Пример #1
0
        public void Load(Item.Item item)
        {
            informationContainer.Clear();

            this.item = item;

            // include info that all items have (excluding image)
            headerLabel.Text = item.name;

            // if its a weapon, display weapon stats.
            if(item is Weapon)
            {
                Weapon weapon = (Weapon)item;

                // rate of fire
                // ammo (current / total)
                // spread
                // damage

                string info = "Rate of Fire: " + weapon.rateOfFire + "\nLoaded Ammo: " + weapon.LoadedAmmo + "\nAmmo Left: " + weapon.Ammo + "\nAccuracy: " + (100 - weapon.spread) + "%\nDamage: " + weapon.Damage;

                Label otherInfoLabel = new Label();

                otherInfoLabel.Alignment = ControlAlignment.Center;
                otherInfoLabel.Text = info;
                otherInfoLabel.WordWrap = false;
                informationContainer.Add(otherInfoLabel);

                return;
            }
        }
Пример #2
0
 public override bool Action(LivingEntity interactor, String interaction)
 {
     if (item == null || !base.Action(interactor, interaction))
         return false;
     interactor.inventory.Add(item);
     this.item = null;
     this.markForDelete = true;
     return true;
 }
        public DragableControl(Item.Item item, float sideLen = 64)
        {
            this.Size = new Vector2(sideLen, sideLen);
            this.Fill = new FillInfo(item.previewSprite.Texture, Color.White);

            this.item = item;

            textLbl = new Label();
            textLbl.Text = item.name;
            textLbl.AutoResize = true;
            textLbl.Alignment = ControlAlignment.Center;
            //textLbl.parent = this;
            Add(textLbl);

            Weapon testWep;
            if ((testWep = item as Weapon) != null)
            {
                textLbl.Text += "\n" + testWep.LoadedAmmo + " / " + testWep.Ammo;
            }
        }
Пример #4
0
        public static Item.Item LeatherSleeves()
        {
            var leatherSleeves = new Item.Item
            {
                armourType  = Item.Item.ArmourType.Leather,
                eqSlot      = Item.Item.EqSlot.Arms,
                description = new Description()
                {
                    look = "A basic pair of leather sleeves.",
                    exam = "A basic pair of leather sleeves.",
                },
                location    = Item.Item.ItemLocation.Room,
                slot        = Item.Item.EqSlot.Arms,
                type        = Item.Item.ItemType.Armour,
                name        = "Basic pair of leather sleeves.",
                ArmorRating = new ArmourRating()
                {
                    Armour = 2,
                    Magic  = 0
                },
                itemFlags = new EditableList <Item.Item.ItemFlags>()
                {
                    Item.Item.ItemFlags.equipable
                },
                Weight    = 2,
                equipable = true,
                QuestItem = true,
                keywords  = new List <string>()
                {
                    "leather",
                    "sleeves",
                    "leather sleevs"
                }
            };


            return(leatherSleeves);
        }
Пример #5
0
        public static Item.Item BreastPlateOfTyr()
        {
            var BreastPlateOfTyr = new Item.Item
            {
                armourType  = Item.Item.ArmourType.PlateMail,
                eqSlot      = Item.Item.EqSlot.Torso,
                description = new Description()
                {
                    look =
                        "This iron breastplate has impressive pectoral muscles embossed on the front and locks in tightly around the wearers shoulders and waist",
                    exam =
                        "This iron breastplate has a blue tinge and shimers slightly at certain angles in the light, it is well crafted as shown by the detailed pectoral muscles embossed on the front. Benedic Tyr has been engraved on the left chest over the heart.",
                    smell = "It doesn't seem to smell",
                    room  = "An iron breastplate with a blue tinge lays here on the floor",
                    taste = "It tastes like metal",
                    touch = "It feels cold to touch"
                },
                location    = Item.Item.ItemLocation.Room,
                slot        = Item.Item.EqSlot.Torso,
                type        = Item.Item.ItemType.Armour,
                name        = "Breast plate of Tyr",
                ArmorRating = new ArmourRating()
                {
                    Armour = 20,
                    Magic  = 7
                },
                itemFlags = new EditableList <Item.Item.ItemFlags>()
                {
                    Item.Item.ItemFlags.equipable,
                    Item.Item.ItemFlags.glow,
                    Item.Item.ItemFlags.bless,
                },
                Weight    = 15,
                equipable = true
            };

            return(BreastPlateOfTyr);
        }
