From 0c3f6cc9c47e3b86e6ae1a382575aeb56fbcde40 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Wed, 8 Mar 2017 09:12:14 -0500 Subject: [PATCH] Fixed bug with old "findActor" code since private areas were added. Add scripts for npcs in echo during limsa opening. --- FFXIVClassic Map Server/WorldManager.cs | 48 +++++++++---------- .../actors/chara/player/Player.cs | 7 +++ .../FFXIVClassic World Server.csproj | 3 +- .../PopulaceStandard/crapulous_adventurer.lua | 13 +++++ .../PopulaceStandard/debonair_pirate.lua | 13 +++++ .../PopulaceStandard/duplicitous_trader.lua | 13 +++++ .../PopulaceStandard/man0l1_baderon.lua | 2 +- .../PopulaceStandard/mytesyn.lua | 13 +++++ .../onyx-haired_adventurer.lua | 13 +++++ .../PopulaceStandard/relaxing_adventurer.lua | 13 +++++ .../PopulaceStandard/skittish_adventurer.lua | 13 +++++ .../PopulaceStandard/yshtola.lua | 13 +++++ .../PopulaceStandard/PrivateAreaPastExit.lua | 12 +++++ 13 files changed, 149 insertions(+), 27 deletions(-) create mode 100644 data/scripts/unique/sea0Town01/PrivateArea/PrivateAreaMasterPast/PopulaceStandard/crapulous_adventurer.lua create mode 100644 data/scripts/unique/sea0Town01/PrivateArea/PrivateAreaMasterPast/PopulaceStandard/debonair_pirate.lua create mode 100644 data/scripts/unique/sea0Town01/PrivateArea/PrivateAreaMasterPast/PopulaceStandard/duplicitous_trader.lua create mode 100644 data/scripts/unique/sea0Town01/PrivateArea/PrivateAreaMasterPast/PopulaceStandard/mytesyn.lua create mode 100644 data/scripts/unique/sea0Town01/PrivateArea/PrivateAreaMasterPast/PopulaceStandard/onyx-haired_adventurer.lua create mode 100644 data/scripts/unique/sea0Town01/PrivateArea/PrivateAreaMasterPast/PopulaceStandard/relaxing_adventurer.lua create mode 100644 data/scripts/unique/sea0Town01/PrivateArea/PrivateAreaMasterPast/PopulaceStandard/skittish_adventurer.lua create mode 100644 data/scripts/unique/sea0Town01/PrivateArea/PrivateAreaMasterPast/PopulaceStandard/yshtola.lua create mode 100644 data/scripts/unique/sea0Town01a/PrivateArea/PrivateAreaMasterPast/PopulaceStandard/PrivateAreaPastExit.lua diff --git a/FFXIVClassic Map Server/WorldManager.cs b/FFXIVClassic Map Server/WorldManager.cs index 06272490..2a1951d6 100644 --- a/FFXIVClassic Map Server/WorldManager.cs +++ b/FFXIVClassic Map Server/WorldManager.cs @@ -581,7 +581,7 @@ namespace FFXIVClassic_Map_Server newArea.AddActorToZone(player); //Update player actor's properties - player.zoneId = newArea.actorId; + player.zoneId = newArea is PrivateArea ? ((PrivateArea)newArea).GetParentZone().actorId : newArea.actorId; player.privateArea = newArea is PrivateArea ? ((PrivateArea)newArea).GetPrivateAreaName() : null; player.privateAreaType = newArea is PrivateArea ? ((PrivateArea)newArea).GetPrivateAreaType() : 0; @@ -649,16 +649,20 @@ namespace FFXIVClassic_Map_Server public void DoZoneIn(Player player, bool isLogin, ushort spawnType) { //Add player to new zone and update - Zone zone = GetZone(player.zoneId); + Area playerArea; + if (player.privateArea != null) + playerArea = GetPrivateArea(player.zoneId, player.privateArea, player.privateAreaType); + else + playerArea = GetZone(player.zoneId); //This server does not contain that zoneId - if (zone == null) + if (playerArea == null) return; //Set the current zone and add player - player.zone = zone; - - zone.AddActorToZone(player); + player.zone = playerArea; + + playerArea.AddActorToZone(player); //Send packets if (!isLogin) @@ -832,14 +836,19 @@ namespace FFXIVClassic_Map_Server } public Player GetPCInWorld(string name) - { - foreach (Zone zone in zoneList.Values) - { - Player p = zone.FindPCInZone(name); - if (p != null) - return p; - } - return null; + { + if (Server.GetServer().GetSession(name) != null) + return Server.GetServer().GetSession(name).GetActor(); + else + return null; + } + + public Player GetPCInWorld(uint charId) + { + if (Server.GetServer().GetSession(charId) != null) + return Server.GetServer().GetSession(charId).GetActor(); + else + return null; } public Actor GetActorInWorld(uint charId) @@ -864,17 +873,6 @@ namespace FFXIVClassic_Map_Server return null; } - public Player GetPCInWorld(uint charId) - { - foreach (Zone zone in zoneList.Values) - { - Player p = zone.FindPCInZone(charId); - if (p != null) - return p; - } - return null; - } - public Zone GetZone(uint zoneId) { if (!zoneList.ContainsKey(zoneId)) diff --git a/FFXIVClassic Map Server/actors/chara/player/Player.cs b/FFXIVClassic Map Server/actors/chara/player/Player.cs index 26b17698..e89b79c0 100644 --- a/FFXIVClassic Map Server/actors/chara/player/Player.cs +++ b/FFXIVClassic Map Server/actors/chara/player/Player.cs @@ -627,6 +627,13 @@ namespace FFXIVClassic_Map_Server.Actors } } + public void ChangeAnimation(uint animId) + { + Actor a = zone.FindActorInZone(currentTarget); + if (a is Npc) + ((Npc)a).animationId = animId; + } + public void SetDCFlag(bool flag) { if (flag) diff --git a/FFXIVClassic World Server/FFXIVClassic World Server.csproj b/FFXIVClassic World Server/FFXIVClassic World Server.csproj index 4710093f..995f8ba5 100644 --- a/FFXIVClassic World Server/FFXIVClassic World Server.csproj +++ b/FFXIVClassic World Server/FFXIVClassic World Server.csproj @@ -190,7 +190,8 @@ - xcopy "$(SolutionDir)data\world_config.ini" "$(SolutionDir)$(ProjectName)\$(OutDir)" /d + +