internal void NotifyCreated(ItemRecord record) { OnRecordCreated(record); var evt = Created; if (evt != null) { evt(record); } }
internal static ItemRecord CreateRecord() { try { var itemRecord = new ItemRecord { Guid = (uint) NextId(), }; return itemRecord; } catch (Exception ex) { throw new WCellException(ex, "Unable to create new ItemRecord."); } }
public void SendMail(string subject, uint money, ItemRecord item, string body) { var msg = new MailMessage(subject, body) { SenderId = (uint)HouseFaction, ReceiverId = OwnerLowId, MessageStationary = MailStationary.Auction, MessageType = MailType.Auction, IncludedMoney = money, LastModifiedOn = null, SendTime = DateTime.Now, DeliveryTime = DateTime.Now }; if(item != null) msg.AddItem(item); msg.Send(); }
/// <summary> /// Places the given item in the given slot (or tries mergeing at slot> if indicated). /// Make sure that the depositer has deposit rights to this BankTab! /// </summary> /// <param name="item">The <see cref="ItemRecord" /> to store.</param> /// <param name="slot">The slotId where you want to store.</param> /// <param name="allowMerge">Whether or not to try and merge the stacks.</param> /// <returns>The <see cref="ItemRecord" /> that was in the slot (or the original <see cref="ItemRecord" /> minus the items that were merged) /// or null if the store/merge was successful.</returns> public ItemRecord StoreItemInSlot(ItemRecord item, int slot, bool allowMerge) { return StoreItemInSlot(item, item.Amount, slot, allowMerge); }
/// <summary> /// Tries to store the given item in the given slot. No merge attempted. /// </summary> /// <param name="item">The item to store.</param> /// <param name="slot">The slot to store it in.</param> /// <returns>The <see cref="ItemRecord" /> that was in the slot (or the original <see cref="ItemRecord" /> minus the items that were merged) /// or null if the store/merge was successful.</returns> public ItemRecord StoreItemInSlot(ItemRecord item, int slot) { return StoreItemInSlot(item, slot, false); }
/// <summary> /// Checks if the given amount of the given item stack can be stored in the given slot (optionally with merging), /// without necessitating an Item swap. No actual store takes place. /// </summary> /// <param name="item">The <see cref="ItemRecord" /> to store.</param> /// <param name="amount">The amount of items from the stack to store.</param> /// <param name="slot">The slotId where you want to store.</param> /// <param name="allowMerge">Whether or not to try and merge the stacks.</param> /// <returns>true if no Item swap is needed.</returns> public bool CheckStoreItemInSlot(ItemRecord item, int amount, int slot, bool allowMerge) { if (slot >= GuildMgr.MAX_BANK_TAB_SLOTS) return false; if (item.Amount < amount) return false; // Cheater! var curItem = this[slot]; if (curItem == null) return true; if (allowMerge && this[slot].EntryId == item.EntryId) { // try to merge the stacks. var freeSpace = (int)curItem.Template.MaxAmount - curItem.Amount; return (freeSpace >= amount); } // gonna swap return false; }
/// <summary> /// Places the given amount of the given item stack in the given slot (or tries mergeing at slot if indicated). /// Make sure that the depositer has deposit rights to this BankTab! /// </summary> /// <param name="item">The <see cref="ItemRecord" /> to store.</param> /// <param name="amount">The amount of items from the stack to store.</param> /// <param name="slot">The slotId where you want to store.</param> /// <param name="allowMerge">Whether or not to try and merge the stacks.</param> /// <returns>The <see cref="ItemRecord" /> that was in the slot (or the original <see cref="ItemRecord" /> minus the items that were merged) /// or null if the store/merge was successful.</returns> public ItemRecord StoreItemInSlot(ItemRecord item, int amount, int slot, bool allowMerge) { if (slot >= GuildMgr.MAX_BANK_TAB_SLOTS) return item; if (item.Amount < amount) return item; // Cheater! var curItem = this[slot]; if (curItem == null) { // the slot is empty, rock on this[slot] = item; return null; } if (allowMerge && this[slot].EntryId == item.EntryId) { // try to merge the stacks. var freeSpace = (int)curItem.Template.MaxAmount - curItem.Amount; freeSpace = Math.Min(freeSpace, amount); curItem.Amount += freeSpace; item.Amount -= freeSpace; return item.Amount > 0 ? item : null; } // gonna swap this[slot] = item; return curItem; }
public void SendMail(MailAuctionAnswers response, uint money, ItemRecord item, string body) { var subject = String.Format("{0}:0:{1}", ItemTemplateId, response); SendMail(subject, money, item, body); }
public void SendMail(MailAuctionAnswers response, ItemRecord item) { var subject = String.Format("{0}:0:{1}", ItemTemplateId, response); SendMail(subject, 0, item, ""); }
private void OnRecordCreated(ItemRecord record) { if (IsCharter) { //if (!record.IsNew) TODO: Re-implement this asap due to unknown concequences //{ // this is executed in the IO-context PetitionRecord.LoadRecord(record.OwnerId); //} } }
internal void PutBack(ItemRecord item) { _items.Add(item); IncludedItemCount++; }
public void AddItem(ItemRecord record) { if (_items == null) { _items = new List<ItemRecord>(3); } record.MailId = Guid; _items.Add(record); IncludedItemCount++; }
public void LogEvent(GuildBankLogEntryType type, Character chr, ItemRecord item, GuildBankTab intoTab) { LogEvent(type, chr, item, item.Amount, intoTab); }
private void LogItemEvent(GuildBankLogEntryType type, Character actor, ItemRecord record, int amount, GuildBankTab intoTab) { var entry = new GuildBankLogEntry(Bank.Guild.Id) { Type = type, Actor = actor, BankLog = this, DestinationTab = intoTab, ItemEntryId = (int)record.EntryId, ItemStackCount = (int)amount, Created = DateTime.Now }; lock (moneyLogEntries) { moneyLogEntries.Insert(entry); } }
public void LogEvent(GuildBankLogEntryType type, Character member, uint money, ItemRecord item, int amount, GuildBankTab intoTab) { switch (type) { case GuildBankLogEntryType.None: { break; } case GuildBankLogEntryType.DepositItem: { LogItemEvent(type, member, item, amount, intoTab); break; } case GuildBankLogEntryType.WithdrawItem: { LogItemEvent(type, member, item, amount, intoTab); break; } case GuildBankLogEntryType.MoveItem: { LogItemEvent(type, member, item, amount, intoTab); break; } case GuildBankLogEntryType.DepositMoney: { LogMoneyEvent(type, member, money); break; } case GuildBankLogEntryType.WithdrawMoney: { LogMoneyEvent(type, member, money); break; } case GuildBankLogEntryType.MoneyUsedForRepairs: { LogMoneyEvent(type, member, money); break; } case GuildBankLogEntryType.MoveItem_2: { LogItemEvent(type, member, item, amount, intoTab); break; } case GuildBankLogEntryType.Unknown1: { break; } case GuildBankLogEntryType.Unknown2: { break; } default: { break; } } // end switch } // end method
public GuildBankTab() { Items = new GuildBankTabItem[GuildMgr.MAX_BANK_TAB_SLOTS]; ItemRecords = new ItemRecord[GuildMgr.MAX_BANK_TAB_SLOTS]; }