Ejemplo n.º 1
0
        public IRelationshipType CreateRelationshipType(IItemType Base, String Name, IItemType ParentType, IItemType ChildType)
        {
            RelationshipType reltype = new RelationshipType((ItemType)Base, Name, ParentType, ChildType);

            this.ItemTypesCache[Name] = reltype;
            return(reltype);
        }
Ejemplo n.º 2
0
        public IItemType CreateItemType(IItemType Base, String Name)
        {
            ItemType itemtype = new ItemType((ItemType)Base, Name);

            this.ItemTypesCache[Name] = itemtype;
            return(itemtype);
        }
Ejemplo n.º 3
0
        public IItem Create(IItemType Type, Guid ItemID, Guid BranchID, Guid VersionID, Int64 Branched, Int64 Versioned, ITransaction Transaction)
        {
            Item item = new Item((ItemType)Type, ItemID, BranchID, VersionID, Branched, Versioned);

            this.ItemCache[item.VersionID] = item;
            return(item);
        }
Ejemplo n.º 4
0
        public IItem Create(IItemType type)
        {
            var item = new ItemHandle(nextId.Next(), type);

            AddTrait <ILocationTrait>(item, new InternalLocationTrait(this, item));
            return(item);
        }
Ejemplo n.º 5
0
    public static ISpellRune FromItemType(IItemType itemType)
    {
        ISpellRune r = ISpellRune.Fire;

        switch (itemType)
        {
        case IItemType.ScrollOfFire:
            r = ISpellRune.Fire;
            break;

        case IItemType.ScrollOfAir:
            r = ISpellRune.Air;
            break;

        case IItemType.ScrollOfEarth:
            r = ISpellRune.Earth;
            break;

        case IItemType.ScrollOfGod:
            r = ISpellRune.Gods;
            break;

        case IItemType.ScrollOfWater:
            r = ISpellRune.Water;
            break;
        }
        return(r);
    }
Ejemplo n.º 6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ContainerItem"/> class.
        /// </summary>
        /// <param name="type">The type of this item.</param>
        public ContainerItem(IItemType type)
            : base(type)
        {
            this.openedByLock = new object();

            this.Content  = new List <IItem>();
            this.OpenedBy = new Dictionary <uint, byte>();
        }
Ejemplo n.º 7
0
        // public event ItemHolderChangeEvent OnHolderChanged;

        // public event ItemAmountChangeEvent OnAmountChanged;

        // private uint holder;

        /// <summary>
        /// Initializes a new instance of the <see cref="Item"/> class.
        /// </summary>
        /// <param name="type">The type of this item.</param>
        public Item(IItemType type)
        {
            this.Type = type;
            // this.UniqueId = Guid.NewGuid().ToString().Substring(0, 8);

            // make a copy of the type we are based on...
            this.Attributes = new Dictionary <ItemAttribute, IConvertible>(this.Type.DefaultAttributes);
        }
Ejemplo n.º 8
0
        public void Register(IItemType itemType)
        {
            if (itemsById.ContainsKey(itemType.ID) ||
                (!idManager.Block(itemType.ID) && itemType.IsStaticID))
            {
                logger.Warn($"ID {itemType.ID} already used by item {itemsById[itemType.ID].Name} --> will be overriden by {itemType.Name}");
            }

            itemsById[itemType.ID] = itemType;
        }
Ejemplo n.º 9
0
 public IItem(int sellCount, int value, string name, IItemType type)
 {
     this.name      = name;
     this.sellCount = sellCount;
     this.type      = type;
     this.value     = value;
     this.intro     = "";
     this.bonuses   = new Immunities();
     this.color     = new IColor(1, 1, 1);
 }
Ejemplo n.º 10
0
 public IItem(int sellCount, int value, string name, IItemType type, Immunities bons, IColor clr)
 {
     this.name      = name;
     this.sellCount = sellCount;
     this.type      = type;
     this.value     = value;
     this.intro     = "";
     this.bonuses   = bons;
     this.color     = clr;
 }