Пример #6
0
        public static Item.Item LeatherHelmet()
        {
            var leatherHelmet = new Item.Item
            {
                armourType  = Item.Item.ArmourType.Leather,
                eqSlot      = Item.Item.EqSlot.Head,
                description = new Description()
                {
                    look = "A basic looking leather helmet.",
                    exam = "A basic looking leather helmet.",
                },
                location    = Item.Item.ItemLocation.Room,
                slot        = Item.Item.EqSlot.Head,
                type        = Item.Item.ItemType.Armour,
                name        = "Simple leather helmet",
                ArmorRating = new ArmourRating()
                {
                    Armour = 2,
                    Magic  = 0
                },
                itemFlags = new EditableList <Item.Item.ItemFlags>()
                {
                    Item.Item.ItemFlags.equipable
                },
                Weight    = 2,
                equipable = true,
                QuestItem = true,
                keywords  = new List <string>()
                {
                    "leather",
                    "helmet",
                    "leather helmet"
                }
            };


            return(leatherHelmet);
        }
Пример #7
0
        public static Item.Item SteelGreevesOfTyr()
        {
            var SteelGreevesOfTyr = new Item.Item
            {
                armourType  = Item.Item.ArmourType.PlateMail,
                eqSlot      = Item.Item.EqSlot.Legs,
                description = new Description()
                {
                    look =
                        "",
                    exam =
                        "",
                    smell = "It doesn't seem to smell",
                    room  = "",
                    taste = "It tastes like metal",
                    touch = "It feels cold to touch"
                },
                location    = Item.Item.ItemLocation.Room,
                slot        = Item.Item.EqSlot.Legs,
                type        = Item.Item.ItemType.Armour,
                name        = "Greaves of Tyr",
                ArmorRating = new ArmourRating()
                {
                    Armour = 20,
                    Magic  = 7
                },
                itemFlags = new EditableList <Item.Item.ItemFlags>()
                {
                    Item.Item.ItemFlags.equipable,
                    Item.Item.ItemFlags.glow,
                    Item.Item.ItemFlags.bless,
                },
                Weight    = 15,
                equipable = true,
            };

            return(SteelGreevesOfTyr);
        }
Пример #8
0
        public DragableControl(Item.Item item, float sideLen = 64)
        {
            this.Size = new Vector2(sideLen, sideLen);
            this.Fill = new FillInfo(item.previewSprite.Texture, Color.White);

            this.item = item;

            textLbl            = new Label();
            textLbl.Text       = item.name;
            textLbl.AutoResize = true;
            textLbl.Alignment  = ControlAlignment.Center;
            //textLbl.parent = this;
            Add(textLbl);



            Weapon testWep;

            if ((testWep = item as Weapon) != null)
            {
                textLbl.Text += "\n" + testWep.LoadedAmmo + " / " + testWep.Ammo;
            }
        }
Пример #9
0
        public static Item.Item Saber()
        {
            var Saber = new Item.Item
            {
                name = "Saber",
                Weight = 2,
                count = 10,
                equipable = true,
                eqSlot = Item.Item.EqSlot.Wielded,
                slot = Item.Item.EqSlot.Wielded,
                location = Item.Item.ItemLocation.Inventory,
                weaponSpeed = 1,
                weaponType = Item.Item.WeaponType.ShortBlades,
                attackType = Item.Item.AttackType.Slash,
                stats = new Stats()
                {
                    damMax = 8,
                    damMin = 1,
                    damRoll = 0,
                    minUsageLevel = 1,
                    worth = 1
                },
                description = new Description()
                {
                    exam = "A thin light metal saber",
                    look = "A thin light metal saber",
                    room = "A thin light metal saber",
                    smell = "",
                    taste = "",
                    touch = "",
                },
                Gold = 30

            };

            return Saber;
        }
