1
Fork 0
mirror of https://bitbucket.org/Ioncannon/project-meteor-server.git synced 2025-04-24 21:57:45 +00:00

Merge branch 'master' of https://bitbucket.org/Ioncannon/ffxiv-classic-server into method_casing

# Conflicts:
#	FFXIVClassic Map Server/CommandProcessor.cs
#	FFXIVClassic Map Server/WorldManager.cs
#	FFXIVClassic Map Server/actors/area/Area.cs
#	FFXIVClassic Map Server/actors/area/PrivateArea.cs
#	FFXIVClassic Map Server/actors/area/Zone.cs
#	FFXIVClassic Map Server/actors/chara/npc/Npc.cs
#	FFXIVClassic Map Server/common/Utils.cs
#	FFXIVClassic Map Server/dataobjects/ConnectedPlayer.cs
This commit is contained in:
Tahir Akhlaq 2016-06-14 22:54:02 +01:00
commit 335a59204c
521 changed files with 12848 additions and 10394 deletions

View file

@ -178,7 +178,7 @@ namespace FFXIVClassic.Common
// *** Check if original file exists *** // *** Check if original file exists ***
bool OriginalFileExists = File.Exists(m_FileName); bool OriginalFileExists = File.Exists(m_FileName);
// *** Get temporary file name *** // *** get temporary file name ***
string TmpFileName = Path.ChangeExtension(m_FileName, "$n$"); string TmpFileName = Path.ChangeExtension(m_FileName, "$n$");
// *** Copy content of original file to temporary file, replace modified values *** // *** Copy content of original file to temporary file, replace modified values ***

View file

@ -219,5 +219,15 @@ namespace FFXIVClassic.Common
return data; return data;
} }
public static string ToStringBase63(int number)
{
string lookup = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
string secondDigit = lookup.Substring((int)Math.Floor((double)number / (double)lookup.Length), 1);
string firstDigit = lookup.Substring(number % lookup.Length, 1);
return secondDigit + firstDigit;
}
} }
} }

View file

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="NLog" version="4.3.5" targetFramework="net45" /> <package id="NLog" version="4.3.5" tarGetFramework="net45" />
</packages> </packages>

View file

@ -16,22 +16,22 @@
See https://github.com/nlog/nlog/wiki/Configuration-file See https://github.com/nlog/nlog/wiki/Configuration-file
for information on customizing logging rules and outputs. for information on customizing logging rules and outputs.
--> -->
<targets async="true"> <tarGets async="true">
<!-- <!--
add your targets here add your tarGets here
See https://github.com/nlog/NLog/wiki/Targets for possible targets. See https://github.com/nlog/NLog/wiki/TarGets for possible tarGets.
See https://github.com/nlog/NLog/wiki/Layout-Renderers for the possible layout renderers. See https://github.com/nlog/NLog/wiki/Layout-Renderers for the possible layout renderers.
--> -->
<!-- <!--
Write events to a file with the date in the filename. Write events to a file with the date in the filename.
<target xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log" <tarGet xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log"
layout="${longdate} ${uppercase:${level}} ${message}" /> layout="${longdate} ${uppercase:${level}} ${message}" />
--> -->
<target xsi:type="ColoredConsole" name="console" layout="[${longdate}] [${uppercase:${level}}] ${message}" /> <tarGet xsi:type="ColoredConsole" name="console" layout="[${longdate}] [${uppercase:${level}}] ${message}" />
<target xsi:type="File" name="file" fileName="${basedir}/logs/${shortdate}/lobby.log" layout="[${longdate}] [${uppercase:${level}}] ${message}" /> <tarGet xsi:type="File" name="file" fileName="${basedir}/logs/${shortdate}/lobby.log" layout="[${longdate}] [${uppercase:${level}}] ${message}" />
</targets> </tarGets>
<rules> <rules>
<!-- add your logging rules here --> <!-- add your logging rules here -->

File diff suppressed because it is too large Load diff

View file

@ -166,7 +166,7 @@ namespace FFXIVClassic_Lobby_Server
if (worldId == 0) if (worldId == 0)
worldId = client.newCharaWorldId; worldId = client.newCharaWorldId;
//Check if this character exists, get world from there //Check if this character exists, Get world from there
if (worldId == 0 && charaReq.characterId != 0) if (worldId == 0 && charaReq.characterId != 0)
{ {
Character chara = Database.GetCharacter(client.currentUserId, charaReq.characterId); Character chara = Database.GetCharacter(client.currentUserId, charaReq.characterId);

View file

@ -213,7 +213,7 @@ namespace FFXIVClassic_Lobby_Server
{ {
BasePacket newPacket = null; BasePacket newPacket = null;
//Too small to even get length //Too small to even Get length
if (bytesRead <= offset) if (bytesRead <= offset)
return null; return null;

View file

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="Cyotek.CircularBuffer" version="1.0.0.0" targetFramework="net45" /> <package id="Cyotek.CircularBuffer" version="1.0.0.0" tarGetFramework="net45" />
<package id="Dapper" version="1.42" targetFramework="net45" /> <package id="Dapper" version="1.42" tarGetFramework="net45" />
<package id="MySql.Data" version="6.9.7" targetFramework="net45" /> <package id="MySql.Data" version="6.9.7" tarGetFramework="net45" />
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net45" /> <package id="Newtonsoft.Json" version="8.0.3" tarGetFramework="net45" />
<package id="NLog" version="4.3.4" targetFramework="net45" /> <package id="NLog" version="4.3.4" tarGetFramework="net45" />
<package id="NLog.Config" version="4.3.4" targetFramework="net45" /> <package id="NLog.Config" version="4.3.4" tarGetFramework="net45" />
<package id="NLog.Schema" version="4.3.4" targetFramework="net45" /> <package id="NLog.Schema" version="4.3.4" tarGetFramework="net45" />
</packages> </packages>

View file

@ -10,7 +10,7 @@ namespace FFXIVClassic_Lobby_Server.packets
public ushort subpacketSize; public ushort subpacketSize;
public ushort type; public ushort type;
public uint sourceId; public uint sourceId;
public uint targetId; public uint tarGetId;
public uint unknown1; public uint unknown1;
} }
@ -68,14 +68,14 @@ namespace FFXIVClassic_Lobby_Server.packets
offset += header.subpacketSize; offset += header.subpacketSize;
} }
public SubPacket(ushort opcode, uint sourceId, uint targetId, byte[] data) public SubPacket(ushort opcode, uint sourceId, uint tarGetId, byte[] data)
{ {
this.header = new SubPacketHeader(); this.header = new SubPacketHeader();
this.gameMessage = new GameMessageHeader(); this.gameMessage = new GameMessageHeader();
gameMessage.opcode = opcode; gameMessage.opcode = opcode;
header.sourceId = sourceId; header.sourceId = sourceId;
header.targetId = targetId; header.tarGetId = tarGetId;
gameMessage.timestamp = Utils.UnixTimeStampUTC(); gameMessage.timestamp = Utils.UnixTimeStampUTC();
@ -90,14 +90,14 @@ namespace FFXIVClassic_Lobby_Server.packets
header.subpacketSize = (ushort)(SUBPACKET_SIZE + GAMEMESSAGE_SIZE + data.Length); header.subpacketSize = (ushort)(SUBPACKET_SIZE + GAMEMESSAGE_SIZE + data.Length);
} }
public SubPacket(SubPacket original, uint newTargetId) public SubPacket(SubPacket original, uint newTarGetId)
{ {
this.header = new SubPacketHeader(); this.header = new SubPacketHeader();
this.gameMessage = original.gameMessage; this.gameMessage = original.gameMessage;
header.subpacketSize = original.header.subpacketSize; header.subpacketSize = original.header.subpacketSize;
header.type = original.header.type; header.type = original.header.type;
header.sourceId = original.header.sourceId; header.sourceId = original.header.sourceId;
header.targetId = newTargetId; header.tarGetId = newTarGetId;
data = original.data; data = original.data;
} }

View file

@ -1,12 +1,21 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text;
using System.Net;
using System.Net.Sockets;
using System.Threading.Tasks;
using System.Threading;
using FFXIVClassic.Common; using FFXIVClassic.Common;
using FFXIVClassic_Map_Server.dataobjects; using FFXIVClassic_Map_Server.dataobjects;
using FFXIVClassic_Map_Server.packets; using FFXIVClassic_Map_Server.packets;
using System.IO;
using FFXIVClassic_Map_Server.packets.send.actor; using FFXIVClassic_Map_Server.packets.send.actor;
using FFXIVClassic_Map_Server;
using FFXIVClassic_Map_Server.packets.send; using FFXIVClassic_Map_Server.packets.send;
using FFXIVClassic_Map_Server.dataobjects.chara;
using FFXIVClassic_Map_Server.Actors; using FFXIVClassic_Map_Server.Actors;
using FFXIVClassic_Map_Server.lua;
using FFXIVClassic_Map_Server.actors.chara.player; using FFXIVClassic_Map_Server.actors.chara.player;
using FFXIVClassic_Map_Server.Properties; using FFXIVClassic_Map_Server.Properties;
@ -45,11 +54,11 @@ namespace FFXIVClassic_Map_Server
} }
} }
public void ChangeProperty(uint id, uint value, string target) public void ChangeProperty(uint id, uint value, string tarGet)
{ {
SetActorPropetyPacket ChangeProperty = new SetActorPropetyPacket(target); SetActorPropetyPacket ChangeProperty = new SetActorPropetyPacket(tarGet);
ChangeProperty.SetTarget(target); ChangeProperty.SetTarget(tarGet);
ChangeProperty.AddInt(id, value); ChangeProperty.AddInt(id, value);
ChangeProperty.AddTarget(); ChangeProperty.AddTarget();
@ -115,8 +124,8 @@ namespace FFXIVClassic_Map_Server
if (worldManager.GetZone(zoneId) == null) if (worldManager.GetZone(zoneId) == null)
{ {
if (client != null) if (client != null)
client.QueuePacket(BasePacket.CreatePacket(SendMessagePacket.BuildPacket(client.actorID, client.actorID, SendMessagePacket.MESSAGE_TYPE_GENERAL_INFO, "", "Zone Does not exist or setting isn't valid."), true, false)); client.QueuePacket(BasePacket.CreatePacket(SendMessagePacket.BuildPacket(client.actorID, client.actorID, SendMessagePacket.MESSAGE_TYPE_GENERAL_INFO, "", "Zone does not exist or setting isn't valid."), true, false));
Program.Log.Error("Zone Does not exist or setting isn't valid."); Program.Log.Error("Zone does not exist or setting isn't valid.");
} }
if (client != null) if (client != null)
@ -142,7 +151,7 @@ namespace FFXIVClassic_Map_Server
foreach (KeyValuePair<uint, ConnectedPlayer> entry in mConnectedPlayerList) foreach (KeyValuePair<uint, ConnectedPlayer> entry in mConnectedPlayerList)
{ {
Player p = entry.Value.GetActor(); Player p = entry.Value.GetActor();
Program.Log.Info("{0}\'s position: ZoneID: {1}, X: {2}, Y: {3}, Z: {4}, Rotation: {5}", p.customDisplayName, p.zoneId, p.positionX, p.positionY, p.positionZ, p.rotation); Program.Log.Info(String.Format("{0}\'s position: ZoneID: {1}, X: {2}, Y: {3}, Z: {4}, Rotation: {5}", p.customDisplayName, p.zoneId, p.positionX, p.positionY, p.positionZ, p.rotation));
} }
} }
} }
@ -259,7 +268,7 @@ namespace FFXIVClassic_Map_Server
} }
} }
// TODO: make RemoveCurrency() remove all quantity of a currency if quantity_to_remove > quantity_in_inventory instead of silently failing // TODO: make RemoveCurrency() Remove all quantity of a currency if quantity_to_Remove > quantity_in_inventory instead of silently failing
private void RemoveCurrency(ConnectedPlayer client, uint itemId, int quantity) private void RemoveCurrency(ConnectedPlayer client, uint itemId, int quantity)
{ {
if (client != null) if (client != null)
@ -446,7 +455,7 @@ namespace FFXIVClassic_Map_Server
return; // catch any invalid warps here return; // catch any invalid warps here
} }
private void DoWeather(ConnectedPlayer client, string weatherID, string value) private void doWeather(ConnectedPlayer client, string weatherID, string value)
{ {
ushort weather = Convert.ToUInt16(weatherID); ushort weather = Convert.ToUInt16(weatherID);
@ -524,12 +533,12 @@ namespace FFXIVClassic_Map_Server
SendMessage(client, Resources.CPgiveitem); SendMessage(client, Resources.CPgiveitem);
else if (split[1].Equals("givekeyitem")) else if (split[1].Equals("givekeyitem"))
SendMessage(client, Resources.CPgivekeyitem); SendMessage(client, Resources.CPgivekeyitem);
else if (split[1].Equals("removecurrency")) else if (split[1].Equals("Removecurrency"))
SendMessage(client, Resources.CPremovecurrency); SendMessage(client, Resources.CPRemovecurrency);
else if (split[1].Equals("removeitem")) else if (split[1].Equals("Removeitem"))
SendMessage(client, Resources.CPremoveitem); SendMessage(client, Resources.CPRemoveitem);
else if (split[1].Equals("removekeyitem")) else if (split[1].Equals("Removekeyitem"))
SendMessage(client, Resources.CPremovekeyitem); SendMessage(client, Resources.CPRemovekeyitem);
else if (split[1].Equals("reloaditems")) else if (split[1].Equals("reloaditems"))
SendMessage(client, Resources.CPreloaditems); SendMessage(client, Resources.CPreloaditems);
else if (split[1].Equals("reloadzones")) else if (split[1].Equals("reloadzones"))
@ -573,12 +582,12 @@ namespace FFXIVClassic_Map_Server
{ {
try try
{ {
DoWeather(client, split[2], split[3]); doWeather(client, split[2], split[3]);
return true; return true;
} }
catch (Exception e) catch (Exception e)
{ {
Program.Log.Error("Could not Change weather: " + e); Program.Log.Error("Could not change weather: " + e);
} }
} }
#endregion #endregion
@ -607,13 +616,13 @@ namespace FFXIVClassic_Map_Server
{ {
if (client != null) if (client != null)
{ {
Program.Log.Info("Got request to reset zone: {0}", client.GetActor().zoneId); Program.Log.Info(String.Format("Got request to reset zone: {0}", client.GetActor().zoneId));
client.GetActor().zone.Clear(); client.GetActor().zone.Clear();
client.GetActor().zone.AddActorToZone(client.GetActor()); client.GetActor().zone.AddActorToZone(client.GetActor());
client.GetActor().SendInstanceUpdate(); client.GetActor().SendInstanceUpdate();
client.QueuePacket(BasePacket.CreatePacket(SendMessagePacket.BuildPacket(client.actorID, client.actorID, SendMessagePacket.MESSAGE_TYPE_GENERAL_INFO, "", String.Format("Reseting zone {0}...", client.GetActor().zoneId)), true, false)); client.QueuePacket(BasePacket.CreatePacket(SendMessagePacket.BuildPacket(client.actorID, client.actorID, SendMessagePacket.MESSAGE_TYPE_GENERAL_INFO, "", String.Format("Reseting zone {0}...", client.GetActor().zoneId)), true, false));
} }
Server.GetWorldManager().ReloadZone(client.GetActor().zoneId); Server.GetWorldManager().reloadZone(client.GetActor().zoneId);
return true; return true;
} }
#endregion #endregion
@ -621,11 +630,11 @@ namespace FFXIVClassic_Map_Server
#region !reloaditems #region !reloaditems
else if (split[0].Equals("reloaditems")) else if (split[0].Equals("reloaditems"))
{ {
Program.Log.Info("Got request to reload item gamedata"); Program.Log.Info(String.Format("Got request to reload item gamedata"));
SendMessage(client, "Reloading Item Gamedata..."); SendMessage(client, "Reloading Item Gamedata...");
gamedataItems.Clear(); gamedataItems.Clear();
gamedataItems = Database.GetItemGamedata(); gamedataItems = Database.GetItemGamedata();
Program.Log.Info("Loaded {0} items.", gamedataItems.Count); Program.Log.Info(String.Format("Loaded {0} items.", gamedataItems.Count));
SendMessage(client, String.Format("Loaded {0} items.", gamedataItems.Count)); SendMessage(client, String.Format("Loaded {0} items.", gamedataItems.Count));
return true; return true;
} }
@ -685,8 +694,8 @@ namespace FFXIVClassic_Map_Server
} }
#endregion #endregion
#region !removeitem #region !Removeitem
else if (split[0].Equals("removeitem")) else if (split[0].Equals("Removeitem"))
{ {
if (split.Length < 2) if (split.Length < 2)
return false; return false;
@ -703,7 +712,7 @@ namespace FFXIVClassic_Map_Server
} }
catch (Exception e) catch (Exception e)
{ {
Program.Log.Error("Could not remove item."); Program.Log.Error("Could not Remove item.");
} }
} }
#endregion #endregion
@ -723,8 +732,8 @@ namespace FFXIVClassic_Map_Server
} }
#endregion #endregion
#region !removekeyitem #region !Removekeyitem
else if (split[0].Equals("removekeyitem")) else if (split[0].Equals("Removekeyitem"))
{ {
if (split.Length < 2) if (split.Length < 2)
return false; return false;
@ -737,7 +746,7 @@ namespace FFXIVClassic_Map_Server
} }
catch (Exception e) catch (Exception e)
{ {
Program.Log.Error("Could not remove keyitem."); Program.Log.Error("Could not Remove keyitem.");
} }
} }
#endregion #endregion
@ -759,8 +768,8 @@ namespace FFXIVClassic_Map_Server
} }
#endregion #endregion
#region !removecurrency #region !Removecurrency
else if (split[0].Equals("removecurrency")) else if (split[0].Equals("Removecurrency"))
{ {
if (split.Length < 2) if (split.Length < 2)
return false; return false;
@ -775,7 +784,7 @@ namespace FFXIVClassic_Map_Server
} }
catch (Exception e) catch (Exception e)
{ {
Program.Log.Error("Could not remove currency."); Program.Log.Error("Could not Remove currency.");
} }
} }
#endregion #endregion
@ -793,7 +802,7 @@ namespace FFXIVClassic_Map_Server
} }
catch (Exception e) catch (Exception e)
{ {
Program.Log.Error("Could not Change music: " + e); Program.Log.Error("Could not change music: " + e);
} }
} }
#endregion #endregion

