Exemplo n.º 1
0
        public void BuildDiscoItems()
        {
            var expectedXml = Resource.Get("Xmpp.Disco.discoitems1.xml");

            Items items = new Items {
                Node = "http://jabber.org/protocol/tune"
            };

            items.AddItem(new Item("*****@*****.**", "node1", "name1"));
            items.AddItem(new Item("*****@*****.**", "node2", "name2"));
            items.AddItem(new Item("*****@*****.**", "node3", "name3"));

            items.ShouldBe(expectedXml);
        }
Exemplo n.º 2
0
        private void PopulateDatabases()
        {
            // databases
            var dbs = Items.AddItem(RepositoryItemType.Databases);

            var dict   = new Dictionary <GeoDatabaseType, IServerItem>();
            var values = Enum.GetValues(typeof(GeoDatabaseType));

            foreach (GeoDatabaseType value in values)
            {
                var item = dbs.SubItems.AddServer(value);
                dict.Add(value, item);
            }

            foreach (var cn in _repository.Connections)
            {
                var server = dict[cn.DatabaseType];
                server.SubItems.AddDatabase(cn);
            }

            dbs.Expand();

            foreach (var item in dbs.SubItems)
            {
                item.Expand();
            }
        }
Exemplo n.º 3
0
    public bool AddItem(Item item)
    {
        Items ItemsManager = new Items();
        bool  confirmation = ItemsManager.AddItem(item);

        return(confirmation);
    }
Exemplo n.º 4
0
        public bool AddAnItem(Item newItem)
        {
            bool  Confirmation;
            Items itemManager = new Items();

            Confirmation = itemManager.AddItem(newItem);
            return(Confirmation);
        }
Exemplo n.º 5
0
    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            items.AddItem(0);
            items.AddItem(1);
        }
        if (Input.GetKeyDown(KeyCode.Backspace))
        {
            items.RemoveItem(0);
        }

        if (Input.GetKeyDown(KeyCode.Tab))
        {
            items.RestetItems();
        }
    }
Exemplo n.º 6
0
    private void Start()
    {
        for (int i = 0; i < Weapons.Count; i++)
        {
            Items.AddItem(Weapons[i]);
        }

        Items.OnWeaponBuy += BuyWeapon;
    }
        public override void Populate()
        {
            var humanFacialHairRSIPath = SharedSpriteComponent.TextureRoot / "Mob/human_facial_hair.rsi";
            var humanFacialHairRSI     = ResourceCache.GetResource <RSIResource>(humanFacialHairRSIPath).RSI;

            foreach (var(styleName, styleState) in HairStyles.FacialHairStylesMap)
            {
                Items.AddItem(styleName, humanFacialHairRSI[styleState].Frame0);
            }
        }
Exemplo n.º 8
0
    public Boolean AddItem(String itemCode, String description, Decimal unitPrice, Int32 stock)
    {
        Items itemManager = new Items();
        Item  item        = new Item(
            itemCode: itemCode,
            description: description,
            unitPrice: unitPrice,
            stock: stock);

        var confirmation = itemManager.AddItem(item);

        return(confirmation);
    }
Exemplo n.º 9
0
        public override void Populate()
        {
            var humanFacialHairRSIPath = SharedSpriteComponent.TextureRoot / "Mobs/Customization/human_facial_hair.rsi";
            var humanFacialHairRSI     = ResC.GetResource <RSIResource>(humanFacialHairRSIPath).RSI;

            var styles = HairStyles.FacialHairStylesMap.ToList();

            styles.Sort(HairStyles.FacialHairStyleComparer);

            foreach (var(styleName, styleState) in HairStyles.FacialHairStylesMap)
            {
                Items.AddItem(styleName, humanFacialHairRSI[styleState].Frame0);
            }
        }
Exemplo n.º 10
0
        private void PopulateFileSystem()
        {
            // file system
            var folders = Items.AddItem(RepositoryItemType.FileSystem);

            foreach (var path in _repository.Folders)
            {
                folders.SubItems.AddFolder(path, true);
            }

            folders.Expand();

            _expandedFolders = new HashSet <string>(_repository.ExpandedFolders.Select(f => f.ToLower()));

            RestoreFoldersExpandedState(folders);
        }
