Moving zone/login stuff away from packetprocessor into a "WorldManager" class.

This commit is contained in:
Filip Maj 2016-01-17 23:36:34 -05:00
parent a640e08fe1
commit 887da7b503
8 changed files with 331 additions and 73 deletions

View file

@ -543,51 +543,5 @@ namespace FFXIVClassic_Lobby_Server
return cheevosPacket.buildPacket(player.actorId);
}
public static void loadZones(Efficient32bitHashTable<Zone> zoneList)
{
int count = 0;
using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
{
try
{
conn.Open();
string query = @"
SELECT
id,
regionId,
zoneName,
dayMusic,
nightMusic,
battleMusic,
isInn,
canRideChocobo,
canStealth,
isInstanceRaid
FROM server_zones
WHERE zoneName IS NOT NULL";
MySqlCommand cmd = new MySqlCommand(query, conn);
using (MySqlDataReader reader = cmd.ExecuteReader())
{
while (reader.Read()) {
Zone zone = new Zone(reader.GetUInt32(0), reader.GetString(2), reader.GetUInt16(1), reader.GetUInt16(3), reader.GetUInt16(4), reader.GetUInt16(5), reader.GetBoolean(6), reader.GetBoolean(7), reader.GetBoolean(8), reader.GetBoolean(9));
zoneList.Add(zone.actorId, zone);
count++;
}
}
}
catch (MySqlException e)
{ Console.WriteLine(e); }
finally
{
conn.Dispose();
}
}
Log.info(String.Format("Loaded {0} zones.", count));
}
}
}