View file

@ -400,7 +400,6 @@ namespace FFXIVClassic_Map_Server
birthMonth, birthMonth,
initialTown, initialTown,
tribe, tribe,
currentParty,
restBonus, restBonus,
achievementPoints, achievementPoints,
playTime playTime
@ -430,9 +429,9 @@ namespace FFXIVClassic_Map_Server
player.playerWork.birthdayMonth = reader.GetByte(14); player.playerWork.birthdayMonth = reader.GetByte(14);
player.playerWork.initialTown = reader.GetByte(15); player.playerWork.initialTown = reader.GetByte(15);
player.playerWork.tribe = reader.GetByte(16); player.playerWork.tribe = reader.GetByte(16);
player.playerWork.restBonusExpRate = reader.GetInt32(18); player.playerWork.restBonusExpRate = reader.GetInt32(17);
player.achievementPoints = reader.GetUInt32(19); player.achievementPoints = reader.GetUInt32(18);
player.playTime = reader.GetUInt32(20); player.playTime = reader.GetUInt32(19);
} }
} }

View file

@ -71,7 +71,9 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="actors\area\PrivateArea.cs" /> <Compile Include="actors\area\PrivateArea.cs" />
<Compile Include="actors\area\SpawnLocation.cs" />
<Compile Include="actors\area\Zone.cs" /> <Compile Include="actors\area\Zone.cs" />
<Compile Include="actors\chara\npc\ActorClass.cs" />
<Compile Include="actors\chara\npc\NpcWork.cs" /> <Compile Include="actors\chara\npc\NpcWork.cs" />
<Compile Include="actors\chara\AetheryteWork.cs" /> <Compile Include="actors\chara\AetheryteWork.cs" />
<Compile Include="actors\chara\player\Equipment.cs" /> <Compile Include="actors\chara\player\Equipment.cs" />

View file

@ -16,22 +16,22 @@
See https://github.com/nlog/nlog/wiki/Configuration-file See https://github.com/nlog/nlog/wiki/Configuration-file
for information on customizing logging rules and outputs. for information on customizing logging rules and outputs.
--> -->
<targets async="true"> <tarGets async="true">
<!-- <!--
add your targets here add your tarGets here
See https://github.com/nlog/NLog/wiki/Targets for possible targets. See https://github.com/nlog/NLog/wiki/TarGets for possible tarGets.
See https://github.com/nlog/NLog/wiki/Layout-Renderers for the possible layout renderers. See https://github.com/nlog/NLog/wiki/Layout-Renderers for the possible layout renderers.
--> -->
<!-- <!--
Write events to a file with the date in the filename. Write events to a file with the date in the filename.
<target xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log" <tarGet xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log"
layout="${longdate} ${uppercase:${level}} ${message}" /> layout="${longdate} ${uppercase:${level}} ${message}" />
--> -->
<target xsi:type="ColoredConsole" name="console" layout="[${longdate}] [${uppercase:${level}}] ${message}" /> <tarGet xsi:type="ColoredConsole" name="console" layout="[${longdate}] [${uppercase:${level}}] ${message}" />
<target xsi:type="File" name="file" fileName="${basedir}/logs/${shortdate}/map.log" layout="[${longdate}] [${uppercase:${level}}] ${message}"/> <tarGet xsi:type="File" name="file" fileName="${basedir}/logs/${shortdate}/map.log" layout="[${longdate}] [${uppercase:${level}}] ${message}"/>
</targets> </tarGets>
<rules> <rules>
<!-- add your logging rules here --> <!-- add your logging rules here -->

File diff suppressed because it is too large Load diff

View file

@ -349,8 +349,8 @@ namespace FFXIVClassic_Map_Server
client.QueuePacket(BasePacket.CreatePacket(BlacklistAddedPacket.BuildPacket(player.actorID, true, addBlackList.name), true, false)); client.QueuePacket(BasePacket.CreatePacket(BlacklistAddedPacket.BuildPacket(player.actorID, true, addBlackList.name), true, false));
break; break;
case 0x01CA: case 0x01CA:
AddRemoveSocialPacket removeBlackList = new AddRemoveSocialPacket(subpacket.data); AddRemoveSocialPacket RemoveBlackList = new AddRemoveSocialPacket(subpacket.data);
client.QueuePacket(BasePacket.CreatePacket(BlacklistRemovedPacket.BuildPacket(player.actorID, true, removeBlackList.name), true, false)); client.QueuePacket(BasePacket.CreatePacket(BlacklistRemovedPacket.BuildPacket(player.actorID, true, RemoveBlackList.name), true, false));
break; break;
case 0x01CB: case 0x01CB:
int offset1 = 0; int offset1 = 0;
@ -361,8 +361,8 @@ namespace FFXIVClassic_Map_Server
client.QueuePacket(BasePacket.CreatePacket(FriendlistAddedPacket.BuildPacket(player.actorID, true, (uint)addFriendList.name.GetHashCode(), true, addFriendList.name), true, false)); client.QueuePacket(BasePacket.CreatePacket(FriendlistAddedPacket.BuildPacket(player.actorID, true, (uint)addFriendList.name.GetHashCode(), true, addFriendList.name), true, false));
break; break;
case 0x01CD: case 0x01CD:
AddRemoveSocialPacket removeFriendList = new AddRemoveSocialPacket(subpacket.data); AddRemoveSocialPacket RemoveFriendList = new AddRemoveSocialPacket(subpacket.data);
client.QueuePacket(BasePacket.CreatePacket(FriendlistRemovedPacket.BuildPacket(player.actorID, true, removeFriendList.name), true, false)); client.QueuePacket(BasePacket.CreatePacket(FriendlistRemovedPacket.BuildPacket(player.actorID, true, RemoveFriendList.name), true, false));
break; break;
case 0x01CE: case 0x01CE:
int offset2 = 0; int offset2 = 0;

View file

@ -17,7 +17,7 @@ namespace FFXIVClassic_Map_Server.Properties {
/// </summary> /// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder // This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio. // class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen // To add or Remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project. // with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@ -105,7 +105,7 @@ namespace FFXIVClassic_Map_Server.Properties {
/// ///
///Available commands: ///Available commands:
///Standard: mypos, music, warp ///Standard: mypos, music, warp
///Server Administration: givecurrency, giveitem, givekeyitem, removecurrency, removekeyitem, reloaditems, reloadzones ///Server Administration: givecurrency, giveitem, givekeyitem, Removecurrency, Removekeyitem, reloaditems, reloadzones
///Test: test weather. ///Test: test weather.
/// </summary> /// </summary>
public static string CPhelp { public static string CPhelp {
@ -176,38 +176,38 @@ namespace FFXIVClassic_Map_Server.Properties {
/// <summary> /// <summary>
/// Looks up a localized string similar to Removes the specified currency from the current player&apos;s inventory /// Looks up a localized string similar to Removes the specified currency from the current player&apos;s inventory
/// ///
///*Syntax: removecurrency &lt;quantity&gt; ///*Syntax: Removecurrency &lt;quantity&gt;
/// removecurrency &lt;type&gt; &lt;quantity&gt; /// Removecurrency &lt;type&gt; &lt;quantity&gt;
///&lt;type&gt; is the specific type of currency desired, defaults to gil if no type specified. ///&lt;type&gt; is the specific type of currency desired, defaults to gil if no type specified.
/// </summary> /// </summary>
public static string CPremovecurrency { public static string CPRemovecurrency {
get { get {
return ResourceManager.GetString("CPremovecurrency", resourceCulture); return ResourceManager.GetString("CPRemovecurrency", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Removes the specified items to the current player&apos;s inventory /// Looks up a localized string similar to Removes the specified items to the current player&apos;s inventory
/// ///
///*Syntax: removeitem &lt;itemid&gt; ///*Syntax: Removeitem &lt;itemid&gt;
/// removeitem &lt;itemid&gt; &lt;quantity&gt; /// Removeitem &lt;itemid&gt; &lt;quantity&gt;
///&lt;item id&gt; is the item&apos;s specific id as defined in the server database. ///&lt;item id&gt; is the item&apos;s specific id as defined in the server database.
/// </summary> /// </summary>
public static string CPremoveitem { public static string CPRemoveitem {
get { get {
return ResourceManager.GetString("CPremoveitem", resourceCulture); return ResourceManager.GetString("CPRemoveitem", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Removes the specified key item to the current player&apos;s inventory /// Looks up a localized string similar to Removes the specified key item to the current player&apos;s inventory
/// ///
///*Syntax: removekeyitem &lt;itemid&gt; ///*Syntax: Removekeyitem &lt;itemid&gt;
///&lt;item id&gt; is the key item&apos;s specific id as defined in the server database. ///&lt;item id&gt; is the key item&apos;s specific id as defined in the server database.
/// </summary> /// </summary>
public static string CPremovekeyitem { public static string CPRemovekeyitem {
get { get {
return ResourceManager.GetString("CPremovekeyitem", resourceCulture); return ResourceManager.GetString("CPRemovekeyitem", resourceCulture);
} }
} }

View file

@ -83,7 +83,9 @@ namespace FFXIVClassic_Map_Server
mWorldManager = new WorldManager(this); mWorldManager = new WorldManager(this);
mWorldManager.LoadZoneList(); mWorldManager.LoadZoneList();
mWorldManager.LoadZoneEntranceList(); mWorldManager.LoadZoneEntranceList();
mWorldManager.LoadNPCs(); mWorldManager.LoadActorClasses();
mWorldManager.LoadSpawnLocations();
mWorldManager.SpawnAllActors();
IPEndPoint serverEndPoint = new System.Net.IPEndPoint(IPAddress.Parse(ConfigConstants.OPTIONS_BINDIP), int.Parse(ConfigConstants.OPTIONS_PORT)); IPEndPoint serverEndPoint = new System.Net.IPEndPoint(IPAddress.Parse(ConfigConstants.OPTIONS_BINDIP), int.Parse(ConfigConstants.OPTIONS_PORT));
@ -294,7 +296,7 @@ namespace FFXIVClassic_Map_Server
{ {
BasePacket newPacket = null; BasePacket newPacket = null;
//Too small to even get length //Too small to even Get length
if (bytesRead <= offset) if (bytesRead <= offset)
return null; return null;

View file

@ -1,12 +1,21 @@
using FFXIVClassic.Common; using FFXIVClassic_Map_Server;
using FFXIVClassic.Common;
using FFXIVClassic_Map_Server.actors.area; using FFXIVClassic_Map_Server.actors.area;
using FFXIVClassic_Map_Server.actors.chara.npc;
using FFXIVClassic_Map_Server.Actors; using FFXIVClassic_Map_Server.Actors;
using FFXIVClassic.Common;
using FFXIVClassic_Map_Server.dataobjects;
using FFXIVClassic_Map_Server.dataobjects.chara;
using FFXIVClassic_Map_Server.lua; using FFXIVClassic_Map_Server.lua;
using FFXIVClassic_Map_Server.packets.send; using FFXIVClassic_Map_Server.packets.send;
using FFXIVClassic_Map_Server.packets.send.actor; using FFXIVClassic_Map_Server.packets.send.actor;
using FFXIVClassic_Map_Server.packets.send.login;
using MySql.Data.MySqlClient; using MySql.Data.MySqlClient;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server namespace FFXIVClassic_Map_Server
{ {
@ -16,6 +25,7 @@ namespace FFXIVClassic_Map_Server
private WorldMaster worldMaster = new WorldMaster(); private WorldMaster worldMaster = new WorldMaster();
private Dictionary<uint, Zone> zoneList; private Dictionary<uint, Zone> zoneList;
private Dictionary<uint, ZoneEntrance> zoneEntranceList; private Dictionary<uint, ZoneEntrance> zoneEntranceList;
private Dictionary<uint, ActorClass> actorClasses = new Dictionary<uint,ActorClass>();
private Server mServer; private Server mServer;
@ -66,10 +76,7 @@ namespace FFXIVClassic_Map_Server
} }
} }
catch (MySqlException e) catch (MySqlException e)
{ { Console.WriteLine(e); }
Program.Log.Error(e.ToString());
}
finally finally
{ {
conn.Dispose(); conn.Dispose();
@ -105,7 +112,7 @@ namespace FFXIVClassic_Map_Server
if (zoneList.ContainsKey(parentZoneId)) if (zoneList.ContainsKey(parentZoneId))
{ {
Zone parent = zoneList[parentZoneId]; Zone parent = zoneList[parentZoneId];
PrivateArea privArea = new PrivateArea(parent, reader.GetUInt32("id"), reader.GetString("className"), reader.GetString("privateAreaName"), reader.GetUInt16("dayMusic"), reader.GetUInt16("nightMusic"), reader.GetUInt16("battleMusic")); PrivateArea privArea = new PrivateArea(parent, reader.GetUInt32("id"), reader.GetString("className"), reader.GetString("privateAreaName"), 1, reader.GetUInt16("dayMusic"), reader.GetUInt16("nightMusic"), reader.GetUInt16("battleMusic"));
parent.AddPrivateArea(privArea); parent.AddPrivateArea(privArea);
} }
else else
@ -116,16 +123,14 @@ namespace FFXIVClassic_Map_Server
} }
} }
catch (MySqlException e) catch (MySqlException e)
{ { Console.WriteLine(e); }
Program.Log.Error(e.ToString());
}
finally finally
{ {
conn.Dispose(); conn.Dispose();
} }
} }
Program.Log.Info("Loaded {0} zones and {1} private areas.", count1, count2); Program.Log.Info(String.Format("Loaded {0} zones and {1} private areas.", count1, count2));
} }
public void LoadZoneEntranceList() public void LoadZoneEntranceList()
@ -169,19 +174,17 @@ namespace FFXIVClassic_Map_Server
} }
} }
catch (MySqlException e) catch (MySqlException e)
{ { Console.WriteLine(e); }
Program.Log.Error(e.ToString());
}
finally finally
{ {
conn.Dispose(); conn.Dispose();
} }
} }
Program.Log.Info("Loaded {0} zone spawn locations.", count); Program.Log.Info(String.Format("Loaded {0} zone spawn locations.", count));
} }
public void LoadNPCs() public void LoadActorClasses()
{ {
int count = 0; int count = 0;
using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD))) using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
@ -193,20 +196,11 @@ namespace FFXIVClassic_Map_Server
string query = @" string query = @"
SELECT SELECT
id, id,
name, classPath,
zoneId,
positionX,
positionY,
positionZ,
rotation,
actorState,
animationId,
displayNameId, displayNameId,
customDisplayName,
actorClassName,
eventConditions eventConditions
FROM gamedata_actor_class FROM gamedata_actor_class
WHERE name is not NULL AND zoneId > 0 WHERE classPath <> ''
"; ";
MySqlCommand cmd = new MySqlCommand(query, conn); MySqlCommand cmd = new MySqlCommand(query, conn);
@ -215,45 +209,35 @@ namespace FFXIVClassic_Map_Server
{ {
while (reader.Read()) while (reader.Read())
{ {
string customName = null; uint id = reader.GetUInt32("id");
if (!reader.IsDBNull(10)) string classPath = reader.GetString("classPath");
customName = reader.GetString(10); uint nameId = reader.GetUInt32("displayNameId");
string eventConditions = null;
Npc npc = new Npc(reader.GetUInt32(0), reader.GetString(1), reader.GetUInt32(2), reader.GetFloat(3), reader.GetFloat(4), reader.GetFloat(5), reader.GetFloat(6), reader.GetUInt16(7), reader.GetUInt32(8), reader.GetUInt32(9), customName, reader.GetString(11)); if (!reader.IsDBNull(3))
eventConditions = reader.GetString("eventConditions");
else
eventConditions = "{}";
if (!reader.IsDBNull(12)) ActorClass actorClass = new ActorClass(id, classPath, nameId, eventConditions);
{ actorClasses.Add(id, actorClass);
string eventConditions = reader.GetString(12);
npc.LoadEventConditions(eventConditions);
}
if (!zoneList.ContainsKey(npc.zoneId))
continue;
Zone zone = zoneList[npc.zoneId];
if (zone == null)
continue;
npc.zone = zone;
zone.AddActorToZone(npc);
count++; count++;
} }
} }
} }
catch (MySqlException e) catch (MySqlException e)
{ { Console.WriteLine(e); }
Program.Log.Error(e.ToString());
}
finally finally
{ {
conn.Dispose(); conn.Dispose();
} }
} }
Program.Log.Info("Loaded {0} npc(s).", count); Program.Log.Info(String.Format("Loaded {0} actor classes.", count));
} }
public void LoadNPCs(uint zoneId) public void LoadSpawnLocations()
{ {
int count = 0; int count = 0;
using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD))) using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
@ -264,69 +248,80 @@ namespace FFXIVClassic_Map_Server
string query = @" string query = @"
SELECT SELECT
id, actorClassId,
name, uniqueId,
zoneId, zoneId,
privateAreaName,
privateAreaLevel,
positionX, positionX,
positionY, positionY,
positionZ, positionZ,
rotation, rotation,
actorState, actorState,
animationId, animationId,
displayNameId, customDisplayName
customDisplayName, FROM server_spawn_locations
actorClassName,
eventConditions
FROM gamedata_actor_class
WHERE name is not NULL AND zoneId = @zoneId
"; ";
MySqlCommand cmd = new MySqlCommand(query, conn); MySqlCommand cmd = new MySqlCommand(query, conn);
cmd.Parameters.AddWithValue("@zoneId", zoneId);
using (MySqlDataReader reader = cmd.ExecuteReader()) using (MySqlDataReader reader = cmd.ExecuteReader())
{ {
while (reader.Read()) while (reader.Read())
{ {
string customName = null; string customName = null;
if (!reader.IsDBNull(10)) if (!reader.IsDBNull(11))
customName = reader.GetString(10); customName = reader.GetString("customDisplayName");
Npc npc = new Npc(reader.GetUInt32(0), reader.GetString(1), reader.GetUInt32(2), reader.GetFloat(3), reader.GetFloat(4), reader.GetFloat(5), reader.GetFloat(6), reader.GetUInt16(7), reader.GetUInt32(8), reader.GetUInt32(9), customName, reader.GetString(11)); uint classId = reader.GetUInt32("actorClassId");
string uniqueId = reader.GetString("uniqueId");
uint zoneId = reader.GetUInt32("zoneId");
string privAreaName = reader.GetString("privateAreaName");
uint privAreaLevel = reader.GetUInt32("privateAreaLevel");
float x = reader.GetFloat("positionX");
float y = reader.GetFloat("positionY");
float z = reader.GetFloat("positionZ");
float rot = reader.GetFloat("rotation");
ushort state = reader.GetUInt16("actorState");
uint animId = reader.GetUInt32("animationId");
if (!reader.IsDBNull(12)) if (!actorClasses.ContainsKey(classId))
{
string eventConditions = reader.GetString(12);
npc.LoadEventConditions(eventConditions);
}
if (!zoneList.ContainsKey(npc.zoneId))
continue; continue;
Zone zone = zoneList[npc.zoneId]; if (!zoneList.ContainsKey(zoneId))
continue;
Zone zone = zoneList[zoneId];
if (zone == null) if (zone == null)
continue; continue;
npc.zone = zone;
zone.AddActorToZone(npc);
count++;
SpawnLocation spawn = new SpawnLocation(classId, uniqueId, zoneId, privAreaName, privAreaLevel, x, y, z, rot, state, animId);
zone.AddSpawnLocation(spawn);
count++;
} }
} }
} }
catch (MySqlException e) catch (MySqlException e)
{ { Console.WriteLine(e); }
Program.Log.Error(e.ToString());
}
finally finally
{ {
conn.Dispose(); conn.Dispose();
} }
} }
Program.Log.Info("Loaded {0} npc(s).", count); Program.Log.Info(String.Format("Loaded {0} spawn(s).", count));
} }
//Moves the actor to the new zone if exists. No packets are sent nor position Changed. public void SpawnAllActors()
{
Program.Log.Info("Spawning actors...");
foreach (Zone z in zoneList.Values)
z.SpawnAllActors(true);
}
//Moves the actor to the new zone if exists. No packets are sent nor position changed.
public void DoSeamlessZoneChange(Player player, uint destinationZoneId) public void DoSeamlessZoneChange(Player player, uint destinationZoneId)
{ {
Area oldZone; Area oldZone;
@ -340,7 +335,7 @@ namespace FFXIVClassic_Map_Server
//Add player to new zone and update //Add player to new zone and update
Zone newZone = GetZone(destinationZoneId); Zone newZone = GetZone(destinationZoneId);
//This server Does not contain that zoneId //This server does not contain that zoneId
if (newZone == null) if (newZone == null)
return; return;
@ -381,7 +376,7 @@ namespace FFXIVClassic_Map_Server
newArea = GetZone(destinationZoneId); newArea = GetZone(destinationZoneId);
else else
newArea = GetZone(destinationZoneId).GetPrivateArea(destinationPrivateArea, 0); newArea = GetZone(destinationZoneId).GetPrivateArea(destinationPrivateArea, 0);
//This server Does not contain that zoneId //This server does not contain that zoneId
if (newArea == null) if (newArea == null)
return; return;
@ -451,11 +446,11 @@ namespace FFXIVClassic_Map_Server
//Add player to new zone and update //Add player to new zone and update
Zone zone = GetZone(player.zoneId); Zone zone = GetZone(player.zoneId);
//This server Does not contain that zoneId //This server does not contain that zoneId
if (zone == null) if (zone == null)
return; return;
//Set the current zone and Add player //Set the current zone and add player
player.zone = zone; player.zone = zone;
LuaEngine.OnBeginLogin(player); LuaEngine.OnBeginLogin(player);
@ -469,14 +464,14 @@ namespace FFXIVClassic_Map_Server
LuaEngine.OnZoneIn(player); LuaEngine.OnZoneIn(player);
} }
public void ReloadZone(uint zoneId) public void reloadZone(uint zoneId)
{ {
if (!zoneList.ContainsKey(zoneId)) if (!zoneList.ContainsKey(zoneId))
return; return;
Zone zone = zoneList[zoneId]; Zone zone = zoneList[zoneId];
//zone.Clear(); //zone.clear();
LoadNPCs(zone.actorId); //LoadNPCs(zone.actorId);
} }
@ -559,6 +554,15 @@ namespace FFXIVClassic_Map_Server
else else
return null; return null;
} }
public ActorClass GetActorClass(uint id)
{
if (actorClasses.ContainsKey(id))
return actorClasses[id];
else
return null;
}
} }
} }

