Beispiel #1
0
        public IEnumerator <YieldInstruction> ProcessGiveItem(GroundChar character, int invSlot, int teamSlot)
        {
            ExplorerTeam memberTeam = DataManager.Instance.Save.ActiveTeam;
            Character    itemChar   = memberTeam.Leader;

            if (teamSlot > -1)
            {
                itemChar = memberTeam.Players[teamSlot];
            }

            //no curse check in ground mode

            InvItem item = memberTeam.GetInv(invSlot);

            memberTeam.RemoveFromInv(invSlot);

            GameManager.Instance.SE(DataManager.Instance.EquipSE);

            if (itemChar.EquippedItem.ID > -1)
            {
                yield return(CoroutineManager.Instance.StartCoroutine(MenuManager.Instance.SetDialogue(false, Text.FormatKey("MSG_ITEM_SWAP", itemChar.Name, item.GetName(), itemChar.EquippedItem.GetName()))));

                //put item in inv
                memberTeam.AddToInv(new InvItem(itemChar.EquippedItem));
            }
            else
            {
                yield return(CoroutineManager.Instance.StartCoroutine(MenuManager.Instance.SetDialogue(false, Text.FormatKey("MSG_ITEM_GIVE", itemChar.Name, item.GetName()))));
            }


            itemChar.EquipItem(item);
        }
Beispiel #2
0
        //public IEnumerator<YieldInstruction> ArriveOnTile(Character character)

        //public IEnumerator<YieldInstruction> ArriveOnTile(Character character, bool checkItem, bool wantItem, bool noTrap)



        private IEnumerator <YieldInstruction> ProcessTrashItem(GroundChar character, int invSlot, bool held)
        {
            InvItem invItem = null;

            if (held)
            {
                Character activeChar = DataManager.Instance.Save.ActiveTeam.Players[invSlot];

                //no curse check in ground mode

                invItem = activeChar.EquippedItem;
                activeChar.EquippedItem = new InvItem();
            }
            else
            {
                ExplorerTeam memberTeam = DataManager.Instance.Save.ActiveTeam;
                invItem = memberTeam.GetInv(invSlot);
                memberTeam.RemoveFromInv(invSlot);
            }

            yield return(CoroutineManager.Instance.StartCoroutine(MenuManager.Instance.SetDialogue(false, String.Format("Threw away the {0}.", invItem.GetName()))));
        }
Beispiel #3
0
        public IEnumerator <YieldInstruction> RestrictTeam(ZoneData zone, bool silent)
        {
            int teamSize = ExplorerTeam.MAX_TEAM_SLOTS;

            if (zone.TeamSize > -1)
            {
                teamSize = zone.TeamSize;
            }
            if (zone.TeamRestrict)
            {
                teamSize = 1;
            }

            List <string> teamRestrictions = new List <string>();

            while (ActiveTeam.Players.Count > teamSize)
            {
                int sendHomeIndex = ActiveTeam.Players.Count - 1;
                if (sendHomeIndex == ActiveTeam.LeaderIndex)
                {
                    sendHomeIndex--;
                }
                teamRestrictions.Add(ActiveTeam.Players[sendHomeIndex].BaseName);
                if (GameManager.Instance.CurrentScene == GroundScene.Instance)
                {
                    GroundScene.Instance.SilentSendHome(sendHomeIndex);
                }
                else if (GameManager.Instance.CurrentScene == DungeonScene.Instance)
                {
                    DungeonScene.Instance.SilentSendHome(sendHomeIndex);
                }
            }

            if (!silent)
            {
                if (teamRestrictions.Count > 1)
                {
                    string compositeList = Text.BuildList(teamRestrictions.ToArray());
                    yield return(CoroutineManager.Instance.StartCoroutine(MenuManager.Instance.SetDialogue(Text.FormatKey("MSG_TEAM_SENT_HOME_PLURAL", compositeList))));
                }
                else if (teamRestrictions.Count == 1)
                {
                    yield return(CoroutineManager.Instance.StartCoroutine(MenuManager.Instance.SetDialogue(Text.FormatKey("MSG_TEAM_SENT_HOME", teamRestrictions[0]))));
                }
            }

            List <string> bagRestrictions = new List <string>();

            if (zone.MoneyRestrict && ActiveTeam.Money > 0)
            {
                ActiveTeam.Bank += ActiveTeam.Money;
                ActiveTeam.Money = 0;
                bagRestrictions.Add(Text.FormatKey("DLG_RESTRICT_MONEY"));
            }

            if (zone.BagRestrict > -1)
            {
                bool removedItems = false;
                int  heldSlots    = 0;
                foreach (Character player in ActiveTeam.Players)
                {
                    if (player.EquippedItem.ID > -1)
                    {
                        heldSlots++;
                    }
                }
                List <InvItem> itemsToStore = new List <InvItem>();
                while (ActiveTeam.GetInvCount() + heldSlots > zone.BagRestrict && ActiveTeam.GetInvCount() > 0)
                {
                    removedItems = true;
                    itemsToStore.Add(ActiveTeam.GetInv(ActiveTeam.GetInvCount() - 1));

                    ActiveTeam.RemoveFromInv(ActiveTeam.GetInvCount() - 1);
                }
                while (ActiveTeam.GetInvCount() + heldSlots > zone.BagRestrict)
                {
                    foreach (Character player in ActiveTeam.Players)
                    {
                        if (player.EquippedItem.ID > -1)
                        {
                            removedItems = true;
                            itemsToStore.Add(player.EquippedItem);
                            player.DequipItem();
                            heldSlots--;
                            break;
                        }
                    }
                }
                ActiveTeam.StoreItems(itemsToStore);
                if (!silent && removedItems)
                {
                    if (zone.BagRestrict > 0)
                    {
                        bagRestrictions.Add(Text.FormatKey("DLG_RESTRICT_ITEM_SLOT", zone.BagRestrict));
                    }
                    else
                    {
                        bagRestrictions.Add(Text.FormatKey("DLG_RESTRICT_ITEM_ALL"));
                    }
                }
            }
            if (bagRestrictions.Count > 0 && !silent)
            {
                string compositeList = Text.BuildList(bagRestrictions.ToArray());
                string finalMsg      = Text.FormatKey("DLG_RESTRICT_BAG", (compositeList[0].ToString()).ToUpper() + compositeList.Substring(1));
                yield return(CoroutineManager.Instance.StartCoroutine(MenuManager.Instance.SetDialogue(finalMsg)));
            }
        }