Exemplo n.º 1
0
        public void On_CMSG_LOGOUT_CANCEL(ref Packets.PacketClass packet, ref WS_Network.ClientClass client)
        {
            try
            {
                WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] CMSG_LOGOUT_CANCEL", client.IP, client.Port);
                if (client != null && client.Character != null && client.Character.LogoutTimer != null)
                {
                    client.Character.LogoutTimer?.Dispose();
                    client.Character.LogoutTimer = null;

                    Packets.UpdateClass UpdateData         = new Packets.UpdateClass(WorldServiceLocator._Global_Constants.FIELD_MASK_SIZE_PLAYER);
                    Packets.PacketClass SMSG_UPDATE_OBJECT = new Packets.PacketClass(Opcodes.SMSG_UPDATE_OBJECT);
                    try
                    {
                        SMSG_UPDATE_OBJECT.AddInt32(1);
                        SMSG_UPDATE_OBJECT.AddInt8(0);
                        client.Character.cUnitFlags &= -262145;
                        UpdateData.SetUpdateFlag(46, client.Character.cUnitFlags);
                        client.Character.StandState = 0;
                        UpdateData.SetUpdateFlag(138, client.Character.cBytes1);
                        WS_PlayerData.CharacterObject updateObject = client.Character;
                        UpdateData.AddToPacket(ref SMSG_UPDATE_OBJECT, ObjectUpdateType.UPDATETYPE_VALUES, ref updateObject);
                        client.Send(ref SMSG_UPDATE_OBJECT);
                    }
                    finally
                    {
                        SMSG_UPDATE_OBJECT.Dispose();
                    }
                    Packets.PacketClass packetACK = new Packets.PacketClass(Opcodes.SMSG_STANDSTATE_CHANGE_ACK);
                    try
                    {
                        packetACK.AddInt8(0);
                        client.Send(ref packetACK);
                    }
                    finally
                    {
                        packetACK.Dispose();
                    }
                    Packets.PacketClass SMSG_LOGOUT_CANCEL_ACK = new Packets.PacketClass(Opcodes.SMSG_LOGOUT_CANCEL_ACK);
                    try
                    {
                        client.Send(ref SMSG_LOGOUT_CANCEL_ACK);
                    }
                    finally
                    {
                        SMSG_LOGOUT_CANCEL_ACK.Dispose();
                    }
                    WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] SMSG_LOGOUT_CANCEL_ACK", client.IP, client.Port);
                    client.Character.SetMoveUnroot();
                }
            }
            catch (Exception ex)
            {
                ProjectData.SetProjectError(ex);
                Exception e = ex;
                WorldServiceLocator._WorldServer.Log.WriteLine(LogType.CRITICAL, "Error while trying to cancel logout.{0}", Environment.NewLine + e);
                ProjectData.ClearProjectError();
            }
        }
Exemplo n.º 2
0
            public void ConvertToBones()
            {
                WorldServiceLocator._WorldServer.CharacterDatabase.Update($"DELETE FROM corpse WHERE player = \"{Owner}\";");
                Flags = 5;
                Owner = 0uL;
                int j = 0;

                checked
                {
                    do
                    {
                        Items[j] = 0;
                        j++;
                    }while (j <= 18);
                    Packets.PacketClass packet = new Packets.PacketClass(Opcodes.SMSG_UPDATE_OBJECT);
                    try
                    {
                        packet.AddInt32(1);
                        packet.AddInt8(0);
                        Packets.UpdateClass tmpUpdate = new Packets.UpdateClass(WorldServiceLocator._Global_Constants.FIELD_MASK_SIZE_CORPSE);
                        try
                        {
                            tmpUpdate.SetUpdateFlag(6, 0);
                            tmpUpdate.SetUpdateFlag(35, 5);
                            int i = 0;
                            do
                            {
                                tmpUpdate.SetUpdateFlag(13 + i, 0);
                                i++;
                            }while (i <= 18);
                            CorpseObject updateObject = this;
                            tmpUpdate.AddToPacket(ref packet, ObjectUpdateType.UPDATETYPE_VALUES, ref updateObject);
                            SendToNearPlayers(ref packet);
                        }
                        finally
                        {
                            tmpUpdate.Dispose();
                        }
                    }
                    finally
                    {
                        packet.Dispose();
                    }
                }
            }