View file

@ -3,8 +3,10 @@ using FFXIVClassic_Map_Server.actors;
using FFXIVClassic_Map_Server.lua; using FFXIVClassic_Map_Server.lua;
using FFXIVClassic_Map_Server.packets.send.actor; using FFXIVClassic_Map_Server.packets.send.actor;
using FFXIVClassic_Map_Server.packets.send.actor.events; using FFXIVClassic_Map_Server.packets.send.actor.events;
using FFXIVClassic.Common;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using FFXIVClassic_Map_Server.actors.area;
namespace FFXIVClassic_Map_Server.Actors namespace FFXIVClassic_Map_Server.Actors
{ {
@ -29,6 +31,7 @@ namespace FFXIVClassic_Map_Server.Actors
public bool spawnedFirstTime = false; public bool spawnedFirstTime = false;
public string classPath;
public string className; public string className;
public List<LuaParam> classParams; public List<LuaParam> classParams;
@ -299,6 +302,53 @@ namespace FFXIVClassic_Map_Server.Actors
zone.BroadcastPacketAroundActor(this, ChangeSpeedPacket); zone.BroadcastPacketAroundActor(this, ChangeSpeedPacket);
} }
public void generateActorName(int actorNumber)
{
//Format Class Name
string className = this.className.Replace("Populace", "Ppl")
.Replace("Monster", "Mon")
.Replace("Crowd", "Crd")
.Replace("MapObj", "Map")
.Replace("Object", "Obj")
.Replace("Retainer", "Rtn")
.Replace("Standard", "Std");
className = Char.ToLowerInvariant(className[0]) + className.Substring(1);
//Format Zone Name
string zoneName = zone.zoneName.Replace("Field", "Fld")
.Replace("Dungeon", "Dgn")
.Replace("Town", "Twn")
.Replace("Battle", "Btl")
.Replace("Test", "Tes")
.Replace("Event", "Evt")
.Replace("Ship", "Shp")
.Replace("Office", "Ofc");
if (zone is PrivateArea)
{
//Check if "normal"
zoneName = zoneName.Remove(zoneName.Length - 1, 1) + "P";
}
zoneName = Char.ToLowerInvariant(zoneName[0]) + zoneName.Substring(1);
try
{
className = className.Substring(0, 20 - zoneName.Length);
}
catch (ArgumentOutOfRangeException e)
{}
//Convert actor number to base 63
string classNumber = Utils.ToStringBase63(actorNumber);
//Get stuff after @
uint zoneId = zone.actorId;
uint privLevel = 0;
if (zone is PrivateArea)
privLevel = ((PrivateArea)zone).GetPrivateAreaLevel();
actorName = String.Format("{0}_{1}_{2}@{3:X3}{4:X2}", className, zoneName, classNumber, zoneId, privLevel);
}
} }
} }

View file

@ -1,9 +1,18 @@
using FFXIVClassic_Map_Server.packets; using FFXIVClassic_Map_Server;
using FFXIVClassic.Common;
using FFXIVClassic_Map_Server.packets;
using FFXIVClassic_Map_Server.actors.area;
using FFXIVClassic_Map_Server.actors.chara.npc;
using FFXIVClassic_Map_Server.dataobjects;
using FFXIVClassic_Map_Server.dataobjects.chara;
using FFXIVClassic_Map_Server.lua; using FFXIVClassic_Map_Server.lua;
using FFXIVClassic_Map_Server.packets.send.actor; using FFXIVClassic_Map_Server.packets.send.actor;
using MoonSharp.Interpreter; using MoonSharp.Interpreter;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.Actors namespace FFXIVClassic_Map_Server.Actors
{ {
@ -15,15 +24,16 @@ namespace FFXIVClassic_Map_Server.Actors
public ushort weatherNormal, weatherCommon, weatherRare; public ushort weatherNormal, weatherCommon, weatherRare;
public ushort bgmDay, bgmNight, bgmBattle; public ushort bgmDay, bgmNight, bgmBattle;
private string classPath; protected string classPath;
public int boundingGridSize = 50; public int boundingGridSize = 50;
public int minX = -1000, minY = -1000, maxX = 1000, maxY = 1000; public int minX = -1000, minY = -1000, maxX = 1000, maxY = 1000;
private int numXBlocks, numYBlocks; protected int numXBlocks, numYBlocks;
private int halfWidth, halfHeight; protected int halfWidth, halfHeight;
private Dictionary<uint, Actor> mActorList = new Dictionary<uint,Actor>(); protected List<SpawnLocation> mSpawnLocations = new List<SpawnLocation>();
private List<Actor>[,] mActorBlock; protected Dictionary<uint, Actor> mActorList = new Dictionary<uint, Actor>();
protected List<Actor>[,] mActorBlock;
Script areaScript; Script areaScript;
@ -329,5 +339,18 @@ namespace FFXIVClassic_Map_Server.Actors
} }
} }
public void SpawnActor(SpawnLocation location)
{
ActorClass actorClass = Server.GetWorldManager().GetActorClass(location.classId);
if (actorClass == null)
return;
Npc npc = new Npc(mActorList.Count + 1, actorClass.actorClassId, location.uniqueId, actorId, location.x, location.y, location.z, location.rot, location.state, location.animId, actorClass.displayNameId, null, actorClass.classPath);
npc.loadEventConditions(actorClass.eventConditions);
AddActorToZone(npc);
}
} }
} }

View file

@ -2,7 +2,11 @@
using FFXIVClassic_Map_Server.Actors; using FFXIVClassic_Map_Server.Actors;
using FFXIVClassic_Map_Server.lua; using FFXIVClassic_Map_Server.lua;
using FFXIVClassic_Map_Server.packets.send.actor; using FFXIVClassic_Map_Server.packets.send.actor;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.actors.area namespace FFXIVClassic_Map_Server.actors.area
{ {
@ -10,12 +14,14 @@ namespace FFXIVClassic_Map_Server.actors.area
{ {
private Zone parentZone; private Zone parentZone;
private string privateAreaName; private string privateAreaName;
private uint privateAreaLevel;
public PrivateArea(Zone parent, uint id, string className, string privateAreaName,ushort bgmDay, ushort bgmNight, ushort bgmBattle) public PrivateArea(Zone parent, uint id, string className, string privateAreaName, uint privateAreaLevel, ushort bgmDay, ushort bgmNight, ushort bgmBattle)
: base(id, parent.zoneName, parent.regionId, className, bgmDay, bgmNight, bgmBattle, parent.isIsolated, parent.isInn, parent.canRideChocobo, parent.canStealth, true) : base(id, parent.zoneName, parent.regionId, className, bgmDay, bgmNight, bgmBattle, parent.isIsolated, parent.isInn, parent.canRideChocobo, parent.canStealth, true)
{ {
this.parentZone = parent; this.parentZone = parent;
this.privateAreaName = privateAreaName; this.privateAreaName = privateAreaName;
this.privateAreaLevel = privateAreaLevel;
} }
public string GetPrivateAreaName() public string GetPrivateAreaName()
@ -23,6 +29,11 @@ namespace FFXIVClassic_Map_Server.actors.area
return privateAreaName; return privateAreaName;
} }
public uint GetPrivateAreaLevel()
{
return privateAreaLevel;
}
public Zone GetParentZone() public Zone GetParentZone()
{ {
return parentZone; return parentZone;
@ -42,5 +53,16 @@ namespace FFXIVClassic_Map_Server.actors.area
return ActorInstantiatePacket.BuildPacket(actorId, playerActorId, actorName, className, lParams); return ActorInstantiatePacket.BuildPacket(actorId, playerActorId, actorName, className, lParams);
} }
public void AddSpawnLocation(SpawnLocation spawn)
{
mSpawnLocations.Add(spawn);
}
public void SpawnAllActors()
{
foreach (SpawnLocation spawn in mSpawnLocations)
SpawnActor(spawn);
}
} }
} }

View file

@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.actors.area
{
class SpawnLocation
{
public uint classId;
public string uniqueId;
public uint zoneId;
public string privAreaName;
public uint privAreaLevel;
public float x;
public float y;
public float z;
public float rot;
public ushort state;
public uint animId;
public SpawnLocation(uint classId, string uniqueId, uint zoneId, string privAreaName, uint privAreaLevel, float x, float y, float z, float rot, ushort state, uint animId)
{
this.classId = classId;
this.uniqueId = uniqueId;
this.zoneId = zoneId;
this.privAreaName = privAreaName;
this.privAreaLevel = privAreaLevel;
this.x = x;
this.y = y;
this.z = z;
this.rot = rot;
this.state = state;
this.animId = animId;
}
}
}