Пример #10
0
        public MapNode findNode(Slot slot, Item.Item item)
        {
            if (item is null)
            {
                return(null);
            }
            if (!(item is IHaulsPeople))
            {
                if (floorNodes.ContainsKey(slot.Y))
                {
                    return(floorNodes[slot.Y]);
                }
                return(null);
            }

            MapNode n = null;

            if (!peopleMovementMap.ContainsKey(slot.ToString()))
            {
                return(null);
            }
            else
            {
                n = peopleMovementMap[slot.ToString()];
            }

            if (item is Elevator && (!n.HasElevator || (n.transportItems[(int)MapNode.Direction.UP] != item && n.transportItems[(int)MapNode.Direction.DOWN] != item)))
            {
                return(null);
            }
            else if (item is IHaulsPeople && n.transportItems[(int)MapNode.Direction.UP] != item)
            {
                return(null);
            }

            return(n);
        }
Пример #11
0
        public static Item.Item ShortIronSword()
        {
            var ShortIronSword = new Item.Item
            {
                name = "Short Iron Sword",
                Weight = 3,
                count = 10,
                equipable = true,
                eqSlot = Item.Item.EqSlot.Wielded,
                slot = Item.Item.EqSlot.Wielded,
                location = Item.Item.ItemLocation.Inventory,
                weaponSpeed = 1,
                weaponType = Item.Item.WeaponType.ShortBlades,
                attackType = Item.Item.AttackType.Pierce,
                stats = new Stats()
                {
                    damMax = 5,
                    damMin = 1,
                    damRoll = 0,
                    minUsageLevel = 1,
                    worth = 1
                },
                description = new Description()
                {
                    exam = "This short sword is a dual-edged smooth blade right down to the black handle that holds it",
                    look = "This is a simple short iron sword",
                    room = "A short iron sword",
                    smell = "",
                    taste = "",
                    touch = "",
                },
                Gold = 35

            };

            return ShortIronSword;
        }
Пример #12
0
        public static Item.Item PlainTop()
        {
            var plainTop = new Item.Item
            {
                armourType  = Item.Item.ArmourType.Cloth,
                eqSlot      = Item.Item.EqSlot.Body,
                description = new Description()
                {
                    look =
                        "This dull looking top is made out of low quality cotton. The only protecction it provides is from the elements.",
                    exam =
                        "This top looks like it has had many previouse owners it's a dull yellow stained beige shirt.",
                    smell = "The top doesn't smell clean or pleasant.",
                    room  = "A top has been left crumpled on the floor",
                    taste = "You wouldn't dare put this horrible looking rag in your mouth.",
                    touch = "Despite being well worn the cotton is still rather soft and warm."
                },
                location    = Item.Item.ItemLocation.Inventory,
                slot        = Item.Item.EqSlot.Body,
                type        = Item.Item.ItemType.Armour,
                name        = "Plain top",
                ArmorRating = new ArmourRating()
                {
                    Armour = 1,
                    Magic  = 0
                },
                itemFlags = new EditableList <Item.Item.ItemFlags>()
                {
                    Item.Item.ItemFlags.equipable
                },
                Weight    = 2,
                equipable = true
            };


            return(plainTop);
        }
Пример #13
0
        public static Item.Item Katana()
        {
            var Katana = new Item.Item
            {
                name = "Katana",
                Weight = 5,
                count = 10,
                equipable = true,
                eqSlot = Item.Item.EqSlot.Wielded,
                slot = Item.Item.EqSlot.Wielded,
                location = Item.Item.ItemLocation.Inventory,
                weaponSpeed = 1,
                weaponType = Item.Item.WeaponType.LongBlades,
                attackType = Item.Item.AttackType.Slash,
                stats = new Stats()
                {
                    damMax = 8,
                    damMin = 1,
                    damRoll = 1,
                    minUsageLevel = 1,
                    worth = 10
                },
                description = new Description()
                {
                    exam = "A katana",
                    look = "A katana",
                    room = "A katana",
                    smell = "",
                    taste = "",
                    touch = "",
                },
                Gold = 40

            };

            return Katana;
        }
