1
Fork 0
mirror of https://bitbucket.org/Ioncannon/project-meteor-server.git synced 2025-04-23 13:17:45 +00:00

Added two new commands; warp by zone entrance and a getpos command. Fixed character actor not appearing on zone... 0x2 packet only sent on login. Added spawnType to getSpawnPackets.

This commit is contained in:
Filip Maj 2016-01-20 00:02:57 -05:00
parent 3fcc9eea49
commit 02b90edd3f
7 changed files with 78 additions and 16 deletions

View file

@ -74,6 +74,20 @@ namespace FFXIVClassic_Lobby_Server
String input = Console.ReadLine();
String[] split = input.Split(' ');
if (split.Length >= 1)
{
if (split[0].Equals("mypos"))
{
try
{
server.printPos();
}
catch (Exception e)
{
Log.error("Could not load packet: " + e);
}
}
}
if (split.Length >= 2)
{
if (split[0].Equals("sendpacket"))
@ -98,6 +112,10 @@ namespace FFXIVClassic_Lobby_Server
Log.error("Could not change music: " + e);
}
}
else if (split[0].Equals("warp"))
{
server.doWarp(split[1]);
}
}
if (split.Length >= 3)
{

View file

@ -14,6 +14,7 @@ using FFXIVClassic_Map_Server.packets.send.actor;
using FFXIVClassic_Map_Server;
using FFXIVClassic_Map_Server.actors;
using FFXIVClassic_Map_Server.packets.send;
using FFXIVClassic_Map_Server.dataobjects.chara;
namespace FFXIVClassic_Lobby_Server
{
@ -38,6 +39,7 @@ namespace FFXIVClassic_Lobby_Server
{
mWorldManager = new WorldManager(this);
mWorldManager.LoadZoneList();
mWorldManager.LoadZoneEntranceList();
IPEndPoint serverEndPoint = new System.Net.IPEndPoint(IPAddress.Parse(ConfigConstants.OPTIONS_BINDIP), FFXIV_MAP_PORT);
@ -283,6 +285,26 @@ namespace FFXIVClassic_Lobby_Server
}
}
public void doWarp(string entranceId)
{
uint id;
if (entranceId.ToLower().StartsWith("0x"))
id = Convert.ToUInt32(entranceId, 16);
else
id = Convert.ToUInt32(entranceId);
FFXIVClassic_Map_Server.WorldManager.ZoneEntrance ze = mWorldManager.getZoneEntrance(id);
if (ze == null)
return;
foreach (KeyValuePair<uint, ConnectedPlayer> entry in mConnectedPlayerList)
{
mWorldManager.DoZoneChange(entry.Value.getActor(), ze.zoneId, ze.spawnType, ze.spawnX, ze.spawnY, ze.spawnZ, 0.0f);
}
}
public void doWarp(string map, string sx, string sy, string sz)
{
uint mapId;
@ -299,8 +321,6 @@ namespace FFXIVClassic_Lobby_Server
foreach (KeyValuePair<uint, ConnectedPlayer> entry in mConnectedPlayerList)
{
BasePacket e2Packet = BasePacket.createPacket(_0xE2Packet.buildPacket(0x6c, 0xF), true, false);
entry.Value.queuePacket(e2Packet);
mWorldManager.DoZoneChange(entry.Value.getActor(), mapId, 0x2, x, y, z, 0.0f);
}
}
@ -310,6 +330,15 @@ namespace FFXIVClassic_Lobby_Server
return mWorldManager;
}
public void printPos()
{
foreach (KeyValuePair<uint, ConnectedPlayer> entry in mConnectedPlayerList)
{
Player p = entry.Value.getActor();
Log.info(String.Format("{0} position: {1}, {2}, {3}, {4}", p.customDisplayName, p.positionX, p.positionY, p.positionZ, p.rotation));
}
}
}
}

View file

@ -7,6 +7,7 @@ using FFXIVClassic_Map_Server.common.EfficientHashTables;
using FFXIVClassic_Map_Server.dataobjects;
using FFXIVClassic_Map_Server.dataobjects.chara;
using FFXIVClassic_Map_Server.packets.send;
using FFXIVClassic_Map_Server.packets.send.login;
using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
@ -187,7 +188,8 @@ namespace FFXIVClassic_Map_Server
player.rotation = spawnRotation;
//Send packets
player.sendZoneInPackets(this);
player.playerSession.queuePacket(_0xE2Packet.buildPacket(0x6c, 0xF), true, false);
player.sendZoneInPackets(this, spawnType);
}
//Login Zone In
@ -205,7 +207,8 @@ namespace FFXIVClassic_Map_Server
zone.addActorToZone(player);
//Send packets
player.sendZoneInPackets(this);
player.playerSession.queuePacket(_0x2Packet.buildPacket(player.actorId), true, false);
player.sendZoneInPackets(this, 0x1);
}
public Player GetPCInWorld(string name)
@ -265,6 +268,13 @@ namespace FFXIVClassic_Map_Server
}
}
public ZoneEntrance getZoneEntrance(uint entranceId)
{
if (zoneEntranceList.ContainsKey(entranceId))
return zoneEntranceList[entranceId];
else
return null;
}
}
}