View file

@ -1,8 +1,15 @@
using FFXIVClassic_Map_Server.packets; using FFXIVClassic_Map_Server;
using FFXIVClassic.Common;
using FFXIVClassic_Map_Server.packets;
using FFXIVClassic_Map_Server.actors.chara.npc;
using FFXIVClassic_Map_Server.Actors; using FFXIVClassic_Map_Server.Actors;
using FFXIVClassic_Map_Server.lua; using FFXIVClassic_Map_Server.lua;
using FFXIVClassic_Map_Server.packets.send.actor; using FFXIVClassic_Map_Server.packets.send.actor;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.actors.area namespace FFXIVClassic_Map_Server.actors.area
{ {
@ -50,5 +57,40 @@ namespace FFXIVClassic_Map_Server.actors.area
return ActorInstantiatePacket.BuildPacket(actorId, playerActorId, actorName, className, lParams); return ActorInstantiatePacket.BuildPacket(actorId, playerActorId, actorName, className, lParams);
} }
public void AddSpawnLocation(SpawnLocation spawn)
{
//Is it in a private area?
if (!spawn.privAreaName.Equals(""))
{
if (privateAreas.ContainsKey(spawn.privAreaName))
{
Dictionary<uint, PrivateArea> levels = privateAreas[spawn.privAreaName];
if (levels.ContainsKey(spawn.privAreaLevel))
levels[spawn.privAreaLevel].AddSpawnLocation(spawn);
else
Program.Log.Error("Tried to add a spawn location to non-existing private area level \"{0}\" in area {1} in zone {2}", spawn.privAreaName, spawn.privAreaLevel, zoneName);
}
else
Program.Log.Error("Tried to add a spawn location to non-existing private area \"{0}\" in zone {1}", spawn.privAreaName, zoneName);
}
else
mSpawnLocations.Add(spawn);
}
public void SpawnAllActors(bool doPrivAreas)
{
foreach (SpawnLocation spawn in mSpawnLocations)
SpawnActor(spawn);
if (doPrivAreas)
{
foreach (Dictionary<uint, PrivateArea> areas in privateAreas.Values)
{
foreach (PrivateArea pa in areas.Values)
pa.SpawnAllActors();
}
}
}
} }
} }

View file

@ -4,7 +4,7 @@
{ {
public short tp = 0; public short tp = 0;
public int targetInformation = 0; public int tarGetInformation = 0;
public ushort[] maxCommandRecastTime = new ushort[40]; public ushort[] maxCommandRecastTime = new ushort[40];

View file

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.actors.chara.npc
{
class ActorClass
{
public readonly uint actorClassId;
public readonly string classPath;
public readonly uint displayNameId;
public readonly string eventConditions;
public ActorClass(uint id, string classPath, uint nameId, string eventConditions)
{
this.actorClassId = id;
this.classPath = classPath;
this.displayNameId = nameId;
this.eventConditions = eventConditions;
}
}
}

View file

@ -1,41 +1,54 @@
using FFXIVClassic.Common; using FFXIVClassic.Common;
using FFXIVClassic_Map_Server.packets;
using FFXIVClassic_Map_Server.actors; using FFXIVClassic_Map_Server.actors;
using FFXIVClassic_Map_Server.Actors.Chara; using FFXIVClassic_Map_Server.Actors.Chara;
using FFXIVClassic_Map_Server.dataobjects;
using FFXIVClassic_Map_Server.lua; using FFXIVClassic_Map_Server.lua;
using FFXIVClassic_Map_Server.packets;
using FFXIVClassic_Map_Server.packets.receive.events;
using FFXIVClassic_Map_Server.packets.send.actor; using FFXIVClassic_Map_Server.packets.send.actor;
using FFXIVClassic_Map_Server.utils; using FFXIVClassic_Map_Server.utils;
using MoonSharp.Interpreter;
using MySql.Data.MySqlClient; using MySql.Data.MySqlClient;
using Newtonsoft.Json; using Newtonsoft.Json;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.Actors namespace FFXIVClassic_Map_Server.Actors
{ {
class Npc : Character class Npc : Character
{ {
private uint actorClassId; private uint actorClassId;
private string uniqueIdentifier;
public NpcWork npcWork = new NpcWork(); public NpcWork npcWork = new NpcWork();
public Npc(uint id, string actorName, uint zoneId, float posX, float posY, float posZ, float rot, ushort actorState, uint animationId, uint displayNameId, string customDisplayName, string className) public Npc(int actorNumber, uint classId, string uniqueId, uint zoneId, float posX, float posY, float posZ, float rot, ushort actorState, uint animationId, uint displayNameId, string customDisplayName, string classPath)
: base(id) : base((4 << 28 | zoneId << 19 | (uint)actorNumber))
{ {
this.actorName = actorName;
this.actorClassId = id;
this.positionX = posX; this.positionX = posX;
this.positionY = posY; this.positionY = posY;
this.positionZ = posZ; this.positionZ = posZ;
this.rotation = rot; this.rotation = rot;
this.animationId = animationId; this.animationId = animationId;
this.className = className;
this.displayNameId = displayNameId; this.displayNameId = displayNameId;
this.customDisplayName = customDisplayName; this.customDisplayName = customDisplayName;
this.zoneId = zoneId; this.uniqueIdentifier = uniqueId;
LoadNpcTemplate(id); this.zoneId = zoneId;
this.zone = Server.GetWorldManager().GetZone(zoneId);
this.actorClassId = classId;
loadNpcAppearance(classId);
this.classPath = classPath;
className = classPath.Substring(classPath.LastIndexOf("/")+1);
charaWork.battleSave.potencial = 1.0f; charaWork.battleSave.potencial = 1.0f;
@ -56,6 +69,11 @@ namespace FFXIVClassic_Map_Server.Actors
charaWork.property[3] = 1; charaWork.property[3] = 1;
charaWork.property[4] = 1; charaWork.property[4] = 1;
npcWork.pushCommand = 0x271D;
npcWork.pushCommandPriority = 1;
generateActorName((int)actorNumber);
} }
public SubPacket CreateAddActorPacket(uint playerActorId) public SubPacket CreateAddActorPacket(uint playerActorId)
@ -63,19 +81,34 @@ namespace FFXIVClassic_Map_Server.Actors
return AddActorPacket.BuildPacket(actorId, playerActorId, 8); return AddActorPacket.BuildPacket(actorId, playerActorId, 8);
} }
// actorClassId, [], [], numBattleCommon, [battleCommon], numEventCommon, [eventCommon], args for either initForBattle/initForEvent
public override SubPacket CreateScriptBindPacket(uint playerActorId) public override SubPacket CreateScriptBindPacket(uint playerActorId)
{ {
List<LuaParam> lParams; List<LuaParam> lParams;
Player player = Server.GetWorldManager().GetPCInWorld(playerActorId); Player player = Server.GetWorldManager().GetPCInWorld(playerActorId);
lParams = LuaEngine.DoActorInstantiate(player, this); lParams = DoActorInit(player);
if (lParams == null) if (lParams == null)
{ {
className = "PopulaceStandard"; string classPathFake = "/Chara/Npc/Populace/PopulaceStandard";
lParams = LuaUtils.CreateLuaParamList("/Chara/Npc/Populace/PopulaceStandard", false, false, false, false, false, 0xF47F6, false, false, 0, 1, "TEST"); string classNameFake = "PopulaceStandard";
lParams = LuaUtils.CreateLuaParamList(classPathFake, false, false, false, false, false, 0xF47F6, false, false, 0, 0);
ActorInstantiatePacket.BuildPacket(actorId, playerActorId, actorName, classNameFake, lParams).DebugPrintSubPacket();
return ActorInstantiatePacket.BuildPacket(actorId, playerActorId, actorName, classNameFake, lParams);
}
else
{
lParams.Insert(0, new LuaParam(2, classPath));
lParams.Insert(1, new LuaParam(4, 4));
lParams.Insert(2, new LuaParam(4, 4));
lParams.Insert(3, new LuaParam(4, 4));
lParams.Insert(4, new LuaParam(4, 4));
lParams.Insert(5, new LuaParam(4, 4));
lParams.Insert(6, new LuaParam(0, (int)actorClassId));
} }
ActorInstantiatePacket.BuildPacket(actorId, playerActorId, actorName, className, lParams).DebugPrintSubPacket();
return ActorInstantiatePacket.BuildPacket(actorId, playerActorId, actorName, className, lParams); return ActorInstantiatePacket.BuildPacket(actorId, playerActorId, actorName, className, lParams);
} }
@ -142,6 +175,8 @@ namespace FFXIVClassic_Map_Server.Actors
} }
propPacketUtil.AddProperty("npcWork.hateType"); propPacketUtil.AddProperty("npcWork.hateType");
propPacketUtil.AddProperty("npcWork.pushCommand");
propPacketUtil.AddProperty("npcWork.pushCommandPriority");
return BasePacket.CreatePacket(propPacketUtil.Done(), true, false); return BasePacket.CreatePacket(propPacketUtil.Done(), true, false);
} }
@ -151,7 +186,7 @@ namespace FFXIVClassic_Map_Server.Actors
return actorClassId; return actorClassId;
} }
public void LoadNpcTemplate(uint id) public void loadNpcAppearance(uint id)
{ {
using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD))) using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
{ {
@ -220,26 +255,32 @@ namespace FFXIVClassic_Map_Server.Actors
appearanceIds[Character.HIGHLIGHT_HAIR] = (uint)(reader.GetUInt32(3) | reader.GetUInt32(2) << 10); //5- Hair Highlight, 4 - Hair Style appearanceIds[Character.HIGHLIGHT_HAIR] = (uint)(reader.GetUInt32(3) | reader.GetUInt32(2) << 10); //5- Hair Highlight, 4 - Hair Style
appearanceIds[Character.VOICE] = reader.GetUInt32(17); appearanceIds[Character.VOICE] = reader.GetUInt32(17);
appearanceIds[Character.MAINHAND] = reader.GetUInt32(19); appearanceIds[Character.MAINHAND] = reader.GetUInt32(19);
//appearanceIds[Character.WEAPON2] = reader.GetUInt32(22); appearanceIds[Character.OFFHAND] = reader.GetUInt32(20);
appearanceIds[Character.SPMAINHAND] = reader.GetUInt32(21);
appearanceIds[Character.SPOFFHAND] = reader.GetUInt32(22);
appearanceIds[Character.THROWING] = reader.GetUInt32(23);
appearanceIds[Character.PACK] = reader.GetUInt32(24);
appearanceIds[Character.POUCH] = reader.GetUInt32(25);
appearanceIds[Character.HEADGEAR] = reader.GetUInt32(26); appearanceIds[Character.HEADGEAR] = reader.GetUInt32(26);
appearanceIds[Character.BODYGEAR] = reader.GetUInt32(27); appearanceIds[Character.BODYGEAR] = reader.GetUInt32(27);
appearanceIds[Character.LEGSGEAR] = reader.GetUInt32(28); appearanceIds[Character.LEGSGEAR] = reader.GetUInt32(28);
appearanceIds[Character.HANDSGEAR] = reader.GetUInt32(29); appearanceIds[Character.HANDSGEAR] = reader.GetUInt32(29);
appearanceIds[Character.FEETGEAR] = reader.GetUInt32(30); appearanceIds[Character.FEETGEAR] = reader.GetUInt32(30);
appearanceIds[Character.WAISTGEAR] = reader.GetUInt32(31); appearanceIds[Character.WAISTGEAR] = reader.GetUInt32(31);
appearanceIds[Character.R_EAR] = reader.GetUInt32(32); appearanceIds[Character.NECKGEAR] = reader.GetUInt32(32);
appearanceIds[Character.L_EAR] = reader.GetUInt32(33); appearanceIds[Character.R_EAR] = reader.GetUInt32(33);
appearanceIds[Character.R_RINGFINGER] = reader.GetUInt32(36); appearanceIds[Character.L_EAR] = reader.GetUInt32(34);
appearanceIds[Character.L_RINGFINGER] = reader.GetUInt32(37); appearanceIds[Character.R_INDEXFINGER] = reader.GetUInt32(35);
appearanceIds[Character.L_INDEXFINGER] = reader.GetUInt32(36);
appearanceIds[Character.R_RINGFINGER] = reader.GetUInt32(37);
appearanceIds[Character.L_RINGFINGER] = reader.GetUInt32(38);
} }
} }
} }
catch (MySqlException e) catch (MySqlException e)
{ { Console.WriteLine(e); }
Program.Log.Error(e.ToString());
}
finally finally
{ {
conn.Dispose(); conn.Dispose();
@ -247,10 +288,132 @@ namespace FFXIVClassic_Map_Server.Actors
} }
} }
public void LoadEventConditions(string eventConditions) public void loadEventConditions(string eventConditions)
{ {
EventList conditions = JsonConvert.DeserializeObject<EventList>(eventConditions); EventList conditions = JsonConvert.DeserializeObject<EventList>(eventConditions);
this.eventConditions = conditions; this.eventConditions = conditions;
} }
public List<LuaParam> DoActorInit(Player player)
{
Script parent = null, child = null;
if (File.Exists("./scripts/base/" + classPath + ".lua"))
parent = LuaEngine.LoadScript("./scripts/base/" + classPath + ".lua");
if (File.Exists(String.Format("./scripts/unique/{0}/{1}/{2}.lua", zone.zoneName, className, uniqueIdentifier)))
child = LuaEngine.LoadScript(String.Format("./scripts/unique/{0}/{1}/{2}.lua", zone.zoneName, className, uniqueIdentifier));
if (parent == null && child == null)
{
LuaEngine.SendError(player, String.Format("ERROR: Could not find script for actor {0}.", GetName()));
return null;
}
DynValue result;
if (child != null && child.Globals["init"] != null)
result = child.Call(child.Globals["init"], this);
else if (parent != null && parent.Globals["init"] != null)
result = parent.Call(parent.Globals["init"], this);
else
return null;
List<LuaParam> lparams = LuaUtils.CreateLuaParamList(result);
return lparams;
}
public void DoEventStart(Player player, EventStartPacket eventStart)
{
Script parent = null, child = null;
if (File.Exists("./scripts/base/" + classPath + ".lua"))
parent = LuaEngine.LoadScript("./scripts/base/" + classPath + ".lua");
if (File.Exists(String.Format("./scripts/unique/{0}/{1}/{2}.lua", zone.zoneName, className, uniqueIdentifier)))
child = LuaEngine.LoadScript(String.Format("./scripts/unique/{0}/{1}/{2}.lua", zone.zoneName, className, uniqueIdentifier));
if (parent == null)
{
LuaEngine.SendError(player, String.Format("ERROR: Could not find script for actor {0}.", GetName()));
return;
}
//Have to do this to combine LuaParams
List<Object> objects = new List<Object>();
objects.Add(player);
objects.Add(this);
objects.Add(eventStart.triggerName);
if (eventStart.luaParams != null)
objects.AddRange(LuaUtils.CreateLuaParamObjectList(eventStart.luaParams));
//Run Script
DynValue result;
if (child != null && !child.Globals.Get("onEventStarted").IsNil())
result = child.Call(child.Globals["onEventStarted"], objects.ToArray());
else if (!parent.Globals.Get("onEventStarted").IsNil())
result = parent.Call(parent.Globals["onEventStarted"], objects.ToArray());
else
return;
}
public void DoEventUpdate(Player player, EventUpdatePacket eventUpdate)
{
Script parent = null, child = null;
if (File.Exists("./scripts/base/" + classPath + ".lua"))
parent = LuaEngine.LoadScript("./scripts/base/" + classPath + ".lua");
if (File.Exists(String.Format("./scripts/unique/{0}/{1}/{2}.lua", zone.zoneName, className, uniqueIdentifier)))
child = LuaEngine.LoadScript(String.Format("./scripts/unique/{0}/{1}/{2}.lua", zone.zoneName, className, uniqueIdentifier));
if (parent == null)
{
LuaEngine.SendError(player, String.Format("ERROR: Could not find script for actor {0}.", GetName()));
return;
}
//Have to do this to combine LuaParams
List<Object> objects = new List<Object>();
objects.Add(player);
objects.Add(this);
objects.Add(eventUpdate.val2);
objects.AddRange(LuaUtils.CreateLuaParamObjectList(eventUpdate.luaParams));
//Run Script
DynValue result;
if (child != null && !child.Globals.Get("onEventUpdate").IsNil())
result = child.Call(child.Globals["onEventUpdate"], objects.ToArray());
else if (!parent.Globals.Get("onEventUpdate").IsNil())
result = parent.Call(parent.Globals["onEventUpdate"], objects.ToArray());
else
return;
}
internal void DoOnActorSpawn(Player player)
{
Script parent = null, child = null;
if (File.Exists("./scripts/base/" + classPath + ".lua"))
parent = LuaEngine.LoadScript("./scripts/base/" + classPath + ".lua");
if (File.Exists(String.Format("./scripts/unique/{0}/{1}/{2}.lua", zone.zoneName, className, uniqueIdentifier)))
child = LuaEngine.LoadScript(String.Format("./scripts/unique/{0}/{1}/{2}.lua", zone.zoneName, className, uniqueIdentifier));
if (parent == null)
{
LuaEngine.SendError(player, String.Format("ERROR: Could not find script for actor {0}.", GetName()));
return;
}
//Run Script
if (child != null && !child.Globals.Get("onSpawn").IsNil())
child.Call(child.Globals["onSpawn"], player, this);
else if (!parent.Globals.Get("onSpawn").IsNil())
parent.Call(parent.Globals["onSpawn"], player, this);
else
return;
}
} }
} }