Пример #14
0
        public static Item.Item BastardSword()
        {
            var BastardSword = new Item.Item
            {
                name = "Bastard Sword",
                Weight = 7,
                count = 10,
                equipable = true,
                eqSlot = Item.Item.EqSlot.Wielded,
                slot = Item.Item.EqSlot.Wielded,
                location = Item.Item.ItemLocation.Inventory,
                weaponSpeed = 1,
                weaponType = Item.Item.WeaponType.ShortBlades,
                attackType = Item.Item.AttackType.Slash,
                stats = new Stats()
                {
                    damMax = 12,
                    damMin = 1,
                    damRoll = 1,
                    minUsageLevel = 1,
                    worth = 10
                },
                description = new Description()
                {
                    exam = "A large iron sword",
                    look = "A large iron sword",
                    room = "A large iron sword",
                    smell = "",
                    taste = "",
                    touch = "",
                },
                Gold = 70

            };

            return BastardSword;
        }
        public bool PickupItem(Item.Item item)
        {
            if (item.Meta.Type == ItemType.Scraps)
            {
                var value = Context.Dungeon.Destroy(item);
                Debug.Log($"{Context.Self.name} picked up {value} scraps.");
                Scraps += value;
                return(true);
            }

            foreach (var i in _inventory)
            {
                if (i.Meta == item.Meta)
                {
                    var value = Context.Dungeon.Destroy(item);
                    Debug.Log($"{Context.Self.name} already has a {item.Meta.Name}. Turn it into {value} scraps!");
                    Scraps += value;
                    return(true);
                }
            }

            if (_inventory.Count >= 10)
            {
                Debug.Log($"{Context.Self.name} failed to pick up a {item.Meta.Name}. Inventory is full.");
                return(false);
            }

            Context.Dungeon.PickupItemFromWorld(item);
            _inventory.Add(item);
            Debug.Log($"{Context.Self.name} picked up a {item.Meta.Name}");

            if (PrimaryWeapon == null && item.Meta.Type == ItemType.Weapon)
            {
                SetPrimaryWeapon(item);
            }
            return(true);
        }
Пример #16
0
        public static Item.Item IronHatchet()
        {
            var IronHatchet = new Item.Item
            {
                name        = "Simple Iron Hatchet",
                Weight      = 5,
                count       = 10,
                equipable   = true,
                eqSlot      = Item.Item.EqSlot.Wielded,
                slot        = Item.Item.EqSlot.Wielded,
                location    = Item.Item.ItemLocation.Inventory,
                weaponSpeed = 1,
                weaponType  = Item.Item.WeaponType.Axe,
                attackType  = Item.Item.AttackType.Chop,
                stats       = new Stats()
                {
                    damMax        = 8,
                    damMin        = 1,
                    damRoll       = 0,
                    minUsageLevel = 1,
                    worth         = 1
                },
                description = new Description()
                {
                    exam  = "A small iron hatchet, with a crudely sharpened metal head and a sturdy wooden handle. ",
                    look  = "A small iron hatchet, with a crudely sharpened metal head and a sturdy wooden handle. ",
                    room  = "A simple Iron Hatchet",
                    smell = "",
                    taste = "",
                    touch = "",
                },
                Gold = 35
            };

            return(IronHatchet);
        }
