Seamless boundries added to DB and loaded by WorldManger.

This commit is contained in:
Filip Maj 2016-07-31 22:30:54 -04:00
parent b43a6885c5
commit 8eb257aba4
3 changed files with 110 additions and 0 deletions

View File

@ -83,6 +83,7 @@ namespace FFXIVClassic_Map_Server
mWorldManager = new WorldManager(this); mWorldManager = new WorldManager(this);
mWorldManager.LoadZoneList(); mWorldManager.LoadZoneList();
mWorldManager.LoadZoneEntranceList(); mWorldManager.LoadZoneEntranceList();
mWorldManager.LoadSeamlessBoundryList();
mWorldManager.LoadActorClasses(); mWorldManager.LoadActorClasses();
mWorldManager.LoadSpawnLocations(); mWorldManager.LoadSpawnLocations();
mWorldManager.SpawnAllActors(); mWorldManager.SpawnAllActors();

View File

@ -24,6 +24,7 @@ namespace FFXIVClassic_Map_Server
private DebugProg debug = new DebugProg(); private DebugProg debug = new DebugProg();
private WorldMaster worldMaster = new WorldMaster(); private WorldMaster worldMaster = new WorldMaster();
private Dictionary<uint, Zone> zoneList; private Dictionary<uint, Zone> zoneList;
private Dictionary<uint, List<SeamlessBoundry>> seamlessBoundryList;
private Dictionary<uint, ZoneEntrance> zoneEntranceList; private Dictionary<uint, ZoneEntrance> zoneEntranceList;
private Dictionary<uint, ActorClass> actorClasses = new Dictionary<uint,ActorClass>(); private Dictionary<uint, ActorClass> actorClasses = new Dictionary<uint,ActorClass>();
@ -184,6 +185,67 @@ namespace FFXIVClassic_Map_Server
Program.Log.Info(String.Format("Loaded {0} zone spawn locations.", count)); Program.Log.Info(String.Format("Loaded {0} zone spawn locations.", count));
} }
public void LoadSeamlessBoundryList()
{
seamlessBoundryList = new Dictionary<uint, List<SeamlessBoundry>();
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<SeamlessBoundry>());
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() public void LoadActorClasses()
{ {
int count = 0; int count = 0;
@ -371,6 +433,17 @@ namespace FFXIVClassic_Map_Server
LuaEngine.OnZoneIn(player); 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 //Moves actor to new zone, and sends packets to spawn at the given zone entrance
public void DoZoneChange(Player player, uint zoneEntrance) public void DoZoneChange(Player player, uint zoneEntrance)
{ {

View File

@ -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;
}
}
}