1
Fork 0
mirror of https://bitbucket.org/Ioncannon/project-meteor-server.git synced 2025-04-23 13:17: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 ***
bool OriginalFileExists = File.Exists(m_FileName);
// *** Get temporary file name ***
// *** get temporary file name ***
string TmpFileName = Path.ChangeExtension(m_FileName, "$n$");
// *** Copy content of original file to temporary file, replace modified values ***

View file

@ -218,6 +218,16 @@ namespace FFXIVClassic.Common
}
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"?>
<packages>
<package id="NLog" version="4.3.5" targetFramework="net45" />
<package id="NLog" version="4.3.5" tarGetFramework="net45" />
</packages>

View file

@ -16,22 +16,22 @@
See https://github.com/nlog/nlog/wiki/Configuration-file
for information on customizing logging rules and outputs.
-->
<targets async="true">
<tarGets async="true">
<!--
add your targets here
See https://github.com/nlog/NLog/wiki/Targets for possible targets.
add your tarGets here
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.
-->
<!--
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}" />
-->
<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}" />
</targets>
<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}" />
</tarGets>
<rules>
<!-- 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)
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)
{
Character chara = Database.GetCharacter(client.currentUserId, charaReq.characterId);

View file

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

View file

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

View file

@ -10,7 +10,7 @@ namespace FFXIVClassic_Lobby_Server.packets
public ushort subpacketSize;
public ushort type;
public uint sourceId;
public uint targetId;
public uint tarGetId;
public uint unknown1;
}
@ -68,14 +68,14 @@ namespace FFXIVClassic_Lobby_Server.packets
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.gameMessage = new GameMessageHeader();
gameMessage.opcode = opcode;
header.sourceId = sourceId;
header.targetId = targetId;
header.tarGetId = tarGetId;
gameMessage.timestamp = Utils.UnixTimeStampUTC();
@ -90,14 +90,14 @@ namespace FFXIVClassic_Lobby_Server.packets
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.gameMessage = original.gameMessage;
header.subpacketSize = original.header.subpacketSize;
header.type = original.header.type;
header.sourceId = original.header.sourceId;
header.targetId = newTargetId;
header.tarGetId = newTarGetId;
data = original.data;
}

File diff suppressed because it is too large Load diff

View file

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

View file

@ -71,7 +71,9 @@
</ItemGroup>
<ItemGroup>
<Compile Include="actors\area\PrivateArea.cs" />
<Compile Include="actors\area\SpawnLocation.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\AetheryteWork.cs" />
<Compile Include="actors\chara\player\Equipment.cs" />

View file

@ -16,22 +16,22 @@
See https://github.com/nlog/nlog/wiki/Configuration-file
for information on customizing logging rules and outputs.
-->
<targets async="true">
<tarGets async="true">
<!--
add your targets here
See https://github.com/nlog/NLog/wiki/Targets for possible targets.
add your tarGets here
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.
-->
<!--
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}" />
-->
<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}"/>
</targets>
<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}"/>
</tarGets>
<rules>
<!-- 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));
break;
case 0x01CA:
AddRemoveSocialPacket removeBlackList = new AddRemoveSocialPacket(subpacket.data);
client.QueuePacket(BasePacket.CreatePacket(BlacklistRemovedPacket.BuildPacket(player.actorID, true, removeBlackList.name), true, false));
AddRemoveSocialPacket RemoveBlackList = new AddRemoveSocialPacket(subpacket.data);
client.QueuePacket(BasePacket.CreatePacket(BlacklistRemovedPacket.BuildPacket(player.actorID, true, RemoveBlackList.name), true, false));
break;
case 0x01CB:
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));
break;
case 0x01CD:
AddRemoveSocialPacket removeFriendList = new AddRemoveSocialPacket(subpacket.data);
client.QueuePacket(BasePacket.CreatePacket(FriendlistRemovedPacket.BuildPacket(player.actorID, true, removeFriendList.name), true, false));
AddRemoveSocialPacket RemoveFriendList = new AddRemoveSocialPacket(subpacket.data);
client.QueuePacket(BasePacket.CreatePacket(FriendlistRemovedPacket.BuildPacket(player.actorID, true, RemoveFriendList.name), true, false));
break;
case 0x01CE:
int offset2 = 0;

