Пример #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="character"></param>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public override bool Process(Entity.CharacterEntity character, Dictionary <string, string> parameters)
        {
            var jobId = int.Parse(parameters["jobId"]);

            var jobTemplate = JobManager.Instance.GetById(jobId);

            if (jobTemplate == null)
            {
                character.Dispatch(WorldMessage.SERVER_ERROR_MESSAGE("Metier inconnu, veuillez reporter l'item sur le forum."));
                return(false);
            }

            if (character.CharacterJobs.HasJob(jobId))
            {
                character.Dispatch(WorldMessage.IM_ERROR_MESSAGE(InformationEnum.ERROR_ALREADY_JOB));
                return(false);
            }

            if (character.CharacterJobs.BaseJobCount > 2)
            {
                character.Dispatch(WorldMessage.IM_ERROR_MESSAGE(InformationEnum.ERROR_TOO_MUCH_JOB));
                return(false);
            }

            character.CachedBuffer = true;
            character.CharacterJobs.LearnJob(jobId);
            character.Dispatch(WorldMessage.JOB_SKILL(character.CharacterJobs));
            character.Dispatch(WorldMessage.JOB_XP(character.CharacterJobs.Jobs));
            character.Dispatch(WorldMessage.IM_INFO_MESSAGE(InformationEnum.INFO_JOB_LEARNT, jobId));
            character.CachedBuffer = false;

            return(true);
        }
Пример #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="character"></param>
 /// <param name="item"></param>
 /// <param name="effect"></param>
 /// <param name="targetId"></param>
 /// <param name="targetCell"></param>
 /// <returns></returns>
 public override bool ProcessItem(Entity.CharacterEntity character, Database.Structure.ItemDAO item, Stats.GenericEffect effect, long targetId, int targetCell)
 {
     return(Process(character, new Dictionary <string, string>()
     {
         { "alignmentId", effect.Value1.ToString() }
     }));
 }
Пример #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="character"></param>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public override bool Process(Entity.CharacterEntity character, Dictionary <string, string> parameters)
        {
            var alignmentId = int.Parse(parameters["alignmentId"]);

            character.SetAlignment(alignmentId);

            return(true);
        }
Пример #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="character"></param>
        /// <param name="level"></param>
        /// <returns></returns>
        public override bool Usable(Entity.CharacterEntity character, int level)
        {
            var weapon   = character.Inventory.Items.Find(item => item.Slot == Database.Structure.ItemSlotEnum.SLOT_WEAPON);
            var weaponId = -1;

            if (weapon != null)
            {
                weaponId = weapon.TemplateId;
            }
            return(RequiredLevel <= level && (Tools.Count == 0 || Tools.Contains(weaponId)));
        }
Пример #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="character"></param>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public override bool Process(Entity.CharacterEntity character, Dictionary <string, string> parameters)
        {
            var kamas = long.Parse(parameters["kamas"]);

            character.CachedBuffer = true;
            character.Inventory.AddKamas(kamas);
            character.Dispatch(WorldMessage.IM_INFO_MESSAGE(InformationEnum.INFO_KAMAS_WON, kamas));
            character.CachedBuffer = false;

            return(true);
        }
Пример #6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="character"></param>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public override bool Process(Entity.CharacterEntity character, Dictionary <string, string> parameters)
        {
            character.SpellBook.Spells.ForEach(spell => spell.Level = 1);
            character.SpellPoint = character.Level - 1;

            character.CachedBuffer = true;
            character.SendAccountStats();
            character.Dispatch(WorldMessage.SPELLS_LIST(character.SpellBook));
            character.CachedBuffer = false;

            return(true);
        }
Пример #7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="character"></param>
        /// <param name="item"></param>
        /// <param name="effect"></param>
        /// <param name="targetId"></param>
        /// <param name="targetCell"></param>
        /// <returns></returns>
        public override bool ProcessItem(Entity.CharacterEntity character, Database.Structure.ItemDAO item, Stats.GenericEffect effect, long targetId, int targetCell)
        {
            // Unknown
            if (!WorldConfig.BOOST_ITEMS.ContainsKey(item.TemplateId))
            {
                return(false);
            }

            return(Process(character, new Dictionary <string, string>()
            {
                { "itemId", WorldConfig.BOOST_ITEMS[item.TemplateId].ToString() }
            }));
        }
Пример #8
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="character"></param>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public override bool Process(Entity.CharacterEntity character, Dictionary <string, string> parameters)
        {
            if (!character.CanGameAction(Action.GameActionTypeEnum.GUILD_CREATE))
            {
                character.Dispatch(WorldMessage.IM_ERROR_MESSAGE(InformationEnum.ERROR_YOU_ARE_AWAY));

                return(false);
            }

            character.GuildCreationOpen();

            return(true);
        }