Пример #17
0
        public static Item.Item DoubleAxe()
        {
            var DoubleAxe = new Item.Item
            {
                name        = "Double sided Axe",
                Weight      = 5,
                count       = 10,
                equipable   = true,
                eqSlot      = Item.Item.EqSlot.Wielded,
                slot        = Item.Item.EqSlot.Wielded,
                location    = Item.Item.ItemLocation.Inventory,
                weaponSpeed = 3,
                weaponType  = Item.Item.WeaponType.Axe,
                attackType  = Item.Item.AttackType.Chop,
                stats       = new Stats()
                {
                    damMax        = 10,
                    damMin        = 1,
                    damRoll       = 1,
                    minUsageLevel = 1,
                    worth         = 1
                },
                description = new Description()
                {
                    exam  = "A Double sided Axe",
                    look  = "A Double sided Axe",
                    room  = "A Double sided Axe",
                    smell = "",
                    taste = "",
                    touch = "",
                },
                Gold = 40
            };

            return(DoubleAxe);
        }
Пример #18
0
        public static Item.Item LongIronSword()
        {
            var LongIronSword = new Item.Item
            {
                name        = "Long Iron Sword",
                Weight      = 12,
                count       = 10,
                equipable   = true,
                eqSlot      = Item.Item.EqSlot.Wielded,
                slot        = Item.Item.EqSlot.Wielded,
                location    = Item.Item.ItemLocation.Inventory,
                weaponSpeed = 4,
                weaponType  = Item.Item.WeaponType.ShortBlades,
                attackType  = Item.Item.AttackType.Pierce,
                stats       = new Stats()
                {
                    damMax        = 12,
                    damMin        = 1,
                    damRoll       = 0,
                    minUsageLevel = 1,
                    worth         = 1
                },
                description = new Description()
                {
                    exam  = "This long sword is a dual-edged smooth blade right down to the black handle that holds it",
                    look  = "A traditional sharp iron long sword",
                    room  = "A long iron sword",
                    smell = "",
                    taste = "",
                    touch = "",
                },
                Gold = 25
            };

            return(LongIronSword);
        }
Пример #19
0
        public static Item.Item HuntingKnife()
        {
            var HuntingKnife = new Item.Item
            {
                name        = "Hunting Knife",
                Weight      = 2,
                count       = 10,
                equipable   = true,
                eqSlot      = Item.Item.EqSlot.Wielded,
                slot        = Item.Item.EqSlot.Wielded,
                location    = Item.Item.ItemLocation.Inventory,
                weaponSpeed = 1,
                weaponType  = Item.Item.WeaponType.ShortBlades,
                attackType  = Item.Item.AttackType.Slash,
                stats       = new Stats()
                {
                    damMax        = 6,
                    damMin        = 1,
                    damRoll       = 1,
                    minUsageLevel = 1,
                    worth         = 10
                },
                description = new Description()
                {
                    exam  = "A hunting knife",
                    look  = "A hunting knife",
                    room  = "A hunting knife",
                    smell = "",
                    taste = "",
                    touch = "",
                },
                Gold = 20
            };

            return(HuntingKnife);
        }
Пример #20
0
        public static Item.Item IronDagger()
        {
            var ironDagger = new Item.Item
            {
                name        = "Simple Iron Dagger",
                Weight      = 1,
                count       = 10,
                equipable   = true,
                eqSlot      = Item.Item.EqSlot.Wielded,
                slot        = Item.Item.EqSlot.Wielded,
                location    = Item.Item.ItemLocation.Inventory,
                weaponSpeed = 1,
                weaponType  = Item.Item.WeaponType.ShortBlades,
                attackType  = Item.Item.AttackType.Pierce,
                stats       = new Stats()
                {
                    damMax        = 4,
                    damMin        = 1,
                    damRoll       = 0,
                    minUsageLevel = 1,
                    worth         = 1
                },
                description = new Description()
                {
                    exam  = "This is a small simple iron hunting knife. The dark iron blade is partly serrated, and the wooden handle curves inward for a better grip. ",
                    look  = "This is a small simple iron hunting knife. The dark iron blade is partly serrated, and the wooden handle curves inward for a better grip. ",
                    room  = "A small serrated iron blade",
                    smell = "",
                    taste = "",
                    touch = "",
                },
                Gold = 20
            };

            return(ironDagger);
        }