View file

@ -17,7 +17,7 @@ namespace FFXIVClassic_Map_Server.Properties {
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// 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.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@ -105,7 +105,7 @@ namespace FFXIVClassic_Map_Server.Properties {
///
///Available commands:
///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.
/// </summary>
public static string CPhelp {
@ -176,38 +176,38 @@ namespace FFXIVClassic_Map_Server.Properties {
/// <summary>
/// Looks up a localized string similar to Removes the specified currency from the current player&apos;s inventory
///
///*Syntax: removecurrency &lt;quantity&gt;
/// removecurrency &lt;type&gt; &lt;quantity&gt;
///*Syntax: Removecurrency &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.
/// </summary>
public static string CPremovecurrency {
public static string CPRemovecurrency {
get {
return ResourceManager.GetString("CPremovecurrency", resourceCulture);
return ResourceManager.GetString("CPRemovecurrency", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Removes the specified items to the current player&apos;s inventory
///
///*Syntax: removeitem &lt;itemid&gt;
/// removeitem &lt;itemid&gt; &lt;quantity&gt;
///*Syntax: Removeitem &lt;itemid&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.
/// </summary>
public static string CPremoveitem {
public static string CPRemoveitem {
get {
return ResourceManager.GetString("CPremoveitem", resourceCulture);
return ResourceManager.GetString("CPRemoveitem", resourceCulture);
}
}
/// <summary>
/// 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.
/// </summary>
public static string CPremovekeyitem {
public static string CPRemovekeyitem {
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.LoadZoneList();
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));
@ -294,7 +296,7 @@ namespace FFXIVClassic_Map_Server
{
BasePacket newPacket = null;
//Too small to even get length
//Too small to even Get length
if (bytesRead <= offset)
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.chara.npc;
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.packets.send;
using FFXIVClassic_Map_Server.packets.send.actor;
using FFXIVClassic_Map_Server.packets.send.login;
using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server
{
@ -16,6 +25,7 @@ namespace FFXIVClassic_Map_Server
private WorldMaster worldMaster = new WorldMaster();
private Dictionary<uint, Zone> zoneList;
private Dictionary<uint, ZoneEntrance> zoneEntranceList;
private Dictionary<uint, ActorClass> actorClasses = new Dictionary<uint,ActorClass>();
private Server mServer;
@ -66,10 +76,7 @@ namespace FFXIVClassic_Map_Server
}
}
catch (MySqlException e)
{
Program.Log.Error(e.ToString());
}
{ Console.WriteLine(e); }
finally
{
conn.Dispose();
@ -105,7 +112,7 @@ namespace FFXIVClassic_Map_Server
if (zoneList.ContainsKey(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);
}
else
@ -116,16 +123,14 @@ namespace FFXIVClassic_Map_Server
}
}
catch (MySqlException e)
{
Program.Log.Error(e.ToString());
}
{ Console.WriteLine(e); }
finally
{
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()
@ -169,19 +174,17 @@ namespace FFXIVClassic_Map_Server
}
}
catch (MySqlException e)
{
Program.Log.Error(e.ToString());
}
{ Console.WriteLine(e); }
finally
{
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;
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 = @"
SELECT
id,
name,
zoneId,
positionX,
positionY,
positionZ,
rotation,
actorState,
animationId,
classPath,
displayNameId,
customDisplayName,
actorClassName,
eventConditions
FROM gamedata_actor_class
WHERE name is not NULL AND zoneId > 0
WHERE classPath <> ''
";
MySqlCommand cmd = new MySqlCommand(query, conn);
@ -215,45 +209,35 @@ namespace FFXIVClassic_Map_Server
{
while (reader.Read())
{
string customName = null;
if (!reader.IsDBNull(10))
customName = reader.GetString(10);
uint id = reader.GetUInt32("id");
string classPath = reader.GetString("classPath");
uint nameId = reader.GetUInt32("displayNameId");
string eventConditions = null;
if (!reader.IsDBNull(3))
eventConditions = reader.GetString("eventConditions");
else
eventConditions = "{}";
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(12))
{
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);
ActorClass actorClass = new ActorClass(id, classPath, nameId, eventConditions);
actorClasses.Add(id, actorClass);
count++;
}
}
}
catch (MySqlException e)
{
Program.Log.Error(e.ToString());
}
{ Console.WriteLine(e); }
finally
{
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;
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 = @"
SELECT
id,
name,
zoneId,
actorClassId,
uniqueId,
zoneId,
privateAreaName,
privateAreaLevel,
positionX,
positionY,
positionZ,
rotation,
actorState,
animationId,
displayNameId,
customDisplayName,
actorClassName,
eventConditions
FROM gamedata_actor_class
WHERE name is not NULL AND zoneId = @zoneId
customDisplayName
FROM server_spawn_locations
";
MySqlCommand cmd = new MySqlCommand(query, conn);
cmd.Parameters.AddWithValue("@zoneId", zoneId);
using (MySqlDataReader reader = cmd.ExecuteReader())
{
while (reader.Read())
{
string customName = null;
if (!reader.IsDBNull(10))
customName = reader.GetString(10);
if (!reader.IsDBNull(11))
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))
{
string eventConditions = reader.GetString(12);
npc.LoadEventConditions(eventConditions);
}
if (!zoneList.ContainsKey(npc.zoneId))
if (!actorClasses.ContainsKey(classId))
continue;
Zone zone = zoneList[npc.zoneId];
if (!zoneList.ContainsKey(zoneId))
continue;
Zone zone = zoneList[zoneId];
if (zone == null)
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)
{
Program.Log.Error(e.ToString());
}
{ Console.WriteLine(e); }
finally
{
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)
{
Area oldZone;
@ -340,7 +335,7 @@ namespace FFXIVClassic_Map_Server
//Add player to new zone and update
Zone newZone = GetZone(destinationZoneId);
//This server Does not contain that zoneId
//This server does not contain that zoneId
if (newZone == null)
return;
@ -381,7 +376,7 @@ namespace FFXIVClassic_Map_Server
newArea = GetZone(destinationZoneId);
else
newArea = GetZone(destinationZoneId).GetPrivateArea(destinationPrivateArea, 0);
//This server Does not contain that zoneId
//This server does not contain that zoneId
if (newArea == null)
return;
@ -451,11 +446,11 @@ namespace FFXIVClassic_Map_Server
//Add player to new zone and update
Zone zone = GetZone(player.zoneId);
//This server Does not contain that zoneId
//This server does not contain that zoneId
if (zone == null)
return;
//Set the current zone and Add player
//Set the current zone and add player
player.zone = zone;
LuaEngine.OnBeginLogin(player);
@ -469,14 +464,14 @@ namespace FFXIVClassic_Map_Server
LuaEngine.OnZoneIn(player);
}
public void ReloadZone(uint zoneId)
public void reloadZone(uint zoneId)
{
if (!zoneList.ContainsKey(zoneId))
return;
Zone zone = zoneList[zoneId];
//zone.Clear();
LoadNPCs(zone.actorId);
//zone.clear();
//LoadNPCs(zone.actorId);
}
@ -559,6 +554,15 @@ namespace FFXIVClassic_Map_Server
else
return null;
}
public ActorClass GetActorClass(uint id)
{
if (actorClasses.ContainsKey(id))
return actorClasses[id];
else
return null;
}
}
}

View file

@ -3,13 +3,15 @@ using FFXIVClassic_Map_Server.actors;
using FFXIVClassic_Map_Server.lua;
using FFXIVClassic_Map_Server.packets.send.actor;
using FFXIVClassic_Map_Server.packets.send.actor.events;
using FFXIVClassic.Common;
using System;
using System.Collections.Generic;
using FFXIVClassic_Map_Server.actors.area;
namespace FFXIVClassic_Map_Server.Actors
{
class Actor
{
{
public uint actorId;
public string actorName;
@ -29,6 +31,7 @@ namespace FFXIVClassic_Map_Server.Actors
public bool spawnedFirstTime = false;
public string classPath;
public string className;
public List<LuaParam> classParams;
@ -298,6 +301,53 @@ namespace FFXIVClassic_Map_Server.Actors
SubPacket ChangeSpeedPacket = SetActorSpeedPacket.BuildPacket(actorId, actorId, moveSpeeds[0], moveSpeeds[1], moveSpeeds[2]);
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.packets.send.actor;
using MoonSharp.Interpreter;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.Actors
{
@ -15,15 +24,16 @@ namespace FFXIVClassic_Map_Server.Actors
public ushort weatherNormal, weatherCommon, weatherRare;
public ushort bgmDay, bgmNight, bgmBattle;
private string classPath;
protected string classPath;
public int boundingGridSize = 50;
public int minX = -1000, minY = -1000, maxX = 1000, maxY = 1000;
private int numXBlocks, numYBlocks;
private int halfWidth, halfHeight;
protected int numXBlocks, numYBlocks;
protected int halfWidth, halfHeight;
private Dictionary<uint, Actor> mActorList = new Dictionary<uint,Actor>();
private List<Actor>[,] mActorBlock;
protected List<SpawnLocation> mSpawnLocations = new List<SpawnLocation>();
protected Dictionary<uint, Actor> mActorList = new Dictionary<uint, Actor>();
protected List<Actor>[,] mActorBlock;
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.lua;
using FFXIVClassic_Map_Server.packets.send.actor;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.actors.area
{
@ -10,12 +14,14 @@ namespace FFXIVClassic_Map_Server.actors.area
{
private Zone parentZone;
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)
{
this.parentZone = parent;
this.privateAreaName = privateAreaName;
this.privateAreaLevel = privateAreaLevel;
}
public string GetPrivateAreaName()
@ -23,6 +29,11 @@ namespace FFXIVClassic_Map_Server.actors.area
return privateAreaName;
}
public uint GetPrivateAreaLevel()
{
return privateAreaLevel;
}
public Zone GetParentZone()
{
return parentZone;
@ -41,6 +52,17 @@ namespace FFXIVClassic_Map_Server.actors.area
ActorInstantiatePacket.BuildPacket(actorId, playerActorId, actorName, className, lParams).DebugPrintSubPacket();
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,13 +1,20 @@
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.lua;
using FFXIVClassic_Map_Server.packets.send.actor;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.actors.area
{
class Zone : Area
{
{
Dictionary<string, Dictionary<uint, PrivateArea>> privateAreas = new Dictionary<string, Dictionary<uint, PrivateArea>>();
public Zone(uint id, string zoneName, ushort regionId, string className, ushort bgmDay, ushort bgmNight, ushort bgmBattle, bool isIsolated, bool isInn, bool canRideChocobo, bool canStealth, bool isInstanceRaid)
@ -50,5 +57,40 @@ namespace FFXIVClassic_Map_Server.actors.area
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 int targetInformation = 0;
public int tarGetInformation = 0;
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_Map_Server.packets;
using FFXIVClassic_Map_Server.actors;
using FFXIVClassic_Map_Server.Actors.Chara;
using FFXIVClassic_Map_Server.dataobjects;
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.utils;
using MoonSharp.Interpreter;
using MySql.Data.MySqlClient;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.Actors
{
class Npc : Character
{
private uint actorClassId;
private string uniqueIdentifier;
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)
: base(id)
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((4 << 28 | zoneId << 19 | (uint)actorNumber))
{
this.actorName = actorName;
this.actorClassId = id;
this.positionX = posX;
this.positionY = posY;
this.positionZ = posZ;
this.rotation = rot;
this.animationId = animationId;
this.className = className;
this.displayNameId = displayNameId;
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;
@ -56,6 +69,11 @@ namespace FFXIVClassic_Map_Server.Actors
charaWork.property[3] = 1;
charaWork.property[4] = 1;
npcWork.pushCommand = 0x271D;
npcWork.pushCommandPriority = 1;
generateActorName((int)actorNumber);
}
public SubPacket CreateAddActorPacket(uint playerActorId)
@ -63,19 +81,34 @@ namespace FFXIVClassic_Map_Server.Actors
return AddActorPacket.BuildPacket(actorId, playerActorId, 8);
}
// actorClassId, [], [], numBattleCommon, [battleCommon], numEventCommon, [eventCommon], args for either initForBattle/initForEvent
public override SubPacket CreateScriptBindPacket(uint playerActorId)
{
List<LuaParam> lParams;
Player player = Server.GetWorldManager().GetPCInWorld(playerActorId);
lParams = LuaEngine.DoActorInstantiate(player, this);
lParams = DoActorInit(player);
if (lParams == null)
{
className = "PopulaceStandard";
lParams = LuaUtils.CreateLuaParamList("/Chara/Npc/Populace/PopulaceStandard", false, false, false, false, false, 0xF47F6, false, false, 0, 1, "TEST");
string classPathFake = "/Chara/Npc/Populace/PopulaceStandard";
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);
}
@ -142,6 +175,8 @@ namespace FFXIVClassic_Map_Server.Actors
}
propPacketUtil.AddProperty("npcWork.hateType");
propPacketUtil.AddProperty("npcWork.pushCommand");
propPacketUtil.AddProperty("npcWork.pushCommandPriority");
return BasePacket.CreatePacket(propPacketUtil.Done(), true, false);
}
@ -151,7 +186,7 @@ namespace FFXIVClassic_Map_Server.Actors
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)))
{
@ -166,7 +201,7 @@ namespace FFXIVClassic_Map_Server.Actors
hairStyle,
hairHighlightColor,
hairVariation,
faceType,
faceType,
characteristics,
characteristicsColor,
faceEyebrows,
@ -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.VOICE] = reader.GetUInt32(17);
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.BODYGEAR] = reader.GetUInt32(27);
appearanceIds[Character.LEGSGEAR] = reader.GetUInt32(28);
appearanceIds[Character.HANDSGEAR] = reader.GetUInt32(29);
appearanceIds[Character.FEETGEAR] = reader.GetUInt32(30);
appearanceIds[Character.WAISTGEAR] = reader.GetUInt32(31);
appearanceIds[Character.R_EAR] = reader.GetUInt32(32);
appearanceIds[Character.L_EAR] = reader.GetUInt32(33);
appearanceIds[Character.R_RINGFINGER] = reader.GetUInt32(36);
appearanceIds[Character.L_RINGFINGER] = reader.GetUInt32(37);
appearanceIds[Character.NECKGEAR] = reader.GetUInt32(32);
appearanceIds[Character.R_EAR] = reader.GetUInt32(33);
appearanceIds[Character.L_EAR] = reader.GetUInt32(34);
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)
{
Program.Log.Error(e.ToString());
}
{ Console.WriteLine(e); }
finally
{
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);
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, 0x6, "commandJudgeMode"));
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"));
return packets;
}
@ -386,7 +386,7 @@ namespace FFXIVClassic_Map_Server.Actors
for (int i = 0; i < charaWork.additionalCommandAcquired.Length; i++)
{
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++)

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.Actors;
using FFXIVClassic_Map_Server.lua;
using FFXIVClassic_Map_Server.packets.send.actor;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.dataobjects
{
@ -111,7 +116,7 @@ namespace FFXIVClassic_Map_Server.dataobjects
public void UpdateInstance(List<Actor> list)
{
List<BasePacket> basePackets = new List<BasePacket>();
List<SubPacket> removeActorSubpackets = new List<SubPacket>();
List<SubPacket> RemoveActorSubpackets = new List<SubPacket>();
List<SubPacket> posUpdateSubpackets = new List<SubPacket>();
//Remove missing actors
@ -145,7 +150,7 @@ namespace FFXIVClassic_Map_Server.dataobjects
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;
}
public static List<LuaParam> DoActorInstantiate(Player player, Actor target)
public static List<LuaParam> DoActorInstantiate(Player player, Actor tarGet)
{
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))
{
Script script = loadScript(luaPath);
Script script = LoadScript(luaPath);
if (script == 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);
return lparams;
}
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;
}
}
@ -56,24 +56,30 @@ namespace FFXIVClassic_Map_Server.lua
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;
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
luaPath = String.Format(FILEPATH_NPCS, target.zoneId, target.GetName());
luaPath = String.Format(FILEPATH_NPCS, tarGet.zoneId, tarGet.GetName());
if (File.Exists(luaPath))
{
Script script = loadScript(luaPath);
Script script = LoadScript(luaPath);
if (script == null)
return;
@ -81,7 +87,7 @@ namespace FFXIVClassic_Map_Server.lua
//Have to Do this to combine LuaParams
List<Object> objects = new List<Object>();
objects.Add(player);
objects.Add(target);
objects.Add(tarGet);
objects.Add(eventStart.triggerName);
if (eventStart.luaParams != null)
@ -93,47 +99,53 @@ namespace FFXIVClassic_Map_Server.lua
}
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))
{
Script script = loadScript(luaPath);
Script script = LoadScript(luaPath);
if (script == null)
return;
//Run Script
if (!script.Globals.Get("onSpawn").IsNil())
script.Call(script.Globals["onSpawn"], player, target);
script.Call(script.Globals["onSpawn"], player, tarGet);
}
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;
if (target is Command)
luaPath = String.Format(FILEPATH_COMMANDS, target.GetName());
else if (target is Director)
luaPath = String.Format(FILEPATH_DIRECTORS, target.GetName());
if (tarGet is Command)
luaPath = String.Format(FILEPATH_COMMANDS, tarGet.GetName());
else if (tarGet is Director)
luaPath = String.Format(FILEPATH_DIRECTORS, tarGet.GetName());
else
luaPath = String.Format(FILEPATH_NPCS, target.zoneId, target.GetName());
luaPath = String.Format(FILEPATH_NPCS, tarGet.zoneId, tarGet.GetName());
if (File.Exists(luaPath))
{
Script script = loadScript(luaPath);
Script script = LoadScript(luaPath);
if (script == null)
return;
@ -141,7 +153,7 @@ namespace FFXIVClassic_Map_Server.lua
//Have to Do this to combine LuaParams
List<Object> objects = new List<Object>();
objects.Add(player);
objects.Add(target);
objects.Add(tarGet);
objects.Add(eventUpdate.val2);
objects.AddRange(LuaUtils.CreateLuaParamObjectList(eventUpdate.luaParams));
@ -151,7 +163,7 @@ namespace FFXIVClassic_Map_Server.lua
}
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))
{
Script script = loadScript(luaPath);
Script script = LoadScript(luaPath);
if (script == null)
return;
@ -176,7 +188,7 @@ namespace FFXIVClassic_Map_Server.lua
{
if (File.Exists(FILEPATH_PLAYER))
{
Script script = loadScript(FILEPATH_PLAYER);
Script script = LoadScript(FILEPATH_PLAYER);
if (script == null)
return;
@ -191,7 +203,7 @@ namespace FFXIVClassic_Map_Server.lua
{
if (File.Exists(FILEPATH_PLAYER))
{
Script script = loadScript(FILEPATH_PLAYER);
Script script = LoadScript(FILEPATH_PLAYER);
if (script == null)
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();
((FileSystemScriptLoader)script.Options.ScriptLoader).ModulePaths = FileSystemScriptLoader.UnpackStringPaths("./scripts/?;./scripts/?.lua");
script.Globals["getWorldManager"] = (Func<WorldManager>)Server.GetWorldManager;
script.Globals["getStaticActor"] = (Func<string, Actor>)Server.GetStaticActors;
script.Globals["getWorldMaster"] = (Func<Actor>)Server.GetWorldManager().GetActor;
script.Globals["getItemGamedata"] = (Func<uint, Item>)Server.GetItemGamedata;
script.Globals["GetWorldManager"] = (Func<WorldManager>)Server.GetWorldManager;
script.Globals["GetStaticActor"] = (Func<string, Actor>)Server.GetStaticActors;
script.Globals["GetWorldMaster"] = (Func<Actor>)Server.GetWorldManager().GetActor;
script.Globals["GetItemGamedata"] = (Func<uint, Item>)Server.GetItemGamedata;
try
{
@ -223,7 +235,7 @@ namespace FFXIVClassic_Map_Server.lua
return script;
}
private static void SendError(Player player, string message)
public static void SendError(Player player, string message)
{
List<SubPacket> SendError = new List<SubPacket>();
SendError.Add(EndEventPacket.BuildPacket(player.actorId, player.currentEventOwner, player.currentEventName));
@ -238,7 +250,7 @@ namespace FFXIVClassic_Map_Server.lua
if (File.Exists(luaPath))
{
Script script = loadScript(luaPath);
Script script = LoadScript(luaPath);
if (script == null)
return;
@ -259,7 +271,7 @@ namespace FFXIVClassic_Map_Server.lua
if (File.Exists(luaPath))
{
Script script = loadScript(luaPath);
Script script = LoadScript(luaPath);
if (script == null)
return;

View file

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

View file

@ -10,7 +10,7 @@ namespace FFXIVClassic_Map_Server.packets
public ushort subpacketSize;
public ushort type;
public uint sourceId;
public uint targetId;
public uint tarGetId;
public uint unknown1;
}
@ -68,14 +68,14 @@ namespace FFXIVClassic_Map_Server.packets
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.gameMessage = new GameMessageHeader();
gameMessage.opcode = opcode;
header.sourceId = sourceId;
header.targetId = targetId;
header.tarGetId = tarGetId;
gameMessage.timestamp = Utils.UnixTimeStampUTC();
@ -97,7 +97,7 @@ namespace FFXIVClassic_Map_Server.packets
header.subpacketSize = original.header.subpacketSize;
header.type = original.header.type;
header.sourceId = original.header.sourceId;
header.targetId = newTargetId;
header.tarGetId = newTargetId;
data = original.data;
}

View file

@ -8,26 +8,26 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
public const ushort OPCODE = 0x00E1;
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];
if (targettedActorId == 0xC0000000)
targettedActorId = sourceActorId;
if (tarGettedActorId == 0xC0000000)
tarGettedActorId = sourceActorId;
using (MemoryStream mem = new MemoryStream(data))
{
using (BinaryWriter binWriter = new BinaryWriter(mem))
{
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)targettedActorId);
binWriter.Write((UInt32)tarGettedActorId);
binWriter.Write((UInt32)realDescID);
}
}
SubPacket packet = new SubPacket(OPCODE, sourceActorId, targetActorId, data);
SubPacket packet = new SubPacket(OPCODE, sourceActorId, tarGetActorId, data);
packet.DebugPrintSubPacket();
return packet;
}

View file

@ -11,7 +11,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
public const ushort OPCODE = 0x00CC;
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];
@ -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 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];
@ -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 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];
@ -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 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];
@ -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;
}