Пример #9
0
        public void Init(Entity.CharacterEntity entity)
        {
            var com = Instantiate(entity.CharacterComponent, this.transform);

            com.HoppingObjectSetActive = true;

            com.Animator.SetLayerWeight(1, 1);

            _parameter.SetComponent("HoppingSkin", com.HoppingSkin);

            _animator = com.Animator;

            _arborFSM.Play();
        }
Пример #10
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="character"></param>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public override bool Process(Entity.CharacterEntity character, Dictionary <string, string> parameters)
        {
            var templateId = int.Parse(parameters["templateId"]);

            var item = character.Inventory.Items.Find(entry => entry.TemplateId == templateId);

            if (item == null)
            {
                return(false);
            }

            character.Inventory.RemoveItem(item.Id);

            return(true);
        }
Пример #11
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="character"></param>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public override bool Process(Entity.CharacterEntity character, Dictionary <string, string> parameters)
        {
            var gradeId = int.Parse(parameters["gradeId"]);
            var grade   = MonsterGradeRepository.Instance.GetById(gradeId);

            if (grade == null)
            {
                character.Dispatch(WorldMessage.SERVER_INFO_MESSAGE("Unknow monster grade, cannot start the fight."));
                return(false);
            }

            return(character.Map.StartMonsterFight(character, new List <MonsterGradeDAO>()
            {
                grade
            }));
        }
Пример #12
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="character"></param>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public override bool Process(Entity.CharacterEntity character, Dictionary <string, string> parameters)
        {
            var itemId   = int.Parse(parameters["itemId"]);
            var template = ItemTemplateRepository.Instance.GetById(itemId);

            if (template == null)
            {
                return(false);
            }

            character.CachedBuffer = true;
            character.Inventory.AddItem(template.Create());
            character.Dispatch(WorldMessage.SERVER_INFO_MESSAGE("Item " + template.Name + " added in your inventory."));
            character.CachedBuffer = false;

            return(true);
        }
Пример #13
0
        /// <summary>
        /// SHOULD NEVER BE CALLED EXCEPT IF WE CREATE A NEW ITEM WITH THIS EFFECT
        /// </summary>
        /// <param name="character"></param>
        /// <param name="item"></param>
        /// <param name="effect"></param>
        /// <param name="targetId"></param>
        /// <param name="targetCell"></param>
        /// <returns></returns>
        public override bool ProcessItem(Entity.CharacterEntity character, Database.Structure.ItemDAO item, Stats.GenericEffect effect, long targetId, int targetCell)
        {
            var monster = MonsterRepository.Instance.GetById(effect.Value2);

            if (monster == null)
            {
                return(false);
            }

            if (!monster.Grades.Any())
            {
                return(false);
            }

            var grade = monster.Grades.ElementAt(Util.Next(0, monster.Grades.Count()));

            return(Process(character, new Dictionary <string, string> {
                { "gradeId", grade.Id.ToString() }
            }));
        }
Пример #14
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="character"></param>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public override bool Process(Entity.CharacterEntity character, Dictionary <string, string> parameters)
        {
            character.CachedBuffer = true;
            character.CaractPoint  = (character.Level - 1) * 5;
            character.Statistics.AddBase(EffectEnum.AddVitality, -character.DatabaseRecord.Vitality);
            character.Statistics.AddBase(EffectEnum.AddWisdom, -character.DatabaseRecord.Wisdom);
            character.Statistics.AddBase(EffectEnum.AddIntelligence, -character.DatabaseRecord.Intelligence);
            character.Statistics.AddBase(EffectEnum.AddStrength, -character.DatabaseRecord.Strength);
            character.Statistics.AddBase(EffectEnum.AddAgility, -character.DatabaseRecord.Agility);
            character.Statistics.AddBase(EffectEnum.AddChance, -character.DatabaseRecord.Chance);
            character.DatabaseRecord.Vitality     = 0;
            character.DatabaseRecord.Wisdom       = 0;
            character.DatabaseRecord.Intelligence = 0;
            character.DatabaseRecord.Strength     = 0;
            character.DatabaseRecord.Agility      = 0;
            character.DatabaseRecord.Chance       = 0;
            character.SendAccountStats();
            character.CachedBuffer = false;

            return(true);
        }
