public void gameFlagResets()
        {
            ItemTracker itemTracker = FindObjectOfType <ItemTracker>();

            if (itemTracker != null)
            {
                itemTracker.Add(102, 0);
            }

            fsys.allReset();
            playerst.clearItemsNum();
            menusys.menuSysReStart();
            setSystemDataToClothFlag();

            MAINWEAPON mainWeapon = MAINWEAPON.NON;
            SUBWEAPON  subWeapon  = SUBWEAPON.NON;

            L2Rando l2Rando = FindObjectOfType <L2Rando>();

            if (l2Rando != null && l2Rando.IsRandomising)
            {
                Init_Coin_num   = l2Rando.StartingMoney;
                Init_Weight_num = l2Rando.StartingWeights;

                if (l2Rando.RemoveITStatue)
                {
                    setFlagData(8, 10, 1);
                }

                setFlagData(5, 47, (short)(12 - l2Rando.RequiredSkulls));

                ItemInfo itemInfo = ItemDB.GetItemInfo(l2Rando.StartingWeapon);

                if (itemInfo != null)
                {
                    if (l2Rando.StartingWeapon == ItemID.Whip1 || l2Rando.StartingWeapon == ItemID.Whip2 || l2Rando.StartingWeapon == ItemID.Whip3)
                    {
                        setFlagData(itemInfo.ItemSheet, itemInfo.ItemFlag, 1);
                        mainWeapon = exchengeMainWeaponNameToEnum("Whip");
                    }
                    else
                    {
                        mainWeapon = exchengeMainWeaponNameToEnum(itemInfo.BoxName);
                    }
                    subWeapon = exchengeSubWeaponNameToEnum(itemInfo.BoxName);
                }
            }

            playerst.addCoin(Init_Coin_num);
            playerst.addWait(Init_Weight_num);
            playerst.resetPlayerStatus(Init_PLayer_lv, 0, 999, Init_Coin_num, Init_Weight_num, 0, mainWeapon, 0, subWeapon, 0, USEITEM.NON, 0);
            playerst.resetExp();
            setFlagData(0, 42, 1);
            setFlagData(4, 60, 4);
            setFlagData(4, 62, 2);
        }
        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;
            }
        }
        public MAINWEAPON changeMainWeapon(int slide_vector)
        {
            MAINWEAPON mainweapon = getMainWeapon();

            for (int i = 0; i < 5; i++)
            {
                if (slide_vector == 1)
                {
                    switch (mainweapon)
                    {
                    case MAINWEAPON.LWHIP:
                        mainweapon = MAINWEAPON.KNIFE;
                        break;

                    case MAINWEAPON.MWIHP:
                        mainweapon = MAINWEAPON.KNIFE;
                        break;

                    case MAINWEAPON.HWHIP:
                        mainweapon = MAINWEAPON.KNIFE;
                        break;

                    case MAINWEAPON.KNIFE:
                        mainweapon = MAINWEAPON.RAPIER;
                        break;

                    case MAINWEAPON.RAPIER:
                        mainweapon = MAINWEAPON.AXE;
                        break;

                    case MAINWEAPON.AXE:
                        mainweapon = MAINWEAPON.SWORD;
                        break;

                    case MAINWEAPON.SWORD:
                    case MAINWEAPON.NON:
                        if (isMainWeapon(MAINWEAPON.HWHIP))
                        {
                            mainweapon = MAINWEAPON.HWHIP;
                        }
                        else if (isMainWeapon(MAINWEAPON.MWIHP))
                        {
                            mainweapon = MAINWEAPON.MWIHP;
                        }
                        else
                        {
                            mainweapon = MAINWEAPON.LWHIP;
                        }
                        break;
                    }
                }
                else
                {
                    switch (mainweapon)
                    {
                    case MAINWEAPON.LWHIP:
                    case MAINWEAPON.MWIHP:
                    case MAINWEAPON.HWHIP:
                    case MAINWEAPON.NON:
                        mainweapon = MAINWEAPON.SWORD;
                        break;

                    case MAINWEAPON.KNIFE:
                        if (isMainWeapon(MAINWEAPON.HWHIP))
                        {
                            mainweapon = MAINWEAPON.HWHIP;
                        }
                        else if (isMainWeapon(MAINWEAPON.MWIHP))
                        {
                            mainweapon = MAINWEAPON.MWIHP;
                        }
                        else
                        {
                            mainweapon = MAINWEAPON.LWHIP;
                        }
                        break;

                    case MAINWEAPON.RAPIER:
                        mainweapon = MAINWEAPON.KNIFE;
                        break;

                    case MAINWEAPON.AXE:
                        mainweapon = MAINWEAPON.RAPIER;
                        break;

                    case MAINWEAPON.SWORD:
                        mainweapon = MAINWEAPON.AXE;
                        break;
                    }
                }

                if (isMainWeapon(mainweapon))
                {
                    return(mainweapon);
                }
            }

            return(MAINWEAPON.NON);
        }
        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);
            }
        }
        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]);
        }