View file

@ -12,7 +12,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
public const ushort OPCODE = 0x0145;
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];
@ -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 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];
@ -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 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];
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 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];
@ -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;
}

View file

@ -22,7 +22,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
public const float INNPOS_Z = 165.050003f;
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];
@ -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;
}
public void SetTarget(string target)
public void SetTarget(string tarGet)
{
currentTarget = target;
currentTarget = tarGet;
}
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_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];
@ -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];
@ -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 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);
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 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];
@ -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;
}
}

View file

@ -8,7 +8,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
public const ushort OPCODE = 0x0177;
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];
@ -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 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 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 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];
@ -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
{
public uint targetId;
public uint tarGetId;
public ushort amount;
public ushort worldMasterTextId;
public uint effectId;

View file

@ -8,7 +8,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.battle
public const ushort OPCODE = 0x013C;
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];

View file

@ -8,7 +8,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.battle
public const ushort OPCODE = 0x0139;
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];
@ -26,7 +26,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.battle
binWriter.Write((UInt16)commandId);
binWriter.Write((UInt16)810); //?
binWriter.Write((UInt32)targetActorId);
binWriter.Write((UInt32)tarGetActorId);
binWriter.Write((UInt16)amount);
binWriter.Write((UInt16)worldMasterTextId);

View file

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