Пример #21
0
        public static Item.Item BronzeCurvedDagger()
        {
            var BronzeCurvedDagger = new Item.Item
            {
                name        = "A bronze curved dagger",
                Weight      = 4,
                count       = 1,
                equipable   = true,
                eqSlot      = Item.Item.EqSlot.Wielded,
                slot        = Item.Item.EqSlot.Wielded,
                location    = Item.Item.ItemLocation.Inventory,
                weaponSpeed = 1,
                weaponType  = Item.Item.WeaponType.ShortBlades,
                attackType  = Item.Item.AttackType.Pierce,
                stats       = new Stats()
                {
                    damMax        = 8,
                    damMin        = 1,
                    damRoll       = 1,
                    minUsageLevel = 1,
                    worth         = 15
                },
                description = new Description()
                {
                    exam  = "A bronze curved dagger",
                    look  = "A bronze curved dagger",
                    room  = "A bronze curved dagger",
                    smell = "",
                    taste = "",
                    touch = "",
                },
                Gold = 120
            };

            return(BronzeCurvedDagger);
        }
Пример #22
0
        public static Item.Item GreatHammer()
        {
            var GreatHammer = new Item.Item
            {
                name        = "Great Hammer",
                Weight      = 20,
                count       = 10,
                equipable   = true,
                eqSlot      = Item.Item.EqSlot.Wielded,
                slot        = Item.Item.EqSlot.Wielded,
                location    = Item.Item.ItemLocation.Inventory,
                weaponSpeed = 10,
                weaponType  = Item.Item.WeaponType.Blunt,
                attackType  = Item.Item.AttackType.Crush,
                stats       = new Stats()
                {
                    damMax        = 16,
                    damMin        = 1,
                    damRoll       = 0,
                    minUsageLevel = 1,
                    worth         = 1
                },
                description = new Description()
                {
                    exam  = "A large metal war hammer",
                    look  = "A large metal war hammer",
                    room  = "A large metal war hammer",
                    smell = "",
                    taste = "",
                    touch = "",
                },
                Gold = 70
            };

            return(GreatHammer);
        }
Пример #23
0
        public static Item.Item BoarSpear()
        {
            var BoarSpear = new Item.Item
            {
                name        = "Boar Spear",
                Weight      = 7,
                count       = 10,
                equipable   = true,
                eqSlot      = Item.Item.EqSlot.Wielded,
                slot        = Item.Item.EqSlot.Wielded,
                location    = Item.Item.ItemLocation.Inventory,
                weaponSpeed = 1,
                weaponType  = Item.Item.WeaponType.Spear,
                attackType  = Item.Item.AttackType.Pierce,
                stats       = new Stats()
                {
                    damMax        = 6,
                    damMin        = 2,
                    damRoll       = 1,
                    minUsageLevel = 1,
                    worth         = 10
                },
                description = new Description()
                {
                    exam  = "A Boar Spear",
                    look  = "A Boar Spear",
                    room  = "A Boar Spear",
                    smell = "",
                    taste = "",
                    touch = "",
                },
                Gold = 50
            };

            return(BoarSpear);
        }
Пример #24
0
        public void ApplyItemClient(Item.Item item)
        {
            //Debug.Log("Table was clicked!");

            PlayerActionController controller = PlayerActionController.Current;
            Humanoid localPlayer = controller.LocalPlayerMob as Humanoid;

            if (localPlayer == null)
            {
                return;
            }


            Item.Item heldItem = localPlayer.GetItemBySlot(controller.ActiveHand);

            if (heldItem == item)
            {
                // Calculating item offset
                Vector2 mousePosition = controller.MouseWorldPosition;
                Vector2 tablePosition = transform.position;
                Vector2 offset        = mousePosition - tablePosition;
                localPlayer.DropItem(controller.ActiveHand, Cell, offset);
            }
        }
