Exemplo n.º 1
0
        private void ChangeEventItem(EventItemScript eventItem)
        {
            ItemData oldItemData = GetItemDataFromName(eventItem.name);

            if (oldItemData != null && locationToItemMap.TryGetValue((int)oldItemData.getItemName(), out int id))
            {
                ItemID newItemID = (ItemID)id;

                //get the item data for the new item, only really need the names here
                ItemInfo newItemInfo = ItemFlags.GetItemInfo(newItemID);
                ItemData newItemData = GetNewItemData(newItemInfo);

                //flags the item uses to check to see if it should be active and visible to the user, important that these are
                //changed because if you only change the label the it will use the original items flags to check. This means that
                //if you change another item to what was this items original is and collect it when it comes to collecting the item
                //this has been changed too if won't be active as it thinks you already have it
                foreach (var flagBoxParent in eventItem.itemActiveFlag)
                {
                    foreach (var flagBox in flagBoxParent.BOX)
                    {
                        if (flagBox.seet_no1 == 2)
                        {
                            flagBox.flag_no1 = (int)newItemData.getItemName();
                            flagBox.comp     = COMPARISON.Equal;
                            flagBox.flag_no2 = 0;

                            //the whips and shields use the same flag just increment higher with each upgrade cant just use the same as other items
                            if (newItemID == ItemID.ChainWhip || newItemID == ItemID.SilverShield || newItemID == ItemID.MobileSuperx3P)
                            {
                                flagBox.flag_no2 = 1;
                                flagBox.comp     = COMPARISON.LessEq;
                            }
                            else if (newItemID == ItemID.FlailWhip || newItemID == ItemID.AngelShield)
                            {
                                flagBox.flag_no2 = 2;
                                flagBox.comp     = COMPARISON.LessEq;
                            }
                            else if (newItemID == ItemID.Buckler)
                            {
                                flagBox.comp = COMPARISON.LessEq;
                            }
                        }
                    }
                }

                //flags that the item sets when you collect it, important to change otherwise the original item will also be collected
                //when you pick up the item because by default it sets the original items flags again, also other flags can be set here
                //usually items that add to flags that are used as a type of counter eg.Sacred Orbs orb count
                eventItem.itemGetFlags = ItemFlags.GetItemGetFlags(newItemID);

                //name used when calling setitem
                eventItem.itemLabel = newItemInfo.boxName;

                //change the sprite to match the new item
                Sprite sprite = L2SystemCore.getMapIconSprite(L2SystemCore.getItemData(newItemInfo.boxName));
                eventItem.gameObject.GetComponent <SpriteRenderer>().sprite = sprite;
            }
        }
 public void openBox()
 {
     if (this.itemObj != null)
     {
         AbstractItemBase component = this.itemObj.GetComponent <AbstractItemBase>();
         if (component.name.Contains(itemToReplaceName) && Enum.IsDefined(typeof(ItemDatabaseSystem.ItemNames), itemToInsertName))
         {
             component.setItemParameter(itemToInsertName, 1);
             Sprite mapIconSprite = L2SystemCore.getMapIconSprite(L2SystemCore.getItemData((ItemDatabaseSystem.ItemNames)Enum.Parse(typeof(ItemDatabaseSystem.ItemNames), itemToInsertName)));
             this.itemObj.GetComponent <SpriteRenderer>().sprite = mapIconSprite;
         }
     }
     base.openBox();
 }
        protected override void itemGetAction()
        {
            int slotNo = base.getL2Core().seManager.playSE(null, 39);

            base.getL2Core().seManager.releaseGameObjectFromPlayer(slotNo);
            this.pl.setActionOder(PLAYERACTIONODER.getitem);
            this.pl.setGetItem(ref this.itemLabel);
            //Mantras don't have an icon so just use the mantra software icon
            if (this.itemLabel.Contains("Mantra"))
            {
                this.pl.setGetItemIcon(L2SystemCore.getItemData("Mantra"));
            }
            else
            {
                this.pl.setGetItemIcon(L2SystemCore.getItemData(this.itemLabel));
            }
        }
Exemplo n.º 4
0
        public override bool itemCallBack(string tab, string name, int vale, int num)
        {
            string[] weapons = { "Whip2",   "Whip3",    "Knife",     "Rapier",      "Axe",        "Katana",    "Shuriken", "R-Shuriken", "E-Spear", "Flare Gun", "Bomb",
                                 "Chakram", "Caltrops", "Clay Doll", "Origin Seal", "Birth Seal", "Life Seal", "Death Seal" };

            bool result = orig_itemCallBack(tab, name, vale, num);

            if (result)
            {
                int counter = this.item_copunter - 1;
                if (this.sys.isMap(name))
                {
                    this.icon[counter]             = L2SystemCore.getMenuIconSprite(L2SystemCore.getItemData("Map"));
                    this.shop_item[counter].sprite = this.icon[counter];
                }
                else if (name.Equals("MSX"))
                {
                    this.icon[counter]             = L2SystemCore.getShopIconSprite(L2SystemCore.getItemData("MSX3p"));
                    this.shop_item[counter].sprite = this.icon[counter];
                }
                else if (name.Contains("Sacred Orb"))
                {
                    this.icon[counter]             = L2SystemCore.getMenuIconSprite(L2SystemCore.getItemData("Sacred Orb"));
                    this.shop_item[counter].sprite = this.icon[counter];
                    this.item_name[counter].text   = this.sys.getMojiText(true, this.sys.mojiSheetNameToNo(tab, this.sys.getMojiScript(mojiScriptType.item)),
                                                                          this.sys.mojiIdToNo(tab, "Sacred Orb", this.sys.getMojiScript(mojiScriptType.item)), this.sys.getNowLangage(), this.sys.getMojiScript(mojiScriptType.item));
                }
                else if (name.Contains("Crystal S"))
                {
                    this.icon[counter]             = L2SystemCore.getMenuIconSprite(L2SystemCore.getItemData("Crystal S"));
                    this.shop_item[counter].sprite = this.icon[counter];
                    this.item_name[counter].text   = this.sys.getMojiText(true, this.sys.mojiSheetNameToNo(tab, this.sys.getMojiScript(mojiScriptType.item)),
                                                                          this.sys.mojiIdToNo(tab, "Crystal S", this.sys.getMojiScript(mojiScriptType.item)), this.sys.getNowLangage(), this.sys.getMojiScript(mojiScriptType.item));
                }
                else
                {
                    if (Array.IndexOf(weapons, name) > -1)
                    {
                        this.icon[counter]             = L2SystemCore.getMenuIconSprite(L2SystemCore.getItemData(name));
                        this.shop_item[counter].sprite = this.icon[counter];
                    }
                }
            }
            return(result);
        }
Exemplo n.º 5
0
        private ItemData GetItemDataFromName(string objName)
        {
            if (objName.Contains("ItemSym "))
            {
                string name = objName.Substring(8);

                if (name.Contains("SacredOrb"))
                {
                    name = name.Insert(6, " ");
                }
                else if (name.Equals("MSX3p"))
                {
                    name = "MSX";
                }
                return(L2SystemCore.getItemData(name));
            }
            return(null);
        }
Exemplo n.º 6
0
 private ItemData GetNewItemData(ItemInfo itemInfo)
 {
     if (itemInfo.shopName.Contains("Whip"))
     {
         return(L2SystemCore.getItemData("Whip"));
     }
     else if (itemInfo.shopName.Contains("Shield"))
     {
         return(L2SystemCore.getItemData("Shield"));
     }
     else if (itemInfo.shopName.Equals("MSX3p"))
     {
         return(L2SystemCore.getItemData("MSX"));
     }
     else
     {
         return(L2SystemCore.getItemData(itemInfo.shopName));
     }
 }
Exemplo n.º 7
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;
            }
        }
