mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-08-01 23:31:55 +02:00
Overhaul of the director system and opening quests. Private Areas further implemented as well.
This commit is contained in:
parent
dcaad5729d
commit
e898c045f7
69 changed files with 2602 additions and 1816 deletions
|
@ -28,6 +28,8 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
public float[] moveSpeeds = new float[4];
|
||||
|
||||
public uint zoneId, zoneId2;
|
||||
public string privateArea;
|
||||
public uint privateAreaType;
|
||||
public Area zone = null;
|
||||
public Area zone2 = null;
|
||||
public bool isZoning = false;
|
||||
|
@ -351,7 +353,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
uint zoneId = zone.actorId;
|
||||
uint privLevel = 0;
|
||||
if (zone is PrivateArea)
|
||||
privLevel = ((PrivateArea)zone).GetPrivateAreaLevel();
|
||||
privLevel = ((PrivateArea)zone).GetPrivateAreaType();
|
||||
|
||||
actorName = String.Format("{0}_{1}_{2}@{3:X3}{4:X2}", className, zoneName, classNumber, zoneId, privLevel);
|
||||
}
|
||||
|
|
|
@ -298,6 +298,19 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
if (!mActorList.ContainsKey(id))
|
||||
return null;
|
||||
return mActorList[id];
|
||||
}
|
||||
|
||||
public Actor FindActorInZoneByUniqueID(string uniqueId)
|
||||
{
|
||||
foreach (Actor a in mActorList.Values)
|
||||
{
|
||||
if (a is Npc)
|
||||
{
|
||||
if (((Npc)a).GetUniqueId().ToLower().Equals(uniqueId))
|
||||
return a;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Player FindPCInZone(string name)
|
||||
|
@ -360,7 +373,16 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
if (actorClass == null)
|
||||
return;
|
||||
|
||||
Npc npc = new Npc(mActorList.Count + 1, actorClass, location.uniqueId, actorId, location.x, location.y, location.z, location.rot, location.state, location.animId, null);
|
||||
uint zoneId;
|
||||
|
||||
if (this is PrivateArea)
|
||||
zoneId = ((PrivateArea)this).GetParentZone().actorId;
|
||||
else
|
||||
zoneId = actorId;
|
||||
|
||||
Npc npc = new Npc(mActorList.Count + 1, actorClass, location.uniqueId, this, location.x, location.y, location.z, location.rot, location.state, location.animId, null);
|
||||
|
||||
|
||||
npc.LoadEventConditions(actorClass.eventConditions);
|
||||
|
||||
AddActorToZone(npc);
|
||||
|
|
|
@ -15,14 +15,14 @@ namespace FFXIVClassic_Map_Server.actors.area
|
|||
{
|
||||
private Zone parentZone;
|
||||
private string privateAreaName;
|
||||
private uint privateAreaLevel;
|
||||
private uint privateAreaType;
|
||||
|
||||
public PrivateArea(Zone parent, uint id, string className, string privateAreaName, uint privateAreaLevel, ushort bgmDay, ushort bgmNight, ushort bgmBattle)
|
||||
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)
|
||||
{
|
||||
this.parentZone = parent;
|
||||
this.privateAreaName = privateAreaName;
|
||||
this.privateAreaLevel = privateAreaLevel;
|
||||
this.privateAreaType = privateAreaType;
|
||||
}
|
||||
|
||||
public string GetPrivateAreaName()
|
||||
|
@ -30,9 +30,9 @@ namespace FFXIVClassic_Map_Server.actors.area
|
|||
return privateAreaName;
|
||||
}
|
||||
|
||||
public uint GetPrivateAreaLevel()
|
||||
public uint GetPrivateAreaType()
|
||||
{
|
||||
return privateAreaLevel;
|
||||
return privateAreaType;
|
||||
}
|
||||
|
||||
public Zone GetParentZone()
|
||||
|
@ -46,12 +46,11 @@ namespace FFXIVClassic_Map_Server.actors.area
|
|||
|
||||
string path = className;
|
||||
|
||||
if (className.ToLower().Contains("content"))
|
||||
path = "Content/" + className;
|
||||
string realClassName = className.Substring(className.LastIndexOf("/") + 1);
|
||||
|
||||
lParams = LuaUtils.CreateLuaParamList("/Area/PrivateArea/" + path, false, true, zoneName, privateAreaName, 0x9E, canRideChocobo ? (byte)1 : (byte)0, canStealth, isInn, false, false, false, false, false, false);
|
||||
ActorInstantiatePacket.BuildPacket(actorId, playerActorId, actorName, className, lParams).DebugPrintSubPacket();
|
||||
return ActorInstantiatePacket.BuildPacket(actorId, playerActorId, actorName, className, lParams);
|
||||
lParams = LuaUtils.CreateLuaParamList("/Area/PrivateArea" + path, 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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ namespace FFXIVClassic_Map_Server.actors.area
|
|||
class Zone : Area
|
||||
{
|
||||
Dictionary<string, Dictionary<uint, PrivateArea>> privateAreas = new Dictionary<string, Dictionary<uint, PrivateArea>>();
|
||||
Dictionary<string, List<PrivateArea>> instancedPrivateAreas = new Dictionary<string, List<PrivateArea>>();
|
||||
|
||||
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)
|
||||
|
@ -26,11 +27,11 @@ namespace FFXIVClassic_Map_Server.actors.area
|
|||
public void AddPrivateArea(PrivateArea pa)
|
||||
{
|
||||
if (privateAreas.ContainsKey(pa.GetPrivateAreaName()))
|
||||
privateAreas[pa.GetPrivateAreaName()][0] = pa;
|
||||
privateAreas[pa.GetPrivateAreaName()][pa.GetPrivateAreaType()] = pa;
|
||||
else
|
||||
{
|
||||
privateAreas[pa.GetPrivateAreaName()] = new Dictionary<uint, PrivateArea>();
|
||||
privateAreas[pa.GetPrivateAreaName()][0] = pa;
|
||||
privateAreas[pa.GetPrivateAreaName()][pa.GetPrivateAreaType()] = pa;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
using FFXIVClassic.Common;
|
||||
using FFXIVClassic_Map_Server.actors;
|
||||
using FFXIVClassic_Map_Server.actors.area;
|
||||
using FFXIVClassic_Map_Server.actors.chara.npc;
|
||||
using FFXIVClassic_Map_Server.Actors.Chara;
|
||||
using FFXIVClassic_Map_Server.dataobjects;
|
||||
using FFXIVClassic_Map_Server.lua;
|
||||
|
||||
using FFXIVClassic_Map_Server.packets.receive.events;
|
||||
using FFXIVClassic_Map_Server.packets.send.actor;
|
||||
using FFXIVClassic_Map_Server.utils;
|
||||
|
@ -27,8 +27,8 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
|
||||
public NpcWork npcWork = new NpcWork();
|
||||
|
||||
public Npc(int actorNumber, ActorClass actorClass, string uniqueId, uint zoneId, float posX, float posY, float posZ, float rot, ushort actorState, uint animationId, string customDisplayName)
|
||||
: base((4 << 28 | zoneId << 19 | (uint)actorNumber))
|
||||
public Npc(int actorNumber, ActorClass actorClass, string uniqueId, Area spawnedArea, float posX, float posY, float posZ, float rot, ushort actorState, uint animationId, string customDisplayName)
|
||||
: base((4 << 28 | spawnedArea.actorId << 19 | (uint)actorNumber))
|
||||
{
|
||||
this.positionX = posX;
|
||||
this.positionY = posY;
|
||||
|
@ -41,8 +41,8 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
|
||||
this.uniqueIdentifier = uniqueId;
|
||||
|
||||
this.zoneId = zoneId;
|
||||
this.zone = Server.GetWorldManager().GetZone(zoneId);
|
||||
this.zoneId = spawnedArea.actorId;
|
||||
this.zone = spawnedArea;
|
||||
|
||||
this.actorClassId = actorClass.actorClassId;
|
||||
|
||||
|
@ -131,8 +131,12 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
subpackets.AddRange(GetEventConditionPackets(playerActorId));
|
||||
subpackets.Add(CreateSpeedPacket(playerActorId));
|
||||
subpackets.Add(CreateSpawnPositonPacket(playerActorId, 0x0));
|
||||
|
||||
if (uniqueIdentifier.Equals("door2"))
|
||||
|
||||
if (uniqueIdentifier.Equals("door1"))
|
||||
{
|
||||
subpackets.Add(_0xD8Packet.BuildPacket(actorId, playerActorId, 0xB0D, 0x1af));
|
||||
}
|
||||
else if (uniqueIdentifier.Equals("door2"))
|
||||
{
|
||||
subpackets.Add(_0xD8Packet.BuildPacket(actorId, playerActorId, 0xB09, 0x1af));
|
||||
}
|
||||
|
@ -167,16 +171,16 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
}
|
||||
else if (actorClassId == 5900013)
|
||||
{
|
||||
uint id = 2;
|
||||
uint id2 = 5144;
|
||||
string val = "fdot";
|
||||
uint id = 201;
|
||||
uint id2 = 0x1415;
|
||||
string val = "fdin";
|
||||
subpackets.Add(_0xD8Packet.BuildPacket(actorId, playerActorId, id, id2));
|
||||
subpackets.Add(_0xD9Packet.BuildPacket(actorId, playerActorId, val));
|
||||
}
|
||||
else if (actorClassId == 5900014)
|
||||
{
|
||||
uint id = 2;
|
||||
uint id2 = 5145;
|
||||
uint id = 201;
|
||||
uint id2 = 0x1415;
|
||||
string val = "fdot";
|
||||
subpackets.Add(_0xD8Packet.BuildPacket(actorId, playerActorId, id, id2));
|
||||
subpackets.Add(_0xD9Packet.BuildPacket(actorId, playerActorId, val));
|
||||
|
@ -374,8 +378,17 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
|
||||
if (File.Exists("./scripts/base/" + classPath + ".lua"))
|
||||
parent = LuaEngine.LoadScript("./scripts/base/" + classPath + ".lua");
|
||||
if (File.Exists(String.Format("./scripts/unique/{0}/{1}/{2}.lua", zone.zoneName, className, uniqueIdentifier)))
|
||||
child = LuaEngine.LoadScript(String.Format("./scripts/unique/{0}/{1}/{2}.lua", zone.zoneName, className, uniqueIdentifier));
|
||||
|
||||
if (zone is PrivateArea)
|
||||
{
|
||||
if (File.Exists(String.Format("./scripts/unique/{0}/privatearea/{1}/{2}/{3}.lua", zone.zoneName, ((PrivateArea)zone).GetPrivateAreaName(), className, uniqueIdentifier)))
|
||||
child = LuaEngine.LoadScript(String.Format("./scripts/unique/{0}/privatearea/{1}/{2}/{3}.lua", zone.zoneName, ((PrivateArea)zone).GetPrivateAreaName(), className, uniqueIdentifier));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (File.Exists(String.Format("./scripts/unique/{0}/{1}/{2}.lua", zone.zoneName, className, uniqueIdentifier)))
|
||||
child = LuaEngine.LoadScript(String.Format("./scripts/unique/{0}/{1}/{2}.lua", zone.zoneName, className, uniqueIdentifier));
|
||||
}
|
||||
|
||||
if (parent == null && child == null)
|
||||
{
|
||||
|
@ -402,8 +415,16 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
|
||||
if (File.Exists("./scripts/base/" + classPath + ".lua"))
|
||||
parent = LuaEngine.LoadScript("./scripts/base/" + classPath + ".lua");
|
||||
if (File.Exists(String.Format("./scripts/unique/{0}/{1}/{2}.lua", zone.zoneName, className, uniqueIdentifier)))
|
||||
child = LuaEngine.LoadScript(String.Format("./scripts/unique/{0}/{1}/{2}.lua", zone.zoneName, className, uniqueIdentifier));
|
||||
if (zone is PrivateArea)
|
||||
{
|
||||
if (File.Exists(String.Format("./scripts/unique/{0}/privatearea/{1}/{2}/{3}.lua", zone.zoneName, ((PrivateArea)zone).GetPrivateAreaName(), className, uniqueIdentifier)))
|
||||
child = LuaEngine.LoadScript(String.Format("./scripts/unique/{0}/privatearea/{1}/{2}/{3}.lua", zone.zoneName, ((PrivateArea)zone).GetPrivateAreaName(), className, uniqueIdentifier));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (File.Exists(String.Format("./scripts/unique/{0}/{1}/{2}.lua", zone.zoneName, className, uniqueIdentifier)))
|
||||
child = LuaEngine.LoadScript(String.Format("./scripts/unique/{0}/{1}/{2}.lua", zone.zoneName, className, uniqueIdentifier));
|
||||
}
|
||||
|
||||
if (parent == null && child == null)
|
||||
{
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -68,14 +68,42 @@ namespace FFXIVClassic_Map_Server.actors.director
|
|||
return BasePacket.CreatePacket(initProperties.BuildPacket(playerActorId, actorId), true, false);
|
||||
}
|
||||
|
||||
public void OnTalked(Player player, Npc npc)
|
||||
public void OnTalkEvent(Player player, Npc npc)
|
||||
{
|
||||
LuaEngine.DoDirectorOnTalked(this, player, npc);
|
||||
if (File.Exists("./scripts/directors/" + directorScriptPath + ".lua"))
|
||||
{
|
||||
LuaScript script = LuaEngine.LoadScript("./scripts/directors/" + directorScriptPath + ".lua");
|
||||
|
||||
if (script == null)
|
||||
return;
|
||||
|
||||
//Run Script
|
||||
if (!script.Globals.Get("onTalkEvent").IsNil())
|
||||
script.Call(script.Globals["onTalkEvent"], player, npc);
|
||||
}
|
||||
else
|
||||
{
|
||||
LuaEngine.SendError(player, String.Format("ERROR: Could not find script for director {0}.", GetName()));
|
||||
}
|
||||
}
|
||||
|
||||
public void OnCommand(Player player, Command command)
|
||||
public void OnCommandEvent(Player player, Command command)
|
||||
{
|
||||
LuaEngine.DoDirectorOnCommand(this, player, command);
|
||||
if (File.Exists("./scripts/directors/" + directorScriptPath + ".lua"))
|
||||
{
|
||||
LuaScript script = LuaEngine.LoadScript("./scripts/directors/" + directorScriptPath + ".lua");
|
||||
|
||||
if (script == null)
|
||||
return;
|
||||
|
||||
//Run Script
|
||||
if (!script.Globals.Get("onCommandEvent").IsNil())
|
||||
script.Call(script.Globals["onCommandEvent"], player, command);
|
||||
}
|
||||
else
|
||||
{
|
||||
LuaEngine.SendError(player, String.Format("ERROR: Could not find script for director {0}.", GetName()));
|
||||
}
|
||||
}
|
||||
|
||||
public void AddChild(Actor actor)
|
||||
|
@ -186,10 +214,15 @@ namespace FFXIVClassic_Map_Server.actors.director
|
|||
uint zoneId = zone.actorId;
|
||||
uint privLevel = 0;
|
||||
if (zone is PrivateArea)
|
||||
privLevel = ((PrivateArea)zone).GetPrivateAreaLevel();
|
||||
privLevel = ((PrivateArea)zone).GetPrivateAreaType();
|
||||
|
||||
actorName = String.Format("{0}_{1}_{2}@{3:X3}{4:X2}", className, zoneName, classNumber, zoneId, privLevel);
|
||||
}
|
||||
|
||||
public string GetScriptPath()
|
||||
{
|
||||
return directorScriptPath;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,6 +41,11 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
//Inform update
|
||||
}
|
||||
|
||||
public uint GetQuestId()
|
||||
{
|
||||
return actorId & 0xFFFFF;
|
||||
}
|
||||
|
||||
public object GetQuestData(string dataName)
|
||||
{
|
||||
if (questData.ContainsKey(dataName))
|
||||
|
@ -52,12 +57,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
public void ClearQuestData()
|
||||
{
|
||||
questData.Clear();
|
||||
}
|
||||
|
||||
public uint GetQuestId()
|
||||
{
|
||||
return actorId;
|
||||
}
|
||||
}
|
||||
|
||||
public void ClearQuestFlags()
|
||||
{
|
||||
|
@ -98,9 +98,11 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
return currentPhase;
|
||||
}
|
||||
|
||||
public void NextPhase()
|
||||
public void NextPhase(int phaseNumber)
|
||||
{
|
||||
currentPhase++;
|
||||
currentPhase = phaseNumber;
|
||||
owner.SendGameMessage(Server.GetWorldManager().GetActor(), 25116, 0x20, (object)GetQuestId());
|
||||
SaveData();
|
||||
}
|
||||
|
||||
public uint GetQuestFlags()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue