Added director related code to player and packet processor. Cleaned up some debug messages. Added a flag when a player is "zoning in".

This commit is contained in:
Filip Maj 2016-03-28 11:31:21 -04:00
parent f8ab0cd86d
commit a30311d12a
10 changed files with 106 additions and 17 deletions

View File

@ -638,6 +638,9 @@ namespace FFXIVClassic_Lobby_Server
{ {
int index = reader.GetUInt16(0); int index = reader.GetUInt16(0);
player.playerWork.questScenario[index] = 0xA0F00000 | reader.GetUInt32(1); player.playerWork.questScenario[index] = 0xA0F00000 | reader.GetUInt32(1);
string questName = Server.getStaticActors(player.playerWork.questScenario[index]).actorName;
player.questScenario[index] = new Quest(player.playerWork.questScenario[index], questName);
} }
} }

View File

@ -117,6 +117,7 @@
<Compile Include="packets\receive\events\EventUpdatePacket.cs" /> <Compile Include="packets\receive\events\EventUpdatePacket.cs" />
<Compile Include="packets\receive\events\EventStartPacket.cs" /> <Compile Include="packets\receive\events\EventStartPacket.cs" />
<Compile Include="packets\receive\HandshakePacket.cs" /> <Compile Include="packets\receive\HandshakePacket.cs" />
<Compile Include="packets\receive\LangaugeCodePacket.cs" />
<Compile Include="packets\receive\ParameterDataRequestPacket.cs" /> <Compile Include="packets\receive\ParameterDataRequestPacket.cs" />
<Compile Include="packets\receive\recruitment\RecruitmentDetailsRequestPacket.cs" /> <Compile Include="packets\receive\recruitment\RecruitmentDetailsRequestPacket.cs" />
<Compile Include="packets\receive\recruitment\RecruitmentSearchRequestPacket.cs" /> <Compile Include="packets\receive\recruitment\RecruitmentSearchRequestPacket.cs" />
@ -129,6 +130,7 @@
<Compile Include="packets\receive\supportdesk\FaqListRequestPacket.cs" /> <Compile Include="packets\receive\supportdesk\FaqListRequestPacket.cs" />
<Compile Include="packets\receive\supportdesk\GMSupportTicketPacket.cs" /> <Compile Include="packets\receive\supportdesk\GMSupportTicketPacket.cs" />
<Compile Include="packets\receive\supportdesk\GMTicketIssuesRequestPacket.cs" /> <Compile Include="packets\receive\supportdesk\GMTicketIssuesRequestPacket.cs" />
<Compile Include="packets\receive\_0x07Packet.cs" />
<Compile Include="packets\send\actor\ActorDoEmotePacket.cs" /> <Compile Include="packets\send\actor\ActorDoEmotePacket.cs" />
<Compile Include="packets\send\actor\ActorInstantiatePacket.cs" /> <Compile Include="packets\send\actor\ActorInstantiatePacket.cs" />
<Compile Include="packets\send\actor\BattleAction1Packet.cs" /> <Compile Include="packets\send\actor\BattleAction1Packet.cs" />
@ -239,6 +241,7 @@
<Compile Include="packets\send\supportdesk\FaqListResponsePacket.cs" /> <Compile Include="packets\send\supportdesk\FaqListResponsePacket.cs" />
<Compile Include="packets\send\supportdesk\GMTicketPacket.cs" /> <Compile Include="packets\send\supportdesk\GMTicketPacket.cs" />
<Compile Include="packets\send\supportdesk\GMTicketSentResponsePacket.cs" /> <Compile Include="packets\send\supportdesk\GMTicketSentResponsePacket.cs" />
<Compile Include="packets\send\_0x02Packet.cs" />
<Compile Include="packets\send\_0xE2Packet.cs" /> <Compile Include="packets\send\_0xE2Packet.cs" />
<Compile Include="packets\SubPacket.cs" /> <Compile Include="packets\SubPacket.cs" />
<Compile Include="packets\receive\PingPacket.cs" /> <Compile Include="packets\receive\PingPacket.cs" />

View File

