Begun reimplementing the whole actor system to follow more closely to the client side's system. Packet processor's reference chanced, and all ActorID vars in Actor class were changed to ActorId.

This commit is contained in:
Filip Maj 2016-01-02 14:04:45 -05:00
parent 67ee70e7c5
commit 04faf9d753
20 changed files with 582 additions and 269 deletions

View File

@ -41,6 +41,9 @@
<HintPath>..\packages\Dapper.1.42\lib\net45\Dapper.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="KeraLua">
<HintPath>..\packages\NLua.1.3.2.1\lib\net45\KeraLua.dll</HintPath>
</Reference>
<Reference Include="MySql.Data, Version=6.9.7.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.6.9.7\lib\net45\MySql.Data.dll</HintPath>
<Private>True</Private>
@ -49,6 +52,9 @@
<HintPath>..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="NLua">
<HintPath>..\packages\NLua.1.3.2.1\lib\net45\NLua.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
@ -58,6 +64,8 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="actors\judge\Judge.cs" />
<Compile Include="actors\StaticActors.cs" />
<Compile Include="ClientConnection.cs" />
<Compile Include="common\Bitfield.cs" />
<Compile Include="common\Blowfish.cs" />
@ -66,46 +74,53 @@
<Compile Include="common\Utils.cs" />
<Compile Include="ConfigConstants.cs" />
<Compile Include="Database.cs" />
<Compile Include="dataobjects\Actor.cs" />
<Compile Include="dataobjects\chara\BattleSave.cs" />
<Compile Include="dataobjects\chara\BattleTemp.cs" />
<Compile Include="dataobjects\chara\EventSave.cs" />
<Compile Include="dataobjects\chara\EventTemp.cs" />
<Compile Include="dataobjects\chara\ParameterTemp.cs" />
<Compile Include="dataobjects\chara\PlayerActor.cs" />
<Compile Include="actors\Actor.cs" />
<Compile Include="actors\chara\BattleSave.cs" />
<Compile Include="actors\chara\BattleTemp.cs" />
<Compile Include="actors\chara\Character.cs" />
<Compile Include="actors\chara\EventSave.cs" />
<Compile Include="actors\chara\EventTemp.cs" />
<Compile Include="actors\chara\npc\Npc.cs" />
<Compile Include="actors\chara\ParameterTemp.cs" />
<Compile Include="actors\chara\player\Player.cs" />
<Compile Include="actors\command\Command.cs" />
<Compile Include="dataobjects\CharaInfo.cs" />
<Compile Include="actors\chara\CharaWork.cs" />
<Compile Include="actors\chara\ParameterSave.cs" />
<Compile Include="actors\chara\player\PlayerWork.cs" />
<Compile Include="dataobjects\database\DBAppearance.cs" />
<Compile Include="dataobjects\database\DBCharacter.cs" />
<Compile Include="dataobjects\CharaInfo.cs" />
<Compile Include="dataobjects\chara\CharaWork.cs" />
<Compile Include="dataobjects\chara\ParameterSave.cs" />
<Compile Include="dataobjects\chara\PlayerWork.cs" />
<Compile Include="dataobjects\database\DBCommands.cs" />
<Compile Include="dataobjects\database\DBJournal.cs" />
<Compile Include="dataobjects\database\DBPlayerData.cs" />
<Compile Include="dataobjects\database\DBStats.cs" />
<Compile Include="dataobjects\database\DBWorld.cs" />
<Compile Include="dataobjects\Item.cs" />
<Compile Include="dataobjects\ConnectedPlayer.cs" />
<Compile Include="dataobjects\database\DBWorld.cs" />
<Compile Include="dataobjects\RecruitmentDetails.cs" />
<Compile Include="dataobjects\SearchEntry.cs" />
<Compile Include="lua\LuaEngine.cs" />
<Compile Include="lua\LuaEvent.cs" />
<Compile Include="lua\LuaParam.cs" />
<Compile Include="lua\LuaPlayer.cs" />
<Compile Include="PacketProcessor.cs" />
<Compile Include="packets\BasePacket.cs" />
<Compile Include="packets\receive\ChatMessagePacket.cs" />
<Compile Include="packets\receive\events\EventUpdatePacket.cs" />
<Compile Include="packets\receive\events\EventStartPacket.cs" />
<Compile Include="packets\receive\HandshakePacket.cs" />
<Compile Include="packets\receive\recruitment\RecruitmentDetailsRequestPacket.cs" />
<Compile Include="packets\receive\recruitment\RecruitmentSearchRequestPacket.cs" />
<Compile Include="packets\receive\recruitment\StartRecruitingRequestPacket.cs" />
<Compile Include="packets\receive\script\CommandStartRequestPacket.cs" />
<Compile Include="packets\receive\script\ScriptResultPacket.cs" />
<Compile Include="packets\receive\SetTargetPacket.cs" />
<Compile Include="packets\receive\LockTargetPacket.cs" />
<Compile Include="packets\receive\social\AddRemoveSocialPacket.cs" />
<Compile Include="packets\receive\social\FriendlistRequestPacket.cs" />
<Compile Include="packets\receive\StartScriptPacket.cs" />
<Compile Include="packets\receive\supportdesk\FaqBodyRequestPacket.cs" />
<Compile Include="packets\receive\supportdesk\FaqListRequestPacket.cs" />
<Compile Include="packets\receive\supportdesk\GMTicketIssuesRequestPacket.cs" />
<Compile Include="packets\send\actor\ActorDoEmotePacket.cs" />
<Compile Include="packets\send\actor\ActorInstantiatePacket.cs" />
<Compile Include="packets\send\actor\DeleteAllActorsPacket.cs" />
<Compile Include="packets\send\actor\SetActorIsZoningPacket.cs" />
<Compile Include="packets\send\actor\DoBattleActionPacket.cs" />
@ -121,6 +136,8 @@
<Compile Include="packets\send\actor\SetActorIconPacket.cs" />
<Compile Include="packets\send\actor\SetActorStatusPacket.cs" />
<Compile Include="packets\send\actor\_0xFPacket.cs" />
<Compile Include="packets\send\events\EndEventPacket.cs" />
<Compile Include="packets\send\events\RunEventFunctionPacket.cs" />
<Compile Include="packets\send\list\ListEntry.cs" />
<Compile Include="packets\send\list\ListUtils.cs" />
<Compile Include="packets\send\list\SetListPropertyPacket.cs" />
@ -162,8 +179,6 @@
<Compile Include="packets\send\recruitment\EndRecruitmentPacket.cs" />
<Compile Include="packets\send\recruitment\RecruiterStatePacket.cs" />
<Compile Include="packets\send\recruitment\StartRecruitingResponse.cs" />
<Compile Include="packets\send\script\ScriptEndPacket.cs" />
<Compile Include="packets\send\script\ScriptStartPacket.cs" />
<Compile Include="packets\send\SendMessagePacket.cs" />
<Compile Include="packets\send\SetMapPacket.cs" />
<Compile Include="packets\send\SetMusicPacket.cs" />
@ -187,7 +202,7 @@
<Compile Include="packets\receive\UpdatePlayerPositionPacket.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ScriptParamReader.cs" />
<Compile Include="lua\LuaUtils.cs" />
<Compile Include="Server.cs" />
<Compile Include="Zone.cs" />
</ItemGroup>
@ -195,8 +210,15 @@
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<Folder Include="actors\area\" />
<Folder Include="actors\director\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>
xcopy /s /y "D:\Coding\FFXIV Related\ffxiv-classic-map-server\packages\NLua.1.3.2.1\lib\native\*.*" "$(TargetDir)"</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">

View File

@ -18,7 +18,6 @@ using FFXIVClassic_Map_Server.packets.send.Actor.inventory;
using FFXIVClassic_Map_Server.packets.send.Actor;
using FFXIVClassic_Map_Server.packets.send.actor;
using FFXIVClassic_Map_Server;
using FFXIVClassic_Map_Server.packets.send.script;
using FFXIVClassic_Map_Server.packets.send.player;
using FFXIVClassic_Map_Server.dataobjects.chara;
using FFXIVClassic_Map_Server.packets.send.supportdesk;
@ -28,20 +27,29 @@ using FFXIVClassic_Map_Server.packets.receive.supportdesk;
using FFXIVClassic_Map_Server.packets.receive.recruitment;
using FFXIVClassic_Map_Server.packets.send.recruitment;
using FFXIVClassic_Map_Server.packets.send.list;
using FFXIVClassic_Map_Server.packets.receive.events;
using FFXIVClassic_Map_Server.packets.send.events;
using FFXIVClassic_Map_Server.lua;
using FFXIVClassic_Map_Server.dataobjects.actors;
using FFXIVClassic_Map_Server.dataobjects.chara.npc;
using FFXIVClassic_Map_Server.actors;
namespace FFXIVClassic_Lobby_Server
{
class PacketProcessor
{
LuaEngine luaEngine = new LuaEngine();
Dictionary<uint, ConnectedPlayer> mPlayers;
List<ClientConnection> mConnections;
StaticActors mStaticActors = new StaticActors();
Zone inn = new Zone();
public PacketProcessor(Dictionary<uint, ConnectedPlayer> playerList, List<ClientConnection> connectionList)
{
mPlayers = playerList;
mConnections = connectionList;
initNpcs();
}
public void processPacket(ClientConnection client, BasePacket packet)
@ -311,7 +319,7 @@ namespace FFXIVClassic_Lobby_Server
client.queuePacket(SetGrandCompanyPacket.buildPacket(player.actorID, player.actorID, 0x01, 0x1B, 0x1B, 0x1B), true, false);
client.queuePacket(SetPlayerTitlePacket.buildPacket(player.actorID, player.actorID, 0x00), true, false);
client.queuePacket(SetCurrentJobPacket.buildPacket(player.actorID, player.actorID, 0x13), true, false);
client.queuePacket(packet196);//client.queuePacket(_0x196Packet.buildPacket(player.actorID, player.actorID), true, false);
//client.queuePacket(packet196);//client.queuePacket(_0x196Packet.buildPacket(player.actorID, player.actorID), true, false);
client.queuePacket(SetChocoboNamePacket.buildPacket(player.actorID, player.actorID, "Boco"), true, false);
client.queuePacket(SetHasChocoboPacket.buildPacket(player.actorID, true), true, false);
client.queuePacket(SetHasGoobbuePacket.buildPacket(player.actorID, true), true, false);
@ -339,13 +347,18 @@ namespace FFXIVClassic_Lobby_Server
book.cutsceneFlags[i] = true;
client.queuePacket(book.buildPacket(player.actorID), true, false);
//client.queuePacket(SetPlayerDreamPacket.buildPacket(player.actorID, 0x0A), true, false);
client.queuePacket(SetPlayerDreamPacket.buildPacket(player.actorID, 11), true, false);
// loadTest(client, player);
// return;
//BasePacket packet1a5 = new BasePacket("./packets/1ax/1a5");
//packet1a5.replaceActorID(player.actorID);
//client.queuePacket(packet1a5);
BasePacket tpacket = BasePacket.createPacket(player.getActor().createInitSubpackets(player.actorID), true, false);
client.queuePacket(tpacket);
//loadTest(client, player);
//return;
inn.addActorToZone(player.getActor());
// BasePacket tpacket = BasePacket.createPacket(player.getActor().createInitSubpackets(player.actorID), true, false);
// client.queuePacket(tpacket);
client.queuePacket(reply7);
client.queuePacket(reply8);
@ -354,7 +367,6 @@ namespace FFXIVClassic_Lobby_Server
// client.queuePacket(reply11);
client.queuePacket(reply12);
inn.addActorToZone(player.getActor());
break;
//Chat Received
@ -391,17 +403,35 @@ namespace FFXIVClassic_Lobby_Server
LockTargetPacket lockTarget = new LockTargetPacket(subpacket.data);
player.getActor().currentLockedTarget = lockTarget.actorID;
break;
//Start Script
//Start Event
case 0x012D:
subpacket.debugPrintSubPacket();
CommandStartRequestPacket commandStart = new CommandStartRequestPacket(subpacket.data);
EventStartPacket eventStart = new EventStartPacket(subpacket.data);
player.eventCurrentOwner = eventStart.scriptOwnerActorID;
player.eventCurrentStarter = eventStart.eventStarter;
client.queuePacket(BasePacket.createPacket(ActorDoEmotePacket.buildPacket(player.actorID, player.getActor().currentTarget, 137), true, false));
//Is it a static actor? If not look in the player's instance
//Actor ownerActor = findActor(player, player.eventCurrentOwner);
//if (ownerActor == null)
// break;
//luaEngine.doEventStart(player, ownerActor, eventStart);
//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.eventStarter, LuaParamReader.dumpParams(eventStart.luaParams)));
break;
//Script Result
//Event Result
case 0x012E:
subpacket.debugPrintSubPacket();
ScriptResultPacket scriptResult = new ScriptResultPacket(subpacket.data);
EventUpdatePacket eventUpdate = new EventUpdatePacket(subpacket.data);
Log.debug(String.Format("\n===Event UPDATE===\nSource Actor: 0x{0:X}\nCaller Actor: 0x{1:X}\nVal1: 0x{2:X}\nVal2: 0x{3:X}\nFunction ID: 0x{4:X}\nParams: {5}", eventUpdate.actorID, eventUpdate.scriptOwnerActorID, eventUpdate.val1, eventUpdate.val2, eventUpdate.step, LuaUtils.dumpParams(eventUpdate.luaParams)));
/*Actor updateOwnerActor = findActor(player, player.eventCurrentOwner);
if (updateOwnerActor == null)
break;
luaEngine.doEventUpdated(player, updateOwnerActor, eventUpdate);
*/
break;
case 0x012F:
subpacket.debugPrintSubPacket();
@ -521,26 +551,33 @@ namespace FFXIVClassic_Lobby_Server
}
}
public void processScriptResult(SubPacket subpacket)
/*
public Actor findActor(ConnectedPlayer player, uint id)
{
uint someId1 = 0;
uint someId2 = 0;
uint someId3 = 0;
using (MemoryStream mem = new MemoryStream(subpacket.data))
Actor ownerActor = mStaticActors[id];
if (ownerActor == null)
{
using (BinaryReader binReader = new BinaryReader(mem))
foreach (Actor a in player.actorInstanceList)
{
binReader.BaseStream.Seek(0x2C, SeekOrigin.Begin);
someId1 = binReader.ReadUInt32();
someId2 = binReader.ReadUInt32();
someId3 = binReader.ReadUInt32();
if (a.actorID == player.eventCurrentOwner)
{
ownerActor = a;
break;
}
}
if (ownerActor == null)
return null;
}
Log.info(String.Format("ProcessScriptResult: Id1 = {0}, Id2 = {1}, Id3 = {2}", someId1, someId2, someId3));
return ownerActor;
}
*/
private void initNpcs()
{
List<Npc> npcList = Database.getNpcList();
foreach (Npc npc in npcList)
inn.addActorToZone(npc);
Log.info(String.Format("Loaded {0} npcs...", npcList.Count));
}
private void loadTest(ClientConnection client, ConnectedPlayer player)

