Exemplo n.º 1
0
        private string ChangeTalkString(LocationID locationID, string original)
        {
            if (locationToItemMap.TryGetValue(locationID, out ItemID newItemID))
            {
                ItemInfo newItemInfo = ItemDB.GetItemInfo(newItemID);

                string take;
                if (newItemInfo.boxName.Equals("Crystal S") || newItemInfo.boxName.Equals("Sacred Orb") || newItemInfo.boxName.Equals("MSX3p"))
                {
                    take = string.Format("[@take,{0},02item,1]\n", newItemInfo.boxName);
                }
                else
                {
                    take = string.Format("[@take,{0},02item,1]\n", newItemInfo.shopName);
                }

                //if the item has more than just its set flags add the flags to the mojiscript string
                L2FlagBoxEnd[] getFLags = CreateGetFlags(newItemID, newItemInfo);
                if (getFLags != null)
                {
                    for (int i = 0; i < getFLags.Length; i++)
                    {
                        L2FlagBoxEnd flag = getFLags[i];
                        if (flag.calcu == CALCU.ADD)
                        {
                            take += string.Format("[@setf,{0},{1},+,{2}]\n", flag.seet_no1, flag.flag_no1, flag.data);
                        }
                        else if (flag.calcu == CALCU.EQR)
                        {
                            take += string.Format("[@setf,{0},{1},=,{2}]\n", flag.seet_no1, flag.flag_no1, flag.data);
                        }
                    }
                }

                return(string.Format(original, take));
            }
            return(string.Empty);
        }
Exemplo n.º 2
0
        private string ChangeTalkFlagCheck(LocationID locationID, COMPARISON comp, string original)
        {
            if (locationToItemMap.TryGetValue(locationID, out ItemID newItemID))
            {
                ItemInfo newItemInfo = ItemDB.GetItemInfo(newItemID);

                int flagValue = 0;

                if (comp == COMPARISON.Greater)
                {
                    if (newItemID == ItemID.ChainWhip || newItemID == ItemID.SilverShield || newItemID == ItemID.MobileSuperx3P)
                    {
                        flagValue = 1;
                    }
                    else if (newItemID == ItemID.FlailWhip || newItemID == ItemID.AngelShield)
                    {
                        flagValue = 2;
                    }
                }
                else if (comp == COMPARISON.Less)
                {
                    flagValue = 1;

                    if (newItemID == ItemID.ChainWhip || newItemID == ItemID.SilverShield || newItemID == ItemID.MobileSuperx3P)
                    {
                        flagValue = 2;
                    }
                    else if (newItemID == ItemID.FlailWhip || newItemID == ItemID.AngelShield)
                    {
                        flagValue = 3;
                    }
                }

                return(string.Format(original, newItemInfo.itemFlag, flagValue));
            }
            return(string.Empty);
        }
Exemplo n.º 3
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.º 4
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);
            }
        }