示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="character"></param>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public override bool Process(CharacterEntity character, Dictionary <string, string> parameters)
        {
            if (!character.CanGameAction(Action.GameActionTypeEnum.EXCHANGE))
            {
                character.Dispatch(WorldMessage.INFORMATION_MESSAGE(InformationTypeEnum.ERROR, InformationEnum.ERROR_YOU_ARE_AWAY));
                return(false);
            }

            var taxe = character.Bank.Items.GroupBy(item => item.TemplateId).Count();

            if (character.Inventory.Kamas < taxe)
            {
                if (character.Bank.Kamas < taxe)
                {
                    character.Dispatch(WorldMessage.INFORMATION_MESSAGE(InformationTypeEnum.ERROR, InformationEnum.ERROR_NOT_ENOUGH_KAMAS, taxe));
                    return(false);
                }

                character.Bank.SubKamas(taxe);
            }
            else
            {
                character.Inventory.SubKamas(taxe);
            }

            character.CachedBuffer = true;
            character.ExchangeStorage(character.Bank);
            character.Dispatch(WorldMessage.IM_INFO_MESSAGE(InformationEnum.INFO_KAMAS_LOST, taxe));
            character.CachedBuffer = false;

            return(true);
        }
示例#2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="character"></param>
        /// <param name="itemId"></param>
        /// <param name="targetId"></param>
        /// <param name="targetCell"></param>
        /// <param name="parameters"></param>
        public void ApplyEffects(CharacterEntity character, long itemId, long targetId = -1, int targetCell = -1, Dictionary <string, string> parameters = null)
        {
            var item = character.Inventory.GetItem(itemId);

            if (item == null)
            {
                return;
            }

            if (!item.Template.Usable && !item.Template.Buff && !item.Template.Targetable && targetId != -1 && targetCell != -1)
            {
                Logger.Info("ActionEffectManager::Apply non usable/buff/targetable item=" + item.Template.Name + " character=" + character.Name);
                character.Dispatch(WorldMessage.BASIC_NO_OPERATION());
                return;
            }

            if (!item.SatisfyConditions(character))
            {
                character.Dispatch(WorldMessage.INFORMATION_MESSAGE(InformationTypeEnum.ERROR, InformationEnum.ERROR_CONDITIONS_UNSATISFIED));
                return;
            }

            var used = false;

            if (item.StringEffects != string.Empty)
            {
                foreach (var effect in item.Statistics.Effects.Values)
                {
                    if (m_effectById.ContainsKey(effect.EffectType))
                    {
                        used = m_effectById[effect.EffectType].ProcessItem(character, item, effect, targetId, targetCell) ||
                               used;
                    }
                }
            }
            else
            {
                if (m_effectByType.ContainsKey((ItemTypeEnum)item.Template.Type))
                {
                    foreach (var effect in m_effectByType[(ItemTypeEnum)item.Template.Type])
                    {
                        used = effect.ProcessItem(character, item, null, targetId, targetCell) ||
                               used;
                    }
                }
            }

            if (used)
            {
                character.Inventory.RemoveItem(itemId);
            }
            else
            {
                character.Dispatch(WorldMessage.BASIC_NO_OPERATION());
            }
        }
