Added warp to public and private areas shortcut. Fixed counter printout bug. Fixed some commands. Fixed handling of the chocobo lender at the ferry docks.

This commit is contained in:
Filip Maj 2022-02-13 18:48:22 -05:00
parent 9f077190a3
commit 214d730a58
13 changed files with 208 additions and 124 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, uint zoneId = 0)
public void SetPos(float x, float y, float z, float rot = 0, bool instant = false)
{
oldPositionX = positionX;
oldPositionY = positionY;
@ -655,7 +655,13 @@ namespace Meteor.Map.Actors
rotation = rot;
// todo: handle zone?
CurrentArea.BroadcastPacketAroundActor(this, MoveActorToPositionPacket.BuildPacket(Id, x, y, z, rot, moveState));
if (instant)
{
CurrentArea.BroadcastPacketAroundPoint(oldPositionX, oldPositionY, CreateSpawnTeleportPacket(0));
CurrentArea.BroadcastPacketAroundPoint(positionX, positionY, CreateSpawnTeleportPacket(0));
}
else
CurrentArea.BroadcastPacketAroundActor(this, MoveActorToPositionPacket.BuildPacket(Id, x, y, z, rot, moveState));
}
public void LookAt(Actor actor)

View file

@ -488,6 +488,26 @@ namespace Meteor.Map.Actors
}
}
public void BroadcastPacketAroundPoint(float x, float y, SubPacket packet)
{
if (isIsolated)
return;
List<Actor> aroundActor = GetActorsAroundPoint(x, y, 50);
foreach (Actor a in aroundActor)
{
if (a is Player)
{
if (isIsolated)
continue;
SubPacket clonedPacket = new SubPacket(packet, a.Id);
Player p = (Player)a;
p.QueuePacket(clonedPacket);
}
}
}
public void SpawnActor(SpawnLocation location)
{
lock (mActorList)
@ -497,16 +517,8 @@ namespace Meteor.Map.Actors
if (actorClass == null)
return;
uint zoneId;
if (this is PrivateArea)
zoneId = ((PrivateArea)this).GetParentZone().Id;
else
zoneId = Id;
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);
@ -522,12 +534,6 @@ namespace Meteor.Map.Actors
if (actorClass == null)
return null;
uint zoneId;
if (this is PrivateArea)
zoneId = ((PrivateArea)this).GetParentZone().Id;
else
zoneId = Id;
Npc npc;
if (isMob)
npc = new BattleNpc(mActorList.Count + 1, actorClass, uniqueId, this, x, y, z, rot, state, animId, null);
@ -554,13 +560,6 @@ namespace Meteor.Map.Actors
if (actorClass == null)
return null;
uint zoneId;
if (this is PrivateArea)
zoneId = ((PrivateArea)this).GetParentZone().Id;
else
zoneId = Id;
Npc npc = new Npc(mActorList.Count + 1, actorClass, uniqueId, this, x, y, z, 0, regionId, layoutId);
npc.LoadEventConditions(actorClass.eventConditions);

View file

@ -582,7 +582,7 @@ namespace Meteor.Map.Actors
QueuePacket(SetWeatherPacket.BuildPacket(Id, SetWeatherPacket.WEATHER_CLEAR, 1));
}
public void SendZoneInPackets(WorldManager world, ushort spawnType, bool changeMap)
public void SendZoneInPackets(WorldManager world, ushort spawnType)
{
QueuePacket(SetActorIsZoningPacket.BuildPacket(Id, false));
QueuePacket(SetDalamudPacket.BuildPacket(Id, 0));
@ -979,6 +979,16 @@ namespace Meteor.Map.Actors
//CurrentArea.BroadcastPacketAroundActor(this, worldMasterMessage);
}
public void ChangeIntoNpc(Npc npc)
{
uint[] npcAppearIds = new uint[appearanceIds.Length];
for (int i = 0; i < appearanceIds.Length; i++)
npcAppearIds[i] = npc.appearanceIds[i];
SetActorAppearancePacket setappearance = new SetActorAppearancePacket(npc.modelId, npcAppearIds);
BroadcastPacket(setappearance.BuildPacket(Id), true);
}
public void GraphicChange(uint slot, uint graphicId)
{
appearanceIds[slot] = graphicId;

View file

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Meteor.Map.Actors.Debug
{
class DebugWork
{
public bool enableWidget;
public bool printProcessing;
public float printProcessingLog;
public bool printDisp;
public bool printDispFront;
public int serverTimeOffset;
}
}

View file

@ -873,7 +873,7 @@ namespace Meteor.Map
if (oldArea is PrivateAreaContent)
((PrivateAreaContent)oldArea).CheckDestroy();
}
}
//Send packets
player.playerSession.QueuePacket(DeleteAllActorsPacket.BuildPacket(player.Id));
@ -916,6 +916,29 @@ namespace Meteor.Map
}
}
// Warp the player to a private area within the zone.
public void WarpToPrivateArea(Player player, String name, int type)
{
WarpToPrivateArea(player, name, type, player.positionX, player.positionY, player.positionZ, player.rotation);
}
// Warp the player to a private area within the zone to a specific location.
public void WarpToPrivateArea(Player player, String name, int type, float x, float y, float z, float rotation)
{
DoZoneChange(player, player.CurrentArea.ZoneId, name, type, 15, x, y, z, rotation);
}
public void WarpToPublicArea(Player player)
{
WarpToPublicArea(player, player.positionX, player.positionY, player.positionZ, player.rotation);
}
public void WarpToPublicArea(Player player, float x, float y, float z, float rotation)
{
if (player.CurrentArea.IsPrivate())
DoZoneChange(player, player.CurrentArea.ZoneId, null, 0, 15, x, y, z, rotation);
}
//Moves actor to new zone, and sends packets to spawn at the given coords.
public void DoZoneChangeContent(Player player, PrivateAreaContent contentArea, float spawnX, float spawnY, float spawnZ, float spawnRotation, ushort spawnType = SetActorPositionPacket.SPAWNTYPE_WARP_DUTY)
{