Added property flags for actors. Cleaned up NPC constructor.

This commit is contained in:
Filip Maj 2016-07-24 10:21:45 -04:00
parent 4ef62a16ec
commit 2939683183
6 changed files with 60 additions and 17 deletions

View file

@ -277,6 +277,7 @@
<None Include="App.config" />
<Content Include="NLog.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<SubType>Designer</SubType>
</Content>
<None Include="NLog.xsd">
<SubType>Designer</SubType>

View file

@ -198,6 +198,7 @@ namespace FFXIVClassic_Map_Server
id,
classPath,
displayNameId,
propertyFlags,
eventConditions
FROM gamedata_actor_class
WHERE classPath <> ''
@ -213,13 +214,15 @@ namespace FFXIVClassic_Map_Server
string classPath = reader.GetString("classPath");
uint nameId = reader.GetUInt32("displayNameId");
string eventConditions = null;
if (!reader.IsDBNull(3))
uint propertyFlags = reader.GetUInt32("propertyFlags");
if (!reader.IsDBNull(4))
eventConditions = reader.GetString("eventConditions");
else
eventConditions = "{}";
ActorClass actorClass = new ActorClass(id, classPath, nameId, eventConditions);
ActorClass actorClass = new ActorClass(id, classPath, nameId, propertyFlags, eventConditions);
actorClasses.Add(id, actorClass);
count++;
}

View file

@ -345,9 +345,9 @@ namespace FFXIVClassic_Map_Server.Actors
ActorClass actorClass = Server.GetWorldManager().GetActorClass(location.classId);
if (actorClass == null)
return;
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);
return;
Npc npc = new Npc(mActorList.Count + 1, actorClass, location.uniqueId, actorId, location.x, location.y, location.z, location.rot, location.state, location.animId, null);
npc.LoadEventConditions(actorClass.eventConditions);
AddActorToZone(npc);

View file

@ -11,13 +11,15 @@ namespace FFXIVClassic_Map_Server.actors.chara.npc
public readonly uint actorClassId;
public readonly string classPath;
public readonly uint displayNameId;
public readonly uint propertyFlags;
public readonly string eventConditions;
public ActorClass(uint id, string classPath, uint nameId, string eventConditions)
public ActorClass(uint id, string classPath, uint nameId, uint propertyFlags, string eventConditions)
{
this.actorClassId = id;
this.classPath = classPath;
this.displayNameId = nameId;
this.propertyFlags = propertyFlags;
this.eventConditions = eventConditions;
}
}

View file

@ -1,5 +1,6 @@
using FFXIVClassic.Common;
using FFXIVClassic_Map_Server.actors;
using FFXIVClassic_Map_Server.actors.chara.npc;
using FFXIVClassic_Map_Server.Actors.Chara;
using FFXIVClassic_Map_Server.dataobjects;
using FFXIVClassic_Map_Server.lua;
@ -26,7 +27,7 @@ namespace FFXIVClassic_Map_Server.Actors
public NpcWork npcWork = new NpcWork();
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)
public Npc(int actorNumber, ActorClass actorClass, string uniqueId, uint zoneId, float posX, float posY, float posZ, float rot, ushort actorState, uint animationId, string customDisplayName)
: base((4 << 28 | zoneId << 19 | (uint)actorNumber))
{
this.positionX = posX;
@ -35,7 +36,7 @@ namespace FFXIVClassic_Map_Server.Actors
this.rotation = rot;
this.animationId = animationId;
this.displayNameId = displayNameId;
this.displayNameId = actorClass.displayNameId;
this.customDisplayName = customDisplayName;
this.uniqueIdentifier = uniqueId;
@ -43,11 +44,11 @@ namespace FFXIVClassic_Map_Server.Actors
this.zoneId = zoneId;
this.zone = Server.GetWorldManager().GetZone(zoneId);
this.actorClassId = classId;
this.actorClassId = actorClass.actorClassId;
LoadNpcAppearance(classId);
LoadNpcAppearance(actorClass.actorClassId);
this.classPath = classPath;
this.classPath = actorClass.classPath;
className = classPath.Substring(classPath.LastIndexOf("/")+1);
charaWork.battleSave.potencial = 1.0f;
@ -58,8 +59,9 @@ namespace FFXIVClassic_Map_Server.Actors
charaWork.parameterSave.hp[0] = 500;
charaWork.parameterSave.hpMax[0] = 500;
charaWork.property[0] = 1;
charaWork.property[1] = 1;
for (int i = 0; i < 32; i++ )
charaWork.property[i] = (byte)(((int)actorClass.propertyFlags >> i) & 1);
if (className.Equals("JellyfishScenarioLimsaLv00"))
{
@ -67,9 +69,6 @@ namespace FFXIVClassic_Map_Server.Actors
npcWork.hateType = 1;
}
charaWork.property[3] = 1;
charaWork.property[4] = 1;
npcWork.pushCommand = 0x271D;
npcWork.pushCommandPriority = 1;