Beispiel #1
0
        public void CreateEquipped(IIndexedKeybinding[] keybindings)
        {
            int index         = 0;
            var equippedItems = InventoryManager.GetEquippedItems <PlayerInventory>();

            foreach (var item in keybindings)
            {
                ColoredString prefix       = new ColoredString();
                var           equippedItem = ItemManager.GetItem <IItem>(equippedItems[index].ObjectId);

                ColoredString itemName = ItemManager.GetItemName <IItem>(equippedItem.ObjectId);

                // temporary solution for item type formatting specifically for this window
                string itemType = equippedItem.GetType() == typeof(WeaponItem) ? "[WEAPON]" :
                                  equippedItem.GetType() == typeof(HeadItem) ? "[HEAD]" :
                                  equippedItem.GetType() == typeof(BodyItem) ? "[BODY]" :
                                  equippedItem.GetType() == typeof(LegsItem) ? "[LEGS]" : "UNKNOWN";

                string itemId = $"itemId_{equippedItem.ObjectId}";

                var printableItem = new PrintContainerBase()
                {
                    Name        = itemName,
                    Type        = itemType,
                    Data        = "\0",
                    Id          = "\0",
                    ButtonIndex = new ButtonIndex(keybindings[index].Key, Color.Green, Color.White, 0, 0, true)
                };

                _printable.Add(printableItem);
                index++;
            }
        }
Beispiel #2
0
        public void CreateLocations(IIndexedKeybinding[] keybindings)
        {
            int index = 0;

            foreach (var item in keybindings)
            {
                var location = LocationManager.GetLocationByObjectId <ILocation>(item.ObjectId);

                ColoredString locationName = LocationManager.GetLocationName <ILocation>(location.ObjectId);

                if (location.ObjectId == Game.GameSession.Player.CurrentLocation.ObjectId)
                {
                    locationName.SetBackground(new Color(18, 77, 7));
                }

                var printableLocation = new PrintContainerBase()
                {
                    Name        = locationName,
                    Type        = location.MinLevel == 0 && location.MaxLevel == 0 ? "\0" : $"<{location.MinLevel} - {location.MaxLevel}>",
                    Data        = "\0",
                    Id          = "\0",
                    ButtonIndex = new ButtonIndex(keybindings[index].Key, Constants.Theme.ButtonKeyColor, Constants.Theme.ForegroundColor, 0, 0, true)
                };

                _printable.Add(printableLocation);
                index++;
            }
        }
Beispiel #3
0
        public void CreateInventory(IIndexedKeybinding[] keybindings)
        {
            int index = 0; // for keybinding index

            foreach (var item in keybindings)
            {
                var           slotItem = InventoryManager.GetSlot <ISlot>(InventoryManager.Get <PlayerInventory>(), item.ObjectId).Item.FirstOrDefault();
                ColoredString itemName = ItemManager.GetItemName <IItem>(slotItem.ObjectId);

                if (slotItem is MiscItem)
                {
                    itemName += $" x{InventoryManager.GetSlot<ISlot>(Game.GameSession.Player.Inventory, item.ObjectId).Item.Count}";
                }

                // temp
                if (slotItem is not MiscItem)
                {
                    var equippedItemId = InventoryManager.GetEquippedItem <PlayerInventory>(slotItem.GetType()).ObjectId;
                    if (slotItem.ObjectId == equippedItemId)
                    {
                        itemName.SetBackground(new Color(18, 77, 7));
                    }
                }

                // retrieves the description attribute from the class
                string itemType = slotItem?.GetType().GetCustomAttribute <DescriptionAttribute>(false).Description;
                string itemId   = $"slotId_{InventoryManager.GetSlot<ISlot>(Game.GameSession.Player.Inventory, item.ObjectId).ObjectId}, itemId_{slotItem.ObjectId}";

                var printableItem = new PrintContainerBase()
                {
                    Name        = itemName,
                    Type        = itemType,
                    Data        = "\0",
                    Id          = "\0",
                    ButtonIndex = new ButtonIndex(keybindings[index].Key, Color.Green, Color.White, 0, 0, true)
                };

                _printable.Add(printableItem);
                index++;
            }
        }
Beispiel #4
0
        public void CreateAreas(IIndexedKeybinding[] keybindings)
        {
            int index = 0;

            foreach (var item in keybindings)
            {
                var area = AreaManager.GetAreaByObjectId <IArea>(item.ObjectId);

                var areaName = new ColoredString(area.Name);

                var printableArea = new PrintContainerBase()
                {
                    Name        = areaName,
                    Type        = area.MinLevel == 0 && area.MaxLevel == 0 ? "\0" : $"<{area.MinLevel} - {area.MaxLevel}>",
                    Data        = "\0",
                    Id          = "\0",
                    ButtonIndex = new ButtonIndex(keybindings[index].Key, Color.Green, Color.White, 0, 0, true)
                };

                _printable.Add(printableArea);
                index++;
            }
        }