Exemplo n.º 8
0
        private void ChangeEventItems()
        {
            foreach (EventItemScript item in FindObjectsOfType <EventItemScript>())
            {
                ItemData oldItemData = GetItemDataFromName(item.name);
                if (oldItemData == null)
                {
                    continue;
                }

                if (oldItemData != null && locationToItemMap.TryGetValue((LocationID)oldItemData.getItemName(), out ItemID newItemID))
                {
                    ItemInfo newItemInfo = ItemDB.GetItemInfo(newItemID);

                    //Change the Event Items active flags to correspond to the new item
                    //These flags are used to set the item inactive after you have got it
                    foreach (L2FlagBoxParent flagBoxParent in item.itemActiveFlag)
                    {
                        foreach (L2FlagBox flagBox in flagBoxParent.BOX)
                        {
                            if (flagBox.seet_no1 == 2)
                            {
                                flagBox.flag_no1 = newItemInfo.itemFlag;
                                flagBox.comp     = COMPARISON.Equal;
                                flagBox.flag_no2 = 0;

                                //the whips and shields use the same flag just increment higher with each upgrade cant just use the same as other items
                                if (newItemID == ItemID.ChainWhip || newItemID == ItemID.SilverShield || newItemID == ItemID.MobileSuperx3P)
                                {
                                    flagBox.flag_no2 = 1;
                                    flagBox.comp     = COMPARISON.LessEq;
                                }
                                else if (newItemID == ItemID.FlailWhip || newItemID == ItemID.AngelShield)
                                {
                                    flagBox.flag_no2 = 2;
                                    flagBox.comp     = COMPARISON.LessEq;
                                }
                                else if (newItemID == ItemID.Buckler)
                                {
                                    flagBox.comp = COMPARISON.LessEq;
                                }
                            }
                        }
                    }
                    //Change the Event Items get flags to correspond to the new item
                    //These are flags that are set when the item is gotten
                    item.itemGetFlags = CreateGetFlags(newItemID, newItemInfo);

                    //Change the name used when calling setitem to correspond to new item
                    item.itemLabel = newItemInfo.boxName;

                    //Change the sprite to correspond to new item
                    Sprite sprite;
                    //Mantras don't have an icon so use the Mantra software icon
                    if (newItemID >= ItemID.Heaven && newItemID <= ItemID.Night)
                    {
                        sprite = L2SystemCore.getMapIconSprite(L2SystemCore.getItemData("Mantra"));
                    }
                    else
                    {
                        sprite = L2SystemCore.getMapIconSprite(L2SystemCore.getItemData(newItemInfo.boxName));
                    }
                    item.gameObject.GetComponent <SpriteRenderer>().sprite = sprite;
                }
            }
        }