示例#3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="character"></param>
        /// <param name="kick"></param>
        /// <returns></returns>
        public override FightActionResultEnum FightQuit(CharacterEntity character, bool kick = false)
        {
            if (LoopState == FightLoopStateEnum.STATE_WAIT_END || LoopState == FightLoopStateEnum.STATE_ENDED)
            {
                return(FightActionResultEnum.RESULT_NOTHING);
            }

            switch (State)
            {
            case FightStateEnum.STATE_PLACEMENT:
                if (character.IsLeader)
                {
                    foreach (var teamFighter in character.Team.Fighters)
                    {
                        if (base.TryKillFighter(teamFighter, teamFighter, true, true) == FightActionResultEnum.RESULT_END)
                        {
                            return(FightActionResultEnum.RESULT_END);
                        }
                    }

                    return(FightActionResultEnum.RESULT_END);
                }

                character.Fight.Dispatch(WorldMessage.FIGHT_FLAG_UPDATE(OperatorEnum.OPERATOR_REMOVE, character.Team.LeaderId, character));
                character.Fight.Dispatch(WorldMessage.GAME_MAP_INFORMATIONS(OperatorEnum.OPERATOR_REMOVE, character));
                character.EndFight(true);
                character.Dispatch(WorldMessage.FIGHT_LEAVE());

                return(FightActionResultEnum.RESULT_NOTHING);

            case FightStateEnum.STATE_FIGHTING:
                if (character.IsSpectating)
                {
                    character.EndFight(true);
                    character.Dispatch(WorldMessage.FIGHT_LEAVE());

                    return(FightActionResultEnum.RESULT_NOTHING);
                }

                if (TryKillFighter(character, character, true, true) != FightActionResultEnum.RESULT_END)
                {
                    character.EndFight();
                    character.Dispatch(WorldMessage.FIGHT_LEAVE());

                    return(FightActionResultEnum.RESULT_DEATH);
                }

                return(FightActionResultEnum.RESULT_END);
            }

            return(FightActionResultEnum.RESULT_NOTHING);
        }
示例#4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="character"></param>
        /// <returns></returns>
        public bool CanJoinBeforeStart(CharacterEntity character)
        {
            if (LeaderId < 0 && AlignmentId == -1) // cant join taxcollector or monsters
            {
                return(false);
            }

            // No more fighter accepted
            if (FreePlace == null || IsOptionLocked(FightOptionTypeEnum.TYPE_NEW_PLAYER_BIS))
            {
                character.Dispatch(WorldMessage.GAME_ACTION(GameActionTypeEnum.FIGHT_JOIN, character.Id, "f"));
                return(false);
            }

            if (IsOptionLocked(FightOptionTypeEnum.TYPE_PARTY) && character.PartyId != ((CharacterEntity)m_fighters[0]).PartyId)
            {
                character.Dispatch(WorldMessage.GAME_ACTION(GameActionTypeEnum.FIGHT_JOIN, character.Id, "f"));
                return(false);
            }

            // no more place
            if (FreePlace == null)
            {
                character.Dispatch(WorldMessage.GAME_ACTION(GameActionTypeEnum.FIGHT_JOIN, character.Id, "c")); // FULL
                return(false);
            }

            switch (Fight.Type)
            {
            case FightTypeEnum.TYPE_PVT:
                var taxCollector = OpponentTeam.Fighters[0] as TaxCollectorEntity;
                if (taxCollector == null)
                {
                    return(false);
                }

                if (character.GuildMember != null && character.GuildMember.GuildId == taxCollector.Guild.Id)
                {
                    character.Dispatch(WorldMessage.SERVER_ERROR_MESSAGE("You can't take part in a fight against your own TaxCollector."));
                    return(false);
                }
                break;

            case FightTypeEnum.TYPE_PVM:
            case FightTypeEnum.TYPE_AGGRESSION:
                return(AlignmentId <= (int)AlignmentTypeEnum.ALIGNMENT_NEUTRAL || character.AlignmentId == AlignmentId);
            }

            return(true);
        }
示例#5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="character"></param>
        /// <param name="skill"></param>
        private void Harvest(CharacterEntity character, SkillIdEnum skill)
        {
            if (!character.CanGameAction(GameActionTypeEnum.SKILL_HARVEST))
            {
                character.Dispatch(WorldMessage.IM_ERROR_MESSAGE(InformationEnum.ERROR_YOU_ARE_AWAY));
                return;
            }

            if (!IsActive)
            {
                return;
            }

            m_currentJob = character.CharacterJobs.GetJob(skill);
            if (m_currentJob == null)
            {
                return;
            }

            var duration = m_currentJob.HarvestDuration;

            m_quantityFarmed = Util.Next(m_currentJob.HarvestMinQuantity, m_currentJob.HarvestMaxQuantity);

            character.HarvestStart(this, duration);
            m_currentHarvester = character;

            Deactivate();

            m_harvestTimer = base.AddTimer(duration, StopHarvest, true);
        }
 /// <summary>
 ///
 /// </summary>
 /// <param name="character"></param>
 public void SendAuctionOwnerList(CharacterEntity character)
 {
     if (!m_auctionsByAccount.ContainsKey(character.AccountId))
     {
         m_auctionsByAccount.Add(character.AccountId, new List <AuctionEntry>());
     }
     character.Dispatch(WorldMessage.AUCTION_HOUSE_AUCTION_OWNER_LIST(m_auctionsByAccount[character.AccountId]));
 }