@ -177,6 +177,7 @@ namespace FFXIVClassic_Lobby_Server
//Unknown //Unknown
case 0x0002: case 0x0002:
subpacket.debugPrintSubPacket();
client.queuePacket(SendMessagePacket.buildPacket(player.actorID, player.actorID, SendMessagePacket.MESSAGE_TYPE_GENERAL_INFO, "", "-------- Login Message --------\nWelcome to the 1.0 Dev Server"), true, false); client.queuePacket(SendMessagePacket.buildPacket(player.actorID, player.actorID, SendMessagePacket.MESSAGE_TYPE_GENERAL_INFO, "", "-------- Login Message --------\nWelcome to the 1.0 Dev Server"), true, false);
Server.GetWorldManager().DoLogin(player.getActor()); Server.GetWorldManager().DoLogin(player.getActor());
@ -196,9 +197,16 @@ namespace FFXIVClassic_Lobby_Server
player.getActor().broadcastPacket(SendMessagePacket.buildPacket(player.actorID, player.actorID, chatMessage.logType, player.getActor().customDisplayName, chatMessage.message), false); player.getActor().broadcastPacket(SendMessagePacket.buildPacket(player.actorID, player.actorID, chatMessage.logType, player.getActor().customDisplayName, chatMessage.message), false);
break;
//Langauge Code
case 0x0006:
LangaugeCodePacket langCode = new LangaugeCodePacket(subpacket.data);
player.languageCode = langCode.languageCode;
break; break;
//Unknown //Unknown
case 0x0007: case 0x0007:
subpacket.debugPrintSubPacket();
_0x07Packet unknown07 = new _0x07Packet(subpacket.data);
break; break;
//Update Position //Update Position
case 0x00CA: case 0x00CA:
@ -207,6 +215,10 @@ namespace FFXIVClassic_Lobby_Server
UpdatePlayerPositionPacket posUpdate = new UpdatePlayerPositionPacket(subpacket.data); UpdatePlayerPositionPacket posUpdate = new UpdatePlayerPositionPacket(subpacket.data);
player.updatePlayerActorPosition(posUpdate.x, posUpdate.y, posUpdate.z, posUpdate.rot, posUpdate.moveState); player.updatePlayerActorPosition(posUpdate.x, posUpdate.y, posUpdate.z, posUpdate.rot, posUpdate.moveState);
player.getActor().sendInstanceUpdate(); player.getActor().sendInstanceUpdate();
if (player.getActor().isInZoneChange())
player.getActor().setZoneChanging(false);
break; break;
//Set Target //Set Target
case 0x00CD: case 0x00CD:
@ -245,11 +257,18 @@ namespace FFXIVClassic_Lobby_Server
Actor ownerActor = Server.getStaticActors(player.getActor().eventCurrentOwner); Actor ownerActor = Server.getStaticActors(player.getActor().eventCurrentOwner);
if (ownerActor == null) if (ownerActor == null)
{ {
//Is it a instance actor?
ownerActor = Server.GetWorldManager().GetActorInWorld(player.getActor().eventCurrentOwner); ownerActor = Server.GetWorldManager().GetActorInWorld(player.getActor().eventCurrentOwner);
if (ownerActor == null) if (ownerActor == null)
{ {
Log.debug(String.Format("\n===Event START===\nCould not find actor 0x{0:X} for event started by caller: 0x{1:X}\nEvent Starter: {2}\nParams: {3}", eventStart.actorID, eventStart.scriptOwnerActorID, eventStart.triggerName, LuaUtils.dumpParams(eventStart.luaParams))); //Is it a Director?
break; if (player.getActor().currentDirector != null && player.getActor().eventCurrentOwner == player.getActor().currentDirector.actorId)
ownerActor = player.getActor().currentDirector;
else
{
Log.debug(String.Format("\n===Event START===\nCould not find actor 0x{0:X} for event started by caller: 0x{1:X}\nEvent Starter: {2}\nParams: {3}", eventStart.actorID, eventStart.scriptOwnerActorID, eventStart.triggerName, LuaUtils.dumpParams(eventStart.luaParams)));
break;
}
} }
} }
@ -257,6 +276,9 @@ namespace FFXIVClassic_Lobby_Server
Log.debug(String.Format("\n===Event START===\nSource Actor: 0x{0:X}\nCaller Actor: 0x{1:X}\nVal1: 0x{2:X}\nVal2: 0x{3:X}\nEvent Starter: {4}\nParams: {5}", eventStart.actorID, eventStart.scriptOwnerActorID, eventStart.val1, eventStart.val2, eventStart.triggerName, LuaUtils.dumpParams(eventStart.luaParams))); Log.debug(String.Format("\n===Event START===\nSource Actor: 0x{0:X}\nCaller Actor: 0x{1:X}\nVal1: 0x{2:X}\nVal2: 0x{3:X}\nEvent Starter: {4}\nParams: {5}", eventStart.actorID, eventStart.scriptOwnerActorID, eventStart.val1, eventStart.val2, eventStart.triggerName, LuaUtils.dumpParams(eventStart.luaParams)));
break; break;
//Unknown, happens at npc spawn and cutscene play????
case 0x00CE:
break;
//Event Result //Event Result
case 0x012E: case 0x012E:
subpacket.debugPrintSubPacket(); subpacket.debugPrintSubPacket();

