Exemple #1
0
        protected override void ChoiceChanged()
        {
            int totalChoice = CurrentChoiceTotal;
            int index       = availableItems[totalChoice];

            if (index < DataManager.Instance.DataIndices[DataManager.DataType.Item].Count)
            {
                summaryMenu.SetItem(new InvItem(index, false, 1));
            }
            else
            {
                summaryMenu.SetItem(DataManager.Instance.Save.ActiveTeam.BoxStorage[index - DataManager.Instance.DataIndices[DataManager.DataType.Item].Count]);
            }
            base.ChoiceChanged();
        }
Exemple #2
0
        protected override void ChoiceChanged()
        {
            InvItem item = Goods[CurrentChoiceTotal].Item1;

            summaryMenu.SetItem(item);
            base.ChoiceChanged();
        }
Exemple #3
0
        protected override void ChoiceChanged()
        {
            InvItem item = new InvItem(AllowedGoods[CurrentChoiceTotal]);

            summaryMenu.SetItem(item);
            base.ChoiceChanged();
        }
        protected override void ChoiceChanged()
        {
            InvItem item = getChosenItemID(CurrentChoiceTotal);

            summaryMenu.SetItem(item);
            base.ChoiceChanged();
        }
Exemple #5
0
        protected override void ChoiceChanged()
        {
            InvItem item = getChosenItemID(CurrentPage * SpacesPerPage + CurrentChoice);

            summaryMenu.SetItem(item);
            base.ChoiceChanged();
        }
Exemple #6
0
        protected override void ChoiceChanged()
        {
            InvItem item = Goods[CurrentPage * SpacesPerPage + CurrentChoice].Item1;

            summaryMenu.SetItem(item);
            base.ChoiceChanged();
        }
Exemple #7
0
        protected override void ChoiceChanged()
        {
            int chosenSlot = CurrentChoiceTotal;

            defaultChoice = chosenSlot;
            InvItem item = getChosenItemID(chosenSlot);

            summaryMenu.SetItem(item);
            base.ChoiceChanged();
        }
Exemple #8
0
        protected override void ChoiceChanged()
        {
            Tuple <int, int[]> trade = Goods[AllowedGoods[CurrentChoiceTotal]];
            ItemData           entry = DataManager.Instance.GetItem(trade.Item1);
            InvItem            item  = new InvItem(trade.Item1);

            summaryMenu.SetItem(item);
            tradeSummary.SetTrade(trade.Item2, PriceList[entry.Rarity], itemPresence, presenceCount);
            base.ChoiceChanged();
        }
