diff --git a/FFXIVClassic Map Server/Server.cs b/FFXIVClassic Map Server/Server.cs index e7f1f1be..6b6779dd 100644 --- a/FFXIVClassic Map Server/Server.cs +++ b/FFXIVClassic Map Server/Server.cs @@ -83,6 +83,7 @@ namespace FFXIVClassic_Map_Server mWorldManager = new WorldManager(this); mWorldManager.LoadZoneList(); mWorldManager.LoadZoneEntranceList(); + mWorldManager.LoadSeamlessBoundryList(); mWorldManager.LoadActorClasses(); mWorldManager.LoadSpawnLocations(); mWorldManager.SpawnAllActors(); diff --git a/FFXIVClassic Map Server/WorldManager.cs b/FFXIVClassic Map Server/WorldManager.cs index 5d2a4987..14982909 100644 --- a/FFXIVClassic Map Server/WorldManager.cs +++ b/FFXIVClassic Map Server/WorldManager.cs @@ -24,6 +24,7 @@ namespace FFXIVClassic_Map_Server private DebugProg debug = new DebugProg(); private WorldMaster worldMaster = new WorldMaster(); private Dictionary zoneList; + private Dictionary> seamlessBoundryList; private Dictionary zoneEntranceList; private Dictionary actorClasses = new Dictionary(); @@ -184,6 +185,67 @@ namespace FFXIVClassic_Map_Server Program.Log.Info(String.Format("Loaded {0} zone spawn locations.", count)); } + public void LoadSeamlessBoundryList() + { + seamlessBoundryList = new Dictionary(); + 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 + * + FROM server_seamless_zonechange_bounds"; + + MySqlCommand cmd = new MySqlCommand(query, conn); + + using (MySqlDataReader reader = cmd.ExecuteReader()) + { + while (reader.Read()) + { + uint id = reader.GetUInt32("id"); + uint regionId = reader.GetUInt32("regionId"); + uint zoneId1 = reader.GetUInt32("zoneId1"); + uint zoneId2 = reader.GetUInt32("zoneId2"); + + float z1_x1 = reader.GetFloat("zone1_boundingbox_x1"); + float z1_y1 = reader.GetFloat("zone1_boundingbox_y1"); + float z1_x2 = reader.GetFloat("zone1_boundingbox_x2"); + float z1_y2 = reader.GetFloat("zone1_boundingbox_y2"); + + float z2_x1 = reader.GetFloat("zone2_boundingbox_x1"); + float z2_y1 = reader.GetFloat("zone2_boundingbox_y1"); + float z2_x2 = reader.GetFloat("zone2_boundingbox_x2"); + float z2_y2 = reader.GetFloat("zone2_boundingbox_y2"); + + float m_x1 = reader.GetFloat("merge_boundingbox_x1"); + float m_y1 = reader.GetFloat("merge_boundingbox_y1"); + float m_x2 = reader.GetFloat("merge_boundingbox_x2"); + float m_y2 = reader.GetFloat("merge_boundingbox_y2"); + + if (!seamlessBoundryList.ContainsKey(regionId)) + seamlessBoundryList.Add(regionId, new List()); + + seamlessBoundryList[regionId].Add(new SeamlessBoundry(regionId, zoneId1, zoneId2, z1_x1, z1_y1, z1_x2, z1_y2, z2_x1, z2_y1, z2_x2, z2_y2, m_x1, m_y1, m_x2, m_y2)); + + count++; + } + } + } + catch (MySqlException e) + { Console.WriteLine(e); } + finally + { + conn.Dispose(); + } + } + + Program.Log.Info(String.Format("Loaded {0} region seamless boundries.", count)); + } + public void LoadActorClasses() { int count = 0; @@ -371,6 +433,17 @@ namespace FFXIVClassic_Map_Server LuaEngine.OnZoneIn(player); } + //Checks all seamless bounding boxes in region to see if player needs to merge or zonechange + public void SeamlessCheck(Player player) + { + if (player.zone == null) + return; + + uint regionId = player.zone.regionId; + + + } + //Moves actor to new zone, and sends packets to spawn at the given zone entrance public void DoZoneChange(Player player, uint zoneEntrance) { diff --git a/FFXIVClassic Map Server/dataobjects/SeamlessBoundry.cs b/FFXIVClassic Map Server/dataobjects/SeamlessBoundry.cs new file mode 100644 index 00000000..9e78f1eb --- /dev/null +++ b/FFXIVClassic Map Server/dataobjects/SeamlessBoundry.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FFXIVClassic_Map_Server.dataobjects +{ + class SeamlessBoundry + { + public readonly uint regionId; + public readonly uint zoneId1, zoneId2; + public readonly float zone1_x1, zone1_y1, zone1_x2, zone1_y2; + public readonly float zone2_x1, zone2_y1, zone2_x2, zone2_y2; + public readonly float merge_x1, merge_y1, merge_x2, merge_y2; + + public SeamlessBoundry(uint regionId, uint zoneId1, uint zoneId2, float zone1_x1, float zone1_y1, float zone1_x2, float zone1_y2, float zone2_x1, float zone2_y1, float zone2_x2, float zone2_y2, float merge_x1, float merge_y1, float merge_x2, float merge_y2) + { + this.regionId = regionId; + this.zoneId1 = zoneId1; + this.zoneId2 = zoneId2; + this.zone1_x1 = zone1_x1; + this.zone1_y1= zone1_y1; + this.zone1_x2 = zone1_x2; + this.zone1_y2 = zone1_y2; + this.zone2_x1 = zone2_x1; + this.zone2_y1 = zone2_y1; + this.zone2_x2 = zone2_x2; + this.zone2_y2 = zone2_y2; + this.merge_x1 = merge_x1; + this.merge_y1 = merge_y1; + this.merge_x2 = merge_x2; + this.merge_y2 = merge_y2; + } + } +}