View File

@ -94,8 +94,6 @@ namespace FFXIVClassic_Map_Server.Actors
//return SetActorPositionPacket.buildPacket(actorId, playerActorId, -211.895477f, 190.000000f, 29.651011f, 2.674819f, SetActorPositionPacket.SPAWNTYPE_PLAYERWAKE); //return SetActorPositionPacket.buildPacket(actorId, playerActorId, -211.895477f, 190.000000f, 29.651011f, 2.674819f, SetActorPositionPacket.SPAWNTYPE_PLAYERWAKE);
spawnedFirstTime = true; spawnedFirstTime = true;
spawnPacket.debugPrintSubPacket();
return spawnPacket; return spawnPacket;
} }
@ -227,7 +225,7 @@ namespace FFXIVClassic_Map_Server.Actors
} }
public virtual BasePacket getSpawnPackets(uint playerActorId) public virtual BasePacket getSpawnPackets(uint playerActorId)
{ {
return getSpawnPackets(playerActorId, 0x1); return getSpawnPackets(playerActorId, 0x1);
} }

View File

@ -90,6 +90,7 @@ namespace FFXIVClassic_Map_Server.Actors
public uint playTime; public uint playTime;
public uint lastPlayTimeUpdate; public uint lastPlayTimeUpdate;
public bool isGM = false; public bool isGM = false;
public bool isZoneChanging = true;
//Inventory //Inventory
private Dictionary<ushort, Inventory> inventories = new Dictionary<ushort, Inventory>(); private Dictionary<ushort, Inventory> inventories = new Dictionary<ushort, Inventory>();
@ -480,12 +481,15 @@ namespace FFXIVClassic_Map_Server.Actors
public void sendZoneInPackets(WorldManager world, ushort spawnType) public void sendZoneInPackets(WorldManager world, ushort spawnType)
{ {
queuePacket(SetMapPacket.buildPacket(actorId, zone.regionId, zone.actorId)); queuePacket(SetMapPacket.buildPacket(actorId, zone.regionId, zone.actorId));
// queuePacket(_0x2Packet.buildPacket(actorId));
queuePacket(SetMusicPacket.buildPacket(actorId, zone.bgmDay, 0x01)); queuePacket(SetMusicPacket.buildPacket(actorId, zone.bgmDay, 0x01));
queuePacket(SetWeatherPacket.buildPacket(actorId, SetWeatherPacket.WEATHER_CLEAR)); queuePacket(SetWeatherPacket.buildPacket(actorId, SetWeatherPacket.WEATHER_CLEAR));
queuePacket(getSpawnPackets(actorId, spawnType)); queuePacket(getSpawnPackets(actorId, spawnType));
//getSpawnPackets(actorId, spawnType).debugPrintPacket();
#region grouptest #region grouptest
//Retainers //Retainers
List<ListEntry> retainerListEntries = new List<ListEntry>(); List<ListEntry> retainerListEntries = new List<ListEntry>();
@ -530,9 +534,12 @@ namespace FFXIVClassic_Map_Server.Actors
playerSession.queuePacket(debugSpawn); playerSession.queuePacket(debugSpawn);
playerSession.queuePacket(worldMasterSpawn); playerSession.queuePacket(worldMasterSpawn);
// if (directorSpawn != null) if (directorSpawn != null)
// queuePacket(directorSpawn); {
//directorSpawn.debugPrintPacket();
queuePacket(directorSpawn);
}
#region hardcode #region hardcode
BasePacket reply10 = new BasePacket("./packets/login/login10.bin"); //Item Storage, Inn Door created BasePacket reply10 = new BasePacket("./packets/login/login10.bin"); //Item Storage, Inn Door created
BasePacket reply11 = new BasePacket("./packets/login/login11.bin"); //NPC Create ??? Final init BasePacket reply11 = new BasePacket("./packets/login/login11.bin"); //NPC Create ??? Final init
@ -956,6 +963,19 @@ namespace FFXIVClassic_Map_Server.Actors
return null; return null;
} }
public void setZoneChanging(bool flag)
{
isZoneChanging = flag;
if (!isZoneChanging)
LuaEngine.onZoneIn(this);
}
public bool isInZoneChange()
{
return isZoneChanging;
}
public Equipment getEquipment() public Equipment getEquipment()
{ {
return equipment; return equipment;
@ -987,11 +1007,15 @@ namespace FFXIVClassic_Map_Server.Actors
{ {
if (directorType.Equals("openingDirector")) if (directorType.Equals("openingDirector"))
{ {
currentDirector = new OpeningDirector(0x5FF80004); currentDirector = new OpeningDirector(0x46080012);
} }
queuePacket(RemoveActorPacket.buildPacket(actorId, 0x5FF80004)); queuePacket(RemoveActorPacket.buildPacket(actorId, 0x46080012));
queuePacket(currentDirector.getSpawnPackets(actorId)); queuePacket(currentDirector.getSpawnPackets(actorId));
queuePacket(currentDirector.getInitPackets(actorId));
// queuePacket(currentDirector.getSetEventStatusPackets(actorId));
// currentDirector.getSpawnPackets(actorId).debugPrintPacket();
// currentDirector.getInitPackets(actorId).debugPrintPacket();
} }
public Director getDirector() public Director getDirector()
@ -1022,6 +1046,9 @@ namespace FFXIVClassic_Map_Server.Actors
public void kickEvent(Actor actor, string conditionName, params object[] parameters) public void kickEvent(Actor actor, string conditionName, params object[] parameters)
{ {
if (actor == null)
return;
List<LuaParam> lParams = LuaUtils.createLuaParamList(parameters); List<LuaParam> lParams = LuaUtils.createLuaParamList(parameters);
SubPacket spacket = KickEventPacket.buildPacket(actorId, actor.actorId, conditionName, lParams); SubPacket spacket = KickEventPacket.buildPacket(actorId, actor.actorId, conditionName, lParams);
spacket.debugPrintSubPacket(); spacket.debugPrintSubPacket();

View File

@ -1,4 +1,6 @@
using FFXIVClassic_Map_Server.Actors; using FFXIVClassic_Lobby_Server.packets;
using FFXIVClassic_Map_Server.Actors;
using FFXIVClassic_Map_Server.packets.send.actor;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -13,5 +15,27 @@ namespace FFXIVClassic_Map_Server.actors.director
{ {
} }
public virtual BasePacket getSpawnPackets(uint playerActorId, uint spawnType)
{
List<SubPacket> subpackets = new List<SubPacket>();
subpackets.Add(createAddActorPacket(playerActorId, 0));
subpackets.AddRange(getEventConditionPackets(playerActorId));
subpackets.Add(createSpeedPacket(playerActorId));
subpackets.Add(createSpawnPositonPacket(playerActorId, 0));
subpackets.Add(createNamePacket(playerActorId));
subpackets.Add(createStatePacket(playerActorId));
subpackets.Add(createIsZoneingPacket(playerActorId));
subpackets.Add(createScriptBindPacket(playerActorId));
return BasePacket.createPacket(subpackets, true, false);
}
public override BasePacket getInitPackets(uint playerActorId)
{
SetActorPropetyPacket initProperties = new SetActorPropetyPacket("/_init");
initProperties.addTarget();
return BasePacket.createPacket(initProperties.buildPacket(playerActorId, actorId), true, false);
}
} }
} }

View File

@ -16,7 +16,9 @@ namespace FFXIVClassic_Map_Server.dataobjects
public uint actorID = 0; public uint actorID = 0;
Player playerActor; Player playerActor;
public List<Actor> actorInstanceList = new List<Actor>(); public List<Actor> actorInstanceList = new List<Actor>();
public uint languageCode = 1;
private ClientConnection zoneConnection; private ClientConnection zoneConnection;
private ClientConnection chatConnection; private ClientConnection chatConnection;
@ -95,7 +97,6 @@ namespace FFXIVClassic_Map_Server.dataobjects
public void updatePlayerActorPosition(float x, float y, float z, float rot, ushort moveState) public void updatePlayerActorPosition(float x, float y, float z, float rot, ushort moveState)
{ {
playerActor.oldPositionX = playerActor.positionX; playerActor.oldPositionX = playerActor.positionX;
playerActor.oldPositionY = playerActor.positionY; playerActor.oldPositionY = playerActor.positionY;
playerActor.oldPositionZ = playerActor.positionZ; playerActor.oldPositionZ = playerActor.positionZ;

View File

@ -1,5 +1,6 @@
using FFXIVClassic_Lobby_Server; using FFXIVClassic_Lobby_Server;
using FFXIVClassic_Lobby_Server.packets; using FFXIVClassic_Lobby_Server.packets;
using FFXIVClassic_Map_Server.actors.director;
using FFXIVClassic_Map_Server.Actors; using FFXIVClassic_Map_Server.Actors;
using FFXIVClassic_Map_Server.dataobjects; using FFXIVClassic_Map_Server.dataobjects;
using FFXIVClassic_Map_Server.packets.receive.events; using FFXIVClassic_Map_Server.packets.receive.events;
@ -22,6 +23,7 @@ namespace FFXIVClassic_Map_Server.lua
const string FILEPATH_PLAYER = "./scripts/player.lua"; const string FILEPATH_PLAYER = "./scripts/player.lua";
const string FILEPATH_ZONE = "./scripts/zones/{0}/zone.lua"; const string FILEPATH_ZONE = "./scripts/zones/{0}/zone.lua";
const string FILEPATH_COMMANDS = "./scripts/commands/{0}.lua"; const string FILEPATH_COMMANDS = "./scripts/commands/{0}.lua";
const string FILEPATH_DIRECTORS = "./scripts/directors/{0}.lua";
const string FILEPATH_NPCS = "./scripts/zones/{0}/npcs/{1}.lua"; const string FILEPATH_NPCS = "./scripts/zones/{0}/npcs/{1}.lua";
public LuaEngine() public LuaEngine()
@ -69,6 +71,10 @@ namespace FFXIVClassic_Map_Server.lua
{ {
luaPath = String.Format(FILEPATH_COMMANDS, target.getName()); luaPath = String.Format(FILEPATH_COMMANDS, target.getName());
} }
else if (target is Director)
{
luaPath = String.Format(FILEPATH_DIRECTORS, target.getName());
}
else else
luaPath = String.Format(FILEPATH_NPCS, target.zoneId, target.getName()); luaPath = String.Format(FILEPATH_NPCS, target.zoneId, target.getName());

View File

@ -24,10 +24,15 @@ namespace FFXIVClassic_Map_Server.packets.send.events
{ {
binWriter.Write((UInt32)playerActorId); binWriter.Write((UInt32)playerActorId);
binWriter.Write((UInt32)targetActorId); binWriter.Write((UInt32)targetActorId);
binWriter.Write((UInt32)0); binWriter.Write((Byte)0x5);
binWriter.Write((UInt32)0); binWriter.Write((UInt32)0x0175DC87);
binWriter.Write((Byte)0x0);
binWriter.Write((Byte)0x0);
binWriter.Write((Byte)0x3c);
binWriter.Write(Encoding.ASCII.GetBytes(conditionName), 0, Encoding.ASCII.GetByteCount(conditionName) >= 0x20 ? 0x20 : Encoding.ASCII.GetByteCount(conditionName)); binWriter.Write(Encoding.ASCII.GetBytes(conditionName), 0, Encoding.ASCII.GetByteCount(conditionName) >= 0x20 ? 0x20 : Encoding.ASCII.GetByteCount(conditionName));
binWriter.Seek(0x30, SeekOrigin.Begin);
LuaUtils.writeLuaParams(binWriter, luaParams); LuaUtils.writeLuaParams(binWriter, luaParams);
} }
} }

