예제 #1
0
 private void ShurikenAbility(RealmTime time, Item item, Position target, USEITEM pkt)
 {
     if (!ninjaShoot)
     {
         ApplyConditionEffect(new ConditionEffect
         {
             Effect     = ConditionEffectIndex.Speedy,
             DurationMS = -1
         });
         ninjaFreeTimer = true;
         ninjaShoot     = true;
     }
     else
     {
         ApplyConditionEffect(new ConditionEffect
         {
             Effect     = ConditionEffectIndex.Speedy,
             DurationMS = 0
         });
         ushort obj;
         Manager.GameData.IdToObjectType.TryGetValue(item.ObjectId, out obj);
         if (Mp >= item.MpEndCost)
         {
             Shoot(time, item, pkt.ItemUsePos);
             Mp -= (int)item.MpEndCost;
         }
         targetlink = target;
         ninjaShoot = false;
     }
 }
예제 #2
0
 private bool CheatEngineDetect(Item item, USEITEM pkt)
 {
     log.FatalFormat("Cheat engine detected for player {0},\nItem should be {1}, but its {2}.",
                     Name, Inventory[pkt.SlotObject.SlotId].ObjectId, item.ObjectId);
     foreach (Player player in Owner?.Players.Values)
     {
         if (player?.Client.Account.Rank >= 2)
         {
             player.SendInfo(string.Format("Cheat engine detected for player {0},\nItem should be {1}, but its {2}.",
                                           Name, Inventory[pkt.SlotObject.SlotId].ObjectId, item.ObjectId));
         }
     }
     Client?.Disconnect(DisconnectReason.CHEAT_ENGINE_DETECTED);
     return(true);
 }
