public Item(int id) { Id = id; Uid = GuidGenerator.Long(); InventoryTab = ItemMetadataStorage.GetTab(id); ItemSlot = ItemMetadataStorage.GetSlot(id); GemSlot = ItemMetadataStorage.GetGem(id); Rarity = ItemMetadataStorage.GetRarity(id); StackLimit = ItemMetadataStorage.GetStackLimit(id); EnableBreak = ItemMetadataStorage.GetEnableBreak(id); IsTwoHand = ItemMetadataStorage.GetIsTwoHand(id); IsDress = ItemMetadataStorage.GetIsDress(id); IsTemplate = ItemMetadataStorage.GetIsTemplate(id); PlayCount = ItemMetadataStorage.GetPlayCount(id); FileName = ItemMetadataStorage.GetFileName(id); SkillId = ItemMetadataStorage.GetSkillID(id); RecommendJobs = ItemMetadataStorage.GetRecommendJobs(id); Content = ItemMetadataStorage.GetContent(id); FunctionName = ItemMetadataStorage.GetFunctionName(id); FunctionId = ItemMetadataStorage.GetFunctionId(id); FunctionDuration = ItemMetadataStorage.GetFunctionDuration(id); FunctionFieldId = ItemMetadataStorage.GetFunctionFieldId(id); FunctionCapacity = ItemMetadataStorage.GetFunctionCapacity(id); Slot = -1; Amount = 1; Stats = new ItemStats(id, Rarity); CanRepackage = true; // If false, item becomes untradable }
public Item(int id) { Id = id; Level = ItemMetadataStorage.GetLevel(id); Uid = GuidGenerator.Long(); InventoryTab = ItemMetadataStorage.GetTab(id); ItemSlot = ItemMetadataStorage.GetSlot(id); GemSlot = ItemMetadataStorage.GetGem(id); Rarity = ItemMetadataStorage.GetRarity(id); StackLimit = ItemMetadataStorage.GetStackLimit(id); EnableBreak = ItemMetadataStorage.GetEnableBreak(id); IsTwoHand = ItemMetadataStorage.GetIsTwoHand(id); IsDress = ItemMetadataStorage.GetIsDress(id); IsTemplate = ItemMetadataStorage.GetIsTemplate(id); IsCustomScore = ItemMetadataStorage.GetIsCustomScore(id); Gender = ItemMetadataStorage.GetGender(id); RemainingGlamorForges = ItemExtractionMetadataStorage.GetExtractionCount(id); PlayCount = ItemMetadataStorage.GetPlayCount(id); FileName = ItemMetadataStorage.GetFileName(id); SkillId = ItemMetadataStorage.GetSkillID(id); RecommendJobs = ItemMetadataStorage.GetRecommendJobs(id); Content = ItemMetadataStorage.GetContent(id); Function = ItemMetadataStorage.GetFunction(id); Tag = ItemMetadataStorage.GetTag(id); ShopID = ItemMetadataStorage.GetShopID(id); Slot = -1; Amount = 1; Score = new MusicScore(); Stats = new ItemStats(id, Rarity, Level); Color = ItemMetadataStorage.GetEquipColor(id); CanRepackage = true; // If false, item becomes untradable }
public Item(int id) { this.Id = id; this.InventoryType = ItemMetadataStorage.GetTab(id); this.ItemSlot = ItemMetadataStorage.GetSlot(id); this.SlotMax = ItemMetadataStorage.GetSlotMax(id); this.IsTemplate = ItemMetadataStorage.GetIsTemplate(id); this.Slot = -1; this.Amount = 1; this.Stats = new ItemStats(); this.CanRepackage = true; // If false, item becomes untradable }
// Example: "item id:20000027" private static void ProcessItemCommand(GameSession session, string command) { Dictionary <string, string> config = command.ToMap(); if (!int.TryParse(config.GetValueOrDefault("id", "20000027"), out int itemId)) { return; } if (!ItemMetadataStorage.IsValid(itemId)) { session.SendNotice("Invalid item: " + itemId); return; } // Add some bonus attributes to equips and pets ItemStats stats = new ItemStats(); if (ItemMetadataStorage.GetTab(itemId) == InventoryTab.Gear || ItemMetadataStorage.GetTab(itemId) == InventoryTab.Pets) { Random rng = new Random(); stats.BonusAttributes.Add(ItemStat.Of((ItemAttribute)rng.Next(35), 0.01f)); stats.BonusAttributes.Add(ItemStat.Of((ItemAttribute)rng.Next(35), 0.01f)); } Item item = new Item(itemId) { CreationTime = DateTimeOffset.UtcNow.ToUnixTimeSeconds(), TransferFlag = TransferFlag.Splitable | TransferFlag.Tradeable, Stats = stats, PlayCount = itemId.ToString().StartsWith("35") ? 10 : 0 }; if (int.TryParse(config.GetValueOrDefault("rarity", "5"), out int rarity)) { item.Rarity = rarity; } if (int.TryParse(config.GetValueOrDefault("amount", "1"), out int amount)) { item.Amount = amount; } // Simulate looting item InventoryController.Add(session, item, true); /*if (session.Player.Inventory.Add(item)) * { * session.Send(ItemInventoryPacket.Add(item)); * session.Send(ItemInventoryPacket.MarkItemNew(item, item.Amount)); * }*/ }
public Item(int id) { this.Id = id; this.Uid = GuidGenerator.Long(); this.InventoryTab = ItemMetadataStorage.GetTab(id); this.ItemSlot = ItemMetadataStorage.GetSlot(id); this.GemSlot = ItemMetadataStorage.GetGem(id); this.Rarity = ItemMetadataStorage.GetRarity(id); this.SlotMax = ItemMetadataStorage.GetSlotMax(id); this.IsTemplate = ItemMetadataStorage.GetIsTemplate(id); this.PlayCount = ItemMetadataStorage.GetPlayCount(id); this.Content = ItemMetadataStorage.GetContent(id); this.Slot = -1; this.Amount = 1; this.Stats = new ItemStats(); this.CanRepackage = true; // If false, item becomes untradable }
public void SetMetadataValues(int id) { InventoryTab = ItemMetadataStorage.GetTab(id); GemSlot = ItemMetadataStorage.GetGem(id); StackLimit = ItemMetadataStorage.GetStackLimit(id); EnableBreak = ItemMetadataStorage.GetEnableBreak(id); IsTwoHand = ItemMetadataStorage.GetIsTwoHand(id); IsDress = ItemMetadataStorage.GetIsDress(id); IsCustomScore = ItemMetadataStorage.GetIsCustomScore(id); Gender = ItemMetadataStorage.GetGender(id); FileName = ItemMetadataStorage.GetFileName(id); SkillId = ItemMetadataStorage.GetSkillID(id); RecommendJobs = ItemMetadataStorage.GetRecommendJobs(id); Content = ItemMetadataStorage.GetContent(id); Function = ItemMetadataStorage.GetFunction(id); AdBalloon = ItemMetadataStorage.GetBalloonData(id); Tag = ItemMetadataStorage.GetTag(id); ShopID = ItemMetadataStorage.GetShopID(id); }
public Item(int id) { Id = id; Uid = GuidGenerator.Long(); InventoryTab = ItemMetadataStorage.GetTab(id); ItemSlot = ItemMetadataStorage.GetSlot(id); GemSlot = ItemMetadataStorage.GetGem(id); Rarity = ItemMetadataStorage.GetRarity(id); StackLimit = ItemMetadataStorage.GetStackLimit(id); IsTwoHand = ItemMetadataStorage.GetIsTwoHand(id); IsDress = ItemMetadataStorage.GetIsDress(id); IsTemplate = ItemMetadataStorage.GetIsTemplate(id); PlayCount = ItemMetadataStorage.GetPlayCount(id); RecommendJobs = ItemMetadataStorage.GetRecommendJobs(id); Content = ItemMetadataStorage.GetContent(id); Slot = -1; Amount = 1; Stats = new ItemStats(id, Rarity); CanRepackage = true; // If false, item becomes untradable }
public void SetMetadataValues() { InventoryTab = ItemMetadataStorage.GetTab(Id); GemSlot = ItemMetadataStorage.GetGem(Id); StackLimit = ItemMetadataStorage.GetStackLimit(Id); EnableBreak = ItemMetadataStorage.GetEnableBreak(Id); IsTwoHand = ItemMetadataStorage.GetIsTwoHand(Id); IsDress = ItemMetadataStorage.GetIsDress(Id); IsCustomScore = ItemMetadataStorage.GetIsCustomScore(Id); Gender = ItemMetadataStorage.GetGender(Id); FileName = ItemMetadataStorage.GetFileName(Id); SkillId = ItemMetadataStorage.GetSkillID(Id); RecommendJobs = ItemMetadataStorage.GetRecommendJobs(Id); Function = ItemMetadataStorage.GetFunction(Id); Tag = ItemMetadataStorage.GetTag(Id); ShopID = ItemMetadataStorage.GetShopID(Id); RemainingTrades = ItemMetadataStorage.GetTradeableCount(Id); TransferType = ItemMetadataStorage.GetTransferType(Id); RepackageCount = ItemMetadataStorage.GetRepackageCount(Id); }
// Example: "item id:20000027" private static void ProcessItemCommand(GameSession session, string command) { Dictionary <string, string> config = command.ToMap(); int.TryParse(config.GetValueOrDefault("id", "20000027"), out int itemId); if (!ItemMetadataStorage.IsValid(itemId)) { session.SendNotice("Invalid item: " + itemId); return; } // Add some bonus attributes to equips and pets var stats = new ItemStats(); if (ItemMetadataStorage.GetTab(itemId) == InventoryType.Gear || ItemMetadataStorage.GetTab(itemId) == InventoryType.Pets) { var rng = new Random(); stats.BonusAttributes.Add(ItemStat.Of((ItemAttribute)rng.Next(35), 0.01f)); stats.BonusAttributes.Add(ItemStat.Of((ItemAttribute)rng.Next(35), 0.01f)); } var item = new Item(itemId) { Uid = Environment.TickCount64, CreationTime = DateTimeOffset.UtcNow.ToUnixTimeSeconds(), Transfer = TransferFlag.Splitable | TransferFlag.Tradeable, Stats = stats }; int.TryParse(config.GetValueOrDefault("rarity", "5"), out item.Rarity); int.TryParse(config.GetValueOrDefault("amount", "1"), out item.Amount); // Simulate looting item if (session.Inventory.Add(item)) { session.Send(ItemInventoryPacket.Add(item)); session.Send(ItemInventoryPacket.MarkItemNew(item)); } }
public bool CanHold(int itemId, int amount) { return(CanHold(itemId, amount, ItemMetadataStorage.GetTab(itemId))); }