static void OnPlayerEnterWorld(WORLDMSG msgID, BinReader data) { uint id = data.ReadUInt32(); ACCESSLEVEL accesslevel = (ACCESSLEVEL)data.ReadByte(); DBCharacter c = (DBCharacter)DBManager.GetDBObject(typeof(DBCharacter), id); if (c == null) { Console.WriteLine("Failed to enter world with id " + id + ". WorldServer is missing Character object"); return; } WorldClient client = new WorldClient(c); MapInstance map = (MapInstance)m_maps[c.WorldMapID]; if (map == null) { Console.WriteLine("Worldserver is not handling " + c.WorldMapID + "!"); client.LeaveWorld(); return; } map.SetObjectPositionInBounds(client.Player); client.CreatePlayerObject(); client.Player.AccessLvl = accesslevel; map.Enter(client.Player); }
static void OnWorldPortAck(WorldClient client, CMSG msgID, BinReader data) { if (client.Player.MapTile == null) { client.CreatePlayerObject(); MapInstance map = GetMap(client.Player.WorldMapID); if (map == null) { Console.WriteLine("Error worldserver received MOVE_WORLDPORT_ACK for a worldmap it wasn't handling."); client.LeaveWorld(); return; } map.Enter(client.Player); } }