View File

@ -0,0 +1,102 @@
using FFXIVClassic_Lobby_Server;
using FFXIVClassic_Lobby_Server.common;
using FFXIVClassic_Lobby_Server.dataobjects;
using FFXIVClassic_Lobby_Server.packets;
using FFXIVClassic_Map_Server.dataobjects.chara;
using FFXIVClassic_Map_Server.lua;
using FFXIVClassic_Map_Server.packets.send.actor;
using FFXIVClassic_Map_Server.packets.send.Actor;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
namespace FFXIVClassic_Map_Server.dataobjects
{
class Actor
{
public uint actorId;
public string actorName;
public uint displayNameId = 0xFFFFFFFF;
public string customDisplayName;
public uint animationId;
public float positionX, positionY, positionZ, rotation;
public float oldPositionX, oldPositionY, oldPositionZ, oldRotation;
public ushort moveState, oldMoveState;
public uint currentZoneId;
public string className;
public List<LuaParam> classParams;
public Actor(uint Id)
{
actorId = Id;
}
public SubPacket createNamePacket(uint playerActorId)
{
return SetActorNamePacket.buildPacket(actorId, playerActorId, displayNameId, displayNameId == 0xFFFFFFFF ? customDisplayName : "");
}
public SubPacket createSpeedPacket(uint playerActorId)
{
return SetActorSpeedPacket.buildPacket(actorId, playerActorId);
}
public SubPacket createSpawnPositonPacket(uint playerActorId, uint spawnType)
{
return SetActorPositionPacket.buildPacket(actorId, playerActorId, SetActorPositionPacket.INNPOS_X, SetActorPositionPacket.INNPOS_Y, SetActorPositionPacket.INNPOS_Z, SetActorPositionPacket.INNPOS_ROT, SetActorPositionPacket.SPAWNTYPE_PLAYERWAKE);
//return SetActorPositionPacket.buildPacket(actorId, playerActorId, -211.895477f, 190.000000f, 29.651011f, 2.674819f, SetActorPositionPacket.SPAWNTYPE_PLAYERWAKE);
}
public SubPacket createPositionUpdatePacket(uint playerActorId)
{
return MoveActorToPositionPacket.buildPacket(actorId, playerActorId, positionX, positionY, positionZ, rotation, moveState);
}
public SubPacket createScriptBindPacket(uint playerActorId)
{
return null;
}
public BasePacket createActorSpawnPackets(uint playerActorId)
{
if (this is Character)
return ((Character)this).createActorSpawnPackets(playerActorId);
else
return null;
}
public override bool Equals(Object obj)
{
Actor actorObj = obj as Actor;
if (actorObj == null)
return false;
else
return actorId == actorObj.actorId;
}
public string getName()
{
return actorName;
}
public string getClassName()
{
return className;
}
public List<LuaParam> getLuaParams()
{
return classParams;
}
}
}