Ejemplo n.º 11
0
 public IItem(int sellCount, int value, string name, IItemType type, Immunities bons, IClassType[] spetial)
 {
     this.name       = name;
     this.sellCount  = sellCount;
     this.type       = type;
     this.value      = value;
     this.intro      = "";
     this.bonuses    = bons;
     this.color      = new IColor(1, 1, 1);
     this.spetiality = spetial;
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Returns a string used for specifieng the item in the ingredient list
 /// </summary>
 /// <param name="item">The item to get the string for</param>
 /// <returns>A string used for specifieng the item in the ingredient list</returns>
 protected static string GetItemCompound(IItemType item)
 {
     if (item.Name.Contains("#"))
     {
         return("{\"tag\":\"" + item.Name.Replace("#", "") + "\"}");
     }
     else
     {
         return("{\"item\":\"" + item.Name + "\"}");
     }
 }
Ejemplo n.º 13
0
        }                                                        //Use ItemType to check its type

        public Item(GameWorld world, IItemType itemType, ModItemDfnXML itemData, bool createNow = false) : base(-1, world)
        {
            this.itemType = itemType;
            this.itemData = itemData;

            this.itemType.Item = this;

            if (createNow)
            {
                create();
            }
        }
Ejemplo n.º 14
0
        public ulong TryAdd(IItemType item, ulong amount = 1)
        {
            if (itemAmounts.ContainsKey(item.ID))
            {
                itemAmounts[item.ID] += amount;
            }
            else
            {
                itemAmounts.Add(item.ID, amount);
            }

            return(amount);
        }
Ejemplo n.º 15
0
 public Item(
     string id,
     string itemName,
     string itemMeshName,
     IItemType itemType,
     ItemHaveAttachOption itemAttachOptionWhenHave,
     ItemUseAttachOption itemAttachOptionWhenUse) : base(id)
 {
     SetID(id);
     this.itemName                 = itemName;
     this.itemMeshName             = itemMeshName;
     this.itemType2                = itemType;
     this.itemAttachOptionWhenHave = itemAttachOptionWhenHave;
     this.itemAttachOptionWhenUse  = itemAttachOptionWhenUse;
 }
Ejemplo n.º 16
0
        public Item(string name, IItemType itemType, IItemBinding binding, IMessageHub messageHub)
        {
            _binding    = binding;
            _messageHub = messageHub;

            Name     = name;
            ItemType = itemType;

            _sendCommandHandler = messageHub
                                  .Handle <SendCommandToItemMessage>()
                                  .Where(msg => msg.ItemName == Name)
                                  .Register(async msg => await OnSendCommandToItem(msg));

            _itemValueUpdateHandler = messageHub
                                      .Handle <ItemValueUpdateMessage>()
                                      .Where(msg => msg.ItemName == Name)
                                      .Register(async msg => await OnItemValueUpdateHandler(msg));
        }
Ejemplo n.º 17
0
        public ulong TryRemove(IItemType item, ulong amount = 1)
        {
            if (itemAmounts.TryGetValue(item.ID, out ulong currentAmount))
            {
                if (currentAmount > amount)
                {
                    itemAmounts[item.ID] -= amount;
                    return(amount);
                }
                else
                {
                    itemAmounts.Remove(item.ID);
                    return(currentAmount);
                }
            }

            return(0);
        }
Ejemplo n.º 18
0
        public ReturnState Register <T>(string name, T content, IItemType itemType)
        {
            if (content == null)
            {
                return(ReturnState.ContentIsNull);
            }

            if (!itemType.Validate(content))
            {
                return(ReturnState.ContentIsNotValid);
            }

            lock (_locker)
            {
                if (Contains(name))
                {
                    return(ReturnState.ItemExist);
                }

                _repoData.GetItems().Add(name, new Item <T>(content, itemType));
            }

            return(ReturnState.Success);
        }
Ejemplo n.º 19
0
 public ItemHandle(int id, IItemType metadata)
 {
     Id       = id;
     ItemType = metadata;
 }
Ejemplo n.º 20
0
 IItem IInventoryManager.SetExtraItem(byte slot, IItemType item)
 {
     return(SetExtraItem(slot, (ItemType)item));
 }
Ejemplo n.º 21
0
		FileProjectItem CreateFileProjectItem(IItemType itemType, string include)
		{
			var fileProjectItem = new FileProjectItem(MSBuildProject, itemType);
			fileProjectItem.Include = include;
			return fileProjectItem;
		}
