public ItemRecord AddItem(ItemTemplate template) { ItemRecord record = ItemRecord.CreateRecord(template); AddItem(record); return(record); }
public override void Process(CmdTrigger <RealmServerCmdArgs> trigger) { var text = trigger.Text; var mod = text.NextModifiers(); var items = new List <ItemRecord>(); var cod = 0u; var money = 0u; if (mod.Contains("i")) { var itemId = trigger.Text.NextEnum(ItemId.None); var template = ItemMgr.GetTemplate(itemId); if (template == null) { trigger.Reply("Invalid ItemId."); return; } var item = ItemRecord.CreateRecord(template); items.Add(item); item.SaveLater(); } if (mod.Contains("c")) { cod = text.NextUInt(); } var recipientName = trigger.Text.NextWord(); if (recipientName.Length == 0) { trigger.Reply("Could not send mail - Unknown Recipient: " + recipientName); return; } var subject = trigger.Text.NextWord(","); var msg = trigger.Text.Remainder; var err = MailMgr.SendMail(recipientName, subject, msg, MailStationary.GM, items, money, cod, trigger.Args.User); if (err == MailError.OK) { trigger.Reply("Done."); } else { trigger.Reply("Could not send mail: " + err); } }
public override void Process(CmdTrigger <RealmServerCmdArgs> trigger) { StringStream text = trigger.Text; string str = text.NextModifiers(); List <ItemRecord> itemRecordList = new List <ItemRecord>(); uint cod = 0; uint money = 0; if (str.Contains("i")) { ItemTemplate template = ItemMgr.GetTemplate(trigger.Text.NextEnum(Asda2ItemId.None)); if (template == null) { trigger.Reply("Invalid ItemId."); return; } ItemRecord record = ItemRecord.CreateRecord(template); itemRecordList.Add(record); record.SaveLater(); } if (str.Contains("c")) { cod = text.NextUInt(); } string recipientName = trigger.Text.NextWord(); if (recipientName.Length == 0) { trigger.Reply("Could not send mail - Unknown Recipient: " + recipientName); } else { string subject = trigger.Text.NextWord(","); string remainder = trigger.Text.Remainder; MailError mailError = MailMgr.SendMail(recipientName, subject, remainder, MailStationary.GM, itemRecordList, money, cod, trigger.Args.User); if (mailError == MailError.OK) { trigger.Reply("Done."); } else { trigger.Reply("Could not send mail: " + mailError); } } }
/// <summary> /// Initializes a new Item /// </summary> internal void InitItem(ItemTemplate template, Character owner, int amount) { m_record = ItemRecord.CreateRecord(); EntryId = m_record.EntryId = template.Id; Type |= ObjectTypes.Item; m_template = template; Durability = m_template.MaxDurability; MaxDurability = m_template.MaxDurability; Flags = m_template.Flags; TextId = m_template.PageTextId; Amount = amount; OwningCharacter = owner; EntityId = m_record.EntityId; // set charges to max if (m_template.UseSpell != null && m_template.UseSpell.HasCharges) { m_record.Charges = m_template.UseSpell.Charges; SetSpellCharges(m_template.UseSpell.Index, m_template.UseSpell.Charges); } var randomEnchants = m_template.RandomPrefixes; if (randomEnchants != null) { ApplyRandomEnchants(randomEnchants, EnchantSlot.PropSlot2, EnchantSlot.PropSlot4); } randomEnchants = m_template.RandomSuffixes; if (randomEnchants != null) { if (ApplyRandomEnchants(randomEnchants, EnchantSlot.PropSlot0, EnchantSlot.PropSlot2)) { RandomPropertiesId = m_enchantments[(int)EnchantSlot.PropSlot0].Entry.Id; } } template.NotifyCreated(m_record); OnInit(); }
/// <summary>Initializes a new Item</summary> internal void InitItem(ItemTemplate template, Character owner, int amount) { m_record = ItemRecord.CreateRecord(); EntryId = m_record.EntryId = template.Id; Type |= ObjectTypes.Item; m_template = template; Durability = m_template.MaxDurability; MaxDurability = m_template.MaxDurability; Flags = m_template.Flags; TextId = m_template.PageTextId; Amount = amount; OwningCharacter = owner; EntityId = m_record.EntityId; if (m_template.UseSpell != null && m_template.UseSpell.HasCharges) { m_record.Charges = m_template.UseSpell.Charges; SetSpellCharges(m_template.UseSpell.Index, m_template.UseSpell.Charges); } template.NotifyCreated(m_record); OnInit(); }