Exemple #9
0
        public ItemUnderfootMenu(int mapItemSlot)
        {
            this.mapItemSlot = mapItemSlot;
            MapItem mapItem  = ZoneManager.Instance.CurrentMap.Items[mapItemSlot];
            string  itemName = mapItem.GetDungeonName();

            List <MenuTextChoice> choices = new List <MenuTextChoice>();

            bool invFull = (DungeonScene.Instance.ActiveTeam.GetInvCount() >= DungeonScene.Instance.ActiveTeam.GetMaxInvSlots(ZoneManager.Instance.CurrentZone));
            bool hasItem = (DungeonScene.Instance.FocusedCharacter.EquippedItem.ID > -1);

            if (mapItem.IsMoney)
            {
                choices.Add(new MenuTextChoice(Text.FormatKey("MENU_GROUND_GET"), PickupAction));
            }
            else
            {
                Data.ItemData entry = Data.DataManager.Instance.GetItem(mapItem.Value);
                //disable pick up for full inv
                //disable swap for empty inv
                bool canGet = (DungeonScene.Instance.ActiveTeam.GetInvCount() < DungeonScene.Instance.ActiveTeam.GetMaxInvSlots(ZoneManager.Instance.CurrentZone));
                if (!canGet && entry.MaxStack > 1)
                {
                    //find an inventory slot that isn't full stack
                    foreach (InvItem item in DungeonScene.Instance.ActiveTeam.EnumerateInv())
                    {
                        if (item.ID == mapItem.Value && item.Cursed == mapItem.Cursed && item.HiddenValue < entry.MaxStack)
                        {
                            canGet = true;
                            break;
                        }
                    }
                }
                bool hasItems = (DungeonScene.Instance.ActiveTeam.GetInvCount() > 0);

                choices.Add(new MenuTextChoice(Text.FormatKey("MENU_GROUND_GET"), PickupAction, canGet, canGet ? Color.White : Color.Red));
                choices.Add(new MenuTextChoice(Text.FormatKey("MENU_ITEM_REPLACE"), ReplaceAction, hasItems, hasItems ? Color.White : Color.Red));

                switch (entry.UsageType)
                {
                case Data.ItemData.UseType.Eat:
                {
                    choices.Add(new MenuTextChoice(Text.FormatKey("MENU_ITEM_EAT"), UseSelfAction, !mapItem.Cursed, mapItem.Cursed ? Color.Red : Color.White));
                    break;
                }

                case Data.ItemData.UseType.Drink:
                {
                    choices.Add(new MenuTextChoice(Text.FormatKey("MENU_ITEM_DRINK"), UseSelfAction, !mapItem.Cursed, mapItem.Cursed ? Color.Red : Color.White));
                    break;
                }

                case Data.ItemData.UseType.Use:
                case Data.ItemData.UseType.UseOther:
                {
                    choices.Add(new MenuTextChoice(Text.FormatKey("MENU_ITEM_USE"), UseSelfAction, !mapItem.Cursed, mapItem.Cursed ? Color.Red : Color.White));
                    break;
                }

                case Data.ItemData.UseType.Learn:
                {
                    //if the character is teaching to himself, need to disable this choice if not compatible
                    bool canLearn = TeachMenu.CanLearnSkill(DungeonScene.Instance.FocusedCharacter, DungeonScene.Instance.FocusedCharacter, BattleContext.FLOOR_ITEM_SLOT);
                    choices.Add(new MenuTextChoice(Text.FormatKey("MENU_ITEM_LEARN"), UseSelfAction, canLearn && !mapItem.Cursed, (canLearn && !mapItem.Cursed) ? Color.White : Color.Red));
                    break;
                }
                }

                //hold item
                bool allowHold = (!invFull || hasItem);
                if (hasItem)
                {
                    ItemData equipEntry = DataManager.Instance.GetItem(DungeonScene.Instance.FocusedCharacter.EquippedItem.ID);
                    if (equipEntry.CannotDrop)
                    {
                        allowHold = false;
                    }
                }
                choices.Add(new MenuTextChoice(Text.FormatKey("MENU_ITEM_HOLD"), HoldAction, allowHold, allowHold ? Color.White : Color.Red));

                if (entry.UsageType == Data.ItemData.UseType.Throw)
                {
                    int choiceIndex = choices.Count - 1;
                    choices.Insert(choiceIndex, new MenuTextChoice(Text.FormatKey("MENU_ITEM_THROW"), ThrowAction));
                }
                else
                {
                    choices.Add(new MenuTextChoice(Text.FormatKey("MENU_ITEM_THROW"), ThrowAction));
                }
                if (entry.UsageType == Data.ItemData.UseType.Learn)
                {
                    choices.Add(new MenuTextChoice(Text.FormatKey("MENU_INFO"), InfoAction));
                }
            }
            choices.Add(new MenuTextChoice(Text.FormatKey("MENU_EXIT"), ExitAction));

            if (!mapItem.IsMoney)
            {
                summaryMenu = new ItemSummary(Rect.FromPoints(new Loc(16, GraphicsManager.ScreenHeight - 8 - 4 * VERT_SPACE - GraphicsManager.MenuBG.TileHeight * 2),
                                                              new Loc(GraphicsManager.ScreenWidth - 16, GraphicsManager.ScreenHeight - 8)));
                summaryMenu.SetItem(new InvItem(mapItem.Value, mapItem.Cursed, mapItem.HiddenValue));
            }

            int menuwidth = CalculateChoiceLength(choices, 72);

            Initialize(new Loc(GraphicsManager.ScreenWidth - 16 - menuwidth, 16), menuwidth, choices.ToArray(), 0, itemName);
        }