From 2939683183e69452135b980c50f36dff1b350af9 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Sun, 24 Jul 2016 10:21:45 -0400 Subject: [PATCH] Added property flags for actors. Cleaned up NPC constructor. --- .../FFXIVClassic Map Server.csproj | 1 + FFXIVClassic Map Server/WorldManager.cs | 9 +++-- FFXIVClassic Map Server/actors/area/Area.cs | 6 +-- .../actors/chara/npc/ActorClass.cs | 4 +- .../actors/chara/npc/Npc.cs | 19 +++++----- research/property_hashes.txt | 38 +++++++++++++++++++ 6 files changed, 60 insertions(+), 17 deletions(-) create mode 100644 research/property_hashes.txt diff --git a/FFXIVClassic Map Server/FFXIVClassic Map Server.csproj b/FFXIVClassic Map Server/FFXIVClassic Map Server.csproj index c5c79140..efe480a8 100644 --- a/FFXIVClassic Map Server/FFXIVClassic Map Server.csproj +++ b/FFXIVClassic Map Server/FFXIVClassic Map Server.csproj @@ -277,6 +277,7 @@ Always + Designer Designer diff --git a/FFXIVClassic Map Server/WorldManager.cs b/FFXIVClassic Map Server/WorldManager.cs index f0c87fde..dcc30dcf 100644 --- a/FFXIVClassic Map Server/WorldManager.cs +++ b/FFXIVClassic Map Server/WorldManager.cs @@ -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++; } diff --git a/FFXIVClassic Map Server/actors/area/Area.cs b/FFXIVClassic Map Server/actors/area/Area.cs index 811b9200..f82ff5a2 100644 --- a/FFXIVClassic Map Server/actors/area/Area.cs +++ b/FFXIVClassic Map Server/actors/area/Area.cs @@ -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); diff --git a/FFXIVClassic Map Server/actors/chara/npc/ActorClass.cs b/FFXIVClassic Map Server/actors/chara/npc/ActorClass.cs index 6d3da091..d1cf2108 100644 --- a/FFXIVClassic Map Server/actors/chara/npc/ActorClass.cs +++ b/FFXIVClassic Map Server/actors/chara/npc/ActorClass.cs @@ -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; } } diff --git a/FFXIVClassic Map Server/actors/chara/npc/Npc.cs b/FFXIVClassic Map Server/actors/chara/npc/Npc.cs index 2459cda7..684c687d 100644 --- a/FFXIVClassic Map Server/actors/chara/npc/Npc.cs +++ b/FFXIVClassic Map Server/actors/chara/npc/Npc.cs @@ -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; diff --git a/research/property_hashes.txt b/research/property_hashes.txt new file mode 100644 index 00000000..616f40b8 --- /dev/null +++ b/research/property_hashes.txt @@ -0,0 +1,38 @@ +charaWork.property[0]: E14B0CA8 +charaWork.property[1]: 2138FD71 +charaWork.property[2]: 7B675313 +charaWork.property[3]: 83AF687B +charaWork.property[4]: FBFBCFB1 +charaWork.property[5]: D0528D6D +charaWork.property[6]: FB2031F0 +charaWork.property[7]: FC4FC79E +charaWork.property[8]: ED3BE8EF +charaWork.property[9]: B2E211F9 +charaWork.property[10]: CF333207 +charaWork.property[11]: D2C07981 +charaWork.property[12]: A0304DFD +charaWork.property[13]: C0F3DA5F +charaWork.property[14]: 29A79FF3 +charaWork.property[15]: 51CF95E0 +charaWork.property[16]: 8EAB1D96 +charaWork.property[17]: DD73A95 +charaWork.property[18]: 880CC775 +charaWork.property[19]: 62B8BF8D +charaWork.property[20]: 2EC61BC3 +charaWork.property[21]: 73F6A7F0 +charaWork.property[22]: A3E164C0 +charaWork.property[23]: EA58AAF0 +charaWork.property[24]: 8A9C7FDC +charaWork.property[25]: 8678D367 +charaWork.property[26]: EB129AED +charaWork.property[27]: F7E9CEB6 +charaWork.property[28]: A1CB539F +charaWork.property[29]: 6F821E02 +charaWork.property[30]: 66C0E093 +charaWork.property[31]: A6EDF047 + +AetheryteParent/MiningPoint, 0, 1, +Populace Achievement, 0, 1, 4 +DoorStandard/BgKeepout/Chocobostop/MarketEntrance/ObjectEventDoor/RetainerFurniture, 0 + +