本文整理汇总了C#中Packets.NumberOfDays方法的典型用法代码示例。如果您正苦于以下问题:C# Packets.NumberOfDays方法的具体用法?C# Packets.NumberOfDays怎么用?C# Packets.NumberOfDays使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Packets
的用法示例。
在下文中一共展示了Packets.NumberOfDays方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnMarketRegister
public void OnMarketRegister(Packets.Client.MarketRegister p)
{
/*
* Expexted packets:
* SMSG_MARKETREGISTER
* SMSG_UPDATEZENY
* SMSG_DELETEITEM | SMSG_UPDATEITEM
*
* This packet registers a new item on the market
* Costs for registering is 50 rufi per day, the expression days
* are expressed in real-time days not gametime.
*
* Index - describes the slot index.
*
* Note: This packet isn't completly reversed, still searching for the number of days
* some kind of reason. To indicate it failed registering, durabillity
*
*/
byte index = p.ItemIndex();
byte stack = p.StackCount();
uint price = p.Zeny();
byte days = p.NumberOfDays();
if (this.Char.zeny < (50 * days)) return;
MarketplaceItem item = new MarketplaceItem();
Item olditem = this.Char.inv.GetItem(CONTAINER_TYPE.INVENTORY, index);
if (stack > olditem.stack) stack = olditem.stack;
Item newitem = new Item(olditem.id, "", olditem.durability, stack);
item.item = newitem;
item.expire = (DateTime.Now + new TimeSpan(days, 0, 0, 0));
item.owner = this.Char.Name;
item.price = price;
MapServer.charDB.RegisterMarketItem(item);
this.map.RemoveItemFromActorPC(this.Char, index, olditem.id, stack, ITEM_UPDATE_REASON.OTHER);
Packets.Server.MarketRegister p1 = new SagaMap.Packets.Server.MarketRegister();
p1.SetAuctionID(item.id);
p1.SetItemID((uint)item.item.id);
p1.SetCount(stack);
p1.SetReqClvl((byte)newitem.req_clvl);
p1.SetZeny(price);
this.netIO.SendPacket(p1, this.SessionID);
this.Char.zeny -= (uint)(50 * days);
this.SendZeny();
}