예제 #3
0
        public void setItem(string item_name, int num, bool direct = false, bool loadcall = false, bool sub_add = true)
        {
            int num2 = this.SeetNametoNo("02Items");
            int num3 = this.SeetNametoNo("00system");

            if (num2 < 0)
            {
                return;
            }

            if (item_name.Contains("Mantra") && !item_name.Equals("Mantra"))
            {
                this.setFlagData(num2, item_name, (short)num);
                return;
            }

            if (item_name == "Whip")
            {
                if (num == 1)
                {
                    this.playerst.setMainWeaponNum(MAINWEAPON.MWIHP, 0);
                    this.haveMainWeapon(MAINWEAPON.MWIHP, false);
                    this.playerst.setMainWeaponNum(MAINWEAPON.HWHIP, 0);
                    this.haveMainWeapon(MAINWEAPON.HWHIP, false);
                }
                else if (num == 2)
                {
                    item_name = "Whip2";
                    num       = 1;
                    this.playerst.setMainWeaponNum(MAINWEAPON.HWHIP, 0);
                    this.haveMainWeapon(MAINWEAPON.HWHIP, false);
                }
                else if (num == 3)
                {
                    item_name = "Whip3";
                    num       = 1;
                }
            }
            if (num == 0)
            {
                return;
            }
            if (item_name == "Weight")
            {
                if (direct)
                {
                    this.playerst.setWait(num);
                }
                else
                {
                    this.playerst.addWait(num);
                }
                return;
            }
            if (item_name == "Gold Bangle")
            {
                this.playerst.setMaxCoin(2000);
                this.playerst.setCoin(this.playerst.getCoin());
            }
            if (item_name == "Gold")
            {
                if (direct)
                {
                    this.playerst.setCoin(num);
                }
                else
                {
                    this.playerst.addCoin(num);
                }
                return;
            }
            if (item_name == "Soul")
            {
                if (direct)
                {
                    this.playerst.setExp(num);
                }
                else
                {
                    this.playerst.addExp(num);
                }
            }
            else if (item_name == "Sacred Orb")
            {
                if (direct)
                {
                    this.playerst.setPLayerLevel(num);
                }
                else
                {
                    this.playerst.setPLayerLevel(this.playerst.getPlayerLevel() + 1);
                }
            }
            else
            {
                if (this.isAnkJewel(item_name))
                {
                    this.setFlagData(num2, item_name, (short)num);
                    short num4 = 0;
                    if (!direct)
                    {
                        this.getFlag(num3, "A_Jewel", ref num4);
                        num += (int)num4;
                    }
                    this.setFlagData(num3, "A_Jewel", (short)num);
                    item_name = "A_Jewel";
                    goto IL_3BF;
                }
                if (item_name == "Ankh Jewel")
                {
                    short num5 = 0;
                    if (!direct)
                    {
                        this.getFlag(num3, "A_Jewel", ref num5);
                        num += (int)num5;
                    }
                    this.setFlagData(num3, "A_Jewel", (short)num);
                    goto IL_3BF;
                }
                if (item_name == "A_Jewel")
                {
                    short num6 = 0;
                    if (!direct)
                    {
                        this.getFlag(num3, "A_Jewel", ref num6);
                        num += (int)num6;
                    }
                    this.setFlagData(num3, "A_Jewel", (short)num);
                    goto IL_3BF;
                }
                if (item_name == "pistolBox")
                {
                    goto IL_3BF;
                }
                if (item_name == "Pepper")
                {
                    if (!direct)
                    {
                        this.setFlagData(num3, "Pepper-b", 10);
                    }
                }
                else if (L2SystemCore.getItemData(item_name).isEquipableItem())
                {
                    if (!L2SystemCore.getItemData(item_name).isSoftWare())
                    {
                        if (L2SystemCore.getItemData(item_name).isForceEquipItem())
                        {
                            if (!direct)
                            {
                                this.equipItem(item_name, true);
                            }
                            if (this.getPlayer() != null)
                            {
                                this.getPlayer().checkEquipItem();
                            }
                        }
                    }
                    else if (item_name == "Xelputter" && !loadcall)
                    {
                        for (int i = 0; i < 1; i++)
                        {
                            int[] softLiveData = this.getSoftLiveData(i);
                            for (int j = 0; j < softLiveData.Length; j++)
                            {
                                if (softLiveData[j] == -1)
                                {
                                    softLiveData[j] = 0;
                                    this.setSoftLive(i, ItemDatabaseSystem.ItemNames.Xelputter, true);
                                    break;
                                }
                            }
                        }
                    }
                }
            }
            if (direct)
            {
                if (item_name == "Shield1")
                {
                    this.setFlagData(num2, "Shield", 1);
                }
                else if (item_name == "Shield2")
                {
                    this.setFlagData(num2, "Shield", 2);
                }
                else if (item_name == "Shield3")
                {
                    this.setFlagData(num2, "Shield", 3);
                }
                else
                {
                    this.setFlagData(num2, item_name, (short)num);
                }
            }
            else if (item_name == "Shield")
            {
                this.setFlagData(num2, "Shield", 1);
            }
            else if (item_name == "Shield2")
            {
                this.setFlagData(num2, "Shield", 2);
            }
            else if (item_name == "Shield3")
            {
                this.setFlagData(num2, "Shield", 3);
            }
            else
            {
                this.setFlagData(num2, item_name, (short)(this.getItemNum(item_name) + num));
            }
IL_3BF:
            MAINWEAPON mainweapon = this.exchengeMainWeaponNameToEnum(item_name);

            if (mainweapon != MAINWEAPON.NON)
            {
                this.haveMainWeapon(mainweapon, true);
                if (direct)
                {
                    if (mainweapon == MAINWEAPON.LWHIP)
                    {
                        this.setFlagData(num2, "Whip", (short)num);
                        this.playerst.setMainWeaponNum(mainweapon, num);
                    }
                    else if (mainweapon == MAINWEAPON.MWIHP)
                    {
                        this.setFlagData(num2, "Whip", 2);
                        this.playerst.setMainWeaponNum(mainweapon, num);
                    }
                    else if (mainweapon == MAINWEAPON.HWHIP)
                    {
                        this.setFlagData(num2, "Whip", 3);
                        this.playerst.setMainWeaponNum(mainweapon, num);
                    }
                }
                else
                {
                    if (mainweapon == MAINWEAPON.LWHIP)
                    {
                        this.setFlagData(num2, "Whip", (short)num);
                    }
                    else if (mainweapon == MAINWEAPON.MWIHP)
                    {
                        this.setFlagData(num2, "Whip", 2);
                    }
                    else if (mainweapon == MAINWEAPON.HWHIP)
                    {
                        this.setFlagData(num2, "Whip", 3);
                    }
                    this.addMainWeaponNum(mainweapon, 1);
                }
                return;
            }
            SUBWEAPON subweapon = this.exchengeSubWeaponNameToEnum(item_name);

            if (subweapon != SUBWEAPON.NON)
            {
                if (subweapon > SUBWEAPON.SUB_ANKJEWEL && subweapon != SUBWEAPON.SUB_REGUN)
                {
                    if (direct)
                    {
                        this.playerst.setSubWeaponNum(subweapon, num, false);
                    }
                    else
                    {
                        this.addSubWeaponNum(subweapon, num);
                    }
                }
                else if (loadcall)
                {
                    if (subweapon == SUBWEAPON.SUB_SHIELD1)
                    {
                        if (num == 2)
                        {
                            subweapon = SUBWEAPON.SUB_SHIELD2;
                        }
                        else if (num == 3)
                        {
                            subweapon = SUBWEAPON.SUB_SHIELD3;
                        }
                    }
                    this.haveSubWeapon(subweapon, true, false);
                }
                else
                {
                    this.haveSubWeapon(subweapon, true, sub_add);
                    if (subweapon == SUBWEAPON.SUB_REGUN)
                    {
                        this.playerst.addSubWeaponNum(subweapon, num);
                    }
                }
                return;
            }
            USEITEM useitem = this.exchengeUseItemNameToEnum(item_name);

            if (useitem != USEITEM.NON)
            {
                this.haveUsesItem(useitem, true);
                if (direct)
                {
                    this.playerst.setUseItemNum(useitem, num);
                    if (useitem == USEITEM.USE_PEPPER_B)
                    {
                        this.setFlagData(num3, "Pepper-b", (short)num);
                    }
                    else if (useitem == USEITEM.USE_CRYSTAL_S_B)
                    {
                        this.setFlagData(num3, "Crystal S-b", (short)num);
                    }
                }
                else
                {
                    this.addUseItemNum(useitem, 1);
                    if (useitem == USEITEM.USE_PEPPER_B)
                    {
                        this.setFlagData(num3, "Pepper-b", (short)this.playerst.getUseItemNum(useitem));
                    }
                    else if (useitem == USEITEM.USE_CRYSTAL_S_B)
                    {
                        this.setFlagData(num3, "Crystal S-b", (short)this.playerst.getUseItemNum(useitem));
                    }
                }
                return;
            }
        }
