mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-07-20 17:45:57 +02:00
Added a "silent" option for LuaEngine calls. More content instance work. Full classpath now used for zones.
This commit is contained in:
parent
cc44d6b63c
commit
8c9ecebae6
15 changed files with 313 additions and 136 deletions
|
@ -45,8 +45,8 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
protected List<Actor>[,] mActorBlock;
|
||||
|
||||
LuaScript areaScript;
|
||||
|
||||
public Area(uint id, string zoneName, ushort regionId, string className, ushort bgmDay, ushort bgmNight, ushort bgmBattle, bool isIsolated, bool isInn, bool canRideChocobo, bool canStealth, bool isInstanceRaid)
|
||||
|
||||
public Area(uint id, string zoneName, ushort regionId, string classPath, ushort bgmDay, ushort bgmNight, ushort bgmBattle, bool isIsolated, bool isInn, bool canRideChocobo, bool canStealth, bool isInstanceRaid)
|
||||
: base(id)
|
||||
{
|
||||
|
||||
|
@ -66,7 +66,8 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
this.customDisplayName = "_areaMaster";
|
||||
this.actorName = String.Format("_areaMaster@{0:X5}",id<<8);
|
||||
|
||||
this.className = className;
|
||||
this.classPath = classPath;
|
||||
this.className = classPath.Substring(classPath.LastIndexOf("/") + 1);
|
||||
|
||||
numXBlocks = (maxX - minX) / boundingGridSize;
|
||||
numYBlocks = (maxY - minY) / boundingGridSize;
|
||||
|
|
|
@ -17,8 +17,8 @@ namespace FFXIVClassic_Map_Server.actors.area
|
|||
private string privateAreaName;
|
||||
private uint privateAreaType;
|
||||
|
||||
public PrivateArea(Zone parent, uint id, string className, string privateAreaName, uint privateAreaType, ushort bgmDay, ushort bgmNight, ushort bgmBattle)
|
||||
: base(id, parent.zoneName, parent.regionId, className, bgmDay, bgmNight, bgmBattle, parent.isIsolated, parent.isInn, parent.canRideChocobo, parent.canStealth, true)
|
||||
public PrivateArea(Zone parent, uint id, string classPath, string privateAreaName, uint privateAreaType, ushort bgmDay, ushort bgmNight, ushort bgmBattle)
|
||||
: base(id, parent.zoneName, parent.regionId, classPath, bgmDay, bgmNight, bgmBattle, parent.isIsolated, parent.isInn, parent.canRideChocobo, parent.canStealth, true)
|
||||
{
|
||||
this.parentZone = parent;
|
||||
this.zoneName = parent.zoneName;
|
||||
|
@ -49,7 +49,7 @@ namespace FFXIVClassic_Map_Server.actors.area
|
|||
|
||||
string realClassName = className.Substring(className.LastIndexOf("/") + 1);
|
||||
|
||||
lParams = LuaUtils.CreateLuaParamList("/Area/PrivateArea" + path, false, true, zoneName, privateAreaName, privateAreaType, canRideChocobo ? (byte)1 : (byte)0, canStealth, isInn, false, false, false, false, false, false);
|
||||
lParams = LuaUtils.CreateLuaParamList(classPath, false, true, zoneName, privateAreaName, privateAreaType, canRideChocobo ? (byte)1 : (byte)0, canStealth, isInn, false, false, false, false, false, false);
|
||||
ActorInstantiatePacket.BuildPacket(actorId, playerActorId, actorName, realClassName, lParams).DebugPrintSubPacket();
|
||||
return ActorInstantiatePacket.BuildPacket(actorId, playerActorId, actorName, realClassName, lParams);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
using System;
|
||||
using FFXIVClassic_Map_Server.actors.director;
|
||||
using FFXIVClassic_Map_Server.actors.group;
|
||||
using FFXIVClassic_Map_Server.Actors;
|
||||
using FFXIVClassic_Map_Server.lua;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
@ -6,11 +10,55 @@ using System.Threading.Tasks;
|
|||
|
||||
namespace FFXIVClassic_Map_Server.actors.area
|
||||
{
|
||||
|
||||
class PrivateAreaContent : PrivateArea
|
||||
{
|
||||
public PrivateAreaContent(Zone parent, uint id, string className, string privateAreaName, uint privateAreaType)
|
||||
: base(parent, id, className, privateAreaName, privateAreaType, 0, 0, 0)
|
||||
{
|
||||
private Director currentDirector;
|
||||
private ContentGroup currentContentGroup;
|
||||
private bool isContentFinished = false;
|
||||
|
||||
public static PrivateAreaContent CreateContentArea(String scriptPath)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public PrivateAreaContent(Zone parent, string classPath, string privateAreaName, uint privateAreaType, Director director, Player contentStarter) //TODO: Make it a list
|
||||
: base(parent, parent.actorId, classPath, privateAreaName, privateAreaType, 0, 0, 0)
|
||||
{
|
||||
currentDirector = director;
|
||||
currentContentGroup = Server.GetWorldManager().CreateContentGroup(director);
|
||||
LuaEngine.GetInstance().CallLuaFunction(contentStarter, this, "onCreate", false, currentContentGroup, currentDirector);
|
||||
}
|
||||
|
||||
public Director GetContentDirector()
|
||||
{
|
||||
return currentDirector;
|
||||
}
|
||||
|
||||
public ContentGroup GetContentGroup()
|
||||
{
|
||||
return currentContentGroup;
|
||||
}
|
||||
|
||||
public void ContentFinished()
|
||||
{
|
||||
isContentFinished = true;
|
||||
}
|
||||
|
||||
public void CheckDestroy()
|
||||
{
|
||||
if (isContentFinished)
|
||||
{
|
||||
bool noPlayersLeft = true;
|
||||
foreach (Actor a in mActorList.Values)
|
||||
{
|
||||
if (a is Player)
|
||||
noPlayersLeft = false;
|
||||
}
|
||||
if (noPlayersLeft)
|
||||
GetParentZone().DeleteContentArea(this);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using FFXIVClassic_Map_Server.actors.director;
|
||||
|
||||
namespace FFXIVClassic_Map_Server.actors.area
|
||||
{
|
||||
|
@ -17,9 +18,10 @@ namespace FFXIVClassic_Map_Server.actors.area
|
|||
{
|
||||
Dictionary<string, Dictionary<uint, PrivateArea>> privateAreas = new Dictionary<string, Dictionary<uint, PrivateArea>>();
|
||||
Dictionary<string, List<PrivateAreaContent>> contentAreas = new Dictionary<string, List<PrivateAreaContent>>();
|
||||
Object contentAreasLock = new Object();
|
||||
|
||||
public Zone(uint id, string zoneName, ushort regionId, string className, ushort bgmDay, ushort bgmNight, ushort bgmBattle, bool isIsolated, bool isInn, bool canRideChocobo, bool canStealth, bool isInstanceRaid)
|
||||
: base(id, zoneName, regionId, className, bgmDay, bgmNight, bgmBattle, isIsolated, isInn, canRideChocobo, canStealth, isInstanceRaid)
|
||||
public Zone(uint id, string zoneName, ushort regionId, string classPath, ushort bgmDay, ushort bgmNight, ushort bgmBattle, bool isIsolated, bool isInn, bool canRideChocobo, bool canStealth, bool isInstanceRaid)
|
||||
: base(id, zoneName, regionId, classPath, bgmDay, bgmNight, bgmBattle, isIsolated, isInn, canRideChocobo, canStealth, isInstanceRaid)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -54,7 +56,7 @@ namespace FFXIVClassic_Map_Server.actors.area
|
|||
bool isEntranceDesion = false;
|
||||
|
||||
List<LuaParam> lParams;
|
||||
lParams = LuaUtils.CreateLuaParamList("/Area/Zone/" + className, false, true, zoneName, "", -1, canRideChocobo ? (byte)1 : (byte)0, canStealth, isInn, false, false, false, true, isInstanceRaid, isEntranceDesion);
|
||||
lParams = LuaUtils.CreateLuaParamList(classPath, false, true, zoneName, "", -1, canRideChocobo ? (byte)1 : (byte)0, canStealth, isInn, false, false, false, true, isInstanceRaid, isEntranceDesion);
|
||||
return ActorInstantiatePacket.BuildPacket(actorId, playerActorId, actorName, className, lParams);
|
||||
}
|
||||
|
||||
|
@ -112,9 +114,30 @@ namespace FFXIVClassic_Map_Server.actors.area
|
|||
return mActorList[id];
|
||||
}
|
||||
|
||||
public void CreateContentArea()
|
||||
public PrivateAreaContent CreateContentArea(Player starterPlayer, string areaClassPath, string contentScript, string areaName, string directorName)
|
||||
{
|
||||
lock (contentAreasLock)
|
||||
{
|
||||
Director director = CreateDirector(directorName);
|
||||
|
||||
if (director == null)
|
||||
return null;
|
||||
|
||||
if (!contentAreas.ContainsKey(areaName))
|
||||
contentAreas.Add(areaName, new List<PrivateAreaContent>());
|
||||
PrivateAreaContent contentArea = new PrivateAreaContent(this, classPath, areaName, 1, director, starterPlayer);
|
||||
contentAreas[areaName].Add(contentArea);
|
||||
return contentArea;
|
||||
}
|
||||
}
|
||||
|
||||
public void DeleteContentArea(PrivateAreaContent area)
|
||||
{
|
||||
if (contentAreas.ContainsKey(area.GetPrivateAreaName()))
|
||||
{
|
||||
contentAreas[area.GetPrivateAreaName()].Remove(area);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,6 +54,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
public CharaWork charaWork = new CharaWork();
|
||||
|
||||
public Group currentParty = null;
|
||||
public ContentGroup currentContentGroup = null;
|
||||
|
||||
public Character(uint actorID) : base(actorID)
|
||||
{
|
||||
|
@ -88,9 +89,14 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
player.QueuePacket(SetActorQuestGraphicPacket.BuildPacket(player.actorId, actorId, graphicNum));
|
||||
}
|
||||
|
||||
public void SetCurrentContentGroup(uint groupType, Player player = null)
|
||||
public void SetCurrentContentGroup(ContentGroup group, Player player = null)
|
||||
{
|
||||
charaWork.currentContentGroup = groupType;
|
||||
if (group != null)
|
||||
charaWork.currentContentGroup = group.GetTypeId();
|
||||
else
|
||||
charaWork.currentContentGroup = 0;
|
||||
|
||||
currentContentGroup = group;
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
|
|
|
@ -83,7 +83,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
List<LuaParam> lParams;
|
||||
|
||||
Player player = Server.GetWorldManager().GetPCInWorld(playerActorId);
|
||||
lParams = LuaEngine.GetInstance().CallLuaFunctionForReturn(player, this, "init");
|
||||
lParams = LuaEngine.GetInstance().CallLuaFunctionForReturn(player, this, "init", false);
|
||||
|
||||
if (uniqueIdentifier.Equals("1"))
|
||||
{
|
||||
|
@ -381,12 +381,12 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
|
||||
public void DoOnActorSpawn(Player player)
|
||||
{
|
||||
LuaEngine.GetInstance().CallLuaFunction(player, this, "onSpawn");
|
||||
LuaEngine.GetInstance().CallLuaFunction(player, this, "onSpawn", true);
|
||||
}
|
||||
|
||||
public void Update(double deltaTime)
|
||||
{
|
||||
LuaEngine.GetInstance().CallLuaFunction(null, this, "onUpdate", deltaTime);
|
||||
LuaEngine.GetInstance().CallLuaFunction(null, this, "onUpdate", true, deltaTime);
|
||||
}
|
||||
|
||||
//A party member list packet came, set the party
|
||||
|
|
|
@ -552,7 +552,10 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
director.GetSpawnPackets(actorId).DebugPrintPacket();
|
||||
QueuePacket(director.GetSpawnPackets(actorId));
|
||||
QueuePacket(director.GetInitPackets(actorId));
|
||||
}
|
||||
}
|
||||
|
||||
if (currentContentGroup != null)
|
||||
currentContentGroup.SendGroupPackets(playerSession);
|
||||
|
||||
}
|
||||
|
||||
|
@ -1526,7 +1529,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
|
||||
public void Update(double delta)
|
||||
{
|
||||
LuaEngine.GetInstance().CallLuaFunction(this, this, "OnUpdate", delta);
|
||||
LuaEngine.GetInstance().CallLuaFunction(this, this, "OnUpdate", true, delta);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -70,17 +70,17 @@ namespace FFXIVClassic_Map_Server.actors.director
|
|||
|
||||
public void OnTalkEvent(Player player, Npc npc)
|
||||
{
|
||||
LuaEngine.GetInstance().CallLuaFunction(player, this, "onTalkEvent", npc);
|
||||
LuaEngine.GetInstance().CallLuaFunction(player, this, "onTalkEvent", false, npc);
|
||||
}
|
||||
|
||||
public void OnCommandEvent(Player player, Command command)
|
||||
{
|
||||
LuaEngine.GetInstance().CallLuaFunction(player, this, "onCommandEvent", command);
|
||||
LuaEngine.GetInstance().CallLuaFunction(player, this, "onCommandEvent", false, command);
|
||||
}
|
||||
|
||||
public void DoActorInit(string directorPath)
|
||||
{
|
||||
List<LuaParam> lparams = LuaEngine.GetInstance().CallLuaFunctionForReturn(null, this, "init");
|
||||
List<LuaParam> lparams = LuaEngine.GetInstance().CallLuaFunctionForReturn(null, this, "init", false);
|
||||
|
||||
if (lparams.Count == 1 && lparams[0].value is string)
|
||||
{
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace FFXIVClassic_Map_Server.actors.group
|
|||
members.Add(actor.actorId);
|
||||
if (actor is Character)
|
||||
{
|
||||
((Character)actor).SetCurrentContentGroup(GetTypeId());
|
||||
((Character)actor).SetCurrentContentGroup(this);
|
||||
SendCurrentContentSync(actor);
|
||||
}
|
||||
SendGroupPacketsAll(members);
|
||||
|
@ -50,16 +50,17 @@ namespace FFXIVClassic_Map_Server.actors.group
|
|||
{
|
||||
members.Remove(memberId);
|
||||
SendGroupPacketsAll(members);
|
||||
CheckDestroy();
|
||||
}
|
||||
|
||||
public override List<GroupMember> BuildMemberList(uint id)
|
||||
{
|
||||
List<GroupMember> groupMembers = new List<GroupMember>();
|
||||
groupMembers.Add(new GroupMember(id, -1, 0, false, true, Server.GetWorldManager().GetActorInWorld(id).customDisplayName));
|
||||
groupMembers.Add(new GroupMember(id, -1, 0, false, true, ""));
|
||||
foreach (uint charaId in members)
|
||||
{
|
||||
if (charaId != id)
|
||||
groupMembers.Add(new GroupMember(charaId, -1, 0, false, true, Server.GetWorldManager().GetActorInWorld(charaId).customDisplayName));
|
||||
groupMembers.Add(new GroupMember(charaId, -1, 0, false, true, ""));
|
||||
}
|
||||
return groupMembers;
|
||||
}
|
||||
|
@ -139,5 +140,23 @@ namespace FFXIVClassic_Map_Server.actors.group
|
|||
SendDeletePackets(members);
|
||||
}
|
||||
|
||||
|
||||
public void CheckDestroy()
|
||||
{
|
||||
bool foundSession = false;
|
||||
foreach (uint memberId in members)
|
||||
{
|
||||
Session session = Server.GetServer().GetSession(memberId);
|
||||
if (session != null)
|
||||
{
|
||||
foundSession = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!foundSession)
|
||||
Server.GetWorldManager().DeleteContentGroup(groupIndex);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -127,7 +127,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
|
||||
public void DoCompletionCheck()
|
||||
{
|
||||
List<LuaParam> returned = LuaEngine.GetInstance().CallLuaFunctionForReturn(owner, this, "isObjectivesComplete");
|
||||
List<LuaParam> returned = LuaEngine.GetInstance().CallLuaFunctionForReturn(owner, this, "isObjectivesComplete", true);
|
||||
if (returned != null && returned.Count >= 1 && returned[0].typeID == 3)
|
||||
{
|
||||
owner.SendDataPacket("attention", Server.GetWorldManager().GetActor(), "", 25225, (object)GetQuestId());
|
||||
|
@ -137,7 +137,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
|
||||
public void DoAbandon()
|
||||
{
|
||||
LuaEngine.GetInstance().CallLuaFunctionForReturn(owner, this, "onAbandonQuest");
|
||||
LuaEngine.GetInstance().CallLuaFunctionForReturn(owner, this, "onAbandonQuest", true);
|
||||
owner.SendGameMessage(owner, Server.GetWorldManager().GetActor(), 25236, 0x20, (object)GetQuestId());
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue