mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-06-10 06:24:38 +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
|
@ -120,9 +120,9 @@ namespace FFXIVClassic_Map_Server
|
|||
LangaugeCodePacket langCode = new LangaugeCodePacket(subpacket.data);
|
||||
session = mServer.AddSession(subpacket.header.targetId);
|
||||
|
||||
LuaEngine.GetInstance().CallLuaFunction(session.GetActor(), session.GetActor(), "onBeginLogin");
|
||||
LuaEngine.GetInstance().CallLuaFunction(session.GetActor(), session.GetActor(), "onBeginLogin", true);
|
||||
Server.GetWorldManager().DoZoneIn(session.GetActor(), true, 0x1);
|
||||
LuaEngine.GetInstance().CallLuaFunction(session.GetActor(), session.GetActor(), "onLogin");
|
||||
LuaEngine.GetInstance().CallLuaFunction(session.GetActor(), session.GetActor(), "onLogin", true);
|
||||
session.languageCode = langCode.languageCode;
|
||||
break;
|
||||
//Unknown - Happens a lot at login, then once every time player zones
|
||||
|
|
|
@ -68,7 +68,7 @@ namespace FFXIVClassic_Map_Server
|
|||
id,
|
||||
zoneName,
|
||||
regionId,
|
||||
className,
|
||||
classPath,
|
||||
dayMusic,
|
||||
nightMusic,
|
||||
battleMusic,
|
||||
|
@ -450,7 +450,7 @@ namespace FFXIVClassic_Map_Server
|
|||
|
||||
player.SendMessage(0x20, "", "Doing Seamless Zone Change");
|
||||
|
||||
LuaEngine.GetInstance().CallLuaFunction(player, newZone, "onZoneIn");
|
||||
LuaEngine.GetInstance().CallLuaFunction(player, newZone, "onZoneIn", true);
|
||||
}
|
||||
|
||||
//Adds a second zone to pull actors from. Used for an improved seamless zone change.
|
||||
|
@ -470,7 +470,7 @@ namespace FFXIVClassic_Map_Server
|
|||
|
||||
player.SendMessage(0x20, "", "Merging Zones");
|
||||
|
||||
LuaEngine.GetInstance().CallLuaFunction(player, mergedZone, "onZoneIn");
|
||||
LuaEngine.GetInstance().CallLuaFunction(player, mergedZone, "onZoneIn", true);
|
||||
}
|
||||
|
||||
//Checks all seamless bounding boxes in region to see if player needs to merge or zonechange
|
||||
|
@ -574,6 +574,8 @@ namespace FFXIVClassic_Map_Server
|
|||
return;
|
||||
}
|
||||
|
||||
player.playerSession.LockUpdates(true);
|
||||
|
||||
Area oldZone = player.zone;
|
||||
//Remove player from currentZone if transfer else it's login
|
||||
if (player.zone != null)
|
||||
|
@ -594,6 +596,16 @@ namespace FFXIVClassic_Map_Server
|
|||
player.positionZ = spawnZ;
|
||||
player.rotation = spawnRotation;
|
||||
|
||||
//Delete content if have
|
||||
if (player.currentContentGroup != null)
|
||||
{
|
||||
player.currentContentGroup.RemoveMember(player.actorId);
|
||||
player.SetCurrentContentGroup(null, player);
|
||||
|
||||
if (oldZone is PrivateAreaContent)
|
||||
((PrivateAreaContent)oldZone).CheckDestroy();
|
||||
}
|
||||
|
||||
//Send packets
|
||||
player.playerSession.QueuePacket(DeleteAllActorsPacket.BuildPacket(player.actorId), true, false);
|
||||
player.playerSession.QueuePacket(_0xE2Packet.BuildPacket(player.actorId, 0x10), true, false);
|
||||
|
@ -601,11 +613,13 @@ namespace FFXIVClassic_Map_Server
|
|||
player.playerSession.ClearInstance();
|
||||
player.SendInstanceUpdate();
|
||||
|
||||
player.playerSession.LockUpdates(false);
|
||||
|
||||
//Send "You have entered an instance" if it's a Private Area
|
||||
if (newArea is PrivateArea)
|
||||
player.SendGameMessage(GetActor(), 34108, 0x20);
|
||||
|
||||
LuaEngine.GetInstance().CallLuaFunction(player, newArea, "onZoneIn");
|
||||
LuaEngine.GetInstance().CallLuaFunction(player, newArea, "onZoneIn", true);
|
||||
}
|
||||
|
||||
//Moves actor within zone to spawn position
|
||||
|
@ -648,6 +662,55 @@ namespace FFXIVClassic_Map_Server
|
|||
}
|
||||
}
|
||||
|
||||
//Moves actor to new zone, and sends packets to spawn at the given coords.
|
||||
public void DoZoneChangeContent(Player player, PrivateAreaContent contentArea, float spawnX, float spawnY, float spawnZ, float spawnRotation, ushort spawnType = SetActorPositionPacket.SPAWNTYPE_WARP_DUTY)
|
||||
{
|
||||
//Content area was null
|
||||
if (contentArea == null)
|
||||
{
|
||||
Program.Log.Debug("Request to change to content area not on this server by: {0}.", player.customDisplayName);
|
||||
return;
|
||||
}
|
||||
|
||||
player.playerSession.LockUpdates(true);
|
||||
|
||||
Area oldZone = player.zone;
|
||||
//Remove player from currentZone if transfer else it's login
|
||||
if (player.zone != null)
|
||||
{
|
||||
oldZone.RemoveActorFromZone(player);
|
||||
}
|
||||
|
||||
contentArea.AddActorToZone(player);
|
||||
|
||||
//Update player actor's properties
|
||||
player.zoneId = contentArea.GetParentZone().actorId;
|
||||
|
||||
player.privateArea = contentArea.GetPrivateAreaName();
|
||||
player.privateAreaType = contentArea.GetPrivateAreaType();
|
||||
player.zone = contentArea;
|
||||
player.positionX = spawnX;
|
||||
player.positionY = spawnY;
|
||||
player.positionZ = spawnZ;
|
||||
player.rotation = spawnRotation;
|
||||
|
||||
//Send "You have entered an instance" if it's a Private Area
|
||||
player.SendGameMessage(GetActor(), 34108, 0x20);
|
||||
|
||||
//Send packets
|
||||
player.playerSession.QueuePacket(DeleteAllActorsPacket.BuildPacket(player.actorId), true, false);
|
||||
player.playerSession.QueuePacket(_0xE2Packet.BuildPacket(player.actorId, 0x10), true, false);
|
||||
player.SendZoneInPackets(this, spawnType);
|
||||
player.playerSession.ClearInstance();
|
||||
player.SendInstanceUpdate();
|
||||
|
||||
player.playerSession.LockUpdates(false);
|
||||
|
||||
|
||||
|
||||
LuaEngine.GetInstance().CallLuaFunction(player, contentArea, "onZoneIn", true);
|
||||
}
|
||||
|
||||
//Session started, zone into world
|
||||
public void DoZoneIn(Player player, bool isLogin, ushort spawnType)
|
||||
{
|
||||
|
@ -683,7 +746,7 @@ namespace FFXIVClassic_Map_Server
|
|||
|
||||
player.playerSession.LockUpdates(false);
|
||||
|
||||
LuaEngine.GetInstance().CallLuaFunction(player, playerArea, "onZoneIn");
|
||||
LuaEngine.GetInstance().CallLuaFunction(player, playerArea, "onZoneIn", true);
|
||||
}
|
||||
|
||||
public void ReloadZone(uint zoneId)
|
||||
|
@ -743,12 +806,6 @@ namespace FFXIVClassic_Map_Server
|
|||
}
|
||||
}
|
||||
|
||||
public void CreateContentArea(String scriptPath)
|
||||
{
|
||||
LuaScript script = LuaEngine.LoadScript(scriptPath);
|
||||
|
||||
}
|
||||
|
||||
public bool SendGroupInit(Session session, ulong groupId)
|
||||
{
|
||||
if (mContentGroups.ContainsKey(groupId))
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ namespace FFXIVClassic_Map_Server.lua
|
|||
{
|
||||
const string FILEPATH_PLAYER = "./scripts/player.lua";
|
||||
const string FILEPATH_ZONE = "./scripts/unique/{0}/zone.lua";
|
||||
const string FILEPATH_CONTENT = "./scripts/content/{0}.lua";
|
||||
const string FILEPATH_COMMANDS = "./scripts/commands/{0}.lua";
|
||||
const string FILEPATH_DIRECTORS = "./scripts/directors/{0}.lua";
|
||||
const string FILEPATH_NPCS = "./scripts/unique/{0}/{1}/{2}.lua";
|
||||
|
@ -138,6 +139,10 @@ namespace FFXIVClassic_Map_Server.lua
|
|||
{
|
||||
return String.Format(FILEPATH_DIRECTORS, ((Director)target).GetScriptPath());
|
||||
}
|
||||
else if (target is PrivateAreaContent)
|
||||
{
|
||||
return String.Format(FILEPATH_CONTENT, ((PrivateAreaContent)target).GetPrivateAreaName());
|
||||
}
|
||||
else if (target is Area)
|
||||
{
|
||||
return String.Format(FILEPATH_ZONE, ((Area)target).zoneName);
|
||||
|
@ -152,7 +157,7 @@ namespace FFXIVClassic_Map_Server.lua
|
|||
return "";
|
||||
}
|
||||
|
||||
private List<LuaParam> CallLuaFunctionNpcForReturn(Player player, Npc target, string funcName, params object[] args)
|
||||
private List<LuaParam> CallLuaFunctionNpcForReturn(Player player, Npc target, string funcName, bool optional, params object[] args)
|
||||
{
|
||||
object[] args2 = new object[args.Length + (player == null ? 1 : 2)];
|
||||
Array.Copy(args, 0, args2, (player == null ? 1 : 2), args.Length);
|
||||
|
@ -200,7 +205,7 @@ namespace FFXIVClassic_Map_Server.lua
|
|||
return lparams;
|
||||
}
|
||||
|
||||
private void CallLuaFunctionNpc(Player player, Npc target, string funcName, params object[] args)
|
||||
private void CallLuaFunctionNpc(Player player, Npc target, string funcName, bool optional, params object[] args)
|
||||
{
|
||||
object[] args2 = new object[args.Length + (player == null ? 1:2)];
|
||||
Array.Copy(args, 0, args2, (player == null ? 1 : 2), args.Length);
|
||||
|
@ -257,11 +262,11 @@ namespace FFXIVClassic_Map_Server.lua
|
|||
}
|
||||
}
|
||||
|
||||
public List<LuaParam> CallLuaFunctionForReturn(Player player, Actor target, string funcName, params object[] args)
|
||||
public List<LuaParam> CallLuaFunctionForReturn(Player player, Actor target, string funcName, bool optional, params object[] args)
|
||||
{
|
||||
//Need a seperate case for NPCs cause that child/parent thing.
|
||||
if (target is Npc)
|
||||
return CallLuaFunctionNpcForReturn(player, (Npc)target, funcName, args);
|
||||
return CallLuaFunctionNpcForReturn(player, (Npc)target, funcName, optional, args);
|
||||
|
||||
object[] args2 = new object[args.Length + (player == null ? 1 : 2)];
|
||||
Array.Copy(args, 0, args2, (player == null ? 1 : 2), args.Length);
|
||||
|
@ -286,22 +291,41 @@ namespace FFXIVClassic_Map_Server.lua
|
|||
}
|
||||
else
|
||||
{
|
||||
SendError(player, String.Format("Could not find function '{0}' for actor {1}.", funcName, target.GetName()));
|
||||
if (!optional)
|
||||
SendError(player, String.Format("Could not find function '{0}' for actor {1}.", funcName, target.GetName()));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SendError(player, String.Format("Could not find script for actor {0}.", target.GetName()));
|
||||
if (!optional)
|
||||
SendError(player, String.Format("Could not find script for actor {0}.", target.GetName()));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void CallLuaFunction(Player player, Actor target, string funcName, params object[] args)
|
||||
public List<LuaParam> CallLuaFunctionForReturn(string path, string funcName, bool optional, params object[] args)
|
||||
{
|
||||
string luaPath = path;
|
||||
LuaScript script = LoadScript(luaPath);
|
||||
if (script != null)
|
||||
{
|
||||
if (!script.Globals.Get(funcName).IsNil())
|
||||
{
|
||||
//Run Script
|
||||
DynValue result = script.Call(script.Globals[funcName], args);
|
||||
List<LuaParam> lparams = LuaUtils.CreateLuaParamList(result);
|
||||
return lparams;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void CallLuaFunction(Player player, Actor target, string funcName, bool optional, params object[] args)
|
||||
{
|
||||
//Need a seperate case for NPCs cause that child/parent thing.
|
||||
if (target is Npc)
|
||||
{
|
||||
CallLuaFunctionNpc(player, (Npc)target, funcName, args);
|
||||
CallLuaFunctionNpc(player, (Npc)target, funcName, optional, args);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -322,12 +346,13 @@ namespace FFXIVClassic_Map_Server.lua
|
|||
}
|
||||
else
|
||||
{
|
||||
SendError(player, String.Format("Could not find function '{0}' for actor {1}.", funcName, target.GetName()));
|
||||
if (!optional)
|
||||
SendError(player, String.Format("Could not find function '{0}' for actor {1}.", funcName, target.GetName()));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(target is Area))
|
||||
if (!(target is Area) && !optional)
|
||||
SendError(player, String.Format("Could not find script for actor {0}.", target.GetName()));
|
||||
}
|
||||
}
|
||||
|
@ -344,7 +369,7 @@ namespace FFXIVClassic_Map_Server.lua
|
|||
ResolveResume(null, coroutine, value);
|
||||
}
|
||||
else
|
||||
CallLuaFunction(player, target, "onEventStarted", LuaUtils.CreateLuaParamObjectList(lparams));
|
||||
CallLuaFunction(player, target, "onEventStarted", false, LuaUtils.CreateLuaParamObjectList(lparams));
|
||||
}
|
||||
|
||||
private DynValue ResolveResume(Player player, Coroutine coroutine, DynValue value)
|
||||
|
|
|
@ -10,20 +10,15 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
|
|||
public const ushort OPCODE = 0x00CE;
|
||||
public const uint PACKET_SIZE = 0x48;
|
||||
|
||||
public const uint SPAWNTYPE_FADEIN = 0;
|
||||
public const uint SPAWNTYPE_PLAYERWAKE = 1;
|
||||
public const uint SPAWNTYPE_WARP_DUTY = 2;
|
||||
public const uint SPAWNTYPE_WARP2 = 3;
|
||||
public const uint SPAWNTYPE_WARP3 = 4;
|
||||
public const uint SPAWNTYPE_WARP_YELLOW = 5;
|
||||
public const uint SPAWNTYPE_WARP_DUTY2 = 6;
|
||||
public const uint SPAWNTYPE_WARP_LIGHT = 7;
|
||||
|
||||
public const float INNPOS_X = 157.550003f;
|
||||
public const float INNPOS_Y = 000.000000f;
|
||||
public const float INNPOS_Z = 165.050003f;
|
||||
public const float INNPOS_ROT = -1.530000f;
|
||||
|
||||
public const ushort SPAWNTYPE_FADEIN = 0;
|
||||
public const ushort SPAWNTYPE_PLAYERWAKE = 1;
|
||||
public const ushort SPAWNTYPE_WARP_DUTY = 2;
|
||||
public const ushort SPAWNTYPE_WARP2 = 3;
|
||||
public const ushort SPAWNTYPE_WARP3 = 4;
|
||||
public const ushort SPAWNTYPE_WARP_YELLOW = 5;
|
||||
public const ushort SPAWNTYPE_WARP_DUTY2 = 6;
|
||||
public const ushort SPAWNTYPE_WARP_LIGHT = 7;
|
||||
|
||||
public static SubPacket BuildPacket(uint sourceActorID, uint targetActorID, uint actorId, float x, float y, float z, float rotation, ushort spawnType, bool isZoningPlayer)
|
||||
{
|
||||
byte[] data = new byte[PACKET_SIZE-0x20];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue