mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-22 20:57:47 +00:00
Moved the warp and send packet code out of packet processor and into the server object. Rewrote the warp command to use the world manager (still working on it). Add a playmusic command.
This commit is contained in:
parent
d90dc0cb80
commit
3fcc9eea49
3 changed files with 48 additions and 78 deletions
|
@ -361,77 +361,5 @@ namespace FFXIVClassic_Lobby_Server
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
public Actor findActor(ConnectedPlayer player, uint id)
|
||||
{
|
||||
Actor ownerActor = mStaticActors[id];
|
||||
if (ownerActor == null)
|
||||
{
|
||||
foreach (Actor a in player.actorInstanceList)
|
||||
{
|
||||
if (a.actorID == player.eventCurrentOwner)
|
||||
{
|
||||
ownerActor = a;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (ownerActor == null)
|
||||
return null;
|
||||
}
|
||||
return ownerActor;
|
||||
}
|
||||
*/
|
||||
private void initNpcs()
|
||||
{
|
||||
/*
|
||||
List<Npc> npcList = Database.getNpcList();
|
||||
foreach (Npc npc in npcList)
|
||||
inn.addActorToZone(npc);
|
||||
Log.info(String.Format("Loaded {0} npcs...", npcList.Count));
|
||||
* */
|
||||
}
|
||||
|
||||
private void loadTest(ClientConnection client, ConnectedPlayer player)
|
||||
{
|
||||
string sequence = "6789abcdefghijklmnopqrsuvwxy";
|
||||
//10 for just login
|
||||
for (int i = 7; i < sequence.Length; i++)
|
||||
{
|
||||
|
||||
BasePacket packet = new BasePacket("./packets/tt2/" + sequence[i]);
|
||||
packet.replaceActorID(player.actorID);
|
||||
client.queuePacket(packet);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void doWarp(uint mapID, float x, float y, float z)
|
||||
{
|
||||
List<SubPacket> pList = new List<SubPacket>();
|
||||
|
||||
|
||||
foreach (KeyValuePair<uint, ConnectedPlayer> entry in mPlayers)
|
||||
{
|
||||
pList.Clear();
|
||||
|
||||
entry.Value.getActor().positionX = x;
|
||||
entry.Value.getActor().positionY = y;
|
||||
entry.Value.getActor().positionZ = z;
|
||||
|
||||
pList.Add(_0xE2Packet.buildPacket(0x6c, 0xF));
|
||||
pList.Add(SetMapPacket.buildPacket(0x6c, mapID, 0));
|
||||
BasePacket packet = BasePacket.createPacket(pList, true, false);
|
||||
|
||||
BasePacket actorPacket = entry.Value.getActor().getInitPackets(entry.Value.actorID);
|
||||
|
||||
packet.replaceActorID(entry.Value.actorID);
|
||||
actorPacket.replaceActorID(entry.Value.actorID);
|
||||
|
||||
entry.Value.queuePacket(packet);
|
||||
entry.Value.queuePacket(actorPacket);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,8 +87,19 @@ namespace FFXIVClassic_Lobby_Server
|
|||
Log.error("Could not load packet: " + e);
|
||||
}
|
||||
}
|
||||
else if (split[0].Equals("music"))
|
||||
{
|
||||
try
|
||||
{
|
||||
server.doMusic(split[1]);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.error("Could not change music: " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (split.Length >= 3)
|
||||
if (split.Length >= 3)
|
||||
{
|
||||
if (split[0].Equals("warp"))
|
||||
{
|
||||
|
|
|
@ -13,6 +13,7 @@ using System.IO;
|
|||
using FFXIVClassic_Map_Server.packets.send.actor;
|
||||
using FFXIVClassic_Map_Server;
|
||||
using FFXIVClassic_Map_Server.actors;
|
||||
using FFXIVClassic_Map_Server.packets.send;
|
||||
|
||||
namespace FFXIVClassic_Lobby_Server
|
||||
{
|
||||
|
@ -266,12 +267,42 @@ namespace FFXIVClassic_Lobby_Server
|
|||
}
|
||||
}
|
||||
|
||||
public void doWarp(String map, String x, String y, String z)
|
||||
public void doMusic(string music)
|
||||
{
|
||||
if (map.ToLower().StartsWith("0x"))
|
||||
mProcessor.doWarp(Convert.ToUInt32(map, 16), Single.Parse(x), Single.Parse(y), Single.Parse(z));
|
||||
ushort musicId;
|
||||
|
||||
if (music.ToLower().StartsWith("0x"))
|
||||
musicId = Convert.ToUInt16(music, 16);
|
||||
else
|
||||
mProcessor.doWarp(Convert.ToUInt32(map), Single.Parse(x), Single.Parse(y), Single.Parse(z));
|
||||
musicId = Convert.ToUInt16(music);
|
||||
|
||||
foreach (KeyValuePair<uint, ConnectedPlayer> entry in mConnectedPlayerList)
|
||||
{
|
||||
BasePacket musicPacket = BasePacket.createPacket(SetMusicPacket.buildPacket(entry.Value.actorID, musicId, 1), true, false);
|
||||
entry.Value.queuePacket(musicPacket);
|
||||
}
|
||||
}
|
||||
|
||||
public void doWarp(string map, string sx, string sy, string sz)
|
||||
{
|
||||
uint mapId;
|
||||
float x,y,z;
|
||||
|
||||
if (map.ToLower().StartsWith("0x"))
|
||||
mapId = Convert.ToUInt32(map, 16);
|
||||
else
|
||||
mapId = Convert.ToUInt32(map);
|
||||
|
||||
x = Single.Parse(sx);
|
||||
y = Single.Parse(sy);
|
||||
z = Single.Parse(sz);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
public WorldManager GetWorldManager()
|
||||
|
|
Loading…
Add table
Reference in a new issue