Exemplo n.º 9
0
        private IEnumerator ChangeTreasureBoxes()
        {
            List <TreasureBoxScript> oldboxes = new List <TreasureBoxScript>();

            foreach (TreasureBoxScript box in FindObjectsOfType <TreasureBoxScript>())
            {
                ItemData oldItemData = GetItemDataFromName(box.itemObj.name);
                if (oldItemData == null)
                {
                    continue;
                }

                LocationID locationID = (LocationID)oldItemData.getItemName();

                if (oldItemData != null && locationToItemMap.TryGetValue(locationID, out ItemID newItemID))
                {
                    ItemInfo          newItemInfo = ItemDB.GetItemInfo(newItemID);
                    TreasureBoxScript newBox;
                    if (IsLocationCursed(locationID))
                    {
                        GameObject obj = Instantiate(cursedChest, box.transform.position, box.transform.rotation);
                        newBox                 = obj.GetComponent <TreasureBoxScript>();
                        newBox.curseMode       = true;
                        newBox.forceOpenFlags  = box.forceOpenFlags;
                        newBox.itemFlags       = box.itemFlags;
                        newBox.openActionFlags = box.openActionFlags;
                        newBox.openFlags       = box.openFlags;
                        newBox.unlockFlags     = box.unlockFlags;
                        newBox.itemObj         = box.itemObj;
                        obj.SetActive(true);
                        obj.transform.SetParent(box.transform.parent);
                        oldboxes.Add(box);
                    }
                    else
                    {
                        newBox           = box;
                        newBox.curseMode = false;
                    }

                    //Change the Treasure Boxs open flags to correspond to the new item
                    //These flags are used to so the chest stays open after you get the item
                    foreach (L2FlagBoxParent flagBoxParent in newBox.openFlags)
                    {
                        foreach (L2FlagBox flagBox in flagBoxParent.BOX)
                        {
                            if (flagBox.seet_no1 == 2)
                            {
                                flagBox.flag_no1 = newItemInfo.itemFlag;
                                flagBox.flag_no2 = 1;

                                //the whips and shields use the same flag just increment higher with each upgrade cant just use the same as other items
                                if (newItemID == ItemID.ChainWhip || newItemID == ItemID.SilverShield || newItemID == ItemID.MobileSuperx3P)
                                {
                                    flagBox.flag_no2 = 2;
                                }
                                else if (newItemID == ItemID.FlailWhip || newItemID == ItemID.AngelShield)
                                {
                                    flagBox.flag_no2 = 3;
                                }
                            }
                        }
                    }

                    EventItemScript item = newBox.itemObj.GetComponent <EventItemScript>();

                    //Change the Event Items active flags to correspond to the new item
                    //These flags are used to set the item inactive after you have got it
                    foreach (L2FlagBoxParent flagBoxParent in item.itemActiveFlag)
                    {
                        foreach (L2FlagBox flagBox in flagBoxParent.BOX)
                        {
                            if (flagBox.seet_no1 == 2)
                            {
                                flagBox.flag_no1 = newItemInfo.itemFlag;
                                flagBox.comp     = COMPARISON.Equal;
                                flagBox.flag_no2 = 0;

                                //the whips and shields use the same flag just increment higher with each upgrade cant just use the same as other items
                                if (newItemID == ItemID.ChainWhip || newItemID == ItemID.SilverShield || newItemID == ItemID.MobileSuperx3P)
                                {
                                    flagBox.flag_no2 = 1;
                                    flagBox.comp     = COMPARISON.LessEq;
                                }
                                else if (newItemID == ItemID.FlailWhip || newItemID == ItemID.AngelShield)
                                {
                                    flagBox.flag_no2 = 2;
                                    flagBox.comp     = COMPARISON.LessEq;
                                }
                                else if (newItemID == ItemID.Buckler)
                                {
                                    flagBox.comp = COMPARISON.LessEq;
                                }
                            }
                        }
                    }
                    //Change the Event Items get flags to correspond to the new item
                    //These are flags that are set when the item is gotten
                    item.itemGetFlags = CreateGetFlags(newItemID, newItemInfo);

                    //Change the name used when calling setitem to correspond to new item
                    item.itemLabel = newItemInfo.boxName;

                    //Change the sprite to correspond to new item
                    Sprite sprite;
                    //Mantras don't have an icon so use the Mantra software icon
                    if (newItemID >= ItemID.Heaven && newItemID <= ItemID.Night)
                    {
                        sprite = L2SystemCore.getMapIconSprite(L2SystemCore.getItemData("Mantra"));
                    }
                    else
                    {
                        sprite = L2SystemCore.getMapIconSprite(L2SystemCore.getItemData(newItemInfo.boxName));
                    }
                    item.gameObject.GetComponent <SpriteRenderer>().sprite = sprite;
                }
            }
            yield return(new WaitForEndOfFrame());

            foreach (var box in oldboxes)
            {
                box.gameObject.SetActive(false);
            }
        }
