Implemented the ending portion of the guildleve.

This commit is contained in:
Filip Maj 2017-06-25 22:43:15 -04:00
parent cd0bb10ef6
commit e5afe8791b
7 changed files with 88 additions and 0 deletions

View File

@ -467,6 +467,11 @@ namespace FFXIVClassic_Map_Server.Actors
RemoveActorFromZone(FindActorInZoneByUniqueID(uniqueId)); RemoveActorFromZone(FindActorInZoneByUniqueID(uniqueId));
} }
public void DespawnActor(Actor actor)
{
RemoveActorFromZone(actor);
}
public Director GetWeatherDirector() public Director GetWeatherDirector()
{ {
return mWeatherDirector; return mWeatherDirector;

View File

@ -396,6 +396,11 @@ namespace FFXIVClassic_Map_Server.Actors
player.QueuePacket(PlayBGAnimation.BuildPacket(actorId, player.actorId, animationName)); player.QueuePacket(PlayBGAnimation.BuildPacket(actorId, player.actorId, animationName));
} }
public void Despawn()
{
zone.DespawnActor(this);
}
public void Update(double deltaTime) public void Update(double deltaTime)
{ {
LuaEngine.GetInstance().CallLuaFunction(null, this, "onUpdate", true, deltaTime); LuaEngine.GetInstance().CallLuaFunction(null, this, "onUpdate", true, deltaTime);

View File

@ -123,6 +123,7 @@ namespace FFXIVClassic_Map_Server.actors.director
public void EndDirector() public void EndDirector()
{ {
isDeleting = true; isDeleting = true;
if (this is GuildleveDirector) if (this is GuildleveDirector)
((GuildleveDirector)this).EndGuildleveDirector(); ((GuildleveDirector)this).EndGuildleveDirector();

View File

@ -23,6 +23,8 @@ namespace FFXIVClassic_Map_Server.actors.director
public GuildleveData guildleveData; public GuildleveData guildleveData;
public GuildleveWork guildleveWork = new GuildleveWork(); public GuildleveWork guildleveWork = new GuildleveWork();
public bool isEnded = false;
public GuildleveDirector(uint id, Area zone, string directorPath, uint guildleveId, byte selectedDifficulty, Player guildleveOwner, params object[] args) public GuildleveDirector(uint id, Area zone, string directorPath, uint guildleveId, byte selectedDifficulty, Player guildleveOwner, params object[] args)
: base(id, zone, directorPath, args) : base(id, zone, directorPath, args)
{ {
@ -83,9 +85,27 @@ namespace FFXIVClassic_Map_Server.actors.director
public void EndGuildleve(bool wasCompleted) public void EndGuildleve(bool wasCompleted)
{ {
if (isEnded)
return;
isEnded = true;
if (wasCompleted) if (wasCompleted)
{ {
foreach (Actor a in GetPlayerMembers())
{
Player player = (Player)a;
player.PlayAnimation(0x02000002);
player.ChangeMusic(81);
player.SendGameMessage(Server.GetWorldManager().GetActor(), 50023, 0x20, (object)(int)guildleveId);
player.SendDataPacket("attention", Server.GetWorldManager().GetActor(), "", 50023, (object)(int)guildleveId);
}
}
foreach (Actor a in GetNpcMembers())
{
Npc npc = (Npc)a;
npc.Despawn();
RemoveMember(a);
} }
guildleveWork.startTime = 0; guildleveWork.startTime = 0;
@ -96,6 +116,11 @@ namespace FFXIVClassic_Map_Server.actors.director
propertyBuilder.AddProperty("guildleveWork.startTime"); propertyBuilder.AddProperty("guildleveWork.startTime");
SendPacketsToPlayers(propertyBuilder.Done()); SendPacketsToPlayers(propertyBuilder.Done());
if (wasCompleted)
{
Npc aetheryteNode = zone.SpawnActor(1200040, String.Format("{0}:warpExit", guildleveOwner.actorName), guildleveOwner.positionX, guildleveOwner.positionY, guildleveOwner.positionZ);
contentGroup.AddMember(aetheryteNode);
}
} }
public void AbandonGuildleve() public void AbandonGuildleve()

View File

@ -134,7 +134,11 @@ namespace FFXIVClassic_Map_Server.actors.group
Session s = Server.GetServer().GetSession(members[i]); Session s = Server.GetServer().GetSession(members[i]);
if (s != null) if (s != null)
s.GetActor().SetCurrentContentGroup(null); s.GetActor().SetCurrentContentGroup(null);
Actor a = director.GetZone().FindActorInArea(members[i]);
if (a is Npc)
((Npc)a).Despawn();
members.Remove(members[i]); members.Remove(members[i]);
i--;
} }
Server.GetWorldManager().DeleteContentGroup(groupIndex); Server.GetWorldManager().DeleteContentGroup(groupIndex);
} }

View File

@ -0,0 +1,43 @@
--[[
GuildleveWarpPoint Script
Functions:
eventGuildleveReward(glId, completionTimeSec, completeReward, difficultyBonus, faction, gil???, factionBonus, RewardId1, RewardAmount1, RewardId2, RewardAmount2, difficulty) - Open Reward Dialog
eventTalkGuildleveWarp(returnAetheryteID1, returnAetheryte2) - Opens choice menu
--]]
require ("global")
require ("aetheryte")
require ("utils")
function init(npc)
return false, false, 0, 0;
end
function onEventStarted(player, npc, triggerName)
local currentGLDirector = player:GetGuildleveDirector();
local glData = currentGLDirector.guildleveData;
callClientFunction(player, "eventGuildleveReward", currentGLDirector.guildleveId, 0x26, 24, 24, 0, 0, 0, 0, 0, 0, 0, 4);
local choice = callClientFunction(player, "eventTalkGuildleveWarp", glData.aetheryte, 0);
if (choice == 3) then
local destination = aetheryteTeleportPositions[glData.aetheryte];
if (destination ~= nil) then
randoPos = getRandomPointInBand(destination[2], destination[4], 3, 5);
rotation = getAngleFacing(randoPos.x, randoPos.y, destination[2], destination[4]);
GetWorldManager():DoZoneChange(player, destination[1], nil, 0, 2, randoPos.x, destination[3], randoPos.y, rotation);
currentGLDirector:EndDirector();
end
elseif (choice == 4) then
currentGLDirector:EndDirector();
end
player:EndEvent();
end
--50023: GL COMPLETE!
--50132: You earn faction credits from X

View File

@ -28,5 +28,10 @@ function main(thisDirector)
thisDirector:UpdateAimNumNow(0, 2); thisDirector:UpdateAimNumNow(0, 2);
wait(3); wait(3);
thisDirector:UpdateAimNumNow(0, 3); thisDirector:UpdateAimNumNow(0, 3);
wait(3);
thisDirector:UpdateAimNumNow(0, 4);
wait(2);
thisDirector:EndGuildleve(true);
end end