Пример #25
0
        public static Item.Item IronMace()
        {
            var ironMace = new Item.Item
            {
                name        = "Simple Iron Mace",
                Weight      = 4,
                count       = 10,
                equipable   = true,
                eqSlot      = Item.Item.EqSlot.Wielded,
                slot        = Item.Item.EqSlot.Wielded,
                location    = Item.Item.ItemLocation.Inventory,
                weaponSpeed = 1,
                weaponType  = Item.Item.WeaponType.ShortBlades,
                attackType  = Item.Item.AttackType.Pierce,
                stats       = new Stats()
                {
                    damMax        = 8,
                    damMin        = 3,
                    damRoll       = 0,
                    minUsageLevel = 1,
                    worth         = 1
                },
                description = new Description()
                {
                    exam  = "This mace has an iron handle with a leather grip. The iron handle extends up housing a circular ball of metal covered in spikes ",
                    look  = "A circular ball of metal covered in spikes sits upon this metal pole",
                    room  = "A Simple Iron Mace",
                    smell = "",
                    taste = "",
                    touch = "",
                },
                Gold = 30
            };

            return(ironMace);
        }
Пример #26
0
        public static Item.Item PlainTrousers()
        {
            var plainTrousers = new Item.Item
            {
                armourType  = Item.Item.ArmourType.Cloth,
                eqSlot      = Item.Item.EqSlot.Legs,
                description = new Description()
                {
                    look =
                        "This pair of trousers looks very cheap made out of low quality cotton. The only protection they provide is from the elements.",
                    exam =
                        "This top looks like it has had many previouse owners it's a dull yellow stained pair of trousers.",
                    smell = "The trousers don't smell clean or pleasant.",
                    room  = "A pair of trousers has been left crumpled on the floor",
                    taste = "You wouldn't dare put these horrible looking rags in your mouth.",
                    touch = "Despite being well worn the cotton is still rather soft and warm."
                },
                location    = Item.Item.ItemLocation.Inventory,
                slot        = Item.Item.EqSlot.Legs,
                type        = Item.Item.ItemType.Armour,
                name        = "A pair of plain trousers",
                ArmorRating = new ArmourRating()
                {
                    Armour = 1,
                    Magic  = 0
                },
                itemFlags = new EditableList <Item.Item.ItemFlags>()
                {
                    Item.Item.ItemFlags.equipable
                },
                Weight    = 0.2,
                equipable = true
            };

            return(plainTrousers);
        }
Пример #27
0
        public static Item.Item WoodenQuarterstaff()
        {
            var WoodenQuarterstaff = new Item.Item
            {
                name        = "Wooden Quarterstaff",
                Weight      = 1,
                count       = 10,
                equipable   = true,
                eqSlot      = Item.Item.EqSlot.Wielded,
                slot        = Item.Item.EqSlot.Wielded,
                location    = Item.Item.ItemLocation.Inventory,
                weaponSpeed = 1,
                weaponType  = Item.Item.WeaponType.ShortBlades,
                attackType  = Item.Item.AttackType.Pierce,
                stats       = new Stats()
                {
                    damMax        = 5,
                    damMin        = 1,
                    damRoll       = 0,
                    minUsageLevel = 1,
                    worth         = 1
                },
                description = new Description()
                {
                    exam  = "This is a long wooden staff built to hit people with or just to help you walk difficult paths, whatever you use it for, have fun.",
                    look  = "This is a long wooden staff",
                    room  = "A long wooden staff",
                    smell = "",
                    taste = "",
                    touch = "",
                },
                Gold = 25
            };

            return(WoodenQuarterstaff);
        }
Пример #28
0
 public bool Condition(Item.Item item) => item.Effect == ItemEffectType.Teleport && item.EffectValue == 2;
Пример #29
0
 public bool Condition(Item.Item item)
 {
     return((item.ItemType == ItemType.Special) && (item.Effect == ItemEffectType.Vehicle));
 }
Пример #30
0
 public bool Condition(Item.Item item) =>
 item.ItemType == ItemType.Magical && item.Effect == ItemEffectType.Speaker;