View file

@ -241,7 +241,7 @@ namespace FFXIVClassic_Map_Server.Actors
packets.Add(_0x132Packet.BuildPacket(playerActorId, 0x4, "commandContent")); packets.Add(_0x132Packet.BuildPacket(playerActorId, 0x4, "commandContent"));
packets.Add(_0x132Packet.BuildPacket(playerActorId, 0x6, "commandJudgeMode")); packets.Add(_0x132Packet.BuildPacket(playerActorId, 0x6, "commandJudgeMode"));
packets.Add(_0x132Packet.BuildPacket(playerActorId, 0x100, "commandRequest")); packets.Add(_0x132Packet.BuildPacket(playerActorId, 0x100, "commandRequest"));
packets.Add(_0x132Packet.BuildPacket(playerActorId, 0x100, "widgetCreate")); packets.Add(_0x132Packet.BuildPacket(playerActorId, 0x100, "widGetCreate"));
packets.Add(_0x132Packet.BuildPacket(playerActorId, 0x100, "macroRequest")); packets.Add(_0x132Packet.BuildPacket(playerActorId, 0x100, "macroRequest"));
return packets; return packets;
} }
@ -386,7 +386,7 @@ namespace FFXIVClassic_Map_Server.Actors
for (int i = 0; i < charaWork.additionalCommandAcquired.Length; i++) for (int i = 0; i < charaWork.additionalCommandAcquired.Length; i++)
{ {
if (charaWork.additionalCommandAcquired[i] != false) if (charaWork.additionalCommandAcquired[i] != false)
propPacketUtil.AddProperty(String.Format("charaWork.additionalCommandAcquired[{0}]", i)); propPacketUtil.AddProperty(String.Format("charaWork.AdditionalCommandAcquired[{0}]", i));
} }
for (int i = 0; i < charaWork.parameterSave.commandSlot_compatibility.Length; i++) for (int i = 0; i < charaWork.parameterSave.commandSlot_compatibility.Length; i++)

View file

@ -1,9 +1,14 @@
using FFXIVClassic.Common; using FFXIVClassic_Map_Server;
using FFXIVClassic.Common;
using FFXIVClassic_Map_Server.packets; using FFXIVClassic_Map_Server.packets;
using FFXIVClassic_Map_Server.Actors; using FFXIVClassic_Map_Server.Actors;
using FFXIVClassic_Map_Server.lua; using FFXIVClassic_Map_Server.lua;
using FFXIVClassic_Map_Server.packets.send.actor; using FFXIVClassic_Map_Server.packets.send.actor;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.dataobjects namespace FFXIVClassic_Map_Server.dataobjects
{ {
@ -111,7 +116,7 @@ namespace FFXIVClassic_Map_Server.dataobjects
public void UpdateInstance(List<Actor> list) public void UpdateInstance(List<Actor> list)
{ {
List<BasePacket> basePackets = new List<BasePacket>(); List<BasePacket> basePackets = new List<BasePacket>();
List<SubPacket> removeActorSubpackets = new List<SubPacket>(); List<SubPacket> RemoveActorSubpackets = new List<SubPacket>();
List<SubPacket> posUpdateSubpackets = new List<SubPacket>(); List<SubPacket> posUpdateSubpackets = new List<SubPacket>();
//Remove missing actors //Remove missing actors
@ -145,7 +150,7 @@ namespace FFXIVClassic_Map_Server.dataobjects
if (actor is Npc) if (actor is Npc)
{ {
LuaEngine.DoActorOnSpawn(GetActor(), (Npc)actor); ((Npc)actor).DoOnActorSpawn(playerActor);
} }
} }
} }

View file

@ -28,27 +28,27 @@ namespace FFXIVClassic_Map_Server.lua
UserData.RegistrationPolicy = InteropRegistrationPolicy.Automatic; UserData.RegistrationPolicy = InteropRegistrationPolicy.Automatic;
} }
public static List<LuaParam> DoActorInstantiate(Player player, Actor target) public static List<LuaParam> DoActorInstantiate(Player player, Actor tarGet)
{ {
string luaPath; string luaPath;
if (target is Npc) if (tarGet is Npc)
{ {
luaPath = String.Format(FILEPATH_NPCS, target.zoneId, target.GetName()); luaPath = String.Format(FILEPATH_NPCS, tarGet.zoneId, tarGet.GetName());
if (File.Exists(luaPath)) if (File.Exists(luaPath))
{ {
Script script = loadScript(luaPath); Script script = LoadScript(luaPath);
if (script == null) if (script == null)
return null; return null;
DynValue result = script.Call(script.Globals["init"], target); DynValue result = script.Call(script.Globals["init"], tarGet);
List<LuaParam> lparams = LuaUtils.CreateLuaParamList(result); List<LuaParam> lparams = LuaUtils.CreateLuaParamList(result);
return lparams; return lparams;
} }
else else
{ {
SendError(player, String.Format("ERROR: Could not find script for actor {0}.", target.GetName())); SendError(player, String.Format("ERROR: Could not find script for actor {0}.", tarGet.GetName()));
return null; return null;
} }
} }
@ -56,24 +56,30 @@ namespace FFXIVClassic_Map_Server.lua
return null; return null;
} }
public static void DoActorOnEventStarted(Player player, Actor target, EventStartPacket eventStart) public static void DoActorOnEventStarted(Player player, Actor tarGet, EventStartPacket eventStart)
{ {
if (tarGet is Npc)
{
((Npc)tarGet).DoEventStart(player, eventStart);
return;
}
string luaPath; string luaPath;
if (target is Command) if (tarGet is Command)
{ {
luaPath = String.Format(FILEPATH_COMMANDS, target.GetName()); luaPath = String.Format(FILEPATH_COMMANDS, tarGet.GetName());
} }
else if (target is Director) else if (tarGet is Director)
{ {
luaPath = String.Format(FILEPATH_DIRECTORS, target.GetName()); luaPath = String.Format(FILEPATH_DIRECTORS, tarGet.GetName());
} }
else else
luaPath = String.Format(FILEPATH_NPCS, target.zoneId, target.GetName()); luaPath = String.Format(FILEPATH_NPCS, tarGet.zoneId, tarGet.GetName());
if (File.Exists(luaPath)) if (File.Exists(luaPath))
{ {
Script script = loadScript(luaPath); Script script = LoadScript(luaPath);
if (script == null) if (script == null)
return; return;
@ -81,7 +87,7 @@ namespace FFXIVClassic_Map_Server.lua
//Have to Do this to combine LuaParams //Have to Do this to combine LuaParams
List<Object> objects = new List<Object>(); List<Object> objects = new List<Object>();
objects.Add(player); objects.Add(player);
objects.Add(target); objects.Add(tarGet);
objects.Add(eventStart.triggerName); objects.Add(eventStart.triggerName);
if (eventStart.luaParams != null) if (eventStart.luaParams != null)
@ -93,47 +99,53 @@ namespace FFXIVClassic_Map_Server.lua
} }
else else
{ {
SendError(player, String.Format("ERROR: Could not find script for actor {0}.", target.GetName())); SendError(player, String.Format("ERROR: Could not find script for actor {0}.", tarGet.GetName()));
} }
} }
public static void DoActorOnSpawn(Player player, Npc target) public static void DoActorOnSpawn(Player player, Npc tarGet)
{ {
string luaPath = String.Format(FILEPATH_NPCS, target.zoneId, target.GetName()); string luaPath = String.Format(FILEPATH_NPCS, tarGet.zoneId, tarGet.GetName());
if (File.Exists(luaPath)) if (File.Exists(luaPath))
{ {
Script script = loadScript(luaPath); Script script = LoadScript(luaPath);
if (script == null) if (script == null)
return; return;
//Run Script //Run Script
if (!script.Globals.Get("onSpawn").IsNil()) if (!script.Globals.Get("onSpawn").IsNil())
script.Call(script.Globals["onSpawn"], player, target); script.Call(script.Globals["onSpawn"], player, tarGet);
} }
else else
{ {
SendError(player, String.Format("ERROR: Could not find script for actor {0}.", target.GetName())); SendError(player, String.Format("ERROR: Could not find script for actor {0}.", tarGet.GetName()));
} }
} }
public static void DoActorOnEventUpdated(Player player, Actor target, EventUpdatePacket eventUpdate) public static void DoActorOnEventUpdated(Player player, Actor tarGet, EventUpdatePacket eventUpdate)
{ {
if (tarGet is Npc)
{
((Npc)tarGet).DoEventUpdate(player, eventUpdate);
return;
}
string luaPath; string luaPath;
if (target is Command) if (tarGet is Command)
luaPath = String.Format(FILEPATH_COMMANDS, target.GetName()); luaPath = String.Format(FILEPATH_COMMANDS, tarGet.GetName());
else if (target is Director) else if (tarGet is Director)
luaPath = String.Format(FILEPATH_DIRECTORS, target.GetName()); luaPath = String.Format(FILEPATH_DIRECTORS, tarGet.GetName());
else else
luaPath = String.Format(FILEPATH_NPCS, target.zoneId, target.GetName()); luaPath = String.Format(FILEPATH_NPCS, tarGet.zoneId, tarGet.GetName());
if (File.Exists(luaPath)) if (File.Exists(luaPath))
{ {
Script script = loadScript(luaPath); Script script = LoadScript(luaPath);
if (script == null) if (script == null)
return; return;
@ -141,7 +153,7 @@ namespace FFXIVClassic_Map_Server.lua
//Have to Do this to combine LuaParams //Have to Do this to combine LuaParams
List<Object> objects = new List<Object>(); List<Object> objects = new List<Object>();
objects.Add(player); objects.Add(player);
objects.Add(target); objects.Add(tarGet);
objects.Add(eventUpdate.val2); objects.Add(eventUpdate.val2);
objects.AddRange(LuaUtils.CreateLuaParamObjectList(eventUpdate.luaParams)); objects.AddRange(LuaUtils.CreateLuaParamObjectList(eventUpdate.luaParams));
@ -151,7 +163,7 @@ namespace FFXIVClassic_Map_Server.lua
} }
else else
{ {
SendError(player, String.Format("ERROR: Could not find script for actor {0}.", target.GetName())); SendError(player, String.Format("ERROR: Could not find script for actor {0}.", tarGet.GetName()));
} }
} }
@ -161,7 +173,7 @@ namespace FFXIVClassic_Map_Server.lua
if (File.Exists(luaPath)) if (File.Exists(luaPath))
{ {
Script script = loadScript(luaPath); Script script = LoadScript(luaPath);
if (script == null) if (script == null)
return; return;
@ -176,7 +188,7 @@ namespace FFXIVClassic_Map_Server.lua
{ {
if (File.Exists(FILEPATH_PLAYER)) if (File.Exists(FILEPATH_PLAYER))
{ {
Script script = loadScript(FILEPATH_PLAYER); Script script = LoadScript(FILEPATH_PLAYER);
if (script == null) if (script == null)
return; return;
@ -191,7 +203,7 @@ namespace FFXIVClassic_Map_Server.lua
{ {
if (File.Exists(FILEPATH_PLAYER)) if (File.Exists(FILEPATH_PLAYER))
{ {
Script script = loadScript(FILEPATH_PLAYER); Script script = LoadScript(FILEPATH_PLAYER);
if (script == null) if (script == null)
return; return;
@ -202,14 +214,14 @@ namespace FFXIVClassic_Map_Server.lua
} }
} }
private static Script loadScript(string filename) public static Script LoadScript(string filename)
{ {
Script script = new Script(); Script script = new Script();
((FileSystemScriptLoader)script.Options.ScriptLoader).ModulePaths = FileSystemScriptLoader.UnpackStringPaths("./scripts/?;./scripts/?.lua"); ((FileSystemScriptLoader)script.Options.ScriptLoader).ModulePaths = FileSystemScriptLoader.UnpackStringPaths("./scripts/?;./scripts/?.lua");
script.Globals["getWorldManager"] = (Func<WorldManager>)Server.GetWorldManager; script.Globals["GetWorldManager"] = (Func<WorldManager>)Server.GetWorldManager;
script.Globals["getStaticActor"] = (Func<string, Actor>)Server.GetStaticActors; script.Globals["GetStaticActor"] = (Func<string, Actor>)Server.GetStaticActors;
script.Globals["getWorldMaster"] = (Func<Actor>)Server.GetWorldManager().GetActor; script.Globals["GetWorldMaster"] = (Func<Actor>)Server.GetWorldManager().GetActor;
script.Globals["getItemGamedata"] = (Func<uint, Item>)Server.GetItemGamedata; script.Globals["GetItemGamedata"] = (Func<uint, Item>)Server.GetItemGamedata;
try try
{ {
@ -223,7 +235,7 @@ namespace FFXIVClassic_Map_Server.lua
return script; return script;
} }
private static void SendError(Player player, string message) public static void SendError(Player player, string message)
{ {
List<SubPacket> SendError = new List<SubPacket>(); List<SubPacket> SendError = new List<SubPacket>();
SendError.Add(EndEventPacket.BuildPacket(player.actorId, player.currentEventOwner, player.currentEventName)); SendError.Add(EndEventPacket.BuildPacket(player.actorId, player.currentEventOwner, player.currentEventName));
@ -238,7 +250,7 @@ namespace FFXIVClassic_Map_Server.lua
if (File.Exists(luaPath)) if (File.Exists(luaPath))
{ {
Script script = loadScript(luaPath); Script script = LoadScript(luaPath);
if (script == null) if (script == null)
return; return;
@ -259,7 +271,7 @@ namespace FFXIVClassic_Map_Server.lua
if (File.Exists(luaPath)) if (File.Exists(luaPath))
{ {
Script script = loadScript(luaPath); Script script = LoadScript(luaPath);
if (script == null) if (script == null)
return; return;

View file

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="Cyotek.CircularBuffer" version="1.0.0.0" targetFramework="net45" /> <package id="Cyotek.CircularBuffer" version="1.0.0.0" tarGetFramework="net45" />
<package id="Dapper" version="1.42" targetFramework="net45" /> <package id="Dapper" version="1.42" tarGetFramework="net45" />
<package id="MoonSharp" version="1.2.1.0" targetFramework="net45" /> <package id="MoonSharp" version="1.2.1.0" tarGetFramework="net45" />
<package id="MySql.Data" version="6.9.7" targetFramework="net45" /> <package id="MySql.Data" version="6.9.7" tarGetFramework="net45" />
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net45" /> <package id="Newtonsoft.Json" version="8.0.3" tarGetFramework="net45" />
<package id="NLog" version="4.3.5" targetFramework="net45" /> <package id="NLog" version="4.3.5" tarGetFramework="net45" />
<package id="NLog.Config" version="4.3.5" targetFramework="net45" /> <package id="NLog.Config" version="4.3.5" tarGetFramework="net45" />
<package id="NLog.Schema" version="4.3.4" targetFramework="net45" /> <package id="NLog.Schema" version="4.3.4" tarGetFramework="net45" />
</packages> </packages>

View file

@ -10,7 +10,7 @@ namespace FFXIVClassic_Map_Server.packets
public ushort subpacketSize; public ushort subpacketSize;
public ushort type; public ushort type;
public uint sourceId; public uint sourceId;
public uint targetId; public uint tarGetId;
public uint unknown1; public uint unknown1;
} }
@ -68,14 +68,14 @@ namespace FFXIVClassic_Map_Server.packets
offset += header.subpacketSize; offset += header.subpacketSize;
} }
public SubPacket(ushort opcode, uint sourceId, uint targetId, byte[] data) public SubPacket(ushort opcode, uint sourceId, uint tarGetId, byte[] data)
{ {
this.header = new SubPacketHeader(); this.header = new SubPacketHeader();
this.gameMessage = new GameMessageHeader(); this.gameMessage = new GameMessageHeader();
gameMessage.opcode = opcode; gameMessage.opcode = opcode;
header.sourceId = sourceId; header.sourceId = sourceId;
header.targetId = targetId; header.tarGetId = tarGetId;
gameMessage.timestamp = Utils.UnixTimeStampUTC(); gameMessage.timestamp = Utils.UnixTimeStampUTC();
@ -97,7 +97,7 @@ namespace FFXIVClassic_Map_Server.packets
header.subpacketSize = original.header.subpacketSize; header.subpacketSize = original.header.subpacketSize;
header.type = original.header.type; header.type = original.header.type;
header.sourceId = original.header.sourceId; header.sourceId = original.header.sourceId;
header.targetId = newTargetId; header.tarGetId = newTargetId;
data = original.data; data = original.data;
} }

View file

@ -8,26 +8,26 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
public const ushort OPCODE = 0x00E1; public const ushort OPCODE = 0x00E1;
public const uint PACKET_SIZE = 0x30; public const uint PACKET_SIZE = 0x30;
public static SubPacket BuildPacket(uint sourceActorId, uint targetActorId, uint targettedActorId, uint emoteID) public static SubPacket BuildPacket(uint sourceActorId, uint tarGetActorId, uint tarGettedActorId, uint emoteID)
{ {
byte[] data = new byte[PACKET_SIZE - 0x20]; byte[] data = new byte[PACKET_SIZE - 0x20];
if (targettedActorId == 0xC0000000) if (tarGettedActorId == 0xC0000000)
targettedActorId = sourceActorId; tarGettedActorId = sourceActorId;
using (MemoryStream mem = new MemoryStream(data)) using (MemoryStream mem = new MemoryStream(data))
{ {
using (BinaryWriter binWriter = new BinaryWriter(mem)) using (BinaryWriter binWriter = new BinaryWriter(mem))
{ {
uint realAnimID = 0x5000000 | ((emoteID - 100) << 12); uint realAnimID = 0x5000000 | ((emoteID - 100) << 12);
uint realDescID = 20000 + ((emoteID - 1) * 10) + (targettedActorId == sourceActorId ? (uint)2 : (uint)1); uint realDescID = 20000 + ((emoteID - 1) * 10) + (tarGettedActorId == sourceActorId ? (uint)2 : (uint)1);
binWriter.Write((UInt32)realAnimID); binWriter.Write((UInt32)realAnimID);
binWriter.Write((UInt32)targettedActorId); binWriter.Write((UInt32)tarGettedActorId);
binWriter.Write((UInt32)realDescID); binWriter.Write((UInt32)realDescID);
} }
} }
SubPacket packet = new SubPacket(OPCODE, sourceActorId, targetActorId, data); SubPacket packet = new SubPacket(OPCODE, sourceActorId, tarGetActorId, data);
packet.DebugPrintSubPacket(); packet.DebugPrintSubPacket();
return packet; return packet;
} }

View file

@ -11,7 +11,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
public const ushort OPCODE = 0x00CC; public const ushort OPCODE = 0x00CC;
public const uint PACKET_SIZE = 0x128; public const uint PACKET_SIZE = 0x128;
public static SubPacket BuildPacket(uint sourceActorID, uint targetActorID, string objectName, string className, List<LuaParam> initParams) public static SubPacket BuildPacket(uint sourceActorID, uint tarGetActorID, string objectName, string className, List<LuaParam> initParams)
{ {
byte[] data = new byte[PACKET_SIZE - 0x20]; byte[] data = new byte[PACKET_SIZE - 0x20];
@ -31,7 +31,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
} }
} }
return new SubPacket(OPCODE, sourceActorID, targetActorID, data); return new SubPacket(OPCODE, sourceActorID, tarGetActorID, data);
} }
} }

View file

@ -13,7 +13,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
public const ushort OPCODE = 0x00E3; public const ushort OPCODE = 0x00E3;
public const uint PACKET_SIZE = 0x28; public const uint PACKET_SIZE = 0x28;
public static SubPacket BuildPacket(uint playerActorID, uint targetActorID, int iconCode) public static SubPacket BuildPacket(uint playerActorID, uint tarGetActorID, int iconCode)
{ {
byte[] data = new byte[PACKET_SIZE - 0x20]; byte[] data = new byte[PACKET_SIZE - 0x20];
@ -25,7 +25,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
} }
} }
return new SubPacket(OPCODE, targetActorID, playerActorID, data); return new SubPacket(OPCODE, tarGetActorID, playerActorID, data);
} }
} }
} }

