mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-08-23 01:20:58 +02:00
Ported over all the opening directors and improved the director code a bit more. Also implemented content instances for Grid/Uld.
This commit is contained in:
parent
24c46c0480
commit
69f7fb5e47
18 changed files with 205 additions and 94 deletions
|
@ -1,6 +1,7 @@
|
|||
|
||||
using FFXIVClassic.Common;
|
||||
using FFXIVClassic_Map_Server.actors.area;
|
||||
using FFXIVClassic_Map_Server.actors.group;
|
||||
using FFXIVClassic_Map_Server.Actors;
|
||||
using FFXIVClassic_Map_Server.lua;
|
||||
using FFXIVClassic_Map_Server.packets.send.actor;
|
||||
|
@ -16,6 +17,7 @@ namespace FFXIVClassic_Map_Server.actors.director
|
|||
private uint directorId;
|
||||
private string directorScriptPath;
|
||||
private List<Actor> members = new List<Actor>();
|
||||
protected ContentGroup contentGroup;
|
||||
private bool isCreated = false;
|
||||
private bool isDeleted = false;
|
||||
private bool isDeleting = false;
|
||||
|
@ -23,7 +25,7 @@ namespace FFXIVClassic_Map_Server.actors.director
|
|||
private Script directorScript;
|
||||
private Coroutine currentCoroutine;
|
||||
|
||||
public Director(uint id, Area zone, string directorPath, params object[] args)
|
||||
public Director(uint id, Area zone, string directorPath, bool hasContentGroup, params object[] args)
|
||||
: base((6 << 28 | zone.actorId << 19 | (uint)id))
|
||||
{
|
||||
directorId = id;
|
||||
|
@ -33,6 +35,9 @@ namespace FFXIVClassic_Map_Server.actors.director
|
|||
|
||||
LoadLuaScript();
|
||||
|
||||
if (hasContentGroup)
|
||||
contentGroup = Server.GetWorldManager().CreateContentGroup(this, GetMembers());
|
||||
|
||||
eventConditions = new EventList();
|
||||
eventConditions.noticeEventConditions = new List<EventList.NoticeEventCondition>();
|
||||
eventConditions.noticeEventConditions.Add(new EventList.NoticeEventCondition("noticeEvent", 0xE,0x0));
|
||||
|
@ -108,6 +113,9 @@ namespace FFXIVClassic_Map_Server.actors.director
|
|||
|
||||
if (isCreated && spawnImmediate)
|
||||
{
|
||||
if (contentGroup != null)
|
||||
contentGroup.Start();
|
||||
|
||||
foreach (Player p in GetPlayerMembers())
|
||||
{
|
||||
p.QueuePackets(GetSpawnPackets());
|
||||
|
@ -116,15 +124,26 @@ namespace FFXIVClassic_Map_Server.actors.director
|
|||
}
|
||||
|
||||
if (this is GuildleveDirector)
|
||||
{
|
||||
((GuildleveDirector)this).LoadGuildleve();
|
||||
|
||||
}
|
||||
|
||||
StartCoroutine("main", this);
|
||||
}
|
||||
|
||||
public void StartContentGroup()
|
||||
{
|
||||
if (contentGroup != null)
|
||||
contentGroup.Start();
|
||||
}
|
||||
|
||||
public void EndDirector()
|
||||
{
|
||||
isDeleting = true;
|
||||
|
||||
if (contentGroup != null)
|
||||
contentGroup.DeleteGroup();
|
||||
|
||||
if (this is GuildleveDirector)
|
||||
((GuildleveDirector)this).EndGuildleveDirector();
|
||||
|
||||
|
@ -139,13 +158,20 @@ namespace FFXIVClassic_Map_Server.actors.director
|
|||
public void AddMember(Actor actor)
|
||||
{
|
||||
if (!members.Contains(actor))
|
||||
{
|
||||
members.Add(actor);
|
||||
|
||||
if (contentGroup != null)
|
||||
contentGroup.AddMember(actor);
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveMember(Actor actor)
|
||||
{
|
||||
if (members.Contains(actor))
|
||||
members.Remove(actor);
|
||||
if (contentGroup != null)
|
||||
contentGroup.RemoveMember(actor.actorId);
|
||||
if (GetPlayerMembers().Count == 0 && !isDeleting)
|
||||
EndDirector();
|
||||
}
|
||||
|
@ -175,6 +201,16 @@ namespace FFXIVClassic_Map_Server.actors.director
|
|||
return isDeleted;
|
||||
}
|
||||
|
||||
public bool HasContentGroup()
|
||||
{
|
||||
return contentGroup != null;
|
||||
}
|
||||
|
||||
public ContentGroup GetContentGroup()
|
||||
{
|
||||
return contentGroup;
|
||||
}
|
||||
|
||||
public void GenerateActorName(int actorNumber)
|
||||
{
|
||||
//Format Class Name
|
||||
|
@ -262,5 +298,24 @@ namespace FFXIVClassic_Map_Server.actors.director
|
|||
return null;
|
||||
}
|
||||
|
||||
public void OnEventStart(Player player, object[] args)
|
||||
{
|
||||
object[] args2 = new object[args.Length + (player == null ? 1 : 2)];
|
||||
Array.Copy(args, 0, args2, (player == null ? 1 : 2), args.Length);
|
||||
if (player != null)
|
||||
{
|
||||
args2[0] = player;
|
||||
args2[1] = this;
|
||||
}
|
||||
else
|
||||
args2[0] = this;
|
||||
|
||||
Coroutine coroutine = directorScript.CreateCoroutine(directorScript.Globals["onEventStarted"]).Coroutine;
|
||||
DynValue value = coroutine.Resume(args2);
|
||||
LuaEngine.GetInstance().ResolveResume(player, coroutine, value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue