Finished Treasures of the Main and Legends Adrift. Fixed quests appearing in private areas (echos). Fixed other bugs. Implemented NPC Linkshells. Added more options to nudge command. Added nudgenpc command. Added testbnpckill command.

This commit is contained in:
Filip Maj 2022-03-11 02:17:46 -05:00
parent ebba56602c
commit 65ee91e49c
14 changed files with 864 additions and 38 deletions

View file

@ -642,7 +642,7 @@ namespace Meteor.Map.Actors
return new Vector3(positionX, positionY, positionZ);
}
public void SetPos(float x, float y, float z, float rot = 0, bool instant = false)
public void SetPos(float x, float y, float z, float rot = 0, bool instant = false, Player player = null)
{
oldPositionX = positionX;
oldPositionY = positionY;
@ -657,8 +657,9 @@ namespace Meteor.Map.Actors
// todo: handle zone?
if (instant)
{
CurrentArea.BroadcastPacketAroundPoint(oldPositionX, oldPositionY, CreateSpawnTeleportPacket(0));
CurrentArea.BroadcastPacketAroundPoint(positionX, positionY, CreateSpawnTeleportPacket(0));
player.QueuePacket(CreateSpawnTeleportPacket(0));
//CurrentArea.BroadcastPacketAroundPoint(oldPositionX, oldPositionY, CreateSpawnTeleportPacket(0));
//CurrentArea.BroadcastPacketAroundPoint(positionX, positionY, CreateSpawnTeleportPacket(0));
}
else
CurrentArea.BroadcastPacketAroundActor(this, MoveActorToPositionPacket.BuildPacket(Id, x, y, z, rot, moveState));

View file

@ -33,9 +33,10 @@ namespace Meteor.Map.actors.area
private readonly Zone ParentZone;
private readonly string PrivateAreaName;
private readonly int PrivateAreaType;
private readonly bool CanExitArea;
public PrivateArea(Zone parent, string classPath, string privateAreaName, int privateAreaType, ushort bgmDay, ushort bgmNight, ushort bgmBattle)
: base(parent.ZoneId, parent.ZoneName, parent.RegionId, classPath, bgmDay, bgmNight, bgmBattle, parent.isIsolated, parent.isInn, parent.canRideChocobo, parent.canStealth, true)
public PrivateArea(Zone parent, string classPath, string privateAreaName, int privateAreaType, bool canExitArea, ushort music)
: base(parent.ZoneId, parent.ZoneName, parent.RegionId, classPath, music, music, music, parent.isIsolated, parent.isInn, parent.canRideChocobo, parent.canStealth, true)
{
this.ParentZone = parent;
this.PrivateAreaName = privateAreaName;
@ -52,6 +53,11 @@ namespace Meteor.Map.actors.area
return PrivateAreaType;
}
public bool CanExitPrivateArea()
{
return CanExitArea;
}
public override bool IsPublic()
{
return false;

View file

@ -38,7 +38,7 @@ namespace Meteor.Map.actors.area
}
public PrivateAreaContent(Zone parent, string classPath, string privateAreaName, int privateAreaType, Director director, Player contentStarter) //TODO: Make it a list
: base(parent, classPath, privateAreaName, privateAreaType, 0, 0, 0)
: base(parent, classPath, privateAreaName, privateAreaType, false, 0)
{
currentDirector = director;
LuaEngine.GetInstance().CallLuaFunction(contentStarter, this, "onCreate", false, currentDirector);

View file

@ -1840,18 +1840,27 @@ namespace Meteor.Map.Actors
public Quest[] GetQuestsForNpc(Npc npc)
{
Quest[] quests = questStateManager.GetQuestsForNpc(npc);
Quest[] quests = questStateManager.GetQuestsForNpc(npc, CurrentArea.IsPrivate());
Array.Sort(quests, (q1, q2) => (q1.HasData() ? 1 : 0) - (q2.HasData() ? 1 : 0));
return quests;
}
public void HandleBNpcKill(uint bnpcClassId)
{
foreach (Quest quest in questScenario)
{
if (quest != null)
quest.OnKillBNpc(this, bnpcClassId);
}
}
public bool HandleNpcLs(uint id)
{
foreach (Quest quest in questScenario)
{
if (quest != null && quest.HasNpcLsMsgs(id))
{
quest.OnNpcLS(this);
quest.OnNpcLs(this);
return true;
}
}

View file

@ -194,7 +194,12 @@ namespace Meteor.Map.Actors.QuestNS
LuaEngine.GetInstance().CallLuaFunction(caller, this, "onNotice", true, triggerName);
}
public void OnNpcLS(Player caller)
public void OnKillBNpc(Player caller, uint classId)
{
LuaEngine.GetInstance().CallLuaFunction(caller, this, "onKillBNpc", true, classId);
}
public void OnNpcLs(Player caller)
{
LuaEngine.GetInstance().CallLuaFunction(caller, this, "onNpcLS", true, data.GetNpcLsFrom(), data.GetMsgStep());
}

View file

@ -151,9 +151,12 @@ namespace Meteor.Map.Actors.QuestNS
return ActiveQuests.Find(quest => quest.GetQuestId() == id);
}
public Quest[] GetQuestsForNpc(Npc npc)
public Quest[] GetQuestsForNpc(Npc npc, bool isPrivateArea)
{
return ActiveQuests.FindAll(quest => quest.IsQuestENPC(player, npc)).ToArray();
if (isPrivateArea)
return ActiveQuests.FindAll(quest => quest.IsQuestENPC(player, npc) && quest.GetSequence() != Quest.SEQ_NOT_STARTED).ToArray();
else
return ActiveQuests.FindAll(quest => quest.IsQuestENPC(player, npc)).ToArray();
}
public byte[] GetCompletionSliceBytes(ushort from, ushort to)