Got warp working. BROKE ACTOR SPAWNING!

This commit is contained in:
Filip Maj 2016-01-08 21:37:09 -05:00
parent 360d72b376
commit fac9d28529
11 changed files with 137 additions and 14 deletions

View File

@ -201,6 +201,7 @@
<Compile Include="packets\send\supportdesk\FaqListResponsePacket.cs" />
<Compile Include="packets\send\supportdesk\GMTicketPacket.cs" />
<Compile Include="packets\send\supportdesk\GMTicketSentResponsePacket.cs" />
<Compile Include="packets\send\_0xE2Packet.cs" />
<Compile Include="packets\SubPacket.cs" />
<Compile Include="packets\receive\PingPacket.cs" />
<Compile Include="packets\receive\UpdatePlayerPositionPacket.cs" />

View File

@ -185,10 +185,8 @@ namespace FFXIVClassic_Lobby_Server
break;
//Unknown
case 0x0002:
BasePacket block132 = new BasePacket("./packets/tt2/4");
BasePacket packet196 = new BasePacket("./packets/196");
BasePacket reply6 = new BasePacket("./packets/login/login6_data.bin");
BasePacket reply7 = new BasePacket("./packets/login/login7_data.bin");
BasePacket reply8 = new BasePacket("./packets/login/login8_data.bin");
BasePacket reply9 = new BasePacket("./packets/login/login9_zonesetup.bin");
@ -203,9 +201,7 @@ namespace FFXIVClassic_Lobby_Server
//currancy.replaceActorID(player.actorID);
//keyitems.replaceActorID(player.actorID);
block132.replaceActorID(player.actorID);
packet196.replaceActorID(player.actorID);
reply6.replaceActorID(player.actorID);
reply7.replaceActorID(player.actorID);
reply8.replaceActorID(player.actorID);
reply9.replaceActorID(player.actorID);
@ -221,9 +217,6 @@ namespace FFXIVClassic_Lobby_Server
client.queuePacket(SetMusicPacket.buildPacket(player.actorID, 0x3D, 0x01), true, false);
client.queuePacket(SetWeatherPacket.buildPacket(player.actorID, SetWeatherPacket.WEATHER_CLEAR), true, false);
// client.queuePacket(reply6);
//client.queuePacket(block132);
BasePacket actorPacket = player.getActor().getInitPackets(player.actorID);
actorPacket.debugPrintPacket();
client.queuePacket(actorPacket);
@ -340,7 +333,7 @@ namespace FFXIVClassic_Lobby_Server
book.cutsceneFlags[i] = true;
client.queuePacket(book.buildPacket(player.actorID), true, false);
client.queuePacket(SetPlayerDreamPacket.buildPacket(player.actorID, 11), true, false);
//client.queuePacket(SetPlayerDreamPacket.buildPacket(player.actorID, 11), true, false);
//BasePacket packet1a5 = new BasePacket("./packets/1ax/1a5");
//packet1a5.replaceActorID(player.actorID);
@ -587,5 +580,35 @@ namespace FFXIVClassic_Lobby_Server
}
}
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.getConnection2().queuePacket(packet);
actorPacket.debugPrintPacket();
entry.Value.getConnection2().queuePacket(actorPacket);
}
}
}
}

View File

@ -16,6 +16,14 @@ namespace FFXIVClassic_Lobby_Server
static void Main(string[] args)
{
Console.WriteLine("{0:x}", Utils.MurmurHash2("playerWork.questScenario[0]", 0));
Console.WriteLine("{0:x}", Utils.MurmurHash2("work.dispPlayer[0]", 0));
Console.WriteLine("{0:x}", Utils.MurmurHash2("work.dispTarget[0]", 0));
Console.WriteLine("{0:x}", Utils.MurmurHash2("work.dispName[0]", 0));
Console.WriteLine("{0:x}", Utils.MurmurHash2("work.dispHead[0]", 0));
Console.WriteLine("{0:x}", Utils.MurmurHash2("work.server", 0));
#if DEBUG
TextWriterTraceListener myWriter = new TextWriterTraceListener(System.Console.Out);
Debug.Listeners.Add(myWriter);
@ -86,6 +94,10 @@ namespace FFXIVClassic_Lobby_Server
Log.error("Could not load packet: " + e);
}
}
else if (split[0].Equals("warp"))
{
server.doWarp(split[1], split[2], split[3], split[4]);
}
else if (split[0].Equals("property"))
{
server.testCodePacket(Utils.MurmurHash2(split[1], 0), Convert.ToUInt32(split[2], 16), split[3]);

View File

@ -263,5 +263,10 @@ namespace FFXIVClassic_Lobby_Server
}
}
public void doWarp(String map, String x, String y, String z)
{
mProcessor.doWarp(Convert.ToUInt32(map), Single.Parse(x), Single.Parse(y), Single.Parse(z));
}
}
}

View File

