Renamed BattleActionPacket -> CommandResultPacket as it better defines what these packets do. A command fires -> here is what happened due to it.

This commit is contained in:
Filip Maj
2019-01-29 00:02:09 -05:00
parent 7c7742fb35
commit e236e1d207
17 changed files with 199 additions and 199 deletions

View File

@@ -253,13 +253,13 @@ namespace FFXIVClassic_Map_Server.Actors
* Unknown - Bool
* Unknown - Number
* Unknown - Bool
* Timer Array - 20 Number
* Timer Array - 20 Number
*/
public override SubPacket CreateScriptBindPacket(Player requestPlayer)
{
List<LuaParam> lParams;
if (IsMyPlayer(requestPlayer.actorId))
if (IsMyPlayer(requestPlayer.actorId))
{
if (loginInitDirector != null)
lParams = LuaUtils.CreateLuaParamList("/Chara/Player/Player_work", false, false, true, loginInitDirector, true, 0, false, timers, true);
@@ -271,32 +271,32 @@ namespace FFXIVClassic_Map_Server.Actors
ActorInstantiatePacket.BuildPacket(actorId, actorName, className, lParams).DebugPrintSubPacket();
return ActorInstantiatePacket.BuildPacket(actorId, actorName, className, lParams);
}
public override List<SubPacket> GetSpawnPackets(Player requestPlayer, ushort spawnType)
public override List<SubPacket> GetSpawnPackets(Player requestPlayer, ushort spawnType)
{
List<SubPacket> subpackets = new List<SubPacket>();
subpackets.Add(CreateAddActorPacket(8));
if (IsMyPlayer(requestPlayer.actorId))
subpackets.AddRange(Create0x132Packets());
subpackets.Add(CreateSpeedPacket());
subpackets.Add(CreateSpawnPositonPacket(this, spawnType));
subpackets.Add(CreateSpeedPacket());
subpackets.Add(CreateSpawnPositonPacket(this, spawnType));
subpackets.Add(CreateAppearancePacket());
subpackets.Add(CreateNamePacket());
subpackets.Add(_0xFPacket.BuildPacket(actorId));
subpackets.Add(CreateStatePacket());
subpackets.Add(CreateSubStatePacket());
subpackets.Add(CreateInitStatusPacket());
subpackets.Add(CreateInitStatusPacket());
subpackets.Add(CreateSetActorIconPacket());
subpackets.Add(CreateIsZoneingPacket());
subpackets.Add(CreateIsZoneingPacket());
subpackets.AddRange(CreatePlayerRelatedPackets(requestPlayer.actorId));
subpackets.Add(CreateScriptBindPacket(requestPlayer));
return subpackets;
}
public List<SubPacket> CreatePlayerRelatedPackets(uint requestingPlayerActorId)
public List<SubPacket> CreatePlayerRelatedPackets(uint requestingPlayerActorId)
{
List<SubPacket> subpackets = new List<SubPacket>();
@@ -306,10 +306,10 @@ namespace FFXIVClassic_Map_Server.Actors
if (currentTitle != 0)
subpackets.Add(SetPlayerTitlePacket.BuildPacket(actorId, currentTitle));
if (currentJob != 0)
if (currentJob != 0)
subpackets.Add(SetCurrentJobPacket.BuildPacket(actorId, currentJob));
if (IsMyPlayer(requestingPlayerActorId))
if (IsMyPlayer(requestingPlayerActorId))
{
subpackets.Add(SetSpecialEventWorkPacket.BuildPacket(actorId));
@@ -334,9 +334,9 @@ namespace FFXIVClassic_Map_Server.Actors
subpackets.Add(SetCurrentMountGoobbuePacket.BuildPacket(actorId, 1));
return subpackets;
}
public override List<SubPacket> GetInitPackets()
}
public override List<SubPacket> GetInitPackets()
{
ActorPropertyPacketUtil propPacketUtil = new ActorPropertyPacketUtil("/_init", this);
@@ -504,8 +504,8 @@ namespace FFXIVClassic_Map_Server.Actors
QueuePacket(SetWeatherPacket.BuildPacket(actorId, SetWeatherPacket.WEATHER_CLEAR, 1));
QueuePacket(SetMapPacket.BuildPacket(actorId, zone.regionId, zone.actorId));
QueuePackets(GetSpawnPackets(this, spawnType));
QueuePackets(GetSpawnPackets(this, spawnType));
//GetSpawnPackets(actorId, spawnType).DebugPrintPacket();
#region Inventory & Equipment
@@ -515,7 +515,7 @@ namespace FFXIVClassic_Map_Server.Actors
inventories[Inventory.KEYITEMS].SendFullInventory();
inventories[Inventory.BAZAAR].SendFullInventory();
inventories[Inventory.MELDREQUEST].SendFullInventory();
inventories[Inventory.LOOT].SendFullInventory();
inventories[Inventory.LOOT].SendFullInventory();
equipment.SendFullEquipment(false);
playerSession.QueuePacket(InventoryEndChangePacket.BuildPacket(actorId));
#endregion
@@ -525,7 +525,7 @@ namespace FFXIVClassic_Map_Server.Actors
List<SubPacket> areaMasterSpawn = zone.GetSpawnPackets();
List<SubPacket> debugSpawn = world.GetDebugActor().GetSpawnPackets();
List<SubPacket> worldMasterSpawn = world.GetActor().GetSpawnPackets();
playerSession.QueuePacket(areaMasterSpawn);
playerSession.QueuePacket(debugSpawn);
playerSession.QueuePacket(worldMasterSpawn);
@@ -544,16 +544,16 @@ namespace FFXIVClassic_Map_Server.Actors
QueuePacket(SetPlayerItemStoragePacket.BuildPacket(actorId));
}
if (zone.GetWeatherDirector() != null)
if (zone.GetWeatherDirector() != null)
{
playerSession.QueuePacket(zone.GetWeatherDirector().GetSpawnPackets());
playerSession.QueuePacket(zone.GetWeatherDirector().GetSpawnPackets());
}
foreach (Director director in ownedDirectors)
{
QueuePackets(director.GetSpawnPackets());
QueuePackets(director.GetInitPackets());
QueuePackets(director.GetSpawnPackets());
QueuePackets(director.GetInitPackets());
}
if (currentContentGroup != null)
@@ -587,18 +587,18 @@ namespace FFXIVClassic_Map_Server.Actors
public bool IsMyPlayer(uint otherActorId)
{
return actorId == otherActorId;
return actorId == otherActorId;
}
public void QueuePacket(SubPacket packet)
{
playerSession.QueuePacket(packet);
}
public void QueuePackets(List<SubPacket> packets)
{
playerSession.QueuePacket(packets);
public void QueuePackets(List<SubPacket> packets)
{
playerSession.QueuePacket(packets);
}
public void SendPacket(string path)
@@ -1182,17 +1182,17 @@ namespace FFXIVClassic_Map_Server.Actors
}
public void MarkGuildleve(uint id, bool abandoned, bool completed)
{
{
if (HasGuildleve(id))
{
{
for (int i = 0; i < work.guildleveId.Length; i++)
{
if (work.guildleveId[i] == id)
{
work.guildleveChecked[i] = completed;
work.guildleveDone[i] = abandoned;
work.guildleveDone[i] = abandoned;
Database.MarkGuildleve(this, id, abandoned, completed);
SendGuildleveMarkClientUpdate(i);
SendGuildleveMarkClientUpdate(i);
}
}
}
@@ -1458,8 +1458,8 @@ namespace FFXIVClassic_Map_Server.Actors
QueuePackets(propPacketUtil.Done());
}
private void SendGuildleveClientUpdate(int slot)
{
private void SendGuildleveClientUpdate(int slot)
{
ActorPropertyPacketUtil propPacketUtil = new ActorPropertyPacketUtil("work/guildleve", this);
propPacketUtil.AddProperty(String.Format("work.guildleveId[{0}]", slot));
QueuePackets(propPacketUtil.Done());
@@ -1506,29 +1506,29 @@ namespace FFXIVClassic_Map_Server.Actors
director.AddMember(this);
}
}
public void SendDirectorPackets(Director director)
public void SendDirectorPackets(Director director)
{
QueuePackets(director.GetSpawnPackets());
QueuePackets(director.GetInitPackets());
QueuePackets(director.GetInitPackets());
}
public void RemoveDirector(Director director)
{
{
if (ownedDirectors.Contains(director))
{
QueuePacket(RemoveActorPacket.BuildPacket(director.actorId));
QueuePacket(RemoveActorPacket.BuildPacket(director.actorId));
ownedDirectors.Remove(director);
director.RemoveMember(this);
}
}
public GuildleveDirector GetGuildleveDirector()
public GuildleveDirector GetGuildleveDirector()
{
foreach (Director d in ownedDirectors)
{
if (d is GuildleveDirector)
return (GuildleveDirector)d;
if (d is GuildleveDirector)
return (GuildleveDirector)d;
}
return null;
@@ -1793,7 +1793,7 @@ namespace FFXIVClassic_Map_Server.Actors
base.PostUpdate(tick, packets);
}
public override void Die(DateTime tick, BattleActionContainer actionContainer = null)
public override void Die(DateTime tick, CommandResultContainer actionContainer = null)
{
// todo: death timer
aiContainer.InternalDie(tick, 60);
@@ -2122,7 +2122,7 @@ namespace FFXIVClassic_Map_Server.Actors
public override bool CanCast(Character target, BattleCommand spell)
{
//Might want to do these with a BattleAction instead to be consistent with the rest of command stuff
//Might want to do these with a CommandResult instead to be consistent with the rest of command stuff
if (GetHotbarTimer(spell.id) > Utils.UnixTimeStampUTC())
{
// todo: this needs confirming
@@ -2227,7 +2227,7 @@ namespace FFXIVClassic_Map_Server.Actors
return true;
}
public override void OnAttack(State state, BattleAction action, ref BattleAction error)
public override void OnAttack(State state, CommandResult action, ref CommandResult error)
{
var target = state.GetTarget();
@@ -2248,7 +2248,7 @@ namespace FFXIVClassic_Map_Server.Actors
LuaEngine.GetInstance().OnSignal("playerAttack");
}
public override void OnCast(State state, BattleAction[] actions, BattleCommand spell, ref BattleAction[] errors)
public override void OnCast(State state, CommandResult[] actions, BattleCommand spell, ref CommandResult[] errors)
{
// todo: update hotbar timers to skill's recast time (also needs to be done on class change or equip crap)
base.OnCast(state, actions, spell, ref errors);
@@ -2257,7 +2257,7 @@ namespace FFXIVClassic_Map_Server.Actors
//LuaEngine.GetInstance().OnSignal("spellUse");
}
public override void OnWeaponSkill(State state, BattleAction[] actions, BattleCommand skill, ref BattleAction[] errors)
public override void OnWeaponSkill(State state, CommandResult[] actions, BattleCommand skill, ref CommandResult[] errors)
{
// todo: update hotbar timers to skill's recast time (also needs to be done on class change or equip crap)
base.OnWeaponSkill(state, actions, skill, ref errors);
@@ -2269,7 +2269,7 @@ namespace FFXIVClassic_Map_Server.Actors
LuaEngine.GetInstance().OnSignal("weaponskillUse");
}
public override void OnAbility(State state, BattleAction[] actions, BattleCommand ability, ref BattleAction[] errors)
public override void OnAbility(State state, CommandResult[] actions, BattleCommand ability, ref CommandResult[] errors)
{
base.OnAbility(state, actions, ability, ref errors);
UpdateHotbarTimer(ability.id, ability.recastTimeMs);
@@ -2277,16 +2277,16 @@ namespace FFXIVClassic_Map_Server.Actors
}
//Handles exp being added, does not handle figuring out exp bonus from buffs or skill/link chains or any of that
//Returns BattleActions that can be sent to display the EXP gained number and level ups
//Returns CommandResults that can be sent to display the EXP gained number and level ups
//exp should be a ushort single the exp graphic overflows after ~65k
public List<BattleAction> AddExp(int exp, byte classId, byte bonusPercent = 0)
public List<CommandResult> AddExp(int exp, byte classId, byte bonusPercent = 0)
{
List<BattleAction> actionList = new List<BattleAction>();
List<CommandResult> actionList = new List<CommandResult>();
exp += (int) Math.Ceiling((exp * bonusPercent / 100.0f));
//You earn [exp] (+[bonusPercent]%) experience points.
//In non-english languages there are unique messages for each language, hence the use of ClassExperienceTextIds
actionList.Add(new BattleAction(actorId, BattleUtils.ClassExperienceTextIds[classId], 0, (ushort)exp, bonusPercent));
actionList.Add(new CommandResult(actorId, BattleUtils.ClassExperienceTextIds[classId], 0, (ushort)exp, bonusPercent));
bool leveled = false;
int diff = MAXEXP[GetLevel() - 1] - charaWork.battleSave.skillPoint[classId - 1];
@@ -2331,7 +2331,7 @@ namespace FFXIVClassic_Map_Server.Actors
}
//Increaess level of current class and equips new abilities earned at that level
public void LevelUp(byte classId, List<BattleAction> actionList = null)
public void LevelUp(byte classId, List<CommandResult> actionList = null)
{
if (charaWork.battleSave.skillLevel[classId - 1] < charaWork.battleSave.skillLevelCap[classId])
{
@@ -2341,7 +2341,7 @@ namespace FFXIVClassic_Map_Server.Actors
//33909: You gain level [level]
if (actionList != null)
actionList.Add(new BattleAction(actorId, 33909, 0, (ushort) charaWork.battleSave.skillLevel[classId - 1]));
actionList.Add(new CommandResult(actorId, 33909, 0, (ushort) charaWork.battleSave.skillLevel[classId - 1]));
//If there's any abilites that unlocks at this level, equip them.
List<uint> commandIds = Server.GetWorldManager().GetBattleCommandIdByLevel(classId, GetLevel());
@@ -2356,7 +2356,7 @@ namespace FFXIVClassic_Map_Server.Actors
if (actionList != null)
{
if(classId == GetCurrentClassOrJob() || jobId == GetCurrentClassOrJob())
actionList.Add(new BattleAction(actorId, 33926, commandId));
actionList.Add(new CommandResult(actorId, 33926, commandId));
}
}
}