本文整理汇总了C#中Packets.GetSupplyID方法的典型用法代码示例。如果您正苦于以下问题:C# Packets.GetSupplyID方法的具体用法?C# Packets.GetSupplyID怎么用?C# Packets.GetSupplyID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Packets
的用法示例。
在下文中一共展示了Packets.GetSupplyID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnSupplySelect
public void OnSupplySelect(Packets.Client.SupplySelect p)
{
if (this.Char.CurTarget == null) return;
if (this.Char.CurTarget.type != ActorType.NPC) return;
try
{
Npc npc = (Npc)this.Char.CurTarget.e;
Packets.Server.SendSupplyList p2 = new SagaMap.Packets.Server.SendSupplyList();
uint supplyID = p.GetSupplyID();
if (!npc.SupplyMatrials.ContainsKey(supplyID) || !npc.SupplyProducts.ContainsKey(supplyID))
{
if (this.Char.GMLevel > 1)
SendMessage("System", "Cannot find Supply items for supplyID:" + supplyID + " for this NPC!", SagaMap.Packets.Server.SendChat.MESSAGE_TYPE.SYSTEM_MESSAGE);
return;
}
p2.SetActor(npc.Actor.id);
p2.SetSupplyID(supplyID);
p2.SetProducts(npc.SupplyProducts[supplyID]);
p2.SetMatrial(npc.SupplyMatrials[supplyID]);
this.netIO.SendPacket(p2, this.SessionID);
npc.NPCChat(this.Char, 0);
}
catch (Exception) { }
}
示例2: OnSupplyExchange
public void OnSupplyExchange(Packets.Client.SupplyExchange p)
{
if (this.Char.CurTarget == null) return;
if (this.Char.CurTarget.type != ActorType.NPC) return;
try
{
Npc npc = (Npc)this.Char.CurTarget.e;
Packets.Server.SendSupplyResult p2 = new SagaMap.Packets.Server.SendSupplyResult();
uint supplyID = p.GetSupplyID();
if (!npc.SupplyMatrials.ContainsKey(supplyID) || !npc.SupplyProducts.ContainsKey(supplyID))
{
if (this.Char.GMLevel > 1)
SendMessage("System", "Cannot find Supply items for supplyID:" + supplyID + " for this NPC!", SagaMap.Packets.Server.SendChat.MESSAGE_TYPE.SYSTEM_MESSAGE);
return;
}
if (!this.Char.inv.HasFreeSpace())
{
p2.SetResult(SagaMap.Packets.Server.SendSupplyResult.Results.NOT_ENOUGH_SPACE);
this.netIO.SendPacket(p2, this.SessionID);
return;
}
foreach (Packets.Server.SendSupplyList.SupplyItem i in npc.SupplyMatrials[supplyID])
{
if (npc.CountItem(this.Char, (int)i.itemID) < i.amount)
{
p2.SetResult(SagaMap.Packets.Server.SendSupplyResult.Results.NOT_ENOUGH_SPACE);
this.netIO.SendPacket(p2, this.SessionID);
return;
}
npc.TakeItem(this.Char, (int)i.itemID, i.amount);
}
foreach (Packets.Server.SendSupplyList.SupplyItem i in npc.SupplyProducts[supplyID])
{
npc.GiveItem(this.Char, (int)i.itemID, i.amount);
}
p2.SetResult(SagaMap.Packets.Server.SendSupplyResult.Results.OK);
this.netIO.SendPacket(p2, this.SessionID);
}
catch (Exception)
{
}
}