View file

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

View file

@ -5,11 +5,11 @@
public const ushort OPCODE = 0x016D;
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];
data[0] = 2;
return new SubPacket(OPCODE, sourceActorId, targetActorId, data);
return new SubPacket(OPCODE, sourceActorId, tarGetActorId, data);
}
public static SubPacket BuildPacket(uint playerActorID)

View file

@ -5,9 +5,9 @@
public const ushort OPCODE = 0x016E;
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)

View file

@ -13,7 +13,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.inventory
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];
@ -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);
}
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];
@ -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);
}
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];
@ -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);
}
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];
@ -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]);
}
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_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];
@ -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);
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];
@ -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);
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];
@ -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);
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];
@ -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);
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)

View file

@ -34,7 +34,7 @@ namespace FFXIVClassic_Map_Server.packets.send
public const ushort OPCODE = 0x0003;
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];
@ -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 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];
@ -20,7 +20,7 @@ namespace FFXIVClassic_Map_Server.packets.send.events
using (BinaryWriter binWriter = new BinaryWriter(mem))
{
binWriter.Write((UInt32)playerActorId);
binWriter.Write((UInt32)targetActorId);
binWriter.Write((UInt32)tarGetActorId);
binWriter.Write((Byte)0x5);
binWriter.Write((Byte)0x87);
binWriter.Write((Byte)0xDC);

View file

@ -158,11 +158,11 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
isMore = flag;
}
public void SetTarget(string target)
public void SetTarget(string tarGet)
{
binWriter.Write((byte)(isMore ? 0x62 + target.Length : 0x82 + target.Length));
binWriter.Write(Encoding.ASCII.GetBytes(target));
runningByteTotal += (ushort)(1 + Encoding.ASCII.GetByteCount(target));
binWriter.Write((byte)(isMore ? 0x62 + tarGet.Length : 0x82 + tarGet.Length));
binWriter.Write(Encoding.ASCII.GetBytes(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 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];
@ -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 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)
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 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 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];
@ -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 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 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];
@ -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();
currentTarget = target;
currentActorPropertyPacket.SetTarget(target);
currentTarget = tarGet;
currentActorPropertyPacket.SetTarget(tarGet);
}
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)
return "/Chara/Npc/Object/ObjectBed", false, false, false, false, false, 0x1250FB, false, false, 0, 1, "TEST";
return false, false, 0, 0;
end
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)
return "/Chara/Npc/Object/ObjectInnDoor", false, false, false, false, false, 0x1250F8, false, false, 0, 1, "TEST";
return false, false, 0, 0;
end
function onEventStarted(player, npc, triggerName)
player:endEvent();
end
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)
return "/Chara/Npc/Object/Aetheryte/AetheryteParent", false, false, false, false, false, npc.getActorClassId(), false, false, 0, 1, "TEST";
return false, false, 0, 0;
end
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)
return "/Chara/Npc/Populace/PopulaceGuildlevePublisher", false, false, false, false, false, npc.getActorClassId(), false, false, 0, 1, "TEST";
return false, false, 0, 0;
end
function onEventStarted(player, npc)

View file

@ -1,5 +1,5 @@
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
function onEventStarted(player, npc)

View file

@ -24,7 +24,7 @@ Menu Ids:
--]]
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
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");
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, "processTtrBtl002");
--player:runEventFunction("delegateEvent", player, man0l0Quest, "processTtrBtl003");
player:runEventFunction("delegateEvent", player, man0u0Quest, "processTtrBtl004");
--player:runEventFunction("delegateEvent", player, man0u0Quest, "processTtrBtl004");
end

View file

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