View File

@ -0,0 +1,116 @@
using FFXIVClassic_Map_Server.actors.judge;
using FFXIVClassic_Map_Server.dataobjects;
using FFXIVClassic_Map_Server.dataobjects.actors;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.actors
{
class StaticActors
{
private Dictionary<uint, Actor> mStaticActors = new Dictionary<uint, Actor>();
public StaticActors()
{
//Judges
mStaticActors.Add(0xA0F5BAF1, new Judge(0x4BAF1, "JudgeMaster"));
mStaticActors.Add(0xA0F5E201, new Judge(0x4E201, "CommonJudge"));
mStaticActors.Add(0xA0F5E206, new Judge(0x4E206, "TutorialJudge"));
mStaticActors.Add(0xA0F5E20D, new Judge(0x4E20D, "ChocoboJudge"));
mStaticActors.Add(0xA0F50911, new Judge(0x50911, "DeceptionJudge"));
//Commands
mStaticActors.Add(0xA0F02EE2, new Command(0xA0F02EE2, "ResetOccupiedCommand"));
mStaticActors.Add(0xA0F02EE3, new Command(0xA0F02EE3, "CombinationManagementCommand"));
mStaticActors.Add(0xA0F02EE4, new Command(0xA0F02EE4, "CombinationStartCommand"));
mStaticActors.Add(0xA0F02EE5, new Command(0xA0F02EE5, "BonusPointCOmmand"));
mStaticActors.Add(0xA0F02EE7, new Command(0xA0F02EE7, "ChangeEquipCommand"));
mStaticActors.Add(0xA0F02EE9, new Command(0xA0F02EE9, "EquipCommand"));
mStaticActors.Add(0xA0F02EEA, new Command(0xA0F02EEA, "EquipAbilityCommand"));
mStaticActors.Add(0xA0F02EEB, new Command(0xA0F02EEB, "PartyTargetCommand"));
mStaticActors.Add(0xA0F02EED, new Command(0xA0F02EED, "EquipPartsShowHideCommand"));
mStaticActors.Add(0xA0F02EEE, new Command(0xA0F02EEE, "ChocoboRideCommand"));
mStaticActors.Add(0xA0F02EEF, new Command(0xA0F02EEF, "ChocoboRideCommand"));
mStaticActors.Add(0xA0F02EF0, new Command(0xA0F02EF0, "ReverseInputOperationCommand"));
mStaticActors.Add(0xA0F02EF1, new Command(0xA0F02EF1, "ChangeJobCommand"));
mStaticActors.Add(0xA0F05209, new Command(0xA0F05209, "ActivateCommand"));
mStaticActors.Add(0xA0F0520A, new Command(0xA0F0520A, "ActivateCommand"));
mStaticActors.Add(0xA0F0520D, new Command(0xA0F0520D, "CommandCancelCommand"));
mStaticActors.Add(0xA0F0520E, new Command(0xA0F0520E, "CommandCancelCommand"));
mStaticActors.Add(0xA0F0520F, new Command(0xA0F0520F, "ItemCommand"));
mStaticActors.Add(0xA0F05210, new Command(0xA0F05210, "AutoAttackTargetChangeCommand"));
mStaticActors.Add(0xA0F055FC, new Command(0xA0F055FC, "CraftCommand"));
mStaticActors.Add(0xA0F055FD, new Command(0xA0F055FD, "CraftCommand"));
mStaticActors.Add(0xA0F055FF, new Command(0xA0F055FF, "CraftCommand"));
mStaticActors.Add(0xA0F05E25, new Command(0xA0F05E25, "TalkCommand"));
mStaticActors.Add(0xA0F05E26, new Command(0xA0F05E26, "EmoteStandardCommand"));
mStaticActors.Add(0xA0F05E28, new Command(0xA0F05E28, "ContinueCommand"));
mStaticActors.Add(0xA0F05E29, new Command(0xA0F05E29, "LoginEventCommand"));
mStaticActors.Add(0xA0F05E8B, new Command(0xA0F05E8B, "PartyInviteCommand"));
mStaticActors.Add(0xA0F05E8C, new Command(0xA0F05E8C, "PartyJoinCommand"));
mStaticActors.Add(0xA0F05E8D, new Command(0xA0F05E8D, "PartyResignCommand"));
mStaticActors.Add(0xA0F05E8E, new Command(0xA0F05E8E, "PartyBreakupCommand"));
mStaticActors.Add(0xA0F05E8F, new Command(0xA0F05E8F, "PartyKickCommand"));
mStaticActors.Add(0xA0F05E90, new Command(0xA0F05E90, "PartyLeaderCommand"));
mStaticActors.Add(0xA0F05E91, new Command(0xA0F05E91, "PartyAcceptCommand"));
mStaticActors.Add(0xA0F05E93, new Command(0xA0F05E93, "RequestQuestJournalCommand"));
mStaticActors.Add(0xA0F05E94, new Command(0xA0F05E94, "RequestInformationCommand"));
mStaticActors.Add(0xA0F05E95, new Command(0xA0F05E95, "NpcLinkshellChatCommand"));
mStaticActors.Add(0xA0F05E96, new Command(0xA0F05E96, "BazaarDealCommand"));
mStaticActors.Add(0xA0F05E97, new Command(0xA0F05E97, "BazaarCheckCommand"));
mStaticActors.Add(0xA0F05E98, new Command(0xA0F05E98, "BazaarUndealCommand"));
mStaticActors.Add(0xA0F05E99, new Command(0xA0F05E99, "TradeOfferCommand"));
mStaticActors.Add(0xA0F05E9A, new Command(0xA0F05E9A, "TradeExecuteCommand"));
mStaticActors.Add(0xA0F05E9B, new Command(0xA0F05E9B, "LogoutCommand"));
mStaticActors.Add(0xA0F05E9C, new Command(0xA0F05E9C, "TeleportCommand"));
mStaticActors.Add(0xA0F05E9D, new Command(0xA0F05E9D, "ItemStuffCommand"));
mStaticActors.Add(0xA0F05E9E, new Command(0xA0F05E9E, "ItemArrangementCommand"));
mStaticActors.Add(0xA0F05E9F, new Command(0xA0F05E9F, "ItemMovePackageCommand"));
mStaticActors.Add(0xA0F05EA0, new Command(0xA0F05EA0, "ItemSplitCommand"));
mStaticActors.Add(0xA0F05EA1, new Command(0xA0F05EA1, "ItemTransferCommand"));
mStaticActors.Add(0xA0F05EA2, new Command(0xA0F05EA2, "ItemWasteCommand"));
mStaticActors.Add(0xA0F05EA3, new Command(0xA0F05EA3, "BazaarTradeCommand"));
mStaticActors.Add(0xA0F05EA4, new Command(0xA0F05EA4, "WidgetOpenCommand"));
mStaticActors.Add(0xA0F05EA5, new Command(0xA0F05EA5, "MacroCommand"));
mStaticActors.Add(0xA0F05EA6, new Command(0xA0F05EA6, "TradeOfferCancelCommand"));
mStaticActors.Add(0xA0F05EA7, new Command(0xA0F05EA7, "LinkshellAppointCommand"));
mStaticActors.Add(0xA0F05EA8, new Command(0xA0F05EA8, "LinkshellInviteCommand"));
mStaticActors.Add(0xA0F05EA9, new Command(0xA0F05EA9, "LinkshellInviteCancelCommand"));
mStaticActors.Add(0xA0F05EAA, new Command(0xA0F05EAA, "LinkshellKickCommand"));
mStaticActors.Add(0xA0F05EAB, new Command(0xA0F05EAB, "LinkshellResignCommand"));
mStaticActors.Add(0xA0F05EAC, new Command(0xA0F05EAC, "LinkshellChangeCommand"));
mStaticActors.Add(0xA0F05EAE, new Command(0xA0F05EAE, "CheckCommand"));
mStaticActors.Add(0xA0F05EAF, new Command(0xA0F05EAF, "NetStatUserSwitchCommand"));
mStaticActors.Add(0xA0F05EB0, new Command(0xA0F05EB0, "ItemMaterializeCommand"));
mStaticActors.Add(0xA0F05EB1, new Command(0xA0F05EB1, "JournalCommand"));
mStaticActors.Add(0xA0F05EB2, new Command(0xA0F05EB2, "DiceCommand"));
mStaticActors.Add(0xA0F05EB3, new Command(0xA0F05EB3, "RepairOrderCommand"));
mStaticActors.Add(0xA0F05EB4, new Command(0xA0F05EB4, "RepairEquipmentsCommand"));
mStaticActors.Add(0xA0F05EED, new Command(0xA0F05EED, "PlaceDrivenCommand"));
mStaticActors.Add(0xA0F05EEE, new Command(0xA0F05EEE, "ContentCommand"));
mStaticActors.Add(0xA0F05EEF, new Command(0xA0F05EEF, "ConfirmGroupCommand"));
mStaticActors.Add(0xA0F05EF0, new Command(0xA0F05EF0, "ConfirmWarpCOmmand"));
mStaticActors.Add(0xA0F05EF1, new Command(0xA0F05EF1, "ConfirmTradeCommand"));
mStaticActors.Add(0xA0F05EF2, new Command(0xA0F05EF2, "ConfirmRaiseCommand"));
mStaticActors.Add(0xA0F05EF8, new Command(0xA0F05EF8, "EmoteSitCommand "));
mStaticActors.Add(0xA0F06A0E, new Command(0xA0F06A0E, "AttackWeaponSKill"));
mStaticActors.Add(0xA0F07339, new Command(0xA0F07339, "NegotiateCommand"));
mStaticActors.Add(0xA0F07595, new Command(0xA0F07595, "DebugInputCommand"));
}
public bool exists(uint actorId)
{
return mStaticActors[actorId] != null;
}
public Actor getActor(uint actorId)
{
return mStaticActors[actorId];
}
}
}

View File

@ -0,0 +1,52 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.dataobjects.chara
{
class BattleTemp
{
public const uint NAMEPLATE_SHOWN = 0xFBFBCFB1;
public const uint TARGETABLE = 0x2138FD71;
public const uint STAT_STRENGTH = 4;
public const uint STAT_VITALITY = 5;
public const uint STAT_DEXTERITY = 6;
public const uint STAT_INTELLIGENCE = 7;
public const uint STAT_MIND = 8;
public const uint STAT_PIETY = 9;
public const uint STAT_RESISTANCE_FIRE = 10;
public const uint STAT_RESISTANCE_ICE = 11;
public const uint STAT_RESISTANCE_WIND = 12;
public const uint STAT_RESISTANCE_LIGHTNING = 3;
public const uint STAT_RESISTANCE_EARTH = 14;
public const uint STAT_RESISTANCE_WATER = 15;
public const uint STAT_ATTACK = 18;
public const uint STAT_ACCURACY = 16;
public const uint STAT_NORMALDEFENSE = 19;
public const uint STAT_EVASION = 17;
public const uint STAT_ATTACK_MAGIC = 24;
public const uint STAT_HEAL_MAGIC = 25;
public const uint STAT_ENCHANCEMENT_MAGIC_POTENCY = 26;
public const uint STAT_ENFEEBLING_MAGIC_POTENCY = 27;
public const uint STAT_MAGIC_ACCURACY = 28;
public const uint STAT_MAGIC_EVASION = 29;
public const uint STAT_CRAFT_PROCESSING = 30;
public const uint STAT_CRAFT_MAGIC_PROCESSING = 31;
public const uint STAT_CRAFT_PROCESS_CONTROL = 32;
public const uint STAT_HARVEST_POTENCY = 33;
public const uint STAT_HARVEST_LIMIT = 34;
public const uint STAT_HARVEST_RATE = 35;
public int[] castGauge_speed = new int[2];
public bool[] timingCommandFlag = new bool[4];
public ushort[] generalParameter = new ushort[32];
}
}