View file

@ -7,7 +7,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
public const ushort OPCODE = 0x0139; public const ushort OPCODE = 0x0139;
public const uint PACKET_SIZE = 0x58; public const uint PACKET_SIZE = 0x58;
public static SubPacket BuildPacket(uint sourceId, uint targetId) public static SubPacket BuildPacket(uint sourceId, uint tarGetId)
{ {
byte[] data = new byte[PACKET_SIZE - 0x20]; byte[] data = new byte[PACKET_SIZE - 0x20];
@ -18,7 +18,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
} }
} }
return new SubPacket(OPCODE, sourceId, targetId, data); return new SubPacket(OPCODE, sourceId, tarGetId, data);
} }
} }
} }

View file

@ -8,7 +8,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
public const ushort OPCODE = 0x00CF; public const ushort OPCODE = 0x00CF;
public const uint PACKET_SIZE = 0x50; public const uint PACKET_SIZE = 0x50;
public static SubPacket BuildPacket(uint playerActorID, uint targetActorID, float x, float y, float z, float rot, ushort moveState) public static SubPacket BuildPacket(uint playerActorID, uint tarGetActorID, float x, float y, float z, float rot, ushort moveState)
{ {
byte[] data = new byte[PACKET_SIZE - 0x20]; byte[] data = new byte[PACKET_SIZE - 0x20];
@ -25,7 +25,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
} }
} }
SubPacket packet = new SubPacket(OPCODE, playerActorID, targetActorID, data); SubPacket packet = new SubPacket(OPCODE, playerActorID, tarGetActorID, data);
return packet; return packet;
} }

View file

@ -12,7 +12,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
public const ushort OPCODE = 0x0145; public const ushort OPCODE = 0x0145;
public const uint PACKET_SIZE = 0x28; public const uint PACKET_SIZE = 0x28;
public static SubPacket BuildPacket(uint playerActorID, uint targetActorID, uint iconCode) public static SubPacket BuildPacket(uint playerActorID, uint tarGetActorID, uint iconCode)
{ {
byte[] data = new byte[PACKET_SIZE - 0x20]; byte[] data = new byte[PACKET_SIZE - 0x20];
@ -24,7 +24,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
} }
} }
return new SubPacket(OPCODE, playerActorID, targetActorID, data); return new SubPacket(OPCODE, playerActorID, tarGetActorID, data);
} }
} }
} }

View file

@ -8,7 +8,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
public const ushort OPCODE = 0x144; public const ushort OPCODE = 0x144;
public const uint PACKET_SIZE = 0x28; public const uint PACKET_SIZE = 0x28;
public static SubPacket BuildPacket(uint playerActorID, uint targetID, uint idleAnimationId) public static SubPacket BuildPacket(uint playerActorID, uint tarGetID, uint idleAnimationId)
{ {
byte[] data = new byte[PACKET_SIZE - 0x20]; byte[] data = new byte[PACKET_SIZE - 0x20];
@ -21,7 +21,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
} }
} }
return new SubPacket(OPCODE, playerActorID, targetID, data); return new SubPacket(OPCODE, playerActorID, tarGetID, data);
} }
} }
} }

View file

@ -5,11 +5,11 @@
public const ushort OPCODE = 0x017B; public const ushort OPCODE = 0x017B;
public const uint PACKET_SIZE = 0x28; public const uint PACKET_SIZE = 0x28;
public static SubPacket BuildPacket(uint playerActorID, uint targetActorID, bool isDimmed) public static SubPacket BuildPacket(uint playerActorID, uint tarGetActorID, bool isDimmed)
{ {
byte[] data = new byte[PACKET_SIZE - 0x20]; byte[] data = new byte[PACKET_SIZE - 0x20];
data[0] = (byte)(isDimmed ? 1 : 0); data[0] = (byte)(isDimmed ? 1 : 0);
return new SubPacket(OPCODE, playerActorID, targetActorID, data); return new SubPacket(OPCODE, playerActorID, tarGetActorID, data);
} }
} }
} }

View file

@ -9,7 +9,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
public const ushort OPCODE = 0x013D; public const ushort OPCODE = 0x013D;
public const uint PACKET_SIZE = 0x48; public const uint PACKET_SIZE = 0x48;
public static SubPacket BuildPacket(uint playerActorID, uint targetActorID, uint displayNameID, string customName) public static SubPacket BuildPacket(uint playerActorID, uint tarGetActorID, uint displayNameID, string customName)
{ {
byte[] data = new byte[PACKET_SIZE - 0x20]; byte[] data = new byte[PACKET_SIZE - 0x20];
@ -27,7 +27,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
} }
} }
SubPacket packet = new SubPacket(OPCODE, playerActorID, targetActorID, data); SubPacket packet = new SubPacket(OPCODE, playerActorID, tarGetActorID, data);
return packet; return packet;
} }

View file

@ -22,7 +22,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
public const float INNPOS_Z = 165.050003f; public const float INNPOS_Z = 165.050003f;
public const float INNPOS_ROT = -1.530000f; public const float INNPOS_ROT = -1.530000f;
public static SubPacket BuildPacket(uint sourceActorID, uint targetActorID, uint actorId, float x, float y, float z, float rotation, uint spawnType, bool isZoningPlayer) public static SubPacket BuildPacket(uint sourceActorID, uint tarGetActorID, uint actorId, float x, float y, float z, float rotation, uint spawnType, bool isZoningPlayer)
{ {
byte[] data = new byte[PACKET_SIZE-0x20]; byte[] data = new byte[PACKET_SIZE-0x20];
@ -44,7 +44,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
} }
} }
return new SubPacket(OPCODE, sourceActorID, targetActorID, data); return new SubPacket(OPCODE, sourceActorID, tarGetActorID, data);
} }
} }

View file

@ -182,9 +182,9 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
isMore = flag; isMore = flag;
} }
public void SetTarget(string target) public void SetTarget(string tarGet)
{ {
currentTarget = target; currentTarget = tarGet;
} }
public void AddTarget() public void AddTarget()

View file

@ -12,7 +12,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
public const float DEFAULT_WALK = 2.0f; public const float DEFAULT_WALK = 2.0f;
public const float DEFAULT_RUN = 5.0f; public const float DEFAULT_RUN = 5.0f;
public static SubPacket BuildPacket(uint playerActorID, uint targetActorID) public static SubPacket BuildPacket(uint playerActorID, uint tarGetActorID)
{ {
byte[] data = new byte[PACKET_SIZE - 0x20]; byte[] data = new byte[PACKET_SIZE - 0x20];
@ -38,10 +38,10 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
} }
} }
return new SubPacket(OPCODE, playerActorID, targetActorID, data); return new SubPacket(OPCODE, playerActorID, tarGetActorID, data);
} }
public static SubPacket BuildPacket(uint playerActorID, uint targetActorID, float stopSpeed, float walkSpeed, float runSpeed) public static SubPacket BuildPacket(uint playerActorID, uint tarGetActorID, float stopSpeed, float walkSpeed, float runSpeed)
{ {
byte[] data = new byte[PACKET_SIZE - 0x20]; byte[] data = new byte[PACKET_SIZE - 0x20];
@ -67,7 +67,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
} }
} }
return new SubPacket(OPCODE, playerActorID, targetActorID, data); return new SubPacket(OPCODE, playerActorID, tarGetActorID, data);
} }
} }
} }

View file

@ -27,10 +27,10 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
public const ushort OPCODE = 0x134; public const ushort OPCODE = 0x134;
public const uint PACKET_SIZE = 0x28; public const uint PACKET_SIZE = 0x28;
public static SubPacket BuildPacket(uint playerActorID, uint targetID, uint mainState, uint subState) public static SubPacket BuildPacket(uint playerActorID, uint tarGetID, uint mainState, uint subState)
{ {
ulong combined = (mainState & 0xFF) | ((subState & 0xFF) << 8); ulong combined = (mainState & 0xFF) | ((subState & 0xFF) << 8);
return new SubPacket(OPCODE, playerActorID, targetID, BitConverter.GetBytes(combined)); return new SubPacket(OPCODE, playerActorID, tarGetID, BitConverter.GetBytes(combined));
} }
} }
} }

View file

@ -8,7 +8,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
public const ushort OPCODE = 0x0179; public const ushort OPCODE = 0x0179;
public const uint PACKET_SIZE = 0x48; public const uint PACKET_SIZE = 0x48;
public static SubPacket BuildPacket(uint playerActorID, uint targetActorID, ushort[] statusIds) public static SubPacket BuildPacket(uint playerActorID, uint tarGetActorID, ushort[] statusIds)
{ {
byte[] data = new byte[PACKET_SIZE - 0x20]; byte[] data = new byte[PACKET_SIZE - 0x20];
@ -25,7 +25,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
} }
} }
SubPacket packet = new SubPacket(OPCODE, playerActorID, targetActorID, data); SubPacket packet = new SubPacket(OPCODE, playerActorID, tarGetActorID, data);
return packet; return packet;
} }
} }

View file

@ -8,7 +8,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
public const ushort OPCODE = 0x0177; public const ushort OPCODE = 0x0177;
public const uint PACKET_SIZE = 0x28; public const uint PACKET_SIZE = 0x28;
public static SubPacket BuildPacket(uint playerActorID, uint targetActorID, ushort index, ushort statusCode) public static SubPacket BuildPacket(uint playerActorID, uint tarGetActorID, ushort index, ushort statusCode)
{ {
byte[] data = new byte[PACKET_SIZE - 0x20]; byte[] data = new byte[PACKET_SIZE - 0x20];
@ -21,7 +21,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
} }
} }
return new SubPacket(OPCODE, playerActorID, targetActorID, data); return new SubPacket(OPCODE, playerActorID, tarGetActorID, data);
} }
} }
} }

View file

@ -7,9 +7,9 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
public const ushort OPCODE = 0x00D3; public const ushort OPCODE = 0x00D3;
public const uint PACKET_SIZE = 0x28; public const uint PACKET_SIZE = 0x28;
public static SubPacket BuildPacket(uint playerActorID, uint targetActorID, uint targetID) public static SubPacket BuildPacket(uint playerActorID, uint tarGetActorID, uint tarGetID)
{ {
return new SubPacket(OPCODE, playerActorID, targetID, BitConverter.GetBytes((ulong)targetID)); return new SubPacket(OPCODE, playerActorID, tarGetID, BitConverter.GetBytes((ulong)tarGetID));
} }
} }
} }

View file

@ -7,9 +7,9 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
public const ushort OPCODE = 0x00DB; public const ushort OPCODE = 0x00DB;
public const uint PACKET_SIZE = 0x28; public const uint PACKET_SIZE = 0x28;
public static SubPacket BuildPacket(uint playerActorID, uint targetActorID, uint targetID) public static SubPacket BuildPacket(uint playerActorID, uint tarGetActorID, uint tarGetID)
{ {
return new SubPacket(OPCODE, playerActorID, targetID, BitConverter.GetBytes((ulong)targetID)); return new SubPacket(OPCODE, playerActorID, tarGetID, BitConverter.GetBytes((ulong)tarGetID));
} }
} }
} }

View file

@ -7,7 +7,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
public const ushort OPCODE = 0x000F; public const ushort OPCODE = 0x000F;
public const uint PACKET_SIZE = 0x38; public const uint PACKET_SIZE = 0x38;
public static SubPacket BuildPacket(uint playerActorID, uint targetActorID) public static SubPacket BuildPacket(uint playerActorID, uint tarGetActorID)
{ {
byte[] data = new byte[PACKET_SIZE - 0x20]; byte[] data = new byte[PACKET_SIZE - 0x20];
@ -19,7 +19,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
} }
} }
return new SubPacket(OPCODE, playerActorID, targetActorID, data); return new SubPacket(OPCODE, playerActorID, tarGetActorID, data);
} }
} }
} }