Exemplo n.º 10
0
        public override bool itemCallBack(string tab, string name, int vale, int num)
        {
            string[] weapons = { "Whip2",   "Whip3",    "Knife",     "Rapier",      "Axe",        "Katana",    "Shuriken", "R-Shuriken", "E-Spear", "Flare Gun", "Bomb",
                                 "Chakram", "Caltrops", "Clay Doll", "Origin Seal", "Birth Seal", "Life Seal", "Death Seal" };

            if (this.item_copunter > 2)
            {
                return(false);
            }
            this.true_name[this.item_copunter] = name;
            if (this.sys.isAnkJewel(name))
            {
                name = "Ankh Jewel";
            }
            else if (this.sys.isMap(name))
            {
                name = "Map";
            }
            this.item_id[this.item_copunter] = name;

            if (name.Contains("Mantra") && !name.Equals("Mantra"))
            {
                this.icon[this.item_copunter]             = L2SystemCore.getShopIconSprite(L2SystemCore.getItemData("Mantra"));
                this.shop_item[this.item_copunter].sprite = this.icon[this.item_copunter];

                string mojiName = name.Equals("Mantra10") ? "mantra1stM10" : "mantra1stM" + name.Substring(6, 1);
                this.item_name[this.item_copunter].text = this.sys.getMojiText(true, this.sys.mojiSheetNameToNo(tab, this.sys.getMojiScript(mojiScriptType.system)),
                                                                               this.sys.mojiIdToNo(tab, mojiName, this.sys.getMojiScript(mojiScriptType.system)), this.sys.getNowLangage(), this.sys.getMojiScript(mojiScriptType.system));
            }
            else
            {
                if (name.Equals("Map"))
                {
                    this.icon[this.item_copunter] = L2SystemCore.getMapIconSprite(L2SystemCore.getItemData("Map"));
                }
                else if (name.Equals("MSX"))
                {
                    this.icon[this.item_copunter] = L2SystemCore.getShopIconSprite(L2SystemCore.getItemData("MSX3p"));
                }
                else if (name.Contains("Sacred Orb"))
                {
                    this.icon[this.item_copunter] = L2SystemCore.getMenuIconSprite(L2SystemCore.getItemData("Sacred Orb"));
                    name = "Sacred Orb";
                }
                else if (name.Contains("Crystal S"))
                {
                    this.icon[this.item_copunter] = L2SystemCore.getShopIconSprite(L2SystemCore.getItemData("Crystal S"));
                    name = "Crystal S";
                }
                else if (Array.IndexOf(weapons, name) > -1)
                {
                    this.icon[this.item_copunter] = L2SystemCore.getMenuIconSprite(L2SystemCore.getItemData(name));
                }
                else
                {
                    this.icon[this.item_copunter] = ShopScript.Load("Textures/icons_shops", name);
                }

                this.shop_item[this.item_copunter].sprite = this.icon[this.item_copunter];
                this.item_name[this.item_copunter].text   = this.sys.getMojiText(true, this.sys.mojiSheetNameToNo(tab, this.sys.getMojiScript(mojiScriptType.item)),
                                                                                 this.sys.mojiIdToNo(tab, name, this.sys.getMojiScript(mojiScriptType.item)), this.sys.getNowLangage(), this.sys.getMojiScript(mojiScriptType.item));
            }

            this.item_value[this.item_copunter] = vale;
            if (vale > 999)
            {
                this.item_valu[this.item_copunter].text = L2Math.numToText(vale, 4);
            }
            else
            {
                this.item_valu[this.item_copunter].text = L2Math.numToText(vale, 3);
            }
            this.item_num[this.item_copunter] = num;
            this.item_copunter++;
            return(true);
        }
