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); }
public IItemType CreateItemType(IItemType Base, String Name) { ItemType itemtype = new ItemType((ItemType)Base, Name); this.ItemTypesCache[Name] = itemtype; return(itemtype); }
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); }
public IItem Create(IItemType type) { var item = new ItemHandle(nextId.Next(), type); AddTrait <ILocationTrait>(item, new InternalLocationTrait(this, item)); return(item); }
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); }
/// <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>(); }
// 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); }
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; }
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); }
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; }
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; }
/// <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 + "\"}"); } }
} //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(); } }
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); }
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; }
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)); }
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); }
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); }
public ItemHandle(int id, IItemType metadata) { Id = id; ItemType = metadata; }
IItem IInventoryManager.SetExtraItem(byte slot, IItemType item) { return(SetExtraItem(slot, (ItemType)item)); }
FileProjectItem CreateFileProjectItem(IItemType itemType, string include) { var fileProjectItem = new FileProjectItem(MSBuildProject, itemType); fileProjectItem.Include = include; return fileProjectItem; }
/// <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(); }
/// <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) { }
public Item(IItemType itemType) { this.ItemType = itemType; }
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; }
IItem CreateItemAt(IItemType itemType, double x, double y) { var item = itemService.Create(itemType); return(MoveTo(item, x, y)); }
/// <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(); }
/// <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) { }
/// <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); }