View File

@ -0,0 +1,79 @@
using FFXIVClassic_Lobby_Server.packets;
using FFXIVClassic_Map_Server.packets.send.actor;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.dataobjects.chara
{
class Character:Actor
{
public const int SIZE = 0;
public const int COLORINFO = 1;
public const int FACEINFO = 2;
public const int HIGHLIGHT_HAIR = 3;
public const int VOICE = 4;
public const int WEAPON1 = 5;
public const int WEAPON2 = 6;
public const int WEAPON3 = 7;
public const int UNKNOWN1 = 8;
public const int UNKNOWN2 = 9;
public const int UNKNOWN3 = 10;
public const int UNKNOWN4 = 11;
public const int HEADGEAR = 12;
public const int BODYGEAR = 13;
public const int LEGSGEAR = 14;
public const int HANDSGEAR = 15;
public const int FEETGEAR = 16;
public const int WAISTGEAR = 17;
public const int UNKNOWN5 = 18;
public const int R_EAR = 19;
public const int L_EAR = 20;
public const int UNKNOWN6 = 21;
public const int UNKNOWN7 = 22;
public const int R_FINGER = 23;
public const int L_FINGER = 24;
public uint modelID;
public uint[] appearanceIDs = new uint[0x1D];
public uint currentTarget = 0xC0000000;
public uint currentLockedTarget = 0xC0000000;
public uint currentState = SetActorStatePacket.STATE_PASSIVE;
public CharaWork charaWork = new CharaWork();
public PlayerWork playerWork = new PlayerWork();
public Character(uint actorID) : base(actorID)
{
}
public SubPacket createAppearancePacket(uint playerActorID)
{
SetActorAppearancePacket setappearance = new SetActorAppearancePacket(modelID, appearanceIDs);
return setappearance.buildPacket(actorId, playerActorID);
}
public SubPacket createStatePacket(uint playerActorID)
{
return SetActorStatePacket.buildPacket(actorId, playerActorID, currentState);
}
public BasePacket createActorSpawnPackets(uint playerActorID)
{
List<SubPacket> subpackets = new List<SubPacket>();
subpackets.Add(createSpeedPacket(playerActorID));
subpackets.Add(createSpawnPositonPacket(playerActorID, 0xFF));
subpackets.Add(createAppearancePacket(playerActorID));
subpackets.Add(createNamePacket(playerActorID));
subpackets.Add(_0xFPacket.buildPacket(playerActorID, playerActorID));
subpackets.Add(createStatePacket(playerActorID));
return BasePacket.createPacket(subpackets, true, false);
}
}
}

View File

@ -0,0 +1,62 @@
using FFXIVClassic_Lobby_Server;
using FFXIVClassic_Lobby_Server.common;
using FFXIVClassic_Lobby_Server.dataobjects;
using FFXIVClassic_Map_Server.lua;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.dataobjects.chara.npc
{
class Npc : Character
{
public Npc(uint id, string actorName, uint displayNameId, string customDisplayName, float positionX, float positionY, float positionZ, float rotation, uint animationId, string className, byte[] initParams)
: base(id)
{
this.actorName = actorName;
this.displayNameId = displayNameId;
this.customDisplayName = customDisplayName;
this.positionX = positionX;
this.positionY = positionY;
this.positionZ = positionZ;
this.rotation = rotation;
this.animationId = animationId;
this.className = className;
if (initParams.Length != 0)
this.classParams = LuaUtils.readLuaParams(initParams);
setPlayerAppearance();
}
public void setPlayerAppearance()
{
DBAppearance appearance = Database.getAppearance(false, actorId);
if (appearance == null)
return;
modelID = DBAppearance.getTribeModel(appearance.tribe);
appearanceIDs[SIZE] = appearance.size;
appearanceIDs[COLORINFO] = (uint)(appearance.skinColor | (appearance.hairColor << 10) | (appearance.eyeColor << 20));
appearanceIDs[FACEINFO] = PrimitiveConversion.ToUInt32(appearance.getFaceInfo());
appearanceIDs[HIGHLIGHT_HAIR] = (uint)(appearance.hairHighlightColor | appearance.hairStyle << 10);
appearanceIDs[VOICE] = appearance.voice;
appearanceIDs[WEAPON1] = appearance.mainHand;
appearanceIDs[WEAPON2] = appearance.offHand;
appearanceIDs[HEADGEAR] = appearance.head;
appearanceIDs[BODYGEAR] = appearance.body;
appearanceIDs[LEGSGEAR] = appearance.legs;
appearanceIDs[HANDSGEAR] = appearance.hands;
appearanceIDs[FEETGEAR] = appearance.feet;
appearanceIDs[WAISTGEAR] = appearance.waist;
appearanceIDs[R_EAR] = appearance.rightEar;
appearanceIDs[L_EAR] = appearance.leftEar;
appearanceIDs[R_FINGER] = appearance.rightFinger;
appearanceIDs[L_FINGER] = appearance.leftFinger;
}
}
}

View File