Exemplo n.º 11
0
        public static Iq CreateRequestAvatarStanza(Jid to, string id)
        {
            var pIq = new PubSubIq
            {
                To   = to,
                Type = IqType.Get
            };

            var items = new Items
            {
                Node = Namespaces.AvatarData
            };

            items.AddItem(new Item {
                Id = id
            });

            pIq.PubSub.Items = items;

            return(pIq);
        }
Exemplo n.º 12
0
        private void PopulateTms()
        {
            var root = Items.AddItem(RepositoryItemType.TmsRoot);

            foreach (var g in _repository.TmsGroups)
            {
                bool expanded = g.Expanded;

                var groupItem = root.SubItems.AddGroup(g);

                if (expanded)
                {
                    groupItem.Expand();
                }
            }

            var group = GetGroup(RepositoryItemType.TmsRoot, TmsProvider.DefaultGroupId);

            if (group != null)
            {
                foreach (var p in _repository.DefaultTmsProviders)
                {
                    group.SubItems.AddTmsProvider(p);
                }
            }

            group = GetGroup(RepositoryItemType.TmsRoot, TmsProvider.CustomGroupId);
            if (group != null)
            {
                foreach (var item in _repository.TmsProviders)
                {
                    group.SubItems.AddTmsProvider(item);
                }
            }

            root.Expand();
        }