Exemplo n.º 11
0
        public override bool Farst()
        {
            int sta = this.sta;

            switch (sta)
            {
            case 0:
                break;

            case 1:
                if (!sys.getL2Keys(L2KEYS.up, KEYSTATE.REPEAT))
                {
                    if (!sys.getL2Keys(L2KEYS.down, KEYSTATE.REPEAT))
                    {
                        if (!sys.getL2Keys(L2KEYS.left, KEYSTATE.DOWN))
                        {
                            if (sys.getL2Keys(L2KEYS.right, KEYSTATE.DOWN))
                            {
                            }
                        }
                    }
                }
                if (sys.getL2Keys(L2KEYS.ok, KEYSTATE.DOWN))
                {
                    sys.setKeyBlock(true);
                    con.anime.Play("snap scan");
                    L2Core.seManager.playSE(null, 155);
                    this.sta = 2;
                }
                if (sys.getL2Keys(L2KEYS.cancel, KEYSTATE.DOWN))
                {
                }
                break;

            case 2:
                if (con.anime.GetCurrentAnimatorStateInfo(0).normalizedTime >= 1f)
                {
                    sys.setKeyBlock(false);
                    con.anime.Play("snap scanEnd");
                    SnapShotTargetSc = L2Core.ScrollSystem.getSnapShotTarget();
                    L2Core.seManager.playSE(null, 37);
                    if (SnapShotTargetSc == null)
                    {
                        this.sta = 3;
                    }
                    else if (SnapShotTargetSc.mode == SnapShotTargetScript.SnapShotMode.MESSAGE)
                    {
                        con.Contents.SetActive(true);
                        con.ContentsText.text = sys.getMojiText(false, SnapShotTargetSc.sheetName, SnapShotTargetSc.cellName, mojiScriptType.sekihi);
                        this.sta = 4;
                    }
                    else if (SnapShotTargetSc.mode == SnapShotTargetScript.SnapShotMode.SOFTWARE)
                    {
                        sys.setKeyBlock(true);
                        L2Rando rando = GameObject.FindObjectOfType <L2Rando>();
                        if (rando != null && rando.IsRandomising)
                        {
                            LocationID locationID = rando.GetLocationIDForMural(SnapShotTargetSc);

                            ItemID   itemID   = rando.GetItemIDForLocation(locationID);
                            ItemInfo itemInfo = ItemDB.GetItemInfo(itemID);

                            GetItemID = itemInfo.BoxName;

                            int flagValue = 0;
                            if (itemID == ItemID.MobileSuperx3P)
                            {
                                flagValue = 1;
                            }

                            if (sys.isHaveItem(itemInfo.ShopName) > flagValue)
                            {
                                HaveItems = true;
                            }
                            else
                            {
                                HaveItems = false;
                                sys.setItem(GetItemID, 1, false, false, true);
                                sys.setEffectFlag(rando.CreateGetFlags(itemID, itemInfo));
                            }
                        }
                        else
                        {
                            item      = L2SystemCore.getItemData(SnapShotTargetSc.itemName);
                            GetItemID = item.getItemId();
                            if (sys.isHaveItem(GetItemID) > 0)
                            {
                                HaveItems = true;
                            }
                            else
                            {
                                HaveItems = false;
                                sys.setItem(GetItemID, 1, true, false, true);
                            }
                        }

                        DrawBinalyCount = 0;
                        this.sta        = 5;
                    }
                    else
                    {
                        Debug.Log("SnapShotTargetScriptはあったけど、何かおかしい" + SnapShotTargetSc.mode);
                        this.sta = 3;
                    }
                }
                break;

            case 3:
                con.NoContents.SetActive(true);
                this.sta = 10;
                break;

            case 4:
                CreateBunsyouData_Message();
                if (sys.getSoftLive(sys.isNowSoftSet())[3])
                {
                    SetHelpBar(1);
                }
                this.sta = 9;
                break;

            case 5:
                con.Contents.SetActive(true);
                for (int i = 0; i < 10; i++)
                {
                    BinalyData[i] = string.Empty;
                    for (int j = 0; j < 100; j++)
                    {
                        int num = rand() / 10 % 2;
                        BinalyData[i] = BinalyData[i] + num.ToString();
                    }
                }
                con.ContentsText.text = BinalyData[0];
                BinalyStart           = 0;
                this.sta = 6;
                break;

            case 6:
            {
                string text = string.Empty;
                if (DrawBinalyCount > 7)
                {
                    int num2 = BinalyStart;
                    for (int k = 0; k < 8; k++)
                    {
                        text += BinalyData[num2];
                        num2++;
                        if (num2 > 9)
                        {
                            num2 = 0;
                        }
                    }
                    BinalyStart++;
                    if (BinalyStart > 9)
                    {
                        BinalyStart = 0;
                    }
                }
                else
                {
                    text = string.Empty;
                    for (int l = 0; l < DrawBinalyCount; l++)
                    {
                        text += BinalyData[l];
                    }
                }
                con.ContentsText.text = text;
                DrawBinalyCount++;
                if (DrawBinalyCount == 120)
                {
                    if (HaveItems)
                    {
                        con.Contents.gameObject.SetActive(false);
                        con.SameContents.gameObject.SetActive(true);
                        sys.setKeyBlock(false);
                        this.sta = 10;
                    }
                    else
                    {
                        sys.getMenuObjectNF(1).setMess(GetItemID);
                        sys.getMenuObjectNF(1).setMess("snap");
                        sys.getMenuObjectNF(1).StartSwitch();
                        sys.getL2SystemCore().seManager.playSE(null, 39);
                        Dialog_on = 1;
                        sys.setKeyBlock(false);
                        this.sta = 10;
                    }
                }
                break;
            }

            default:
                switch (sta)
                {
                case 80:
                    scroll_count--;
                    if (scroll_count != 0)
                    {
                        scroll_pos += 80f;
                        SnapBase.transform.localPosition = new Vector3(scroll_pos, 0f, 600f);
                    }
                    else
                    {
                        SnapBase.transform.localPosition = new Vector3(0f, 0f, 600f);
                        this.sta = 1;
                    }
                    break;

                case 81:
                    scroll_count--;
                    if (scroll_count != 0)
                    {
                        scroll_pos -= 80f;
                        SnapBase.transform.localPosition = new Vector3(scroll_pos, 0f, 600f);
                    }
                    else
                    {
                        SnapBase.transform.localPosition = new Vector3(0f, 0f, 600f);
                        this.sta = 1;
                    }
                    break;

                case 82:
                    scroll_count--;
                    if (scroll_count != 0)
                    {
                        scroll_pos -= 80f;
                        SnapBase.transform.localPosition = new Vector3(scroll_pos, 0f, 600f);
                    }
                    else
                    {
                        con.Contents.SetActive(false);
                        con.NoContents.SetActive(false);
                        con.SameContents.gameObject.SetActive(false);
                        m_obj.SetActive(false);
                        this.sta = 0;
                        sys.callSlideEnd();
                    }
                    break;

                case 83:
                    scroll_count--;
                    if (scroll_count != 0)
                    {
                        scroll_pos += 80f;
                        SnapBase.transform.localPosition = new Vector3(scroll_pos, 0f, 600f);
                    }
                    else
                    {
                        con.Contents.SetActive(false);
                        con.NoContents.SetActive(false);
                        con.SameContents.gameObject.SetActive(false);
                        m_obj.SetActive(false);
                        this.sta = 0;
                        sys.callSlideEnd();
                    }
                    break;

                default:
                    if (sta != 100)
                    {
                        MonoBehaviour.print("エラーだってよ");
                    }
                    else
                    {
                        if (Bunsyouemon)
                        {
                            sys.getMenuObjectNF(4).EndSwitch();
                        }
                        sys.setInfoBar(false, false, 0f);
                        m_obj.SetActive(false);
                        this.sta = 0;
                    }
                    break;
                }
                break;

            case 9:
                if (sys.getSoftLive(sys.isNowSoftSet())[3] && sys.getL2Keys(L2KEYS.use, KEYSTATE.DOWN))
                {
                    SetHelpBar(0);
                    sys.setBunsyouData(ref bun);
                    sys.getMenuObjectNF(4).setMess("w");
                    sys.getMenuObjectNF(4).StartSwitch();
                    Bunsyouemon = true;
                    this.sta    = 10;
                }
                break;

            case 10:
                sys.itemCompleteCheck();
                sys.softCompleteCheck();
                this.sta = 11;
                break;

            case 11:
                break;
            }
            return(true);
        }
        protected override void itemGetAction()
        {
#if ONEPOINTZERO
            pl = sys.getPlayer();
#endif
            int slotNo = getL2Core().seManager.playSE(null, 39);
            getL2Core().seManager.releaseGameObjectFromPlayer(slotNo);
            pl.setActionOder(PLAYERACTIONODER.getitem);
            if (itemLabel.Contains("Whip"))
            {
                short  data         = 0;
                string trueItemName = string.Empty;
                sys.getFlag(2, "Whip", ref data);
                if (data == 0)
                {
                    trueItemName = "Whip";
                }
                else if (data == 1)
                {
                    trueItemName = "Whip2";
                }
                else if (data >= 2)
                {
                    trueItemName = "Whip3";
                }

                pl.setGetItem(ref trueItemName);
                pl.setGetItemIcon(L2SystemCore.getItemData(trueItemName));
            }
            else if (itemLabel.Contains("Shield"))
            {
                short  data         = 0;
                string trueItemName = string.Empty;
                sys.getFlag(2, 184, ref data);
                if (data == 0)
                {
                    trueItemName = "Shield";
                }
                else if (data == 1)
                {
                    trueItemName = "Shield2";
                }
                else if (data >= 2)
                {
                    trueItemName = "Shield3";
                }

                pl.setGetItem(ref trueItemName);
                pl.setGetItemIcon(L2SystemCore.getItemData(trueItemName));
            }
            else
            {
                pl.setGetItem(ref itemLabel);
                //Mantras don't have an icon so just use the mantra software icon
                if (itemLabel.Contains("Mantra"))
                {
                    pl.setGetItemIcon(L2SystemCore.getItemData("Mantra"));
                }
                else
                {
                    pl.setGetItemIcon(L2SystemCore.getItemData(itemLabel));
                }
            }
        }