Ejemplo n.º 22
0
 /// <summary>
 /// Intializes a new <see cref="SmeltRecipe"/>
 /// </summary>
 /// <param name="packNamespace">The namespace the recipe is in</param>
 /// <param name="fileName">The name of the recipe file</param>
 /// <param name="writeSetting">The settings for how to write this file</param>
 /// <param name="group">The name of the recipe group the recipe is in. Leave null for no group.</param>
 /// <param name="recipeType">The type of smelting recipe</param>
 /// <param name="ingredient">The item to smelt</param>
 /// <param name="result">The result from the recipe</param>
 /// <param name="experience">The amount of experience to get for smelting the item</param>
 /// <param name="cookingTime">The amount of time in ticks it takes to cook the item</param>
 public SmeltRecipe(BasePackNamespace packNamespace, string?fileName, SmeltType recipeType, IItemType ingredient, ID.Item result, double experience, NoneNegativeTime <int>?cookingTime = null, string?group = null, WriteSetting writeSetting = WriteSetting.LockedAuto) : this(true, packNamespace, fileName, recipeType, new IItemType[] { ingredient }, result, experience, cookingTime, group, writeSetting)
 {
     FinishedConstructing();
 }
Ejemplo n.º 23
0
 /// <summary>
 /// Creates a new item
 /// </summary>
 /// <param name="ItemID">The type of the item. If null the item has no type</param>
 /// <param name="Count">The amount of the item. If null the item has no amount</param>
 /// <param name="Slot">The slot the item is in. If null the item isn't in a slot</param>
 public Potion(IItemType ItemID, sbyte?Count = null, sbyte?Slot = null) : base(ItemID, Count, Slot)
 {
 }
Ejemplo n.º 24
0
 public Item(IItemType itemType)
 {
     this.ItemType = itemType;
 }
Ejemplo n.º 25
0
 public Item(T content, IItemType itemType)
 {
     Content         = content;
     ContentItemType = itemType;
 }
 internal RelationshipType(RelationshipType Base, String Name, IItemType ParentType, IItemType ChildType)
     : base(Base, Name)
 {
     this.ParentType = ParentType;
     this.ChildType  = ChildType;
 }
Ejemplo n.º 27
0
        IItem CreateItemAt(IItemType itemType, double x, double y)
        {
            var item = itemService.Create(itemType);

            return(MoveTo(item, x, y));
        }
Ejemplo n.º 28
0
 /// <summary>
 /// Intializes a new <see cref="CuttingRecipe"/>
 /// </summary>
 /// <param name="packNamespace">The namespace the recipe is in</param>
 /// <param name="fileName">The name of the recipe file</param>
 /// <param name="writeSetting">The settings for how to write this file</param>
 /// <param name="group">The name of the recipe group the recipe is in. Leave null for no group.</param>
 /// <param name="ingredient">The item used in the recipe</param>
 /// <param name="count">The amount of the result item the recipe should output</param>
 /// <param name="result">The item to craft</param>
 public CuttingRecipe(BasePackNamespace packNamespace, string?fileName, IItemType ingredient, ID.Item result, int count = 1, string?group = null, WriteSetting writeSetting = WriteSetting.LockedAuto) : this(true, packNamespace, fileName, new IItemType[] { ingredient }, result, count, group, writeSetting)
 {
     FinishedConstructing();
 }
Ejemplo n.º 29
0
 /// <summary>
 /// Creates a new item
 /// </summary>
 /// <param name="ItemID">The type of the item. If null the item has no type</param>
 /// <param name="Count">The amount of the item. If null the item has no amount</param>
 /// <param name="Slot">The slot the item is in. If null the item isn't in a slot</param>
 public Compass(IItemType ItemID, sbyte?Count = null, sbyte?Slot = null) : base(ItemID, Count, Slot)
 {
 }
Ejemplo n.º 30
0
 /// <summary>
 /// Intializes a new <see cref="ItemEntry"/>
 /// </summary>
 /// <param name="item">The item the entry drops</param>
 public ItemEntry(IItemType item) : base(ID.LootEntryType.item)
 {
     Item = item;
 }
 internal static int GetNumber <T>(this IItemType itemType) where T : BaseAttribute
 {
     T[] attributes = (T[])itemType.GetType().GetCustomAttributes(typeof(T), true);
     return(attributes[0].Number);
 }