Child scripts now loaded by a uniqueId in the spawn table.

This commit is contained in:
Filip Maj 2016-06-09 22:58:03 -04:00
parent 23b6ede128
commit f0d4429f65
4 changed files with 34 additions and 18 deletions

View File

@ -243,7 +243,8 @@ namespace FFXIVClassic_Map_Server
string query = @"
SELECT
actorClassId,
actorClassId,
uniqueId,
zoneId,
privateAreaName,
privateAreaLevel,
@ -264,10 +265,11 @@ namespace FFXIVClassic_Map_Server
while (reader.Read())
{
string customName = null;
if (!reader.IsDBNull(10))
if (!reader.IsDBNull(11))
customName = reader.GetString("customDisplayName");
uint classId = reader.GetUInt32("actorClassId");
string uniqueId = reader.GetString("uniqueId");
uint zoneId = reader.GetUInt32("zoneId");
string privAreaName = reader.GetString("privateAreaName");
uint privAreaLevel = reader.GetUInt32("privateAreaLevel");
@ -287,7 +289,7 @@ namespace FFXIVClassic_Map_Server
if (zone == null)
continue;
SpawnLocation spawn = new SpawnLocation(classId, zoneId, privAreaName, privAreaLevel, x, y, z, rot, state, animId);
SpawnLocation spawn = new SpawnLocation(classId, uniqueId, zoneId, privAreaName, privAreaLevel, x, y, z, rot, state, animId);
zone.addSpawnLocation(spawn);

View File

@ -346,7 +346,7 @@ namespace FFXIVClassic_Map_Server.Actors
if (actorClass == null)
return;
Npc npc = new Npc(mActorList.Count + 1, actorClass.actorClassId, actorId, location.x, location.y, location.z, location.rot, location.state, location.animId, actorClass.displayNameId, null, actorClass.classPath);
Npc npc = new Npc(mActorList.Count + 1, actorClass.actorClassId, location.uniqueId, actorId, location.x, location.y, location.z, location.rot, location.state, location.animId, actorClass.displayNameId, null, actorClass.classPath);
npc.loadEventConditions(actorClass.eventConditions);
addActorToZone(npc);

View File

@ -9,6 +9,7 @@ namespace FFXIVClassic_Map_Server.actors.area
class SpawnLocation
{
public uint classId;
public string uniqueId;
public uint zoneId;
public string privAreaName;
public uint privAreaLevel;
@ -19,9 +20,10 @@ namespace FFXIVClassic_Map_Server.actors.area
public ushort state;
public uint animId;
public SpawnLocation(uint classId, uint zoneId, string privAreaName, uint privAreaLevel, float x, float y, float z, float rot, ushort state, uint animId)
public SpawnLocation(uint classId, string uniqueId, uint zoneId, string privAreaName, uint privAreaLevel, float x, float y, float z, float rot, ushort state, uint animId)
{
this.classId = classId;
this.uniqueId = uniqueId;
this.zoneId = zoneId;
this.privAreaName = privAreaName;
this.privAreaLevel = privAreaLevel;

View File

@ -22,12 +22,12 @@ namespace FFXIVClassic_Map_Server.Actors
{
class Npc : Character
{
//private Script actorScript;
private uint actorClassId;
private string uniqueIdentifier;
public NpcWork npcWork = new NpcWork();
public Npc(int actorNumber, uint classId, uint zoneId, float posX, float posY, float posZ, float rot, ushort actorState, uint animationId, uint displayNameId, string customDisplayName, string classPath)
public Npc(int actorNumber, uint classId, string uniqueId, uint zoneId, float posX, float posY, float posZ, float rot, ushort actorState, uint animationId, uint displayNameId, string customDisplayName, string classPath)
: base((4 << 28 | zoneId << 19 | (uint)actorNumber))
{
this.positionX = posX;
@ -39,6 +39,8 @@ namespace FFXIVClassic_Map_Server.Actors
this.displayNameId = displayNameId;
this.customDisplayName = customDisplayName;
this.uniqueIdentifier = uniqueId;
this.zoneId = zoneId;
this.zone = Server.GetWorldManager().GetZone(zoneId);
@ -86,13 +88,23 @@ namespace FFXIVClassic_Map_Server.Actors
List<LuaParam> lParams;
Player player = Server.GetWorldManager().GetPCInWorld(playerActorId);
lParams = DoActorInit(player);
lParams = DoActorInit(player);
if (lParams == null)
{
classPath = "/Chara/Npc/Populace/PopulaceStandard";
className = "PopulaceStandard";
lParams = LuaUtils.createLuaParamList(classPath, false, false, false, false, false, 0xF47F6, false, false, 0, 0);
lParams = LuaUtils.createLuaParamList(classPath, false, false, false, false, false, 0xF47F6, false, false, 0, 1, "TEST");
}
else
{
lParams.Insert(0, new LuaParam(2, classPath));
lParams.Insert(1, new LuaParam(4, 4));
lParams.Insert(2, new LuaParam(4, 4));
lParams.Insert(3, new LuaParam(4, 4));
lParams.Insert(4, new LuaParam(4, 4));
lParams.Insert(5, new LuaParam(4, 4));
lParams.Insert(6, new LuaParam(0, (int)actorClassId));
}
ActorInstantiatePacket.buildPacket(actorId, playerActorId, actorName, className, lParams).debugPrintSubPacket();
@ -188,7 +200,7 @@ namespace FFXIVClassic_Map_Server.Actors
hairStyle,
hairHighlightColor,
hairVariation,
faceType,
faceType,
characteristics,
characteristicsColor,
faceEyebrows,
@ -287,8 +299,8 @@ namespace FFXIVClassic_Map_Server.Actors
if (File.Exists("./scripts/base/" + classPath + ".lua"))
parent = LuaEngine.loadScript("./scripts/base/" + classPath + ".lua");
if (File.Exists(String.Format("./scripts/unique/{0}/{1}.{2}.lua", zone.zoneName, className, actorClassId)))
child = LuaEngine.loadScript(String.Format("./scripts/unique/{0}/{1}.{2}.lua", zone.zoneName, className, actorClassId));
if (File.Exists(String.Format("./scripts/unique/{0}/{1}/{2}.lua", zone.zoneName, className, uniqueIdentifier)))
child = LuaEngine.loadScript(String.Format("./scripts/unique/{0}/{1}/{2}.lua", zone.zoneName, className, uniqueIdentifier));
if (parent == null)
{
@ -315,8 +327,8 @@ namespace FFXIVClassic_Map_Server.Actors
if (File.Exists("./scripts/base/" + classPath + ".lua"))
parent = LuaEngine.loadScript("./scripts/base/" + classPath + ".lua");
if (File.Exists(String.Format("./scripts/unique/{0}/{1}.{2}.lua", zone.zoneName, className, actorClassId)))
child = LuaEngine.loadScript(String.Format("./scripts/unique/{0}/{1}.{2}.lua", zone.zoneName, className, actorClassId));
if (File.Exists(String.Format("./scripts/unique/{0}/{1}/{2}.lua", zone.zoneName, className, uniqueIdentifier)))
child = LuaEngine.loadScript(String.Format("./scripts/unique/{0}/{1}/{2}.lua", zone.zoneName, className, uniqueIdentifier));
if (parent == null)
{
@ -351,8 +363,8 @@ namespace FFXIVClassic_Map_Server.Actors
if (File.Exists("./scripts/base/" + classPath + ".lua"))
parent = LuaEngine.loadScript("./scripts/base/" + classPath + ".lua");
if (File.Exists(String.Format("./scripts/unique/{0}/{1}.{2}.lua", zone.zoneName, className, actorClassId)))
child = LuaEngine.loadScript(String.Format("./scripts/unique/{0}/{1}.{2}.lua", zone.zoneName, className, actorClassId));
if (File.Exists(String.Format("./scripts/unique/{0}/{1}/{2}.lua", zone.zoneName, className, uniqueIdentifier)))
child = LuaEngine.loadScript(String.Format("./scripts/unique/{0}/{1}/{2}.lua", zone.zoneName, className, uniqueIdentifier));
if (parent == null)
{
@ -385,8 +397,8 @@ namespace FFXIVClassic_Map_Server.Actors
if (File.Exists("./scripts/base/" + classPath + ".lua"))
parent = LuaEngine.loadScript("./scripts/base/" + classPath + ".lua");
if (File.Exists(String.Format("./scripts/unique/{0}/{1}.{2}.lua", zone.zoneName, className, actorClassId)))
child = LuaEngine.loadScript(String.Format("./scripts/unique/{0}/{1}.{2}.lua", zone.zoneName, className, actorClassId));
if (File.Exists(String.Format("./scripts/unique/{0}/{1}/{2}.lua", zone.zoneName, className, uniqueIdentifier)))
child = LuaEngine.loadScript(String.Format("./scripts/unique/{0}/{1}/{2}.lua", zone.zoneName, className, uniqueIdentifier));
if (parent == null)
{