Пример #15
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="character"></param>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public override bool Process(Entity.CharacterEntity character, Dictionary <string, string> parameters)
        {
            var mapId  = int.Parse(parameters["mapId"]);
            var cellId = int.Parse(parameters["cellId"]);

            // Not on map, maybe offline teleport or end fight teleport.
            if (!character.HasGameAction(GameActionTypeEnum.MAP) && character.CurrentAction == null)
            {
                character.MapId  = mapId;
                character.CellId = cellId;

                return(true);
            }

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

            character.Teleport(mapId, cellId);

            return(true);
        }
Пример #16
0
 /// <summary>
 /// SHOULD NEVER BE CALLED EXCEPT IF WE CREATE A NEW ITEM WITH THAT ACTION
 /// </summary>
 /// <param name="character"></param>
 /// <param name="item"></param>
 /// <param name="effect"></param>
 /// <param name="targetId"></param>
 /// <param name="targetCell"></param>
 /// <returns></returns>
 public override bool ProcessItem(Entity.CharacterEntity character, Database.Structure.ItemDAO item, Stats.GenericEffect effect, long targetId, int targetCell)
 {
     throw new NotImplementedException();
 }
Пример #17
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="character"></param>
 /// <param name="item"></param>
 /// <param name="effect"></param>
 /// <param name="targetId"></param>
 /// <param name="targetCell"></param>
 /// <returns></returns>
 public override bool ProcessItem(Entity.CharacterEntity character, Database.Structure.ItemDAO item, Stats.GenericEffect effect, long targetId, int targetCell)
 {
     return(Process(character, new Dictionary <string, string> {
         { "kamas", effect.RandomJet.ToString() }
     }));
 }
Пример #18
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="character"></param>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public override bool Process(Entity.CharacterEntity character, Dictionary <string, string> parameters)
        {
            var itemId   = int.Parse(parameters["itemId"]);
            var template = ItemTemplateRepository.Instance.GetById(itemId);

            if (template == null)
            {
                return(false);
            }

            ItemSlotEnum slot = ItemSlotEnum.SLOT_INVENTORY;

            switch ((ItemTypeEnum)template.Type)
            {
            case ItemTypeEnum.TYPE_TRANSFORM:
                slot = ItemSlotEnum.SLOT_BOOST_MUTATION;
                break;

            case ItemTypeEnum.TYPE_PERSO_SUIVEUR:
                slot = ItemSlotEnum.SLOT_BOOST_FOLLOWER;
                break;

            case ItemTypeEnum.TYPE_BENEDICTION:
                if (character.Inventory.Items.Any(entry => entry.Slot == ItemSlotEnum.SLOT_BOOST_BENEDICTION))
                {
                    slot = ItemSlotEnum.SLOT_BOOST_BENEDICTION_1;
                }
                else
                {
                    slot = ItemSlotEnum.SLOT_BOOST_BENEDICTION;
                }
                break;

            case ItemTypeEnum.TYPE_MALEDICTION:
                if (character.Inventory.Items.Any(entry => entry.Slot == ItemSlotEnum.SLOT_BOOST_MALEDICTION))
                {
                    slot = ItemSlotEnum.SLOT_BOOST_MALEDICTION_1;
                }
                else
                {
                    slot = ItemSlotEnum.SLOT_BOOST_MALEDICTION;
                }
                break;

            case ItemTypeEnum.TYPE_RP_BUFF:
                slot = ItemSlotEnum.SLOT_BOOST_ROLEPLAY_BUFF;
                break;

            case ItemTypeEnum.TYPE_BOOST_FOOD:
                slot = ItemSlotEnum.SLOT_BOOST_FOOD;
                break;
            }

            if (character.Inventory.Items.Any(entry => entry.Slot == slot || entry.TemplateId == itemId))
            {
                character.Dispatch(WorldMessage.IM_ERROR_MESSAGE(InformationEnum.ERROR_CONDITIONS_UNSATISFIED));
                return(false);
            }

            var item = template.Create(1, slot);

            character.CachedBuffer = true;
            character.Statistics.Merge(StatsType.TYPE_BOOST, item.Statistics);
            character.Inventory.AddItem(item);
            character.SendAccountStats();
            character.CachedBuffer = false;

            return(true);
        }
Пример #19
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="character"></param>
 /// <param name="item"></param>
 /// <param name="effect"></param>
 /// <param name="targetId"></param>
 /// <param name="targetCell"></param>
 /// <returns></returns>
 public override bool ProcessItem(Entity.CharacterEntity character, Database.Structure.ItemDAO item, Stats.GenericEffect effect, long targetId, int targetCell)
 {
     return(Process(character, null));
 }