Exemplo n.º 3
0
 public void AddToWorld()
 {
     WorldServiceLocator._WS_Maps.GetMapTile(positionX, positionY, ref CellX, ref CellY);
     if (WorldServiceLocator._WS_Maps.Maps[MapID].Tiles[CellX, CellY] == null)
     {
         WorldServiceLocator._WS_CharMovement.MAP_Load(CellX, CellY, MapID);
     }
     WorldServiceLocator._WS_Maps.Maps[MapID].Tiles[CellX, CellY].CorpseObjectsHere.Add(GUID);
     Packets.PacketClass packet = new Packets.PacketClass(Opcodes.SMSG_UPDATE_OBJECT);
     checked
     {
         try
         {
             Packets.UpdateClass tmpUpdate = new Packets.UpdateClass(WorldServiceLocator._Global_Constants.FIELD_MASK_SIZE_CORPSE);
             try
             {
                 packet.AddInt32(1);
                 packet.AddInt8(0);
                 FillAllUpdateFlags(ref tmpUpdate);
                 Packets.UpdateClass updateClass  = tmpUpdate;
                 CorpseObject        updateObject = this;
                 updateClass.AddToPacket(ref packet, ObjectUpdateType.UPDATETYPE_CREATE_OBJECT, ref updateObject);
             }
             finally
             {
                 tmpUpdate.Dispose();
             }
             short i = -1;
             do
             {
                 short j = -1;
                 do
                 {
                     if ((short)unchecked (CellX + i) >= 0 && (short)unchecked (CellX + i) <= 63 && (short)unchecked (CellY + j) >= 0 && (short)unchecked (CellY + j) <= 63 && WorldServiceLocator._WS_Maps.Maps[MapID].Tiles[(short)unchecked (CellX + i), (short)unchecked (CellY + j)] != null && WorldServiceLocator._WS_Maps.Maps[MapID].Tiles[(short)unchecked (CellX + i), (short)unchecked (CellY + j)].PlayersHere.Count > 0)
                     {
                         WS_Maps.TMapTile tMapTile = WorldServiceLocator._WS_Maps.Maps[MapID].Tiles[(short)unchecked (CellX + i), (short)unchecked (CellY + j)];
                         ulong[]          list     = tMapTile.PlayersHere.ToArray();
                         ulong[]          array    = list;
                         foreach (ulong plGUID in array)
                         {
                             int num;
                             if (WorldServiceLocator._WorldServer.CHARACTERs.ContainsKey(plGUID))
                             {
                                 WS_PlayerData.CharacterObject characterObject = WorldServiceLocator._WorldServer.CHARACTERs[plGUID];
                                 WS_Base.BaseObject            objCharacter    = this;
                                 num = (characterObject.CanSee(ref objCharacter) ? 1 : 0);
                             }
                             else
                             {
                                 num = 0;
                             }
                             if (num != 0)
                             {
                                 WorldServiceLocator._WorldServer.CHARACTERs[plGUID].client.SendMultiplyPackets(ref packet);
                                 WorldServiceLocator._WorldServer.CHARACTERs[plGUID].corpseObjectsNear.Add(GUID);
                                 SeenBy.Add(plGUID);
                             }
                         }
                     }
                     j = (short)unchecked (j + 1);
                 }while (j <= 1);
                 i = (short)unchecked (i + 1);
             }while (i <= 1);
         }
         finally
         {
             packet.Dispose();
         }
     }
 }
Exemplo n.º 4
0
            public void AddToWorld()
            {
                WorldServiceLocator._WS_Maps.GetMapTile(positionX, positionY, ref CellX, ref CellY);
                if (WorldServiceLocator._WS_Maps.Maps[MapID].Tiles[CellX, CellY] == null)
                {
                    WorldServiceLocator._WS_CharMovement.MAP_Load(CellX, CellY, MapID);
                }
                try
                {
                    WorldServiceLocator._WS_Maps.Maps[MapID].Tiles[CellX, CellY].DynamicObjectsHere.Add(GUID);
                }
                catch (Exception projectError)
                {
                    ProjectData.SetProjectError(projectError);
                    WorldServiceLocator._WorldServer.Log.WriteLine(LogType.WARNING, "AddToWorld failed MapId: {0} Tile XY: {1} {2} GUID: {3}", MapID, CellX, CellY, GUID);
                    ProjectData.ClearProjectError();
                    return;
                }
                Packets.PacketClass packet = new Packets.PacketClass(Opcodes.SMSG_UPDATE_OBJECT);
                packet.AddInt32(1);
                packet.AddInt8(0);
                Packets.UpdateClass tmpUpdate = new Packets.UpdateClass(WorldServiceLocator._Global_Constants.FIELD_MASK_SIZE_DYNAMICOBJECT);
                FillAllUpdateFlags(ref tmpUpdate);
                Packets.UpdateClass updateClass  = tmpUpdate;
                DynamicObjectObject updateObject = this;

                updateClass.AddToPacket(ref packet, ObjectUpdateType.UPDATETYPE_CREATE_OBJECT_SELF, ref updateObject);
                tmpUpdate.Dispose();
                short i = -1;

                checked
                {
                    do
                    {
                        short j = -1;
                        do
                        {
                            if ((short)unchecked (CellX + i) >= 0 && (short)unchecked (CellX + i) <= 63 && (short)unchecked (CellY + j) >= 0 && (short)unchecked (CellY + j) <= 63 && WorldServiceLocator._WS_Maps.Maps[MapID].Tiles[(short)unchecked (CellX + i), (short)unchecked (CellY + j)] != null && WorldServiceLocator._WS_Maps.Maps[MapID].Tiles[(short)unchecked (CellX + i), (short)unchecked (CellY + j)].PlayersHere.Count > 0)
                            {
                                WS_Maps.TMapTile tMapTile = WorldServiceLocator._WS_Maps.Maps[MapID].Tiles[(short)unchecked (CellX + i), (short)unchecked (CellY + j)];
                                ulong[]          list     = tMapTile.PlayersHere.ToArray();
                                ulong[]          array    = list;
                                foreach (ulong plGUID in array)
                                {
                                    int num;
                                    if (WorldServiceLocator._WorldServer.CHARACTERs.ContainsKey(plGUID))
                                    {
                                        WS_PlayerData.CharacterObject characterObject = WorldServiceLocator._WorldServer.CHARACTERs[plGUID];
                                        WS_Base.BaseObject            objCharacter    = this;
                                        num = (characterObject.CanSee(ref objCharacter) ? 1 : 0);
                                    }
                                    else
                                    {
                                        num = 0;
                                    }
                                    if (num != 0)
                                    {
                                        WorldServiceLocator._WorldServer.CHARACTERs[plGUID].client.SendMultiplyPackets(ref packet);
                                        WorldServiceLocator._WorldServer.CHARACTERs[plGUID].dynamicObjectsNear.Add(GUID);
                                        SeenBy.Add(plGUID);
                                    }
                                }
                            }
                            j = (short)unchecked (j + 1);
                        }while (j <= 1);
                        i = (short)unchecked (i + 1);
                    }while (i <= 1);
                    packet.Dispose();
                }
            }