@ -10,10 +10,12 @@ using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.dataobjects.chara
{
class PlayerActor : Actor
class Player : Character
{
public PlayerActor(uint actorID) : base(actorID)
public Player(uint actorID) : base(actorID)
{
actorName = String.Format("_player{0:00000000}", actorID);
DBStats stats = Database.getCharacterStats(actorID);
charaWork.property[0] = 1;
@ -44,7 +46,7 @@ namespace FFXIVClassic_Map_Server.dataobjects.chara
public void setPlayerAppearance()
{
DBAppearance appearance = Database.getAppearance(actorID);
DBAppearance appearance = Database.getAppearance(true, actorId);
modelID = DBAppearance.getTribeModel(appearance.tribe);
appearanceIDs[SIZE] = appearance.size;

View File

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.dataobjects.actors
{
class Command : Actor
{
public Command(uint actorID, string name) : base(actorID)
{
actorName = name;
}
}
}

View File

@ -0,0 +1,17 @@
using FFXIVClassic_Map_Server.dataobjects;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.actors.judge
{
class Judge : Actor
{
public Judge(uint actorID, string name) : base(actorID)
{
actorName = name;
}
}
}

View File

@ -1,162 +0,0 @@
using FFXIVClassic_Lobby_Server;
using FFXIVClassic_Lobby_Server.common;
using FFXIVClassic_Lobby_Server.dataobjects;
using FFXIVClassic_Lobby_Server.packets;
using FFXIVClassic_Map_Server.dataobjects.chara;
using FFXIVClassic_Map_Server.packets.send.actor;
using FFXIVClassic_Map_Server.packets.send.Actor;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
namespace FFXIVClassic_Map_Server.dataobjects
{
class Actor
{
public const int SIZE = 0;
public const int COLORINFO = 1;
public const int FACEINFO = 2;
public const int HIGHLIGHT_HAIR = 3;
public const int VOICE = 4;
public const int WEAPON1 = 5;
public const int WEAPON2 = 6;
public const int WEAPON3 = 7;
public const int UNKNOWN1 = 8;
public const int UNKNOWN2 = 9;
public const int UNKNOWN3 = 10;
public const int UNKNOWN4 = 11;
public const int HEADGEAR = 12;
public const int BODYGEAR = 13;
public const int LEGSGEAR = 14;
public const int HANDSGEAR = 15;
public const int FEETGEAR = 16;
public const int WAISTGEAR = 17;
public const int UNKNOWN5 = 18;
public const int R_EAR = 19;
public const int L_EAR = 20;
public const int UNKNOWN6 = 21;
public const int UNKNOWN7 = 22;
public const int R_FINGER = 23;
public const int L_FINGER = 24;
public uint actorID;
public CharaWork charaWork = new CharaWork();
public PlayerWork playerWork = new PlayerWork();
public uint displayNameID = 0xFFFFFFFF;
public string customDisplayName;
public uint modelID;
public uint[] appearanceIDs = new uint[0x1D];
public uint currentTarget = 0xC0000000;
public uint currentLockedTarget = 0xC0000000;
public float positionX, positionY, positionZ, rotation;
public float oldPositionX, oldPositionY, oldPositionZ, oldRotation;
public ushort moveState, oldMoveState;
public uint currentState = SetActorStatePacket.STATE_PASSIVE;
public uint currentZoneID;
public Actor(uint id)
{
actorID = id;
}
public SubPacket createNamePacket(uint playerActorID)
{
return SetActorNamePacket.buildPacket(actorID, playerActorID, displayNameID, displayNameID == 0xFFFFFFFF ? customDisplayName : "");
}
public SubPacket createAppearancePacket(uint playerActorID)
{
SetActorAppearancePacket setappearance = new SetActorAppearancePacket(modelID, appearanceIDs);
return setappearance.buildPacket(actorID, playerActorID);
}
public SubPacket createStatePacket(uint playerActorID)
{
return SetActorStatePacket.buildPacket(actorID, playerActorID, currentState);
}
public SubPacket createSpeedPacket(uint playerActorID)
{
return SetActorSpeedPacket.buildPacket(actorID, playerActorID);
}
public SubPacket createSpawnPositonPacket(uint playerActorID, uint spawnType)
{
return SetActorPositionPacket.buildPacket(actorID, playerActorID, SetActorPositionPacket.INNPOS_X, SetActorPositionPacket.INNPOS_Y, SetActorPositionPacket.INNPOS_Z, SetActorPositionPacket.INNPOS_ROT, SetActorPositionPacket.SPAWNTYPE_PLAYERWAKE);
//return SetActorPositionPacket.buildPacket(actorID, playerActorID, -211.895477f, 190.000000f, 29.651011f, 2.674819f, SetActorPositionPacket.SPAWNTYPE_PLAYERWAKE);
}
public SubPacket createPositionUpdatePacket(uint playerActorID)
{
return MoveActorToPositionPacket.buildPacket(actorID, playerActorID, positionX, positionY, positionZ, rotation, moveState);
}
public SubPacket createScriptBindPacket(uint playerActorID)
{
return null;
}
public BasePacket createActorSpawnPackets(uint playerActorID)
{
List<SubPacket> subpackets = new List<SubPacket>();
subpackets.Add(createSpeedPacket(playerActorID));
subpackets.Add(createSpawnPositonPacket(playerActorID, 0xFF));
subpackets.Add(createAppearancePacket(playerActorID));
subpackets.Add(createNamePacket(playerActorID));
subpackets.Add(_0xFPacket.buildPacket(playerActorID, playerActorID));
subpackets.Add(createStatePacket(playerActorID));
//subpackets.Add(createScriptBindPacket(playerActorID));
return BasePacket.createPacket(subpackets, true, false);
}
public List<SubPacket> createInitSubpackets(uint playerActorID)
{
List<SubPacket> subpacketList = new List<SubPacket>();
SetActorPropetyPacket setProperty = new SetActorPropetyPacket();
setProperty.addByte(0x0DB5A5BF, 5);
setProperty.addProperty(this, "charaWork.battleSave.potencial");
setProperty.addProperty(this, "charaWork.property[0]");
setProperty.addProperty(this, "charaWork.property[1]");
setProperty.addProperty(this, "charaWork.property[2]");
setProperty.addProperty(this, "charaWork.property[4]");
setProperty.addProperty(this, "charaWork.parameterSave.hp[0]");
setProperty.addProperty(this, "charaWork.parameterSave.hpMax[0]");
setProperty.addProperty(this, "charaWork.parameterSave.mp");
setProperty.addProperty(this, "charaWork.parameterSave.mpMax");
setProperty.addProperty(this, "charaWork.parameterTemp.tp");
setProperty.addProperty(this, "charaWork.parameterSave.state_mainSkill[0]");
setProperty.addProperty(this, "charaWork.parameterSave.state_mainSkillLevel");
setProperty.addProperty(this, "charaWork.depictionJudge");
setProperty.addProperty(this, "charaWork.statusShownTime[0]");
setProperty.setTarget("/_init");
subpacketList.Add(setProperty.buildPacket(actorID, playerActorID));
return subpacketList;
}
public override bool Equals(Object obj)
{
Actor actorObj = obj as Actor;
if (actorObj == null)
return false;
else
return actorID == actorObj.actorID;
}
}
}

View File

@ -14,8 +14,11 @@ namespace FFXIVClassic_Map_Server.dataobjects
class ConnectedPlayer
{
public uint actorID = 0;
PlayerActor playerActor;
List<Actor> actorInstanceList = new List<Actor>();
Player playerActor;
public List<Actor> actorInstanceList = new List<Actor>();
public uint eventCurrentOwner = 0;
public string eventCurrentStarter = "";
ClientConnection conn1;
ClientConnection conn2;
@ -71,16 +74,26 @@ namespace FFXIVClassic_Map_Server.dataobjects
return conn2;
}
public Actor getActor()
public void queuePacket(BasePacket basePacket)
{
conn1.queuePacket(basePacket);
}
public void queuePacket(SubPacket subPacket, bool isAuthed, bool isEncrypted)
{
conn1.queuePacket(subPacket, isAuthed, isEncrypted);
}
public Player getActor()
{
return playerActor;
}
public void createPlayerActor(uint actorId, DBCharacter chara)
{
playerActor = new PlayerActor(actorId);
playerActor = new Player(actorId);
playerActor.displayNameID = 0xFFFFFFFF;
playerActor.displayNameId = 0xFFFFFFFF;
playerActor.customDisplayName = chara.name;
playerActor.setPlayerAppearance();
actorInstanceList.Add(playerActor);
@ -106,7 +119,6 @@ namespace FFXIVClassic_Map_Server.dataobjects
}
public List<BasePacket> updateInstance(List<Actor> list)
{
List<BasePacket> basePackets = new List<BasePacket>();
@ -116,17 +128,17 @@ namespace FFXIVClassic_Map_Server.dataobjects
{
Actor actor = list[i];
if (actor.actorID == playerActor.actorID)
if (actor.actorId == playerActor.actorId)
continue;
if (actorInstanceList.Contains(actor))
{
posUpdateSubpackets.Add(actor.createPositionUpdatePacket(playerActor.actorID));
posUpdateSubpackets.Add(actor.createPositionUpdatePacket(playerActor.actorId));
}
else
{
BasePacket p = actor.createActorSpawnPackets(playerActor.actorID);
p.replaceActorID(0x29b27d3, playerActor.actorID);
BasePacket p = actor.createActorSpawnPackets(playerActor.actorId);
p.replaceActorID(playerActor.actorId);
basePackets.Add(p);
actorInstanceList.Add(actor);
}
@ -137,5 +149,6 @@ namespace FFXIVClassic_Map_Server.dataobjects
return basePackets;
}
}
}

View File

@ -1,45 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.dataobjects.chara
{
class BattleTemp
{
//These are known property IDs
public const uint NAMEPLATE_SHOWN = 0xFBFBCFB1;
public const uint TARGETABLE = 0x2138FD71;
public const uint STAT_STRENGTH = 0x647A29A8;
public const uint STAT_VITALITY = 0x939E884A;
public const uint STAT_DEXTERITY = 0x416571AC;
public const uint STAT_INTELLIGENCE = 0x2DFBC13A;
public const uint STAT_MIND = 0x0E704141;
public const uint STAT_PIETY = 0x6CCAF8B3;
public const uint STAT_ACCURACY = 0x91CD44E7;
public const uint STAT_EVASION = 0x11B1B22D;
public const uint STAT_ATTACK = 0xBA51C4E1;
public const uint STAT_DEFENSE = 0x8CAE90DB;
public const uint STAT_ATTACK_MAGIC_POTENCY = 0x1F3DACC5;
public const uint STAT_HEALING_MAGIC_POTENCY = 0xA329599A;
public const uint STAT_ENCHANCEMENT_MAGIC_POTENCY = 0xBA51C4E1;
public const uint STAT_ENFEEBLING_MAGIC_POTENCY = 0xEB90BAAB;
public const uint STAT_MAGIC_ACCURACY = 0xD57DC284;
public const uint STAT_MAGIC_EVASION = 0x17AB37EF;
public const uint RESISTANCE_FIRE = 0x79C7ECFF;
public const uint RESISTANCE_ICE = 0xE17D8C7A;
public const uint RESISTANCE_WIND = 0x204CF942;
public const uint RESISTANCE_LIGHTNING = 0x1C2AEC73;
public const uint RESISTANCE_EARTH = 0x5FC56D16;
public const uint RESISTANCE_WATER = 0x64803E98;
//End of properties
public int[] castGauge_speed = new int[2];
public bool[] timingCommandFlag = new bool[4];
public ushort[] generalParameter = new ushort[32];
}
}