当前位置: 首页>>代码示例>>C#>>正文


C# Packets.GetSupplyID方法代码示例

本文整理汇总了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) { }
 }
开发者ID:Willyham,项目名称:SagaRO2,代码行数:24,代码来源:MapClient.NPC.cs

示例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)
     {
     }
 }
开发者ID:Willyham,项目名称:SagaRO2,代码行数:42,代码来源:MapClient.NPC.cs


注:本文中的Packets.GetSupplyID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。