Exemplo n.º 5
0
 public void On_CMSG_LOGOUT_REQUEST(ref Packets.PacketClass packet, ref WS_Network.ClientClass client)
 {
     WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] CMSG_LOGOUT_REQUEST", client.IP, client.Port);
     client.Character.Save();
     if (client.Character.IsInCombat)
     {
         Packets.PacketClass LOGOUT_RESPONSE_DENIED = new Packets.PacketClass(Opcodes.SMSG_LOGOUT_RESPONSE);
         try
         {
             LOGOUT_RESPONSE_DENIED.AddInt32(0);
             LOGOUT_RESPONSE_DENIED.AddInt8(12);
             client.Send(ref LOGOUT_RESPONSE_DENIED);
         }
         finally
         {
             LOGOUT_RESPONSE_DENIED.Dispose();
         }
         return;
     }
     if (!(client.Character.positionZ > WorldServiceLocator._WS_Maps.GetZCoord(client.Character.positionX, client.Character.positionY, client.Character.positionZ, client.Character.MapID) + 10f))
     {
         Packets.UpdateClass UpdateData         = new Packets.UpdateClass(WorldServiceLocator._Global_Constants.FIELD_MASK_SIZE_PLAYER);
         Packets.PacketClass SMSG_UPDATE_OBJECT = new Packets.PacketClass(Opcodes.SMSG_UPDATE_OBJECT);
         try
         {
             SMSG_UPDATE_OBJECT.AddInt32(1);
             SMSG_UPDATE_OBJECT.AddInt8(0);
             client.Character.cUnitFlags |= 0x40000;
             UpdateData.SetUpdateFlag(46, client.Character.cUnitFlags);
             client.Character.StandState = 1;
             UpdateData.SetUpdateFlag(138, client.Character.cBytes1);
             WS_PlayerData.CharacterObject updateObject = client.Character;
             UpdateData.AddToPacket(ref SMSG_UPDATE_OBJECT, ObjectUpdateType.UPDATETYPE_VALUES, ref updateObject);
             client.Character.SendToNearPlayers(ref SMSG_UPDATE_OBJECT);
         }
         finally
         {
             SMSG_UPDATE_OBJECT.Dispose();
         }
         Packets.PacketClass packetACK = new Packets.PacketClass(Opcodes.SMSG_STANDSTATE_CHANGE_ACK);
         try
         {
             packetACK.AddInt8(1);
             client.Send(ref packetACK);
         }
         finally
         {
             packetACK.Dispose();
         }
     }
     Packets.PacketClass SMSG_LOGOUT_RESPONSE = new Packets.PacketClass(Opcodes.SMSG_LOGOUT_RESPONSE);
     try
     {
         SMSG_LOGOUT_RESPONSE.AddInt32(0);
         SMSG_LOGOUT_RESPONSE.AddInt8(0);
         client.Send(ref SMSG_LOGOUT_RESPONSE);
     }
     finally
     {
         SMSG_LOGOUT_RESPONSE.Dispose();
     }
     WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] SMSG_LOGOUT_RESPONSE", client.IP, client.Port);
     client.Character.SetMoveRoot();
     client.Character.ZoneCheck();
     if (client.Character.isResting)
     {
         client.Character.Logout();
     }
     else
     {
         client.Character.LogoutTimer = new Timer(client.Character.Logout, null, 20000, -1);
     }
 }