コード例 #1
0
 void SetLocalTarget(ItemTargets target)
 {
     // Only player supported for now
     if (target == ItemTargets.Player)
     {
         localItems = playerEntity.Items;
     }
 }
コード例 #2
0
        /// <summary>
        /// Assigns basic starting gear to a new character.
        /// </summary>
        public void AssignStartingGear(PlayerEntity playerEntity)
        {
            // Get references
            EntityItems    items      = playerEntity.Items;
            ItemEquipTable equipTable = playerEntity.ItemEquipTable;

            // Starting clothes are gender-specific
            DaggerfallUnityItem shortShirt  = null;
            DaggerfallUnityItem casualPants = null;

            if (playerEntity.Gender == Genders.Female)
            {
                shortShirt  = ItemBuilder.CreateWomensClothing(WomensClothing.Short_shirt_closed, playerEntity.Race, 1);
                casualPants = ItemBuilder.CreateWomensClothing(WomensClothing.Casual_pants, playerEntity.Race);
            }
            else
            {
                shortShirt  = ItemBuilder.CreateMensClothing(MensClothing.Short_shirt_closed_top, playerEntity.Race, 1);
                casualPants = ItemBuilder.CreateMensClothing(MensClothing.Casual_pants, playerEntity.Race);
            }

            // Randomise shirt dye and pants variant
            shortShirt.dyeColor = ItemBuilder.RandomClothingDye();
            ItemBuilder.RandomizeVariant(casualPants);

            // Add a wagon
            // This is required for now as shops not currently implemented
            // Wagon is easy to obtain anyway (150g) and most player can affored right out of Privateer's Hold
            // TODO: Remove this once shops can sell this item to players as normal
            items.AddItem(ItemBuilder.CreateItem(ItemGroups.Transportation, (int)Transportation.Small_cart));

            // Add spellbook, all players start with one
            items.AddItem(ItemBuilder.CreateItem(ItemGroups.MiscItems, (int)MiscItems.Spellbook));

            // Add and equip clothing
            items.AddItem(shortShirt);
            items.AddItem(casualPants);
            equipTable.EquipItem(shortShirt);
            equipTable.EquipItem(casualPants);

            // Always add ebony dagger until biography implemented
            items.AddItem(ItemBuilder.CreateWeapon(Weapons.Dagger, WeaponMaterialTypes.Ebony));

            // Add a cuirass
            items.AddItem(ItemBuilder.CreateArmor(playerEntity.Gender, playerEntity.Race, Armor.Cuirass, ArmorMaterialTypes.Leather));

            // Add alternate weapons
            items.AddItem(ItemBuilder.CreateWeapon(Weapons.Longsword, WeaponMaterialTypes.Steel));
            items.AddItem(ItemBuilder.CreateWeapon(Weapons.Katana, WeaponMaterialTypes.Iron));
            items.AddItem(ItemBuilder.CreateWeapon(Weapons.Staff, WeaponMaterialTypes.Silver));

            // Add some ingredients
            for (int i = 0; i < 10; i++)
            {
                items.AddItem(ItemBuilder.CreateRandomIngredient());
            }
        }
コード例 #3
0
        void TransferItem(DaggerfallUnityItem item, EntityItems from, EntityItems to)
        {
            // Block transfer of horse or cart
            if (item.IsOfTemplate(ItemGroups.Transportation, (int)Transportation.Horse) ||
                item.IsOfTemplate(ItemGroups.Transportation, (int)Transportation.Small_cart))
            {
                return;
            }

            to.Transfer(item, from);
            Refresh(false);
        }
コード例 #4
0
        /// <summary>
        /// Deserialize equip table and attempt to relink equipped items in collection.
        /// Item UID must exist inside collection provided or entry will not be restored and item not equipped.
        /// </summary>
        /// <param name="data">UID array exactly this.equipTableLength in length.</param>
        /// <param name="items">Item collection.</param>
        public void DeserializeEquipTable(ulong[] data, EntityItems items)
        {
            if (data == null || items == null || data.Length != equipTableLength)
            {
                return;
            }

            for (int i = 0; i < equipTableLength; i++)
            {
                ulong uid = data[i];
                if (items.Contains(uid))
                {
                    DaggerfallUnityItem item = items.GetItem(uid);
                    if (item != null)
                    {
                        equipTable[i]  = item;
                        item.EquipSlot = (EquipSlots)i;
                    }
                }
            }
        }
コード例 #5
0
        void SetRemoteTarget(ItemTargets target)
        {
            //remoteTarget = target;

            // Clear selections
            wagonButton.BackgroundTexture = wagonNotSelected;

            // Only wagon supported for now
            if (target == ItemTargets.Wagon)
            {
                // Show wagon icon
                ImageData containerImage = DaggerfallUnity.ItemHelper.GetContainerImage(ContainerTypes.Wagon);
                remoteTargetIconPanel.BackgroundTexture = containerImage.texture;

                // Highlight wagon button
                wagonButton.BackgroundTexture = wagonSelected;

                // Set remote items
                remoteItems = playerEntity.WagonItems;
            }
        }
コード例 #6
0
        public List <Tip> GetVenueTips(string venueId, List <Parameter> parameters)
        {
            EntityItems <Tip> tips = GetSingle <EntityItems <Tip> >("/venues/" + venueId + "/tips", parameters, true).response["tips"];

            return(tips.items);
        }