Exemplo n.º 13
0
        public void groundInit()
        {
            if (itemObj != null)
            {
                string targetItem = null;

                patch_AbstractItemBase itemBase = (patch_AbstractItemBase)itemObj.GetComponent <AbstractItemBase>();
                if (itemBase.originalItemLabel.Length == 0)
                {
                    itemBase.originalItemLabel = itemBase.itemLabel;
                }

                if (itemBase.originalItemLabel.Equals("Shell Horn"))
                {
                    targetItem = "Lamp";
                }
                else if (itemBase.originalItemLabel.Equals("Holy Grail"))
                {
                    targetItem = "Feather";
                }

                if (targetItem != null)
                {
                    ItemData originalItemData = L2SystemCore.getItemData(itemBase.originalItemLabel);

                    itemBase.setItemParameter(targetItem, 1);
                    ItemData updatedItemData = L2SystemCore.getItemData(targetItem);
                    Sprite   targetSprite    = L2SystemCore.getMapIconSprite(updatedItemData);

                    SpriteRenderer spriteRenderer = itemObj.GetComponent <SpriteRenderer>();
                    spriteRenderer.sprite = targetSprite;

                    foreach (L2Flag.L2FlagBoxEnd flag in itemBase.itemGetFlags)
                    {
                        if (flag.calcu == L2Flag.CALCU.EQR && flag.seet_no1 == 2 && flag.flag_no1 == (int)originalItemData.getItemName())
                        {
                            flag.flag_no1 = (int)updatedItemData.getItemName();
                        }
                    }

                    foreach (L2Flag.L2FlagBoxParent flagBoxParent in itemBase.itemActiveFlag)
                    {
                        foreach (L2Flag.L2FlagBox origFlagBox in flagBoxParent.BOX)
                        {
                            patch_L2FlagBox flagBox = (patch_L2FlagBox)origFlagBox;

                            if (flagBox.seet_no1 == 2 && flagBox.flag_no1 == (int)originalItemData.getItemName())
                            {
                                flagBox.flag_no1 = (int)updatedItemData.getItemName();
                            }
                        }
                    }

                    foreach (L2Flag.L2FlagBoxParent flagBoxParent in openFlags)
                    {
                        foreach (L2Flag.L2FlagBox origFlagBox in flagBoxParent.BOX)
                        {
                            patch_L2FlagBox flagBox = (patch_L2FlagBox)origFlagBox;

                            if (flagBox.seet_no1 == 2 && flagBox.flag_no1 == (int)originalItemData.getItemName())
                            {
                                if (flagBox.flgBaseL != null)
                                {
                                    flagBox.flgBaseL.setFlagName(targetItem);
                                }

                                flagBox.flag_no1 = (int)updatedItemData.getItemName();
                            }
                        }
                    }
                }
            }

            orig_groundInit();
        }