예제 #4
0
        public int getItemNum(string item_name)
        {
            short num  = 0;
            int   num2 = SeetNametoNo("02Items");

            if (num2 < 0)
            {
                return(-1);
            }
            if (item_name == "Weight")
            {
                return(playerst.getWait());
            }
            if (item_name == "Gold")
            {
                return(playerst.getCoin());
            }
            if (item_name == "Whip1")
            {
                getFlag(num2, 190, ref num);
                return(num);
            }
            else if (item_name == "Whip2")
            {
                getFlag(num2, 189, ref num);
                return(num);
            }
            else if (item_name == "Whip3")
            {
                getFlag(num2, 188, ref num);
                return(num);
            }
            else if (item_name == "Shield1")
            {
                getFlag(num2, 187, ref num);
                return(num);
            }
            else if (item_name == "Shield2")
            {
                getFlag(num2, 186, ref num);
                return(num);
            }
            else if (item_name == "Shield3")
            {
                getFlag(num2, 185, ref num);
                return(num);
            }
            else if (item_name == "MSX")
            {
                getFlag(num2, "MSX", ref num);
                return(num == 2 ? 1 : 0);
            }
            else
            {
                if (item_name == "A_Jewel" || item_name == "Ankh Jewel")
                {
                    getFlag(SeetNametoNo("00system"), "A_Jewel", ref num);
                    return((int)num);
                }
                if (!getFlag(num2, item_name, ref num))
                {
                    num = -1;
                }
                MAINWEAPON mainweapon = exchengeMainWeaponNameToEnum(item_name);
                if (mainweapon != MAINWEAPON.NON)
                {
                    getFlag(num2, item_name, ref num);
                    return(num > 0 ? 1 : 0);
                }
                SUBWEAPON subweapon = exchengeSubWeaponNameToEnum(item_name);
                if (subweapon != SUBWEAPON.NON && subweapon > SUBWEAPON.SUB_ANKJEWEL)
                {
                    num = (short)getSubWeaponNum(subweapon);
                }
                USEITEM useitem = exchengeUseItemNameToEnum(item_name);
                if (useitem != USEITEM.NON)
                {
                    num = (short)getUseItemNum(useitem);
                }
                return((int)num);
            }
        }
예제 #5
0
        public void resetPlayerStatus(int lv, int hp, int mcoin, int coin, int wait, int exp, MAINWEAPON now_wea, int now_wea_num, SUBWEAPON now_sub, int now_sub_num, USEITEM now_use, int now_use_num)
        {
            sys.setFlagData(2, 62, 0);
            clearItemsNum();
            string weaponName = string.Empty;

            if (now_wea != MAINWEAPON.NON)
            {
                weaponName = sys.exchengeMainWeaponEnumToName(now_wea);
                //haveMainWeapon(now_wea, true);
            }
            else if (now_sub != SUBWEAPON.NON)
            {
                weaponName = sys.exchengeSubWeaponEnumToName(now_sub);
                //sys.haveSubWeapon(now_sub, true, true);
            }

            if (!string.IsNullOrEmpty(weaponName))
            {
                sys.setItem(weaponName, 1, false, false, true);
                sys.equipItem(weaponName, true);
            }

            player_level = lv;
            if (player_level < 1)
            {
                player_level = 1;
            }
            if (hp < 1)
            {
                l2_hp = HPTANK * lv;
            }
            else
            {
                l2_hp = hp;
            }
            max_hp   = HPTANK * lv;
            max_coin = mcoin;
            l2_coin  = coin;
            setMainWeapon(now_wea);
            setSubWeapon(now_sub);
            setUseItem(now_use);
            statusbar.setInitHP(l2_hp / 100, (float)(max_hp / 100));
            l2Exp = exp;
            statusbar.setExp(exp);
            if (max_coin < 1000)
            {
                statusbar.setCoin(l2_coin, 3);
                statusbar.changeCoinMax(999);
            }
            else
            {
                statusbar.setCoin(l2_coin, 4);
                statusbar.changeCoinMax(2000);
            }
            l2_wait = wait;
            statusbar.setWait(wait);
            statusbar.setMain(l2_eq_main, l2_main[(int)now_wea]);
            statusbar.setSub(l2_eq_sub, l2_sub[(int)now_sub]);
            statusbar.setUse(l2_eq_use, l2_use[(int)now_use]);
        }
