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

@ -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);
spawnedFirstTime = true;
spawnPacket.debugPrintSubPacket();
return spawnPacket;
}
@ -227,7 +225,7 @@ namespace FFXIVClassic_Map_Server.Actors
}
public virtual BasePacket getSpawnPackets(uint playerActorId)
{
{
return getSpawnPackets(playerActorId, 0x1);
}

View file

@ -90,6 +90,7 @@ namespace FFXIVClassic_Map_Server.Actors
public uint playTime;
public uint lastPlayTimeUpdate;
public bool isGM = false;
public bool isZoneChanging = true;
//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)
{
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(SetWeatherPacket.buildPacket(actorId, SetWeatherPacket.WEATHER_CLEAR));
queuePacket(getSpawnPackets(actorId, spawnType));
//getSpawnPackets(actorId, spawnType).debugPrintPacket();
#region grouptest
//Retainers
List<ListEntry> retainerListEntries = new List<ListEntry>();
@ -530,9 +534,12 @@ namespace FFXIVClassic_Map_Server.Actors
playerSession.queuePacket(debugSpawn);
playerSession.queuePacket(worldMasterSpawn);
// if (directorSpawn != null)
// queuePacket(directorSpawn);
if (directorSpawn != null)
{
//directorSpawn.debugPrintPacket();
queuePacket(directorSpawn);
}
#region hardcode
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
@ -956,6 +963,19 @@ namespace FFXIVClassic_Map_Server.Actors
return null;
}
public void setZoneChanging(bool flag)
{
isZoneChanging = flag;
if (!isZoneChanging)
LuaEngine.onZoneIn(this);
}
public bool isInZoneChange()
{
return isZoneChanging;
}
public Equipment getEquipment()
{
return equipment;
@ -987,11 +1007,15 @@ namespace FFXIVClassic_Map_Server.Actors
{
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.getInitPackets(actorId));
// queuePacket(currentDirector.getSetEventStatusPackets(actorId));
// currentDirector.getSpawnPackets(actorId).debugPrintPacket();
// currentDirector.getInitPackets(actorId).debugPrintPacket();
}
public Director getDirector()
@ -1022,6 +1046,9 @@ namespace FFXIVClassic_Map_Server.Actors
public void kickEvent(Actor actor, string conditionName, params object[] parameters)
{
if (actor == null)
return;
List<LuaParam> lParams = LuaUtils.createLuaParamList(parameters);
SubPacket spacket = KickEventPacket.buildPacket(actorId, actor.actorId, conditionName, lParams);
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.Collections.Generic;
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);
}
}
}