Added the game message packets. Fixed "canRideChocobo" param in zone not working. Added a lot more function for lua to access. Various minor changes.

This commit is contained in:
Filip Maj 2016-02-03 00:45:11 -05:00
parent cfb29b912f
commit c83b4a12b9
13 changed files with 259 additions and 166 deletions

View file

@ -221,6 +221,11 @@ namespace FFXIVClassic_Map_Server.Actors
return className;
}
public ushort getState()
{
return currentMainState;
}
public List<LuaParam> getLuaParams()
{
return classParams;
@ -230,7 +235,9 @@ namespace FFXIVClassic_Map_Server.Actors
{
currentMainState = newState;
SubPacket changeStatePacket = SetActorStatePacket.buildPacket(actorId, actorId, newState, currentSubState);
SubPacket battleActionPacket = BattleAction1Packet.buildPacket(actorId, actorId);
zone.broadcastPacketAroundActor(this, changeStatePacket);
zone.broadcastPacketAroundActor(this, battleActionPacket);
}
public void changeSpeed(int type, float value)

View file

@ -28,7 +28,7 @@ namespace FFXIVClassic_Map_Server.Actors
private Dictionary<uint, Actor> mActorList = new Dictionary<uint,Actor>();
private List<Actor>[,] mActorBlock;
public Zone(uint id, string zoneName, ushort regionId, ushort bgmDay, ushort bgmNight, ushort bgmBattle, bool canStealth, bool isInn, bool canRideChocobo, bool isInstanceRaid)
public Zone(uint id, string zoneName, ushort regionId, ushort bgmDay, ushort bgmNight, ushort bgmBattle, bool isInn, bool canRideChocobo, bool canStealth, bool isInstanceRaid)
: base(id)
{
@ -68,7 +68,7 @@ namespace FFXIVClassic_Map_Server.Actors
public override SubPacket createScriptBindPacket(uint playerActorId)
{
List<LuaParam> lParams;
lParams = LuaUtils.createLuaParamList("/Area/Zone/ZoneMasterPrvI0", false, true, zoneName, "", 0xFFFFFFFF, false, false, canStealth, isInn, false, false, false, false, false, false);
lParams = LuaUtils.createLuaParamList("/Area/Zone/ZoneMasterPrvI0", false, true, zoneName, "", -1, canRideChocobo ? (byte)1 : (byte)0, canStealth, isInn, false, false, false, false, false, false);
return ActorInstantiatePacket.buildPacket(actorId, playerActorId, actorName, className, lParams);
}
@ -82,6 +82,7 @@ namespace FFXIVClassic_Map_Server.Actors
subpackets.Add(createStatePacket(playerActorId));
subpackets.Add(createIsZoneingPacket(playerActorId));
subpackets.Add(createScriptBindPacket(playerActorId));
subpackets[6].debugPrintSubPacket();
return BasePacket.createPacket(subpackets, true, false);
}
@ -291,19 +292,16 @@ namespace FFXIVClassic_Map_Server.Actors
public void broadcastPacketAroundActor(Actor actor, SubPacket packet)
{
if (zone != null)
List<Actor> aroundActor = getActorsAroundActor(actor, 50);
foreach (Actor a in aroundActor)
{
List<Actor> aroundActor = getActorsAroundActor(actor, 50);
foreach (Actor a in aroundActor)
if (a is Player)
{
if (a is Player)
{
SubPacket clonedPacket = new SubPacket(packet, actor.actorId);
Player p = (Player)a;
p.queuePacket(clonedPacket);
}
SubPacket clonedPacket = new SubPacket(packet, actor.actorId);
Player p = (Player)a;
p.queuePacket(clonedPacket);
}
}
}
}
}

View file

