示例#1
0
文件: MapItem.cs 项目: xxlio109/Saga
 public void SendLootList(ActorPC pc)
 {
     ActorEventHandlers.PC_EventHandler eh = (SagaMap.ActorEventHandlers.PC_EventHandler)pc.e;
     if (this.NPCItem == null)
     {
         this.NPCItem = new List <Item>();
     }
     pc.CurNPCinv = this.NPCItem;
     Packets.Server.SendNpcInventory sendPacket = new Packets.Server.SendNpcInventory();
     sendPacket.SetActorID(pc.id);
     sendPacket.SetItems(this.NPCItem);
     eh.C.netIO.SendPacket(sendPacket, eh.C.SessionID);
 }
示例#2
0
        public void OnNPCDropList(SagaMap.Packets.Client.NPCDropList p)
        {
            if (this.state != SESSION_STATE.MAP_LOADED)
            {
                return;
            }
            ActorNPC Mob = (ActorNPC)this.map.GetActor(p.GetActorID());

            if (Mob.stance != Global.STANCE.DIE && Mob.HP != 0)
            {
                return;
            }
            if (Mob == null)
            {
                Packets.Server.NPCDropListResult sendPacket = new SagaMap.Packets.Server.NPCDropListResult();
                sendPacket.SetResult(SagaMap.Packets.Server.NPCDropListResult.Result.NO_RIGHT);
                this.netIO.SendPacket(sendPacket, this.SessionID);
                return;
            }
            Mob mob = (Mob)Mob.e;

            if (mob.timeSignature.actorID != this.Char.id)
            {
                Packets.Server.NPCDropListResult sendPacket = new SagaMap.Packets.Server.NPCDropListResult();
                sendPacket.SetResult(SagaMap.Packets.Server.NPCDropListResult.Result.NO_RIGHT);
                this.netIO.SendPacket(sendPacket, this.SessionID);
                return;
            }
            if (!this.Char.inv.HasFreeSpace())
            {
                Packets.Server.NPCDropListResult sendPacket = new SagaMap.Packets.Server.NPCDropListResult();
                sendPacket.SetResult(SagaMap.Packets.Server.NPCDropListResult.Result.INVENTORY_FULL);
                this.netIO.SendPacket(sendPacket, this.SessionID);;
                return;
            }
            if (Mob.NPCinv == null)
            {
                Mob.NPCinv = new List <Item>();
            }
            this.Char.CurNPCinv = Mob.NPCinv;
            Packets.Server.SendNpcInventory sendPacket1 = new Packets.Server.SendNpcInventory();
            sendPacket1.SetActorID(this.Char.id);
            sendPacket1.SetItems(Mob.NPCinv);
            this.netIO.SendPacket(sendPacket1, this.SessionID);;
            //this.map.DeleteActor(Mob);
        }
示例#3
0
 //07 03 Droplist Select
 public void OnDropSelect(SagaMap.Packets.Client.DropSelect p)
 {
     if (this.state != SESSION_STATE.MAP_LOADED)
     {
         return;
     }
     try
     {
         if (this.Char.CurNPCinv == null)
         {
             this.Char.CurNPCinv = new List <Item>();
         }
         if (this.Char.CurNPCinv.Count != 0)
         {
             Item nItem = this.Char.CurNPCinv[(int)p.GetIndex()];
             this.Char.CurNPCinv.RemoveAt((int)p.GetIndex());
             if (nItem != null)
             {
                 this.map.AddItemToActor(this.Char, nItem, ITEM_UPDATE_REASON.FOUND);
                 if (this.Party != null)
                 {
                     this.Party.SendLoot(this, (uint)nItem.id);
                 }
             }
         }
         Packets.Server.SendNpcInventory sendPacket = new Packets.Server.SendNpcInventory();
         sendPacket.SetActorID(this.Char.id);
         sendPacket.SetItems(this.Char.CurNPCinv);
         this.netIO.SendPacket(sendPacket, this.SessionID);
         Quest.QuestsManager.UpdateQuestItem(this.Char);
     }
     catch (Exception)
     {
         Packets.Server.SendNpcInventory sendPacket = new Packets.Server.SendNpcInventory();
         sendPacket.SetActorID(this.Char.id);
         sendPacket.SetItems(new List <Item>());
         this.netIO.SendPacket(sendPacket, this.SessionID);
         Quest.QuestsManager.UpdateQuestItem(this.Char);
     }
 }