View file

@ -69,7 +69,7 @@ namespace FFXIVClassic_Map_Server.dataobjects
{
SubPacket spawnPacket;
if (!spawnedFirstTime && playerActorId == actorId)
spawnPacket = SetActorPositionPacket.buildPacket(actorId, playerActorId, 0, positionX, positionY, positionZ, rotation, spawnType, false);
spawnPacket = SetActorPositionPacket.buildPacket(actorId, playerActorId, 0, positionX, positionY, positionZ, rotation, 0x1, false);
else if (playerActorId == actorId)
spawnPacket = SetActorPositionPacket.buildPacket(actorId, playerActorId, 0xFFFFFFFF, positionX, positionY, positionZ, rotation, spawnType, true);
else
@ -101,11 +101,16 @@ namespace FFXIVClassic_Map_Server.dataobjects
}
public virtual BasePacket getSpawnPackets(uint playerActorId)
{
return getSpawnPackets(playerActorId, 0x1);
}
public virtual BasePacket getSpawnPackets(uint playerActorId, uint spawnType)
{
List<SubPacket> subpackets = new List<SubPacket>();
subpackets.Add(createAddActorPacket(playerActorId));
subpackets.Add(createSpeedPacket(playerActorId));
subpackets.Add(createSpawnPositonPacket(playerActorId, 0x1));
subpackets.Add(createSpawnPositonPacket(playerActorId, spawnType));
subpackets.Add(createNamePacket(playerActorId));
subpackets.Add(createStatePacket(playerActorId));
subpackets.Add(createIsZoneingPacket(playerActorId));

View file

@ -89,7 +89,8 @@ namespace FFXIVClassic_Map_Server
public void addActorToZone(Actor actor)
{
mActorList.Add(actor.actorId, actor);
if (!mActorList.ContainsKey(actor.actorId))
mActorList.Add(actor.actorId, actor);
int gridX = (int)actor.positionX / boundingGridSize;
int gridY = (int)actor.positionZ / boundingGridSize;

View file

@ -145,14 +145,14 @@ namespace FFXIVClassic_Map_Server.dataobjects.chara
return ActorInstantiatePacket.buildPacket(actorId, playerActorId, actorName, className, lParams);
}
public override BasePacket getSpawnPackets(uint playerActorId)
public override BasePacket getSpawnPackets(uint playerActorId, uint spawnType)
{
List<SubPacket> subpackets = new List<SubPacket>();
subpackets.Add(createAddActorPacket(playerActorId));
if (isMyPlayer(playerActorId))
subpackets.AddRange(create0x132Packets(playerActorId));
subpackets.Add(createSpeedPacket(playerActorId));
subpackets.Add(createSpawnPositonPacket(playerActorId, 0x1));
subpackets.Add(createSpawnPositonPacket(playerActorId, spawnType));
subpackets.Add(createAppearancePacket(playerActorId));
subpackets.Add(createNamePacket(playerActorId));
subpackets.Add(_0xFPacket.buildPacket(playerActorId, playerActorId));
@ -363,14 +363,13 @@ namespace FFXIVClassic_Map_Server.dataobjects.chara
return propPacketUtil.done();
}
public void sendZoneInPackets(WorldManager world)
public void sendZoneInPackets(WorldManager world, ushort spawnType)
{
playerSession.queuePacket(SetMapPacket.buildPacket(actorId, zone.regionId, zone.actorId), true, false);
playerSession.queuePacket(_0x2Packet.buildPacket(actorId), true, false);
playerSession.queuePacket(SetMusicPacket.buildPacket(actorId, 0x3D, 0x01), true, false);
playerSession.queuePacket(SetMapPacket.buildPacket(actorId, zone.regionId, zone.actorId), true, false);
playerSession.queuePacket(SetMusicPacket.buildPacket(actorId, zone.bgmDay, 0x01), true, false);
playerSession.queuePacket(SetWeatherPacket.buildPacket(actorId, SetWeatherPacket.WEATHER_CLEAR), true, false);
playerSession.queuePacket(getSpawnPackets(actorId));
playerSession.queuePacket(getSpawnPackets(actorId, spawnType));
#region grouptest
//Retainers

View file

@ -73,13 +73,13 @@ namespace FFXIVClassic_Map_Server.dataobjects
public void updatePlayerActorPosition(float x, float y, float z, float rot, ushort moveState)
{
/*
playerActor.positionX = x;
playerActor.positionY = y;
playerActor.positionZ = z;
playerActor.rotation = rot;
playerActor.moveState = moveState;
*/
}
public void sendMotd()