mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-22 12:47:46 +00:00
More fixings and improvements.
This commit is contained in:
parent
718bc28c57
commit
b81141a158
5 changed files with 64 additions and 23 deletions
|
@ -1231,7 +1231,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
||||||
|
|
||||||
public void UpdateEvent(EventUpdatePacket update)
|
public void UpdateEvent(EventUpdatePacket update)
|
||||||
{
|
{
|
||||||
LuaEngine.GetInstance().OnEventUpdate(this);
|
LuaEngine.GetInstance().OnEventUpdate(this, update.luaParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void KickEvent(Actor actor, string conditionName, params object[] parameters)
|
public void KickEvent(Actor actor, string conditionName, params object[] parameters)
|
||||||
|
|
|
@ -85,7 +85,7 @@ namespace FFXIVClassic_Map_Server.lua
|
||||||
{
|
{
|
||||||
mSleepingOnTime.Remove(key);
|
mSleepingOnTime.Remove(key);
|
||||||
DynValue value = key.Resume();
|
DynValue value = key.Resume();
|
||||||
ResolveResume(key, value);
|
ResolveResume(null, key, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,16 +102,18 @@ namespace FFXIVClassic_Map_Server.lua
|
||||||
foreach (Coroutine key in mToAwake)
|
foreach (Coroutine key in mToAwake)
|
||||||
{
|
{
|
||||||
DynValue value = key.Resume();
|
DynValue value = key.Resume();
|
||||||
ResolveResume(key, value);
|
ResolveResume(null, key, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnEventUpdate(Player player)
|
public void OnEventUpdate(Player player, List<LuaParam> args)
|
||||||
{
|
{
|
||||||
if (mSleepingOnPlayerEvent.ContainsKey(player.actorId))
|
if (mSleepingOnPlayerEvent.ContainsKey(player.actorId))
|
||||||
{
|
{
|
||||||
mSleepingOnPlayerEvent[player.actorId].Resume();
|
Coroutine coroutine = mSleepingOnPlayerEvent[player.actorId];
|
||||||
mSleepingOnPlayerEvent.Remove(player.actorId);
|
mSleepingOnPlayerEvent.Remove(player.actorId);
|
||||||
|
DynValue value = coroutine.Resume(LuaUtils.CreateLuaParamObjectList(args));
|
||||||
|
ResolveResume(null, coroutine, value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
player.EndEvent();
|
player.EndEvent();
|
||||||
|
@ -203,6 +205,7 @@ namespace FFXIVClassic_Map_Server.lua
|
||||||
if (parent == null && child == null)
|
if (parent == null && child == null)
|
||||||
{
|
{
|
||||||
LuaEngine.SendError(player, String.Format("ERROR: Could not find script for actor {0}.", target.GetName()));
|
LuaEngine.SendError(player, String.Format("ERROR: Could not find script for actor {0}.", target.GetName()));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Run Script
|
//Run Script
|
||||||
|
@ -215,8 +218,8 @@ namespace FFXIVClassic_Map_Server.lua
|
||||||
|
|
||||||
if (coroutine != null)
|
if (coroutine != null)
|
||||||
{
|
{
|
||||||
DynValue value = coroutine.Resume();
|
DynValue value = coroutine.Resume(player, target, args);
|
||||||
ResolveResume(coroutine, value);
|
ResolveResume(player, coroutine, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,7 +256,10 @@ namespace FFXIVClassic_Map_Server.lua
|
||||||
{
|
{
|
||||||
//Need a seperate case for NPCs cause that child/parent thing.
|
//Need a seperate case for NPCs cause that child/parent thing.
|
||||||
if (target is Npc)
|
if (target is Npc)
|
||||||
|
{
|
||||||
CallLuaFunctionNpc(player, (Npc)target, funcName, args);
|
CallLuaFunctionNpc(player, (Npc)target, funcName, args);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
string luaPath = GetScriptPath(target);
|
string luaPath = GetScriptPath(target);
|
||||||
LuaScript script = LoadScript(luaPath);
|
LuaScript script = LoadScript(luaPath);
|
||||||
|
@ -262,7 +268,8 @@ namespace FFXIVClassic_Map_Server.lua
|
||||||
if (!script.Globals.Get(funcName).IsNil())
|
if (!script.Globals.Get(funcName).IsNil())
|
||||||
{
|
{
|
||||||
Coroutine coroutine = script.CreateCoroutine(script.Globals[funcName]).Coroutine;
|
Coroutine coroutine = script.CreateCoroutine(script.Globals[funcName]).Coroutine;
|
||||||
coroutine.Resume(player, target, args);
|
DynValue value = coroutine.Resume(player, target, args);
|
||||||
|
ResolveResume(player, coroutine, value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -277,15 +284,27 @@ namespace FFXIVClassic_Map_Server.lua
|
||||||
|
|
||||||
public void EventStarted(Player player, Actor target, EventStartPacket eventStart)
|
public void EventStarted(Player player, Actor target, EventStartPacket eventStart)
|
||||||
{
|
{
|
||||||
CallLuaFunction(player, target, "onEventStarted");
|
if (mSleepingOnPlayerEvent.ContainsKey(player.actorId))
|
||||||
|
{
|
||||||
|
Coroutine coroutine = mSleepingOnPlayerEvent[player.actorId];
|
||||||
|
mSleepingOnPlayerEvent.Remove(player.actorId);
|
||||||
|
DynValue value = coroutine.Resume();
|
||||||
|
ResolveResume(null, coroutine, value);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
CallLuaFunction(player, target, "onEventStarted", eventStart.triggerName);
|
||||||
}
|
}
|
||||||
|
|
||||||
private DynValue ResolveResume(Coroutine coroutine, DynValue value)
|
private DynValue ResolveResume(Player player, Coroutine coroutine, DynValue value)
|
||||||
{
|
{
|
||||||
if (value == null || value.IsVoid())
|
if (value == null || value.IsVoid())
|
||||||
return value;
|
return value;
|
||||||
|
|
||||||
if (value.Tuple != null && value.Tuple.Length >= 1 && value.Tuple[0].String != null)
|
if (value.String != null && value.String.Equals("_WAIT_EVENT"))
|
||||||
|
{
|
||||||
|
GetInstance().AddWaitEventCoroutine(player, coroutine);
|
||||||
|
}
|
||||||
|
else if (value.Tuple != null && value.Tuple.Length >= 1 && value.Tuple[0].String != null)
|
||||||
{
|
{
|
||||||
switch (value.Tuple[0].String)
|
switch (value.Tuple[0].String)
|
||||||
{
|
{
|
||||||
|
@ -296,7 +315,7 @@ namespace FFXIVClassic_Map_Server.lua
|
||||||
GetInstance().AddWaitSignalCoroutine(coroutine, (string)value.Tuple[1].String);
|
GetInstance().AddWaitSignalCoroutine(coroutine, (string)value.Tuple[1].String);
|
||||||
break;
|
break;
|
||||||
case "_WAIT_EVENT":
|
case "_WAIT_EVENT":
|
||||||
GetInstance().AddWaitEventCoroutine(new Player(null, 0), coroutine);
|
GetInstance().AddWaitEventCoroutine((Player)value.Tuple[1].UserData.Object, coroutine);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return value;
|
return value;
|
||||||
|
@ -437,7 +456,7 @@ namespace FFXIVClassic_Map_Server.lua
|
||||||
|
|
||||||
Coroutine coroutine = script.CreateCoroutine(script.Globals["onTrigger"]).Coroutine;
|
Coroutine coroutine = script.CreateCoroutine(script.Globals["onTrigger"]).Coroutine;
|
||||||
DynValue value = coroutine.Resume(player, LuaParam.ToArray());
|
DynValue value = coroutine.Resume(player, LuaParam.ToArray());
|
||||||
GetInstance().ResolveResume(coroutine, value);
|
GetInstance().ResolveResume(player, coroutine, value);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
require ("global")
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
|
|
||||||
ActivateCommand Script
|
ActivateCommand Script
|
||||||
|
@ -10,15 +12,12 @@ function onEventStarted(player, command, triggerName)
|
||||||
|
|
||||||
if (player:GetState() == 0) then
|
if (player:GetState() == 0) then
|
||||||
player:ChangeState(2);
|
player:ChangeState(2);
|
||||||
|
sendSignal("playerActive");
|
||||||
elseif (player:GetState() == 2) then
|
elseif (player:GetState() == 2) then
|
||||||
player:ChangeState(0);
|
player:ChangeState(0);
|
||||||
|
sendSignal("playerPassive");
|
||||||
end
|
end
|
||||||
|
|
||||||
player:endEvent();
|
player:endEvent();
|
||||||
|
|
||||||
--For Opening Tutorial
|
|
||||||
--if (player:HasQuest("Man0l0") or player:HasQuest("Man0g0") or player:HasQuest("Man0u0")) then
|
|
||||||
--player:GetDirector("Quest/QuestDirectorMan0l001"):OnCommandEvent(player, command);
|
|
||||||
--end
|
|
||||||
|
|
||||||
end
|
end
|
|
@ -19,10 +19,28 @@ end
|
||||||
function onEventStarted(player, actor, triggerName)
|
function onEventStarted(player, actor, triggerName)
|
||||||
|
|
||||||
man0l0Quest = player:GetQuest("Man0l0");
|
man0l0Quest = player:GetQuest("Man0l0");
|
||||||
|
|
||||||
callClientFunction(player, "delegateEvent", player, man0l0Quest, "processTtrBtl001", nil, nil, nil);
|
callClientFunction(player, "delegateEvent", player, man0l0Quest, "processTtrBtl001", nil, nil, nil);
|
||||||
|
player:EndEvent();
|
||||||
|
waitForSignal("playerActive");
|
||||||
|
kickEventContinue(player, actor, "noticeEvent", "noticeEvent");
|
||||||
callClientFunction(player, "delegateEvent", player, man0l0Quest, "processTtrBtl002", nil, nil, nil);
|
callClientFunction(player, "delegateEvent", player, man0l0Quest, "processTtrBtl002", nil, nil, nil);
|
||||||
callClientFunction(player, "delegateEvent", player, man0l0Quest, "processEvent000_2", nil, nil, nil);
|
player:EndEvent();
|
||||||
|
|
||||||
|
|
||||||
|
wait(4);
|
||||||
|
player:SendRequestedInfo(5); --Close TutorialWidget
|
||||||
|
player:SendRequestedInfo(2, nil, nil, 9055, 9055, 9055); --Open TutorialSuccessWidget for attacking enemy
|
||||||
|
wait(4);
|
||||||
|
player:SendRequestedInfo(4, nil, nil, nil, 12); --Open TP TutorialWidget
|
||||||
|
wait(4); --Should be wait for TP signal
|
||||||
|
player:SendRequestedInfo(5); --Close TutorialWidget
|
||||||
|
player:SendRequestedInfo(4, nil, nil, nil, 13); --Open WS TutorialWidget
|
||||||
|
wait(4); --Should be wait for weaponskillUsed signal
|
||||||
|
player:SendRequestedInfo(5); --Close TutorialWidget
|
||||||
|
player:SendRequestedInfo(2, nil, nil, 9065, 9065, 9065); --Open TutorialSuccessWidget for weapon skill
|
||||||
|
wait(4); --Should be wait for mobkill
|
||||||
|
callClientFunction(player, "delegateEvent", player, man0l0Quest, "processEvent000_2", nil, nil, nil);
|
||||||
player:ChangeMusic(7);
|
player:ChangeMusic(7);
|
||||||
callClientFunction(player, "delegateEvent", player, man0l0Quest, "processEvent000_3", nil, nil, nil);
|
callClientFunction(player, "delegateEvent", player, man0l0Quest, "processEvent000_3", nil, nil, nil);
|
||||||
|
|
||||||
|
|
|
@ -53,14 +53,19 @@ INVENTORY_EQUIPMENT_OTHERPLAYER = 0x00F9; --Max 0x23
|
||||||
|
|
||||||
--UTILS
|
--UTILS
|
||||||
|
|
||||||
|
function kickEventContinue(player, actor, trigger, ...)
|
||||||
|
player:kickEvent(actor, trigger, ...);
|
||||||
|
return coroutine.yield("_WAIT_EVENT", player);
|
||||||
|
end
|
||||||
|
|
||||||
function callClientFunction(player, functionName, ...)
|
function callClientFunction(player, functionName, ...)
|
||||||
player:RunEventFunction(functionName, ...);
|
player:RunEventFunction(functionName, ...);
|
||||||
result = coroutine.yield("_WAIT_EVENT");
|
result = coroutine.yield("_WAIT_EVENT", player);
|
||||||
return result;
|
return result;
|
||||||
end
|
end
|
||||||
|
|
||||||
function wait(seconds)
|
function wait(seconds)
|
||||||
return coroutine.yield(_WAIT_TIME, seconds);
|
return coroutine.yield("_WAIT_TIME", seconds);
|
||||||
end
|
end
|
||||||
|
|
||||||
function waitForSignal(signal)
|
function waitForSignal(signal)
|
||||||
|
|
Loading…
Add table
Reference in a new issue