@ -48,18 +48,25 @@ namespace FFXIVClassic_Map_Server.Actors
public uint[] timers = new uint[20];
public ushort currentJob;
public uint currentTitle;
//GC Related
public byte gcCurrent;
public byte gcRankLimsa;
public byte gcRankGridania;
public byte gcRankUldah;
//Mount Related
public bool hasChocobo;
public bool hasGoobbue;
public byte chocoboAppearance;
public string chocoboName;
public byte mountState = 0;
//Event Related
public uint eventCurrentOwner = 0;
public string eventCurrentStarter = "";
public uint eventMenuId = 0;
public uint achievementPoints;
@ -598,7 +605,25 @@ namespace FFXIVClassic_Map_Server.Actors
{
playerSession.queuePacket(packet, true, false);
}
public void broadcastPacket(SubPacket packet)
{
foreach (Actor a in playerSession.actorInstanceList)
{
if (a is Player)
{
Player p = (Player)a;
SubPacket clonedPacket = new SubPacket(packet, a.actorId);
p.queuePacket(clonedPacket);
}
}
}
public Zone getZone()
{
return zone;
}
public void sendMessage(uint logType, string sender, string message)
{
queuePacket(SendMessagePacket.buildPacket(actorId, actorId, logType, sender, message));
@ -628,10 +653,54 @@ namespace FFXIVClassic_Map_Server.Actors
{
queuePacket(SetCurrentMountGoobbuePacket.buildPacket(actorId, 1));
}
public void sendWorldMessage(ushort worldMasterId, params object[] msgParams)
public void setMountState(byte mountState)
{
//queuePacket(WorldMasterPacket.buildPacket());
this.mountState = mountState;
}
public byte getMountState()
{
return mountState;
}
public void doEmote(uint emoteId)
{
broadcastPacket(ActorDoEmotePacket.buildPacket(actorId, actorId, emoteId));
}
public void sendGameMessage(Actor sourceActor, Actor textIdOwner, ushort textId, byte log, params object[] msgParams)
{
if (msgParams.Length == 0)
{
queuePacket(GameMessagePacket.buildPacket(Server.getServer().GetWorldManager().GetActor().actorId, actorId, sourceActor.actorId, textIdOwner.actorId, textId, log));
}
else
queuePacket(GameMessagePacket.buildPacket(Server.getServer().GetWorldManager().GetActor().actorId, actorId, sourceActor.actorId, textIdOwner.actorId, textId, log, LuaUtils.createLuaParamList(msgParams)));
}
public void sendGameMessage(Actor textIdOwner, ushort textId, byte log, params object[] msgParams)
{
if (msgParams.Length == 0)
queuePacket(GameMessagePacket.buildPacket(Server.getServer().GetWorldManager().GetActor().actorId, actorId, textIdOwner.actorId, textId, log));
else
queuePacket(GameMessagePacket.buildPacket(Server.getServer().GetWorldManager().GetActor().actorId, actorId, textIdOwner.actorId, textId, log, LuaUtils.createLuaParamList(msgParams)));
}
public void sendGameMessage(Actor textIdOwner, ushort textId, byte log, string customSender, params object[] msgParams)
{
if (msgParams.Length == 0)
queuePacket(GameMessagePacket.buildPacket(Server.getServer().GetWorldManager().GetActor().actorId, actorId, textIdOwner.actorId, textId, customSender, log));
else
queuePacket(GameMessagePacket.buildPacket(Server.getServer().GetWorldManager().GetActor().actorId, actorId, textIdOwner.actorId, textId, customSender, log, LuaUtils.createLuaParamList(msgParams)));
}
public void sendGameMessage(Actor textIdOwner, ushort textId, byte log, uint displayId, params object[] msgParams)
{
if (msgParams.Length == 0)
queuePacket(GameMessagePacket.buildPacket(Server.getServer().GetWorldManager().GetActor().actorId, actorId, textIdOwner.actorId, textId, displayId, log));
else
queuePacket(GameMessagePacket.buildPacket(Server.getServer().GetWorldManager().GetActor().actorId, actorId, textIdOwner.actorId, textId, displayId, log, LuaUtils.createLuaParamList(msgParams)));
}
public void broadcastWorldMessage(ushort worldMasterId, params object[] msgParams)
@ -643,16 +712,29 @@ namespace FFXIVClassic_Map_Server.Actors
public void runEventFunction(string functionName, params object[] parameters)
{
List<LuaParam> lParams = LuaUtils.createLuaParamList(parameters);
SubPacket spacket = RunEventFunctionPacket.buildPacket(actorId, playerSession.eventCurrentOwner, playerSession.eventCurrentStarter, functionName, lParams);
SubPacket spacket = RunEventFunctionPacket.buildPacket(actorId, eventCurrentOwner, eventCurrentStarter, functionName, lParams);
spacket.debugPrintSubPacket();
queuePacket(spacket);
}
public void endEvent()
{
SubPacket p = EndEventPacket.buildPacket(actorId, playerSession.eventCurrentOwner, playerSession.eventCurrentStarter);
p.debugPrintSubPacket();
SubPacket p = EndEventPacket.buildPacket(actorId, eventCurrentOwner, eventCurrentStarter);
queuePacket(p);
eventCurrentOwner = 0;
eventCurrentStarter = "";
eventMenuId = 0;
}
public void setCurrentMenuId(uint id)
{
eventMenuId = id;
}
public uint getCurrentMenuId()
{
return eventMenuId;
}
}