Esempio n. 1
0
        private void petCast(L2Player player, int npcId, int id, int lv, int maxLv = 1)
        {
            if (player.Summon == null || !(player.Summon is L2Pet))
            {
                player.sendActionFailed();
                return;
            }

            //if (player.Summon.Template.NpcId != npcId)
            //{
            //    player.sendActionFailed();
            //    return;
            //}

            TSkill skill = TSkillTable.getInstance().get(id, lv);

            if (skill != null)
            {
                player.Summon.ChangeTarget(player.CurrentTarget);
                int result = player.Summon.castSkill(skill);
                Console.WriteLine("pet cast result " + result);
            }
            else
            {
                CLogger.error("pet " + npcId + " used null skill " + id + "-" + lv);
            }
        }
Esempio n. 2
0
        protected internal override void use(L2Player admin, string alias)
        {
            //setskill [skill_id] [skill_lvl] -- дает скилл [skill_id] уровня [skill_lvl] выбранному чару
            int id  = int.Parse(alias.Split(' ')[1]);
            int lvl = int.Parse(alias.Split(' ')[2]);

            TSkill skill = TSkillTable.getInstance().get(id, lvl);

            if (skill == null)
            {
                admin.sendMessage("Skill " + id + "/" + lvl + " is missing.");
            }
            else
            {
                L2Player target;
                if (admin.CurrentTarget != null && admin.CurrentTarget is L2Player)
                {
                    target = (L2Player)admin.CurrentTarget;
                }
                else
                {
                    target = admin;
                }

                target.addSkill(skill, true, true);
                admin.sendMessage(target.Name + " has received skill " + id + "/" + lvl);
            }
        }
Esempio n. 3
0
        public void Insert(SkillDTO entityDTO)
        {
            TSkill entity = Builders.
                            GenericBuilder.builderDTOEntity <TSkill, SkillDTO>
                                (entityDTO);

            repository.Save(entity);
        }
Esempio n. 4
0
        public BuffForQuestReward(L2Citizen npc, L2Character target, int skillId)
        {
            this.npc     = npc;
            this.cha     = target;
            this.skillId = skillId;
            skill        = TSkillTable.getInstance().get(skillId);
            cha.broadcastPacket(new MagicSkillUse(npc, cha, skill, skill.skill_hit_time));

            new Thread(Run).Start();
        }
Esempio n. 5
0
        public void Delete(Guid SkillID)
        {
            TSkill dbEntry = context.TSkill
                             .FirstOrDefault(p => p.SkillId == SkillID);

            if (dbEntry != null)
            {
                context.TSkill.Remove(dbEntry);
                context.SaveChanges();
            }
        }
Esempio n. 6
0
        public override bool CanUse(L2Player player, TSkill skill)
        {
            //int len = player.cubics.Count;
            //int max = (int)player.CharacterStat.getStat(TEffectType.p_cubic_mastery);
            //if (max == 0)
            //    max = 1;

            //return !(len + 1 > max);

            return(true);
        }
Esempio n. 7
0
        public IBrainBuilder AddSkill <TSkill>() where TSkill : IBrainSkill, new()
        {
            var skill = new TSkill();

            brain.Skills.Add(skill);
            skill.AssignOrders(order =>
            {
                brain.SkillSelector.AssignSkill(order, skill);
                ((Brain)brain).AddSkillsHelp(order, skill);
            });
            return(this);
        }
Esempio n. 8
0
        public bool calcDebuffSuccess(TSkill skill, L2Character caster)
        {
            bool success = false;

            int rnd = new Random().Next(0, 100);

            success = rnd <= skill.activate_rate;

            caster.sendMessage(skill.skill_id + " success " + rnd + "% (" + skill.activate_rate + "% base)");

            return(success);
        }
Esempio n. 9
0
 public MagicSkillUse(L2Character caster, L2Object target, TSkill skill, int hitTime, int flag = 0)
 {
     _id            = skill.skill_id;
     _level         = skill.level;
     _hitTime       = hitTime;
     _targetId      = target.ObjID;
     _casterId      = caster.ObjID;
     _x             = caster.X;
     _y             = caster.Y;
     _z             = caster.Z;
     tx             = target.X;
     ty             = target.Y;
     tz             = target.Z;
     _damageSuccess = flag;
 }