View File

@ -26,7 +26,7 @@ namespace FFXIVClassic_Map_Server.packets.send.events
{ {
binWriter.Write((UInt32)playerActorID); binWriter.Write((UInt32)playerActorID);
binWriter.Write((UInt32)eventOwnerActorID); binWriter.Write((UInt32)eventOwnerActorID);
binWriter.Write((Byte)1); binWriter.Write((Byte)5);
binWriter.Write(Encoding.ASCII.GetBytes(eventStarter), 0, Encoding.ASCII.GetByteCount(eventStarter) >= 0x20 ? 0x20 : Encoding.ASCII.GetByteCount(eventStarter)); binWriter.Write(Encoding.ASCII.GetBytes(eventStarter), 0, Encoding.ASCII.GetByteCount(eventStarter) >= 0x20 ? 0x20 : Encoding.ASCII.GetByteCount(eventStarter));
binWriter.Seek(0x29, SeekOrigin.Begin); binWriter.Seek(0x29, SeekOrigin.Begin);
binWriter.Write(Encoding.ASCII.GetBytes(callFunction), 0, Encoding.ASCII.GetByteCount(callFunction) >= 0x20 ? 0x20 : Encoding.ASCII.GetByteCount(callFunction)); binWriter.Write(Encoding.ASCII.GetBytes(callFunction), 0, Encoding.ASCII.GetByteCount(callFunction) >= 0x20 ? 0x20 : Encoding.ASCII.GetByteCount(callFunction));