本文整理汇总了C#中Packets.GetItemId方法的典型用法代码示例。如果您正苦于以下问题:C# Packets.GetItemId方法的具体用法?C# Packets.GetItemId怎么用?C# Packets.GetItemId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Packets
的用法示例。
在下文中一共展示了Packets.GetItemId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnMarketBuyItem
public void OnMarketBuyItem(Packets.Client.MarketBuyItem p)
{
uint id = p.GetItemId();
MarketplaceItem item = MapServer.charDB.GetMarketItem(id);
Packets.Server.MarketBuyItem p1 = new SagaMap.Packets.Server.MarketBuyItem();
if (item == null)
{
p1.SetResult(1);
this.netIO.SendPacket(p1, this.SessionID);
return;
}
if (this.Char.zeny < item.price)
{
p1.SetResult(1);
this.netIO.SendPacket(p1, this.SessionID);
return;
}
Mail mail = new Mail();
mail.content = "We are glad to inform you that your registered item at <Regenbogen> Market Place was bought by another Player" +
".\n Here is the money for the sold item.\n We are looking forward to see you at <Regenbogen> again!";
mail.date = DateTime.Now;
mail.read = 0;
mail.receiver = item.owner;
mail.sender = "<Regenbogen>";
mail.topic = "Your item at <Regenbogen> was sold";
mail.zeny = item.price;
mail.valid = 30;
MapServer.charDB.NewMail(mail);
MapServer.charDB.DeleteMarketItem(item);
MapClient receiver = MapClientManager.Instance.GetClient(item.owner);
if (receiver != null)
{
receiver.CheckNewMail();
}
this.Char.zeny -= item.price;
this.SendZeny();
mail = new Mail();
mail.content = "We are glad to inform you that you've successfully bought an item at <Regenbogen> Market Place from another Player" +
".\n Here is the bought item.\n We are looking forward to see you at <Regenbogen> again!";
mail.date = DateTime.Now;
mail.read = 0;
mail.receiver = this.Char.Name;
mail.sender = "<Regenbogen>";
mail.topic = "You've bought an item at <Regenbogen>";
mail.valid = 30;
mail.creator = "";
mail.durability = item.item.durability;
mail.item = (uint)item.item.id;
mail.stack = item.item.stack;
MapServer.charDB.NewMail(mail);
this.CheckNewMail();
p1.SetResult(0);
this.netIO.SendPacket(p1, this.SessionID);
}
示例2: OnMarketDeleteItem
public void OnMarketDeleteItem(Packets.Client.MarketDeleteItem p)
{
/*
* Expected packets:
* SMSG_MarketDelete
*
* Additional expected packet:
* SMSG_NewMailRecieved
*
* Approach: check if the selected itemid still exists in the database
* if so send marketdelete packet with a 0 reason (successfull) and a new mail message
*
* If it fails you'ld need to send it with a failure reason, no clue which id's it are
*/
uint id = p.GetItemId();
MarketplaceItem item = MapServer.charDB.GetMarketItem(id);
Packets.Server.MarketDeleteIem p1 = new SagaMap.Packets.Server.MarketDeleteIem();
if (item == null)
{
p1.SetReason(1);
this.netIO.SendPacket(p1, this.SessionID);
return;
}
MapServer.charDB.DeleteMarketItem(item);
Mail mail = new Mail();
mail.content = "You've canceled a registered Auction at <Regenbogen> Market Place" +
".\n Here is the item you've handed to us.\n We are looking forward to see you at <Regenbogen> again!";
mail.date = DateTime.Now;
mail.read = 0;
mail.receiver = this.Char.Name;
mail.sender = "<Regenbogen>";
mail.topic = "You've canceled an auction at <Regenbogen>";
mail.valid = 30;
mail.creator = "";
mail.durability = item.item.durability;
mail.item = (uint)item.item.id;
mail.stack = item.item.stack;
MapServer.charDB.NewMail(mail);
this.CheckNewMail();
p1.SetReason(0);
this.netIO.SendPacket(p1, this.SessionID);
}