예제 #6
0
 private bool CheatEngineDetectSlot(Item item, USEITEM pkt, IContainer con) => pkt?.SlotObject.SlotId != 255 && pkt?.SlotObject.SlotId != 254 && con?.Inventory[pkt.SlotObject.SlotId] != item;
예제 #7
0
        public bool Activate(RealmTime time, Item item, USEITEM pkt)
        {
            bool     endMethod = false;
            Position target    = pkt.ItemUsePos;

            Mp -= item.MpCost;
            IContainer con = Owner?.GetEntity(pkt.SlotObject.ObjectId) as IContainer;

            if (con == null)
            {
                return(true);
            }
            if (CheatEngineDetectSlot(item, pkt, con))
            {
                CheatEngineDetect(item, pkt);
            }
            if (item.IsBackpack)
            {
                Backpack();
            }
            if (item.XpBooster)
            {
                XpBooster(item);
            }
            if (item.LootDropBooster)
            {
                LootDropBooster(item);
            }
            if (item.LootTierBooster)
            {
                LootTierBooster(item);
            }

            foreach (ActivateEffect eff in item.ActivateEffects)
            {
                switch (eff.Effect)
                {
                case ActivateEffects.BulletNova: BulletNova(time, item, target); break;

                case ActivateEffects.Shoot: Shoot(time, item, target); break;

                case ActivateEffects.StatBoostSelf: StatBoostSelf(eff); break;

                case ActivateEffects.StatBoostAura: StatBoostAura(eff); break;

                case ActivateEffects.ConditionEffectSelf: ConditionEffectSelf(eff); break;

                case ActivateEffects.ConditionEffectAura: ConditionEffectAura(eff); break;

                case ActivateEffects.Heal: Heal(eff); break;

                case ActivateEffects.HealNova: HealNova(eff); break;

                case ActivateEffects.Magic: Magic(eff); break;

                case ActivateEffects.MagicNova: MagicNova(eff); break;

                case ActivateEffects.Teleport: Teleport(target); break;

                case ActivateEffects.VampireBlast: VampireBlast(time, eff, target); break;

                case ActivateEffects.Trap: Trap(time, eff, target); break;

                case ActivateEffects.StasisBlast: StasisBlast(eff, target); break;

                case ActivateEffects.Decoy: Decoy(eff); break;

                case ActivateEffects.Lightning: Lightning(time, eff, target); break;

                case ActivateEffects.PoisonGrenade: PoisonGrenade(eff, target); break;

                case ActivateEffects.RemoveNegativeConditions: RemoveNegativeConditions(eff); break;

                case ActivateEffects.RemoveNegativeConditionsSelf: RemoveNegativeConditionsSelf(); break;

                case ActivateEffects.IncrementStat: IncrementStat(eff); break;

                case ActivateEffects.UnlockPortal: UnlockPortal(eff); break;

                case ActivateEffects.Create: Create(eff); break;

                case ActivateEffects.Dye: Dye(item); break;

                case ActivateEffects.ShurikenAbility: ShurikenAbility(time, item, target, pkt); break;

                case ActivateEffects.UnlockSkin: UnlockSkin(item, endMethod); break;

                case ActivateEffects.PermaPet: PermaPet(); break;

                case ActivateEffects.Pet: Pet(eff); break;

                case ActivateEffects.CreatePet: CreatePet(); break;

                case ActivateEffects.MysteryPortal: MysteryPortal(); break;

                case ActivateEffects.GenericActivate: GenericActivate(eff, target); break;

                case ActivateEffects.PetSkin: PetSkin(); break;

                case ActivateEffects.Unlock: Unlock(); break;

                case ActivateEffects.MysteryDyes: MysteryDyes(); break;

                case ActivateEffects.Exchange: Exchange(); break;
                }
            }
            UpdateCount++;
            return(endMethod);
        }