Exemplo n.º 13
0
        public void SetEnemyEquipment(int variant)
        {
            PlayerEntity player    = GameManager.Instance.PlayerEntity;
            int          itemLevel = player.Level;
            Genders      gender    = player.Gender;
            Races        race      = player.Race;
            int          chance    = 0;

            if (variant == 0)
            {
                // right-hand weapon
                int item = UnityEngine.Random.Range((int)Game.Items.Weapons.Broadsword, (int)(Game.Items.Weapons.Longsword) + 1);
                Items.DaggerfallUnityItem weapon = Game.Items.ItemBuilder.CreateWeapon((Items.Weapons)item, Game.Items.ItemBuilder.RandomMaterial(itemLevel));
                ItemEquipTable.EquipItem(weapon, true, false);
                Items.AddItem(weapon);

                chance = 50;

                // left-hand shield
                item = UnityEngine.Random.Range((int)Game.Items.Armor.Buckler, (int)(Game.Items.Armor.Round_Shield) + 1);
                if (UnityEngine.Random.Range(1, 101) <= chance)
                {
                    Items.DaggerfallUnityItem armor = Game.Items.ItemBuilder.CreateArmor(gender, race, (Items.Armor)item, Game.Items.ItemBuilder.RandomArmorMaterial(itemLevel));
                    ItemEquipTable.EquipItem(armor, true, false);
                    Items.AddItem(armor);
                }
                // left-hand weapon
                else if (UnityEngine.Random.Range(1, 101) <= chance)
                {
                    item   = UnityEngine.Random.Range((int)Game.Items.Weapons.Dagger, (int)(Game.Items.Weapons.Shortsword) + 1);
                    weapon = Game.Items.ItemBuilder.CreateWeapon((Items.Weapons)item, Game.Items.ItemBuilder.RandomMaterial(itemLevel));
                    ItemEquipTable.EquipItem(weapon, true, false);
                    Items.AddItem(weapon);
                }
            }
            else
            {
                // right-hand weapon
                int item = UnityEngine.Random.Range((int)Game.Items.Weapons.Claymore, (int)(Game.Items.Weapons.Battle_Axe) + 1);
                Items.DaggerfallUnityItem weapon = Game.Items.ItemBuilder.CreateWeapon((Items.Weapons)item, Game.Items.ItemBuilder.RandomMaterial(itemLevel));
                ItemEquipTable.EquipItem(weapon, true, false);
                Items.AddItem(weapon);

                if (variant == 1)
                {
                    chance = 75;
                }
                else if (variant == 2)
                {
                    chance = 90;
                }
            }
            // helm
            if (UnityEngine.Random.Range(1, 101) <= chance)
            {
                Items.DaggerfallUnityItem armor = Game.Items.ItemBuilder.CreateArmor(gender, race, Game.Items.Armor.Helm, Game.Items.ItemBuilder.RandomArmorMaterial(itemLevel));
                ItemEquipTable.EquipItem(armor, true, false);
                Items.AddItem(armor);
            }
            // right pauldron
            if (UnityEngine.Random.Range(1, 101) <= chance)
            {
                Items.DaggerfallUnityItem armor = Game.Items.ItemBuilder.CreateArmor(gender, race, Game.Items.Armor.Right_Pauldron, Game.Items.ItemBuilder.RandomArmorMaterial(itemLevel));
                ItemEquipTable.EquipItem(armor, true, false);
                Items.AddItem(armor);
            }
            // left pauldron
            if (UnityEngine.Random.Range(1, 101) <= chance)
            {
                Items.DaggerfallUnityItem armor = Game.Items.ItemBuilder.CreateArmor(gender, race, Game.Items.Armor.Left_Pauldron, Game.Items.ItemBuilder.RandomArmorMaterial(itemLevel));
                ItemEquipTable.EquipItem(armor, true, false);
                Items.AddItem(armor);
            }
            // cuirass
            if (UnityEngine.Random.Range(1, 101) <= chance)
            {
                Items.DaggerfallUnityItem armor = Game.Items.ItemBuilder.CreateArmor(gender, race, Game.Items.Armor.Cuirass, Game.Items.ItemBuilder.RandomArmorMaterial(itemLevel));
                ItemEquipTable.EquipItem(armor, true, false);
                Items.AddItem(armor);
            }
            // greaves
            if (UnityEngine.Random.Range(1, 101) <= chance)
            {
                Items.DaggerfallUnityItem armor = Game.Items.ItemBuilder.CreateArmor(gender, race, Game.Items.Armor.Greaves, Game.Items.ItemBuilder.RandomArmorMaterial(itemLevel));
                ItemEquipTable.EquipItem(armor, true, false);
                Items.AddItem(armor);
            }
            // boots
            if (UnityEngine.Random.Range(1, 101) <= chance)
            {
                Items.DaggerfallUnityItem armor = Game.Items.ItemBuilder.CreateArmor(gender, race, Game.Items.Armor.Boots, Game.Items.ItemBuilder.RandomArmorMaterial(itemLevel));
                ItemEquipTable.EquipItem(armor, true, false);
                Items.AddItem(armor);
            }

            // Initialize armor values to 100 (no armor)
            for (int i = 0; i < ArmorValues.Length; i++)
            {
                ArmorValues[i] = 100;
            }
            // Calculate armor values from equipment
            for (int i = (int)Game.Items.EquipSlots.Head; i < (int)Game.Items.EquipSlots.Feet; i++)
            {
                Items.DaggerfallUnityItem item = ItemEquipTable.GetItem((Items.EquipSlots)i);
                if (item != null && item.ItemGroup == Game.Items.ItemGroups.Armor)
                {
                    UpdateEquippedArmorValues(item, true);
                }
            }

            if (entityType == EntityTypes.EnemyClass)
            {
                // Clamp to maximum armor value of 60. In classic this also applies for monsters.
                // Note: Classic sets the value to 60 if it is > 50, which seems like an oversight.
                for (int i = 0; i < ArmorValues.Length; i++)
                {
                    if (ArmorValues[i] > 60)
                    {
                        ArmorValues[i] = 60;
                    }
                }
            }
            else
            {
                // Note: In classic, the above applies for equipment-using monsters as well as enemy classes.
                // The resulting armor values are often 60. Due to the +40 to hit against monsters this makes
                // monsters with equipment very easy to hit, and 60 is a worse value than any value monsters
                // have in their definition. To avoid this, in DF Unity the equipment valuesare only used if
                // they are better than the value in the definition.
                for (int i = 0; i < ArmorValues.Length; i++)
                {
                    if (ArmorValues[i] > (sbyte)(mobileEnemy.ArmorValue * 5))
                    {
                        ArmorValues[i] = (sbyte)(mobileEnemy.ArmorValue * 5);
                    }
                }
            }
        }