Пример #31
0
        public virtual Item.Item GetItem(string title, string url, string extraInfo)
        {
            var item = new Item.Item()
                           {
                               Tags = new List<string>(),
                               ItemImages = new List<ItemImage>(),
                               Url = url//,
                               //Keyword = keyword
                           };

            string itemHtml = "";
            var maxTry = 3;
            var tryCount = 0;
            while (tryCount < maxTry)
            {
                if (_options.UseProxy)
                {
                    itemHtml = WebHelper.CurlSimple(url, "text/html",
                        new WebProxy(_options.ProxyAddress + ":" + _options.ProxyPort));
                }
                else
                {
                    itemHtml = WebHelper.CurlSimple(url);
                }
                if (!string.IsNullOrEmpty(itemHtml))
                {
                    break;
                }
                Thread.Sleep(TimeSpan.FromSeconds(3));
                tryCount++;
            }

            if (itemHtml == null) return null;
            var htmlDoc = new HtmlDocument();
            htmlDoc.LoadHtml(itemHtml);

            var metaDescription = htmlDoc.DocumentNode.SelectSingleNode(MetaDescriptionXPath);
            if (metaDescription != null)
            {
                item.MetaDescription = metaDescription.Attributes["content"].Value;
            }

            var tags = htmlDoc.DocumentNode.SelectNodes(TagsXPath);
            if (tags != null)
            {
                foreach (var tag in tags)
                {
                    item.Tags.Add(tag.InnerText);
                }
            }

            var images = htmlDoc.DocumentNode.SelectNodes(ImagesXPath);
            if (images != null)
            {
                foreach (var image in images)
                {

                    var imageUrl = image.Attributes[ImagesAttribute] == null ? "" : image.Attributes[ImagesAttribute].Value;
                    if (string.IsNullOrEmpty(imageUrl))
                    {
                        imageUrl = image.Attributes[AlternativeImagesAttribute] == null ? "" : image.Attributes[AlternativeImagesAttribute].Value;
                        if (string.IsNullOrEmpty(imageUrl))
                        {
                            continue;
                        }
                    }
                    if (!imageUrl.StartsWith("http://") && !imageUrl.StartsWith("https://"))
                    {
                        imageUrl = "http:" + (imageUrl.StartsWith("//") ? "" : "//") + imageUrl;
                    }
                    item.ItemImages.Add(new ItemImage() { OriginalSource = imageUrl, Primary = true });
                }
            }

            var metaPrice = htmlDoc.DocumentNode.SelectSingleNode(PriceXPath);
            if (metaPrice != null)
            {
                item.Price = GetPriceValue(metaPrice);
            }

            var content = htmlDoc.DocumentNode.SelectSingleNode(DescriptionXPath);
            if (content != null)
            {
                item.Content = Regex.Replace(content.InnerHtml, "<a.*>.*</a>", "");
                item.Content = RefineContent(item.Content);
                var converterFunctions = new ConverterFunctions();
                item.WordCount = converterFunctions.StripTags(content.InnerHtml, new List<string>()).WordCount();

            }
            item.Title = title;
            var regex = new Regex(IdRegex);
            var match = regex.Match(url);
            if (match.Success)
            {
                item.Id = Int32.Parse(match.Groups[1].Value);
            }
            item.Site = Name;
            SetCreatedDate(htmlDoc, item);
            return item;
        }
Пример #32
0
 public bool Condition(Item.Item item) =>
 item.ItemType == ItemType.Special && item.Effect == ItemEffectType.Vehicle;
Пример #33
0
        public void PickupItemFromWorld(Item.Item item)
        {
            item.Pickup();

            _worldItems.Remove(item);
        }
Пример #34
0
 public void Setup(Item.Item item, IInteractibleMeta meta)
 {
     _item = item;
     _meta = (EquipableMeta)meta;
 }
Пример #35
0
 public EntityItem(FloatRectangle rect, Item.Item item)
     : base(rect, item.previewSprite)
 {
     this.item = item;
 }