project-meteor-server/FFXIVClassic Map Server/actors/chara/player/Player.cs

679 lines
30 KiB
C#

using FFXIVClassic_Lobby_Server;
using FFXIVClassic_Lobby_Server.common;
using FFXIVClassic_Lobby_Server.packets;
using FFXIVClassic_Map_Server.actors.area;
using FFXIVClassic_Map_Server.actors.chara.player;
using FFXIVClassic_Map_Server.dataobjects;
using FFXIVClassic_Map_Server.dataobjects.chara;
using FFXIVClassic_Map_Server.lua;
using FFXIVClassic_Map_Server.packets.send;
using FFXIVClassic_Map_Server.packets.send.actor;
using FFXIVClassic_Map_Server.packets.send.actor.inventory;
using FFXIVClassic_Map_Server.packets.send.Actor.inventory;
using FFXIVClassic_Map_Server.packets.send.events;
using FFXIVClassic_Map_Server.packets.send.list;
using FFXIVClassic_Map_Server.packets.send.login;
using FFXIVClassic_Map_Server.packets.send.player;
using FFXIVClassic_Map_Server.utils;
using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.Actors
{
class Player : Character
{
public const int MAXSIZE_INVENTORY_NORMAL = 200;
public const int MAXSIZE_INVENTORY_CURRANCY = 320;
public const int MAXSIZE_INVENTORY_KEYITEMS = 500;
public const int MAXSIZE_INVENTORY_LOOT = 10;
public const int MAXSIZE_INVENTORY_MELDREQUEST = 4;
public const int MAXSIZE_INVENTORY_BAZAAR = 10;
public const int MAXSIZE_INVENTORY_EQUIPMENT = 10;
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;
//Player Info
public uint[] timers = new uint[20];
public ushort currentJob;
public uint currentTitle;
//Inventory
public Dictionary<ushort, Inventory> inventories = new Dictionary<ushort, Inventory>();
public int[] invEquipment = new int[MAXSIZE_INVENTORY_EQUIPMENT];
//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;
public PlayerWork playerWork = new PlayerWork();
public ConnectedPlayer playerSession;
public Player(ConnectedPlayer cp, uint actorID) : base(actorID)
{
playerSession = cp;
actorName = String.Format("_pc{0:00000000}", actorID);
className = "Player";
currentSubState = SetActorStatePacket.SUB_STATE_PLAYER;
inventories[Inventory.NORMAL] = new Inventory(this, MAXSIZE_INVENTORY_NORMAL, Inventory.NORMAL);
inventories[Inventory.KEYITEMS] = new Inventory(this, MAXSIZE_INVENTORY_KEYITEMS, Inventory.KEYITEMS);
inventories[Inventory.CURRANCY] = new Inventory(this, MAXSIZE_INVENTORY_CURRANCY, Inventory.CURRANCY);
charaWork.property[0] = 1;
charaWork.property[1] = 1;
charaWork.property[2] = 1;
charaWork.property[4] = 1;
charaWork.command[0] = 0xA0F00000 | 21001;
charaWork.command[1] = 0xA0F00000 | 21001;
charaWork.command[2] = 0xA0F00000 | 21002;
charaWork.command[3] = 0xA0F00000 | 12004;
charaWork.command[4] = 0xA0F00000 | 21005;
charaWork.command[5] = 0xA0F00000 | 21006;
charaWork.command[6] = 0xA0F00000 | 21007;
charaWork.command[7] = 0xA0F00000 | 12009;
charaWork.command[8] = 0xA0F00000 | 12010;
charaWork.command[9] = 0xA0F00000 | 12005;
charaWork.command[10] = 0xA0F00000 | 12007;
charaWork.command[11] = 0xA0F00000 | 12011;
charaWork.command[12] = 0xA0F00000 | 22012;
charaWork.command[13] = 0xA0F00000 | 22013;
charaWork.command[14] = 0xA0F00000 | 29497;
charaWork.command[15] = 0xA0F00000 | 22015;
charaWork.command[32] = 0xA0F00000 | 27191;
charaWork.command[33] = 0xA0F00000 | 22302;
charaWork.command[34] = 0xA0F00000 | 28466;
charaWork.commandAcquired[27150 - 26000] = true;
playerWork.questScenarioComplete[110001 - 110001] = true;
playerWork.questGuildleveComplete[120050 - 120001] = true;
for (int i = 0; i < charaWork.additionalCommandAcquired.Length; i++ )
charaWork.additionalCommandAcquired[i] = true;
for (int i = 0; i < charaWork.commandCategory.Length; i++)
charaWork.commandCategory[i] = 1;
charaWork.battleTemp.generalParameter[3] = 1;
charaWork.eventSave.bazaarTax = 5;
charaWork.battleSave.potencial = 6.6f;
charaWork.commandCategory[0] = 1;
charaWork.commandCategory[1] = 1;
charaWork.commandCategory[32] = 1;
charaWork.commandCategory[33] = 1;
charaWork.commandCategory[34] = 1;
charaWork.parameterSave.commandSlot_compatibility[0] = true;
charaWork.parameterSave.commandSlot_compatibility[1] = true;
charaWork.parameterSave.commandSlot_compatibility[32] = true;
charaWork.commandBorder = 0x20;
charaWork.parameterTemp.tp = 3000;
Database.loadPlayerCharacter(this);
}
public List<SubPacket> create0x132Packets(uint playerActorId)
{
List<SubPacket> packets = new List<SubPacket>();
packets.Add(_0x132Packet.buildPacket(playerActorId, 0xB, "commandForced"));
packets.Add(_0x132Packet.buildPacket(playerActorId, 0xA, "commandDefault"));
packets.Add(_0x132Packet.buildPacket(playerActorId, 0x6, "commandWeak"));
packets.Add(_0x132Packet.buildPacket(playerActorId, 0x4, "commandContent"));
packets.Add(_0x132Packet.buildPacket(playerActorId, 0x6, "commandJudgeMode"));
packets.Add(_0x132Packet.buildPacket(playerActorId, 0x100, "commandRequest"));
packets.Add(_0x132Packet.buildPacket(playerActorId, 0x100, "widgetCreate"));
packets.Add(_0x132Packet.buildPacket(playerActorId, 0x100, "macroRequest"));
return packets;
}
public override SubPacket createScriptBindPacket(uint playerActorId)
{
List<LuaParam> lParams;
if (isMyPlayer(playerActorId))
{
lParams = LuaUtils.createLuaParamList("/Chara/Player/Player_work", false, false, false, true, 0, false, timers, true);
}
else
lParams = LuaUtils.createLuaParamList("/Chara/Player/Player_work", false, false, false, false, false, true);
return ActorInstantiatePacket.buildPacket(actorId, playerActorId, actorName, className, lParams);
}
public override BasePacket getSpawnPackets(uint playerActorId, uint spawnType)
{
List<SubPacket> subpackets = new List<SubPacket>();
subpackets.Add(createAddActorPacket(playerActorId, 8));
if (isMyPlayer(playerActorId))
subpackets.AddRange(create0x132Packets(playerActorId));
subpackets.Add(createSpeedPacket(playerActorId));
subpackets.Add(createSpawnPositonPacket(playerActorId, spawnType));
subpackets.Add(createAppearancePacket(playerActorId));
subpackets.Add(createNamePacket(playerActorId));
subpackets.Add(_0xFPacket.buildPacket(playerActorId, playerActorId));
subpackets.Add(createStatePacket(playerActorId));
subpackets.Add(createIdleAnimationPacket(playerActorId));
subpackets.Add(createInitStatusPacket(playerActorId));
subpackets.Add(createSetActorIconPacket(playerActorId));
subpackets.Add(createIsZoneingPacket(playerActorId));
subpackets.AddRange(createPlayerRelatedPackets(playerActorId));
subpackets.Add(createScriptBindPacket(playerActorId));
return BasePacket.createPacket(subpackets, true, false);
}
public List<SubPacket> createPlayerRelatedPackets(uint playerActorId)
{
List<SubPacket> subpackets = new List<SubPacket>();
if (gcCurrent != 0)
subpackets.Add(SetGrandCompanyPacket.buildPacket(actorId, playerActorId, gcCurrent, gcRankLimsa, gcRankGridania, gcRankUldah));
if (currentTitle != 0)
subpackets.Add(SetPlayerTitlePacket.buildPacket(actorId, playerActorId, currentTitle));
if (currentJob != 0)
subpackets.Add(SetCurrentJobPacket.buildPacket(actorId, playerActorId, currentJob));
if (isMyPlayer(playerActorId))
{
subpackets.Add(_0x196Packet.buildPacket(playerActorId, playerActorId));
if (hasChocobo && chocoboName != null && !chocoboName.Equals(""))
{
subpackets.Add(SetChocoboNamePacket.buildPacket(actorId, playerActorId, chocoboName));
subpackets.Add(SetHasChocoboPacket.buildPacket(playerActorId, hasChocobo));
}
if (hasGoobbue)
subpackets.Add(SetHasGoobbuePacket.buildPacket(playerActorId, hasGoobbue));
subpackets.Add(SetAchievementPointsPacket.buildPacket(playerActorId, achievementPoints));
subpackets.Add(Database.getLatestAchievements(this));
subpackets.Add(Database.getAchievementsPacket(this));
/*
if (isInn)
{
SetCutsceneBookPacket book = new SetCutsceneBookPacket();
for (int i = 0; i < book.cutsceneFlags.Length; i++)
book.cutsceneFlags[i] = true;
client.queuePacket(book.buildPacket(player.actorID), true, false);
//
//subpackets.Add(SetPlayerDreamPacket.buildPacket(playerActorId, );
}
*/
}
return subpackets;
}
public override BasePacket getInitPackets(uint playerActorId)
{
ActorPropertyPacketUtil propPacketUtil = new ActorPropertyPacketUtil("/_init", this, playerActorId);
propPacketUtil.addProperty("charaWork.eventSave.bazaarTax");
propPacketUtil.addProperty("charaWork.battleSave.potencial");
//Properties
for (int i = 0; i < charaWork.property.Length; i++)
{
if (charaWork.property[i] != 0)
propPacketUtil.addProperty(String.Format("charaWork.property[{0}]", i));
}
//Parameters
propPacketUtil.addProperty("charaWork.parameterSave.hp[0]");
propPacketUtil.addProperty("charaWork.parameterSave.hpMax[0]");
propPacketUtil.addProperty("charaWork.parameterSave.mp");
propPacketUtil.addProperty("charaWork.parameterSave.mpMax");
propPacketUtil.addProperty("charaWork.parameterTemp.tp");
propPacketUtil.addProperty("charaWork.parameterSave.state_mainSkill[0]");
propPacketUtil.addProperty("charaWork.parameterSave.state_mainSkillLevel");
//Status Times
for (int i = 0; i < charaWork.statusShownTime.Length; i++)
{
if (charaWork.statusShownTime[i] != 0xFFFFFFFF)
propPacketUtil.addProperty(String.Format("charaWork.statusShownTime[{0}]", i));
}
//General Parameters
for (int i = 3; i < charaWork.battleTemp.generalParameter.Length; i++)
{
if (charaWork.battleTemp.generalParameter[i] != 0)
propPacketUtil.addProperty(String.Format("charaWork.battleTemp.generalParameter[{0}]", i));
}
propPacketUtil.addProperty("charaWork.battleTemp.castGauge_speed[0]");
propPacketUtil.addProperty("charaWork.battleTemp.castGauge_speed[1]");
//Battle Save Skillpoint
//Commands
propPacketUtil.addProperty("charaWork.commandBorder");
for (int i = 0; i < charaWork.command.Length; i++)
{
if (charaWork.command[i] != 0)
propPacketUtil.addProperty(String.Format("charaWork.command[{0}]", i));
}
for (int i = 0; i < charaWork.commandCategory.Length; i++)
{
charaWork.commandCategory[i] = 1;
if (charaWork.commandCategory[i] != 0)
propPacketUtil.addProperty(String.Format("charaWork.commandCategory[{0}]", i));
}
for (int i = 0; i < charaWork.commandAcquired.Length; i++)
{
if (charaWork.commandAcquired[i] != false)
propPacketUtil.addProperty(String.Format("charaWork.commandAcquired[{0}]", i));
}
for (int i = 0; i < charaWork.additionalCommandAcquired.Length; i++)
{
if (charaWork.additionalCommandAcquired[i] != false)
propPacketUtil.addProperty(String.Format("charaWork.additionalCommandAcquired[{0}]", i));
}
for (int i = 0; i < charaWork.parameterSave.commandSlot_compatibility.Length; i++)
{
charaWork.parameterSave.commandSlot_compatibility[i] = true;
if (charaWork.parameterSave.commandSlot_compatibility[i])
propPacketUtil.addProperty(String.Format("charaWork.parameterSave.commandSlot_compatibility[{0}]", i));
}
/*
for (int i = 0; i < charaWork.parameterSave.commandSlot_recastTime.Length; i++)
{
if (charaWork.parameterSave.commandSlot_recastTime[i] != 0)
propPacketUtil.addProperty(String.Format("charaWork.parameterSave.commandSlot_recastTime[{0}]", i));
}
*/
//System
propPacketUtil.addProperty("charaWork.parameterTemp.forceControl_float_forClientSelf[0]");
propPacketUtil.addProperty("charaWork.parameterTemp.forceControl_float_forClientSelf[1]");
propPacketUtil.addProperty("charaWork.parameterTemp.forceControl_int16_forClientSelf[0]");
propPacketUtil.addProperty("charaWork.parameterTemp.forceControl_int16_forClientSelf[1]");
charaWork.parameterTemp.otherClassAbilityCount[0] = 4;
charaWork.parameterTemp.otherClassAbilityCount[1] = 5;
charaWork.parameterTemp.giftCount[1] = 5;
propPacketUtil.addProperty("charaWork.parameterTemp.otherClassAbilityCount[0]");
propPacketUtil.addProperty("charaWork.parameterTemp.otherClassAbilityCount[1]");
propPacketUtil.addProperty("charaWork.parameterTemp.giftCount[1]");
propPacketUtil.addProperty("charaWork.depictionJudge");
//Scenario
for (int i = 0; i < playerWork.questScenario.Length; i++)
{
if (playerWork.questScenario[i] != 0)
propPacketUtil.addProperty(String.Format("playerWork.questScenario[{0}]", i));
}
//Guildleve - Local
for (int i = 0; i < playerWork.questGuildleve.Length; i++)
{
if (playerWork.questGuildleve[i] != 0)
propPacketUtil.addProperty(String.Format("playerWork.questGuildleve[{0}]", i));
}
//Guildleve - Regional
for (int i = 0; i < work.guildleveId.Length; i++)
{
if (work.guildleveId[i] != 0)
propPacketUtil.addProperty(String.Format("work.guildleveId[{0}]", i));
if (work.guildleveDone[i] != false)
propPacketUtil.addProperty(String.Format("work.guildleveDone[{0}]", i));
if (work.guildleveChecked[i] != false)
propPacketUtil.addProperty(String.Format("work.guildleveChecked[{0}]", i));
}
//NPC Linkshell
for (int i = 0; i < playerWork.npcLinkshellChatCalling.Length; i++)
{
if (playerWork.npcLinkshellChatCalling[i] != false)
propPacketUtil.addProperty(String.Format("playerWork.npcLinkshellChatCalling[{0}]", i));
if (playerWork.npcLinkshellChatExtra[i] != false)
propPacketUtil.addProperty(String.Format("playerWork.npcLinkshellChatExtra[{0}]", i));
}
propPacketUtil.addProperty("playerWork.restBonusExpRate");
//Profile
propPacketUtil.addProperty("playerWork.tribe");
propPacketUtil.addProperty("playerWork.guardian");
propPacketUtil.addProperty("playerWork.birthdayMonth");
propPacketUtil.addProperty("playerWork.birthdayDay");
propPacketUtil.addProperty("playerWork.initialTown");
return propPacketUtil.done();
}
public void sendZoneInPackets(WorldManager world, ushort spawnType)
{
queuePacket(SetMapPacket.buildPacket(actorId, zone.regionId, zone.actorId));
queuePacket(SetMusicPacket.buildPacket(actorId, zone.bgmDay, 0x01));
queuePacket(SetWeatherPacket.buildPacket(actorId, SetWeatherPacket.WEATHER_CLEAR));
queuePacket(getSpawnPackets(actorId, spawnType));
#region grouptest
//Retainers
List<ListEntry> retainerListEntries = new List<ListEntry>();
retainerListEntries.Add(new ListEntry(actorId, 0xFFFFFFFF, 0x139E, false, true, customDisplayName));
retainerListEntries.Add(new ListEntry(0x23, 0x0, 0xFFFFFFFF, false, false, "TEST1"));
retainerListEntries.Add(new ListEntry(0x24, 0x0, 0xFFFFFFFF, false, false, "TEST2"));
retainerListEntries.Add(new ListEntry(0x25, 0x0, 0xFFFFFFFF, false, false, "TEST3"));
BasePacket retainerListPacket = BasePacket.createPacket(ListUtils.createRetainerList(actorId, 0xF4, 1, 0x800000000004e639, retainerListEntries), true, false);
playerSession.queuePacket(retainerListPacket);
//Party
List<ListEntry> partyListEntries = new List<ListEntry>();
partyListEntries.Add(new ListEntry(actorId, 0xFFFFFFFF, 0xFFFFFFFF, false, true, customDisplayName));
partyListEntries.Add(new ListEntry(0x029B27D3, 0xFFFFFFFF, 0x195, false, true, "Valentine Bluefeather"));
BasePacket partyListPacket = BasePacket.createPacket(ListUtils.createPartyList(actorId, 0xF4, 1, 0x8000000000696df2, partyListEntries), true, false);
playerSession.queuePacket(partyListPacket);
#endregion
queuePacket(InventoryBeginChangePacket.buildPacket(actorId));
inventories[Inventory.NORMAL].sendFullInventory();
#region equipsetup
EquipmentListX08Packet initialEqupmentPacket = new EquipmentListX08Packet();
initialEqupmentPacket.setItem(EquipmentListX08Packet.SLOT_BODY, 5);
initialEqupmentPacket.setItem(EquipmentListX08Packet.SLOT_HEAD, 3);
initialEqupmentPacket.setItem(EquipmentListX08Packet.SLOT_UNDERSHIRT, 6);
initialEqupmentPacket.setItem(EquipmentListX08Packet.SLOT_UNDERGARMENT, 7);
initialEqupmentPacket.setItem(EquipmentListX08Packet.SLOT_MAINHAND, 2);
initialEqupmentPacket.setItem(EquipmentListX08Packet.SLOT_LEGS, 8);
//Equip Init
// playerSession.queuePacket(InventorySetBeginPacket.buildPacket(actorId, 0x23, InventorySetBeginPacket.CODE_EQUIPMENT), true, false);
// playerSession.queuePacket(BasePacket.createPacket(initialEqupmentPacket.buildPackets(actorId), true, false));
// playerSession.queuePacket(InventorySetEndPacket.buildPacket(actorId), true, false);
#endregion
playerSession.queuePacket(InventoryEndChangePacket.buildPacket(actorId), true, false);
playerSession.queuePacket(getInitPackets(actorId));
BasePacket areaMasterSpawn = zone.getSpawnPackets(actorId);
BasePacket debugSpawn = world.GetDebugActor().getSpawnPackets(actorId);
BasePacket worldMasterSpawn = world.GetActor().getSpawnPackets(actorId);
playerSession.queuePacket(areaMasterSpawn);
playerSession.queuePacket(debugSpawn);
playerSession.queuePacket(worldMasterSpawn);
#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
reply10.replaceActorID(actorId);
reply11.replaceActorID(actorId);
playerSession.queuePacket(reply10);
playerSession.queuePacket(reply11);
#endregion
}
private void sendRemoveInventoryPackets(List<ushort> slots)
{
int currentIndex = 0;
while (true)
{
if (slots.Count - currentIndex >= 64)
queuePacket(InventoryRemoveX64Packet.buildPacket(actorId, slots, ref currentIndex));
else if (slots.Count - currentIndex >= 32)
queuePacket(InventoryRemoveX32Packet.buildPacket(actorId, slots, ref currentIndex));
else if (slots.Count - currentIndex >= 16)
queuePacket(InventoryRemoveX16Packet.buildPacket(actorId, slots, ref currentIndex));
else if (slots.Count - currentIndex >= 8)
queuePacket(InventoryRemoveX08Packet.buildPacket(actorId, slots, ref currentIndex));
else if (slots.Count - currentIndex == 1)
queuePacket(InventoryRemoveX01Packet.buildPacket(actorId, slots[currentIndex]));
else
break;
}
}
/*
private void sendEquipmentPackets(List<int> indexes)
{
int currentIndex = 0;
InventorySetBeginPacket.buildPacket(actorId, MAXSIZE_INVENTORY_EQUIPMENT, InventorySetBeginPacket.CODE_EQUIPMENT);
while (true)
{
if (indexes.Count - currentIndex >= 64)
queuePacket(EquipmentListX64Packet.buildPacket(actorId, indexes, ref currentIndex));
else if (indexes.Count - currentIndex >= 32)
queuePacket(EquipmentListX32Packet.buildPacket(actorId, indexes, ref currentIndex));
else if (indexes.Count - currentIndex >= 16)
queuePacket(EquipmentListX16Packet.buildPacket(actorId, indexes, ref currentIndex));
else if (indexes.Count - currentIndex >= 8)
queuePacket(EquipmentListX08Packet.buildPacket(actorId, indexes, ref currentIndex));
else if (indexes.Count - currentIndex == 1)
queuePacket(EquipmentListX01Packet.buildPacket(actorId, indexes[currentIndex]));
else
break;
}
InventorySetEndPacket.buildPacket(actorId);
}
*/
public bool isMyPlayer(uint otherActorId)
{
return actorId == otherActorId;
}
public void queuePacket(BasePacket packet)
{
playerSession.queuePacket(packet);
}
public void queuePacket(SubPacket packet)
{
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));
}
public void logout()
{
queuePacket(LogoutPacket.buildPacket(actorId));
}
public void quitGame()
{
queuePacket(QuitPacket.buildPacket(actorId));
}
public void changeMusic(ushort musicId)
{
queuePacket(SetMusicPacket.buildPacket(actorId, musicId, 1));
}
public void sendChocoboAppearance()
{
queuePacket(SetCurrentMountChocoboPacket.buildPacket(actorId, chocoboAppearance));
}
public void sendGoobbueAppearance()
{
queuePacket(SetCurrentMountGoobbuePacket.buildPacket(actorId, 1));
}
public void setMountState(byte mountState)
{
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)
{
//SubPacket worldMasterMessage =
//zone.broadcastPacketAroundActor(this, worldMasterMessage);
}
public void runEventFunction(string functionName, params object[] parameters)
{
List<LuaParam> lParams = LuaUtils.createLuaParamList(parameters);
SubPacket spacket = RunEventFunctionPacket.buildPacket(actorId, eventCurrentOwner, eventCurrentStarter, functionName, lParams);
spacket.debugPrintSubPacket();
queuePacket(spacket);
}
public void endEvent()
{
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;
}
public void sendInstanceUpdate()
{
//Update Instance
List<BasePacket> instanceUpdatePackets = playerSession.updateInstance(zone.getActorsAroundActor(this, 50));
foreach (BasePacket bp in instanceUpdatePackets)
{
// bp.debugPrintPacket();
queuePacket(bp);
}
}
}
}