示例#7
0
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 public bool CanStartFight(CharacterEntity character)
 {
     if (m_map.FightTeam0Cells.Count == 0 || m_map.FightTeam1Cells.Count == 0)
     {
         character.Dispatch(WorldMessage.SERVER_ERROR_MESSAGE("Unable to start fight withouth fightCells"));
         return(false);
     }
     return(true);
 }
示例#8
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="character"></param>
        public void StartUse(CharacterEntity character)
        {
            if (!character.CanGameAction(GameActionTypeEnum.EXCHANGE))
            {
                character.Dispatch(WorldMessage.INFORMATION_MESSAGE(InformationTypeEnum.ERROR, InformationEnum.ERROR_YOU_ARE_AWAY));
                return;
            }

            character.ExchangeStorage(m_storage);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="character"></param>
        public void SendTemplatesByTypeList(CharacterEntity character, int type)
        {
            var templates = new List <int>();

            if (m_templatesByType.ContainsKey(type))
            {
                templates.AddRange(m_templatesByType[type]);
            }
            character.Dispatch(WorldMessage.AUCTION_HOUSE_TEMPLATE_LIST(type, templates));
        }
示例#10
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="character"></param>
        /// <param name="templateId"></param>
        public void SendCategoriesByTemplate(CharacterEntity character, int templateId)
        {
            var categories = new List <AuctionCategory>();

            if (m_categoriesByTemplate.ContainsKey(templateId))
            {
                categories.AddRange(m_categoriesByTemplate[templateId]);
            }
            character.Dispatch(WorldMessage.AUCTION_HOUSE_AUCTION_LIST(templateId, categories));
        }
示例#11
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public override bool Process(CharacterEntity character, Dictionary <string, string> parameters)
        {
            var addEffect  = EffectEnum.None;
            var effectType = (EffectEnum)int.Parse(parameters["statsId"]);
            var value      = int.Parse(parameters["value"]);

            switch (effectType)
            {
            case EffectEnum.AddVitality:
            case EffectEnum.AddCaractVitality:
                addEffect = EffectEnum.AddVitality;
                character.DatabaseRecord.Vitality += value;
                break;

            case EffectEnum.AddWisdom:
            case EffectEnum.AddCaractWisdom:
                addEffect = EffectEnum.AddWisdom;
                character.DatabaseRecord.Wisdom += value;
                break;

            case EffectEnum.AddIntelligence:
            case EffectEnum.AddCaractIntelligence:
                addEffect = EffectEnum.AddIntelligence;
                character.DatabaseRecord.Intelligence += value;
                break;

            case  EffectEnum.AddStrength:
            case EffectEnum.AddCaractStrength:
                addEffect = EffectEnum.AddStrength;
                character.DatabaseRecord.Strength += value;
                break;

            case EffectEnum.AddAgility:
            case EffectEnum.AddCaractAgility:
                addEffect = EffectEnum.AddAgility;
                character.DatabaseRecord.Agility += value;
                break;

            case EffectEnum.AddChance:
            case EffectEnum.AddCaractChance:
                addEffect = EffectEnum.AddChance;
                character.DatabaseRecord.Chance += value;
                break;
            }

            character.Statistics.AddBase(addEffect, value);

            character.CachedBuffer = true;
            character.SendAccountStats();
            character.Dispatch(WorldMessage.INFORMATION_MESSAGE(InformationTypeEnum.INFO, InformationEnum.INFO_CARACTERISTIC_UPGRADED, value));
            character.CachedBuffer = false;

            return(true);
        }
示例#12
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="character"></param>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public override bool Process(CharacterEntity character, Dictionary <string, string> parameters)
        {
            var experience = long.Parse(parameters["experience"]);

            character.CachedBuffer = true;
            character.AddExperience(experience);
            character.SendAccountStats();
            character.Dispatch(WorldMessage.IM_INFO_MESSAGE(InformationEnum.INFO_EXPERIENCE_GAINED, experience));
            character.CachedBuffer = false;

            return(true);
        }
示例#13
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="character"></param>
 public void Buy(CharacterEntity character)
 {
     if (m_paddock.OnSale)
     {
     }
     else
     {
         // Trying to buy a public or already owned paddock, cheating for sure :)))
         character.Dispatch(WorldMessage.BASIC_NO_OPERATION());
         Logger.Info("PaddockDoor::Buy() trying to buy a free or already owned paddock " + character.Name);
     }
 }
示例#14
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="character"></param>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public override bool Process(CharacterEntity character, Dictionary <string, string> parameters)
        {
            var spellId = int.Parse(parameters["spellId"]);

            if (SpellManager.Instance.GetTemplate(spellId) == null)
            {
                character.Dispatch(WorldMessage.SERVER_ERROR_MESSAGE("Sort inconnu, veuillez porter l'item sur le forum."));
                return(false);
            }

            if (character.SpellBook.HasSpell(spellId))
            {
                character.Dispatch(WorldMessage.IM_ERROR_MESSAGE(InformationEnum.ERROR_UNABLE_LEARN_SPELL, spellId));
                return(false);
            }

            character.SpellBook.AddSpell(spellId);
            character.Dispatch(WorldMessage.SPELLS_LIST(character.SpellBook));

            return(true);
        }
示例#15
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="character"></param>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public override bool Process(CharacterEntity character, Dictionary <string, string> parameters)
        {
            if (!character.CanGameAction(GameActionTypeEnum.MAP_TELEPORT))
            {
                character.Dispatch(WorldMessage.IM_ERROR_MESSAGE(InformationEnum.ERROR_YOU_ARE_AWAY));
                return(false);
            }

            character.Teleport(character.SavedMapId, character.SavedCellId);

            return(true);
        }
示例#16
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="character"></param>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public override bool Process(CharacterEntity character, Dictionary <string, string> parameters)
        {
            var energy = int.Parse(parameters["energy"]);

            character.CachedBuffer = true;
            character.Energy      += energy;
            character.SendAccountStats();
            character.Dispatch(WorldMessage.IM_INFO_MESSAGE(InformationEnum.INFO_ENERGY_RECOVERED, energy));
            character.CachedBuffer = false;

            return(true);
        }
示例#17
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="character"></param>
        /// <param name="itemId"></param>
        public void TryRemove(CharacterEntity character, long itemId)
        {
            Logger.Debug("AuctionHouse::TryRemove itemId=" + itemId);

            if (!m_auctionsByAccount.ContainsKey(character.AccountId))
            {
                character.Dispatch(WorldMessage.OBJECT_MOVE_ERROR());
                return;
            }

            var auction = m_auctionsByAccount[character.AccountId].Find(entry => entry.ItemId == itemId);

            if (auction == null)
            {
                character.Dispatch(WorldMessage.OBJECT_MOVE_ERROR());
                return;
            }

            m_auctionsByAccount[character.AccountId].Remove(auction);
            AuctionCategory category   = null;
            int             i          = 0;
            var             categories = m_categoriesByTemplate[auction.Item.TemplateId];

            while (i < categories.Count && category == null)
            {
                var current = categories[i];
                if (current.Remove(auction))
                {
                    category = current;
                }
            }

            CheckEmptyCategory(category);
            UpdateMiddlePrice(category.TemplateId);

            auction.Remove();
            character.Inventory.AddItem(auction.Item);

            SendAuctionOwnerList(character);
        }
示例#18
0
        private void CheckEnd()
        {
            Done = CurrentStep.Objectives.All(objective => objective.Done(GetAdvancement(objective.Id)));
            if (Done)
            {
                foreach (var action in CurrentStep.ActionsList)
                {
                    ActionEffectManager.Instance.ApplyEffect(m_character, action.Effect, action.Parameters);
                }

                var nextStep = m_template.Steps.FirstOrDefault(s => s.Order > CurrentStep.Order);
                if (nextStep != null)
                {
                    CurrentStepId = nextStep.Id;
                    CurrentStep   = nextStep;
                    m_character.Dispatch(WorldMessage.IM_INFO_MESSAGE(InformationEnum.INFOS_QUEST_UPDATE, Id));
                }
                else
                {
                    m_character.Dispatch(WorldMessage.IM_INFO_MESSAGE(InformationEnum.INFOS_QUEST_END, Id));
                }
            }
        }
示例#19
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="character"></param>
        public void StopHarvest()
        {
            m_currentHarvester.StopAction(GameActionTypeEnum.SKILL_HARVEST);

            var exprienceWin = m_quantityFarmed * Experience;

            m_currentHarvester.CachedBuffer = true;
            m_currentHarvester.Inventory.AddItem(GeneratedTemplate.Create(m_quantityFarmed));
            m_currentHarvester.CharacterJobs.AddExperience(m_currentJob, exprienceWin);
            m_currentHarvester.Dispatch(WorldMessage.INTERACTIVE_FARMED_QUANTITY(m_currentHarvester.Id, m_quantityFarmed));
            m_currentHarvester.CachedBuffer = false;

            base.UpdateFrame(FRAME_FARMING, FRAME_CUT);
            base.AddTimer(Util.Next(MinRespawnTime, MaxRespawnTime), Respawn, true);
        }
示例#20
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="character"></param>
 public void Access(CharacterEntity character)
 {
     if (m_paddock.Public)
     {
         character.ExchangePaddock(m_paddock);
     }
     else if (!m_paddock.OnSale)
     {
         // TODO : if in the same guild and has enough rights
     }
     else
     {
         // Trying to access to an in sale paddock, almost cheating no ?
         character.Dispatch(WorldMessage.BASIC_NO_OPERATION());
     }
 }
示例#21
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="character"></param>
        /// <param name="cellId"></param>
        /// <param name="skillId"></param>
        public void InteractiveExecute(CharacterEntity character, int cellId, int skillId)
        {
            var cell = GetCell(cellId);

            if (cell != null)
            {
                if (cell.InteractiveObject != null)
                {
                    cell.InteractiveObject.UseWithSkill(character, character.CharacterJobs.GetSkill(skillId));
                }
                else
                {
                    character.Dispatch(WorldMessage.SERVER_INFO_MESSAGE("Not implemented yet."));
                }
            }
        }
示例#22
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="character"></param>
        /// <param name="monsterGroup"></param>
        public bool StartMonsterFight(CharacterEntity character, MonsterGroupEntity monsterGroup)
        {
            if (!CanStartFight(character))
            {
                return(false);
            }

            if (!character.CanGameAction(GameActionTypeEnum.FIGHT))
            {
                character.Dispatch(WorldMessage.IM_ERROR_MESSAGE(InformationEnum.ERROR_YOU_ARE_AWAY));
                return(false);
            }

            monsterGroup.StopAction(GameActionTypeEnum.MAP);
            Add(new MonsterFight(m_map, m_fightId++, character, monsterGroup));

            return(true);
        }
示例#23
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="character"></param>
        /// <param name="skill"></param>
        public override void UseWithSkill(CharacterEntity character, JobSkill skill)
        {
            if (!character.Waypoints.Any(waypoint => waypoint.MapId == Map.Id))
            {
                CharacterWaypointRepository.Instance.Create(character.Id, Map.Id);
                character.Dispatch(WorldMessage.INFORMATION_MESSAGE(InformationTypeEnum.INFO, InformationEnum.INFO_WAYPOINT_REGISTERED));
            }

            switch (skill.Id)
            {
            case SkillIdEnum.SKILL_SAUVEGARDER:
                Save(character);
                break;

            case SkillIdEnum.SKILL_UTILISER_ZAAP:
                Use(character);
                break;
            }
        }
示例#24
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="character"></param>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public override bool Process(CharacterEntity character, Dictionary <string, string> parameters)
        {
            if (character.Life == character.MaxLife)
            {
                return(false);
            }

            var heal = int.Parse(parameters["life"]);

            if (character.Life + heal > character.MaxLife)
            {
                heal = character.MaxLife - character.Life;
            }

            character.CachedBuffer = true;
            character.Life        += heal;
            character.SendAccountStats();
            character.Dispatch(WorldMessage.INFORMATION_MESSAGE(InformationTypeEnum.INFO, InformationEnum.INFO_LIFE_RECOVERED, heal));
            character.CachedBuffer = false;

            return(true);
        }
示例#25
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="character"></param>
 /// <param name="skillId"></param>
 public virtual void UseWithSkill(CharacterEntity character, JobSkill skill)
 {
     character.Dispatch(WorldMessage.SERVER_INFO_MESSAGE("Interactive object not yet implemented."));
 }
示例#26
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="character"></param>
        /// <param name="categoryId"></param>
        /// <param name="floorId"></param>
        /// <param name="price"></param>
        public void TryBuy(CharacterEntity character, int categoryId, int floorId, long price)
        {
            Logger.Debug("AuctionHouse::TryBuy categoryId=" + categoryId + " floorId=" + floorId + " price=" + price);

            if (price < 1)
            {
                character.Dispatch(WorldMessage.BASIC_NO_OPERATION());
                return;
            }

            if (character.Inventory.Kamas < price)
            {
                character.Dispatch(WorldMessage.INFORMATION_MESSAGE(InformationTypeEnum.ERROR, InformationEnum.ERROR_NOT_ENOUGH_KAMAS));
                return;
            }

            if (!m_categoryById.ContainsKey(categoryId))
            {
                character.Dispatch(WorldMessage.BASIC_NO_OPERATION());
                return;
            }

            var category = m_categoryById[categoryId];
            var floor    = GetFloorById(floorId);

            if (floor == AuctionCategoryFloorEnum.INVALID)
            {
                character.Dispatch(WorldMessage.BASIC_NO_OPERATION());
                return;
            }
            var auction = category.FirstOrDefault(floor);

            switch (category.Buy(character, floor, price))
            {
            case AuctionBuyResultEnum.ALREADY_SOLD:
                character.Dispatch(WorldMessage.INFORMATION_MESSAGE(InformationTypeEnum.INFO, InformationEnum.INFO_ITEM_ALREADY_SOLD));
                SendCategoriesByTemplate(character, category.TemplateId);
                break;

            case AuctionBuyResultEnum.NOT_ENOUGH_KAMAS:
                character.Dispatch(WorldMessage.INFORMATION_MESSAGE(InformationTypeEnum.ERROR, InformationEnum.ERROR_NOT_ENOUGH_KAMAS));
                break;

            case AuctionBuyResultEnum.SUCCES:
                m_auctionsByAccount[auction.OwnerId].Remove(auction);
                if (!CheckEmptyCategory(category))
                {
                    SendCategoriesByTemplate(character, category.TemplateId);
                }

                UpdateMiddlePrice(category.TemplateId);

                character.Dispatch(WorldMessage.INFORMATION_MESSAGE(InformationTypeEnum.INFO, InformationEnum.INFO_AUCTION_LOT_BOUGHT));

                WorldService.Instance.AddMessage(() =>
                {
                    auction.OwnerBank.AddKamas(price);

                    // check if player online and notify
                    var seller = EntityManager.Instance.GetCharacterByAccount(auction.OwnerId);
                    if (seller != null)
                    {
                        seller.AddMessage(() =>
                        {
                            seller.Dispatch(WorldMessage.INFORMATION_MESSAGE(InformationTypeEnum.INFO, InformationEnum.INFO_AUCTION_BANK_CREDITED, price, auction.Item.TemplateId));
                            if (seller.HasGameAction(GameActionTypeEnum.EXCHANGE))
                            {
                                var action = seller.CurrentAction as GameAuctionHouseSellAction;
                                if (action != null)
                                {
                                    if (action.AuctionExchange.Npc.AuctionHouse.Id == Id)
                                    {
                                        action.AuctionExchange.Npc.AuctionHouse.SendAuctionOwnerList(seller);
                                    }
                                }
                            }
                        });
                    }
                });
                break;

            default:
                character.Dispatch(WorldMessage.BASIC_NO_OPERATION());
                break;
            }
        }
示例#27
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="character"></param>
 public void Save(CharacterEntity character)
 {
     character.SavedMapId  = Map.Id;
     character.SavedCellId = character.CellId;
     character.Dispatch(WorldMessage.INFORMATION_MESSAGE(InformationTypeEnum.INFO, InformationEnum.INFO_WAYPOINT_SAVED));
 }