View file

@ -2,7 +2,7 @@
{ {
class BattleAction class BattleAction
{ {
public uint targetId; public uint tarGetId;
public ushort amount; public ushort amount;
public ushort worldMasterTextId; public ushort worldMasterTextId;
public uint effectId; public uint effectId;

View file

@ -8,7 +8,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.battle
public const ushort OPCODE = 0x013C; public const ushort OPCODE = 0x013C;
public const uint PACKET_SIZE = 0x48; public const uint PACKET_SIZE = 0x48;
public static SubPacket BuildPacket(uint playerActorID, uint sourceActorId, uint targetActorId, uint animationId, ushort commandId) public static SubPacket BuildPacket(uint playerActorID, uint sourceActorId, uint tarGetActorId, uint animationId, ushort commandId)
{ {
byte[] data = new byte[PACKET_SIZE - 0x20]; byte[] data = new byte[PACKET_SIZE - 0x20];

View file

@ -8,7 +8,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.battle
public const ushort OPCODE = 0x0139; public const ushort OPCODE = 0x0139;
public const uint PACKET_SIZE = 0x58; public const uint PACKET_SIZE = 0x58;
public static SubPacket BuildPacket(uint playerActorID, uint sourceActorId, uint targetActorId, uint animationId, uint effectId, ushort worldMasterTextId, ushort commandId, ushort amount, byte param) public static SubPacket BuildPacket(uint playerActorID, uint sourceActorId, uint tarGetActorId, uint animationId, uint effectId, ushort worldMasterTextId, ushort commandId, ushort amount, byte param)
{ {
byte[] data = new byte[PACKET_SIZE - 0x20]; byte[] data = new byte[PACKET_SIZE - 0x20];
@ -26,7 +26,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.battle
binWriter.Write((UInt16)commandId); binWriter.Write((UInt16)commandId);
binWriter.Write((UInt16)810); //? binWriter.Write((UInt16)810); //?
binWriter.Write((UInt32)targetActorId); binWriter.Write((UInt32)tarGetActorId);
binWriter.Write((UInt16)amount); binWriter.Write((UInt16)amount);
binWriter.Write((UInt16)worldMasterTextId); binWriter.Write((UInt16)worldMasterTextId);

View file

@ -28,7 +28,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.battle
binWriter.Seek(0x20, SeekOrigin.Begin); binWriter.Seek(0x20, SeekOrigin.Begin);
foreach (BattleAction action in actionList) foreach (BattleAction action in actionList)
binWriter.Write((UInt32)action.targetId); binWriter.Write((UInt32)action.tarGetId);
binWriter.Seek(0x50, SeekOrigin.Begin); binWriter.Seek(0x50, SeekOrigin.Begin);
foreach (BattleAction action in actionList) foreach (BattleAction action in actionList)

View file

@ -28,7 +28,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.battle
binWriter.Seek(0x58, SeekOrigin.Begin); binWriter.Seek(0x58, SeekOrigin.Begin);
foreach (BattleAction action in actionList) foreach (BattleAction action in actionList)
binWriter.Write((UInt32)action.targetId); binWriter.Write((UInt32)action.tarGetId);
binWriter.Seek(0xA0, SeekOrigin.Begin); binWriter.Seek(0xA0, SeekOrigin.Begin);
foreach (BattleAction action in actionList) foreach (BattleAction action in actionList)

View file

@ -5,11 +5,11 @@
public const ushort OPCODE = 0x016D; public const ushort OPCODE = 0x016D;
public const uint PACKET_SIZE = 0x28; public const uint PACKET_SIZE = 0x28;
public static SubPacket BuildPacket(uint sourceActorId, uint targetActorId) public static SubPacket BuildPacket(uint sourceActorId, uint tarGetActorId)
{ {
byte[] data = new byte[8]; byte[] data = new byte[8];
data[0] = 2; data[0] = 2;
return new SubPacket(OPCODE, sourceActorId, targetActorId, data); return new SubPacket(OPCODE, sourceActorId, tarGetActorId, data);
} }
public static SubPacket BuildPacket(uint playerActorID) public static SubPacket BuildPacket(uint playerActorID)

View file

@ -5,9 +5,9 @@
public const ushort OPCODE = 0x016E; public const ushort OPCODE = 0x016E;
public const uint PACKET_SIZE = 0x28; public const uint PACKET_SIZE = 0x28;
public static SubPacket BuildPacket(uint sourceActorId, uint targetActorId) public static SubPacket BuildPacket(uint sourceActorId, uint tarGetActorId)
{ {
return new SubPacket(OPCODE, sourceActorId, targetActorId, new byte[8]); return new SubPacket(OPCODE, sourceActorId, tarGetActorId, new byte[8]);
} }
public static SubPacket BuildPacket(uint playerActorID) public static SubPacket BuildPacket(uint playerActorID)

View file

@ -13,7 +13,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.inventory
return BuildPacket(playerActorId, playerActorId, item); return BuildPacket(playerActorId, playerActorId, item);
} }
public static SubPacket BuildPacket(uint sourceActorId, uint targetActorId, InventoryItem item) public static SubPacket BuildPacket(uint sourceActorId, uint tarGetActorId, InventoryItem item)
{ {
byte[] data = new byte[PACKET_SIZE - 0x20]; byte[] data = new byte[PACKET_SIZE - 0x20];
@ -25,7 +25,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.inventory
} }
} }
return new SubPacket(OPCODE, sourceActorId, targetActorId, data); return new SubPacket(OPCODE, sourceActorId, tarGetActorId, data);
} }
} }

View file

@ -15,7 +15,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.inventory
return BuildPacket(playerActorId, playerActorId, items, ref listOffset); return BuildPacket(playerActorId, playerActorId, items, ref listOffset);
} }
public static SubPacket BuildPacket(uint sourceActorId, uint targetActorId, List<InventoryItem> items, ref int listOffset) public static SubPacket BuildPacket(uint sourceActorId, uint tarGetActorId, List<InventoryItem> items, ref int listOffset)
{ {
byte[] data = new byte[PACKET_SIZE - 0x20]; byte[] data = new byte[PACKET_SIZE - 0x20];
@ -40,7 +40,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.inventory
} }
} }
return new SubPacket(OPCODE, sourceActorId, targetActorId, data); return new SubPacket(OPCODE, sourceActorId, tarGetActorId, data);
} }
} }
} }

View file

@ -14,7 +14,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.inventory
return BuildPacket(playerActorId, playerActorId, items, ref listOffset); return BuildPacket(playerActorId, playerActorId, items, ref listOffset);
} }
public static SubPacket BuildPacket(uint sourceActorId, uint targetActorId, List<InventoryItem> items, ref int listOffset) public static SubPacket BuildPacket(uint sourceActorId, uint tarGetActorId, List<InventoryItem> items, ref int listOffset)
{ {
byte[] data = new byte[PACKET_SIZE - 0x20]; byte[] data = new byte[PACKET_SIZE - 0x20];
@ -36,7 +36,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.inventory
} }
} }
return new SubPacket(OPCODE, sourceActorId, targetActorId, data); return new SubPacket(OPCODE, sourceActorId, tarGetActorId, data);
} }
} }
} }

View file

@ -13,7 +13,7 @@ namespace FFXIVClassic_Map_Server.packets.send.Actor.inventory
return BuildPacket(playerActorId, playerActorId, size, code); return BuildPacket(playerActorId, playerActorId, size, code);
} }
public static SubPacket BuildPacket(uint sourceActorId, uint targetActorId, ushort size, ushort code) public static SubPacket BuildPacket(uint sourceActorId, uint tarGetActorId, ushort size, ushort code)
{ {
byte[] data = new byte[8]; byte[] data = new byte[8];
@ -27,7 +27,7 @@ namespace FFXIVClassic_Map_Server.packets.send.Actor.inventory
} }
} }
return new SubPacket(OPCODE, sourceActorId, targetActorId, data); return new SubPacket(OPCODE, sourceActorId, tarGetActorId, data);
} }
} }

View file

@ -11,9 +11,9 @@
return new SubPacket(OPCODE, playerActorId, playerActorId, new byte[8]); return new SubPacket(OPCODE, playerActorId, playerActorId, new byte[8]);
} }
public static SubPacket BuildPacket(uint sourceActorId, uint targetActorID) public static SubPacket BuildPacket(uint sourceActorId, uint tarGetActorID)
{ {
return new SubPacket(OPCODE, sourceActorId, targetActorID, new byte[8]); return new SubPacket(OPCODE, sourceActorId, tarGetActorID, new byte[8]);
} }
} }

View file

@ -56,7 +56,7 @@ namespace FFXIVClassic_Map_Server.packets.send
private const ushort SIZE_GAMEMESSAGE_WITHOUT_ACTOR4 = 0x48; private const ushort SIZE_GAMEMESSAGE_WITHOUT_ACTOR4 = 0x48;
private const ushort SIZE_GAMEMESSAGE_WITHOUT_ACTOR5 = 0x68; private const ushort SIZE_GAMEMESSAGE_WITHOUT_ACTOR5 = 0x68;
public static SubPacket BuildPacket(uint sourceId, uint targetId, uint actorId, uint textOwnerActorId, ushort textId, byte log) public static SubPacket BuildPacket(uint sourceId, uint tarGetId, uint actorId, uint textOwnerActorId, ushort textId, byte log)
{ {
byte[] data = new byte[SIZE_GAMEMESSAGE_WITH_ACTOR1 - 0x20]; byte[] data = new byte[SIZE_GAMEMESSAGE_WITH_ACTOR1 - 0x20];
@ -71,10 +71,10 @@ namespace FFXIVClassic_Map_Server.packets.send
} }
} }
return new SubPacket(OPCODE_GAMEMESSAGE_WITH_ACTOR1, sourceId, targetId, data); return new SubPacket(OPCODE_GAMEMESSAGE_WITH_ACTOR1, sourceId, tarGetId, data);
} }
public static SubPacket BuildPacket(uint sourceId, uint targetId, uint actorId, uint textOwnerActorId, ushort textId, byte log, List<LuaParam> lParams) public static SubPacket BuildPacket(uint sourceId, uint tarGetId, uint actorId, uint textOwnerActorId, ushort textId, byte log, List<LuaParam> lParams)
{ {
int lParamsSize = findSizeOfParams(lParams); int lParamsSize = findSizeOfParams(lParams);
byte[] data; byte[] data;
@ -119,10 +119,10 @@ namespace FFXIVClassic_Map_Server.packets.send
} }
} }
return new SubPacket(opcode, sourceId, targetId, data); return new SubPacket(opcode, sourceId, tarGetId, data);
} }
public static SubPacket BuildPacket(uint sourceId, uint targetId, uint textOwnerActorId, ushort textId, string sender, byte log) public static SubPacket BuildPacket(uint sourceId, uint tarGetId, uint textOwnerActorId, ushort textId, string sender, byte log)
{ {
byte[] data = new byte[SIZE_GAMEMESSAGE_WITH_CUSTOM_SENDER1 - 0x20]; byte[] data = new byte[SIZE_GAMEMESSAGE_WITH_CUSTOM_SENDER1 - 0x20];
@ -137,10 +137,10 @@ namespace FFXIVClassic_Map_Server.packets.send
} }
} }
return new SubPacket(OPCODE_GAMEMESSAGE_WITH_CUSTOM_SENDER1, sourceId, targetId, data); return new SubPacket(OPCODE_GAMEMESSAGE_WITH_CUSTOM_SENDER1, sourceId, tarGetId, data);
} }
public static SubPacket BuildPacket(uint sourceId, uint targetId, uint textOwnerActorId, ushort textId, string sender, byte log, List<LuaParam> lParams) public static SubPacket BuildPacket(uint sourceId, uint tarGetId, uint textOwnerActorId, ushort textId, string sender, byte log, List<LuaParam> lParams)
{ {
int lParamsSize = findSizeOfParams(lParams); int lParamsSize = findSizeOfParams(lParams);
byte[] data; byte[] data;
@ -185,10 +185,10 @@ namespace FFXIVClassic_Map_Server.packets.send
} }
} }
return new SubPacket(opcode, sourceId, targetId, data); return new SubPacket(opcode, sourceId, tarGetId, data);
} }
public static SubPacket BuildPacket(uint sourceId, uint targetId, uint textOwnerActorId, ushort textId, uint senderDisplayNameId, byte log) public static SubPacket BuildPacket(uint sourceId, uint tarGetId, uint textOwnerActorId, ushort textId, uint senderDisplayNameId, byte log)
{ {
byte[] data = new byte[SIZE_GAMEMESSAGE_WITH_DISPID_SENDER1 - 0x20]; byte[] data = new byte[SIZE_GAMEMESSAGE_WITH_DISPID_SENDER1 - 0x20];
@ -203,10 +203,10 @@ namespace FFXIVClassic_Map_Server.packets.send
} }
} }
return new SubPacket(OPCODE_GAMEMESSAGE_WITH_DISPID_SENDER1, sourceId, targetId, data); return new SubPacket(OPCODE_GAMEMESSAGE_WITH_DISPID_SENDER1, sourceId, tarGetId, data);
} }
public static SubPacket BuildPacket(uint sourceId, uint targetId, uint textOwnerActorId, ushort textId, uint senderDisplayNameId, byte log, List<LuaParam> lParams) public static SubPacket BuildPacket(uint sourceId, uint tarGetId, uint textOwnerActorId, ushort textId, uint senderDisplayNameId, byte log, List<LuaParam> lParams)
{ {
int lParamsSize = findSizeOfParams(lParams); int lParamsSize = findSizeOfParams(lParams);
byte[] data; byte[] data;
@ -251,10 +251,10 @@ namespace FFXIVClassic_Map_Server.packets.send
} }
} }
return new SubPacket(opcode, sourceId, targetId, data); return new SubPacket(opcode, sourceId, tarGetId, data);
} }
public static SubPacket BuildPacket(uint sourceId, uint targetId, uint textOwnerActorId, ushort textId, byte log) public static SubPacket BuildPacket(uint sourceId, uint tarGetId, uint textOwnerActorId, ushort textId, byte log)
{ {
byte[] data = new byte[SIZE_GAMEMESSAGE_WITHOUT_ACTOR1 - 0x20]; byte[] data = new byte[SIZE_GAMEMESSAGE_WITHOUT_ACTOR1 - 0x20];
@ -268,10 +268,10 @@ namespace FFXIVClassic_Map_Server.packets.send
} }
} }
return new SubPacket(OPCODE_GAMEMESSAGE_WITHOUT_ACTOR1, sourceId, targetId, data); return new SubPacket(OPCODE_GAMEMESSAGE_WITHOUT_ACTOR1, sourceId, tarGetId, data);
} }
public static SubPacket BuildPacket(uint sourceId, uint targetId, uint textOwnerActorId, ushort textId, byte log, List<LuaParam> lParams) public static SubPacket BuildPacket(uint sourceId, uint tarGetId, uint textOwnerActorId, ushort textId, byte log, List<LuaParam> lParams)
{ {
int lParamsSize = findSizeOfParams(lParams); int lParamsSize = findSizeOfParams(lParams);
byte[] data; byte[] data;
@ -315,7 +315,7 @@ namespace FFXIVClassic_Map_Server.packets.send
} }
} }
return new SubPacket(opcode, sourceId, targetId, data); return new SubPacket(opcode, sourceId, tarGetId, data);
} }
private static int findSizeOfParams(List<LuaParam> lParams) private static int findSizeOfParams(List<LuaParam> lParams)

View file

@ -34,7 +34,7 @@ namespace FFXIVClassic_Map_Server.packets.send
public const ushort OPCODE = 0x0003; public const ushort OPCODE = 0x0003;
public const uint PACKET_SIZE = 0x248; public const uint PACKET_SIZE = 0x248;
public static SubPacket BuildPacket(uint playerActorID, uint targetID, uint messageType, string sender, string message) public static SubPacket BuildPacket(uint playerActorID, uint tarGetID, uint messageType, string sender, string message)
{ {
byte[] data = new byte[PACKET_SIZE - 0x20]; byte[] data = new byte[PACKET_SIZE - 0x20];
@ -49,7 +49,7 @@ namespace FFXIVClassic_Map_Server.packets.send
} }
} }
return new SubPacket(OPCODE, playerActorID, targetID, data); return new SubPacket(OPCODE, playerActorID, tarGetID, data);
} }
} }

