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

Fixed emotes not being sent to the emoter. Fixed appearance packets' gloves/legs being ordered wrong. Chat is implemented. Changed commands to start with '!'.

This commit is contained in:
Filip Maj 2016-02-18 22:38:54 -05:00
parent c6ac8b2f14
commit a47d5f96a5
8 changed files with 86 additions and 43 deletions

View file

@ -233,14 +233,14 @@ namespace FFXIVClassic_Lobby_Server
offHand,
head,
body,
hands,
legs,
hands,
feet,
waist,
leftFinger,
rightFinger,
leftEars,
rightEars
leftEar,
rightEar
FROM characters_appearance WHERE characterId = @charId";
cmd = new MySqlCommand(query, conn);

View file

@ -158,7 +158,13 @@ namespace FFXIVClassic_Lobby_Server
}
else if (subpacket.header.type == 0x03)
{
ConnectedPlayer player = mPlayers[client.owner];
ConnectedPlayer player = null;
if(mPlayers.ContainsKey(client.owner))
player = mPlayers[client.owner];
if (player == null)
return;
//Normal Game Opcode
switch (subpacket.gameMessage.opcode)
@ -181,9 +187,15 @@ namespace FFXIVClassic_Lobby_Server
case 0x0003:
ChatMessagePacket chatMessage = new ChatMessagePacket(subpacket.data);
Log.info(String.Format("Got type-{5} message: {0} @ {1}, {2}, {3}, Rot: {4}", chatMessage.message, chatMessage.posX, chatMessage.posY, chatMessage.posZ, chatMessage.posRot, chatMessage.logType));
//subpacket.debugPrintSubPacket();
subpacket.debugPrintSubPacket();
mServer.doCommand(chatMessage.message, player);
if (chatMessage.message.StartsWith("!"))
{
if (mServer.doCommand(chatMessage.message, player))
continue;
}
player.getActor().broadcastPacket(SendMessagePacket.buildPacket(player.actorID, player.actorID, chatMessage.logType, player.getActor().customDisplayName, chatMessage.message), false);
break;
//Unknown
@ -203,7 +215,7 @@ namespace FFXIVClassic_Lobby_Server
SetTargetPacket setTarget = new SetTargetPacket(subpacket.data);
player.getActor().currentTarget = setTarget.actorID;
client.queuePacket(BasePacket.createPacket(SetActorTargetAnimatedPacket.buildPacket(player.actorID, player.actorID, setTarget.actorID), true, false));
player.getActor().broadcastPacket(SetActorTargetAnimatedPacket.buildPacket(player.actorID, player.actorID, setTarget.actorID), true);
break;
//Lock Target
case 0x00CC:

View file

@ -205,8 +205,6 @@ namespace FFXIVClassic_Lobby_Server
if (offset < bytesRead)
Array.Copy(conn.buffer, offset, conn.buffer, 0, bytesRead - offset);
Array.Clear(conn.buffer, bytesRead - offset, conn.buffer.Length - (bytesRead - offset));
conn.lastPartialSize = bytesRead - offset;
//Build any queued subpackets into basepackets and send
@ -573,9 +571,11 @@ namespace FFXIVClassic_Lobby_Server
}
}
internal void doCommand(string input, ConnectedPlayer client)
internal bool doCommand(string input, ConnectedPlayer client)
{
input.Trim();
if (input.StartsWith("!"))
input = input.Substring(1);
String[] split = input.Split(' ');
@ -586,6 +586,7 @@ namespace FFXIVClassic_Lobby_Server
try
{
printPos(client);
return true;
}
catch (Exception e)
{
@ -603,15 +604,17 @@ namespace FFXIVClassic_Lobby_Server
client.queuePacket(BasePacket.createPacket(SendMessagePacket.buildPacket(client.actorID, client.actorID, SendMessagePacket.MESSAGE_TYPE_GENERAL_INFO, "", String.Format("Resting zone {0}...", client.getActor().zoneId)), true, false));
}
mWorldManager.reloadZone(client.getActor().zoneId);
return true;
}
else if (split[0].Equals("sendpacket"))
{
if (split.Length < 2)
return;
return false;
try
{
sendPacket(client, "./packets/" + split[1]);
return true;
}
catch (Exception e)
{
@ -628,6 +631,7 @@ namespace FFXIVClassic_Lobby_Server
giveItem(client, UInt32.Parse(split[1]), Int32.Parse(split[2]));
else if (split.Length == 4)
giveItem(client, UInt32.Parse(split[1]), Int32.Parse(split[2]), UInt16.Parse(split[3]));
return true;
}
catch (Exception e)
{
@ -637,7 +641,7 @@ namespace FFXIVClassic_Lobby_Server
else if (split[0].Equals("removeitem"))
{
if (split.Length < 2)
return;
return false;
try
{
@ -647,6 +651,7 @@ namespace FFXIVClassic_Lobby_Server
removeItem(client, UInt32.Parse(split[1]), Int32.Parse(split[2]));
else if (split.Length == 4)
removeItem(client, UInt32.Parse(split[1]), Int32.Parse(split[2]), UInt16.Parse(split[3]));
return true;
}
catch (Exception e)
{
@ -668,12 +673,13 @@ namespace FFXIVClassic_Lobby_Server
else if (split[0].Equals("removekeyitem"))
{
if (split.Length < 2)
return;
return false;
try
{
if (split.Length == 2)
removeKeyItem(client, UInt32.Parse(split[1]));
return true;
}
catch (Exception e)
{
@ -697,7 +703,7 @@ namespace FFXIVClassic_Lobby_Server
else if (split[0].Equals("removecurrancy"))
{
if (split.Length < 2)
return;
return false;
try
{
@ -705,6 +711,7 @@ namespace FFXIVClassic_Lobby_Server
removeCurrancy(client, UInt32.Parse(split[1]), 1);
else if (split.Length == 3)
removeCurrancy(client, UInt32.Parse(split[1]), Int32.Parse(split[2]));
return true;
}
catch (Exception e)
{
@ -714,11 +721,12 @@ namespace FFXIVClassic_Lobby_Server
else if (split[0].Equals("music"))
{
if (split.Length < 2)
return;
return false;
try
{
doMusic(client, split[1]);
return true;
}
catch (Exception e)
{
@ -731,13 +739,16 @@ namespace FFXIVClassic_Lobby_Server
doWarp(client, split[1]);
else if (split.Length == 5)
doWarp(client, split[1], split[2], split[3], split[4]);
return true;
}
else if (split[0].Equals("property"))
{
if (split.Length == 5)
testCodePacket(Utils.MurmurHash2(split[1], 0), Convert.ToUInt32(split[2], 16), split[3]);
return true;
}
}
return false;
}
}

View file

@ -216,6 +216,16 @@ namespace FFXIVClassic_Map_Server.Actors
}
}
//Remove players if isolation zone
if (isIsolated)
{
for (int i = 0; i < result.Count; i++)
{
if (result[i] is Player)
result.RemoveAt(i);
}
}
return result;
}
@ -306,11 +316,17 @@ namespace FFXIVClassic_Map_Server.Actors
public void broadcastPacketAroundActor(Actor actor, SubPacket packet)
{
if (isIsolated)
return;
List<Actor> aroundActor = getActorsAroundActor(actor, 50);
foreach (Actor a in aroundActor)
{
if (a is Player)
{
if (isIsolated && packet.header.sourceId != a.actorId)
continue;
SubPacket clonedPacket = new SubPacket(packet, actor.actorId);
Player p = (Player)a;
p.queuePacket(clonedPacket);

View file

@ -129,8 +129,8 @@ namespace FFXIVClassic_Map_Server.Actors
feet,
waist,
neck,
leftEars,
rightEars,
leftEar,
rightEar,
leftIndex,
rightIndex,
leftFinger,

View file

@ -538,8 +538,11 @@ namespace FFXIVClassic_Map_Server.Actors
playerSession.queuePacket(packet, true, false);
}
public void broadcastPacket(SubPacket packet)
public void broadcastPacket(SubPacket packet, bool sendToSelf)
{
if (sendToSelf)
queuePacket(packet);
foreach (Actor a in playerSession.actorInstanceList)
{
if (a is Player)
@ -598,7 +601,7 @@ namespace FFXIVClassic_Map_Server.Actors
public void doEmote(uint emoteId)
{
broadcastPacket(ActorDoEmotePacket.buildPacket(actorId, actorId, emoteId));
broadcastPacket(ActorDoEmotePacket.buildPacket(actorId, actorId, currentTarget, emoteId), true);
}
public void sendGameMessage(Actor sourceActor, Actor textIdOwner, ushort textId, byte log, params object[] msgParams)

View file

@ -13,26 +13,27 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
public const ushort OPCODE = 0x00E1;
public const uint PACKET_SIZE = 0x30;
public static SubPacket buildPacket(uint playerActorID, uint targetActorID, uint emoteID)
public static SubPacket buildPacket(uint sourceActorId, uint targetActorId, uint targettedActorId, uint emoteID)
{
byte[] data = new byte[PACKET_SIZE - 0x20];
if (targetActorID == 0xC0000000)
targetActorID = playerActorID;
if (targettedActorId == 0xC0000000)
targettedActorId = sourceActorId;
using (MemoryStream mem = new MemoryStream(data))
{
using (BinaryWriter binWriter = new BinaryWriter(mem))
{
uint realAnimID = 0x5000000 | ((emoteID - 100) << 12);
uint realDescID = 20000 + ((emoteID - 1) * 10) + (targetActorID == playerActorID ? (uint)2 : (uint)1);
uint realDescID = 20000 + ((emoteID - 1) * 10) + (targettedActorId == sourceActorId ? (uint)2 : (uint)1);
binWriter.Write((UInt32)realAnimID);
binWriter.Write((UInt32)targetActorID);
binWriter.Write((UInt32)targettedActorId);
binWriter.Write((UInt32)realDescID);
}
}
SubPacket packet = new SubPacket(OPCODE, playerActorID, targetActorID, data);
SubPacket packet = new SubPacket(OPCODE, sourceActorId, targetActorId, data);
packet.debugPrintSubPacket();
return packet;
}
}

View file

@ -21,19 +21,19 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
public const int WEAPON1 = 5;
public const int WEAPON2 = 6;
public const int WEAPON3 = 7;
public const int HEADGEAR = 8;
public const int BODYGEAR = 9;
public const int LEGSGEAR = 10;
public const int HANDSGEAR = 11;
public const int FEETGEAR = 12;
public const int WAISTGEAR = 13;
public const int UNKNOWN1 = 14;
public const int R_EAR = 15;
public const int L_EAR = 16;
public const int UNKNOWN2 = 17;
public const int UNKNOWN3 = 18;
public const int R_FINGER = 19;
public const int L_FINGER = 20;
public const int HEADGEAR = 12;
public const int BODYGEAR = 13;
public const int LEGSGEAR = 14;
public const int HANDSGEAR = 15;
public const int FEETGEAR = 16;
public const int WAISTGEAR = 17;
public const int UNKNOWN1 = 18;
public const int R_EAR = 19;
public const int L_EAR = 20;
public const int UNKNOWN2 = 21;
public const int UNKNOWN3 = 22;
public const int R_FINGER = 23;
public const int L_FINGER = 24;
public uint modelID;
public uint[] appearanceIDs;