mirror of
				https://bitbucket.org/Ioncannon/project-meteor-server.git
				synced 2025-05-20 08:26:59 -04:00 
			
		
		
		
	Implementing zone settings from DB.
This commit is contained in:
		| @@ -13,12 +13,14 @@ using FFXIVClassic_Map_Server.utils; | ||||
| using FFXIVClassic_Lobby_Server.packets; | ||||
| using FFXIVClassic_Map_Server.packets.send.player; | ||||
| using FFXIVClassic_Lobby_Server.dataobjects; | ||||
| using FFXIVClassic_Map_Server; | ||||
|  | ||||
| namespace FFXIVClassic_Lobby_Server | ||||
| { | ||||
|  | ||||
|     class Database | ||||
|     { | ||||
|  | ||||
|         public static uint getUserIdFromSession(String sessionId) | ||||
|         { | ||||
|             uint id = 0; | ||||
| @@ -540,5 +542,51 @@ namespace FFXIVClassic_Lobby_Server | ||||
|             return cheevosPacket.buildPacket(player.actorId); | ||||
|         } | ||||
|  | ||||
|         public static List<Zone> loadZones() | ||||
|         { | ||||
|             List<Zone> zones = new List<Zone>(); | ||||
|             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(); | ||||
|  | ||||
|                     //Load Last 5 Completed | ||||
|                     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)); | ||||
|                             zones.Add(zone); | ||||
|                         } | ||||
|                     } | ||||
|                 } | ||||
|                 catch (MySqlException e) | ||||
|                 { Console.WriteLine(e); } | ||||
|                 finally | ||||
|                 { | ||||
|                     conn.Dispose(); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return zones; | ||||
|         } | ||||
|  | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -49,13 +49,15 @@ namespace FFXIVClassic_Lobby_Server | ||||
|  | ||||
|         DebugProg debug = new DebugProg(); | ||||
|         WorldMaster worldMaster = new WorldMaster(); | ||||
|         Zone inn = new Zone(0xF4, "prv0Inn01", 0xD1, false, false, false, false); | ||||
|  | ||||
|         List<Zone> zoneList; | ||||
|  | ||||
|         public PacketProcessor(Dictionary<uint, ConnectedPlayer> playerList, List<ClientConnection> connectionList) | ||||
|         { | ||||
|             mPlayers = playerList; | ||||
|             mConnections = connectionList; | ||||
|            // initNpcs(); | ||||
|  | ||||
|             zoneList = Database.loadZones(); | ||||
|         }      | ||||
|  | ||||
|         public void processPacket(ClientConnection client, BasePacket packet) | ||||
|   | ||||
| @@ -25,7 +25,8 @@ namespace FFXIVClassic_Map_Server | ||||
|         private int halfWidth, halfHeight; | ||||
|         private List<Actor>[,] actorBlock; | ||||
|  | ||||
|         public Zone(uint id, string zoneName, ushort regionId, bool canStealth, bool isInn, bool canRideChocobo, bool isInstanceRaid) : base(id) | ||||
|         public Zone(uint id, string zoneName, ushort regionId, ushort bgmDay, ushort bgmNight, ushort bgmBattle, bool canStealth, bool isInn, bool canRideChocobo, bool isInstanceRaid) | ||||
|             : base(id) | ||||
|         { | ||||
|  | ||||
|             this.zoneName = zoneName; | ||||
| @@ -35,6 +36,10 @@ namespace FFXIVClassic_Map_Server | ||||
|             this.canRideChocobo = canRideChocobo; | ||||
|             this.isInstanceRaid = isInstanceRaid; | ||||
|  | ||||
|             this.bgmDay = bgmDay; | ||||
|             this.bgmNight = bgmNight; | ||||
|             this.bgmBattle = bgmBattle; | ||||
|  | ||||
|             this.displayNameId = 0; | ||||
|             this.customDisplayName = "_areaMaster"; | ||||
|             this.actorName = String.Format("_areaMaster@{0:X5}",id<<8); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user