Esempio n. 1
0
 public void RemovePlayer(Player pPlayer)
 {
     mPlayers.Remove(pPlayer);
     Player controller = null;
     if (mPlayers.Count > 0) controller = mPlayers[0];
     mMobs.ForEach(m => { if (m.Controller == pPlayer) m.AssignController(controller); });
     SendPlayerLeave(pPlayer);
 }
Esempio n. 2
0
 internal void AssignController(Player pPlayer)
 {
     if (mController == pPlayer) return;
     if (mController != null) SendControl(false);
     mController = pPlayer;
     SendControl(true);
 }
Esempio n. 3
0
 protected override void Execute(Player pPlayer, Portal pPortal)
 {
     pPlayer.SendPortalBlocked();
 }
 protected internal abstract void Execute(Player pPlayer, Portal pPortal);
Esempio n. 5
0
 internal void SendReactorDetails(Player pPlayer)
 {
     int slot = 0;
     foreach (Reactor reactor in mReactors)
     {
         Packet packet = new Packet(EOpcode.SMSG_REACTOR_DETAILS);
         packet.WriteInt(slot++);
         packet.WriteInt(reactor.Data.ReactorIdentifier);
         packet.WriteByte(reactor.State);
         packet.WriteShort(reactor.Data.X);
         packet.WriteShort(reactor.Data.Y);
         packet.WriteByte(0x00);
         pPlayer.SendPacket(packet);
     }
 }
Esempio n. 6
0
 public void AddPlayer(Player pPlayer)
 {
     mPlayers.Add(pPlayer);
 }
Esempio n. 7
0
 internal void SendPlayerLeave(Player pPlayer)
 {
     Packet packet = new Packet(EOpcode.SMSG_PLAYER_LEAVE);
     packet.WriteInt(pPlayer.Identifier);
     SendPacketToAll(packet);
 }
Esempio n. 8
0
 internal void SendPlayerDetails(Player pPlayer)
 {
     SendPacketToAllExcept(pPlayer.GetPlayerDetails(), pPlayer);
     mPlayers.ForEach(p => { if (p != pPlayer) pPlayer.SendPacket(p.GetPlayerDetails()); });
 }
Esempio n. 9
0
 internal void SendPacketToAllExcept(Packet pPacket, Player pExcept)
 {
     mPlayers.ForEach(p => { if (p != pExcept) p.SendPacket(pPacket); });
 }
Esempio n. 10
0
        internal void SendNPCDetails(Player pPlayer)
        {
            int index = 0;
            foreach (NPC npc in mNPCs)
            {
                Packet packet = new Packet(EOpcode.SMSG_NPC_DETAILS);
                packet.WriteInt(index + 0x64);
                packet.WriteInt(npc.Data.NPCIdentifier);
                packet.WriteShort(npc.Data.X);
                packet.WriteShort(npc.Data.Y);
                packet.WriteBool((npc.Data.Flags & MapData.MapNPCData.EMapNPCFlags.FacesLeft) != MapData.MapNPCData.EMapNPCFlags.None);
                packet.WriteUShort(npc.Data.Foothold);
                packet.WriteShort(npc.Data.MinClickX);
                packet.WriteShort(npc.Data.MaxClickX);
                packet.WriteBool(true);
                pPlayer.SendPacket(packet);

                packet = new Packet(EOpcode.SMSG_NPC_CONTROL);
                packet.WriteBool(true);
                packet.WriteInt(index + 0x64);
                packet.WriteInt(npc.Data.NPCIdentifier);
                packet.WriteShort(npc.Data.X);
                packet.WriteShort(npc.Data.Y);
                packet.WriteBool((npc.Data.Flags & MapData.MapNPCData.EMapNPCFlags.FacesLeft) != MapData.MapNPCData.EMapNPCFlags.None);
                packet.WriteUShort(npc.Data.Foothold);
                packet.WriteShort(npc.Data.MinClickX);
                packet.WriteShort(npc.Data.MaxClickX);
                packet.WriteBool(true);
                pPlayer.SendPacket(packet);

                ++index;
            }
        }
Esempio n. 11
0
        internal void SendMobDetails(Player pPlayer)
        {
            foreach (Mob mob in mMobs)
            {
                Packet packet = new Packet(EOpcode.SMSG_MOB_DETAILS);
                packet.WriteInt(mob.UniqueIdentifier);
                packet.WriteByte(0x00);
                packet.WriteInt(mob.Data.MobIdentifier);
                mob.WriteStatus(packet);
                packet.WriteCoordinates(mob.Position);
                byte bits = 0x02;
                if (mob.FacingLeft) bits |= 0x01;
                packet.WriteByte(bits);
                packet.WriteUShort(mob.Foothold);
                packet.WriteUShort(mob.Data.Foothold);
                packet.WriteSByte(-1);
                packet.WriteSByte(0);
                packet.WriteInt(0);
                pPlayer.SendPacket(packet);

            }
        }