예제 #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();
            }
        }
예제 #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();
                    }
                }
            }
예제 #3
0
            public void FillAllUpdateFlags(ref Packets.UpdateClass Update)
            {
                Update.SetUpdateFlag(0, GUID);
                Update.SetUpdateFlag(2, 129);
                Update.SetUpdateFlag(3, 0);
                Update.SetUpdateFlag(4, 1f);
                Update.SetUpdateFlag(6, Owner);
                Update.SetUpdateFlag(8, orientation);
                Update.SetUpdateFlag(9, positionX);
                Update.SetUpdateFlag(10, positionY);
                Update.SetUpdateFlag(11, positionZ);
                Update.SetUpdateFlag(12, Model);
                int i = 0;

                checked
                {
                    do
                    {
                        Update.SetUpdateFlag(13 + i, Items[i]);
                        i++;
                    }while (i <= 18);
                    Update.SetUpdateFlag(32, Bytes1);
                    Update.SetUpdateFlag(33, Bytes2);
                    Update.SetUpdateFlag(34, Guild);
                    Update.SetUpdateFlag(35, Flags);
                    Update.SetUpdateFlag(36, DynFlags);
                }
            }
예제 #4
0
 public void FillAllUpdateFlags(ref Packets.UpdateClass Update)
 {
     Update.SetUpdateFlag(0, GUID);
     Update.SetUpdateFlag(2, 65);
     Update.SetUpdateFlag(4, 0.5f * Radius);
     Update.SetUpdateFlag(6, Caster.GUID);
     Update.SetUpdateFlag(8, Bytes);
     Update.SetUpdateFlag(9, SpellID);
     Update.SetUpdateFlag(10, Radius);
     Update.SetUpdateFlag(11, positionX);
     Update.SetUpdateFlag(12, positionY);
     Update.SetUpdateFlag(13, positionZ);
     Update.SetUpdateFlag(14, orientation);
 }
예제 #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);
     }
 }