View file

@ -11,7 +11,7 @@ namespace FFXIVClassic_Map_Server.packets.send.events
public const ushort OPCODE = 0x012F; public const ushort OPCODE = 0x012F;
public const uint PACKET_SIZE = 0x90; public const uint PACKET_SIZE = 0x90;
public static SubPacket BuildPacket(uint playerActorId, uint targetActorId, string conditionName, List<LuaParam> luaParams) public static SubPacket BuildPacket(uint playerActorId, uint tarGetActorId, string conditionName, List<LuaParam> luaParams)
{ {
byte[] data = new byte[PACKET_SIZE - 0x20]; byte[] data = new byte[PACKET_SIZE - 0x20];
@ -20,7 +20,7 @@ namespace FFXIVClassic_Map_Server.packets.send.events
using (BinaryWriter binWriter = new BinaryWriter(mem)) using (BinaryWriter binWriter = new BinaryWriter(mem))
{ {
binWriter.Write((UInt32)playerActorId); binWriter.Write((UInt32)playerActorId);
binWriter.Write((UInt32)targetActorId); binWriter.Write((UInt32)tarGetActorId);
binWriter.Write((Byte)0x5); binWriter.Write((Byte)0x5);
binWriter.Write((Byte)0x87); binWriter.Write((Byte)0x87);
binWriter.Write((Byte)0xDC); binWriter.Write((Byte)0xDC);

View file

@ -158,11 +158,11 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
isMore = flag; isMore = flag;
} }
public void SetTarget(string target) public void SetTarget(string tarGet)
{ {
binWriter.Write((byte)(isMore ? 0x62 + target.Length : 0x82 + target.Length)); binWriter.Write((byte)(isMore ? 0x62 + tarGet.Length : 0x82 + tarGet.Length));
binWriter.Write(Encoding.ASCII.GetBytes(target)); binWriter.Write(Encoding.ASCII.GetBytes(tarGet));
runningByteTotal += (ushort)(1 + Encoding.ASCII.GetByteCount(target)); runningByteTotal += (ushort)(1 + Encoding.ASCII.GetByteCount(tarGet));
} }

View file

@ -9,7 +9,7 @@ namespace FFXIVClassic_Map_Server.packets.send.player
public const ushort OPCODE = 0x0133; public const ushort OPCODE = 0x0133;
public const uint PACKET_SIZE = 0xE0; public const uint PACKET_SIZE = 0xE0;
public static SubPacket BuildPacket(uint playerActorID, uint targetActorID, List<LuaParam> luaParams) public static SubPacket BuildPacket(uint playerActorID, uint tarGetActorID, List<LuaParam> luaParams)
{ {
byte[] data = new byte[PACKET_SIZE - 0x20]; byte[] data = new byte[PACKET_SIZE - 0x20];
@ -21,7 +21,7 @@ namespace FFXIVClassic_Map_Server.packets.send.player
} }
} }
return new SubPacket(OPCODE, playerActorID, targetActorID, data); return new SubPacket(OPCODE, playerActorID, tarGetActorID, data);
} }
} }
} }

View file

@ -7,11 +7,11 @@ namespace FFXIVClassic_Map_Server.packets.send.player
public const ushort OPCODE = 0x0198; public const ushort OPCODE = 0x0198;
public const uint PACKET_SIZE = 0x40; public const uint PACKET_SIZE = 0x40;
public static SubPacket BuildPacket(uint playerActorID, uint targetActorID, string name) public static SubPacket BuildPacket(uint playerActorID, uint tarGetActorID, string name)
{ {
if (Encoding.Unicode.GetByteCount(name) >= 0x20) if (Encoding.Unicode.GetByteCount(name) >= 0x20)
name = "ERR: Too Long"; name = "ERR: Too Long";
return new SubPacket(OPCODE, playerActorID, targetActorID, Encoding.ASCII.GetBytes(name)); return new SubPacket(OPCODE, playerActorID, tarGetActorID, Encoding.ASCII.GetBytes(name));
} }
} }
} }

View file

@ -7,9 +7,9 @@ namespace FFXIVClassic_Map_Server.packets.send.player
public const ushort OPCODE = 0x01A4; public const ushort OPCODE = 0x01A4;
public const uint PACKET_SIZE = 0x28; public const uint PACKET_SIZE = 0x28;
public static SubPacket BuildPacket(uint sourceActorID, uint targetActorID, uint jobId) public static SubPacket BuildPacket(uint sourceActorID, uint tarGetActorID, uint jobId)
{ {
return new SubPacket(OPCODE, sourceActorID, targetActorID, BitConverter.GetBytes((uint)jobId)); return new SubPacket(OPCODE, sourceActorID, tarGetActorID, BitConverter.GetBytes((uint)jobId));
} }
} }
} }

View file

@ -8,7 +8,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
public const ushort OPCODE = 0x0194; public const ushort OPCODE = 0x0194;
public const uint PACKET_SIZE = 0x28; public const uint PACKET_SIZE = 0x28;
public static SubPacket BuildPacket(uint sourceActorID, uint targetActorID, ushort currentAllegiance, ushort rankLimsa, ushort rankGridania, ushort rankUldah) public static SubPacket BuildPacket(uint sourceActorID, uint tarGetActorID, ushort currentAllegiance, ushort rankLimsa, ushort rankGridania, ushort rankUldah)
{ {
byte[] data = new byte[PACKET_SIZE - 0x20]; byte[] data = new byte[PACKET_SIZE - 0x20];
@ -23,7 +23,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
} }
} }
return new SubPacket(OPCODE, sourceActorID, targetActorID, data); return new SubPacket(OPCODE, sourceActorID, tarGetActorID, data);
} }
} }

View file

@ -7,9 +7,9 @@ namespace FFXIVClassic_Map_Server.packets.send.player
public const ushort OPCODE = 0x019D; public const ushort OPCODE = 0x019D;
public const uint PACKET_SIZE = 0x28; public const uint PACKET_SIZE = 0x28;
public static SubPacket BuildPacket(uint playerActorID, uint targetActorID, uint titleID) public static SubPacket BuildPacket(uint playerActorID, uint tarGetActorID, uint titleID)
{ {
return new SubPacket(OPCODE, playerActorID, targetActorID, BitConverter.GetBytes((UInt64)titleID)); return new SubPacket(OPCODE, playerActorID, tarGetActorID, BitConverter.GetBytes((UInt64)titleID));
} }
} }
} }

View file

@ -8,7 +8,7 @@ namespace FFXIVClassic_Map_Server.packets.send.player
public const ushort OPCODE = 0x0196; public const ushort OPCODE = 0x0196;
public const uint PACKET_SIZE = 0x38; public const uint PACKET_SIZE = 0x38;
public static SubPacket BuildPacket(uint playerActorID, uint targetActorID) public static SubPacket BuildPacket(uint playerActorID, uint tarGetActorID)
{ {
byte[] data = new byte[PACKET_SIZE - 0x20]; byte[] data = new byte[PACKET_SIZE - 0x20];
@ -21,7 +21,7 @@ namespace FFXIVClassic_Map_Server.packets.send.player
} }
} }
return new SubPacket(OPCODE, playerActorID, targetActorID, data); return new SubPacket(OPCODE, playerActorID, tarGetActorID, data);
} }
} }
} }

View file

@ -32,11 +32,11 @@ namespace FFXIVClassic_Map_Server.utils
} }
} }
public void NewTarget(string target) public void NewTarget(string tarGet)
{ {
currentActorPropertyPacket.AddTarget(); currentActorPropertyPacket.AddTarget();
currentTarget = target; currentTarget = tarGet;
currentActorPropertyPacket.SetTarget(target); currentActorPropertyPacket.SetTarget(tarGet);
} }
public List<SubPacket> Done() public List<SubPacket> Done()

View file

@ -0,0 +1,3 @@
function init(npc)
return false, false, 0, 0, 0, 0;
end

View file

@ -1,5 +1,6 @@
function init(npc) function init(npc)
return "/Chara/Npc/Object/ObjectBed", false, false, false, false, false, 0x1250FB, false, false, 0, 1, "TEST"; return false, false, 0, 0;
end end
function onEventStarted(player, npc, triggerName) function onEventStarted(player, npc, triggerName)

View file

@ -0,0 +1,19 @@
function init(npc)
return false, false, 0, 0;
end
function onEventStarted(player, npc, triggerName)
defaultFst = getStaticActor("DftFst");
player:runEventFunction("delegateEvent", player, defaultFst, "defaultTalkWithInn_ExitDoor", nil, nil, nil);
end
function onEventUpdate(player, npc, resultId, isExitYes)
if (isExitYes ~= nil and isExitYes == 1) then
getWorldManager():DoZoneChange(player, 1);
else
player:endEvent();
end
end

View file

@ -1,8 +1,9 @@
function init(npc) function init(npc)
return "/Chara/Npc/Object/ObjectInnDoor", false, false, false, false, false, 0x1250F8, false, false, 0, 1, "TEST"; return false, false, 0, 0;
end end
function onEventStarted(player, npc, triggerName) function onEventStarted(player, npc, triggerName)
player:endEvent();
end end
function onEventUpdate(player, npc) function onEventUpdate(player, npc)

View file

@ -0,0 +1,13 @@
function init(npc)
return false, false, 0, 0;
end
function onEventStarted(player, npc, triggerName)
if (triggerName == "caution") then
worldMaster = getWorldMaster();
player:sendGameMessage(player, worldMaster, 34109, 0x20);
elseif (triggerName == "exit") then
getWorldManager():DoPlayerMoveInZone(player, 5);
end
player:endEvent();
end

View file

@ -0,0 +1,20 @@
function init(npc)
return false, false, 0, 0;
end
function onEventStarted(player, npc, triggerName)
questNOC = getStaticActor("Noc000");
if (npc:getActorClassId() == 1200193) then
player:runEventFunction("delegateEvent", player, questNOC, "pETaskBoardAskLimsa", nil, nil, nil);
elseif (npc:getActorClassId() == 1200194) then
player:runEventFunction("delegateEvent", player, questNOC, "pETaskBoardAskUldah", nil, nil, nil);
else
player:runEventFunction("delegateEvent", player, questNOC, "pETaskBoardAskGridania", nil, nil, nil);
end
end
function onEventUpdate(player, npc, step, menuOptionSelected)
player:endEvent();
end

View file

@ -21,7 +21,7 @@ Menu Ids:
--]] --]]
function init(npc) function init(npc)
return "/Chara/Npc/Object/Aetheryte/AetheryteParent", false, false, false, false, false, npc.getActorClassId(), false, false, 0, 1, "TEST"; return false, false, 0, 0;
end end
function onEventStarted(player, npc, triggerName) function onEventStarted(player, npc, triggerName)

View file

@ -0,0 +1,9 @@
function init(npc)
return false, false, 0, 0;
end
function onEventStarted(player, npc, triggerName)
end
function onEventUpdate(player, npc)
end

View file

@ -21,7 +21,7 @@ Menu Ids:
--]] --]]
function init(npc) function init(npc)
return "/Chara/Npc/Populace/PopulaceGuildlevePublisher", false, false, false, false, false, npc.getActorClassId(), false, false, 0, 1, "TEST"; return false, false, 0, 0;
end end
function onEventStarted(player, npc) function onEventStarted(player, npc)

View file

@ -1,5 +1,5 @@
function init(npc) function init(npc)
return "/Chara/Npc/Populace/PopulaceLinkshellManager", false, false, false, false, false, npc.getActorClassId(), false, false, 0, 1, "TEST"; return false, false, 0, 0;
end end
function onEventStarted(player, npc) function onEventStarted(player, npc)

View file

@ -24,7 +24,7 @@ Menu Ids:
--]] --]]
function init(npc) function init(npc)
return "/Chara/Npc/Populace/PopulacePassiveGLPublisher", false, false, false, false, false, npc.getActorClassId(), false, false, 0, 1, "TEST"; return false, false, 0, 0;
end end
function onEventStarted(player, npc) function onEventStarted(player, npc)

View file

@ -0,0 +1,13 @@
function init(npc)
return false, false, 0, 0;
end
function onEventStarted(player, npc)
player:sendMessage(0x20, "", "This PopulaceStandard actor has no event set. Actor Class Id: " .. tostring(npc:getActorClassId()));
player:endEvent();
end
function onEventUpdate(player, npc, blah, menuSelect)
player:endEvent();
end

View file

@ -0,0 +1,15 @@
function init(npc)
return false, false, 0, 0;
end
function onEventStarted(player, npc)
player:sendMessage(0x20, "", "This PopulaceShopSalesman actor has no event set. Actor Class Id: " .. tostring(npc:getActorClassId()))
player:endEvent();
--player:runEventFunction("welcomeTalk");
end
function onEventUpdate(player, npc, step, menuOptionSelected, lsName, lsCrest)
player:endEvent();
end

View file

@ -0,0 +1,19 @@
--[[
PartyInviteCommand Script
Handles what happens when you invite
--]]
function onEventStarted(player, actor, triggerName, name, arg1, arg2, arg3, actorId)
if (name ~= nil) then
getWorldManager():CreateInvitePartyGroup(player, name);
elseif (actorId ~= nil) then
getWorldManager():CreateInvitePartyGroup(player, actorId);
end
player:endCommand();
end

View file

@ -3,12 +3,12 @@ function onEventStarted(player, actor, triggerName)
man0u0Quest = getStaticActor("Man0u0"); man0u0Quest = getStaticActor("Man0u0");
man0l0Quest = getStaticActor("Man0l0"); man0l0Quest = getStaticActor("Man0l0");
--player:runEventFunction("delegateEvent", player, man0l0Quest, "processTtrBtl001"); player:runEventFunction("delegateEvent", player, man0l0Quest, "processTtrBtl001");
--player:runEventFunction("delegateEvent", player, man0l0Quest, "processTtrBtlMagic001"); --player:runEventFunction("delegateEvent", player, man0l0Quest, "processTtrBtlMagic001");
--player:runEventFunction("delegateEvent", player, man0l0Quest, "processTtrBtl002"); --player:runEventFunction("delegateEvent", player, man0l0Quest, "processTtrBtl002");
--player:runEventFunction("delegateEvent", player, man0l0Quest, "processTtrBtl003"); --player:runEventFunction("delegateEvent", player, man0l0Quest, "processTtrBtl003");
player:runEventFunction("delegateEvent", player, man0u0Quest, "processTtrBtl004"); --player:runEventFunction("delegateEvent", player, man0u0Quest, "processTtrBtl004");
end end

View file

@ -18,11 +18,11 @@ function onBeginLogin(player)
--For Opening. Set Director and reset position incase d/c --For Opening. Set Director and reset position incase d/c
if (player:hasQuest(110001) == true) then if (player:hasQuest(110001) == true) then
player:setDirector("openingDirector", false); --player:setDirector("openingDirector", false);
player.positionX = 0.016; player.positionX = 0.016;
player.positionY = 10.35; player.positionY = 10.35;
player.positionZ = -36.91; --player.positionZ = -36.91;
--player.positionZ = -20.91; player.positionZ = -20.91;
player.rotation = 0.025; player.rotation = 0.025;
player:getQuest(110001):ClearQuestData(); player:getQuest(110001):ClearQuestData();
player:getQuest(110001):ClearQuestFlags(); player:getQuest(110001):ClearQuestFlags();

View file

@ -0,0 +1,15 @@
function onEventStarted(player, npc)
defaultFst = getStaticActor("DftFst");
player:runEventFunction("delegateEvent", player, defaultFst, "defaultTalkWithInn_Desk", nil, nil, nil);
end
function onEventUpdate(player, npc, blah, menuSelect)
if (menuSelect == 1) then
getWorldManager():DoZoneChange(player, 13);
end
player:endEvent();
end

View file

@ -0,0 +1,3 @@
function init(npc)
return false, false, 0, 0, 0x141, 0xB84;
end

View file

@ -0,0 +1,3 @@
function init(npc)
return false, false, 0, 0, 0x141, 0xB83;
end

View file

@ -0,0 +1,3 @@
function init(npc)
return false, false, 0, 0, 0x141, 0xB81;
end

View file

@ -0,0 +1,3 @@
function init(npc)
return false, false, 0, 0, 0x141, 0xB7D;
end

Some files were not shown because too many files have changed in this diff Show more