Esempio n. 10
0
        private void calcEffect(L2Character character)
        {
            if (EffectID != -1)
            {
                TSkill skill = TSkillTable.getInstance().get(EffectID, EffectLv);

                if (skill == null)
                {
                    CLogger.error("ItemHandler: item " + id + " with null effect " + EffectID + "/" + EffectLv);
                    return;
                }

                character.addAbnormal(skill, character, true, false);
                character.broadcastPacket(new MagicSkillUse(character, character, skill, 100));
            }
        }
Esempio n. 11
0
        public override bool CanUse(L2Player player, TSkill skill)
        {
            L2Item item = player.Inventory.getWeapon();

            if (item != null)
            {
                foreach (string mask in allowed)
                {
                    if (mask.Equals(item.Template.WeaponType.ToString()))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Esempio n. 12
0
 public void Save(TSkill skill)
 {
     if (skill.SkillId == Guid.Empty)
     {
         skill.SkillId = Guid.NewGuid();
         context.TSkill.Add(skill);
     }
     else
     {
         TSkill dbEntry = context.TSkill
                          .FirstOrDefault(s => s.SkillId == skill.SkillId);
         if (dbEntry != null)
         {
             dbEntry.SkillNom = skill.SkillNom;
         }
     }
     context.SaveChangesAsync();
 }
Esempio n. 13
0
        public virtual void onTransformStart(L2Player player)
        {
            player.TransformID     = id;
            player.MountType       = MoveMode;
            player.MountedTemplate = NpcTable.getInstance().getNpcTemplate(npcId);
            player.broadcastUserInfo();

            if (_skills != null && _skills.Count > 0)
            {
                foreach (int[] s in _skills)
                {
                    TSkill sk = TSkillTable.getInstance().get(s[0], s[1]);
                    if (sk != null)
                    {
                        player.addSkill(sk, false, false);
                    }
                }

                player.updateSkillList();
            }
        }
Esempio n. 14
0
        public void addMultiSkills(string value)
        {
            if (multiSkills == null)
            {
                multiSkills = new List <TSkill>();
            }

            foreach (string v in value.Split(';'))
            {
                TSkill sk = TSkillTable.getInstance().get(int.Parse(v.Split('-')[0]), int.Parse(v.Split('-')[1]));
                if (sk != null)
                {
                    multiSkills.Add(sk);
                }
            }

            if (multiSkills.Count == 0)
            {
                multiSkills = null;
            }
        }
Esempio n. 15
0
        public void CallSkill(L2Player caster, TSkill skill, L2Character target)
        {
            if (SkillCast == null)
            {
                SkillCast = new System.Timers.Timer();
            }

            this.target = target;
            if (skill.skill_hit_time > 0)
            {
                SkillCast.Interval = skill.skill_hit_time;
                SkillCast.Elapsed += new System.Timers.ElapsedEventHandler(SkillCastTask);
                SkillCast.Enabled  = true;
            }
            else
            {
                SkillCastTask(null, null);
            }

            caster.broadcastPacket(new MagicSkillUse(caster, target, skill, skill.skill_hit_time));
        }
        public override void run()
        {
            L2Player player = getClient().CurrentPlayer;

            if (player._p_block_act == 1)
            {
                player.sendActionFailed();
                return;
            }

            TSkill skill = player.getSkill(_magicId);

            if (skill == null)
            {
                player.sendMessage("no skill found");
                player.sendActionFailed();
                return;
            }

            bool muted = false;

            switch (skill.is_magic)
            {
            case 0:
                muted = player._p_block_skill == 1;
                break;

            case 1:
                muted = player._p_block_spell == 1;
                break;
            }

            if (muted)
            {
                player.sendActionFailed();
                return;
            }

            player.castSkill(skill, _ctrlPressed, _shiftPressed);
        }
Esempio n. 17
0
        private void calcSkill(L2Character character)
        {
            if (SkillID != -1)
            {
                TSkill skill = TSkillTable.getInstance().get(SkillID, SkillLv);

                if (skill == null)
                {
                    CLogger.error("ItemHandler: item " + id + " with null skill " + SkillID + "/" + SkillLv);
                    return;
                }

                if (character is L2Player)
                {
                    ((L2Player)character).castSkill(skill, false, false);
                }
                else
                {
                    character.castSkill(skill);
                }
            }
        }
Esempio n. 18
0
        public void showAvailRegularSkills(L2Player player, bool backward)
        {
            SortedList <int, TAcquireSkill> list;

            if (player.ActiveSkillTree != null)
            {
                list = player.ActiveSkillTree;
            }
            else
            {
                list = new SortedList <int, TAcquireSkill>();
            }

            int nextLvl = 800;

            foreach (TAcquireSkill e in TSkillTable.getInstance().getAllRegularSkills(player.ActiveClass.ClassId.Id).skills)
            {
                if (e.get_lv > player.Level)
                {
                    if (nextLvl > e.get_lv)
                    {
                        nextLvl = e.get_lv;
                    }
                    continue;
                }

                if (list.ContainsKey(e.id))
                {
                    continue;
                }

                if (player._skills.ContainsKey(e.id))
                {
                    TSkill skill = player._skills[e.id];

                    if (skill.level >= e.lv)
                    {
                        continue;
                    }

                    if (!list.ContainsKey(e.id))
                    {
                        list.Add(e.id, e);
                        break;
                    }
                }
                else
                {
                    list.Add(e.id, e);
                }
            }

            if (list.Count == 0)
            {
                if (backward)
                {
                    list.Clear();
                    player.ActiveSkillTree = list;
                    player.sendPacket(new AcquireSkillList(AcquireSkillList.ESTT_NORMAL, player));
                }

                if (nextLvl != 800)
                {
                    //You do not have any further skills to learn.  Come back when you have reached Level $s1.
                    player.sendPacket(new SystemMessage(607).addNumber(nextLvl));
                }
                else
                {
                    //There are no other skills to learn.
                    player.sendSystemMessage(750);
                }

                player.sendActionFailed();
                return;
            }

            player.ActiveSkillTree = list;
            player.sendPacket(new AcquireSkillList(AcquireSkillList.ESTT_NORMAL, player));
            player.FolkNpc = this;
        }
Esempio n. 19
0
        public override void run()
        {
            L2Player player = getClient().CurrentPlayer;

            SortedList <int, TAcquireSkill> seq = player.ActiveSkillTree;

            if (seq == null || !seq.ContainsKey(_id))
            {
                player.sendActionFailed();
                return;
            }

            TAcquireSkill e = seq[_id];

            if (e.lv != _level)
            {
                player.sendActionFailed();
                return;
            }

            if (e.lv_up_sp > player.SP)
            {
                player.sendSystemMessage(278); //You do not have enough SP to learn this skill.
                player.sendActionFailed();
                return;
            }

            if (e.itemid > 0)
            {
                if (!player.hasItem(e.itemid, e.itemcount))
                {
                    player.sendSystemMessage(276); //You do not have the necessary materials or prerequisites to learn this skill.
                    player.sendActionFailed();
                    return;
                }
            }

            if (e.lv_up_sp > 0)
            {
                player.SP -= e.lv_up_sp;
                StatusUpdate su = new StatusUpdate(player.ObjID);
                su.add(StatusUpdate.SP, player.SP);
                player.sendPacket(su);
            }

            player.Inventory.destroyItem(e.itemid, e.itemcount, true, true);

            TSkill skill = TSkillTable.getInstance().get(e.id, e.lv);

            if (skill != null)
            {
                player.addSkill(skill, true, true);
            }
            else
            {
                player.sendMessage("failed to learn null skill");
                player.sendActionFailed();
                return;
            }

            if (_level > 1)
            {
                bool upd = false;
                lock (player._shortcuts)
                {
                    foreach (L2Shortcut sc in player._shortcuts)
                    {
                        if (sc.Type == L2Shortcut.TYPE_SKILL && sc.Id == _id)
                        {
                            sc.Level = _level;
                            upd      = true;
                        }
                    }
                }

                if (upd)
                {
                    player.sendPacket(new ShortCutInit(player));
                }
            }

            player.ActiveSkillTree.Remove(_id);
            player.FolkNpc.showAvailRegularSkills(player, true);
        }
Esempio n. 20
0
 public virtual void onCast(L2Player player, TSkill skill, int stage)
 {
 }
Esempio n. 21
0
        public override void run()
        {
            L2Player player = getClient().CurrentPlayer;

            if (player._p_block_act == 1)
            {
                player.sendActionFailed();
                return;
            }

            L2Item item = player.getItemByObjId(sID);

            if (item == null)
            {
                player.sendSystemMessage(352); //Incorrect item.
                return;
            }

            if (player.TradeState != 0)
            {
                player.sendSystemMessage(149); //You cannot pick up or use items while trading.
                player.sendActionFailed();
                return;
            }

            switch (item.Template.Type)
            {
            case ItemTemplate.L2ItemType.armor:
            case ItemTemplate.L2ItemType.weapon:
            case ItemTemplate.L2ItemType.accessary:
            {
                if (item._isEquipped == 0)
                {
                    if (!item.Template.canEquipChaotic(player.PkKills))
                    {
                        //You are unable to equip this item when your PK count is greater than or equal to one.
                        player.sendSystemMessage(1685);
                        player.sendActionFailed();
                        return;
                    }

                    if (!item.Template.canEquipHeroic(player.Heroic) ||
                        !item.Template.canEquipNobless(player.Noblesse) ||
                        !item.Template.canEquipSex(player.Sex))
                    {
                        //You do not meet the required condition to equip that item.
                        player.sendSystemMessage(1518);
                        player.sendActionFailed();
                        return;
                    }
                }

                int pdollId = player.Inventory.getPaperdollId(item.Template);
                player.setPaperdoll(pdollId, item._isEquipped == 1 ? null : item, true);
                player.broadcastUserInfo();
            }
            break;
            }

            if (ItemHandler.getInstance().Process(player, item))
            {
                return;
            }

            switch (item.Template.default_action)
            {
            case "action_capsule":
                Capsule.getInstance().Process(player, item);
                break;

            case "action_call_skill":
            {
                TSkill skill = item.Template.item_skill;
                if (skill != null)
                {
                    player.addEffect(player, skill, true, false);
                }
                else
                {
                    player.sendMessage("skill onCall was not found.");
                }
            }
            break;
            }

            //switch (item.Template._actionType)
            //{
            //    case ItemTemplate.L2ItemActionType.action_show_html:
            //        player.sendPacket(new NpcHtmlMessage(player, item.Template._htmFile, player.ObjID, item.Template.ItemID));
            //        break;
            //    case ItemTemplate.L2ItemActionType.action_recipe:
            //        {
            //            bool next = false;

            //            int cur0 = player.ItemLimit_RecipeDwarven, cur1 = player.ItemLimit_Warehouse;
            //            if (player._recipeBook != null)
            //            {
            //                foreach (L2Recipe rec in player._recipeBook)
            //                {
            //                    if (rec._item_id == item.Template.ItemID)
            //                    {
            //                        //That recipe is already registered.
            //                        player.sendSystemMessage(840);
            //                        player.sendActionFailed();
            //                        return;
            //                    }

            //                    if(rec._iscommonrecipe == 0)
            //                        cur0--;
            //                    else
            //                        cur1--;
            //                }
            //            }

            //            L2Recipe newr = RecipeTable.getInstance().getByItemId(item.Template.ItemID);

            //            if (newr._iscommonrecipe == 0)
            //                next = player.p_create_item >= newr._level;
            //            else
            //                next = player.p_create_common_item >= newr._level;

            //            if (!next)
            //            {
            //                //Your Create Item level is too low to register this recipe.
            //                player.sendSystemMessage(404);
            //                player.sendActionFailed();
            //                return;
            //            }

            //            next = true;

            //            if (newr._iscommonrecipe == 0)
            //                next = cur0 > 0;
            //            else
            //                next = cur1 > 0;

            //            if (!next)
            //            {
            //                //No further recipes may be registered.
            //                player.sendSystemMessage(841);
            //                player.sendActionFailed();
            //                return;
            //            }

            //            player.registerRecipe(newr, true, false);
            //            player.Inventory.destroyItem(item, 1, true, true);
            //        }
            //        break;
            //}
        }
Esempio n. 22
0
 public void addItemEnch4(string value)
 {
     item_skill_ench4 = TSkillTable.getInstance().get(int.Parse(value.Split('-')[0]), int.Parse(value.Split('-')[1]));
 }
Esempio n. 23
0
 public void setUnequipSkill(string value)
 {
     unequip_skill = TSkillTable.getInstance().get(int.Parse(value.Split('-')[0]), int.Parse(value.Split('-')[1]));
 }
Esempio n. 24
0
 public virtual void addAbnormal(TSkill skill, L2Character caster, bool permanent, bool unlim)
 {
 }
Esempio n. 25
0
        private short useBuff(int reply, L2Player player)
        {
            int id = 0, lvl = 1;

            switch (reply)  // id * 65536 + level
            {
            case 285540353: //Ускорение Ур.1
                id = 4357;
                break;

            case 285540354:    //Ускорение Ур.2
                id = 4357; lvl = 2;
                break;

            case 284557313:    //Легкая Походка Ур.1
                id = 4342;
                break;

            case 284557314:    //Легкая Походка Lv.2
                id = 4342; lvl = 2;
                break;

            case 284622849:    //Легкость Ур.1
                id = 4343;
                break;

            case 284622851:    //Легкость Lv.3
                id = 4343; lvl = 3;
                break;

            case 284688385:    //Щит Ур.1
                id = 4344;
                break;

            case 284688387:    //Щит Ур. 3
                id = 4344; lvl = 3;
                break;

            case 284819457:    //Ментальный Щит Ур.1
                id = 4346;
                break;

            case 284819460:    //Ментальный Щит Ур.4
                id = 4346; lvl = 4;
                break;

            case 284753921:    //Могущество Ур.1
                id = 4345;
                break;

            case 284753923:    //Могущество Ур.3
                id = 4345; lvl = 3;
                break;

            case 284884994:    //Благословение Тела Ур.2
                id = 4347; lvl = 2;
                break;

            case 284884998:    //Благословенное Тело Ур.6
                id = 4347; lvl = 6;
                break;

            case 285016065:    //Магический Барьер Ур.1
                id = 4349;
                break;

            case 285016066:    //Магический Барьер Ур.2
                id = 4349; lvl = 2;
                break;

            case 285081601:    //Сопротивление Оглушению Ур.1
                id = 4350;
                break;

            case 285081604:    //Сопротивление Оглушению Ур.4
                id = 4350; lvl = 4;
                break;

            case 284950530:    //Благословение Души Ур.2
                id = 4348; lvl = 2;
                break;

            case 284950534:    //Благословенная Душа Ур.6
                id = 4348; lvl = 6;
                break;

            case 285147138:    //Концентрация Ур.2
                id = 4351; lvl = 2;
                break;

            case 285147142:    //Концентрация Ур.6
                id = 4351; lvl = 6;
                break;

            case 285212673:    //Дух Берсерка Ур.1
                id = 4352;
                break;

            case 285212674:    //Дух Берсерка Ур.2
                id = 4352; lvl = 2;
                break;

            case 285278210:    //Благословленный Щит Ур.2
                id = 4353; lvl = 2;
                break;

            case 285278214:    //Благословенный Щит Ур.6
                id = 4353; lvl = 6;
                break;

            case 285605889:    //Наведение Ур.1
                id = 4358;
                break;

            case 285605891:    //Наведение Ур.3
                id = 4358; lvl = 3;
                break;

            case 285343745:    //Ярость Вампира Ур. 1
                id = 4354;
                break;

            case 285343748:    //Ярость Вампира Ур.4
                id = 4354; lvl = 4;
                break;

            case 285409281:    //Проницательность Ур.1
                id = 4355;
                break;

            case 285409283:    //Проницательность Ур.3
                id = 4355; lvl = 3;
                break;

            case 285474817:    //Благо Ур.1
                id = 4356;
                break;

            case 285474819:    //Благо Ур.3
                id = 4356; lvl = 3;
                break;

            case 285671425:    //Фокусировка Ур.1
                id = 4359;
                break;

            case 285671427:    //Фокусировка Ур.3
                id = 4359; lvl = 3;
                break;

            case 285736961:    //Шепот Смерти Ур.1
                id = 4360;
                break;

            case 285736963:    //Шепот Смерти Ур.3
                id = 4360; lvl = 3;
                break;
            }

            if (id == 0)
            {
                CLogger.error("hideout manager has invalid buff request " + reply);
                return(1);
            }

            TSkill skill = TSkillTable.getInstance().get(id, lvl);

            if (skill == null)
            {
                CLogger.error("hideout manager has null buff skill " + id + "-" + lvl);
                return(1);
            }

            this.ChangeTarget(player);
            return((short)this.castSkill(skill));


            //  CurMP -= (skill.MpConsume1 + skill.MpConsume2);
            // player.addEffect(this, skill, player, true, false);
            //  return 5;
        }
Esempio n. 26
0
 public IActionResult Put(Guid SkillId, [FromBody] TSkill proyecto)
 {
     proyecto.SkillId = SkillId;
     repository.Save(proyecto);
     return(Ok(true));
 }
Esempio n. 27
0
 public IActionResult Post([FromBody] TSkill proyecto)
 {
     repository.Save(proyecto);
     return(Ok(true));
 }
Esempio n. 28
0
        protected internal override void use(L2Player admin, string alias)
        {
            if (!(admin.CurrentTarget is L2Player))
            {
                admin.sendMessage("target is not a player.");
                return;
            }

            L2Player            target = admin.CurrentTarget as L2Player;
            TAcquireSkillsEntry skills = TSkillTable.getInstance().getAllRegularSkills(target.ActiveClass.ClassId.Id);

            SortedList <int, TAcquireSkill> avail  = new SortedList <int, TAcquireSkill>();
            Dictionary <int, int>           updDel = new Dictionary <int, int>();

            int nextLvl = 800;

            foreach (TAcquireSkill e in skills.skills)
            {
                if (e.get_lv > target.Level)
                {
                    if (nextLvl > e.get_lv)
                    {
                        nextLvl = e.get_lv;
                    }
                    continue;
                }

                if (avail.ContainsKey(e.id))
                {
                    continue;
                }

                if (target._skills.ContainsKey(e.id))
                {
                    TSkill skill = target._skills[e.id];

                    if (skill.level >= e.lv)
                    {
                        continue;
                    }

                    if (!avail.ContainsKey(e.id))
                    {
                        avail.Add(e.id, e);
                        updDel.Add(e.id, e.lv);
                        break;
                    }
                }
                else
                {
                    avail.Add(e.id, e);
                }
            }

            //foreach (int a in updDel.Keys)
            //    target.removeSkill(a, true, false);
            //updDel.Clear();

            foreach (TAcquireSkill sk in avail.Values)
            {
                TSkill skill = TSkillTable.getInstance().get(sk.id, sk.lv);
                if (skill != null)
                {
                    target.addSkill(skill, false, false);
                }
                else
                {
                    target.sendMessage("no skill #" + sk.id + "-" + sk.lv);
                }
            }

            target.ActiveSkillTree = avail;
            target.sendPacket(new AcquireSkillList(0, target));

            target.updateSkillList();
            target.sendMessage("gor all skills [" + skills.skills.Count + "][" + avail.Count + "] for lv" + target.Level + ", class @" + target.ActiveClass.ClassId.Id.ToString());
        }