@ -26,8 +26,7 @@ namespace FFXIVClassic_Map_Server.dataobjects
public uint currentMainState = SetActorStatePacket.MAIN_STATE_PASSIVE;
public uint currentSubState = SetActorStatePacket.SUB_STATE_NONE;
public float positionX, positionY, positionZ, rotation;
public float positionX = SetActorPositionPacket.INNPOS_X, positionY = SetActorPositionPacket.INNPOS_Y, positionZ = SetActorPositionPacket.INNPOS_Z, rotation = SetActorPositionPacket.INNPOS_ROT;
public float oldPositionX, oldPositionY, oldPositionZ, oldRotation;
public ushort moveState, oldMoveState;
@ -35,6 +34,8 @@ namespace FFXIVClassic_Map_Server.dataobjects
public bool isZoning = false;
public bool spawnedFirstTime = false;
public string className;
public List<LuaParam> classParams;
@ -62,6 +63,8 @@ namespace FFXIVClassic_Map_Server.dataobjects
{
return SetActorPositionPacket.buildPacket(actorId, playerActorId, SetActorPositionPacket.INNPOS_X, SetActorPositionPacket.INNPOS_Y, SetActorPositionPacket.INNPOS_Z, SetActorPositionPacket.INNPOS_ROT, SetActorPositionPacket.SPAWNTYPE_PLAYERWAKE);
//return SetActorPositionPacket.buildPacket(actorId, playerActorId, -211.895477f, 190.000000f, 29.651011f, 2.674819f, SetActorPositionPacket.SPAWNTYPE_PLAYERWAKE);
//spawnedFirstTime = true;
//return spawnPacket;
}
public SubPacket createPositionUpdatePacket(uint playerActorId)
@ -122,3 +125,4 @@ namespace FFXIVClassic_Map_Server.dataobjects
}
}

View File

@ -1,7 +1,9 @@
using FFXIVClassic_Lobby_Server;
using FFXIVClassic_Lobby_Server.common;
using FFXIVClassic_Lobby_Server.dataobjects;
using FFXIVClassic_Lobby_Server.packets;
using FFXIVClassic_Map_Server.lua;
using FFXIVClassic_Map_Server.packets.send.actor;
using System;
using System.Collections.Generic;
using System.Linq;
@ -58,5 +60,32 @@ namespace FFXIVClassic_Map_Server.dataobjects.chara.npc
appearanceIDs[L_FINGER] = appearance.leftFinger;
}
public override SubPacket createScriptBindPacket(uint playerActorId)
{
List<LuaParam> lParams;
lParams = LuaUtils.createLuaParamList("/Chara/Player/Player_work", false, false, false, false, false, true);
return ActorInstantiatePacket.buildPacket(actorId, playerActorId, actorName, className, lParams);
}
public override BasePacket getInitPackets(uint playerActorId)
{
List<SubPacket> subpackets = new List<SubPacket>();
subpackets.Add(createAddActorPacket(playerActorId));
subpackets.Add(createSpeedPacket(playerActorId));
subpackets.Add(createSpawnPositonPacket(playerActorId, 0xFF));
subpackets.Add(createAppearancePacket(playerActorId));
subpackets.Add(createNamePacket(playerActorId));
subpackets.Add(createStatePacket(playerActorId));
subpackets.Add(createIdleAnimationPacket(playerActorId));
subpackets.Add(createInitStatusPacket(playerActorId));
subpackets.Add(createSetActorIconPacket(playerActorId));
subpackets.Add(createIsZoneingPacket(playerActorId));
//subpackets.Add(createScriptBindPacket(playerActorId));
return BasePacket.createPacket(subpackets, true, false);
}
}
}

View File

@ -15,6 +15,30 @@ namespace FFXIVClassic_Map_Server.dataobjects.chara
{
class Player : Character
{
public const int TIMER_TOTORAK = 0;
public const int TIMER_DZEMAEL = 1;
public const int TIMER_BOWL_OF_EMBERS_HARD = 2;
public const int TIMER_BOWL_OF_EMBERS = 3;
public const int TIMER_THORNMARCH = 4;
public const int TIMER_AURUMVALE = 5;
public const int TIMER_CUTTERSCRY = 6;
public const int TIMER_BATTLE_ALEPORT = 7;
public const int TIMER_BATTLE_HYRSTMILL = 8;
public const int TIMER_BATTLE_GOLDENBAZAAR = 9;
public const int TIMER_HOWLING_EYE_HARD = 10;
public const int TIMER_HOWLING_EYE = 11;
public const int TIMER_CASTRUM_TOWER = 12;
public const int TIMER_BOWL_OF_EMBERS_EXTREME = 13;
public const int TIMER_RIVENROAD = 14;
public const int TIMER_RIVENROAD_HARD = 15;
public const int TIMER_BEHEST = 16;
public const int TIMER_COMPANYBEHEST = 17;
public const int TIMER_RETURN = 18;
public const int TIMER_SKIRMISH = 19;
public uint[] timers = new uint[20];
PlayerWork playerWork = new PlayerWork();
public Player(uint actorID) : base(actorID)

View File

@ -101,11 +101,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()

View File

@ -44,7 +44,8 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
binWriter.BaseStream.Seek(0x24, SeekOrigin.Begin);
binWriter.Write((UInt32)spawnType);
binWriter.Write((UInt16)spawnType);
binWriter.Write((UInt16)(0));
}
}

View File

@ -23,7 +23,7 @@ namespace FFXIVClassic_Map_Server.packets.send
{
binWriter.Write((uint)mapID);
binWriter.Write((uint)regionID);
binWriter.Write((uint)0x28);
binWriter.Write((uint)0x0);
}
}

View File

@ -0,0 +1,22 @@
using FFXIVClassic_Lobby_Server.packets;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.packets.send
{
class _0xE2Packet
{
public const ushort OPCODE = 0x00E2;
public const uint PACKET_SIZE = 0x28;
public static SubPacket buildPacket(uint playerActorID, int val)
{
byte[] data = new byte[PACKET_SIZE - 0x20];
data[0] = (Byte) (val & 0xFF);
return new SubPacket(OPCODE, playerActorID, playerActorID, data);
}
}
}