private void OnCharacterRegistrationRequest(Packet inPacket) { int characterId = inPacket.ReadInt(); Character character = CenterServer.GetCharacter(characterId); if (character == null) { character = new Character(); character.ID = characterId; character.Name = inPacket.ReadString(); character.WorldID = this.Server.WorldID; character.ChannelID = this.Server.GameID; CenterServer.Characters.Add(character.ID, character); } else if (character.IsMigrating) { character.IsMigrating = false; character.ChannelID = this.Server.GameID; } character.Job = inPacket.ReadShort(); character.Level = inPacket.ReadByte(); }
private void OnMigrateRequest(Packet inPacket) { string hash = inPacket.ReadString(); byte worldId = inPacket.ReadByte(); byte channelId = inPacket.ReadByte(); int characterId = inPacket.ReadInt(); using (Packet outPacket = new Packet(InteroperabilityMessages.MigrateResponse)) { outPacket.WriteString(hash); outPacket.WriteInt(characterId); if (!CenterServer.Worlds.ContainsKey(worldId)) { outPacket.WriteInt(); outPacket.WriteShort(); this.Send(outPacket); return; } if (channelId != 50 && CenterServer.Worlds[worldId].GameServers.ContainsKey(channelId)) { Server server = CenterServer.Worlds[worldId].GameServers[channelId]; outPacket.WriteBytes(server.PublicIP.GetAddressBytes()); outPacket.WriteUShort(server.Port); Character c = CenterServer.GetCharacter(characterId); if (c != null) { c.IsMigrating = true; } } else if (channelId == 50 && CenterServer.Worlds[worldId].ShopServer != null) { Server server = CenterServer.Worlds[worldId].ShopServer; outPacket.WriteBytes(server.PublicIP.GetAddressBytes()); outPacket.WriteUShort(server.Port); Character c = CenterServer.GetCharacter(characterId); if (c != null) { c.IsMigrating = true; c.LastChannel = c.ChannelID; } } else { outPacket.WriteInt(); outPacket.WriteShort(); } this.Send(outPacket); } }
private void OnCharacterDegistrationRequest(Packet inPacket) { int characterId = inPacket.ReadInt(); Character character = CenterServer.GetCharacter(characterId); if (character == null) { return; } CenterServer.Characters.Remove(characterId); }