public static void ReceivedCharacterDeleted(Network.WorldLink link, Protocol.ForwardPacket packet) { string name = packet.Reader.ReadString(); Database.Records.AccountCharactersInformationsRecord character = Database.Cache.AccountCharactersInformationsCache.Cache.FirstOrDefault (x => x.Server == link.GameServer.ID && x.Name == name); Database.Cache.AccountCharactersInformationsCache.Cache.Remove(character); character.DeleteAndFlush(); }
public static void ReceivedCharacterCreated(Network.WorldLink link, Protocol.ForwardPacket packet) { Database.Records.AccountCharactersInformationsRecord character = new Database.Records.AccountCharactersInformationsRecord() { Owner = packet.Reader.ReadInt32(), Name = packet.Reader.ReadString(), Server = link.GameServer.ID, }; character.SaveAndFlush(); Database.Cache.AccountCharactersInformationsCache.Cache.Add(character); }
public static void ReceivedPlayerConnected(Network.WorldLink link, Protocol.ForwardPacket packet) { string name = packet.Reader.ReadString(); if (!link.ConnectedAccount.Contains(name)) { link.ConnectedAccount.Add(name); Database.Records.AccountRecord account = Database.Records.AccountRecord.FindByUsername(name); if (account != null) { account.Logged = 1; account.SaveAndFlush(); } } Logger.LogInfo("Player '" + name + "' connected on server '" + link.GameServer.ID + "'"); }
public static void ReceivedShopPointUpdate(Network.WorldLink link, Protocol.ForwardPacket packet) { try { string name = packet.Reader.ReadString(); int points = packet.Reader.ReadInt32(); Database.Records.AccountRecord account = Database.Records.AccountRecord.FindByUsername(name); if (account != null) { account.Points = points; account.SaveAndFlush(); Logger.LogInfo("Shop points updated for '" + name + "' !"); } } catch (Exception e) { Logger.LogError("Cant update shop points : " + e.ToString()); } }
public static void ReceivedPlayerDisconnected(Network.WorldLink link, Protocol.ForwardPacket packet) { try { string name = packet.Reader.ReadString(); if (link.ConnectedAccount.Contains(name)) { link.ConnectedAccount.Remove(name); Database.Records.AccountRecord account = Database.Records.AccountRecord.FindByUsername(name); if (account != null) { account.Logged = 0; account.SaveAndFlush(); } } Logger.LogInfo("Player '" + name + "' disconnected on from '" + link.GameServer.ID + "'"); } catch (Exception e) { Logger.LogError("Can't disconnect player : " + e.ToString()); } }
public static void SendPlayerToWorld(Network.WorldLink link, Authentification.Network.AuthentificationClient client, string ticket) { link.SendMessage(new Network.Packet.PlayerCommingMessage(client.Account, ticket)); System.Threading.Thread.Sleep(250); }
public static void SendSecureKey(Network.WorldLink link) { link.SendMessage(new Network.Packet.SecureKeyMessage(Utilities.ConfigurationManager.GetStringValue("SecureKey"))); }