diff --git a/FFXIVClassic Common Class Lib/FFXIVClassic Common Class Lib.csproj b/FFXIVClassic Common Class Lib/FFXIVClassic Common Class Lib.csproj index 5e54cb7e..a2c8c826 100644 --- a/FFXIVClassic Common Class Lib/FFXIVClassic Common Class Lib.csproj +++ b/FFXIVClassic Common Class Lib/FFXIVClassic Common Class Lib.csproj @@ -10,7 +10,7 @@ Properties FFXIVClassic.Common FFXIVClassic.Common - v4.5 + v4.5.1 512 @@ -36,6 +36,27 @@ prompt 4 false + true + + + true + bin\Debug\ + DEBUG;TRACE + true + full + x64 + prompt + MinimumRecommendedRules.ruleset + + + bin\x64\Release\ + TRACE + true + true + pdbonly + x64 + prompt + MinimumRecommendedRules.ruleset @@ -51,6 +72,7 @@ + @@ -68,6 +90,7 @@ + @@ -87,4 +110,4 @@ --> - + \ No newline at end of file diff --git a/FFXIVClassic Common Class Lib/Utils.cs b/FFXIVClassic Common Class Lib/Utils.cs index a6479b78..aa8ddaf5 100644 --- a/FFXIVClassic Common Class Lib/Utils.cs +++ b/FFXIVClassic Common Class Lib/Utils.cs @@ -84,10 +84,10 @@ namespace FFXIVClassic.Common return sb.ToString().TrimEnd(Environment.NewLine.ToCharArray()); } - public static uint UnixTimeStampUTC() + public static uint UnixTimeStampUTC(DateTime? time = null) { uint unixTimeStamp; - var currentTime = DateTime.Now; + var currentTime = time ?? DateTime.Now; var zuluTime = currentTime.ToUniversalTime(); var unixEpoch = new DateTime(1970, 1, 1); unixTimeStamp = (uint)zuluTime.Subtract(unixEpoch).TotalSeconds; @@ -95,10 +95,10 @@ namespace FFXIVClassic.Common return unixTimeStamp; } - public static ulong MilisUnixTimeStampUTC() + public static ulong MilisUnixTimeStampUTC(DateTime? time = null) { ulong unixTimeStamp; - var currentTime = DateTime.Now; + var currentTime = time ?? DateTime.Now; var zuluTime = currentTime.ToUniversalTime(); var unixEpoch = new DateTime(1970, 1, 1); unixTimeStamp = (ulong)zuluTime.Subtract(unixEpoch).TotalMilliseconds; @@ -351,5 +351,95 @@ namespace FFXIVClassic.Common { return (value >> bits) | (value << (16 - bits)); } + + public static T Clamp(this T value, T min, T max) where T : IComparable + { + if (value.CompareTo(min) < 0) + return min; + else if (value.CompareTo(max) > 0) + return max; + else + return value; + } + + public static T Min(this T value, T min) where T : IComparable + { + if (value.CompareTo(min) > 0) + return min; + else + return value; + } + + public static T Max(this T value, T max) where T : IComparable + { + + if (value.CompareTo(max) < 0) + return max; + else + return value; + } + + public static float DistanceSquared(Vector3 lhs, Vector3 rhs) + { + return DistanceSquared(lhs.X, lhs.Y, lhs.Z, rhs.X, rhs.Y, rhs.Z); + } + + public static float Distance(Vector3 lhs, Vector3 rhs) + { + return Distance(lhs.X, lhs.Y, lhs.Z, rhs.X, rhs.Y, rhs.Z); + } + + public static float Distance(float x, float y, float z, float x2, float y2, float z2) + { + if (x == x2 && y == y2 && z == z2) + return 0.0f; + + return (float)Math.Sqrt(DistanceSquared(x, y, z, x2, y2, z2)); + } + + public static float DistanceSquared(float x, float y, float z, float x2, float y2, float z2) + { + if (x == x2 && y == y2 && z == z2) + return 0.0f; + + // todo: my maths is shit + var dx = x - x2; + var dy = y - y2; + var dz = z - z2; + + return dx * dx + dy * dy + dz * dz; + } + + //Distance of just the x and z valeus, ignoring y + public static float XZDistanceSquared(Vector3 lhs, Vector3 rhs) + { + return XZDistanceSquared(lhs.X, lhs.Z, rhs.X, rhs.Z); + } + + public static float XZDistance(Vector3 lhs, Vector3 rhs) + { + return XZDistance(lhs.X, lhs.Z, rhs.X, rhs.Z); + } + + public static float XZDistance(float x, float z, float x2, float z2) + { + if (x == x2 && z == z2) + return 0.0f; + + return (float)Math.Sqrt(XZDistanceSquared(x, z, x2, z2)); + } + + + public static float XZDistanceSquared(float x, float z, float x2, float z2) + { + if (x == x2 && z == z2) + return 0.0f; + + // todo: mz maths is shit + var dx = x - x2; + var dz = z - z2; + + return dx * dx + dz * dz; + } } } \ No newline at end of file diff --git a/FFXIVClassic Common Class Lib/Vector3.cs b/FFXIVClassic Common Class Lib/Vector3.cs new file mode 100644 index 00000000..40285a4b --- /dev/null +++ b/FFXIVClassic Common Class Lib/Vector3.cs @@ -0,0 +1,145 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FFXIVClassic.Common +{ + public class Vector3 + { + public float X; + public float Y; + public float Z; + public static Vector3 Zero = new Vector3(); + + public Vector3(float x, float y, float z) + { + X = x; + Y = y; + Z = z; + } + + public Vector3() + { + X = 0.0f; + Y = 0.0f; + Z = 0.0f; + } + + public static Vector3 operator +(Vector3 lhs, Vector3 rhs) + { + Vector3 newVec = new Vector3(lhs.X, lhs.Y, lhs.Z); + newVec.X += rhs.X; + newVec.Y += rhs.Y; + newVec.Z += rhs.Z; + return newVec; + } + + public static Vector3 operator -(Vector3 lhs, Vector3 rhs) + { + return new Vector3(lhs.X - rhs.X, lhs.Y - rhs.Y, lhs.Z - rhs.Z); + } + + public static Vector3 operator *(Vector3 lhs, Vector3 rhs) + { + return new Vector3(lhs.X * rhs.X, lhs.Y * rhs.Y, lhs.Z * rhs.Z); + } + + public static Vector3 operator *(float scalar, Vector3 rhs) + { + return new Vector3(scalar * rhs.X, scalar * rhs.Y, scalar * rhs.Z); + } + + public static Vector3 operator /(Vector3 lhs, float scalar) + { + return new Vector3(lhs.X / scalar, lhs.Y / scalar, lhs.Z / scalar); + } + + public static bool operator !=(Vector3 lhs, Vector3 rhs) + { + return !(lhs?.X == rhs?.X && lhs?.Y == rhs?.Y && lhs?.Z == rhs?.Z); + } + + public static bool operator ==(Vector3 lhs, Vector3 rhs) + { + return (lhs?.X == rhs?.X && lhs?.Y == rhs?.Y && lhs?.Z == rhs?.Z); + } + + public float Length() + { + return (float)Math.Sqrt(this.LengthSquared()); + } + + public float LengthSquared() + { + return (this.X * this.X) + (this.Y * this.Y) + (this.Z * this.Z); + } + + public static float Dot(Vector3 lhs, Vector3 rhs) + { + return (lhs.X * rhs.X) + (lhs.Y * rhs.Y) + (lhs.Z * rhs.Z); + } + + public static float GetAngle(Vector3 lhs, Vector3 rhs) + { + return GetAngle(lhs.X, lhs.Z, rhs.X, rhs.Z); + } + + public static float GetAngle(float x, float z, float x2, float z2) + { + if (x == x2) + return 0.0f; + + var angle = (float)(Math.Atan((z2 - z) / (x2 - x))); + return (float)(x > x2 ? angle + Math.PI : angle); + } + + public Vector3 NewHorizontalVector(float angle, float extents) + { + var newVec = new Vector3(); + newVec.Y = this.Y; + newVec.X = this.X + (float)Math.Cos(angle) * extents; + newVec.Z = this.Z + (float)Math.Sin(angle) * extents; + + return newVec; + } + + public bool IsWithinCircle(Vector3 center, float maxRadius, float minRadius) + { + if (this.X == center.X && this.Z == center.Z) + return true; + + float diffX = center.X - this.X; + float diffZ = center.Z - this.Z; + + float distance = Utils.XZDistance(center.X, center.Z, X, Z); + + return distance <= maxRadius && distance >= minRadius; + } + + public bool IsWithinBox(Vector3 upperLeftCorner, Vector3 lowerRightCorner) + { + return upperLeftCorner.X <= this.X && + upperLeftCorner.Y <= this.Y && + upperLeftCorner.Z <= this.Z && + lowerRightCorner.X >= this.X && + lowerRightCorner.Y >= this.Y && + lowerRightCorner.Z >= this.Z; + } + + //Checks if this vector is in a cone, note it doesn't check for distance + public bool IsWithinCone(Vector3 coneCenter, float coneRotation, float coneAngle) + { + float angleToTarget = GetAngle(coneCenter, this); + float halfAngleOfAoe = (float) (coneAngle * Math.PI / 2); + float rotationToAdd = coneRotation + halfAngleOfAoe; + + //This is the angle relative to the lower angle of the cone + angleToTarget = (angleToTarget + rotationToAdd - (0.5f * (float)Math.PI)) % (2 * (float) Math.PI); + + //If the relative angle is less than the total angle of the cone, the target is inside the cone + return angleToTarget >= 0 && angleToTarget <= (coneAngle * Math.PI); + } + } +} diff --git a/FFXIVClassic Common Class Lib/app.config b/FFXIVClassic Common Class Lib/app.config index 143834c2..e418f4e3 100644 --- a/FFXIVClassic Common Class Lib/app.config +++ b/FFXIVClassic Common Class Lib/app.config @@ -1,9 +1,9 @@ - + - - + + - \ No newline at end of file + diff --git a/FFXIVClassic Lobby Server/Database.cs b/FFXIVClassic Lobby Server/Database.cs index 8af742d1..cd17e498 100644 --- a/FFXIVClassic Lobby Server/Database.cs +++ b/FFXIVClassic Lobby Server/Database.cs @@ -1,6 +1,5 @@ using FFXIVClassic_Lobby_Server.dataobjects; using MySql.Data.MySqlClient; -using Dapper; using System; using System.Collections.Generic; using System.Linq; @@ -219,7 +218,7 @@ namespace FFXIVClassic_Lobby_Server { MySqlCommand cmd = new MySqlCommand(); cmd.Connection = conn; - cmd.CommandText = String.Format("INSERT INTO characters_parametersave(characterId, hp, hpMax, mp, mpMax, mainSkill, mainSkillLevel) VALUES(@characterId, 1, 1, 1, 1, @mainSkill, 1);", CharacterCreatorUtils.GetClassNameForId((short)charaInfo.currentClass)); + cmd.CommandText = String.Format("INSERT INTO characters_parametersave(characterId, hp, hpMax, mp, mpMax, mainSkill, mainSkillLevel) VALUES(@characterId, 1900, 1000, 115, 115, @mainSkill, 1);", CharacterCreatorUtils.GetClassNameForId((short)charaInfo.currentClass)); cmd.Prepare(); cmd.Parameters.AddWithValue("@characterId", cid); @@ -231,15 +230,51 @@ namespace FFXIVClassic_Lobby_Server catch (MySqlException e) { Program.Log.Error(e.ToString()); - + conn.Dispose(); + return; + } + //Create Hotbar + try + { + MySqlCommand cmd = new MySqlCommand(); + cmd.Connection = conn; + cmd.CommandText = "SELECT id FROM server_battle_commands WHERE classJob = @classjob AND lvl = 1 ORDER BY id DESC"; + cmd.Prepare(); + + cmd.Parameters.AddWithValue("@classJob", charaInfo.currentClass); + List defaultActions = new List(); + using (var reader = cmd.ExecuteReader()) + { + while(reader.Read()) + { + defaultActions.Add(reader.GetUInt32("id")); + } + } + MySqlCommand cmd2 = new MySqlCommand(); + cmd2.Connection = conn; + cmd2.CommandText = "INSERT INTO characters_hotbar (characterId, classId, hotbarSlot, commandId, recastTime) VALUES (@characterId, @classId, @hotbarSlot, @commandId, 0)"; + cmd2.Prepare(); + cmd2.Parameters.AddWithValue("@characterId", cid); + cmd2.Parameters.AddWithValue("@classId", charaInfo.currentClass); + cmd2.Parameters.Add("@hotbarSlot", MySqlDbType.Int16); + cmd2.Parameters.Add("@commandId", MySqlDbType.Int16); + + for(int i = 0; i < defaultActions.Count; i++) + { + cmd2.Parameters["@hotbarSlot"].Value = i; + cmd2.Parameters["@commandId"].Value = defaultActions[i]; + cmd2.ExecuteNonQuery(); + } + } + catch(MySqlException e) + { + Program.Log.Error(e.ToString()); } finally { conn.Dispose(); } - - } Program.Log.Debug("[SQL] CID={0} state updated to active(2).", cid); @@ -325,48 +360,105 @@ namespace FFXIVClassic_Lobby_Server public static List GetServers() { - using (var 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))) + string query; + MySqlCommand cmd; + List worldList = new List(); + + 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))) { - List worldList = null; try { conn.Open(); - worldList = conn.Query("SELECT * FROM servers WHERE isActive=true").ToList(); + query = "SELECT * FROM servers WHERE isActive=true"; + cmd = new MySqlCommand(query, conn); + + using (MySqlDataReader reader = cmd.ExecuteReader()) + { + while (reader.Read()) + { + ushort id; + string address; + ushort port; + ushort listPosition; + ushort population; + string name; + bool isActive; + + id = reader.GetUInt16("id"); + address = reader.GetString("address"); + port = reader.GetUInt16("port"); + listPosition = reader.GetUInt16("listPosition"); + population = 2; + name = reader.GetString("name"); + isActive = reader.GetBoolean("isActive"); + + worldList.Add(new World(id, address, port, listPosition, population, name, isActive)); + } + } } catch (MySqlException e) { Program.Log.Error(e.ToString()); - worldList = new List(); } + worldList = new List(); + } finally - { + { conn.Dispose(); } - return worldList; } + return worldList; } public static World GetServer(uint serverId) { - using (var 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))) + string query; + MySqlCommand cmd; + World world = null; + + 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))) { - World world = null; try { conn.Open(); - world = conn.Query("SELECT * FROM servers WHERE id=@ServerId", new {ServerId = serverId}).SingleOrDefault(); + query = "SELECT * FROM servers WHERE id=@ServerId"; + cmd = new MySqlCommand(query, conn); + cmd.Parameters.AddWithValue("@ServerId", serverId); + + using (MySqlDataReader reader = cmd.ExecuteReader()) + { + while (reader.Read()) + { + ushort id; + string address; + ushort port; + ushort listPosition; + ushort population; + string name; + bool isActive; + + id = reader.GetUInt16("id"); + address = reader.GetString("address"); + port = reader.GetUInt16("port"); + listPosition = reader.GetUInt16("listPosition"); + population = 2; //TODO + name = reader.GetString("name"); + isActive = reader.GetBoolean("isActive"); + + world = new World(id, address, port, listPosition, population, name, isActive); + } + } } catch (MySqlException e) { - Program.Log.Error(e.ToString()); - + Program.Log.Error(e.ToString()); } finally { conn.Dispose(); } - - return world; } + + return world; } public static List GetCharacters(uint userId) @@ -432,9 +524,11 @@ namespace FFXIVClassic_Lobby_Server Character chara = null; using (var 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))) { - conn.Open(); + try + { + conn.Open(); - string query = @" + string query = @" SELECT id, slot, @@ -454,126 +548,179 @@ namespace FFXIVClassic_Lobby_Server INNER JOIN characters_parametersave ON id = characters_parametersave.characterId WHERE id = @charId"; - MySqlCommand cmd = new MySqlCommand(query, conn); - cmd.Parameters.AddWithValue("@charId", charId); - using (MySqlDataReader reader = cmd.ExecuteReader()) - { - if (reader.Read()) + MySqlCommand cmd = new MySqlCommand(query, conn); + cmd.Parameters.AddWithValue("@charId", charId); + using (MySqlDataReader reader = cmd.ExecuteReader()) { - chara = new Character(); - chara.id = reader.GetUInt32("id"); - chara.slot = reader.GetUInt16("slot"); - chara.serverId = reader.GetUInt16("serverId"); - chara.name = reader.GetString("name"); - chara.isLegacy = reader.GetBoolean("isLegacy"); - chara.doRename = reader.GetBoolean("doRename"); - chara.currentZoneId = reader.GetUInt32("currentZoneId"); - chara.guardian = reader.GetByte("guardian"); - chara.birthMonth = reader.GetByte("birthMonth"); - chara.birthDay = reader.GetByte("birthDay"); - chara.initialTown = reader.GetByte("initialTown"); - chara.tribe = reader.GetByte("tribe"); - chara.currentClass = reader.GetByte("mainSkill"); - //chara.currentJob = ??? - chara.currentLevel = reader.GetInt16("mainSkillLevel"); + if (reader.Read()) + { + chara = new Character(); + chara.id = reader.GetUInt32("id"); + chara.slot = reader.GetUInt16("slot"); + chara.serverId = reader.GetUInt16("serverId"); + chara.name = reader.GetString("name"); + chara.isLegacy = reader.GetBoolean("isLegacy"); + chara.doRename = reader.GetBoolean("doRename"); + chara.currentZoneId = reader.GetUInt32("currentZoneId"); + chara.guardian = reader.GetByte("guardian"); + chara.birthMonth = reader.GetByte("birthMonth"); + chara.birthDay = reader.GetByte("birthDay"); + chara.initialTown = reader.GetByte("initialTown"); + chara.tribe = reader.GetByte("tribe"); + chara.currentClass = reader.GetByte("mainSkill"); + //chara.currentJob = ??? + chara.currentLevel = reader.GetInt16("mainSkillLevel"); + } } } + catch (MySqlException e) + { + Program.Log.Error(e.ToString()); + + } + finally + { + conn.Dispose(); + } } return chara; } public static Appearance GetAppearance(uint charaId) { + Appearance appearance = new Appearance(); using (var 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))) { - Appearance appearance = null; try { conn.Open(); - appearance = conn.Query("SELECT * FROM characters_appearance WHERE characterId=@CharaId", new { CharaId = charaId }).SingleOrDefault(); + //Load appearance + string query = @" + SELECT + baseId, + size, + voice, + skinColor, + hairStyle, + hairColor, + hairHighlightColor, + eyeColor, + characteristics, + characteristicsColor, + faceType, + ears, + faceMouth, + faceFeatures, + faceNose, + faceEyeShape, + faceIrisSize, + faceEyebrows, + mainHand, + offHand, + head, + body, + legs, + hands, + feet, + waist, + leftFinger, + rightFinger, + leftEar, + rightEar + FROM characters_appearance WHERE characterId = @charaId"; + + MySqlCommand cmd = new MySqlCommand(query, conn); + cmd.Parameters.AddWithValue("@charaId", charaId); + using (MySqlDataReader reader = cmd.ExecuteReader()) + { + if (reader.Read()) + { + appearance.size = reader.GetByte("size"); + appearance.voice = reader.GetByte("voice"); + appearance.skinColor = reader.GetUInt16("skinColor"); + appearance.hairStyle = reader.GetUInt16("hairStyle"); + appearance.hairColor = reader.GetUInt16("hairColor"); + appearance.hairHighlightColor = reader.GetUInt16("hairHighlightColor"); + appearance.eyeColor = reader.GetUInt16("eyeColor"); + appearance.characteristics = reader.GetByte("characteristics"); + appearance.characteristicsColor = reader.GetByte("characteristicsColor"); + appearance.faceType = reader.GetByte("faceType"); + appearance.ears = reader.GetByte("ears"); + appearance.faceMouth = reader.GetByte("faceMouth"); + appearance.faceFeatures = reader.GetByte("faceFeatures"); + appearance.faceNose = reader.GetByte("faceNose"); + appearance.faceEyeShape = reader.GetByte("faceEyeShape"); + appearance.faceIrisSize = reader.GetByte("faceIrisSize"); + appearance.faceEyebrows = reader.GetByte("faceEyebrows"); + + appearance.mainHand = reader.GetUInt32("mainHand"); + appearance.offHand = reader.GetUInt32("offHand"); + appearance.head = reader.GetUInt32("head"); + appearance.body = reader.GetUInt32("body"); + appearance.mainHand = reader.GetUInt32("mainHand"); + appearance.legs = reader.GetUInt32("legs"); + appearance.hands = reader.GetUInt32("hands"); + appearance.feet = reader.GetUInt32("feet"); + appearance.waist = reader.GetUInt32("waist"); + appearance.leftFinger = reader.GetUInt32("leftFinger"); + appearance.rightFinger = reader.GetUInt32("rightFinger"); + appearance.leftEar = reader.GetUInt32("leftEar"); + appearance.rightEar = reader.GetUInt32("rightEar"); + } + + } } catch (MySqlException e) { Program.Log.Error(e.ToString()); - + } finally { conn.Dispose(); } - - return appearance; } + + return appearance; } public static List GetReservedNames(uint userId) { + List reservedNames = new List(); using (var 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))) - { - List nameList = null; - try - { - conn.Open(); - nameList = conn.Query("SELECT name FROM reserved_names WHERE userId=@UserId", new { UserId = userId }).ToList(); - } - catch (MySqlException e) - { - Program.Log.Error(e.ToString()); - nameList = new List(); } - finally - { - conn.Dispose(); - } - return nameList; - } - } - - public static List GetRetainers(uint userId) - { - List retainers = new List(); - - 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))) { try { conn.Open(); - string query = @" - SELECT characters.id as charaId, server_retainers.id as retainerId, server_retainers.name, characters_retainers.doRename FROM characters - INNER JOIN characters_retainers ON characters.id = characters_retainers.characterId - INNER JOIN server_retainers ON characters_retainers.retainerId = server_retainers.id - WHERE userId = @userId - "; + string query = "SELECT name FROM reserved_names WHERE userId=@UserId"; MySqlCommand cmd = new MySqlCommand(query, conn); - cmd.Parameters.AddWithValue("@userId", userId); - + cmd.Parameters.AddWithValue("@UserId", userId); using (MySqlDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { - uint characterId = reader.GetUInt32("charaId"); - uint retainerId = reader.GetUInt32("retainerId"); - string name = reader.GetString("name"); - bool doRename = reader.GetBoolean("doRename"); - - retainers.Add(new Retainer(characterId, retainerId, name, doRename)); + reservedNames.Add(reader.GetString("name")); } } - } catch (MySqlException e) { Program.Log.Error(e.ToString()); + } finally { conn.Dispose(); } - - return retainers; } + return reservedNames; + } + public static List GetRetainers(uint userId) + { + return new List(); } } diff --git a/FFXIVClassic Lobby Server/FFXIVClassic Lobby Server.csproj b/FFXIVClassic Lobby Server/FFXIVClassic Lobby Server.csproj index 962c3676..640d1111 100644 --- a/FFXIVClassic Lobby Server/FFXIVClassic Lobby Server.csproj +++ b/FFXIVClassic Lobby Server/FFXIVClassic Lobby Server.csproj @@ -10,7 +10,7 @@ Properties FFXIVClassic_Lobby_Server FFXIVClassic_Lobby_Server - v4.5 + v4.5.1 512 false publish\ @@ -28,6 +28,7 @@ false true cc1ba6f5 + AnyCPU @@ -50,13 +51,32 @@ 4 true + + true + bin\Debug\ + DEBUG;TRACE + true + full + x64 + prompt + MinimumRecommendedRules.ruleset + true + + + bin\x64\Release\ + TRACE + true + true + pdbonly + x64 + prompt + MinimumRecommendedRules.ruleset + true + ..\packages\Cyotek.CircularBuffer.1.0.0.0\lib\net20\Cyotek.Collections.Generic.CircularBuffer.dll - - ..\packages\Dapper.1.42\lib\net45\Dapper.dll - ..\FFXIVClassic Common Class Lib\bin\Debug\FFXIVClassic.Common.dll @@ -64,10 +84,6 @@ ..\packages\MySql.Data.6.9.8\lib\net45\MySql.Data.dll True - - ..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll - True - ..\packages\NLog.4.3.4\lib\net45\NLog.dll True diff --git a/FFXIVClassic Lobby Server/app.config b/FFXIVClassic Lobby Server/app.config index 143834c2..e418f4e3 100644 --- a/FFXIVClassic Lobby Server/app.config +++ b/FFXIVClassic Lobby Server/app.config @@ -1,9 +1,9 @@ - + - - + + - \ No newline at end of file + diff --git a/FFXIVClassic Lobby Server/dataobjects/World.cs b/FFXIVClassic Lobby Server/dataobjects/World.cs index 8cab7502..67749216 100644 --- a/FFXIVClassic Lobby Server/dataobjects/World.cs +++ b/FFXIVClassic Lobby Server/dataobjects/World.cs @@ -2,12 +2,30 @@ { class World { - public ushort id; - public string address; - public ushort port; - public ushort listPosition; - public ushort population; - public string name; - public bool isActive; + public readonly ushort id; + public readonly string address; + public readonly ushort port; + public readonly ushort listPosition; + public readonly ushort population; + public readonly string name; + public readonly bool isActive; + + public World( + ushort id, + string address, + ushort port, + ushort listPosition, + ushort population, + string name, + bool isActive) + { + this.id = id; + this.address = address; + this.port = port; + this.listPosition = listPosition; + this.population = population; + this.name = name; + this.isActive = isActive; + } } } diff --git a/FFXIVClassic Lobby Server/packages.config b/FFXIVClassic Lobby Server/packages.config index 54b0ad82..6d704229 100644 --- a/FFXIVClassic Lobby Server/packages.config +++ b/FFXIVClassic Lobby Server/packages.config @@ -1,10 +1,8 @@  - - diff --git a/FFXIVClassic Map Server/App.config b/FFXIVClassic Map Server/App.config index 63198b4c..3c9bd9c6 100644 --- a/FFXIVClassic Map Server/App.config +++ b/FFXIVClassic Map Server/App.config @@ -1,11 +1,20 @@  - + - \ No newline at end of file + + + + + + + + + + diff --git a/FFXIVClassic Map Server/CommandProcessor.cs b/FFXIVClassic Map Server/CommandProcessor.cs index 283c78c5..447bfd57 100644 --- a/FFXIVClassic Map Server/CommandProcessor.cs +++ b/FFXIVClassic Map Server/CommandProcessor.cs @@ -32,7 +32,7 @@ namespace FFXIVClassic_Map_Server internal bool DoCommand(string input, Session session) { - if (!input.Any() || input.Equals("")) + if (!input.Any() || input.Equals("") || input.Length == 1) return false; input.Trim(); @@ -47,10 +47,10 @@ namespace FFXIVClassic_Map_Server split = split.ToArray(); // Ignore case on commands - var cmd = split[0]; - - if (cmd.Any()) + if (split.Length > 0) { + var cmd = split[0]; + // if client isnt null, take player to be the player actor Player player = null; if (session != null) diff --git a/FFXIVClassic Map Server/Database.cs b/FFXIVClassic Map Server/Database.cs index 22201313..41f575ca 100644 --- a/FFXIVClassic Map Server/Database.cs +++ b/FFXIVClassic Map Server/Database.cs @@ -1,8 +1,6 @@ using MySql.Data.MySqlClient; -using Dapper; using System; using System.Collections.Generic; -using System.Linq; using FFXIVClassic.Common; using FFXIVClassic_Map_Server.utils; @@ -12,6 +10,9 @@ using FFXIVClassic_Map_Server.Actors; using FFXIVClassic_Map_Server.actors.chara.player; using FFXIVClassic_Map_Server.packets.receive.supportdesk; using FFXIVClassic_Map_Server.actors.chara.npc; +using FFXIVClassic_Map_Server.actors.chara.ai; +using FFXIVClassic_Map_Server.packets.send.actor.battle; +using FFXIVClassic_Map_Server.actors.chara; namespace FFXIVClassic_Map_Server { @@ -49,29 +50,6 @@ namespace FFXIVClassic_Map_Server return id; } - public static List GetNpcList() - { - using (var 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))) - { - List npcList = null; - try - { - conn.Open(); - npcList = conn.Query("SELECT * FROM npc_list").ToList(); - } - catch (MySqlException e) - { - Program.Log.Error(e.ToString()); - } - finally - { - conn.Dispose(); - } - - return npcList; - } - } - public static Dictionary GetItemGamedata() { using (var 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))) @@ -783,6 +761,62 @@ namespace FFXIVClassic_Map_Server } } + //Get class experience + query = @" + SELECT + pug, + gla, + mrd, + arc, + lnc, + + thm, + cnj, + + crp, + bsm, + arm, + gsm, + ltw, + wvr, + alc, + cul, + + min, + btn, + fsh + FROM characters_class_exp WHERE characterId = @charId"; + + cmd = new MySqlCommand(query, conn); + cmd.Parameters.AddWithValue("@charId", player.actorId); + using (MySqlDataReader reader = cmd.ExecuteReader()) + { + if (reader.Read()) + { + player.charaWork.battleSave.skillPoint[Player.CLASSID_PUG - 1] = reader.GetInt32("pug"); + player.charaWork.battleSave.skillPoint[Player.CLASSID_GLA - 1] = reader.GetInt32("gla"); + player.charaWork.battleSave.skillPoint[Player.CLASSID_MRD - 1] = reader.GetInt32("mrd"); + player.charaWork.battleSave.skillPoint[Player.CLASSID_ARC - 1] = reader.GetInt32("arc"); + player.charaWork.battleSave.skillPoint[Player.CLASSID_LNC - 1] = reader.GetInt32("lnc"); + + player.charaWork.battleSave.skillPoint[Player.CLASSID_THM - 1] = reader.GetInt32("thm"); + player.charaWork.battleSave.skillPoint[Player.CLASSID_CNJ - 1] = reader.GetInt32("cnj"); + + player.charaWork.battleSave.skillPoint[Player.CLASSID_CRP - 1] = reader.GetInt32("crp"); + player.charaWork.battleSave.skillPoint[Player.CLASSID_BSM - 1] = reader.GetInt32("bsm"); + player.charaWork.battleSave.skillPoint[Player.CLASSID_ARM - 1] = reader.GetInt32("arm"); + player.charaWork.battleSave.skillPoint[Player.CLASSID_GSM - 1] = reader.GetInt32("gsm"); + player.charaWork.battleSave.skillPoint[Player.CLASSID_LTW - 1] = reader.GetInt32("ltw"); + player.charaWork.battleSave.skillPoint[Player.CLASSID_WVR - 1] = reader.GetInt32("wvr"); + player.charaWork.battleSave.skillPoint[Player.CLASSID_ALC - 1] = reader.GetInt32("alc"); + player.charaWork.battleSave.skillPoint[Player.CLASSID_CUL - 1] = reader.GetInt32("cul"); + + player.charaWork.battleSave.skillPoint[Player.CLASSID_MIN - 1] = reader.GetInt32("min"); + player.charaWork.battleSave.skillPoint[Player.CLASSID_BTN - 1] = reader.GetInt32("btn"); + player.charaWork.battleSave.skillPoint[Player.CLASSID_FSH - 1] = reader.GetInt32("fsh"); + } + } + //Load Saved Parameters query = @" SELECT @@ -879,18 +913,38 @@ namespace FFXIVClassic_Map_Server query = @" SELECT statusId, - expireTime + duration, + magnitude, + tick, + tier, + extra FROM characters_statuseffect WHERE characterId = @charId"; cmd = new MySqlCommand(query, conn); cmd.Parameters.AddWithValue("@charId", player.actorId); using (MySqlDataReader reader = cmd.ExecuteReader()) { - int count = 0; while (reader.Read()) { - player.charaWork.status[count] = reader.GetUInt16("statusId"); - player.charaWork.statusShownTime[count] = reader.GetUInt32("expireTime"); + var id = reader.GetUInt32(0); + var duration = reader.GetUInt32(1); + var magnitude = reader.GetUInt64(2); + var tick = reader.GetUInt32(3); + var tier = reader.GetByte(4); + var extra = reader.GetUInt64(5); + + var effect = Server.GetWorldManager().GetStatusEffect(id); + if (effect != null) + { + effect.SetDuration(duration); + effect.SetMagnitude(magnitude); + effect.SetTickMs(tick); + effect.SetTier(tier); + effect.SetExtra(extra); + + // dont wanna send ton of messages on login (i assume retail doesnt) + player.statusEffects.AddStatusEffect(effect, null, true); + } } } @@ -953,25 +1007,7 @@ namespace FFXIVClassic_Map_Server } //Load Hotbar - query = @" - SELECT - hotbarSlot, - commandId, - recastTime - FROM characters_hotbar WHERE characterId = @charId AND classId = @classId"; - - cmd = new MySqlCommand(query, conn); - cmd.Parameters.AddWithValue("@charId", player.actorId); - cmd.Parameters.AddWithValue("@classId", player.charaWork.parameterSave.state_mainSkill[0]); - using (MySqlDataReader reader = cmd.ExecuteReader()) - { - while (reader.Read()) - { - int index = reader.GetUInt16(0); - player.charaWork.command[index + 32] = reader.GetUInt32(1); - player.charaWork.parameterSave.commandSlot_recastTime[index] = reader.GetUInt32(2); - } - } + LoadHotbar(player); //Load Scenario Quests query = @" @@ -1210,7 +1246,195 @@ namespace FFXIVClassic_Map_Server } } + public static void EquipAbility(Player player, byte classId, ushort hotbarSlot, uint commandId, uint recastTime) + { + commandId ^= 0xA0F00000; + if (commandId > 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))) + { + try + { + conn.Open(); + MySqlCommand cmd; + string query = @" + INSERT INTO characters_hotbar + (characterId, classId, hotbarSlot, commandId, recastTime) + VALUES + (@charId, @classId, @hotbarSlot, @commandId, @recastTime) + ON DUPLICATE KEY UPDATE commandId=@commandId, recastTime=@recastTime; + "; + cmd = new MySqlCommand(query, conn); + cmd.Parameters.AddWithValue("@charId", player.actorId); + cmd.Parameters.AddWithValue("@classId", classId); + cmd.Parameters.AddWithValue("@commandId", commandId); + cmd.Parameters.AddWithValue("@hotbarSlot", hotbarSlot); + cmd.Parameters.AddWithValue("@recastTime", recastTime); + cmd.ExecuteNonQuery(); + } + catch (MySqlException e) + { + Program.Log.Error(e.ToString()); + } + finally + { + conn.Dispose(); + } + } + } + else + UnequipAbility(player, hotbarSlot); + } + + //Unequipping is done by sending an equip packet with 0xA0F00000 as the ability and the hotbar slot of the action being unequipped + public static void UnequipAbility(Player player, ushort hotbarSlot) + { + 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))) + { + try + { + conn.Open(); + MySqlCommand cmd; + string query = ""; + + query = @" + DELETE FROM characters_hotbar + WHERE characterId = @charId AND classId = @classId AND hotbarSlot = @hotbarSlot + "; + cmd = new MySqlCommand(query, conn); + cmd.Parameters.AddWithValue("@charId", player.actorId); + cmd.Parameters.AddWithValue("@classId", player.charaWork.parameterSave.state_mainSkill[0]); + cmd.Parameters.AddWithValue("@hotbarSlot", hotbarSlot); + cmd.ExecuteNonQuery(); + } + catch (MySqlException e) + { + Program.Log.Error(e.ToString()); + } + finally + { + conn.Dispose(); + } + } + + } + + public static void LoadHotbar(Player player) + { + string query; + MySqlCommand cmd; + + 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))) + { + try + { + conn.Open(); + //Load Hotbar + query = @" + SELECT + hotbarSlot, + commandId, + recastTime + FROM characters_hotbar WHERE characterId = @charId AND classId = @classId + ORDER BY hotbarSlot"; + + cmd = new MySqlCommand(query, conn); + cmd.Parameters.AddWithValue("@charId", player.actorId); + cmd.Parameters.AddWithValue("@classId", player.GetCurrentClassOrJob()); + + player.charaWork.commandBorder = 32; + + using (MySqlDataReader reader = cmd.ExecuteReader()) + { + while (reader.Read()) + { + int hotbarSlot = reader.GetUInt16("hotbarSlot"); + uint commandId = reader.GetUInt32("commandId"); + player.charaWork.command[hotbarSlot + player.charaWork.commandBorder] = 0xA0F00000 | commandId; + player.charaWork.commandCategory[hotbarSlot + player.charaWork.commandBorder] = 1; + player.charaWork.parameterSave.commandSlot_recastTime[hotbarSlot] = reader.GetUInt32("recastTime"); + + //Recast timer + BattleCommand ability = Server.GetWorldManager().GetBattleCommand((ushort)(commandId)); + player.charaWork.parameterTemp.maxCommandRecastTime[hotbarSlot] = (ushort) (ability != null ? ability.maxRecastTimeSeconds : 1); + } + } + } + catch (MySqlException e) + { + Program.Log.Error(e.ToString()); + } + finally + { + conn.Dispose(); + } + } + } + + public static ushort FindFirstCommandSlot(Player player, byte classId) + { + ushort slot = 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))) + { + try + { + conn.Open(); + MySqlCommand cmd; + string query = ""; + + //Drop + List> hotbarList = new List>(); + query = @" + SELECT hotbarSlot + FROM characters_hotbar + WHERE characterId = @charId AND classId = @classId + ORDER BY hotbarSlot + "; + cmd = new MySqlCommand(query, conn); + cmd.Parameters.AddWithValue("@charId", player.actorId); + cmd.Parameters.AddWithValue("@classId", classId); + + using (MySqlDataReader reader = cmd.ExecuteReader()) + { + while (reader.Read()) + { + if (slot != reader.GetUInt16("hotbarSlot")) + break; + + slot++; + } + } + } + catch (MySqlException e) + { + Program.Log.Error(e.ToString()); + } + finally + { + conn.Dispose(); + } + } + return slot; + } public static List GetInventory(Player player, uint slotOffset, uint type) { List items = new List(); @@ -1370,7 +1594,7 @@ namespace FFXIVClassic_Map_Server string query = @" - INSERT INTO server_items + INSERT INTO server_items (itemId, quality, itemType, durability) VALUES (@itemId, @quality, @itemType, @durability); @@ -1694,7 +1918,7 @@ namespace FFXIVClassic_Map_Server conn.Open(); string query = @" - INSERT INTO server_linkshells + INSERT INTO server_linkshells (name, master, crest) VALUES (@lsName, @master, @crest) @@ -2068,7 +2292,312 @@ namespace FFXIVClassic_Map_Server } } } + + public static Dictionary LoadGlobalStatusEffectList() + { + var effects = new Dictionary(); + 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))) + { + try + { + conn.Open(); + + var query = @"SELECT id, name, flags, overwrite, tickMs FROM server_statuseffects;"; + + MySqlCommand cmd = new MySqlCommand(query, conn); + + using (MySqlDataReader reader = cmd.ExecuteReader()) + { + while (reader.Read()) + { + var id = reader.GetUInt32("id"); + var name = reader.GetString("name"); + var flags = reader.GetUInt32("flags"); + var overwrite = reader.GetByte("overwrite"); + var tickMs = reader.GetUInt32("tickMs"); + var effect = new StatusEffect(id, name, flags, overwrite, tickMs); + lua.LuaEngine.LoadStatusEffectScript(effect); + effects.Add(id, effect); + } + } + } + catch (MySqlException e) + { + Program.Log.Error(e.ToString()); + } + finally + { + conn.Dispose(); + } + } + return effects; + } + + public static void SavePlayerStatusEffects(Player player) + { + string[] faqs = null; + List raw = new List(); + 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))) + { + try + { + conn.Open(); + + using (MySqlTransaction trns = conn.BeginTransaction()) + { + string query = @" + REPLACE INTO characters_statuseffect + (characterId, statusId, magnitude, duration, tick, tier, extra) + VALUES + (@actorId, @statusId, @magnitude, @duration, @tick, @tier, @extra) + "; + using (MySqlCommand cmd = new MySqlCommand(query, conn, trns)) + { + foreach (var effect in player.statusEffects.GetStatusEffects()) + { + var duration = Utils.UnixTimeStampUTC(effect.GetEndTime()) - Utils.UnixTimeStampUTC(); + + cmd.Parameters.AddWithValue("@actorId", player.actorId); + cmd.Parameters.AddWithValue("@statusId", effect.GetStatusEffectId()); + cmd.Parameters.AddWithValue("@magnitude", effect.GetMagnitude()); + cmd.Parameters.AddWithValue("@duration", duration); + cmd.Parameters.AddWithValue("@tick", effect.GetTickMs()); + cmd.Parameters.AddWithValue("@tier", effect.GetTier()); + cmd.Parameters.AddWithValue("@extra", effect.GetExtra()); + + cmd.ExecuteNonQuery(); + } + trns.Commit(); + } + } + } + catch (MySqlException e) + { + Program.Log.Error(e.ToString()); + } + finally + { + conn.Dispose(); + } + } + } + + public static void LoadGlobalBattleCommandList(Dictionary battleCommandDict, Dictionary, List> battleCommandIdByLevel) + { + 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))) + { + try + { + int count = 0; + conn.Open(); + + var query = ("SELECT `id`, name, classJob, lvl, requirements, mainTarget, validTarget, aoeType, aoeRange, aoeMinRange, aoeConeAngle, aoeRotateAngle, aoeTarget, basePotency, numHits, positionBonus, procRequirement, `range`, minRange, rangeHeight, rangeWidth, statusId, statusDuration, statusChance, " + + "castType, castTime, recastTime, mpCost, tpCost, animationType, effectAnimation, modelAnimation, animationDuration, battleAnimation, validUser, comboId1, comboId2, comboStep, accuracyMod, worldMasterTextId, commandType, actionType, actionProperty FROM server_battle_commands;"); + + MySqlCommand cmd = new MySqlCommand(query, conn); + + using (MySqlDataReader reader = cmd.ExecuteReader()) + { + while (reader.Read()) + { + var id = reader.GetUInt16("id"); + var name = reader.GetString("name"); + var battleCommand = new BattleCommand(id, name); + + battleCommand.job = reader.GetByte("classJob"); + battleCommand.level = reader.GetByte("lvl"); + battleCommand.requirements = (BattleCommandRequirements)reader.GetUInt16("requirements"); + battleCommand.mainTarget = (ValidTarget)reader.GetByte("mainTarget"); + battleCommand.validTarget = (ValidTarget)reader.GetByte("validTarget"); + battleCommand.aoeType = (TargetFindAOEType)reader.GetByte("aoeType"); + battleCommand.basePotency = reader.GetUInt16("basePotency"); + battleCommand.numHits = reader.GetByte("numHits"); + battleCommand.positionBonus = (BattleCommandPositionBonus)reader.GetByte("positionBonus"); + battleCommand.procRequirement = (BattleCommandProcRequirement)reader.GetByte("procRequirement"); + battleCommand.range = reader.GetFloat("range"); + battleCommand.minRange = reader.GetFloat("minRange"); + battleCommand.rangeHeight = reader.GetInt32("rangeHeight"); + battleCommand.rangeWidth = reader.GetInt32("rangeWidth"); + battleCommand.statusId = reader.GetUInt32("statusId"); + battleCommand.statusDuration = reader.GetUInt32("statusDuration"); + battleCommand.statusChance = reader.GetFloat("statusChance"); + battleCommand.castType = reader.GetByte("castType"); + battleCommand.castTimeMs = reader.GetUInt32("castTime"); + battleCommand.maxRecastTimeSeconds = reader.GetUInt32("recastTime"); + battleCommand.recastTimeMs = battleCommand.maxRecastTimeSeconds * 1000; + battleCommand.mpCost = reader.GetUInt16("mpCost"); + battleCommand.tpCost = reader.GetUInt16("tpCost"); + battleCommand.animationType = reader.GetByte("animationType"); + battleCommand.effectAnimation = reader.GetUInt16("effectAnimation"); + battleCommand.modelAnimation = reader.GetUInt16("modelAnimation"); + battleCommand.animationDurationSeconds = reader.GetUInt16("animationDuration"); + battleCommand.aoeRange = reader.GetFloat("aoeRange"); + battleCommand.aoeMinRange = reader.GetFloat("aoeMinRange"); + battleCommand.aoeConeAngle = reader.GetFloat("aoeConeAngle"); + battleCommand.aoeRotateAngle = reader.GetFloat("aoeRotateAngle"); + battleCommand.aoeTarget = (TargetFindAOETarget)reader.GetByte("aoeTarget"); + + battleCommand.battleAnimation = reader.GetUInt32("battleAnimation"); + battleCommand.validUser = (BattleCommandValidUser)reader.GetByte("validUser"); + + battleCommand.comboNextCommandId[0] = reader.GetInt32("comboId1"); + battleCommand.comboNextCommandId[1] = reader.GetInt32("comboId2"); + battleCommand.comboStep = reader.GetInt16("comboStep"); + battleCommand.commandType = (CommandType) reader.GetInt16("commandType"); + battleCommand.actionProperty = (ActionProperty)reader.GetInt16("actionProperty"); + battleCommand.actionType = (ActionType)reader.GetInt16("actionType"); + battleCommand.accuracyModifier = reader.GetFloat("accuracyMod"); + battleCommand.worldMasterTextId = reader.GetUInt16("worldMasterTextId"); + lua.LuaEngine.LoadBattleCommandScript(battleCommand, "weaponskill"); + battleCommandDict.Add(id, battleCommand); + + Tuple tuple = Tuple.Create(battleCommand.job, battleCommand.level); + if (battleCommandIdByLevel.ContainsKey(tuple)) + { + battleCommandIdByLevel[tuple].Add(id); + } + else + { + List list = new List() { id }; + battleCommandIdByLevel.Add(tuple, list); + } + count++; + } + } + + Program.Log.Info(String.Format("Loaded {0} battle commands.", count)); + } + catch (MySqlException e) + { + Program.Log.Error(e.ToString()); + } + finally + { + conn.Dispose(); + } + } + } + + public static void LoadGlobalBattleTraitList(Dictionary battleTraitDict, Dictionary> battleTraitJobDict) + { + 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))) + { + try + { + int count = 0; + conn.Open(); + + var query = ("SELECT `id`, name, classJob, lvl, modifier, bonus FROM server_battle_traits;"); + + MySqlCommand cmd = new MySqlCommand(query, conn); + + using (MySqlDataReader reader = cmd.ExecuteReader()) + { + while (reader.Read()) + { + var id = reader.GetUInt16("id"); + var name = reader.GetString("name"); + var job = reader.GetByte("classJob"); + var level = reader.GetByte("lvl"); + uint modifier = reader.GetUInt32("modifier"); + var bonus = reader.GetInt32("bonus"); + + var trait = new BattleTrait(id, name, job, level, modifier, bonus); + + battleTraitDict.Add(id, trait); + + if(battleTraitJobDict.ContainsKey(job)) + { + battleTraitJobDict[job].Add(id); + } + else + { + battleTraitJobDict[job] = new List(); + battleTraitJobDict[job].Add(id); + } + + count++; + } + } + Program.Log.Info(String.Format("Loaded {0} battle traits.", count)); + } + catch (MySqlException e) + { + Program.Log.Error(e.ToString()); + } + finally + { + conn.Dispose(); + } + } + } + + public static void SetExp(Player player, byte classId, int exp) + { + 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))) + { + try + { + conn.Open(); + + var query = String.Format(@" + UPDATE characters_class_exp + SET + {0} = @exp + WHERE + characterId = @characterId", CharacterUtils.GetClassNameForId(classId)); + MySqlCommand cmd = new MySqlCommand(query, conn); + + cmd.Prepare(); + cmd = new MySqlCommand(query, conn); + cmd.Parameters.AddWithValue("@characterId", player.actorId); + cmd.Parameters.AddWithValue("@exp", exp); + cmd.ExecuteNonQuery(); + } + catch (MySqlException e) + { + Program.Log.Error(e.ToString()); + } + finally + { + conn.Dispose(); + } + } + } + + public static void SetLevel(Player player, byte classId, short level) + { + 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))) + { + try + { + conn.Open(); + + var query = String.Format(@" + UPDATE characters_class_levels + SET + {0} = @lvl + WHERE + characterId = @characterId", CharacterUtils.GetClassNameForId(classId)); + MySqlCommand cmd = new MySqlCommand(query, conn); + + cmd.Prepare(); + cmd = new MySqlCommand(query, conn); + cmd.Parameters.AddWithValue("@characterId", player.actorId); + cmd.Parameters.AddWithValue("@lvl", level); + cmd.ExecuteNonQuery(); + } + catch (MySqlException e) + { + Program.Log.Error(e.ToString()); + } + finally + { + conn.Dispose(); + } + } + } public static Retainer LoadRetainer(Player player, int retainerIndex) { diff --git a/FFXIVClassic Map Server/FFXIVClassic Map Server.csproj b/FFXIVClassic Map Server/FFXIVClassic Map Server.csproj index 5ff268f7..63fe6bca 100644 --- a/FFXIVClassic Map Server/FFXIVClassic Map Server.csproj +++ b/FFXIVClassic Map Server/FFXIVClassic Map Server.csproj @@ -10,9 +10,10 @@ Properties FFXIVClassic_Map_Server FFXIVClassic Map Server - v4.5 + v4.5.1 512 1d22ec4a + AnyCPU @@ -24,6 +25,7 @@ prompt 4 true + true AnyCPU @@ -38,15 +40,33 @@ Always + + true + bin\Debug\ + DEBUG;TRACE + true + full + x64 + prompt + MinimumRecommendedRules.ruleset + true + + + bin\x64\Release\ + TRACE + true + true + pdbonly + x64 + prompt + MinimumRecommendedRules.ruleset + true + ..\packages\Cyotek.CircularBuffer.1.0.0.0\lib\net20\Cyotek.Collections.Generic.CircularBuffer.dll True - - ..\packages\Dapper.1.42\lib\net45\Dapper.dll - True - False ..\FFXIVClassic Common Class Lib\bin\Debug\FFXIVClassic.Common.dll @@ -58,16 +78,21 @@ ..\packages\MySql.Data.6.9.8\lib\net45\MySql.Data.dll True - - ..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll - True + + False + ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll ..\packages\NLog.4.3.5\lib\net45\NLog.dll True + + False + navmesh\SharpNav.dll + + @@ -79,17 +104,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -100,11 +157,11 @@ - - - - - + + + + + @@ -162,10 +219,11 @@ - - - - + + + + + @@ -192,7 +250,7 @@ - + @@ -203,7 +261,7 @@ - + @@ -329,6 +387,7 @@ + @@ -351,6 +410,9 @@ Resources.Designer.cs + + + diff --git a/FFXIVClassic Map Server/PacketProcessor.cs b/FFXIVClassic Map Server/PacketProcessor.cs index ded25460..e0ebcbdf 100644 --- a/FFXIVClassic Map Server/PacketProcessor.cs +++ b/FFXIVClassic Map Server/PacketProcessor.cs @@ -148,6 +148,7 @@ namespace FFXIVClassic_Map_Server SetTargetPacket setTarget = new SetTargetPacket(subpacket.data); session.GetActor().currentTarget = setTarget.actorID; + session.GetActor().isAutoAttackEnabled = setTarget.attackTarget != 0xE0000000; session.GetActor().BroadcastPacket(SetActorTargetAnimatedPacket.BuildPacket(session.id, setTarget.actorID), true); break; //Lock Target diff --git a/FFXIVClassic Map Server/Program.cs b/FFXIVClassic Map Server/Program.cs index d2d8ce4a..1954b553 100644 --- a/FFXIVClassic Map Server/Program.cs +++ b/FFXIVClassic Map Server/Program.cs @@ -16,6 +16,10 @@ namespace FFXIVClassic_Map_Server class Program { public static Logger Log; + public static Server Server; + public static Random Random; + public static DateTime LastTick = DateTime.Now; + public static DateTime Tick = DateTime.Now; static void Main(string[] args) { @@ -57,9 +61,10 @@ namespace FFXIVClassic_Map_Server //Start server if A-OK if (startServer) { - Server server = new Server(); - - server.StartServer(); + Random = new Random(); + Server = new Server(); + Tick = DateTime.Now; + Server.StartServer(); while (startServer) { diff --git a/FFXIVClassic Map Server/Properties/Resources.Designer.cs b/FFXIVClassic Map Server/Properties/Resources.Designer.cs index 75ee4efc..11a22948 100644 --- a/FFXIVClassic Map Server/Properties/Resources.Designer.cs +++ b/FFXIVClassic Map Server/Properties/Resources.Designer.cs @@ -17,7 +17,7 @@ namespace FFXIVClassic_Map_Server.Properties { /// // 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. /// public static string CPhelp { @@ -176,38 +176,38 @@ namespace FFXIVClassic_Map_Server.Properties { /// /// Looks up a localized string similar to Removes the specified currency from the current player's inventory /// - ///*Syntax: Removecurrency <quantity> - /// Removecurrency <type> <quantity> + ///*Syntax: removecurrency <quantity> + /// removecurrency <type> <quantity> ///<type> is the specific type of currency desired, defaults to gil if no type specified. /// - public static string CPRemovecurrency { + public static string CPremovecurrency { get { - return ResourceManager.GetString("CPRemovecurrency", resourceCulture); + return ResourceManager.GetString("CPremovecurrency", resourceCulture); } } /// /// Looks up a localized string similar to Removes the specified items to the current player's inventory /// - ///*Syntax: Removeitem <itemid> - /// Removeitem <itemid> <quantity> + ///*Syntax: removeitem <itemid> + /// removeitem <itemid> <quantity> ///<item id> is the item's specific id as defined in the server database. /// - public static string CPRemoveitem { + public static string CPremoveitem { get { - return ResourceManager.GetString("CPRemoveitem", resourceCulture); + return ResourceManager.GetString("CPremoveitem", resourceCulture); } } /// /// Looks up a localized string similar to Removes the specified key item to the current player's inventory /// - ///*Syntax: Removekeyitem <itemid> + ///*Syntax: removekeyitem <itemid> ///<item id> is the key item's specific id as defined in the server database. /// - public static string CPRemovekeyitem { + public static string CPremovekeyitem { get { - return ResourceManager.GetString("CPRemovekeyitem", resourceCulture); + return ResourceManager.GetString("CPremovekeyitem", resourceCulture); } } diff --git a/FFXIVClassic Map Server/Server.cs b/FFXIVClassic Map Server/Server.cs index f0f988aa..97f201f5 100644 --- a/FFXIVClassic Map Server/Server.cs +++ b/FFXIVClassic Map Server/Server.cs @@ -53,6 +53,10 @@ namespace FFXIVClassic_Map_Server mWorldManager.LoadSeamlessBoundryList(); mWorldManager.LoadActorClasses(); mWorldManager.LoadSpawnLocations(); + mWorldManager.LoadBattleNpcs(); + mWorldManager.LoadStatusEffects(); + mWorldManager.LoadBattleCommands(); + mWorldManager.LoadBattleTraits(); mWorldManager.SpawnAllActors(); mWorldManager.StartZoneThread(); diff --git a/FFXIVClassic Map Server/SharpNav.dll b/FFXIVClassic Map Server/SharpNav.dll new file mode 100644 index 00000000..3c648e5c Binary files /dev/null and b/FFXIVClassic Map Server/SharpNav.dll differ diff --git a/FFXIVClassic Map Server/WorldManager.cs b/FFXIVClassic Map Server/WorldManager.cs index 26d2d847..8bd9a058 100644 --- a/FFXIVClassic Map Server/WorldManager.cs +++ b/FFXIVClassic Map Server/WorldManager.cs @@ -22,6 +22,9 @@ using FFXIVClassic_Map_Server.packets.WorldPackets.Send.Group; using System.Threading; using System.Diagnostics; using FFXIVClassic_Map_Server.actors.director; +using FFXIVClassic_Map_Server.actors.chara.ai; +using FFXIVClassic_Map_Server.actors.chara; +using FFXIVClassic_Map_Server.Actors.Chara; namespace FFXIVClassic_Map_Server { @@ -34,10 +37,18 @@ namespace FFXIVClassic_Map_Server private Dictionary zoneEntranceList; private Dictionary actorClasses = new Dictionary(); private Dictionary currentPlayerParties = new Dictionary(); //GroupId, Party object + private Dictionary statusEffectList = new Dictionary(); + private Dictionary battleCommandList = new Dictionary(); + private Dictionary, List> battleCommandIdByLevel = new Dictionary, List>();//Holds battle command ids keyed by class id and level (in that order) + private Dictionary battleTraitList = new Dictionary(); + private Dictionary> battleTraitIdsForClass = new Dictionary>(); + private Dictionary battleNpcGenusMods = new Dictionary(); + private Dictionary battleNpcPoolMods = new Dictionary(); + private Dictionary battleNpcSpawnMods = new Dictionary(); private Server mServer; - private const int MILIS_LOOPTIME = 10; + private const int MILIS_LOOPTIME = 333; private Timer mZoneTimer; //Content Groups @@ -75,7 +86,8 @@ namespace FFXIVClassic_Map_Server isInn, canRideChocobo, canStealth, - isInstanceRaid + isInstanceRaid, + loadNavMesh FROM server_zones WHERE zoneName IS NOT NULL and serverIp = @ip and serverPort = @port"; @@ -88,7 +100,8 @@ namespace FFXIVClassic_Map_Server { while (reader.Read()) { - Zone zone = new Zone(reader.GetUInt32(0), reader.GetString(1), reader.GetUInt16(2), reader.GetString(3), reader.GetUInt16(4), reader.GetUInt16(5), reader.GetUInt16(6), reader.GetBoolean(7), reader.GetBoolean(8), reader.GetBoolean(9), reader.GetBoolean(10), reader.GetBoolean(11)); + Zone zone = new Zone(reader.GetUInt32(0), reader.GetString(1), reader.GetUInt16(2), reader.GetString(3), reader.GetUInt16(4), reader.GetUInt16(5), + reader.GetUInt16(6), reader.GetBoolean(7), reader.GetBoolean(8), reader.GetBoolean(9), reader.GetBoolean(10), reader.GetBoolean(11), reader.GetBoolean(12)); zoneList[zone.actorId] = zone; count1++; } @@ -412,6 +425,121 @@ namespace FFXIVClassic_Map_Server Program.Log.Info(String.Format("Loaded {0} spawn(s).", count)); } + public void LoadBattleNpcs() + { + LoadBattleNpcModifiers("server_battlenpc_genus_mods", "genusId", battleNpcGenusMods); + LoadBattleNpcModifiers("server_battlenpc_pool_mods", "poolId", battleNpcPoolMods); + LoadBattleNpcModifiers("server_battlenpc_spawn_mods", "bnpcId", battleNpcSpawnMods); + + 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))) + { + try + { + conn.Open(); + var query = @" + SELECT bsl.bnpcId, bsl.groupId, bsl.positionX, bsl.positionY, bsl.positionZ, bsl.rotation, + bgr.groupId, bgr.poolId, bgr.scriptName, bgr.minLevel, bgr.maxLevel, bgr.respawnTime, bgr.hp, bgr.mp, + bgr.dropListId, bgr.allegiance, bgr.spawnType, bgr.animationId, bgr.actorState, bgr.privateAreaName, bgr.privateAreaLevel, bgr.zoneId, + bpo.poolId, bpo.genusId, bpo.actorClassId, bpo.currentJob, bpo.combatSkill, bpo.combatDelay, bpo.combatDmgMult, bpo.aggroType, + bpo.immunity, bpo.linkType, bpo.skillListId, bpo.spellListId, + bge.genusId, bge.modelSize, bge.speed, bge.kindredId, bge.detection, bge.hpp, bge.mpp, bge.tpp, bge.str, bge.vit, bge.dex, + bge.int, bge.mnd, bge.pie, bge.att, bge.acc, bge.def, bge.eva, bge.slash, bge.pierce, bge.h2h, bge.blunt, + bge.fire, bge.ice, bge.wind, bge.lightning, bge.earth, bge.water, bge.element + FROM server_battlenpc_spawn_locations bsl + INNER JOIN server_battlenpc_groups bgr ON bsl.groupId = bgr.groupId + INNER JOIN server_battlenpc_pools bpo ON bgr.poolId = bpo.poolId + INNER JOIN server_battlenpc_genus bge ON bpo.genusId = bge.genusId + WHERE bgr.zoneId = @zoneId GROUP BY bsl.bnpcId; + "; + + var count = 0; + foreach (var zonePair in zoneList) + { + Area zone = zonePair.Value; + + MySqlCommand cmd = new MySqlCommand(query, conn); + cmd.Parameters.AddWithValue("@zoneId", zonePair.Key); + + using (MySqlDataReader reader = cmd.ExecuteReader()) + { + while (reader.Read()) + { + int actorId = zone.GetActorCount() + 1; + + // todo: add to private areas, set up immunity, mob linking, + // - load skill/spell/drop lists, set detection icon, load pool/family/group mods + + var battleNpc = new BattleNpc(actorId, Server.GetWorldManager().GetActorClass(reader.GetUInt32("actorClassId")), + reader.GetString("scriptName"), zone, reader.GetFloat("positionX"), reader.GetFloat("positionY"), reader.GetFloat("positionZ"), reader.GetFloat("rotation"), + reader.GetUInt16("actorState"), reader.GetUInt32("animationId"), ""); + + battleNpc.SetBattleNpcId(reader.GetUInt32("bnpcId")); + + battleNpc.poolId = reader.GetUInt32("poolId"); + battleNpc.genusId = reader.GetUInt32("genusId"); + battleNpcPoolMods.TryGetValue(battleNpc.poolId, out battleNpc.poolMods); + battleNpcGenusMods.TryGetValue(battleNpc.genusId, out battleNpc.genusMods); + battleNpcSpawnMods.TryGetValue(battleNpc.GetBattleNpcId(), out battleNpc.spawnMods); + + battleNpc.SetMod((uint)Modifier.Speed, reader.GetByte("speed")); + battleNpc.neutral = reader.GetByte("aggroType") == 0; + + battleNpc.SetDetectionType(reader.GetUInt32("detection")); + battleNpc.kindredType = (KindredType)reader.GetUInt32("kindredId"); + battleNpc.npcSpawnType = (NpcSpawnType)reader.GetUInt32("spawnType"); + + battleNpc.charaWork.parameterSave.state_mainSkill[0] = reader.GetByte("currentJob"); + battleNpc.charaWork.parameterSave.state_mainSkillLevel = (short)Program.Random.Next(reader.GetByte("minLevel"), reader.GetByte("maxLevel")); + + battleNpc.allegiance = (CharacterTargetingAllegiance)reader.GetByte("allegiance"); + + // todo: setup private areas and other crap and + // set up rest of stat resists + battleNpc.SetMod((uint)Modifier.Hp, reader.GetUInt32("hp")); + battleNpc.SetMod((uint)Modifier.HpPercent, reader.GetUInt32("hpp")); + battleNpc.SetMod((uint)Modifier.Mp, reader.GetUInt32("mp")); + battleNpc.SetMod((uint)Modifier.MpPercent, reader.GetUInt32("mpp")); + battleNpc.SetMod((uint)Modifier.TpPercent, reader.GetUInt32("tpp")); + + battleNpc.SetMod((uint)Modifier.Strength, reader.GetUInt32("str")); + battleNpc.SetMod((uint)Modifier.Vitality, reader.GetUInt32("vit")); + battleNpc.SetMod((uint)Modifier.Dexterity, reader.GetUInt32("dex")); + battleNpc.SetMod((uint)Modifier.Intelligence, reader.GetUInt32("int")); + battleNpc.SetMod((uint)Modifier.Mind, reader.GetUInt32("mnd")); + battleNpc.SetMod((uint)Modifier.Piety, reader.GetUInt32("pie")); + battleNpc.SetMod((uint)Modifier.Attack, reader.GetUInt32("att")); + battleNpc.SetMod((uint)Modifier.Accuracy, reader.GetUInt32("acc")); + battleNpc.SetMod((uint)Modifier.Defense, reader.GetUInt32("def")); + battleNpc.SetMod((uint)Modifier.Evasion, reader.GetUInt32("eva")); + + battleNpc.dropListId = reader.GetUInt32("dropListId"); + battleNpc.spellListId = reader.GetUInt32("spellListId"); + battleNpc.skillListId = reader.GetUInt32("skillListId"); + + //battleNpc.SetMod((uint)Modifier.ResistFire, ) + + // todo: this is dumb + if (battleNpc.npcSpawnType == NpcSpawnType.Normal) + { + zone.AddActorToZone(battleNpc); + count++; + } + } + } + } + Program.Log.Info("Loaded {0} monsters.", count); + } + catch (MySqlException e) + { + Program.Log.Error(e.ToString()); + } + finally + { + conn.Dispose(); + } + } + } + public void SpawnAllActors() { Program.Log.Info("Spawning actors..."); @@ -419,6 +547,200 @@ namespace FFXIVClassic_Map_Server z.SpawnAllActors(true); } + public BattleNpc SpawnBattleNpcById(uint id, Area area = null) + { + BattleNpc bnpc = null; + // todo: this is stupid duplicate code and really needs to die, think of a better way later + 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))) + { + try + { + conn.Open(); + var query = @" + SELECT bsl.bnpcId, bsl.groupId, bsl.positionX, bsl.positionY, bsl.positionZ, bsl.rotation, + bgr.groupId, bgr.poolId, bgr.scriptName, bgr.minLevel, bgr.maxLevel, bgr.respawnTime, bgr.hp, bgr.mp, + bgr.dropListId, bgr.allegiance, bgr.spawnType, bgr.animationId, bgr.actorState, bgr.privateAreaName, bgr.privateAreaLevel, bgr.zoneId, + bpo.poolId, bpo.genusId, bpo.actorClassId, bpo.currentJob, bpo.combatSkill, bpo.combatDelay, bpo.combatDmgMult, bpo.aggroType, + bpo.immunity, bpo.linkType, bpo.skillListId, bpo.spellListId, + bge.genusId, bge.modelSize, bge.speed, bge.kindredId, bge.detection, bge.hpp, bge.mpp, bge.tpp, bge.str, bge.vit, bge.dex, + bge.int, bge.mnd, bge.pie, bge.att, bge.acc, bge.def, bge.eva, bge.slash, bge.pierce, bge.h2h, bge.blunt, + bge.fire, bge.ice, bge.wind, bge.lightning, bge.earth, bge.water, bge.element + FROM server_battlenpc_spawn_locations bsl + INNER JOIN server_battlenpc_groups bgr ON bsl.groupId = bgr.groupId + INNER JOIN server_battlenpc_pools bpo ON bgr.poolId = bpo.poolId + INNER JOIN server_battlenpc_genus bge ON bpo.genusId = bge.genusId + WHERE bsl.bnpcId = @bnpcId GROUP BY bsl.bnpcId; + "; + + var count = 0; + + MySqlCommand cmd = new MySqlCommand(query, conn); + cmd.Parameters.AddWithValue("@bnpcId", id); + + using (MySqlDataReader reader = cmd.ExecuteReader()) + { + while (reader.Read()) + { + area = area ?? Server.GetWorldManager().GetZone(reader.GetUInt16("zoneId")); + int actorId = area.GetActorCount() + 1; + bnpc = area.GetBattleNpcById(id); + + if (bnpc != null) + { + bnpc.ForceRespawn(); + break; + } + + // todo: add to private areas, set up immunity, mob linking, + // - load skill/spell/drop lists, set detection icon, load pool/family/group mods + var allegiance = (CharacterTargetingAllegiance)reader.GetByte("allegiance"); + BattleNpc battleNpc = null; + + if (allegiance == CharacterTargetingAllegiance.Player) + battleNpc = new Ally(actorId, Server.GetWorldManager().GetActorClass(reader.GetUInt32("actorClassId")), + reader.GetString("scriptName"), area, reader.GetFloat("positionX"), reader.GetFloat("positionY"), reader.GetFloat("positionZ"), reader.GetFloat("rotation"), + reader.GetUInt16("actorState"), reader.GetUInt32("animationId"), ""); + else + battleNpc = new BattleNpc(actorId, Server.GetWorldManager().GetActorClass(reader.GetUInt32("actorClassId")), + reader.GetString("scriptName"), area, reader.GetFloat("positionX"), reader.GetFloat("positionY"), reader.GetFloat("positionZ"), reader.GetFloat("rotation"), + reader.GetUInt16("actorState"), reader.GetUInt32("animationId"), ""); + + battleNpc.SetBattleNpcId(reader.GetUInt32("bnpcId")); + battleNpc.SetMod((uint)Modifier.Speed, reader.GetByte("speed")); + battleNpc.neutral = reader.GetByte("aggroType") == 0; + + // set mob mods + battleNpc.poolId = reader.GetUInt32("poolId"); + battleNpc.genusId = reader.GetUInt32("genusId"); + battleNpcPoolMods.TryGetValue(battleNpc.poolId, out battleNpc.poolMods); + battleNpcGenusMods.TryGetValue(battleNpc.genusId, out battleNpc.genusMods); + battleNpcSpawnMods.TryGetValue(battleNpc.GetBattleNpcId(), out battleNpc.spawnMods); + + battleNpc.SetDetectionType(reader.GetUInt32("detection")); + battleNpc.kindredType = (KindredType)reader.GetUInt32("kindredId"); + battleNpc.npcSpawnType = (NpcSpawnType)reader.GetUInt32("spawnType"); + + battleNpc.charaWork.parameterSave.state_mainSkill[0] = reader.GetByte("currentJob"); + battleNpc.charaWork.parameterSave.state_mainSkillLevel = (short)Program.Random.Next(reader.GetByte("minLevel"), reader.GetByte("maxLevel")); + + battleNpc.allegiance = (CharacterTargetingAllegiance)reader.GetByte("allegiance"); + + // todo: setup private areas and other crap and + // set up rest of stat resists + battleNpc.SetMod((uint)Modifier.Hp, reader.GetUInt32("hp")); + battleNpc.SetMod((uint)Modifier.HpPercent, reader.GetUInt32("hpp")); + battleNpc.SetMod((uint)Modifier.Mp, reader.GetUInt32("mp")); + battleNpc.SetMod((uint)Modifier.MpPercent, reader.GetUInt32("mpp")); + battleNpc.SetMod((uint)Modifier.TpPercent, reader.GetUInt32("tpp")); + + battleNpc.SetMod((uint)Modifier.Strength, reader.GetUInt32("str")); + battleNpc.SetMod((uint)Modifier.Vitality, reader.GetUInt32("vit")); + battleNpc.SetMod((uint)Modifier.Dexterity, reader.GetUInt32("dex")); + battleNpc.SetMod((uint)Modifier.Intelligence, reader.GetUInt32("int")); + battleNpc.SetMod((uint)Modifier.Mind, reader.GetUInt32("mnd")); + battleNpc.SetMod((uint)Modifier.Piety, reader.GetUInt32("pie")); + battleNpc.SetMod((uint)Modifier.Attack, reader.GetUInt32("att")); + battleNpc.SetMod((uint)Modifier.Accuracy, reader.GetUInt32("acc")); + battleNpc.SetMod((uint)Modifier.Defense, reader.GetUInt32("def")); + battleNpc.SetMod((uint)Modifier.Evasion, reader.GetUInt32("eva")); + + if (battleNpc.poolMods != null) + { + foreach (var a in battleNpc.poolMods.mobModList) + { + battleNpc.SetMobMod(a.Value.id, (long)(a.Value.value)); + } + foreach (var a in battleNpc.poolMods.modList) + { + battleNpc.SetMod(a.Key, (long)(a.Value.value)); + } + } + + if (battleNpc.genusMods != null) + { + foreach (var a in battleNpc.genusMods.mobModList) + { + battleNpc.SetMobMod(a.Key, (long)(a.Value.value)); + } + foreach (var a in battleNpc.genusMods.modList) + { + battleNpc.SetMod(a.Key, (long)(a.Value.value)); + } + } + + if(battleNpc.spawnMods != null) + { + foreach (var a in battleNpc.spawnMods.mobModList) + { + battleNpc.SetMobMod(a.Key, (long)(a.Value.value)); + } + + foreach (var a in battleNpc.spawnMods.modList) + { + battleNpc.SetMod(a.Key, (long)(a.Value.value)); + } + } + + battleNpc.dropListId = reader.GetUInt32("dropListId"); + battleNpc.spellListId = reader.GetUInt32("spellListId"); + battleNpc.skillListId = reader.GetUInt32("skillListId"); + battleNpc.SetBattleNpcId(reader.GetUInt32("bnpcId")); + battleNpc.SetRespawnTime(reader.GetUInt32("respawnTime")); + battleNpc.CalculateBaseStats(); + battleNpc.RecalculateStats(); + //battleNpc.SetMod((uint)Modifier.ResistFire, ) + bnpc = battleNpc; + area.AddActorToZone(battleNpc); + count++; + } + } + Program.Log.Info("WorldManager.SpawnBattleNpcById spawned BattleNpc {0}.", id); + } + catch (MySqlException e) + { + Program.Log.Error(e.ToString()); + } + finally + { + conn.Dispose(); + } + } + return bnpc; + } + + public void LoadBattleNpcModifiers(string tableName, string primaryKey, Dictionary list) + { + 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))) + { + try + { + conn.Open(); + var query = $"SELECT {primaryKey}, modId, modVal, isMobMod FROM {tableName}"; + + MySqlCommand cmd = new MySqlCommand(query, conn); + + using (MySqlDataReader reader = cmd.ExecuteReader()) + { + while (reader.Read()) + { + var id = reader.GetUInt32(primaryKey); + ModifierList modList = list.TryGetValue(id, out modList) ? modList : new ModifierList(id); + modList.SetModifier(reader.GetUInt16("modId"), reader.GetInt64("modVal"), reader.GetBoolean("isMobMod")); + list[id] = modList; + } + } + } + catch (MySqlException e) + { + Program.Log.Error(e.ToString()); + } + finally + { + conn.Dispose(); + } + } + } + //Moves the actor to the new zone if exists. No packets are sent nor position changed. Merged zone is removed. public void DoSeamlessZoneChange(Player player, uint destinationZoneId) { @@ -581,7 +903,6 @@ namespace FFXIVClassic_Map_Server { oldZone.RemoveActorFromZone(player); } - newArea.AddActorToZone(player); //Update player actor's properties @@ -757,13 +1078,15 @@ namespace FFXIVClassic_Map_Server public void ReloadZone(uint zoneId) { - if (!zoneList.ContainsKey(zoneId)) - return; - - Zone zone = zoneList[zoneId]; - //zone.clear(); - //LoadNPCs(zone.actorId); + lock (zoneList) + { + if (!zoneList.ContainsKey(zoneId)) + return; + Zone zone = zoneList[zoneId]; + //zone.clear(); + //LoadNPCs(zone.actorId); + } } public ContentGroup CreateContentGroup(Director director, params Actor[] actors) @@ -1005,11 +1328,17 @@ namespace FFXIVClassic_Map_Server } public void ZoneThreadLoop(Object state) - { + { + // todo: coroutines GetActorInWorld stuff seems to be causing it to hang + // todo: spawn new thread for each zone on startup lock (zoneList) { - foreach (Area area in zoneList.Values) - area.Update(MILIS_LOOPTIME); + Program.Tick = DateTime.Now; + foreach (Zone zone in zoneList.Values) + { + zone.Update(Program.Tick); + } + Program.LastTick = Program.Tick; } } @@ -1031,39 +1360,52 @@ namespace FFXIVClassic_Map_Server public Actor GetActorInWorld(uint charId) { - foreach (Zone zone in zoneList.Values) + lock (zoneList) { - Actor a = zone.FindActorInZone(charId); - if (a != null) - return a; + foreach (Zone zone in zoneList.Values) + { + Actor a = zone.FindActorInZone(charId); + if (a != null) + return a; + } } return null; } public Actor GetActorInWorldByUniqueId(string uid) { - foreach (Zone zone in zoneList.Values) + lock (zoneList) { - Actor a = zone.FindActorInZoneByUniqueID(uid); - if (a != null) - return a; + foreach (Zone zone in zoneList.Values) + { + Actor a = zone.FindActorInZoneByUniqueID(uid); + if (a != null) + return a; + } } return null; } public Zone GetZone(uint zoneId) { - if (!zoneList.ContainsKey(zoneId)) - return null; - return zoneList[zoneId]; + lock (zoneList) + { + if (!zoneList.ContainsKey(zoneId)) + return null; + + return zoneList[zoneId]; + } } public PrivateArea GetPrivateArea(uint zoneId, string privateArea, uint privateAreaType) { - if (!zoneList.ContainsKey(zoneId)) - return null; + lock (zoneList) + { + if (!zoneList.ContainsKey(zoneId)) + return null; - return zoneList[zoneId].GetPrivateArea(privateArea, privateAreaType); + return zoneList[zoneId].GetPrivateArea(privateArea, privateAreaType); + } } public WorldMaster GetActor() @@ -1115,5 +1457,52 @@ namespace FFXIVClassic_Map_Server else return null; } + public void LoadStatusEffects() + { + statusEffectList = Database.LoadGlobalStatusEffectList(); + } + + public StatusEffect GetStatusEffect(uint id) + { + StatusEffect statusEffect; + + return statusEffectList.TryGetValue(id, out statusEffect) ? new StatusEffect(null, statusEffect) : null; + } + + public void LoadBattleCommands() + { + Database.LoadGlobalBattleCommandList(battleCommandList, battleCommandIdByLevel); + } + + public void LoadBattleTraits() + { + Database.LoadGlobalBattleTraitList(battleTraitList, battleTraitIdsForClass); + } + + public BattleCommand GetBattleCommand(uint id) + { + BattleCommand battleCommand; + return battleCommandList.TryGetValue((ushort)id, out battleCommand) ? battleCommand.Clone() : null; + } + + public List GetBattleCommandIdByLevel(byte classId, short level) + { + List ids; + return battleCommandIdByLevel.TryGetValue(Tuple.Create(classId, level), out ids) ? ids : new List(); + } + + public BattleTrait GetBattleTrait(ushort id) + { + BattleTrait battleTrait; + battleTraitList.TryGetValue(id, out battleTrait); + return battleTrait; + } + + public List GetAllBattleTraitIdsForClass(byte classId) + { + List ids; + return battleTraitIdsForClass.TryGetValue(classId, out ids) ? ids : new List(); + } + } } diff --git a/FFXIVClassic Map Server/actors/Actor.cs b/FFXIVClassic Map Server/actors/Actor.cs index 7c66e813..d5640417 100644 --- a/FFXIVClassic Map Server/actors/Actor.cs +++ b/FFXIVClassic Map Server/actors/Actor.cs @@ -10,11 +10,35 @@ using FFXIVClassic_Map_Server.actors.area; using System.Reflection; using System.ComponentModel; using FFXIVClassic_Map_Server.packets.send.actor.battle; +using FFXIVClassic_Map_Server.packets.send; +using FFXIVClassic_Map_Server.actors.chara; namespace FFXIVClassic_Map_Server.Actors { + [Flags] + enum ActorUpdateFlags + { + None = 0x00, + Position = 0x01, + HpTpMp = 0x02, + State = 0x04, + SubState = 0x08, + Combat = 0x0F, + Name = 0x10, + Appearance = 0x20, + Speed = 0x40, + Work = 0x80, + Stats = 0x100, + Status = 0x200, + StatusTime = 0x400, + + AllNpc = 0xDF, + AllPlayer = 0x13F + } + class Actor { + public static uint INVALID_ACTORID = 0xC0000000; public uint actorId; public string actorName; @@ -22,7 +46,9 @@ namespace FFXIVClassic_Map_Server.Actors public string customDisplayName; public ushort currentMainState = SetActorStatePacket.MAIN_STATE_PASSIVE; - public ushort currentSubState = SetActorStatePacket.SUB_STATE_NONE; + + public SubState currentSubState = new SubState(); + public float positionX, positionY, positionZ, rotation; public float oldPositionX, oldPositionY, oldPositionZ, oldRotation; public ushort moveState, oldMoveState; @@ -41,6 +67,15 @@ namespace FFXIVClassic_Map_Server.Actors public string className; public List classParams; + public List positionUpdates; + protected DateTime lastUpdateScript; + protected DateTime lastUpdate; + public Actor target; + + public bool isAtSpawn = true; + + public ActorUpdateFlags updateFlags; + public EventList eventConditions; public Actor(uint actorId) @@ -75,12 +110,23 @@ namespace FFXIVClassic_Map_Server.Actors } } } + + public virtual void ResetMoveSpeeds() + { + this.moveSpeeds[0] = SetActorSpeedPacket.DEFAULT_STOP; + this.moveSpeeds[1] = SetActorSpeedPacket.DEFAULT_WALK; + this.moveSpeeds[2] = SetActorSpeedPacket.DEFAULT_RUN; + this.moveSpeeds[3] = SetActorSpeedPacket.DEFAULT_ACTIVE; - public SubPacket CreateAddActorPacket(byte val) + this.moveState = this.oldMoveState; + this.updateFlags |= ActorUpdateFlags.Speed; + } + + public SubPacket CreateAddActorPacket(byte val) { return AddActorPacket.BuildPacket(actorId, val); } - + public SubPacket CreateNamePacket() { return SetActorNamePacket.BuildPacket(actorId, customDisplayName != null ? 0 : displayNameId, displayNameId == 0xFFFFFFFF | displayNameId == 0x0 | customDisplayName != null ? customDisplayName : ""); @@ -139,7 +185,7 @@ namespace FFXIVClassic_Map_Server.Actors public SubPacket CreateStatePacket() { - return SetActorStatePacket.BuildPacket(actorId, currentMainState, currentSubState); + return SetActorStatePacket.BuildPacket(actorId, currentMainState, 0); } public List GetEventConditionPackets() @@ -238,7 +284,7 @@ namespace FFXIVClassic_Map_Server.Actors public SubPacket CreateIsZoneingPacket() { - return SetActorIsZoningPacket.BuildPacket(actorId, false); + return SetActorIsZoningPacket.BuildPacket(actorId, false); } public virtual SubPacket CreateScriptBindPacket(Player player) @@ -246,13 +292,13 @@ namespace FFXIVClassic_Map_Server.Actors return ActorInstantiatePacket.BuildPacket(actorId, actorName, className, classParams); } - public virtual SubPacket CreateScriptBindPacket() + public virtual SubPacket CreateScriptBindPacket() { return ActorInstantiatePacket.BuildPacket(actorId, actorName, className, classParams); } - + public virtual List GetSpawnPackets(Player player, ushort spawnType) - { + { List subpackets = new List(); subpackets.Add(CreateAddActorPacket(8)); subpackets.AddRange(GetEventConditionPackets()); @@ -325,20 +371,40 @@ namespace FFXIVClassic_Map_Server.Actors return classParams; } + //character's newMainState kind of messes with this public void ChangeState(ushort newState) { - currentMainState = newState; - SubPacket ChangeStatePacket = SetActorStatePacket.BuildPacket(actorId, newState, currentSubState); - SubPacket battleActionPacket = BattleActionX01Packet.BuildPacket(actorId, actorId, actorId, 0x72000062, 1, 0, 0x05209, 0, 0); - zone.BroadcastPacketAroundActor(this, ChangeStatePacket); - zone.BroadcastPacketAroundActor(this, battleActionPacket); + if (newState != currentMainState) + { + currentMainState = newState; + + updateFlags |= (ActorUpdateFlags.State | ActorUpdateFlags.Position); + } + } + + public SubState GetSubState() + { + return currentSubState; + } + + public void SubstateModified() + { + updateFlags |= (ActorUpdateFlags.SubState); + } + + public void ModifySpeed(float mod) + { + for (int i = 0; i < 4; i++) + { + moveSpeeds[i] *= mod; + } + updateFlags |= ActorUpdateFlags.Speed; } public void ChangeSpeed(int type, float value) { moveSpeeds[type] = value; - SubPacket ChangeSpeedPacket = SetActorSpeedPacket.BuildPacket(actorId, moveSpeeds[0], moveSpeeds[1], moveSpeeds[2], moveSpeeds[3]); - zone.BroadcastPacketAroundActor(this, ChangeSpeedPacket); + updateFlags |= ActorUpdateFlags.Speed; } public void ChangeSpeed(float speedStop, float speedWalk, float speedRun, float speedActive) @@ -347,12 +413,68 @@ namespace FFXIVClassic_Map_Server.Actors moveSpeeds[1] = speedWalk; moveSpeeds[2] = speedRun; moveSpeeds[3] = speedActive; - SubPacket ChangeSpeedPacket = SetActorSpeedPacket.BuildPacket(actorId, moveSpeeds[0], moveSpeeds[1], moveSpeeds[2], moveSpeeds[3]); - zone.BroadcastPacketAroundActor(this, ChangeSpeedPacket); + updateFlags |= ActorUpdateFlags.Speed; } - public void Update(double deltaTime) - { + public virtual void Update(DateTime tick) + { + + } + + public virtual void PostUpdate(DateTime tick, List packets = null) + { + if (updateFlags != ActorUpdateFlags.None) + { + packets = packets ?? new List(); + if ((updateFlags & ActorUpdateFlags.Position) != 0) + { + if (positionUpdates != null && positionUpdates.Count > 0) + { + var pos = positionUpdates[0]; + if (pos != null) + { + oldPositionX = positionX; + oldPositionY = positionY; + oldPositionZ = positionZ; + oldRotation = rotation; + + positionX = pos.X; + positionY = pos.Y; + positionZ = pos.Z; + + zone.UpdateActorPosition(this); + + //Program.Server.GetInstance().mLuaEngine.OnPath(actor, position, positionUpdates) + } + positionUpdates.Remove(pos); + + } + packets.Add(CreatePositionUpdatePacket()); + } + + if ((updateFlags & ActorUpdateFlags.Speed) != 0) + { + packets.Add(SetActorSpeedPacket.BuildPacket(actorId, moveSpeeds[0], moveSpeeds[1], moveSpeeds[2], moveSpeeds[3])); + } + + if ((updateFlags & ActorUpdateFlags.Name) != 0) + { + packets.Add(SetActorNamePacket.BuildPacket(actorId, displayNameId, customDisplayName)); + } + + if ((updateFlags & ActorUpdateFlags.State) != 0) + { + packets.Add(SetActorStatePacket.BuildPacket(actorId, currentMainState, 0x3B)); + } + + if ((updateFlags & ActorUpdateFlags.SubState) != 0) + { + packets.Add(SetActorSubStatePacket.BuildPacket(actorId, currentSubState)); + } + + updateFlags = ActorUpdateFlags.None; + } + zone.BroadcastPacketsAroundActor(this, packets); } public void GenerateActorName(int actorNumber) @@ -468,7 +590,7 @@ namespace FFXIVClassic_Map_Server.Actors if (value.GetType() == curObj.GetType()) parentObj.GetType().GetField(split[split.Length - 1]).SetValue(parentObj, value); else - parentObj.GetType().GetField(split[split.Length-1]).SetValue(parentObj, TypeDescriptor.GetConverter(value.GetType()).ConvertTo(value, curObj.GetType())); + parentObj.GetType().GetField(split[split.Length - 1]).SetValue(parentObj, TypeDescriptor.GetConverter(value.GetType()).ConvertTo(value, curObj.GetType())); SetActorPropetyPacket changeProperty = new SetActorPropetyPacket(uiFunc); changeProperty.AddProperty(this, name); @@ -481,8 +603,9 @@ namespace FFXIVClassic_Map_Server.Actors } return false; } - } + } + #region positioning public List GetPos() { List pos = new List(); @@ -496,6 +619,11 @@ namespace FFXIVClassic_Map_Server.Actors return pos; } + public Vector3 GetPosAsVector3() + { + return new Vector3(positionX, positionY, positionZ); + } + public void SetPos(float x, float y, float z, float rot = 0, uint zoneId = 0) { oldPositionX = positionX; @@ -521,6 +649,103 @@ namespace FFXIVClassic_Map_Server.Actors { return zoneId; } + + public void LookAt(Actor actor) + { + if (actor != null && actor != this) + { + LookAt(actor.positionX, actor.positionZ); + } + else + { + Program.Log.Error("[{0}][{1}] Actor.LookAt() unable to find actor!", actorId, actorName); + } + } + + public void LookAt(Vector3 pos) + { + if (pos != null) + { + LookAt(pos.X, pos.Z); + } + } + + public void LookAt(float x, float z) + { + var rot1 = this.rotation; + + var dX = this.positionX - x; + var dY = this.positionZ - z; + var rot2 = Math.Atan2(dY, dX); + var dRot = Math.PI - rot2 + Math.PI / 2; + + // pending move, dont need to unset it + this.updateFlags |= ActorUpdateFlags.Position; + rotation = (float)dRot; + } + + // todo: is this legit? + public bool IsFacing(float x, float z, float angle = 90.0f) + { + angle = (float)(Math.PI * angle / 180); + var a = Vector3.GetAngle(positionX, positionZ, x, z); + return new Vector3(x, 0, z).IsWithinCone(GetPosAsVector3(), rotation, angle); + } + + public bool IsFacing(Actor target, float angle = 40.0f) + { + if (target == null) + { + Program.Log.Error("[{0}][{1}] IsFacing no target!", actorId, actorName); + return false; + } + + return IsFacing(target.positionX, target.positionZ, angle); + } + + public void QueuePositionUpdate(Vector3 pos) + { + if (positionUpdates == null) + positionUpdates = new List(); + + positionUpdates.Add(pos); + this.updateFlags |= ActorUpdateFlags.Position; + } + + public void QueuePositionUpdate(float x, float y, float z) + { + QueuePositionUpdate(new Vector3(x, y, z)); + } + + public void ClearPositionUpdates() + { + positionUpdates.Clear(); + } + + public Vector3 FindRandomPoint(float x, float y, float z, float minRadius, float maxRadius) + { + var angle = Program.Random.NextDouble() * Math.PI * 2; + var radius = Math.Sqrt(Program.Random.NextDouble() * (maxRadius - minRadius)) + minRadius; + + return new Vector3(x + (float)(radius * Math.Cos(angle)), y, z + (float)(radius * Math.Sin(angle))); + } + + public Vector3 FindRandomPointAroundTarget(Actor target, float minRadius, float maxRadius) + { + if (target == null) + { + Program.Log.Error(String.Format("[{0} {1}] FindRandomPointAroundTarget: no target found!", this.actorId, this.customDisplayName)); + return GetPosAsVector3(); + } + return FindRandomPoint(target.positionX, target.positionY, target.positionZ, minRadius, maxRadius); + } + + public Vector3 FindRandomPointAroundActor(float minRadius, float maxRadius) + { + return FindRandomPoint(positionX, positionY, positionZ, minRadius, maxRadius); + } + #endregion + } } diff --git a/FFXIVClassic Map Server/actors/area/Area.cs b/FFXIVClassic Map Server/actors/area/Area.cs index 71ff41ee..1e3b5693 100644 --- a/FFXIVClassic Map Server/actors/area/Area.cs +++ b/FFXIVClassic Map Server/actors/area/Area.cs @@ -15,6 +15,7 @@ using System.Threading.Tasks; using FFXIVClassic_Map_Server.packets.send; using FFXIVClassic_Map_Server.actors.group; using FFXIVClassic_Map_Server.actors.director; +using FFXIVClassic_Map_Server.actors.chara.ai.controllers; namespace FFXIVClassic_Map_Server.Actors { @@ -103,59 +104,67 @@ namespace FFXIVClassic_Map_Server.Actors return subpackets; } + // todo: handle instance areas in derived class? (see virtuals) #region Actor Management public void AddActorToZone(Actor actor) { lock (mActorList) { + if (actor is Character) + ((Character)actor).ResetTempVars(); + if (!mActorList.ContainsKey(actor.actorId)) mActorList.Add(actor.actorId, actor); + + + int gridX = (int)actor.positionX / boundingGridSize; + int gridY = (int)actor.positionZ / boundingGridSize; + + gridX += halfWidth; + gridY += halfHeight; + + //Boundries + if (gridX < 0) + gridX = 0; + if (gridX >= numXBlocks) + gridX = numXBlocks - 1; + if (gridY < 0) + gridY = 0; + if (gridY >= numYBlocks) + gridY = numYBlocks - 1; + + lock (mActorBlock) + mActorBlock[gridX, gridY].Add(actor); } - - int gridX = (int)actor.positionX / boundingGridSize; - int gridY = (int)actor.positionZ / boundingGridSize; - - gridX += halfWidth; - gridY += halfHeight; - - //Boundries - if (gridX < 0) - gridX = 0; - if (gridX >= numXBlocks) - gridX = numXBlocks - 1; - if (gridY < 0) - gridY = 0; - if (gridY >= numYBlocks) - gridY = numYBlocks - 1; - - lock (mActorBlock) - mActorBlock[gridX, gridY].Add(actor); } public void RemoveActorFromZone(Actor actor) { - lock (mActorList) - mActorList.Remove(actor.actorId); + if (actor != null) + lock (mActorList) + { + mActorList.Remove(actor.actorId); - int gridX = (int)actor.positionX / boundingGridSize; - int gridY = (int)actor.positionZ / boundingGridSize; + int gridX = (int)actor.positionX / boundingGridSize; + int gridY = (int)actor.positionZ / boundingGridSize; - gridX += halfWidth; - gridY += halfHeight; + gridX += halfWidth; + gridY += halfHeight; - //Boundries - if (gridX < 0) - gridX = 0; - if (gridX >= numXBlocks) - gridX = numXBlocks - 1; - if (gridY < 0) - gridY = 0; - if (gridY >= numYBlocks) - gridY = numYBlocks - 1; + //Boundries + if (gridX < 0) + gridX = 0; + if (gridX >= numXBlocks) + gridX = numXBlocks - 1; + if (gridY < 0) + gridY = 0; + if (gridY >= numYBlocks) + gridY = numYBlocks - 1; - lock (mActorBlock) - mActorBlock[gridX, gridY].Remove(actor); + lock (mActorBlock) + mActorBlock[gridX, gridY].Remove(actor); + } } public void UpdateActorPosition(Actor actor) @@ -203,12 +212,12 @@ namespace FFXIVClassic_Map_Server.Actors } } - public List GetActorsAroundPoint(float x, float y, int checkDistance) + public virtual List GetActorsAroundPoint(float x, float y, int checkDistance) where T : Actor { checkDistance /= boundingGridSize; - int gridX = (int)x/boundingGridSize; - int gridY = (int)y/boundingGridSize; + int gridX = (int)x / boundingGridSize; + int gridY = (int)y / boundingGridSize; gridX += halfWidth; gridY += halfHeight; @@ -223,7 +232,7 @@ namespace FFXIVClassic_Map_Server.Actors if (gridY >= numYBlocks) gridY = numYBlocks - 1; - List result = new List(); + List result = new List(); lock (mActorBlock) { @@ -231,7 +240,7 @@ namespace FFXIVClassic_Map_Server.Actors { for (int gy = gridY - checkDistance; gy <= gridY + checkDistance; gy++) { - result.AddRange(mActorBlock[gx, gy]); + result.AddRange(mActorBlock[gx, gy].OfType()); } } } @@ -245,11 +254,20 @@ namespace FFXIVClassic_Map_Server.Actors result.RemoveAt(i); } } - return result; } - public List GetActorsAroundActor(Actor actor, int checkDistance) + public virtual List GetActorsAroundPoint(float x, float y, int checkDistance) + { + return GetActorsAroundPoint(x, y, checkDistance); + } + + public virtual List GetActorsAroundActor(Actor actor, int checkDistance) + { + return GetActorsAroundActor(actor, checkDistance); + } + + public virtual List GetActorsAroundActor(Actor actor, int checkDistance) where T : Actor { checkDistance /= boundingGridSize; @@ -269,7 +287,7 @@ namespace FFXIVClassic_Map_Server.Actors if (gridY >= numYBlocks) gridY = numYBlocks - 1; - List result = new List(); + var result = new List(); lock (mActorBlock) { @@ -277,7 +295,7 @@ namespace FFXIVClassic_Map_Server.Actors { for (int gx = ((gridX - checkDistance) < 0 ? 0 : (gridX - checkDistance)); gx <= ((gridX + checkDistance) >= numXBlocks ? numXBlocks - 1 : (gridX + checkDistance)); gx++) { - result.AddRange(mActorBlock[gx, gy]); + result.AddRange(mActorBlock[gx, gy].OfType()); } } } @@ -307,6 +325,11 @@ namespace FFXIVClassic_Map_Server.Actors } } + public T FindActorInArea(uint id) where T : Actor + { + return FindActorInArea(id) as T; + } + public Actor FindActorInZoneByUniqueID(string uniqueId) { lock (mActorList) @@ -327,13 +350,10 @@ namespace FFXIVClassic_Map_Server.Actors { lock (mActorList) { - foreach (Actor a in mActorList.Values) + foreach (Player player in mActorList.Values.OfType()) { - if (a is Player) - { - if (((Player)a).customDisplayName.ToLower().Equals(name.ToLower())) - return (Player)a; - } + if (player.customDisplayName.ToLower().Equals(name.ToLower())) + return player; } return null; } @@ -368,6 +388,45 @@ namespace FFXIVClassic_Map_Server.Actors } } + // todo: for zones override this to search contentareas (assuming flag is passed) + public virtual List GetAllActors() where T : Actor + { + lock (mActorList) + { + List actorList = new List(mActorList.Count); + actorList.AddRange(mActorList.Values.OfType()); + return actorList; + } + } + + public int GetActorCount() + { + lock (mActorList) + { + return mActorList.Count; + } + } + + public virtual List GetAllActors() + { + return GetAllActors(); + } + + public virtual List GetPlayers() + { + return GetAllActors(); + } + + public virtual List GetMonsters() + { + return GetAllActors(); + } + + public virtual List GetAllies() + { + return GetAllActors(); + } + public void BroadcastPacketsAroundActor(Actor actor, List packets) { foreach (SubPacket packet in packets) @@ -384,7 +443,7 @@ namespace FFXIVClassic_Map_Server.Actors { if (a is Player) { - if (isIsolated && packet.header.sourceId != a.actorId) + if (isIsolated) continue; SubPacket clonedPacket = new SubPacket(packet, a.actorId); @@ -396,69 +455,95 @@ namespace FFXIVClassic_Map_Server.Actors public void SpawnActor(SpawnLocation location) { - ActorClass actorClass = Server.GetWorldManager().GetActorClass(location.classId); - - if (actorClass == null) - return; + lock (mActorList) + { + ActorClass actorClass = Server.GetWorldManager().GetActorClass(location.classId); - uint zoneId; + if (actorClass == null) + return; - if (this is PrivateArea) - zoneId = ((PrivateArea)this).GetParentZone().actorId; - else - zoneId = actorId; + uint zoneId; - Npc npc = new Npc(mActorList.Count + 1, actorClass, location.uniqueId, this, location.x, location.y, location.z, location.rot, location.state, location.animId, null); + if (this is PrivateArea) + zoneId = ((PrivateArea)this).GetParentZone().actorId; + else + zoneId = actorId; - npc.LoadEventConditions(actorClass.eventConditions); + Npc npc = new Npc(mActorList.Count + 1, actorClass, location.uniqueId, this, location.x, location.y, location.z, location.rot, location.state, location.animId, null); - AddActorToZone(npc); + + npc.LoadEventConditions(actorClass.eventConditions); + + AddActorToZone(npc); + } } - public Npc SpawnActor(uint classId, string uniqueId, float x, float y, float z, float rot = 0, ushort state = 0, uint animId = 0) + public Npc SpawnActor(uint classId, string uniqueId, float x, float y, float z, float rot = 0, ushort state = 0, uint animId = 0, bool isMob = false) { - ActorClass actorClass = Server.GetWorldManager().GetActorClass(classId); + lock (mActorList) + { + ActorClass actorClass = Server.GetWorldManager().GetActorClass(classId); - if (actorClass == null) - return null; + if (actorClass == null) + return null; - uint zoneId; + uint zoneId; + if (this is PrivateArea) + zoneId = ((PrivateArea)this).GetParentZone().actorId; + else + zoneId = actorId; - if (this is PrivateArea) - zoneId = ((PrivateArea)this).GetParentZone().actorId; - else - zoneId = actorId; + Npc npc; + if (isMob) + npc = new BattleNpc(mActorList.Count + 1, actorClass, uniqueId, this, x, y, z, rot, state, animId, null); + else + npc = new Npc(mActorList.Count + 1, actorClass, uniqueId, this, x, y, z, rot, state, animId, null); - Npc npc = new Npc(mActorList.Count + 1, actorClass, uniqueId, this, x, y, z, rot, state, animId, null); + npc.LoadEventConditions(actorClass.eventConditions); + npc.SetMaxHP(100); + npc.SetHP(100); + npc.ResetMoveSpeeds(); - npc.LoadEventConditions(actorClass.eventConditions); + AddActorToZone(npc); - AddActorToZone(npc); - - return npc; + return npc; + } } public Npc SpawnActor(uint classId, string uniqueId, float x, float y, float z, uint regionId, uint layoutId) { - ActorClass actorClass = Server.GetWorldManager().GetActorClass(classId); + lock (mActorList) + { + ActorClass actorClass = Server.GetWorldManager().GetActorClass(classId); - if (actorClass == null) - return null; + if (actorClass == null) + return null; - uint zoneId; + uint zoneId; - if (this is PrivateArea) - zoneId = ((PrivateArea)this).GetParentZone().actorId; - else - zoneId = actorId; + if (this is PrivateArea) + zoneId = ((PrivateArea)this).GetParentZone().actorId; + else + zoneId = actorId; - Npc npc = new Npc(mActorList.Count + 1, actorClass, uniqueId, this, x, y, z, 0, regionId, layoutId); + Npc npc = new Npc(mActorList.Count + 1, actorClass, uniqueId, this, x, y, z, 0, regionId, layoutId); - npc.LoadEventConditions(actorClass.eventConditions); + npc.LoadEventConditions(actorClass.eventConditions); - AddActorToZone(npc); + AddActorToZone(npc); - return npc; + return npc; + } + } + + public BattleNpc GetBattleNpcById(uint id) + { + foreach (var bnpc in GetAllActors()) + { + if (bnpc.GetBattleNpcId() == id) + return bnpc; + } + return null; } public void DespawnActor(string uniqueId) @@ -579,12 +664,18 @@ namespace FFXIVClassic_Map_Server.Actors return null; } - public void Update(double deltaTime) + public override void Update(DateTime tick) { lock (mActorList) { - foreach (Actor a in mActorList.Values) - a.Update(deltaTime); + foreach (Actor a in mActorList.Values.ToList()) + a.Update(tick); + + if ((tick - lastUpdateScript).TotalMilliseconds > 1500) + { + //LuaEngine.GetInstance().CallLuaFunctionForReturn(LuaEngine.GetScriptPath(this), "onUpdate", true, this, tick); + lastUpdateScript = tick; + } } } diff --git a/FFXIVClassic Map Server/actors/area/PrivateAreaContent.cs b/FFXIVClassic Map Server/actors/area/PrivateAreaContent.cs index 4cece65c..d97b7efc 100644 --- a/FFXIVClassic Map Server/actors/area/PrivateAreaContent.cs +++ b/FFXIVClassic Map Server/actors/area/PrivateAreaContent.cs @@ -40,17 +40,20 @@ namespace FFXIVClassic_Map_Server.actors.area public void CheckDestroy() { - if (isContentFinished) + lock (mActorList) { - bool noPlayersLeft = true; - foreach (Actor a in mActorList.Values) + if (isContentFinished) { - if (a is Player) - noPlayersLeft = false; + bool noPlayersLeft = true; + foreach (Actor a in mActorList.Values) + { + if (a is Player) + noPlayersLeft = false; + } + if (noPlayersLeft) + GetParentZone().DeleteContentArea(this); } - if (noPlayersLeft) - GetParentZone().DeleteContentArea(this); - } + } } } diff --git a/FFXIVClassic Map Server/actors/area/Zone.cs b/FFXIVClassic Map Server/actors/area/Zone.cs index 16ee73e7..d198fff5 100644 --- a/FFXIVClassic Map Server/actors/area/Zone.cs +++ b/FFXIVClassic Map Server/actors/area/Zone.cs @@ -10,6 +10,8 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.IO; + using FFXIVClassic_Map_Server.actors.director; namespace FFXIVClassic_Map_Server.actors.area @@ -20,10 +22,31 @@ namespace FFXIVClassic_Map_Server.actors.area Dictionary> contentAreas = new Dictionary>(); Object contentAreasLock = new Object(); - public Zone(uint id, string zoneName, ushort regionId, string classPath, ushort bgmDay, ushort bgmNight, ushort bgmBattle, bool isIsolated, bool isInn, bool canRideChocobo, bool canStealth, bool isInstanceRaid) + public SharpNav.TiledNavMesh tiledNavMesh; + public SharpNav.NavMeshQuery navMeshQuery; + + public Int64 pathCalls; + public Int64 prevPathCalls = 0; + public Int64 pathCallTime; + + public Zone(uint id, string zoneName, ushort regionId, string classPath, ushort bgmDay, ushort bgmNight, ushort bgmBattle, bool isIsolated, bool isInn, bool canRideChocobo, bool canStealth, bool isInstanceRaid, bool loadNavMesh = false) : base(id, zoneName, regionId, classPath, bgmDay, bgmNight, bgmBattle, isIsolated, isInn, canRideChocobo, canStealth, isInstanceRaid) { + if (loadNavMesh) + { + try + { + tiledNavMesh = utils.NavmeshUtils.LoadNavmesh(tiledNavMesh, zoneName + ".snb"); + navMeshQuery = new SharpNav.NavMeshQuery(tiledNavMesh, 100); + if (tiledNavMesh != null && tiledNavMesh.Tiles[0].PolyCount > 0) + Program.Log.Info($"Loaded navmesh for {zoneName}"); + } + catch (Exception e) + { + Program.Log.Error(e.Message); + } + } } public void AddPrivateArea(PrivateArea pa) @@ -97,21 +120,36 @@ namespace FFXIVClassic_Map_Server.actors.area public Actor FindActorInZone(uint id) { - if (!mActorList.ContainsKey(id)) + lock (mActorList) { - foreach(Dictionary paList in privateAreas.Values) + if (!mActorList.ContainsKey(id)) { - foreach(PrivateArea pa in paList.Values) + foreach (Dictionary paList in privateAreas.Values) { - Actor actor = pa.FindActorInArea(id); - if (actor != null) - return actor; + foreach (PrivateArea pa in paList.Values) + { + Actor actor = pa.FindActorInArea(id); + if (actor != null) + return actor; + } } + + foreach (List paList in contentAreas.Values) + { + foreach (PrivateArea pa in paList) + { + Actor actor = pa.FindActorInArea(id); + if (actor != null) + return actor; + } + } + + + return null; } - return null; + else + return mActorList[id]; } - else - return mActorList[id]; } public PrivateAreaContent CreateContentArea(Player starterPlayer, string areaClassPath, string contentScript, string areaName, string directorName, params object[] args) @@ -127,6 +165,7 @@ namespace FFXIVClassic_Map_Server.actors.area contentAreas.Add(areaName, new List()); PrivateAreaContent contentArea = new PrivateAreaContent(this, classPath, areaName, 1, director, starterPlayer); contentAreas[areaName].Add(contentArea); + return contentArea; } } @@ -139,5 +178,30 @@ namespace FFXIVClassic_Map_Server.actors.area } } + public override void Update(DateTime tick) + { + base.Update(tick); + + foreach (var a in privateAreas.Values) + foreach(var b in a.Values) + b.Update(tick); + + foreach (var a in contentAreas.Values) + foreach (var b in a) + b.Update(tick); + + // todo: again, this is retarded but debug stuff + var diffTime = tick - lastUpdate; + + if (diffTime.TotalSeconds >= 10) + { + if (this.pathCalls > 0) + { + Program.Log.Debug("Number of pathfinding calls {0} average time {1}ms. {2} this tick", pathCalls, (float)(pathCallTime / pathCalls), pathCalls - prevPathCalls); + prevPathCalls = pathCalls; + } + lastUpdate = tick; + } + } } } diff --git a/FFXIVClassic Map Server/actors/chara/BattleSave.cs b/FFXIVClassic Map Server/actors/chara/BattleSave.cs index bf9a6000..8d2928e4 100644 --- a/FFXIVClassic Map Server/actors/chara/BattleSave.cs +++ b/FFXIVClassic Map Server/actors/chara/BattleSave.cs @@ -5,7 +5,7 @@ public float potencial = 6.6f; public short[] skillLevel = new short[52]; public short[] skillLevelCap = new short[52]; - public short[] skillPoint = new short[52]; + public int[] skillPoint = new int[52]; public short physicalLevel; public int physicalExp; diff --git a/FFXIVClassic Map Server/actors/chara/BattleTemp.cs b/FFXIVClassic Map Server/actors/chara/BattleTemp.cs index 0d1c861f..9f46b35f 100644 --- a/FFXIVClassic Map Server/actors/chara/BattleTemp.cs +++ b/FFXIVClassic Map Server/actors/chara/BattleTemp.cs @@ -2,10 +2,11 @@ { class BattleTemp { + //Are these right? public const uint NAMEPLATE_SHOWN = 0; public const uint TARGETABLE = 1; - //public const uint NAMEPLATE_SHOWN2 = 2; - public const uint NAMEPLATE_SHOWN2 = 3; + public const uint NAMEPLATE_SHOWN2 = 2; + //public const uint NAMEPLATE_SHOWN2 = 3; public const uint STAT_STRENGTH = 3; public const uint STAT_VITALITY = 4; @@ -25,13 +26,13 @@ public const uint STAT_ACCURACY = 15; public const uint STAT_NORMALDEFENSE = 18; public const uint STAT_EVASION = 16; - public const uint STAT_ATTACK_MAGIC = 24; - public const uint STAT_HEAL_MAGIC = 25; - public const uint STAT_ENCHANCEMENT_MAGIC_POTENCY = 26; - public const uint STAT_ENFEEBLING_MAGIC_POTENCY = 27; - - public const uint STAT_MAGIC_ACCURACY = 28; - public const uint STAT_MAGIC_EVASION = 29; + public const uint STAT_ATTACK_MAGIC = 23; + public const uint STAT_HEAL_MAGIC = 24; + public const uint STAT_ENCHANCEMENT_MAGIC_POTENCY = 25; + public const uint STAT_ENFEEBLING_MAGIC_POTENCY = 26; + + public const uint STAT_MAGIC_ACCURACY = 27; + public const uint STAT_MAGIC_EVASION = 28; public const uint STAT_CRAFT_PROCESSING = 30; public const uint STAT_CRAFT_MAGIC_PROCESSING = 31; @@ -43,6 +44,6 @@ public float[] castGauge_speed = { 1.0f, 0.25f}; public bool[] timingCommandFlag = new bool[4]; - public ushort[] generalParameter = new ushort[35]; + public short[] generalParameter = new short[35]; } } diff --git a/FFXIVClassic Map Server/actors/chara/CharaWork.cs b/FFXIVClassic Map Server/actors/chara/CharaWork.cs index 652178d6..45afc964 100644 --- a/FFXIVClassic Map Server/actors/chara/CharaWork.cs +++ b/FFXIVClassic Map Server/actors/chara/CharaWork.cs @@ -23,7 +23,7 @@ public uint[] command = new uint[64]; //ACTORS public byte[] commandCategory = new byte[64]; public byte commandBorder = 0x20; - public bool[] commandAcquired = new bool[4096]; + public bool[] commandAcquired = new bool[4096]; public bool[] additionalCommandAcquired = new bool[36]; public uint currentContentGroup; diff --git a/FFXIVClassic Map Server/actors/chara/Character.cs b/FFXIVClassic Map Server/actors/chara/Character.cs index 6d56209e..3aa4e0bc 100644 --- a/FFXIVClassic Map Server/actors/chara/Character.cs +++ b/FFXIVClassic Map Server/actors/chara/Character.cs @@ -1,14 +1,63 @@  using FFXIVClassic.Common; +using FFXIVClassic_Map_Server.actors.area; using FFXIVClassic_Map_Server.actors.group; using FFXIVClassic_Map_Server.Actors.Chara; using FFXIVClassic_Map_Server.packets.send.actor; using FFXIVClassic_Map_Server.utils; +using FFXIVClassic_Map_Server.actors.chara.ai; +using System; +using System.Collections.Generic; +using FFXIVClassic_Map_Server.actors.chara; +using FFXIVClassic_Map_Server.packets.send.actor.battle; +using FFXIVClassic_Map_Server.packets.send; +using FFXIVClassic_Map_Server.actors.chara.ai.state; +using FFXIVClassic_Map_Server.actors.chara.ai.utils; +using FFXIVClassic_Map_Server.actors.chara.npc; namespace FFXIVClassic_Map_Server.Actors { - class Character:Actor + /// Which Character types am I friendly with + enum CharacterTargetingAllegiance { + /// Friendly to BattleNpcs + BattleNpcs, + /// Friendly to Players + Player + } + + enum DamageTakenType + { + None, + Attack, + Magic, + Weaponskill, + Ability + } + + class Character : Actor + { + public const int CLASSID_PUG = 2; + public const int CLASSID_GLA = 3; + public const int CLASSID_MRD = 4; + public const int CLASSID_ARC = 7; + public const int CLASSID_LNC = 8; + public const int CLASSID_THM = 22; + public const int CLASSID_CNJ = 23; + + public const int CLASSID_CRP = 29; + public const int CLASSID_BSM = 30; + public const int CLASSID_ARM = 31; + public const int CLASSID_GSM = 32; + public const int CLASSID_LTW = 33; + public const int CLASSID_WVR = 34; + public const int CLASSID_ALC = 35; + public const int CLASSID_CUL = 36; + + public const int CLASSID_MIN = 39; + public const int CLASSID_BTN = 40; + public const int CLASSID_FSH = 41; + public const int SIZE = 0; public const int COLORINFO = 1; public const int FACEINFO = 2; @@ -40,13 +89,16 @@ namespace FFXIVClassic_Map_Server.Actors public bool isStatic = false; + public bool isMovingToSpawn = false; + public bool isAutoAttackEnabled = true; + public uint modelId; public uint[] appearanceIds = new uint[28]; public uint animationId = 0; - public uint currentTarget = 0xC0000000; - public uint currentLockedTarget = 0xC0000000; + public uint currentTarget = Actor.INVALID_ACTORID; + public uint currentLockedTarget = Actor.INVALID_ACTORID; public uint currentActorIcon = 0; @@ -56,11 +108,47 @@ namespace FFXIVClassic_Map_Server.Actors public Group currentParty = null; public ContentGroup currentContentGroup = null; + //public DateTime lastAiUpdate; + + public AIContainer aiContainer; + public StatusEffectContainer statusEffects; + + public CharacterTargetingAllegiance allegiance; + + public Pet pet; + + private Dictionary modifiers = new Dictionary(); + + protected ushort hpBase, hpMaxBase, mpBase, mpMaxBase, tpBase; + protected BattleTemp baseStats = new BattleTemp(); + public ushort currentJob; + public ushort newMainState; + public float spawnX, spawnY, spawnZ; + + //I needed some values I could reuse for random stuff, delete later + public int extraInt; + public uint extraUint; + public float extraFloat; + + protected Dictionary tempVars = new Dictionary(); + public Character(uint actorID) : base(actorID) - { + { //Init timer array to "notimer" for (int i = 0; i < charaWork.statusShownTime.Length; i++) - charaWork.statusShownTime[i] = 0xFFFFFFFF; + charaWork.statusShownTime[i] = 0; + + this.statusEffects = new StatusEffectContainer(this); + + // todo: move this somewhere more appropriate + // todo: base this on equip and shit + SetMod((uint)Modifier.AttackRange, 3); + SetMod((uint)Modifier.AttackDelay, (Program.Random.Next(30, 60) * 100)); + SetMod((uint)Modifier.Speed, (uint)moveSpeeds[2]); + + spawnX = positionX; + spawnY = positionY; + spawnZ = positionZ; } public SubPacket CreateAppearancePacket() @@ -71,7 +159,7 @@ namespace FFXIVClassic_Map_Server.Actors public SubPacket CreateInitStatusPacket() { - return (SetActorStatusAllPacket.BuildPacket(actorId, charaWork.status)); + return (SetActorStatusAllPacket.BuildPacket(actorId, charaWork.status)); } public SubPacket CreateSetActorIconPacket() @@ -79,9 +167,9 @@ namespace FFXIVClassic_Map_Server.Actors return SetActorIconPacket.BuildPacket(actorId, currentActorIcon); } - public SubPacket CreateIdleAnimationPacket() + public SubPacket CreateSubStatePacket() { - return SetActorSubStatPacket.BuildPacket(actorId, 0, 0, 0, 0, 0, 0, animationId); + return SetActorSubStatePacket.BuildPacket(actorId, currentSubState); } public void SetQuestGraphic(Player player, int graphicNum) @@ -99,13 +187,29 @@ namespace FFXIVClassic_Map_Server.Actors currentContentGroup = group; ActorPropertyPacketUtil propPacketUtil = new ActorPropertyPacketUtil("charaWork/currentContentGroup", this); - propPacketUtil.AddProperty("charaWork.currentContentGroup"); + propPacketUtil.AddProperty("charaWork.currentContentGroup"); zone.BroadcastPacketsAroundActor(this, propPacketUtil.Done()); + } + + //This logic isn't correct, order of GetStatusEffects() is not necessarily the same as the actual effects in game. Also sending every time at once isn't needed + public List GetActorStatusPackets() + { + var propPacketUtil = new ActorPropertyPacketUtil("charaWork/status", this); + var i = 0; + foreach (var effect in statusEffects.GetStatusEffects()) + { + if (!effect.GetHidden()) + { + propPacketUtil.AddProperty(String.Format("charaWork.statusShownTime[{0}]", i)); + propPacketUtil.AddProperty(String.Format("charaWork.statusShownTime[{0}]", i)); + i++; + } + } + return propPacketUtil.Done(); + } - } - public void PlayAnimation(uint animId, bool onlySelf = false) - { + { if (onlySelf) { if (this is Player) @@ -115,6 +219,919 @@ namespace FFXIVClassic_Map_Server.Actors zone.BroadcastPacketAroundActor(this, PlayAnimationOnActorPacket.BuildPacket(actorId, animId)); } - } + public void DoBattleAction(ushort commandId, uint animationId) + { + zone.BroadcastPacketAroundActor(this, CommandResultX00Packet.BuildPacket(actorId, animationId, commandId)); + } -} + public void DoBattleAction(ushort commandId, uint animationId, CommandResult result) + { + zone.BroadcastPacketAroundActor(this, CommandResultX01Packet.BuildPacket(actorId, animationId, commandId, result)); + } + + public void DoBattleAction(ushort commandId, uint animationId, CommandResult[] results) + { + int currentIndex = 0; + //AoE abilities only ever hit 16 people, so we probably won't need this loop anymore + //Apparently aoe are limited to 8? + while (true) + { + if (results.Length - currentIndex >= 10) + zone.BroadcastPacketAroundActor(this, CommandResultX18Packet.BuildPacket(actorId, animationId, commandId, results, ref currentIndex)); + else if (results.Length - currentIndex > 1) + zone.BroadcastPacketAroundActor(this, CommandResultX10Packet.BuildPacket(actorId, animationId, commandId, results, ref currentIndex)); + else if (results.Length - currentIndex == 1) + { + zone.BroadcastPacketAroundActor(this, CommandResultX01Packet.BuildPacket(actorId, animationId, commandId, results[currentIndex])); + currentIndex++; + } + else + break; + + //I think aoe effects play on all hit enemies. Firaga does at least + //animationId = 0; //If more than one packet is sent out, only send the animation once to avoid double playing. + } + } + + public void DoBattleAction(ushort commandId, uint animationId, List results) + { + int currentIndex = 0; + + while (true) + { + if (results.Count - currentIndex >= 10) + zone.BroadcastPacketAroundActor(this, CommandResultX18Packet.BuildPacket(actorId, animationId, commandId, results, ref currentIndex)); + else if (results.Count - currentIndex > 1) + zone.BroadcastPacketAroundActor(this, CommandResultX10Packet.BuildPacket(actorId, animationId, commandId, results, ref currentIndex)); + else if (results.Count - currentIndex == 1) + { + zone.BroadcastPacketAroundActor(this, CommandResultX01Packet.BuildPacket(actorId, animationId, commandId, results[currentIndex])); + currentIndex++; + } + else + break; + + //Sending multiple packets at once causes some issues. Setting any combination of these to zero changes what breaks + //animationId = 0; //If more than one packet is sent out, only send the animation once to avoid double playing. + //commandId = 0; + //sourceActorId = 0; + } + } + + #region ai stuff + public void PathTo(float x, float y, float z, float stepSize = 0.70f, int maxPath = 40, float polyRadius = 0.0f) + { + if (aiContainer != null && aiContainer.pathFind != null) + aiContainer.pathFind.PreparePath(x, y, z, stepSize, maxPath, polyRadius); + } + + public void FollowTarget(Actor target, float stepSize = 1.2f, int maxPath = 25, float radius = 0.0f) + { + if (target != null) + PathTo(target.positionX, target.positionY, target.positionZ, stepSize, maxPath, radius); + } + + public double GetMod(Modifier modifier) + { + return GetMod((uint)modifier); + } + + public double GetMod(uint modifier) + { + double res; + if (modifiers.TryGetValue((Modifier)modifier, out res)) + return res; + return 0; + } + + public void SetMod(uint modifier, double val) + { + if (modifiers.ContainsKey((Modifier)modifier)) + modifiers[(Modifier)modifier] = val; + else + modifiers.Add((Modifier)modifier, val); + + if (modifier <= 35) + updateFlags |= ActorUpdateFlags.Stats; + } + + public void AddMod(Modifier modifier, double val) + { + AddMod((uint)modifier, val); + } + + public void AddMod(uint modifier, double val) + { + + double newVal = GetMod(modifier) + val; + SetMod(modifier, newVal); + } + + public void SubtractMod(Modifier modifier, double val) + { + AddMod((uint)modifier, val); + } + + public void SubtractMod(uint modifier, double val) + { + double newVal = GetMod(modifier) - val; + SetMod(modifier, newVal); + } + + public virtual void OnPath(Vector3 point) + { + //lua.LuaEngine.CallLuaBattleFunction(this, "onPath", this, point); + + updateFlags |= ActorUpdateFlags.Position; + this.isAtSpawn = false; + } + + public override void Update(DateTime tick) + { + + } + + public override void PostUpdate(DateTime tick, List packets = null) + { + if (updateFlags != ActorUpdateFlags.None) + { + packets = packets ?? new List(); + + if ((updateFlags & ActorUpdateFlags.Appearance) != 0) + { + packets.Add(new SetActorAppearancePacket(modelId, appearanceIds).BuildPacket(actorId)); + } + + if ((updateFlags & ActorUpdateFlags.State) != 0) + { + packets.Add(SetActorStatePacket.BuildPacket(actorId, currentMainState, 0x0)); + packets.Add(CommandResultX00Packet.BuildPacket(actorId, 0x72000062, 0)); + packets.Add(CommandResultX01Packet.BuildPacket(actorId, 0x7C000062, 21001, new CommandResult(actorId, 0, 1))); + + updateFlags &= ~ActorUpdateFlags.State; + //DoBattleAction(21001, 0x7C000062, new BattleAction(this.actorId, 0, 1, 0, 0, 1)); //Attack Mode + } + + if ((updateFlags & ActorUpdateFlags.SubState) != 0) + { + //packets.Add(SetActorSubStatePacket.BuildPacket(actorId, currentSubState)); + //packets.Add(CommandResultX00Packet.BuildPacket(actorId, 0x72000062, 0)); + //packets.Add(CommandResultX01Packet.BuildPacket(actorId, 0x7C000062, 21001, new CommandResult(actorId, 0, 1))); + + updateFlags &= ~ActorUpdateFlags.SubState; + //DoBattleAction(21001, 0x7C000062, new BattleAction(this.actorId, 0, 1, 0, 0, 1)); //Attack Mode + } + + if ((updateFlags & ActorUpdateFlags.Status) != 0) + { + List statusPackets = statusEffects.GetStatusPackets(); + packets.AddRange(statusPackets); + statusPackets.Clear(); + updateFlags &= ~ActorUpdateFlags.Status; + } + + if ((updateFlags & ActorUpdateFlags.StatusTime) != 0) + { + packets.AddRange(statusEffects.GetStatusTimerPackets()); + statusEffects.ResetPropPacketUtil(); + updateFlags &= ~ActorUpdateFlags.StatusTime; + } + + if ((updateFlags & ActorUpdateFlags.HpTpMp) != 0) + { + var propPacketUtil = new ActorPropertyPacketUtil("charaWork/stateAtQuicklyForAll", this); + propPacketUtil.AddProperty("charaWork.parameterSave.hp[0]"); + propPacketUtil.AddProperty("charaWork.parameterSave.hpMax[0]"); + propPacketUtil.AddProperty("charaWork.parameterSave.mp"); + propPacketUtil.AddProperty("charaWork.parameterSave.mpMax"); + propPacketUtil.AddProperty("charaWork.parameterTemp.tp"); + packets.AddRange(propPacketUtil.Done()); + } + + base.PostUpdate(tick, packets); + } + } + + public virtual bool IsValidTarget(Character target, ValidTarget validTarget) + { + return !target.isStatic; + } + + public virtual bool CanAttack() + { + return true; + } + + public virtual bool CanCast(Character target, BattleCommand spell) + { + return false; + } + + public virtual bool CanWeaponSkill(Character target, BattleCommand skill) + { + return false; + } + + public virtual bool CanUseAbility(Character target, BattleCommand ability) + { + return false; + } + + public virtual uint GetAttackDelayMs() + { + return (uint)GetMod((uint)Modifier.AttackDelay); + } + + public virtual uint GetAttackRange() + { + return (uint)(GetMod((uint)Modifier.AttackRange) == 0 ? 3 : GetMod((uint)Modifier.AttackRange)); + } + + public virtual bool Engage(uint targid = 0, ushort newMainState = 0xFFFF) + { + // todo: attack the things + /*if (newMainState != 0xFFFF) + { + currentMainState = newMainState;// this.newMainState = newMainState; + updateFlags |= ActorUpdateFlags.State; + } + else*/ if (aiContainer.CanChangeState()) + { + if (targid == 0) + { + if (currentTarget != Actor.INVALID_ACTORID) + targid = currentTarget; + else if (currentLockedTarget != Actor.INVALID_ACTORID) + targid = currentLockedTarget; + } + //if (targid != 0) + { + aiContainer.Engage(zone.FindActorInArea(targid)); + } + } + + return false; + } + + public virtual bool Engage(Character target) + { + aiContainer.Engage(target); + return false; + } + + public virtual bool Disengage(ushort newMainState = 0xFFFF) + { + /*if (newMainState != 0xFFFF) + { + currentMainState = newMainState;// this.newMainState = newMainState; + updateFlags |= ActorUpdateFlags.State; + } + else*/ if (IsEngaged()) + { + aiContainer.Disengage(); + return true; + } + return false; + } + + public virtual void Cast(uint spellId, uint targetId = 0) + { + if (aiContainer.CanChangeState()) + aiContainer.Cast(zone.FindActorInArea(targetId == 0 ? currentTarget : targetId), spellId); + } + + public virtual void Ability(uint abilityId, uint targetId = 0) + { + if (aiContainer.CanChangeState()) + aiContainer.Ability(zone.FindActorInArea(targetId == 0 ? currentTarget : targetId), abilityId); + } + + public virtual void WeaponSkill(uint skillId, uint targetId = 0) + { + if (aiContainer.CanChangeState()) + aiContainer.WeaponSkill(zone.FindActorInArea(targetId == 0 ? currentTarget : targetId), skillId); + } + + public virtual void Spawn(DateTime tick) + { + aiContainer.Reset(); + // todo: reset hp/mp/tp etc here + ChangeState(SetActorStatePacket.MAIN_STATE_PASSIVE); + charaWork.parameterSave.hp = charaWork.parameterSave.hpMax; + charaWork.parameterSave.mp = charaWork.parameterSave.mpMax; + RecalculateStats(); + } + + //AdditionalActions is the list of actions that EXP/Chain messages are added to + public virtual void Die(DateTime tick, CommandResultContainer actionContainer = null) + { + // todo: actual despawn timer + aiContainer.InternalDie(tick, 10); + ChangeSpeed(0.0f, 0.0f, 0.0f, 0.0f); + } + + public virtual void Despawn(DateTime tick) + { + + } + + public bool IsDead() + { + return !IsAlive(); + } + + public bool IsAlive() + { + return !aiContainer.IsDead();// && GetHP() > 0; + } + + public short GetHP() + { + // todo: + return charaWork.parameterSave.hp[0]; + } + + public short GetMaxHP() + { + return charaWork.parameterSave.hpMax[0]; + } + + public short GetMP() + { + return charaWork.parameterSave.mp; + } + + public ushort GetTP() + { + return tpBase; + } + + public short GetMaxMP() + { + return charaWork.parameterSave.mpMax; + } + + public byte GetMPP() + { + return (byte)((charaWork.parameterSave.mp / charaWork.parameterSave.mpMax) * 100); + } + + public byte GetTPP() + { + return (byte)((tpBase / 3000) * 100); + } + + public byte GetHPP() + { + return (byte)(charaWork.parameterSave.hp[0] == 0 ? 0 : (charaWork.parameterSave.hp[0] / (float) charaWork.parameterSave.hpMax[0]) * 100); + } + + public void SetHP(uint hp) + { + charaWork.parameterSave.hp[0] = (short)hp; + if (hp > charaWork.parameterSave.hpMax[0]) + SetMaxHP(hp); + + updateFlags |= ActorUpdateFlags.HpTpMp; + } + + public void SetMaxHP(uint hp) + { + charaWork.parameterSave.hpMax[0] = (short)hp; + updateFlags |= ActorUpdateFlags.HpTpMp; + } + + public void SetMP(uint mp) + { + charaWork.parameterSave.mpMax = (short)mp; + if (mp > charaWork.parameterSave.hpMax[0]) + SetMaxMP(mp); + + updateFlags |= ActorUpdateFlags.HpTpMp; + } + + public void SetMaxMP(uint mp) + { + charaWork.parameterSave.mp = (short)mp; + updateFlags |= ActorUpdateFlags.HpTpMp; + } + // todo: the following functions are virtuals since we want to check hidden item bonuses etc on player for certain conditions + public virtual void AddHP(int hp) + { + // dont wanna die ded, don't want to send update if hp isn't actually changed + if (IsAlive() && hp != 0) + { + // todo: +/- hp and die + // todo: battlenpcs probably have way more hp? + var addHp = charaWork.parameterSave.hp[0] + hp; + addHp = addHp.Clamp((short)GetMod((uint)Modifier.MinimumHpLock), charaWork.parameterSave.hpMax[0]); + charaWork.parameterSave.hp[0] = (short)addHp; + + updateFlags |= ActorUpdateFlags.HpTpMp; + } + } + + public short GetClass() + { + return charaWork.parameterSave.state_mainSkill[0]; + } + + public short GetLevel() + { + return charaWork.parameterSave.state_mainSkillLevel; + } + + public void AddMP(int mp) + { + if (IsAlive() && mp != 0) + { + charaWork.parameterSave.mp = (short)(charaWork.parameterSave.mp + mp).Clamp(ushort.MinValue, charaWork.parameterSave.mpMax); + + // todo: check hidden effects and shit + + updateFlags |= ActorUpdateFlags.HpTpMp; + } + } + + public void AddTP(int tp) + { + if (IsAlive() && tp != 0) + { + var addTp = charaWork.parameterTemp.tp + tp; + + addTp = addTp.Clamp((int) GetMod(Modifier.MinimumTpLock), 3000); + charaWork.parameterTemp.tp = (short) addTp; + tpBase = (ushort)charaWork.parameterTemp.tp; + updateFlags |= ActorUpdateFlags.HpTpMp; + + if (tpBase >= 1000) + lua.LuaEngine.GetInstance().OnSignal("tpOver1000"); + } + } + + public void DelHP(int hp) + { + AddHP((short)-hp); + } + + public void DelMP(int mp) + { + AddMP(-mp); + } + + public void DelTP(int tp) + { + AddTP(-tp); + } + + virtual public void CalculateBaseStats() + { + // todo: apply mods and shit here, get race/level/job and shit + uint hpMod = (uint) GetMod((uint)Modifier.Hp); + if (hpMod != 0) + { + SetMaxHP(hpMod); + uint hpp = (uint) GetMod((uint) Modifier.HpPercent); + uint hp = hpMod; + if(hpp != 0) + { + hp = (uint) Math.Ceiling(((float)hpp / 100.0f) * hpMod); + } + SetHP(hp); + } + + uint mpMod = (uint)GetMod((uint)Modifier.Mp); + if (mpMod != 0) + { + SetMaxMP(mpMod); + uint mpp = (uint)GetMod((uint)Modifier.MpPercent); + uint mp = mpMod; + if (mpp != 0) + { + mp = (uint)Math.Ceiling(((float)mpp / 100.0f) * mpMod); + } + SetMP(mp); + } + // todo: recalculate stats and crap + updateFlags |= ActorUpdateFlags.HpTpMp; + + + SetMod((uint)Modifier.HitCount, 1); + } + + public void RecalculateStats() + { + //CalculateBaseStats(); + } + + public void SetStat(uint statId, int val) + { + charaWork.battleTemp.generalParameter[statId] = (short)val; + } + + public short GetStat(uint statId) + { + return charaWork.battleTemp.generalParameter[statId]; + } + + public virtual float GetSpeed() + { + // todo: for battlenpc/player calculate speed + return (float) GetMod((uint)Modifier.Speed); + } + + public virtual void OnAttack(State state, CommandResult action, ref CommandResult error) + { + var target = state.GetTarget(); + // todo: change animation based on equipped weapon + // todo: get hitrate and shit, handle protect effect and whatever + if (BattleUtils.TryAttack(this, target, action, ref error)) + { + //var packet = BattleActionX01Packet.BuildPacket(owner.actorId, owner.actorId, target.actorId, (uint)0x19001000, (uint)0x8000604, (ushort)0x765D, (ushort)BattleActionX01PacketCommand.Attack, (ushort)damage, (byte)0x1); + } + + // todo: call onAttack/onDamageTaken + //BattleUtils.DamageTarget(this, target, DamageTakenType.Attack, action); + AddTP(200); + target.AddTP(100); + } + + public virtual void OnCast(State state, CommandResult[] actions, BattleCommand spell, ref CommandResult[] errors) + { + // damage is handled in script + var spellCost = spell.CalculateMpCost(this); + this.DelMP(spellCost); // mpCost can be set in script e.g. if caster has something for free spells + + foreach (CommandResult action in actions) + { + if (zone.FindActorInArea(action.targetId) is Character) + { + //BattleUtils.HandleHitType(this, chara, action); + //BattleUtils.DoAction(this, chara, action, DamageTakenType.Magic); + } + } + lua.LuaEngine.GetInstance().OnSignal("spellUsed"); + } + + public virtual void OnWeaponSkill(State state, CommandResult[] actions, BattleCommand skill, ref CommandResult[] errors) + { + // damage is handled in script + + foreach (CommandResult action in actions) + { + //Should we just store the character insteado f having to find it again? + if (zone.FindActorInArea(action.targetId) is Character) + { + //BattleUtils.DoAction(this, chara, action, DamageTakenType.Weaponskill); + } + } + + this.DelTP(skill.tpCost); + } + + public virtual void OnAbility(State state, CommandResult[] actions, BattleCommand ability, ref CommandResult[] errors) + { + foreach (var action in actions) + { + if (zone.FindActorInArea(action.targetId) is Character) + { + //BattleUtils.DoAction(this, chara, action, DamageTakenType.Ability); + } + } + } + + public virtual void OnSpawn() + { + + } + + public virtual void OnDeath() + { + + } + + public virtual void OnDespawn() + { + + } + + public virtual void OnDamageDealt(Character defender, CommandResult action, CommandResultContainer actionContainer = null) + { + switch (action.hitType) + { + case (HitType.Miss): + OnMiss(this, action, actionContainer); + break; + default: + OnHit(defender, action, actionContainer); + break; + } + + //TP is only gained from autoattacks and abilities + if (action.commandType == CommandType.AutoAttack || action.commandType == CommandType.Ability) + { + //TP gained on an attack is usually 100 * delay. + //Store TP seems to add .1% per point. + double weaponDelay = GetMod(Modifier.AttackDelay) / 1000.0; + var storeTPPercent = 1 + (GetMod(Modifier.StoreTP) * 0.001); + AddTP((int)(weaponDelay * 100 * storeTPPercent)); + } + } + + public virtual void OnDamageTaken(Character attacker, CommandResult action, CommandResultContainer actionContainer = null) + { + switch (action.hitType) + { + case (HitType.Miss): + OnEvade(attacker, action, actionContainer); + break; + case (HitType.Parry): + OnParry(attacker, action, actionContainer); + break; + case (HitType.Block): + OnBlock(attacker, action, actionContainer); + break; + } + + statusEffects.CallLuaFunctionByFlag((uint)StatusEffectFlags.ActivateOnDamageTaken, "onDamageTaken", attacker, this, action); + + //TP gain formula seems to be something like 5 * e ^ ( -0.667 * [defender's level] ) * damage taken, rounded up + //This should be completely accurate at level 50, but isn't totally accurate at lower levels. + //Don't know if store tp impacts this + double tpModifier = 5 * Math.Pow(Math.E, (-0.0667 * GetLevel())); + AddTP((int)Math.Ceiling(tpModifier * action.amount)); + + + if (charaWork.parameterSave.hp[0] < 1) + Die(Program.Tick, actionContainer); + } + + public UInt64 GetTempVar(string name) + { + UInt64 retVal = 0; + if (tempVars.TryGetValue(name, out retVal)) + return retVal; + return 0; + } + + // cause lua is a dick + public void SetTempVar(string name, uint val) + { + if (tempVars.ContainsKey(name)) + tempVars[name] = val; + } + + public void SetTempVar(string name, UInt64 val) + { + if (tempVars.ContainsKey(name)) + tempVars[name] = val; + } + + public void ResetTempVars() + { + tempVars.Clear(); + } + + #region lua helpers + public bool IsEngaged() + { + return aiContainer.IsEngaged(); + } + + public bool IsPlayer() + { + return this is Player; + } + + public bool IsMonster() + { + return this is BattleNpc; + } + + public bool IsPet() + { + return this is Pet; + } + + public bool IsAlly() + { + return this is Ally; + } + + public bool IsDiscipleOfWar() + { + return GetClass() < CLASSID_THM; + } + + public bool IsDiscipleOfMagic() + { + return GetClass() >= CLASSID_THM && currentJob < CLASSID_CRP; + } + + public bool IsDiscipleOfHand() + { + return GetClass() >= CLASSID_CRP && currentJob < CLASSID_MIN; + } + + public bool IsDiscipleOfLand() + { + return GetClass() >= CLASSID_MIN; + } + #endregion lua helpers + #endregion ai stuff + + //Reset procs. Only send packet if any procs were actually reset. + //This assumes you can't use weaponskills between getting a proc and using the procced ability + public void ResetProcs() + { + var propPacketUtil = new ActorPropertyPacketUtil("charaWork/timingCommand", this); + bool shouldSend = false; + for (int i = 0; i < 4; i++) + { + if (charaWork.battleTemp.timingCommandFlag[i]) + { + shouldSend = true; + charaWork.battleTemp.timingCommandFlag[i] = false; + propPacketUtil.AddProperty(String.Format("charaWork.battleTemp.timingCommandFlag[{0}]", i)); + } + } + + if (shouldSend && this is Player) + ((Player)this).QueuePackets(propPacketUtil.Done()); + } + + //Set given proc to true and send packet if this is a player + // todo: hidden status effects for timing when the procs fall off + public void SetProc(int procId, bool val = true) + { + charaWork.battleTemp.timingCommandFlag[procId] = val; + uint effectId = (uint)StatusEffectId.EvadeProc + (uint)procId; + + //If a proc just occurred, add a hidden effect effect + if (val) + { + StatusEffect procEffect = Server.GetWorldManager().GetStatusEffect(effectId); + procEffect.SetDuration(5); + procEffect.SetSilent(true); + statusEffects.AddStatusEffect(procEffect, this, true, true); + } + //Otherwise we're reseting a proc, remove the status + else + { + statusEffects.RemoveStatusEffect(statusEffects.GetStatusEffectById((uint)effectId)); + } + + if (this is Player) + { + var propPacketUtil = new ActorPropertyPacketUtil("charaWork/timingCommand", this); + propPacketUtil.AddProperty(String.Format("charaWork.battleTemp.timingCommandFlag[{0}]", procId)); + ((Player)this).QueuePackets(propPacketUtil.Done()); + } + } + + public HitDirection GetHitDirection(Actor target) + { + //Get between taget's position and our position + double angle = Vector3.GetAngle(target.GetPosAsVector3(), GetPosAsVector3()); + //Add to the target's rotation, mod by 2pi. This is the angle relative to where the target is looking + //Actor's rotation is 0 degrees on their left side, rotate it by 45 degrees so that quadrants line up with sides + angle = (angle + target.rotation - (.25 * Math.PI)) % (2 * Math.PI); + //Make positive + if (angle < 0) + angle = angle + (2 * Math.PI); + + //Get the side we're on. 0 is front, 1 is right, 2 is rear, 3 is left + var side = (int) (angle / (.5 * Math.PI)) % 4; + + return (HitDirection) (1 << side); + } + + //Called when this character evades attacker's action + public void OnEvade(Character attacker, CommandResult action, CommandResultContainer actionContainer = null) + { + SetProc((ushort)HitType.Evade); + statusEffects.CallLuaFunctionByFlag((uint)StatusEffectFlags.ActivateOnEvade, "onEvade", attacker, this, action, actionContainer); + } + + //Called when this character blocks attacker's action + public void OnBlock(Character attacker, CommandResult action, CommandResultContainer actionContainer = null) + { + SetProc((ushort)HitType.Block); + statusEffects.CallLuaFunctionByFlag((uint)StatusEffectFlags.ActivateOnBlock, "onBlock", attacker, this, action, actionContainer); + } + + //Called when this character parries attacker's action + public void OnParry(Character attacker, CommandResult action, CommandResultContainer actionContainer = null) + { + SetProc((ushort)HitType.Parry); + statusEffects.CallLuaFunctionByFlag((uint)StatusEffectFlags.ActivateOnParry, "onParry", attacker, this, action, actionContainer); + } + + //Called when this character misses + public void OnMiss(Character defender, CommandResult action, CommandResultContainer actionContainer = null) + { + SetProc((ushort)HitType.Miss); + statusEffects.CallLuaFunctionByFlag((uint)StatusEffectFlags.ActivateOnMiss, "onMiss", this, defender, action, actionContainer); + } + + public void OnHit(Character defender, CommandResult action, CommandResultContainer actionContainer = null) + { + statusEffects.CallLuaFunctionByFlag((uint)StatusEffectFlags.ActivateOnHit, "onHit", this, defender, action, actionContainer); + } + + //The order of messages that appears after using a command is: + + //1. Cast start messages. (ie "You begin casting... ") + //2. Messages from buffs that activate before the command actually starts, like Power Surge or Presence of Mind. (This may be wrong and these could be the same as 4.) + //3. If the command is a multi-hit command, this is where the "You use [command] on [target]" message goes + + //Then, for each hit: + //4. Buffs that activate before a command hits, like Blindside + //5. The hit itself. For single hit commands this message is "Your [command] hits [target] for x damage" for multi hits it's "[Target] takes x points of damage" + //6. Stoneskin falling off + //6. Buffs that activate after a command hits, like Aegis Boon and Divine Veil + + //After all hits + //7. If it's a multi-hit command there's a "{numhits]fold attack..." message or if all hits miss an "All attacks missed" message + //8. Buffs that fall off after the skill ends, like Excruciate + + //For every target defeated: + //8. Defeat message + //9. EXP message + //10. EXP chain message + + + //folder is probably temporary until move to cached scripts is complete + public void DoBattleCommand(BattleCommand command, string folder) + { + //List actions = new List(); + CommandResultContainer actions = new CommandResultContainer(); + + var targets = command.targetFind.GetTargets(); + bool hitTarget = false; + + if (targets.Count > 0) + { + statusEffects.CallLuaFunctionByFlag((uint)StatusEffectFlags.ActivateOnCommandStart, "onCommandStart", this, command, actions); + + foreach (var chara in targets) + { + ushort hitCount = 0; + ushort totalDamage = 0; + for (int hitNum = 1; hitNum <= command.numHits; hitNum++) + { + var action = new CommandResult(chara.actorId, command, (byte)GetHitDirection(chara), (byte) hitNum); + + //uncached script + lua.LuaEngine.CallLuaBattleCommandFunction(this, command, folder, "onSkillFinish", this, chara, command, action, actions); + //cached script + //skill.CallLuaFunction(owner, "onSkillFinish", this, chara, command, action, actions); + if (action.hitType > HitType.Evade && action.hitType != HitType.Resist) + { + hitTarget = true; + hitCount++; + totalDamage += action.amount; + } + } + + if (command.numHits > 1) + { + //30442: [hitCount]fold Attack! [chara] takes a total of totalDamage points of damage. + //30450: All attacks miss! + ushort textId = (ushort) (hitTarget ? 30442 : 30450); + actions.AddAction(new CommandResult(chara.actorId, textId, 0, totalDamage, (byte)hitCount)); + } + } + + statusEffects.CallLuaFunctionByFlag((uint)StatusEffectFlags.ActivateOnCommandFinish, "onCommandFinish", this, command, actions); + } + else + { + actions.AddAction(new CommandResult(actorId, 30202, 0)); + } + + //Now that we know if we hit the target we can check if the combo continues + if (this is Player) + { + if (command.isCombo && hitTarget) + ((Player)this).SetCombos(command.comboNextCommandId); + else + ((Player)this).SetCombos(); + } + + CommandResult error = new CommandResult(actorId, 0, 0); + DelMP(command.CalculateMpCost(this)); + DelTP(command.CalculateTpCost(this)); + actions.CombineLists(); + DoBattleAction(command.id, command.battleAnimation, actions.GetList()); + } + + public List GetPartyMembersInRange(uint range) + { + TargetFind targetFind = new TargetFind(this); + targetFind.SetAOEType(ValidTarget.PartyMember, TargetFindAOEType.Circle, TargetFindAOETarget.Self, range, 0, 10, 0, 0); + targetFind.FindWithinArea(this, ValidTarget.PartyMember, TargetFindAOETarget.Self); + return targetFind.GetTargets(); + } + } +} \ No newline at end of file diff --git a/FFXIVClassic Map Server/actors/chara/Modifier.cs b/FFXIVClassic Map Server/actors/chara/Modifier.cs new file mode 100644 index 00000000..8481cc19 --- /dev/null +++ b/FFXIVClassic Map Server/actors/chara/Modifier.cs @@ -0,0 +1,98 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FFXIVClassic_Map_Server.actors.chara +{ + //These will need to be redone at some point. remember to update tables in db. + //Consider using text_paramname sheet. that matches up with the stats on armor, but some things will need special handling + //Also, 0-35 should probably match with up BattleTemp + enum Modifier : UInt32 + { + NAMEPLATE_SHOWN = 0, + TARGETABLE = 1, + NAMEPLATE_SHOWN2 = 2, + //NAMEPLATE_SHOWN2 = 3, + + Strength = 3, + Vitality = 4, + Dexterity = 5, + Intelligence = 6, + Mind = 7, + Piety = 8, + + ResistFire = 9, + ResistIce = 10, + ResistWind = 11, + ResistLightning = 12, + ResistEarth = 13, + ResistWater = 14, + + Accuracy = 15, + Evasion = 16, + Attack = 17, + Defense = 18, //Is there a magic defense stat? 19 maybe? + MagicAttack = 23, + MagicHeal = 24, + MagicEnhancePotency = 25, + MagicEnfeeblingPotency = 26, + + MagicAccuracy = 27, + MagicEvasion = 28, + + CraftProcessing = 30, + CraftMagicProcessing = 31, + CraftProcessControl = 32, + + HarvestPotency = 33, + HarvestLimit = 34, + HarvestRate = 35, + + None = 36, + Hp = 37, + HpPercent = 38, + Mp = 39, + MpPercent = 40, + Tp = 41, + TpPercent = 42, + Regen = 43, + Refresh = 44, + + AttackRange = 45, + Speed = 46, + AttackDelay = 47, + + Raise = 48, + MinimumHpLock = 49, // hp cannot fall below this value + AttackType = 50, // slashing, piercing, etc + BlockRate = 51, + Block = 52, + CritRating = 53, + HasShield = 54, // Need this because shields are required for blocks. Could have used BlockRate or Block but BlockRate is provided by Gallant Sollerets and Block is provided by some buffs. + HitCount = 55, // Amount of hits in an auto attack. Usually 1, 2 for h2h, 3 with spinning heel + + //Flat percent increases to these rates. Probably a better way to do this + RawEvadeRate = 56, + RawParryRate = 57, + RawBlockRate = 58, + RawResistRate = 59, + RawHitRate = 60, + RawCritRate = 61, + + DamageTakenDown = 62, // Percent damage taken down + StoreTP = 63, //.1% extra tp per point. Lancer trait is 50 StoreTP + PhysicalCritRate = 64, //CritRating but only for physical attacks. Increases chance of critting. + PhysicalCritEvasion = 65, //Opposite of CritRating. Reduces chance of being crit by phyiscal attacks + PhysicalCritAttack = 66, //Increases damage done by Physical Critical hits + PhysicalCritResilience = 67, //Decreases damage taken by Physical Critical hits + Parry = 68, //Increases chance to parry + MagicCritPotency = 69, //Increases + Regain = 70, //TP regen, should be -90 out of combat, Invigorate sets to 100+ depending on traits + RegenDown = 71, //Damage over time effects. Separate from normal Regen because of how they are displayed in game + Stoneskin = 72, //Nullifies damage + MinimumTpLock = 73, //Don't let TP fall below this, used in openings + KnockbackImmune = 74 //Immune to knockback effects when above 0 + } +} diff --git a/FFXIVClassic Map Server/actors/chara/ModifierList.cs b/FFXIVClassic Map Server/actors/chara/ModifierList.cs new file mode 100644 index 00000000..15b188b6 --- /dev/null +++ b/FFXIVClassic Map Server/actors/chara/ModifierList.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using FFXIVClassic_Map_Server.actors.chara.npc; + +namespace FFXIVClassic_Map_Server.actors.chara +{ + class ModifierListEntry + { + public uint id; + public Int64 value; + + public ModifierListEntry(uint id, Int64 value) + { + this.id = id; + this.value = value; + } + } + + class ModifierList + { + public Dictionary modList; + public Dictionary mobModList; + + public ModifierList(uint id) + { + modList = new Dictionary(); + mobModList = new Dictionary(); + } + + public void AddModifier(uint id, Int64 val, bool isMobMod) + { + var list = isMobMod ? mobModList : modList; + list.Add(id, new ModifierListEntry(id, val)); + } + + public void SetModifier(uint id, Int64 val, bool isMobMod) + { + var list = isMobMod ? mobModList : modList; + if (list.ContainsKey(id)) + list[id].value = val; + else + list.Add(id, new ModifierListEntry(id, val)); + } + + public Int64 GetModifier(uint id, bool isMobMod) + { + ModifierListEntry retVal; + var list = isMobMod ? mobModList : modList; + if (!list.TryGetValue(id, out retVal)) + return 0; + + return retVal.value; + } + } +} diff --git a/FFXIVClassic Map Server/actors/chara/SubState.cs b/FFXIVClassic Map Server/actors/chara/SubState.cs new file mode 100644 index 00000000..e7e3d8c7 --- /dev/null +++ b/FFXIVClassic Map Server/actors/chara/SubState.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FFXIVClassic_Map_Server.actors.chara +{ + class SubState + { + public byte breakage = 0; + public byte chantId = 0; + public byte guard = 0; + public byte waste = 0; + public byte mode = 0; + public ushort motionPack = 0; + + public void toggleBreak(int index, bool toggle) + { + if (index > 7 || index < 0) + return; + + if (toggle) + breakage = (byte)(breakage | (1 << index)); + else + breakage = (byte)(breakage & ~(1 << index)); + } + + public void setChant(byte chant) { + chantId = chant; + } + + public void setGuard(byte guard) + { + if (guard >= 0 && guard <= 3) + this.guard = guard; + } + + public void setWaste(byte waste) + { + if (waste >= 0 && waste <= 3) + this.waste = waste; + } + + public void setMode(byte bitfield) + { + mode = bitfield; + } + + public void setMotionPack(ushort mp) + { + motionPack = mp; + } + + } +} diff --git a/FFXIVClassic Map Server/actors/chara/ai/AIContainer.cs b/FFXIVClassic Map Server/actors/chara/ai/AIContainer.cs new file mode 100644 index 00000000..38c636a1 --- /dev/null +++ b/FFXIVClassic Map Server/actors/chara/ai/AIContainer.cs @@ -0,0 +1,382 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using FFXIVClassic_Map_Server.Actors; +using FFXIVClassic_Map_Server.actors.chara.ai.state; +using FFXIVClassic_Map_Server.actors.chara.ai.controllers; +using FFXIVClassic_Map_Server.packets.send.actor; + +// port of ai code in dsp by kjLotus (https://github.com/DarkstarProject/darkstar/blob/master/src/map/ai) +namespace FFXIVClassic_Map_Server.actors.chara.ai +{ + class AIContainer + { + private Character owner; + private Controller controller; + private Stack states; + private DateTime latestUpdate; + private DateTime prevUpdate; + public readonly PathFind pathFind; + private TargetFind targetFind; + private ActionQueue actionQueue; + private DateTime lastActionTime; + + public AIContainer(Character actor, Controller controller, PathFind pathFind, TargetFind targetFind) + { + this.owner = actor; + this.states = new Stack(); + this.controller = controller; + this.pathFind = pathFind; + this.targetFind = targetFind; + latestUpdate = DateTime.Now; + prevUpdate = latestUpdate; + actionQueue = new ActionQueue(owner); + } + + public void UpdateLastActionTime(uint delay = 0) + { + lastActionTime = DateTime.Now.AddSeconds(delay); + } + + public DateTime GetLastActionTime() + { + return lastActionTime; + } + + public void Update(DateTime tick) + { + prevUpdate = latestUpdate; + latestUpdate = tick; + + // todo: trigger listeners + + if (controller == null && pathFind != null) + { + pathFind.FollowPath(); + } + + // todo: action queues + if (controller != null && controller.canUpdate) + controller.Update(tick); + + State top; + + while (states.Count > 0 && (top = states.Peek()).Update(tick)) + { + if (top == GetCurrentState()) + { + states.Pop().Cleanup(); + } + } + owner.PostUpdate(tick); + } + + public void CheckCompletedStates() + { + while (states.Count > 0 && states.Peek().IsCompleted()) + { + states.Peek().Cleanup(); + states.Pop(); + } + } + + public void InterruptStates() + { + while (states.Count > 0 && states.Peek().CanInterrupt()) + { + states.Peek().SetInterrupted(true); + states.Peek().Cleanup(); + states.Pop(); + } + } + + public void InternalUseItem(Character target, uint slot, uint itemId) + { + // todo: can allies use items? + if (owner is Player) + { + if (CanChangeState()) + { + ChangeState(new ItemState((Player)owner, target, (ushort)slot, itemId)); + } + else + { + // You cannot use that item now. + ((Player)owner).SendGameMessage(Server.GetWorldManager().GetActor(), 32544, 0x20, itemId); + } + } + } + + public void ClearStates() + { + while (states.Count > 0) + { + states.Peek().Cleanup(); + states.Pop(); + } + } + + public void ChangeController(Controller controller) + { + this.controller = controller; + } + + public T GetController() where T : Controller + { + return controller as T; + } + + public TargetFind GetTargetFind() + { + return targetFind; + } + + public bool CanFollowPath() + { + return pathFind != null && (GetCurrentState() == null || GetCurrentState().CanChangeState()); + } + + public bool CanChangeState() + { + return GetCurrentState() == null || states.Peek().CanChangeState(); + } + + public void ChangeTarget(Character target) + { + if (controller != null) + { + controller.ChangeTarget(target); + } + } + + public void ChangeState(State state) + { + if (CanChangeState()) + { + if (states.Count <= 10) + { + CheckCompletedStates(); + states.Push(state); + } + else + { + throw new Exception("shit"); + } + } + } + + public void ForceChangeState(State state) + { + if (states.Count <= 10) + { + CheckCompletedStates(); + states.Push(state); + } + else + { + throw new Exception("force shit"); + } + } + + public bool IsCurrentState() where T : State + { + return GetCurrentState() is T; + } + + public State GetCurrentState() + { + return states.Count > 0 ? states.Peek() : null; + } + + public DateTime GetLatestUpdate() + { + return latestUpdate; + } + + public void Reset() + { + // todo: reset cooldowns and stuff here too? + targetFind?.Reset(); + pathFind?.Clear(); + ClearStates(); + InternalDisengage(); + } + + public bool IsSpawned() + { + return !IsDead(); + } + + public bool IsEngaged() + { + return owner.currentMainState == SetActorStatePacket.MAIN_STATE_ACTIVE; + } + + public bool IsDead() + { + return owner.currentMainState == SetActorStatePacket.MAIN_STATE_DEAD || + owner.currentMainState == SetActorStatePacket.MAIN_STATE_DEAD2; + } + + public bool IsRoaming() + { + // todo: check mounted? + return owner.currentMainState == SetActorStatePacket.MAIN_STATE_PASSIVE; + } + + public void Engage(Character target) + { + if (controller != null) + controller.Engage(target); + else + InternalEngage(target); + } + + public void Disengage() + { + if (controller != null) + controller.Disengage(); + else + InternalDisengage(); + } + + public void Ability(Character target, uint abilityId) + { + if (controller != null) + controller.Ability(target, abilityId); + else + InternalAbility(target, abilityId); + } + + public void Cast(Character target, uint spellId) + { + if (controller != null) + controller.Cast(target, spellId); + else + InternalCast(target, spellId); + } + + public void WeaponSkill(Character target, uint weaponSkillId) + { + if (controller != null) + controller.WeaponSkill(target, weaponSkillId); + else + InternalWeaponSkill(target, weaponSkillId); + } + + public void MobSkill(Character target, uint mobSkillId) + { + if (controller != null) + controller.MonsterSkill(target, mobSkillId); + else + InternalMobSkill(target, mobSkillId); + } + + public void UseItem(Character target, uint slot, uint itemId) + { + if (controller != null) + controller.UseItem(target, slot, itemId); + } + + public void InternalChangeTarget(Character target) + { + // targets are changed in the controller + if (IsEngaged() || target == null) + { + + } + else + { + Engage(target); + } + } + + public bool InternalEngage(Character target) + { + if (IsEngaged()) + { + if (this.owner.target != target) + { + ChangeTarget(target); + return true; + } + return false; + } + + if (CanChangeState() || (GetCurrentState() != null && GetCurrentState().IsCompleted())) + { + ForceChangeState(new AttackState(owner, target)); + return true; + } + return false; + } + + public void InternalDisengage() + { + pathFind?.Clear(); + GetTargetFind()?.Reset(); + + owner.updateFlags |= ActorUpdateFlags.HpTpMp; + ChangeTarget(null); + + if (owner.currentMainState == SetActorStatePacket.MAIN_STATE_ACTIVE) + owner.ChangeState(SetActorStatePacket.MAIN_STATE_PASSIVE); + + ClearStates(); + } + + public void InternalAbility(Character target, uint abilityId) + { + if (CanChangeState()) + { + ChangeState(new AbilityState(owner, target, (ushort)abilityId)); + } + } + + public void InternalCast(Character target, uint spellId) + { + if (CanChangeState()) + { + ChangeState(new MagicState(owner, target, (ushort)spellId)); + } + } + + public void InternalWeaponSkill(Character target, uint weaponSkillId) + { + if (CanChangeState()) + { + ChangeState(new WeaponSkillState(owner, target, (ushort)weaponSkillId)); + } + } + + public void InternalMobSkill(Character target, uint mobSkillId) + { + if (CanChangeState()) + { + + } + } + + public void InternalDie(DateTime tick, uint fadeoutTimerSeconds) + { + pathFind?.Clear(); + ClearStates(); + ForceChangeState(new DeathState(owner, tick, fadeoutTimerSeconds)); + } + + public void InternalDespawn(DateTime tick, uint respawnTimerSeconds) + { + ClearStates(); + Disengage(); + ForceChangeState(new DespawnState(owner, respawnTimerSeconds)); + } + + public void InternalRaise(Character target) + { + // todo: place at target + // ForceChangeState(new RaiseState(target)); + } + } +} diff --git a/FFXIVClassic Map Server/actors/chara/ai/BattleCommand.cs b/FFXIVClassic Map Server/actors/chara/ai/BattleCommand.cs new file mode 100644 index 00000000..fa0cd2e3 --- /dev/null +++ b/FFXIVClassic Map Server/actors/chara/ai/BattleCommand.cs @@ -0,0 +1,395 @@ +using FFXIVClassic_Map_Server.Actors; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using FFXIVClassic_Map_Server.actors.chara.player; +using FFXIVClassic.Common; +using FFXIVClassic_Map_Server.packets.send.actor.battle; +using FFXIVClassic_Map_Server.actors.chara.ai.utils; +using MoonSharp.Interpreter; + +namespace FFXIVClassic_Map_Server.actors.chara.ai +{ + + public enum BattleCommandRequirements : ushort + { + None, + DiscipleOfWar = 0x01, + DiscipeOfMagic = 0x02, + HandToHand = 0x04, + Sword = 0x08, + Shield = 0x10, + Axe = 0x20, + Archery = 0x40, + Polearm = 0x80, + Thaumaturgy = 0x100, + Conjury = 0x200 + } + + public enum BattleCommandPositionBonus : byte + { + None, + Front = 0x01, + Rear = 0x02, + Flank = 0x04 + } + + public enum BattleCommandProcRequirement : byte + { + None, + Miss, + Evade, + Parry, + Block + } + + public enum BattleCommandValidUser : byte + { + All, + Player, + Monster + } + + public enum BattleCommandCastType : ushort + { + None, + Weaponskill = 1, + Weaponskill2 = 2, + BlackMagic = 3, + WhiteMagic = 4, + SongMagic = 8 + } + + + //What type of command it is + [Flags] + public enum CommandType : ushort + { + //Type of action + None = 0, + AutoAttack = 1, + WeaponSkill = 2, + Ability =3, + Spell = 4 + } + + public enum KnockbackType : ushort + { + None = 0, + Level1 = 1, + Level2 = 2, + Level3 = 3, + Level4 = 4, + Level5 = 5, + Clockwise1 = 6, + Clockwise2 = 7, + CounterClockwise1 = 8, + CounterClockwise2 = 9, + DrawIn = 10 + } + + class BattleCommand + { + public ushort id; + public string name; + public byte job; + public byte level; + public BattleCommandRequirements requirements; + public ValidTarget mainTarget; //what the skill has to be used on. ie self for flare, enemy for ring of talons even though both are self-centere aoe + public ValidTarget validTarget; //what type of character the skill can hit + public TargetFindAOEType aoeType; //shape of aoe + public TargetFindAOETarget aoeTarget; //where the center of the aoe is (target/self) + public byte numHits; //amount of hits in the skill + public BattleCommandPositionBonus positionBonus; //bonus for front/flank/rear + public BattleCommandProcRequirement procRequirement;//if the skill requires a block/parry/evade before using + public float range; //maximum distance to target to be able to use this skill + public float minRange; //Minimum distance to target to be able to use this skill + + public uint statusId; //id of statuseffect that the skill might inflict + public uint statusDuration; //duration of statuseffect in milliseconds + public float statusChance; //percent chance of status landing, 0-1.0. Usually 1.0 for buffs + public byte castType; //casting animation, 2 for blm, 3 for whm, 8 for brd + public uint castTimeMs; //cast time in milliseconds + public uint recastTimeMs; //recast time in milliseconds + public uint maxRecastTimeSeconds; //maximum recast time in seconds + public ushort mpCost; + public ushort tpCost; + public byte animationType; + public ushort effectAnimation; + public ushort modelAnimation; + public ushort animationDurationSeconds; + public uint battleAnimation; + public ushort worldMasterTextId; + public float aoeRange; //Radius for circle and cone aoes, length for box aoes + public float aoeMinRange; //Minimum range of aoe effect for things like Lunar Dynamo or Arrow Helix + public float aoeConeAngle; //Angle of aoe cones + public float aoeRotateAngle; //Amount aoes are rotated about the target position (usually the user's position) + public float rangeHeight; //Total height a skill can be used against target above or below user + public float rangeWidth; //Width of box aoes + public int[] comboNextCommandId = new int[2]; //next two skills in a combo + public short comboStep; //Where in a combo string this skill is + public CommandType commandType; + public ActionProperty actionProperty; + public ActionType actionType; + + + public byte statusTier; //tier of status to put on target + public double statusMagnitude = 0; //magnitude of status to put on target + public ushort basePotency; //damage variable + public float enmityModifier; //multiples by damage done to get final enmity + public float accuracyModifier; //modifies accuracy + public float bonusCritRate; //extra crit rate + public bool isCombo; + public bool comboEffectAdded = false; //If the combo effect is added to multiple hiteffects it plays multiple times, so this keeps track of that + public bool isRanged = false; + + public bool actionCrit; //Whether any actions were critical hits, used for Excruciate + + public lua.LuaScript script; //cached script + + public TargetFind targetFind; + public BattleCommandValidUser validUser; + + public BattleCommand(ushort id, string name) + { + this.id = id; + this.name = name; + this.range = 0; + this.enmityModifier = 1; + this.accuracyModifier = 0; + this.statusTier = 1; + this.statusChance = 50; + this.recastTimeMs = (uint) maxRecastTimeSeconds * 1000; + this.isCombo = false; + } + + public BattleCommand Clone() + { + return (BattleCommand)MemberwiseClone(); + } + + public int CallLuaFunction(Character chara, string functionName, params object[] args) + { + if (script != null && !script.Globals.Get(functionName).IsNil()) + { + DynValue res = new DynValue(); + res = script.Call(script.Globals.Get(functionName), args); + if (res != null) + return (int)res.Number; + } + + return -1; + } + + public bool IsSpell() + { + return mpCost != 0 || castTimeMs != 0; + } + + public bool IsInstantCast() + { + return castTimeMs == 0; + } + + //Checks whether the skill can be used on the given target + public bool IsValidMainTarget(Character user, Character target) + { + targetFind = new TargetFind(user); + + if (aoeType == TargetFindAOEType.Box) + { + targetFind.SetAOEBox(validTarget, aoeTarget, aoeRange, rangeWidth, aoeRotateAngle); + } + else + { + targetFind.SetAOEType(validTarget, aoeType, aoeTarget, aoeRange, aoeMinRange, rangeHeight, aoeRotateAngle, aoeConeAngle); + } + + /* + worldMasterTextId + 32512 cannot be performed on a KO'd target. + 32513 can only be performed on a KO'd target. + 32514 cannot be performed on yourself. + 32515 can only be performed on yourself. + 32516 cannot be performed on a friendly target. + 32517 can only be performed on a friendly target. + 32518 cannot be performed on an enemy. + 32519 can only be performed on an enemy, + 32556 unable to execute [weaponskill]. Conditions for use are not met. + */ + + // cant target dead + if ((mainTarget & (ValidTarget.Corpse | ValidTarget.CorpseOnly)) == 0 && target.IsDead()) + { + // cannot be perfomed on + if (user is Player) + ((Player)user).SendGameMessage(Server.GetWorldManager().GetActor(), 32512, 0x20, (uint)id); + return false; + } + + //level too high + if (level > user.GetLevel()) + { + if (user is Player) + ((Player)user).SendGameMessage(Server.GetWorldManager().GetActor(), 32527, 0x20, (uint)id); + //return false; + } + + //Proc requirement + if (procRequirement != BattleCommandProcRequirement.None && !user.charaWork.battleTemp.timingCommandFlag[(int) procRequirement - 1]) + { + if (user is Player) + ((Player)user).SendGameMessage(Server.GetWorldManager().GetActor(), 32556, 0x20, (uint)id); + return false; + } + + //costs too much tp + if (CalculateTpCost(user) > user.GetTP()) + { + if (user is Player) + ((Player)user).SendGameMessage(Server.GetWorldManager().GetActor(), 32546, 0x20, (uint)id); + return false; + } + + // todo: calculate cost based on modifiers also (probably in BattleUtils) + if (BattleUtils.CalculateSpellCost(user, target, this) > user.GetMP()) + { + if (user is Player) + ((Player)user).SendGameMessage(Server.GetWorldManager().GetActor(), 32545, 0x20, (uint)id); + return false; + } + + // todo: check target requirements + if (requirements != BattleCommandRequirements.None) + { + if (false) + { + // Unable to execute [@SHEET(xtx/command,$E8(1),2)]. Conditions for use are not met. + if (user is Player) + ((Player)user).SendGameMessage(Server.GetWorldManager().GetActor(), 32556, 0x20, (uint)id); + return false; + } + } + + + // todo: i dont care to message for each scenario, just the most common ones.. + if ((mainTarget & ValidTarget.CorpseOnly) != 0) + { + if (target != null && target.IsAlive()) + { + if (user is Player) + ((Player)user).SendGameMessage(Server.GetWorldManager().GetActor(), 32513, 0x20, (uint)id); + return false; + } + } + + if ((mainTarget & ValidTarget.Enemy) != 0) + { + if (target == user || target != null && + user.allegiance == target.allegiance) + { + if (user is Player) + ((Player)user).SendGameMessage(Server.GetWorldManager().GetActor(), 32519, 0x20, (uint)id); + return false; + } + } + + if ((mainTarget & ValidTarget.Ally) != 0) + { + if (target == null || target.allegiance != user.allegiance) + { + if (user is Player) + ((Player)user).SendGameMessage(Server.GetWorldManager().GetActor(), 32517, 0x20, (uint)id); + return false; + } + } + + if ((mainTarget & ValidTarget.PartyMember) != 0) + { + if (target == null || target.currentParty != user.currentParty) + { + if (user is Player) + ((Player)user).SendGameMessage(Server.GetWorldManager().GetActor(), 32547, 0x20, (uint)id); + return false; + } + } + + if ((mainTarget & ValidTarget.Player) != 0) + { + if (!(target is Player)) + { + if (user is Player) + ((Player)user).SendGameMessage(Server.GetWorldManager().GetActor(), 32517, 0x20, (uint)id); + return false; + } + } + + return true;// targetFind.CanTarget(target, true, true, true); //this will be done later + } + + public ushort CalculateMpCost(Character user) + { + // todo: use precalculated costs instead + var level = user.GetLevel(); + ushort cost = 0; + if (level <= 10) + cost = (ushort)(100 + level * 10); + else if (level <= 20) + cost = (ushort)(200 + (level - 10) * 20); + else if (level <= 30) + cost = (ushort)(400 + (level - 20) * 40); + else if (level <= 40) + cost = (ushort)(800 + (level - 30) * 70); + else if (level <= 50) + cost = (ushort)(1500 + (level - 40) * 130); + else if (level <= 60) + cost = (ushort)(2800 + (level - 50) * 200); + else if (level <= 70) + cost = (ushort)(4800 + (level - 60) * 320); + else + cost = (ushort)(8000 + (level - 70) * 500); + + //scale the mpcost by level + cost = (ushort)Math.Ceiling((cost * mpCost * 0.001)); + + //if user is player, check if spell is a part of combo + if (user is Player) + { + var player = user as Player; + if (player.playerWork.comboNextCommandId[0] == id || player.playerWork.comboNextCommandId[1] == id) + cost = (ushort)Math.Ceiling(cost * (1 - player.playerWork.comboCostBonusRate)); + } + + return mpCost != 0 ? cost : (ushort)0; + } + + //Calculate TP cost taking into considerating the combo bonus rate for players + //Should this set tpCost or should it be called like CalculateMp where it gets calculated each time? + //Might cause issues with the delay between starting and finishing a WS + public ushort CalculateTpCost(Character user) + { + ushort tp = tpCost; + //Calculate tp cost + if (user is Player) + { + var player = user as Player; + if (player.playerWork.comboNextCommandId[0] == id || player.playerWork.comboNextCommandId[1] == id) + tp = (ushort)Math.Ceiling((float)tpCost * (1 - player.playerWork.comboCostBonusRate)); + } + + return tp; + } + + public List GetTargets() + { + return targetFind?.GetTargets(); + } + + public ushort GetCommandType() + { + return (ushort) commandType; + } + } +} \ No newline at end of file diff --git a/FFXIVClassic Map Server/actors/chara/ai/BattleTrait.cs b/FFXIVClassic Map Server/actors/chara/ai/BattleTrait.cs new file mode 100644 index 00000000..f8f41b48 --- /dev/null +++ b/FFXIVClassic Map Server/actors/chara/ai/BattleTrait.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FFXIVClassic_Map_Server.actors.chara.ai +{ + class BattleTrait + { + public ushort id; + public string name; + public byte job; + public byte level; + public uint modifier; + public int bonus; + + public BattleTrait(ushort id, string name, byte job, byte level, uint modifier, int bonus) + { + this.id = id; + this.name = name; + this.job = job; + this.level = level; + this.modifier = modifier; + this.bonus = bonus; + } + } +} diff --git a/FFXIVClassic Map Server/actors/chara/ai/HateContainer.cs b/FFXIVClassic Map Server/actors/chara/ai/HateContainer.cs new file mode 100644 index 00000000..47086f68 --- /dev/null +++ b/FFXIVClassic Map Server/actors/chara/ai/HateContainer.cs @@ -0,0 +1,91 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using FFXIVClassic_Map_Server.Actors; + +namespace FFXIVClassic_Map_Server.actors.chara.ai +{ + // todo: actually implement enmity properly + class HateEntry + { + public Character actor; + public uint cumulativeEnmity; + public uint volatileEnmity; + public bool isActive; + + public HateEntry(Character actor, uint cumulativeEnmity = 0, uint volatileEnmity = 0, bool isActive = false) + { + this.actor = actor; + this.cumulativeEnmity = cumulativeEnmity; + this.volatileEnmity = volatileEnmity; + this.isActive = isActive; + } + } + + class HateContainer + { + private Dictionary hateList; + private Character owner; + + public HateContainer(Character owner) + { + this.owner = owner; + this.hateList = new Dictionary(); + } + + public void AddBaseHate(Character target) + { + if (!HasHateForTarget(target)) + hateList.Add(target, new HateEntry(target, 1, 0, true)); + } + + public void UpdateHate(Character target, int damage) + { + AddBaseHate(target); + //hateList[target].volatileEnmity += (uint)damage; + hateList[target].cumulativeEnmity += (uint)damage; + } + + public void ClearHate(Character target = null) + { + if (target != null) + hateList.Remove(target); + else + hateList.Clear(); + } + + private void UpdateHate(HateEntry entry) + { + + } + + public Dictionary GetHateList() + { + // todo: return unmodifiable collection? + return hateList; + } + + public bool HasHateForTarget(Character target) + { + return hateList.ContainsKey(target); + } + + public Character GetMostHatedTarget() + { + uint enmity = 0; + Character target = null; + + foreach(var entry in hateList.Values) + { + if (entry.cumulativeEnmity > enmity && entry.isActive) + { + enmity = entry.cumulativeEnmity; + target = entry.actor; + } + } + return target; + } + } +} diff --git a/FFXIVClassic Map Server/actors/chara/ai/StatusEffect.cs b/FFXIVClassic Map Server/actors/chara/ai/StatusEffect.cs new file mode 100644 index 00000000..d05f19d8 --- /dev/null +++ b/FFXIVClassic Map Server/actors/chara/ai/StatusEffect.cs @@ -0,0 +1,657 @@ +using FFXIVClassic_Map_Server.Actors; +using FFXIVClassic_Map_Server.lua; +using FFXIVClassic_Map_Server.packets.send.actor; +using FFXIVClassic_Map_Server.packets.send.actor.battle; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using MoonSharp.Interpreter; +using FFXIVClassic.Common; + +namespace FFXIVClassic_Map_Server.actors.chara.ai +{ + enum StatusEffectId : uint + { + RageofHalone = 221021, + + Quick = 223001, + Haste = 223002, + Slow = 223003, + Petrification = 223004, + Paralysis = 223005, + Silence = 223006, + Blind = 223007, + Mute = 223008, + Slowcast = 223009, + Glare = 223010, + Poison = 223011, + Transfixion = 223012, + Pacification = 223013, + Amnesia = 223014, + Stun = 223015, + Daze = 223016, + ExposedFront = 223017, + ExposedRight = 223018, + ExposedRear = 223019, + ExposedLeft = 223020, + Incapacitation = 223021, + Incapacitation2 = 223022, + Incapacitation3 = 223023, + Incapacitation4 = 223024, + Incapacitation5 = 223025, + Incapacitation6 = 223026, + Incapacitation7 = 223027, + Incapacitation8 = 223028, + HPBoost = 223029, + HPPenalty = 223030, + MPBoost = 223031, + MPPenalty = 223032, + AttackUp = 223033, + AttackDown = 223034, + AccuracyUp = 223035, + AccuracyDown = 223036, + DefenseUp = 223037, + DefenseDown = 223038, + EvasionUp = 223039, + EvasionDown = 223040, + MagicPotencyUp = 223041, + MagicPotencyDown = 223042, + MagicAccuracyUp = 223043, + MagicAccuracyDown = 223044, + MagicDefenseUp = 223045, + MagicDefenseDown = 223046, + MagicResistanceUp = 223047, + MagicResistanceDown = 223048, + CombatFinesse = 223049, + CombatHindrance = 223050, + MagicFinesse = 223051, + MagicHindrance = 223052, + CombatResilience = 223053, + CombatVulnerability = 223054, + MagicVulnerability = 223055, + MagicResilience = 223056, + Inhibited = 223057, + AegisBoon = 223058, + Deflection = 223059, + Outmaneuver = 223060, + Provoked = 223061, + Sentinel = 223062, + Cover = 223063, + Rampart = 223064, + StillPrecision = 223065, + Cadence = 223066, + DiscerningEye = 223067, + TemperedWill = 223068, + Obsess = 223069, + Ambidexterity = 223070, + BattleCalm = 223071, + MasterofArms = 223072, + Taunted = 223073, + Blindside = 223074, + Featherfoot = 223075, + PresenceofMind = 223076, + CoeurlStep = 223077, + EnduringMarch = 223078, + MurderousIntent = 223079, + Entrench = 223080, + Bloodbath = 223081, + Retaliation = 223082, + Foresight = 223083, + Defender = 223084, + Rampage = 223085, //old effect + Enraged = 223086, + Warmonger = 223087, + Disorientx1 = 223088, + Disorientx2 = 223089, + Disorientx3 = 223090, + KeenFlurry = 223091, + ComradeinArms = 223092, + Ferocity = 223093, + Invigorate = 223094, + LineofFire = 223095, + Jump = 223096, + Collusion = 223097, + Diversion = 223098, + SpeedSurge = 223099, + LifeSurge = 223100, + SpeedSap = 223101, + LifeSap = 223102, + Farshot = 223103, + QuellingStrike = 223104, + RagingStrike = 223105, //old effect + HawksEye = 223106, + SubtleRelease = 223107, + Decoy = 223108, //Untraited + Profundity = 223109, + TranceChant = 223110, + RoamingSoul = 223111, + Purge = 223112, + Spiritsong = 223113, + Resonance = 223114, //Old Resonance? Both have the same icons and description + Soughspeak = 223115, + PresenceofMind2 = 223116, + SanguineRite = 223117, //old effect + PunishingBarbs = 223118, + DarkSeal = 223119, //old effect + Emulate = 223120, + ParadigmShift = 223121, + ConcussiveBlowx1 = 223123, + ConcussiveBlowx2 = 223124, + ConcussiveBlowx3 = 223125, + SkullSunder = 223126, + Bloodletter = 223127, //comboed effect + Levinbolt = 223128, + Protect = 223129, //untraited protect + Shell = 223130, //old shell + Reraise = 223131, + ShockSpikes = 223132, + Stoneskin = 223133, + Scourge = 223134, + Bio = 223135, + Dia = 223136, + Banish = 223137, + StygianSpikes = 223138, + ATKAbsorbed = 223139, + DEFAbsorbed = 223140, + ACCAbsorbed = 223141, + EVAAbsorbed = 223142, + AbsorbATK = 223143, + AbsorbDEF = 223144, + AbsorbACC = 223145, + AbsorbEVA = 223146, + SoulWard = 223147, + Burn = 223148, + Frost = 223149, + Shock = 223150, + Drown = 223151, + Choke = 223152, + Rasp = 223153, + Flare = 223154, + Freeze = 223155, + Burst = 223156, + Flood = 223157, + Tornado = 223158, + Quake = 223159, + Berserk = 223160, + RegimenofRuin = 223161, + RegimenofTrauma = 223162, + RegimenofDespair = 223163, + RegimenofConstraint = 223164, + Weakness = 223165, + Scavenge = 223166, + Fastcast = 223167, + MidnightHowl = 223168, + Outlast = 223169, + Steadfast = 223170, + DoubleNock = 223171, + TripleNock = 223172, + Covered = 223173, + PerfectDodge = 223174, + ExpertMining = 223175, + ExpertLogging = 223176, + ExpertHarvesting = 223177, + ExpertFishing = 223178, + ExpertSpearfishing = 223179, + Regen = 223180, + Refresh = 223181, + Regain = 223182, + TPBleed = 223183, + Empowered = 223184, + Imperiled = 223185, + Adept = 223186, + Inept = 223187, + Quick2 = 223188, + Quick3 = 223189, + WristFlick = 223190, + Glossolalia = 223191, + SonorousBlast = 223192, + Comradery = 223193, + StrengthinNumbers = 223194, + + BrinkofDeath = 223197, + CraftersGrace = 223198, + GatherersGrace = 223199, + Rebirth = 223200, + Stealth = 223201, + StealthII = 223202, + StealthIII = 223203, + StealthIV = 223204, + Combo = 223205, + GoringBlade = 223206, + Berserk2 = 223207, //new effect + Rampage2 = 223208, //new effect + FistsofFire = 223209, + FistsofEarth = 223210, + FistsofWind = 223211, + PowerSurgeI = 223212, + PowerSurgeII = 223213, + PowerSurgeIII = 223214, + LifeSurgeI = 223215, + LifeSurgeII = 223216, + LifeSurgeIII = 223217, + DreadSpike = 223218, + BloodforBlood = 223219, + Barrage = 223220, + RagingStrike2 = 223221, + + Swiftsong = 223224, + SacredPrism = 223225, + ShroudofSaints = 223226, + ClericStance = 223227, + BlissfulMind = 223228, + DarkSeal2 = 223229, //new effect + Resonance2 = 223230, + Excruciate = 223231, + Necrogenesis = 223232, + Parsimony = 223233, + SanguineRite2 = 223234, //untraited effect + Aero = 223235, + Outmaneuver2 = 223236, + Blindside2 = 223237, + Decoy2 = 223238, //Traited + Protect2 = 223239, //Traited + SanguineRite3 = 223240, //Traited + Bloodletter2 = 223241, //uncomboed effect + FullyBlissfulMind = 223242, + MagicEvasionDown = 223243, + HundredFists = 223244, + SpinningHeel = 223245, + DivineVeil = 223248, + HallowedGround = 223249, + Vengeance = 223250, + Antagonize = 223251, + MightyStrikes = 223252, + BattleVoice = 223253, + BalladofMagi = 223254, + PaeonofWar = 223255, + MinuetofRigor = 223256, + GoldLung = 223258, + Goldbile = 223259, + AurumVeil = 223260, + AurumVeilII = 223261, + Flare2 = 223262, + Resting = 223263, + DivineRegen = 223264, + DefenseAndEvasionUp = 223265, + MagicDefenseAndEvasionUp = 223266, + AttackUp2 = 223267, + MagicPotencyUp2 = 223268, + DefenseAndEvasionDown = 223269, + MagicDefenseAndEvasionDown = 223270, + Poison2 = 223271, + DeepBurn = 223272, + LunarCurtain = 223273, + DefenseUp2 = 223274, + AttackDown2 = 223275, + Sanction = 223992, + IntactPodlingToting = 223993, + RedRidingHooded = 223994, + Medicated = 223998, + WellFed = 223999, + + Sleep = 228001, + Bind = 228011, + Fixation = 228012, + Bind2 = 228013, + Heavy = 228021, + Charm = 228031, + Flee = 228041, + Doom = 228051, + SynthesisSupport = 230001, + WoodyardAccess = 230002, + SmithsForgeAccess = 230003, + ArmorersForgeAccess = 230004, + GemmaryAccess = 230005, + TanneryAccess = 230006, + ClothshopAccess = 230007, + LaboratoryAccess = 230008, + CookeryAccess = 230009, + MinersSupport = 230010, + BotanistsSupport = 230011, + FishersSupport = 230012, + GearChange = 230013, + GearDamage = 230014, + HeavyGearDamage = 230015, + Lamed = 230016, + Lamed2 = 230017, + Lamed3 = 230018, + Poison3 = 231002, + Envenom = 231003, + Berserk4 = 231004, + GuardiansAspect = 253002, + + + // custom effects here + // status for having procs fall off + EvadeProc = 253003, + BlockProc = 253004, + ParryProc = 253005, + MissProc = 253006, + EXPChain = 253007 + } + + [Flags] + enum StatusEffectFlags : uint + { + None = 0, + Silent = 1 << 0, // dont display effect loss message + + //Loss flags + LoseOnDeath = 1 << 1, // effects removed on death + LoseOnZoning = 1 << 2, // effects removed on zoning + LoseOnEsuna = 1 << 3, // effects which can be removed with esuna (debuffs) + LoseOnDispel = 1 << 4, // some buffs which player might be able to dispel from mob + LoseOnLogout = 1 << 5, // effects removed on logging out + LoseOnAttacking = 1 << 6, // effects removed when owner attacks another entity + LoseOnCastStart = 1 << 7, // effects removed when owner starts casting + LoseOnAggro = 1 << 8, // effects removed when owner gains enmity (swiftsong) + + //Activate flags + ActivateOnCastStart = 1 << 9, //Activates when a cast starts. + ActivateOnCommandStart = 1 << 10, //Activates when a command is used, before iterating over targets. Used for things like power surge, excruciate. + ActivateOnCommandFinish = 1 << 11, //Activates when the command is finished, after all targets have been iterated over. Used for things like Excruciate and Resonance falling off. + ActivateOnPreactionTarget = 1 << 12, //Activates after initial rates are calculated for an action against owner + ActivateOnPreactionCaster = 1 << 13, //Activates after initial rates are calculated for an action by owner + ActivateOnDamageTaken = 1 << 14, + ActivateOnHealed = 1 << 15, + + //Should these be rolled into DamageTaken? + ActivateOnMiss = 1 << 16, //Activates when owner misses + ActivateOnEvade = 1 << 17, //Activates when owner evades + ActivateOnParry = 1 << 18, //Activates when owner parries + ActivateOnBlock = 1 << 19, //Activates when owner evades + ActivateOnHit = 1 << 20, //Activates when owner hits + ActivateOnCrit = 1 << 21, //Activates when owner crits + + //Prevent flags. Sleep/stun/petrify/etc combine these + PreventSpell = 1 << 22, // effects which prevent using spells, such as silence + PreventWeaponSkill = 1 << 23, // effects which prevent using weaponskills, such as pacification + PreventAbility = 1 << 24, // effects which prevent using abilities, such as amnesia + PreventAttack = 1 << 25, // effects which prevent basic attacks + PreventMovement = 1 << 26, // effects which prevent movement such as bind, still allows turning in place + PreventTurn = 1 << 27, // effects which prevent turning, such as stun + PreventUntarget = 1 << 28, // effects which prevent changing targets, such as fixation + + Stealth = 1 << 29, // sneak/invis + Stance = 1 << 30, // effects that do not have a timer + } + + enum StatusEffectOverwrite : byte + { + None, + Always, + GreaterOrEqualTo, + GreaterOnly, + } + + class StatusEffect + { + // todo: probably use get;set; + private Character owner; + private Character source; + private StatusEffectId id; + private string name; // name of this effect + private DateTime startTime; // when was this effect added + private DateTime endTime; // when this status falls off + private DateTime lastTick; // when did this effect last tick + private uint duration; // how long should this effect last in seconds + private uint tickMs; // how often should this effect proc + private double magnitude; // a value specified by scripter which is guaranteed to be used by all effects + private byte tier; // same effect with higher tier overwrites this + private double extra; // optional value + private StatusEffectFlags flags; // death/erase/dispel etc + private StatusEffectOverwrite overwrite; // how to handle adding an effect with same id (see StatusEfectOverwrite) + private bool silent = false; // do i send a message on losing effect + private bool hidden = false; + public LuaScript script; + + HitEffect animationEffect; + + public StatusEffect(Character owner, uint id, double magnitude, uint tickMs, uint duration, byte tier = 0) + { + this.owner = owner; + this.source = owner; + this.id = (StatusEffectId)id; + this.magnitude = magnitude; + this.tickMs = tickMs; + this.duration = duration; + this.tier = tier; + + this.startTime = DateTime.Now; + this.lastTick = startTime; + } + + public StatusEffect(Character owner, StatusEffect effect) + { + this.owner = owner; + this.source = owner; + this.id = effect.id; + this.magnitude = effect.magnitude; + this.tickMs = effect.tickMs; + this.duration = effect.duration; + this.tier = effect.tier; + this.startTime = effect.startTime; + this.lastTick = effect.lastTick; + + this.name = effect.name; + this.flags = effect.flags; + this.overwrite = effect.overwrite; + this.extra = effect.extra; + this.script = effect.script; + } + + public StatusEffect(uint id, string name, uint flags, uint overwrite, uint tickMs) + { + this.id = (StatusEffectId)id; + this.name = name; + this.flags = (StatusEffectFlags)flags; + this.overwrite = (StatusEffectOverwrite)overwrite; + this.tickMs = tickMs; + } + + // return true when duration has elapsed + public bool Update(DateTime tick) + { + if (tickMs != 0 && (tick - lastTick).TotalMilliseconds >= tickMs) + { + lastTick = tick; + if (LuaEngine.CallLuaStatusEffectFunction(this.owner, this, "onTick", this.owner, this) > 0) + return true; + } + + if (duration >= 0 && tick >= endTime) + { + return true; + } + return false; + } + + public int CallLuaFunction(Character chara, string functionName, params object[] args) + { + + DynValue res = new DynValue(); + + return lua.LuaEngine.CallLuaStatusEffectFunction(chara, this, functionName, args); + if (!script.Globals.Get(functionName).IsNil()) + { + res = script.Call(script.Globals.Get(functionName), args); + if (res != null) + return (int)res.Number; + } + + } + + public Character GetOwner() + { + return owner; + } + + public Character GetSource() + { + return source ?? owner; + } + + public uint GetStatusEffectId() + { + return (uint)id; + } + + public ushort GetStatusId() + { + return (ushort)(id - 200000); + } + + public DateTime GetStartTime() + { + return startTime; + } + + public DateTime GetEndTime() + { + return endTime; + } + + public string GetName() + { + return name; + } + + public uint GetDuration() + { + return duration; + } + + public uint GetTickMs() + { + return tickMs; + } + + public double GetMagnitude() + { + return magnitude; + } + + public byte GetTier() + { + return tier; + } + + public double GetExtra() + { + return extra; + } + + public uint GetFlags() + { + return (uint)flags; + } + + public byte GetOverwritable() + { + return (byte)overwrite; + } + + public bool GetSilent() + { + return silent; + } + + public bool GetHidden() + { + return hidden; + } + + public void SetStartTime(DateTime time) + { + this.startTime = time; + this.lastTick = time; + } + + public void SetEndTime(DateTime time) + { + endTime = time; + } + + //Refresh the status, updating the end time based on the duration of the status and broadcasts the new time + public void RefreshTime() + { + endTime = DateTime.Now.AddSeconds(GetDuration()); + int index = Array.IndexOf(owner.charaWork.status, GetStatusId()); + + if (index >= 0) + owner.statusEffects.SetTimeAtIndex(index, (uint) Utils.UnixTimeStampUTC(endTime)); + } + + public void SetOwner(Character owner) + { + this.owner = owner; + } + + public void SetSource(Character source) + { + this.source = source; + } + + public void SetName(string name) + { + this.name = name; + } + + public void SetMagnitude(double magnitude) + { + this.magnitude = magnitude; + } + + public void SetDuration(uint duration) + { + this.duration = duration; + } + + public void SetTickMs(uint tickMs) + { + this.tickMs = tickMs; + } + + public void SetTier(byte tier) + { + this.tier = tier; + } + + public void SetExtra(double val) + { + this.extra = val; + } + + public void SetFlags(uint flags) + { + this.flags = (StatusEffectFlags)flags; + } + + public void SetOverwritable(byte overwrite) + { + this.overwrite = (StatusEffectOverwrite)overwrite; + } + + public void SetSilent(bool silent) + { + this.silent = silent; + } + + public void SetHidden(bool hidden) + { + this.hidden = hidden; + } + + public void SetAnimation(uint hitEffect) + { + animationEffect = (HitEffect)hitEffect; + } + + public uint GetAnimation() + { + return (uint)animationEffect; + } + } +} diff --git a/FFXIVClassic Map Server/actors/chara/ai/StatusEffectContainer.cs b/FFXIVClassic Map Server/actors/chara/ai/StatusEffectContainer.cs new file mode 100644 index 00000000..09742e6d --- /dev/null +++ b/FFXIVClassic Map Server/actors/chara/ai/StatusEffectContainer.cs @@ -0,0 +1,440 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using FFXIVClassic.Common; +using FFXIVClassic_Map_Server.Actors; +using FFXIVClassic_Map_Server.lua; +using FFXIVClassic_Map_Server.actors.area; +using FFXIVClassic_Map_Server.packets.send; +using FFXIVClassic_Map_Server.packets.send.actor; +using FFXIVClassic_Map_Server.packets.send.actor.battle; +using System.Collections.ObjectModel; +using FFXIVClassic_Map_Server.utils; + +namespace FFXIVClassic_Map_Server.actors.chara.ai +{ + class StatusEffectContainer + { + private Character owner; + private readonly Dictionary effects; + public static readonly int MAX_EFFECTS = 20; + private bool sendUpdate = false; + private DateTime lastTick;// Do all effects tick at the same time like regen? + private List statusSubpackets; + private ActorPropertyPacketUtil statusTimerPropPacketUtil; + + public StatusEffectContainer(Character owner) + { + this.owner = owner; + this.effects = new Dictionary(); + statusSubpackets = new List(); + statusTimerPropPacketUtil = new ActorPropertyPacketUtil("charawork/Status", owner); + } + + public void Update(DateTime tick) + { + //Regen/Refresh/Regain effects tick every 3 seconds + if ((DateTime.Now - lastTick).Seconds >= 3) + { + RegenTick(tick); + lastTick = DateTime.Now; + } + // list of effects to remove + + // if (owner is Player) UpdateTimeAtIndex(4, 4294967295); + var removeEffects = new List(); + for (int i = 0; i < effects.Values.Count; i++) + { + // effect's update function returns true if effect has completed + if (effects.Values.ElementAt(i).Update(tick)) + removeEffects.Add(effects.Values.ElementAt(i)); + + } + + // remove effects from this list + foreach (var effect in removeEffects) + { + RemoveStatusEffect(effect); + } + + if (sendUpdate) + { + owner.zone.BroadcastPacketsAroundActor(owner, owner.GetActorStatusPackets()); + sendUpdate = false; + } + } + + //regen/refresh/regain + public void RegenTick(DateTime tick) + { + ushort dotTick = (ushort) owner.GetMod(Modifier.RegenDown); + ushort regenTick = (ushort) owner.GetMod(Modifier.Regen); + ushort refreshtick = (ushort) owner.GetMod(Modifier.Refresh); + short regainTick = (short) owner.GetMod(Modifier.Regain); + + //DoTs tick before regen and the full dot damage is displayed, even if some or all of it is nullified by regen. Only effects like stoneskin actually alter the number shown + if (dotTick > 0) + { + CommandResult action = new CommandResult(owner.actorId, 30331, (uint)(HitEffect.HitEffectType | HitEffect.Hit), dotTick); + utils.BattleUtils.HandleStoneskin(owner, action); + // todo: figure out how to make red numbers appear for enemies getting hurt by dots + //owner.DelHP(action.amount); + utils.BattleUtils.DamageTarget(owner, owner, action, null); + owner.DoBattleAction(0, 0, action); + } + + //DoTs are the only effect to show numbers, so that doesnt need to be handled for these + owner.AddHP(regenTick); + owner.AddMP(refreshtick); + owner.AddTP(regainTick); + } + + public bool HasStatusEffect(uint id) + { + return effects.ContainsKey(id); + } + + public bool HasStatusEffect(StatusEffectId id) + { + return effects.ContainsKey((uint)id); + } + + public CommandResult AddStatusForCommandResult(uint id, byte tier = 1, ulong magnitude = 0, uint duration = 0) + { + CommandResult action = null; + + if (AddStatusEffect(id, tier, magnitude, duration)) + action = new CommandResult(owner.actorId, 30328, id | (uint)HitEffect.StatusEffectType); + + return action; + } + + public bool AddStatusEffect(uint id) + { + var se = Server.GetWorldManager().GetStatusEffect(id); + + return AddStatusEffect(se, owner); + } + + public bool AddStatusEffect(uint id, byte tier) + { + var se = Server.GetWorldManager().GetStatusEffect(id); + + se.SetTier(tier); + + return AddStatusEffect(se, owner); + } + + public bool AddStatusEffect(uint id, byte tier, double magnitude) + { + var se = Server.GetWorldManager().GetStatusEffect(id); + + se.SetMagnitude(magnitude); + se.SetTier(tier); + + return AddStatusEffect(se, owner); + } + + public bool AddStatusEffect(uint id, byte tier, double magnitude, uint duration, int tickMs = 3000) + { + var se = Server.GetWorldManager().GetStatusEffect(id); + if (se != null) + { + se.SetDuration(duration); + se.SetStartTime(DateTime.Now); + se.SetOwner(owner); + } + return AddStatusEffect(se ?? new StatusEffect(this.owner, id, magnitude, 3000, duration, tier), owner); + } + + public bool AddStatusEffect(StatusEffect newEffect, Character source, bool silent = false, bool hidden = false) + { + /* + worldMasterTextId + 32001 [@2B([@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])])] [@IF($E4($EB(1),$EB(2)),resist,resists)] the effect of [@SHEET(xtx/status,$E8(11),3)]. + 32002 [@SHEET(xtx/status,$E8(11),3)] fails to take effect. + */ + + var effect = GetStatusEffectById(newEffect.GetStatusEffectId()); + + bool canOverwrite = false; + if (effect != null) + { + var overwritable = effect.GetOverwritable(); + canOverwrite = (overwritable == (uint)StatusEffectOverwrite.Always) || + (overwritable == (uint)StatusEffectOverwrite.GreaterOnly && (effect.GetDuration() < newEffect.GetDuration() || effect.GetMagnitude() < newEffect.GetMagnitude())) || + (overwritable == (uint)StatusEffectOverwrite.GreaterOrEqualTo && (effect.GetDuration() <= newEffect.GetDuration() || effect.GetMagnitude() <= newEffect.GetMagnitude())); + } + + if (canOverwrite || effect == null) + { + // send packet to client with effect added message + if (effect != null && (!silent || !effect.GetSilent() || (effect.GetFlags() & (uint)StatusEffectFlags.Silent) == 0)) + { + // todo: send packet to client with effect added message + } + + // wont send a message about losing effect here + if (canOverwrite) + effects.Remove(newEffect.GetStatusEffectId()); + + newEffect.SetStartTime(DateTime.Now); + newEffect.SetEndTime(DateTime.Now.AddSeconds(newEffect.GetDuration())); + newEffect.SetOwner(owner); + + if (effects.Count < MAX_EFFECTS) + { + if(newEffect.script != null) + newEffect.CallLuaFunction(this.owner, "onGain", this.owner, newEffect); + else + LuaEngine.CallLuaStatusEffectFunction(this.owner, newEffect, "onGain", this.owner, newEffect); + effects.Add(newEffect.GetStatusEffectId(), newEffect); + //newEffect.SetSilent(silent); + newEffect.SetHidden(hidden); + + if (!newEffect.GetHidden()) + { + int index = 0; + + //If effect is already in the list of statuses, get that index, otherwise find the first open index + if (owner.charaWork.status.Contains(newEffect.GetStatusId())) + index = Array.IndexOf(owner.charaWork.status, newEffect.GetStatusId()); + else + index = Array.IndexOf(owner.charaWork.status, (ushort) 0); + + SetStatusAtIndex(index, newEffect.GetStatusId()); + //Stance statuses need their time set to an extremely high number so their icon doesn't flash + //Adding getduration with them doesn't work because it overflows + uint time = (newEffect.GetFlags() & (uint) StatusEffectFlags.Stance) == 0 ? Utils.UnixTimeStampUTC(newEffect.GetEndTime()) : 0xFFFFFFFF; + SetTimeAtIndex(index, time); + } + owner.RecalculateStats(); + } + return true; + } + return false; + } + + public bool RemoveStatusEffect(StatusEffect effect, bool silent = false) + { + bool removedEffect = false; + if (effect != null && effects.ContainsKey(effect.GetStatusEffectId())) + { + // send packet to client with effect remove message + if (!silent && !effect.GetSilent() && (effect.GetFlags() & (uint)StatusEffectFlags.Silent) == 0) + { + owner.DoBattleAction(0, 0, new CommandResult(owner.actorId, 30331, effect.GetStatusEffectId())); + } + + //hidden effects not in charawork + var index = Array.IndexOf(owner.charaWork.status, effect.GetStatusId()); + if (!effect.GetHidden() && index != -1) + { + SetStatusAtIndex(index, 0); + SetTimeAtIndex(index, 0); + } + // function onLose(actor, effect) + effects.Remove(effect.GetStatusEffectId()); + if(effect.script != null) + effect.CallLuaFunction(owner, "onLose", owner, effect); + else + LuaEngine.CallLuaStatusEffectFunction(this.owner, effect, "onLose", this.owner, effect); + owner.RecalculateStats(); + sendUpdate = true; + removedEffect = true; + } + + return removedEffect; + } + + public bool RemoveStatusEffect(uint effectId, bool silent = false) + { + bool removedEffect = false; + foreach (var effect in effects.Values) + { + if (effect.GetStatusEffectId() == effectId) + { + RemoveStatusEffect(effect, effect.GetSilent() || silent); + removedEffect = true; + break; + } + } + + return removedEffect; + } + + + //Remove status effect and return the CommandResult message instead of sending it immediately + public CommandResult RemoveStatusEffectForCommandResult(uint effectId, ushort worldMasterTextId = 30331) + { + CommandResult action = null; + if (RemoveStatusEffect(effectId, true)) + action = new CommandResult(owner.actorId, worldMasterTextId, effectId); + + return action; + } + + //Remove status effect and return the CommandResult message instead of sending it immediately + public CommandResult RemoveStatusEffectForCommandResult(StatusEffect effect, ushort worldMasterTextId = 30331) + { + CommandResult action = null; + if (RemoveStatusEffect(effect, true)) + action = new CommandResult(owner.actorId, worldMasterTextId, effect.GetStatusEffectId()); + return action; + } + + public StatusEffect CopyEffect(StatusEffect effect) + { + var newEffect = new StatusEffect(owner, effect); + newEffect.SetOwner(owner); + // todo: should source be copied too? + return AddStatusEffect(newEffect, effect.GetSource()) ? newEffect : null; + } + + public bool RemoveStatusEffectsByFlags(uint flags, bool silent = false) + { + // build list of effects to remove + var removeEffects = GetStatusEffectsByFlag(flags); + + // remove effects from main list + foreach (var effect in removeEffects) + RemoveStatusEffect(effect, silent); + + // removed an effect with one of these flags + return removeEffects.Count > 0; + } + + public StatusEffect GetStatusEffectById(uint id, byte tier = 0xFF) + { + StatusEffect effect; + + if (effects.TryGetValue(id, out effect) && effect.GetStatusEffectId() == id && (tier != 0xFF ? effect.GetTier() == tier : true)) + return effect; + + return null; + } + + public List GetStatusEffectsByFlag(uint flag) + { + var list = new List(); + foreach (var effect in effects.Values) + if ((effect.GetFlags() & flag) != 0) + list.Add(effect); + + return list; + } + + // todo: why the fuck cant c# convert enums/ + public bool HasStatusEffectsByFlag(StatusEffectFlags flags) + { + return HasStatusEffectsByFlag((uint)flags); + } + + public bool HasStatusEffectsByFlag(uint flag) + { + foreach (var effect in effects.Values) + { + if ((effect.GetFlags() & flag) != 0) + return true; + } + return false; + } + + public IEnumerable GetStatusEffects() + { + return effects.Values; + } + + void SaveStatusEffectsToDatabase(StatusEffectFlags removeEffectFlags = StatusEffectFlags.None) + { + if (owner is Player) + { + Database.SavePlayerStatusEffects((Player)owner); + } + } + + public void CallLuaFunctionByFlag(uint flag, string function, params object[] args) + { + var effects = GetStatusEffectsByFlag(flag); + + object[] argsWithEffect = new object[args.Length + 1]; + + for (int i = 0; i < args.Length; i++) + argsWithEffect[i + 1] = args[i]; + + foreach (var effect in effects) + { + argsWithEffect[0] = effect; + effect.CallLuaFunction(owner, function, argsWithEffect); + } + } + + //Sets the status id at an index. + //Changing a status to another doesn't seem to work. If updating an index that already has an effect, set it to 0 first then to the correct status + public void SetStatusAtIndex(int index, ushort statusId) + { + owner.charaWork.status[index] = statusId; + + statusSubpackets.Add(SetActorStatusPacket.BuildPacket(owner.actorId, (ushort)index, statusId)); + owner.updateFlags |= ActorUpdateFlags.Status; + } + + public void SetTimeAtIndex(int index, uint time) + { + owner.charaWork.statusShownTime[index] = time; + statusTimerPropPacketUtil.AddProperty($"charaWork.statusShownTime[{index}]"); + owner.updateFlags |= ActorUpdateFlags.StatusTime; + } + + public List GetStatusPackets() + { + return statusSubpackets; + } + + public List GetStatusTimerPackets() + { + return statusTimerPropPacketUtil.Done(); + } + + public void ResetPropPacketUtil() + { + statusTimerPropPacketUtil = new ActorPropertyPacketUtil("charaWork/status", owner); + } + + //Overwrites effectToBeReplaced with a new status effect + //Returns the message of the new effect being added + //Doing this instead of simply calling remove then add so that the new effect is in the same slot as the old one + //There should be a better way to do this + //Currently causes the icons to blink whenb eing rpelaced + public CommandResult ReplaceEffect(StatusEffect effectToBeReplaced, uint newEffectId, byte tier, double magnitude, uint duration) + { + StatusEffect newEffect = Server.GetWorldManager().GetStatusEffect(newEffectId); + newEffect.SetTier(tier); + newEffect.SetMagnitude(magnitude); + newEffect.SetDuration(duration); + newEffect.SetOwner(effectToBeReplaced.GetOwner()); + effectToBeReplaced.CallLuaFunction(owner, "onLose", owner, effectToBeReplaced); + newEffect.CallLuaFunction(owner, "onGain", owner, newEffect); + effects.Remove(effectToBeReplaced.GetStatusEffectId()); + + newEffect.SetStartTime(DateTime.Now); + newEffect.SetEndTime(DateTime.Now.AddSeconds(newEffect.GetDuration())); + uint time = (newEffect.GetFlags() & (uint)StatusEffectFlags.Stance) == 0 ? Utils.UnixTimeStampUTC(newEffect.GetEndTime()) : 0xFFFFFFFF; + int index = Array.IndexOf(owner.charaWork.status, effectToBeReplaced.GetStatusId()); + + //owner.charaWork.status[index] = newEffect.GetStatusId(); + owner.charaWork.statusShownTime[index] = time; + effects[newEffectId] = newEffect; + + SetStatusAtIndex(index, 0); + + //charawork/status + SetStatusAtIndex(index, (ushort) (newEffectId - 200000)); + SetTimeAtIndex(index, time); + + return new CommandResult(owner.actorId, 30328, (uint) HitEffect.StatusEffectType | newEffectId); + } + } +} \ No newline at end of file diff --git a/FFXIVClassic Map Server/actors/chara/ai/controllers/AllyController.cs b/FFXIVClassic Map Server/actors/chara/ai/controllers/AllyController.cs new file mode 100644 index 00000000..4098e2bb --- /dev/null +++ b/FFXIVClassic Map Server/actors/chara/ai/controllers/AllyController.cs @@ -0,0 +1,81 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using FFXIVClassic_Map_Server.Actors; +using FFXIVClassic_Map_Server.actors.chara.npc; +using FFXIVClassic.Common; + +namespace FFXIVClassic_Map_Server.actors.chara.ai.controllers +{ + // todo: this is probably not needed, can do everything in their script + class AllyController : BattleNpcController + { + protected new Ally owner; + public AllyController(Ally owner) : + base(owner) + { + this.owner = owner; + } + + protected List GetContentGroupCharas() + { + List contentGroupCharas = null; + + if (owner.currentContentGroup != null) + { + contentGroupCharas = new List(owner.currentContentGroup.GetMemberCount()); + foreach (var charaId in owner.currentContentGroup.GetMembers()) + { + var chara = owner.zone.FindActorInArea(charaId); + + if (chara != null) + contentGroupCharas.Add(chara); + } + } + + return contentGroupCharas; + } + + //Iterate over players in the group and if they are fighting, assist them + protected override void TryAggro(DateTime tick) + { + //lua.LuaEngine.CallLuaBattleFunction(owner, "tryAggro", owner, GetContentGroupCharas()); + + foreach(Character chara in GetContentGroupCharas()) + { + if(chara.IsPlayer()) + { + if(owner.aiContainer.GetTargetFind().CanTarget((Character) chara.target) && chara.target is BattleNpc && ((BattleNpc)chara.target).hateContainer.HasHateForTarget(chara)) + { + owner.Engage(chara.target.actorId); + owner.hateContainer.AddBaseHate((Character) chara.target); + break; + } + } + } + //base.TryAggro(tick); + } + + // server really likes to hang whenever scripts iterate area's actorlist + protected override void DoCombatTick(DateTime tick, List contentGroupCharas = null) + { + if (contentGroupCharas == null) + { + contentGroupCharas = GetContentGroupCharas(); + } + + base.DoCombatTick(tick, contentGroupCharas); + } + + protected override void DoRoamTick(DateTime tick, List contentGroupCharas = null) + { + if (contentGroupCharas == null) + { + contentGroupCharas = GetContentGroupCharas(); + } + base.DoRoamTick(tick, contentGroupCharas); + } + } +} diff --git a/FFXIVClassic Map Server/actors/chara/ai/controllers/BattleNpcController.cs b/FFXIVClassic Map Server/actors/chara/ai/controllers/BattleNpcController.cs new file mode 100644 index 00000000..a2ebeb87 --- /dev/null +++ b/FFXIVClassic Map Server/actors/chara/ai/controllers/BattleNpcController.cs @@ -0,0 +1,412 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using FFXIVClassic.Common; +using FFXIVClassic_Map_Server.Actors; +using FFXIVClassic_Map_Server.packets.send.actor; +using FFXIVClassic_Map_Server.actors.area; +using FFXIVClassic_Map_Server.utils; +using FFXIVClassic_Map_Server.actors.chara.ai.state; +using FFXIVClassic_Map_Server.actors.chara.npc; + +namespace FFXIVClassic_Map_Server.actors.chara.ai.controllers +{ + class BattleNpcController : Controller + { + protected DateTime lastActionTime; + protected DateTime lastSpellCastTime; + protected DateTime lastSkillTime; + protected DateTime lastSpecialSkillTime; // todo: i dont think monsters have "2hr" cooldowns like ffxi + protected DateTime deaggroTime; + protected DateTime neutralTime; + protected DateTime waitTime; + + private bool firstSpell = true; + protected DateTime lastRoamUpdate; + protected DateTime battleStartTime; + + protected new BattleNpc owner; + public BattleNpcController(BattleNpc owner) : + base(owner) + { + this.owner = owner; + this.lastUpdate = DateTime.Now; + this.waitTime = lastUpdate.AddSeconds(5); + } + + public override void Update(DateTime tick) + { + lastUpdate = tick; + if (!owner.IsDead()) + { + // todo: handle aggro/deaggro and other shit here + if (!owner.aiContainer.IsEngaged()) + { + TryAggro(tick); + } + + if (owner.aiContainer.IsEngaged()) + { + DoCombatTick(tick); + } + //Only move if owner isn't dead and is either too far away from their spawn point or is meant to roam and isn't in combat + else if (!owner.IsDead() && (owner.isMovingToSpawn || owner.GetMobMod((uint)MobModifier.Roams) > 0)) + { + DoRoamTick(tick); + } + } + } + + public bool TryDeaggro() + { + if (owner.hateContainer.GetMostHatedTarget() == null || !owner.aiContainer.GetTargetFind().CanTarget(owner.target as Character)) + { + return true; + } + else if (!owner.IsCloseToSpawn()) + { + return true; + } + return false; + } + + //If the owner isn't moving to spawn, iterate over nearby enemies and + //aggro the first one that is within 10 levels and can be detected, then engage + protected virtual void TryAggro(DateTime tick) + { + if (tick >= neutralTime && !owner.isMovingToSpawn) + { + if (!owner.neutral && owner.IsAlive()) + { + foreach (var chara in owner.zone.GetActorsAroundActor(owner, 50)) + { + if (chara.allegiance == owner.allegiance) + continue; + + if (owner.aiContainer.pathFind.AtPoint() && owner.detectionType != DetectionType.None) + { + uint levelDifference = (uint)Math.Abs(owner.GetLevel() - chara.GetLevel()); + + if (levelDifference <= 10 || (owner.detectionType & DetectionType.IgnoreLevelDifference) != 0 && CanAggroTarget(chara)) + { + owner.hateContainer.AddBaseHate(chara); + break; + } + } + } + } + } + + if (owner.hateContainer.GetHateList().Count > 0) + { + Engage(owner.hateContainer.GetMostHatedTarget()); + } + } + + public override bool Engage(Character target) + { + var canEngage = this.owner.aiContainer.InternalEngage(target); + if (canEngage) + { + //owner.ChangeState(SetActorStatePacket.MAIN_STATE_ACTIVE); + + // reset casting + firstSpell = true; + // todo: find a better place to put this? + if (owner.GetState() != SetActorStatePacket.MAIN_STATE_ACTIVE) + owner.ChangeState(SetActorStatePacket.MAIN_STATE_ACTIVE); + + lastActionTime = DateTime.Now; + battleStartTime = lastActionTime; + // todo: adjust cooldowns with modifiers + } + return canEngage; + } + + protected bool TryEngage(Character target) + { + // todo: + return true; + } + + public override void Disengage() + { + var target = owner.target; + base.Disengage(); + // todo: + lastActionTime = lastUpdate.AddSeconds(5); + owner.isMovingToSpawn = true; + owner.aiContainer.pathFind.SetPathFlags(PathFindFlags.None); + owner.aiContainer.pathFind.PreparePath(owner.spawnX, owner.spawnY, owner.spawnZ, 1.5f, 10); + neutralTime = lastActionTime; + owner.hateContainer.ClearHate(); + lua.LuaEngine.CallLuaBattleFunction(owner, "onDisengage", owner, target, Utils.UnixTimeStampUTC(lastUpdate)); + } + + public override void Cast(Character target, uint spellId) + { + // todo: + if(owner.aiContainer.CanChangeState()) + owner.aiContainer.InternalCast(target, spellId); + } + + public override void Ability(Character target, uint abilityId) + { + // todo: + if (owner.aiContainer.CanChangeState()) + owner.aiContainer.InternalAbility(target, abilityId); + } + + public override void RangedAttack(Character target) + { + // todo: + } + + public override void MonsterSkill(Character target, uint mobSkillId) + { + // todo: + } + + protected virtual void DoRoamTick(DateTime tick, List contentGroupCharas = null) + { + if (tick >= waitTime) + { + neutralTime = tick.AddSeconds(5); + if (owner.aiContainer.pathFind.IsFollowingPath()) + { + owner.aiContainer.pathFind.FollowPath(); + lastActionTime = tick.AddSeconds(-5); + } + else + { + if (tick >= lastActionTime) + { + + } + } + waitTime = tick.AddSeconds(owner.GetMobMod((uint) MobModifier.RoamDelay)); + owner.OnRoam(tick); + + if (CanMoveForward(0.0f) && !owner.aiContainer.pathFind.IsFollowingPath()) + { + // will move on next tick + owner.aiContainer.pathFind.SetPathFlags(PathFindFlags.None); + owner.aiContainer.pathFind.PathInRange(owner.spawnX, owner.spawnY, owner.spawnZ, 1.5f, 50.0f); + } + //lua.LuaEngine.CallLuaBattleFunction(owner, "onRoam", owner, contentGroupCharas); + } + + if (owner.aiContainer.pathFind.IsFollowingPath() && owner.aiContainer.CanFollowPath()) + { + owner.aiContainer.pathFind.FollowPath(); + } + } + + protected virtual void DoCombatTick(DateTime tick, List contentGroupCharas = null) + { + HandleHate(); + // todo: magic/attack/ws cooldowns etc + if (TryDeaggro()) + { + Disengage(); + return; + } + owner.SetMod((uint)Modifier.Speed, 5); + if ((tick - lastCombatTickScript).TotalSeconds > 3) + { + Move(); + //if (owner.aiContainer.CanChangeState()) + //owner.aiContainer.WeaponSkill(owner.zone.FindActorInArea(owner.target.actorId), 27155); + //lua.LuaEngine.CallLuaBattleFunction(owner, "onCombatTick", owner, owner.target, Utils.UnixTimeStampUTC(tick), contentGroupCharas); + lastCombatTickScript = tick; + } + } + + protected virtual void Move() + { + if (!owner.aiContainer.CanFollowPath()) + { + return; + } + + if (owner.aiContainer.pathFind.IsFollowingScriptedPath()) + { + owner.aiContainer.pathFind.FollowPath(); + return; + } + + var vecToTarget = owner.target.GetPosAsVector3() - owner.GetPosAsVector3(); + vecToTarget /= vecToTarget.Length(); + vecToTarget = (Utils.Distance(owner.GetPosAsVector3(), owner.target.GetPosAsVector3()) - owner.GetAttackRange() + 0.2f) * vecToTarget; + + var targetPos = vecToTarget + owner.GetPosAsVector3(); + var distance = Utils.Distance(owner.GetPosAsVector3(), owner.target.GetPosAsVector3()); + if (distance > owner.GetAttackRange() - 0.2f) + { + if (CanMoveForward(distance)) + { + if (!owner.aiContainer.pathFind.IsFollowingPath() && distance > 3) + { + // pathfind if too far otherwise jump to target + owner.aiContainer.pathFind.SetPathFlags(PathFindFlags.None); + owner.aiContainer.pathFind.PreparePath(targetPos, 1.5f, 5); + } + owner.aiContainer.pathFind.FollowPath(); + if (!owner.aiContainer.pathFind.IsFollowingPath()) + { + if (owner.target is Player) + { + foreach (var chara in owner.zone.GetActorsAroundActor(owner, 1)) + { + if (chara == owner) + continue; + + float mobDistance = Utils.Distance(owner.positionX, owner.positionY, owner.positionZ, chara.positionX, chara.positionY, chara.positionZ); + if (mobDistance < 0.50f && (chara.updateFlags & ActorUpdateFlags.Position) == 0) + { + owner.aiContainer.pathFind.PathInRange(targetPos, 1.3f, chara.GetAttackRange()); + break; + } + } + } + FaceTarget(); + } + } + } + else + { + FaceTarget(); + } + lastRoamUpdate = DateTime.Now; + } + + protected void FaceTarget() + { + // todo: check if stunned etc + if (owner.statusEffects.HasStatusEffectsByFlag(StatusEffectFlags.PreventTurn) ) + { + } + else + { + owner.LookAt(owner.target); + } + } + + protected bool CanMoveForward(float distance) + { + // todo: check spawn leash and stuff + if (!owner.IsCloseToSpawn()) + { + return false; + } + if (owner.GetSpeed() == 0) + { + return false; + } + return true; + } + + public virtual bool CanAggroTarget(Character target) + { + if (owner.neutral || owner.detectionType == DetectionType.None || owner.IsDead()) + { + return false; + } + + // todo: can mobs aggro mounted targets? + if (target.IsDead() || target.currentMainState == SetActorStatePacket.MAIN_STATE_MOUNTED) + { + return false; + } + + if (owner.aiContainer.IsSpawned() && !owner.aiContainer.IsEngaged() && CanDetectTarget(target)) + { + return true; + } + return false; + } + + public virtual bool CanDetectTarget(Character target, bool forceSight = false) + { + if (owner.IsDead()) + return false; + + // todo: this should probably be changed to only allow detection at end of path? + if (owner.aiContainer.pathFind.IsFollowingScriptedPath() || owner.aiContainer.pathFind.IsFollowingPath() && !owner.aiContainer.pathFind.AtPoint()) + { + return false; + } + + // todo: handle sight/scent/hp etc + if (target.IsDead() || target.currentMainState == SetActorStatePacket.MAIN_STATE_MOUNTED) + return false; + + float verticalDistance = Math.Abs(target.positionY - owner.positionY); + if (verticalDistance > 8) + return false; + + var distance = Utils.Distance(owner.positionX, owner.positionY, owner.positionZ, target.positionX, target.positionY, target.positionZ); + + bool detectSight = forceSight || (owner.detectionType & DetectionType.Sight) != 0; + bool hasSneak = false; + bool hasInvisible = false; + bool isFacing = owner.IsFacing(target); + + // use the mobmod sight range before defaulting to 20 yalms + if (detectSight && !hasInvisible && isFacing && distance < owner.GetMobMod((uint)MobModifier.SightRange)) + return CanSeePoint(target.positionX, target.positionY, target.positionZ); + + // todo: check line of sight and aggroTypes + if (distance > 20) + { + return false; + } + + // todo: seems ffxiv doesnt even differentiate between sneak/invis? + { + hasSneak = target.statusEffects.HasStatusEffectsByFlag((uint)StatusEffectFlags.Stealth); + hasInvisible = hasSneak; + } + + + + if ((owner.detectionType & DetectionType.Sound) != 0 && !hasSneak && distance < owner.GetMobMod((uint)MobModifier.SoundRange)) + return CanSeePoint(target.positionX, target.positionY, target.positionZ); + + if ((owner.detectionType & DetectionType.Magic) != 0 && target.aiContainer.IsCurrentState()) + return CanSeePoint(target.positionX, target.positionY, target.positionZ); + + if ((owner.detectionType & DetectionType.LowHp) != 0 && target.GetHPP() < 75) + return CanSeePoint(target.positionX, target.positionY, target.positionZ); + + return false; + } + + public virtual bool CanSeePoint(float x, float y, float z) + { + return NavmeshUtils.CanSee((Zone)owner.zone, owner.positionX, owner.positionY, owner.positionZ, x, y, z); + } + + protected virtual void HandleHate() + { + ChangeTarget(owner.hateContainer.GetMostHatedTarget()); + } + + public override void ChangeTarget(Character target) + { + if (target != owner.target) + { + owner.target = target; + owner.currentLockedTarget = target?.actorId ?? Actor.INVALID_ACTORID; + owner.currentTarget = target?.actorId ?? Actor.INVALID_ACTORID; + + foreach (var player in owner.zone.GetActorsAroundActor(owner, 50)) + player.QueuePacket(owner.GetHateTypePacket(player)); + + base.ChangeTarget(target); + } + } + } +} diff --git a/FFXIVClassic Map Server/actors/chara/ai/controllers/Controller.cs b/FFXIVClassic Map Server/actors/chara/ai/controllers/Controller.cs new file mode 100644 index 00000000..ab194953 --- /dev/null +++ b/FFXIVClassic Map Server/actors/chara/ai/controllers/Controller.cs @@ -0,0 +1,80 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using FFXIVClassic_Map_Server.Actors; + +namespace FFXIVClassic_Map_Server.actors.chara.ai.controllers +{ + abstract class Controller + { + protected Character owner; + + protected DateTime lastCombatTickScript; + protected DateTime lastUpdate; + public bool canUpdate = true; + protected bool autoAttackEnabled = true; + protected bool castingEnabled = true; + protected bool weaponSkillEnabled = true; + protected PathFind pathFind; + protected TargetFind targetFind; + + public Controller(Character owner) + { + this.owner = owner; + } + + public abstract void Update(DateTime tick); + public abstract bool Engage(Character target); + public abstract void Cast(Character target, uint spellId); + public virtual void WeaponSkill(Character target, uint weaponSkillId) { } + public virtual void MonsterSkill(Character target, uint mobSkillId) { } + public virtual void UseItem(Character target, uint slot, uint itemId) { } + public abstract void Ability(Character target, uint abilityId); + public abstract void RangedAttack(Character target); + public virtual void Spawn() { } + public virtual void Despawn() { } + + + public virtual void Disengage() + { + owner.aiContainer.InternalDisengage(); + } + + public virtual void ChangeTarget(Character target) + { + owner.aiContainer.InternalChangeTarget(target); + } + + public bool IsAutoAttackEnabled() + { + return autoAttackEnabled; + } + + public void SetAutoAttackEnabled(bool isEnabled) + { + autoAttackEnabled = isEnabled; + } + + public bool IsCastingEnabled() + { + return castingEnabled; + } + + public void SetCastingEnabled(bool isEnabled) + { + castingEnabled = isEnabled; + } + + public bool IsWeaponSkillEnabled() + { + return weaponSkillEnabled; + } + + public void SetWeaponSkillEnabled(bool isEnabled) + { + weaponSkillEnabled = isEnabled; + } + } +} diff --git a/FFXIVClassic Map Server/actors/chara/ai/controllers/PetController.cs b/FFXIVClassic Map Server/actors/chara/ai/controllers/PetController.cs new file mode 100644 index 00000000..bfcef0ac --- /dev/null +++ b/FFXIVClassic Map Server/actors/chara/ai/controllers/PetController.cs @@ -0,0 +1,72 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using FFXIVClassic_Map_Server.Actors; + +namespace FFXIVClassic_Map_Server.actors.chara.ai.controllers +{ + class PetController : Controller + { + private Character petMaster; + + public PetController(Character owner) : + base(owner) + { + this.lastUpdate = Program.Tick; + } + + public override void Update(DateTime tick) + { + // todo: handle pet stuff on tick + } + + public override void ChangeTarget(Character target) + { + base.ChangeTarget(target); + } + + public override bool Engage(Character target) + { + // todo: check distance, last swing time, status effects + return true; + } + + public override void Disengage() + { + // todo: + return; + } + + public override void Cast(Character target, uint spellId) + { + + } + + public override void Ability(Character target, uint abilityId) + { + + } + + public override void RangedAttack(Character target) + { + + } + + public Character GetPetMaster() + { + return petMaster; + } + + public void SetPetMaster(Character master) + { + petMaster = master; + + if (master is Player) + owner.allegiance = CharacterTargetingAllegiance.Player; + else + owner.allegiance = CharacterTargetingAllegiance.BattleNpcs; + } + } +} diff --git a/FFXIVClassic Map Server/actors/chara/ai/controllers/PlayerController.cs b/FFXIVClassic Map Server/actors/chara/ai/controllers/PlayerController.cs new file mode 100644 index 00000000..1505d453 --- /dev/null +++ b/FFXIVClassic Map Server/actors/chara/ai/controllers/PlayerController.cs @@ -0,0 +1,93 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using FFXIVClassic_Map_Server.Actors; +using FFXIVClassic_Map_Server.packets.send.actor; +using FFXIVClassic.Common; + +namespace FFXIVClassic_Map_Server.actors.chara.ai.controllers +{ + class PlayerController : Controller + { + private new Player owner; + public PlayerController(Player owner) : + base(owner) + { + this.owner = owner; + this.lastUpdate = DateTime.Now; + } + + public override void Update(DateTime tick) + { + /* + if (owner.newMainState != owner.currentMainState) + { + if (owner.newMainState == SetActorStatePacket.MAIN_STATE_ACTIVE) + { + owner.Engage(); + } + else + { + owner.Disengage(); + } + owner.currentMainState = (ushort)owner.newMainState; + }*/ + } + + public override void ChangeTarget(Character target) + { + owner.target = target; + base.ChangeTarget(target); + } + + public override bool Engage(Character target) + { + var canEngage = this.owner.aiContainer.InternalEngage(target); + if (canEngage) + { + if (owner.statusEffects.HasStatusEffect(StatusEffectId.Sleep)) + { + // That command cannot be performed. + owner.SendGameMessage(Server.GetWorldManager().GetActor(), 32553, 0x20); + return false; + } + // todo: adjust cooldowns with modifiers + } + return canEngage; + } + + public override void Disengage() + { + // todo: + base.Disengage(); + return; + } + + public override void Cast(Character target, uint spellId) + { + owner.aiContainer.InternalCast(target, spellId); + } + + public override void WeaponSkill(Character target, uint weaponSkillId) + { + owner.aiContainer.InternalWeaponSkill(target, weaponSkillId); + } + + public override void Ability(Character target, uint abilityId) + { + owner.aiContainer.InternalAbility(target, abilityId); + } + + public override void RangedAttack(Character target) + { + + } + + public override void UseItem(Character target, uint slot, uint itemId) + { + owner.aiContainer.InternalUseItem(target, slot, itemId); + } + } +} diff --git a/FFXIVClassic Map Server/actors/chara/ai/helpers/ActionQueue.cs b/FFXIVClassic Map Server/actors/chara/ai/helpers/ActionQueue.cs new file mode 100644 index 00000000..87112724 --- /dev/null +++ b/FFXIVClassic Map Server/actors/chara/ai/helpers/ActionQueue.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using FFXIVClassic_Map_Server.Actors; +using MoonSharp; +using MoonSharp.Interpreter; +using FFXIVClassic_Map_Server.lua; + +namespace FFXIVClassic_Map_Server.actors.chara.ai +{ + class Action + { + public DateTime startTime; + public uint durationMs; + public bool checkState; + // todo: lua function + LuaScript script; + } + + class ActionQueue + { + private Character owner; + private Queue actionQueue; + private Queue timerQueue; + + public bool IsEmpty { get { return actionQueue.Count > 0 || timerQueue.Count > 0; } } + + public ActionQueue(Character owner) + { + this.owner = owner; + actionQueue = new Queue(); + timerQueue = new Queue(); + } + + public void PushAction(Action action) + { + + } + + public void Update(DateTime tick) + { + + } + + public void HandleAction(Action action) + { + + } + + public void CheckAction(DateTime tick) + { + + } + } +} diff --git a/FFXIVClassic Map Server/actors/chara/ai/helpers/PathFind.cs b/FFXIVClassic Map Server/actors/chara/ai/helpers/PathFind.cs new file mode 100644 index 00000000..399bb9b5 --- /dev/null +++ b/FFXIVClassic Map Server/actors/chara/ai/helpers/PathFind.cs @@ -0,0 +1,211 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using FFXIVClassic_Map_Server.Actors; +using FFXIVClassic_Map_Server; +using FFXIVClassic_Map_Server.utils; +using FFXIVClassic.Common; +using FFXIVClassic_Map_Server.actors.area; +using FFXIVClassic_Map_Server.packets.send.actor; + +// port of https://github.com/DarkstarProject/darkstar/blob/master/src/map/ai/helpers/pathfind.h + +namespace FFXIVClassic_Map_Server.actors.chara.ai +{ + // todo: check for obstacles, los, etc + public enum PathFindFlags + { + None, + Scripted = 0x01, + IgnoreNav = 0x02, + } + class PathFind + { + private Character owner; + private List path; + private bool canFollowPath; + float distanceFromPoint; + + private PathFindFlags pathFlags; + + public PathFind(Character owner) + { + this.owner = owner; + } + + public void PreparePath(Vector3 dest, float stepSize = 1.25f, int maxPath = 40, float polyRadius = 0.0f) + { + PreparePath(dest.X, dest.Y, dest.Z, stepSize, maxPath, polyRadius); + } + + public void PreparePath(float x, float y, float z, float stepSize = 1.25f, int maxPath = 40, float polyRadius = 0.0f) + { + var pos = new Vector3(owner.positionX, owner.positionY, owner.positionZ); + var dest = new Vector3(x, y, z); + + Zone zone; + if (owner.GetZone() is PrivateArea || owner.GetZone() is PrivateAreaContent) + zone = (Zone)((PrivateArea)owner.GetZone()).GetParentZone(); + else + zone = (Zone)owner.GetZone(); + + var sw = new System.Diagnostics.Stopwatch(); + sw.Start(); + + if ((pathFlags & PathFindFlags.IgnoreNav) != 0) + path = new List(1) { new Vector3(x, y, z) }; + else + path = NavmeshUtils.GetPath(zone, pos, dest, stepSize, maxPath, polyRadius); + + if (path != null) + { + if (owner.oldPositionX == 0.0f && owner.oldPositionY == 0.0f && owner.oldPositionZ == 0.0f) + { + owner.oldPositionX = owner.positionX; + owner.oldPositionY = owner.positionY; + owner.oldPositionZ = owner.positionZ; + } + + // todo: something went wrong + if (path.Count == 0) + { + owner.positionX = owner.oldPositionX; + owner.positionY = owner.oldPositionY; + owner.positionZ = owner.oldPositionZ; + } + + sw.Stop(); + zone.pathCalls++; + zone.pathCallTime += sw.ElapsedMilliseconds; + + //if (path.Count == 1) + // Program.Log.Info($"mypos: {owner.positionX} {owner.positionY} {owner.positionZ} | targetPos: {x} {y} {z} | step {stepSize} | maxPath {maxPath} | polyRadius {polyRadius}"); + + //Program.Log.Error("[{0}][{1}] Created {2} points in {3} milliseconds", owner.actorId, owner.actorName, path.Count, sw.ElapsedMilliseconds); + } + } + + public void PathInRange(Vector3 dest, float minRange, float maxRange) + { + PathInRange(dest.X, dest.Y, dest.Z, minRange, maxRange); + } + + public void PathInRange(float x, float y, float z, float minRange, float maxRange = 5.0f) + { + var dest = owner.FindRandomPoint(x, y, z, minRange, maxRange); + // todo: this is dumb.. + distanceFromPoint = owner.GetAttackRange(); + PreparePath(dest.X, dest.Y, dest.Z); + } + + + public void SetPathFlags(PathFindFlags flags) + { + this.pathFlags = flags; + } + + public bool IsFollowingPath() + { + return path?.Count > 0; + } + + public bool IsFollowingScriptedPath() + { + return (pathFlags & PathFindFlags.Scripted) != 0; + } + + public void FollowPath() + { + if (path?.Count > 0) + { + var point = path[0]; + + StepTo(point); + + if (AtPoint(point)) + { + path.Remove(point); + owner.OnPath(point); + //Program.Log.Error($"{owner.actorName} arrived at point {point.X} {point.Y} {point.Z}"); + } + + if (path.Count == 0 && owner.target != null) + owner.LookAt(owner.target); + } + } + + public bool AtPoint(Vector3 point = null) + { + if (point == null && path != null && path.Count > 0) + { + point = path[path.Count - 1]; + } + else + { + distanceFromPoint = 0; + return true; + } + + if (distanceFromPoint == 0) + return owner.positionX == point.X && owner.positionZ == point.Z; + else + return Utils.Distance(owner.positionX, owner.positionY, owner.positionZ, point.X, point.Y, point.Z) <= (distanceFromPoint + 4.5f); + } + + public void StepTo(Vector3 point, bool run = false) + { + float speed = GetSpeed(); + + float stepDistance = speed / 3; + float distanceTo = Utils.Distance(owner.positionX, owner.positionY, owner.positionZ, point.X, point.Y, point.Z); + + owner.LookAt(point); + + if (distanceTo <= distanceFromPoint + stepDistance) + { + if (distanceFromPoint <= owner.GetAttackRange()) + { + owner.QueuePositionUpdate(point); + } + else + { + float x = owner.positionX - (float)Math.Cos(owner.rotation + (float)(Math.PI / 2)) * (distanceTo - distanceFromPoint); + float z = owner.positionZ + (float)Math.Sin(owner.rotation + (float)(Math.PI / 2)) * (distanceTo - distanceFromPoint); + + owner.QueuePositionUpdate(x, owner.positionY, z); + } + } + else + { + float x = owner.positionX - (float)Math.Cos(owner.rotation + (float)(Math.PI / 2)) * (distanceTo - distanceFromPoint); + float z = owner.positionZ + (float)Math.Sin(owner.rotation + (float)(Math.PI / 2)) * (distanceTo - distanceFromPoint); + + owner.QueuePositionUpdate(x, owner.positionY, z); + } + } + + public void Clear() + { + path?.Clear(); + pathFlags = PathFindFlags.None; + distanceFromPoint = 0.0f; + } + + private float GetSpeed() + { + float baseSpeed = owner.GetSpeed(); + + if (!(owner is Player)) + { + if (owner is BattleNpc) + { + //owner.ChangeSpeed(0.0f, SetActorSpeedPacket.DEFAULT_WALK - 2.0f, SetActorSpeedPacket.DEFAULT_RUN - 2.0f, SetActorSpeedPacket.DEFAULT_ACTIVE - 2.0f); + } + // baseSpeed += ConfigConstants.NPC_SPEED_MOD; + } + return baseSpeed; + } + } +} diff --git a/FFXIVClassic Map Server/actors/chara/ai/helpers/TargetFind.cs b/FFXIVClassic Map Server/actors/chara/ai/helpers/TargetFind.cs new file mode 100644 index 00000000..77814d67 --- /dev/null +++ b/FFXIVClassic Map Server/actors/chara/ai/helpers/TargetFind.cs @@ -0,0 +1,462 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using FFXIVClassic_Map_Server.Actors; +using FFXIVClassic.Common; +using FFXIVClassic_Map_Server.actors.chara.ai; +using FFXIVClassic_Map_Server.actors.chara.ai.controllers; +using FFXIVClassic_Map_Server.actors.group; +using FFXIVClassic_Map_Server.packets.send.actor; + +// port of dsp's ai code https://github.com/DarkstarProject/darkstar/blob/master/src/map/ai/ + +namespace FFXIVClassic_Map_Server.actors.chara.ai +{ + // https://github.com/Windower/POLUtils/blob/master/PlayOnline.FFXI/Enums.cs + [Flags] + public enum ValidTarget : ushort + { + None = 0x00, + Self = 0x01, + Player = 0x02, + PartyMember = 0x04, + Ally = 0x08, + NPC = 0x10, + Enemy = 0x20, + Unknown = 0x40, + Object = 0x60, + CorpseOnly = 0x80, + Corpse = 0x9D // CorpseOnly + NPC + Ally + Partymember + Self + } + + /// Targeting from/to different entity types + enum TargetFindCharacterType : byte + { + None, + /// Player can target all s in party + PlayerToPlayer, + /// Player can target all s (excluding player owned s) + PlayerToBattleNpc, + /// BattleNpc can target other s + BattleNpcToBattleNpc, + /// BattleNpc can target s and their s + BattleNpcToPlayer, + } + + /// Type of AOE region to create + enum TargetFindAOEType : byte + { + None, + /// Really a cylinder, uses maxDistance parameter in SetAOEType + Circle, + /// Create a cone with param in radians + Cone, + /// Box using self/target coords and + Box + } + + /// Set AOE around self or target + enum TargetFindAOETarget : byte + { + /// Set AOE's origin at target's position + Target, + /// Set AOE's origin to own position. + Self + } + + /// Target finding helper class + class TargetFind + { + private Character owner; + private Character masterTarget; // if target is a pet, this is the owner + private TargetFindCharacterType findType; + private ValidTarget validTarget; + private TargetFindAOETarget aoeTarget; + private TargetFindAOEType aoeType; + private Vector3 aoeTargetPosition; //This is the center of circle an cone AOEs and the position where line aoes come out + private float aoeTargetRotation; //This is the direction the aoe target is facing + private float maxDistance; //Radius for circle and cone AOEs, length for line AOEs + private float minDistance; //Minimum distance to that target must be to be able to be hit + private float width; //Width of line AOEs + private float height; //All AoEs are boxes or cylinders. Height is usually 10y regardless of maxDistance, but some commands have different values. Height is total height, so targets can be at most half this distance away on Y axis + private float aoeRotateAngle; //This is the angle that cones and line aoes are rotated about aoeTargetPosition for skills that come out of a side other than the front + private float coneAngle; //The angle of the cone itself in Pi Radians + private float param; + private List targets; + + public TargetFind(Character owner) + { + this.owner = owner; + Reset(); + } + + public void Reset() + { + this.findType = TargetFindCharacterType.None; + this.validTarget = ValidTarget.Enemy; + this.aoeType = TargetFindAOEType.None; + this.aoeTarget = TargetFindAOETarget.Target; + this.aoeTargetPosition = null; + this.aoeTargetRotation = 0; + this.maxDistance = 0.0f; + this.minDistance = 0.0f; + this.width = 0.0f; + this.height = 0.0f; + this.aoeRotateAngle = 0.0f; + this.coneAngle = 0.0f; + this.param = 0.0f; + this.targets = new List(); + } + + public List GetTargets() where T : Character + { + return new List(targets.OfType()); + } + + public List GetTargets() + { + return targets; + } + + /// + /// Call this before + /// + /// + /// - radius of circle + /// - height of cone + /// - width of box / 2 (todo: set box length not just between user and target) + /// + /// param in degrees of cone (todo: probably use radians and forget converting at runtime) + public void SetAOEType(ValidTarget validTarget, TargetFindAOEType aoeType, TargetFindAOETarget aoeTarget, float maxDistance, float minDistance, float height, float aoeRotate, float coneAngle, float param = 0.0f) + { + this.validTarget = validTarget; + this.aoeType = aoeType; + this.maxDistance = maxDistance; + this.minDistance = minDistance; + this.param = param; + this.height = height; + this.aoeRotateAngle = aoeRotate; + this.coneAngle = coneAngle; + } + + /// + /// Call this to prepare Box AOE + /// + /// + /// + /// + /// + public void SetAOEBox(ValidTarget validTarget, TargetFindAOETarget aoeTarget, float length, float width, float aoeRotateAngle) + { + this.validTarget = validTarget; + this.aoeType = TargetFindAOEType.Box; + this.aoeTarget = aoeTarget; + this.aoeRotateAngle = aoeRotateAngle; + float x = owner.positionX - (float)Math.Cos(owner.rotation + (float)(Math.PI / 2)) * (length); + float z = owner.positionZ + (float)Math.Sin(owner.rotation + (float)(Math.PI / 2)) * (length); + this.maxDistance = length; + this.width = width; + } + + /// + /// Find and try to add a single target to target list + /// + public void FindTarget(Character target, ValidTarget flags) + { + validTarget = flags; + // todo: maybe this should only be set if successfully added? + AddTarget(target, false); + } + + /// + /// Call SetAOEType before calling this + /// Find targets within area set by + /// + public void FindWithinArea(Character target, ValidTarget flags, TargetFindAOETarget aoeTarget) + { + targets.Clear(); + validTarget = flags; + // are we creating aoe circles around target or self + if (aoeTarget == TargetFindAOETarget.Self) + { + this.aoeTargetPosition = owner.GetPosAsVector3(); + this.aoeTargetRotation = owner.rotation + (float) (aoeRotateAngle * Math.PI); + } + else + { + this.aoeTargetPosition = target.GetPosAsVector3(); + this.aoeTargetRotation = target.rotation + (float) (aoeRotateAngle * Math.PI); + } + + masterTarget = TryGetMasterTarget(target) ?? target; + + // todo: this is stupid + bool withPet = (flags & ValidTarget.Ally) != 0 || masterTarget.allegiance != owner.allegiance; + + if (masterTarget != null && CanTarget(masterTarget)) + targets.Add(masterTarget); + + if (aoeType != TargetFindAOEType.None) + { + AddAllInRange(target, withPet); + } + + //if (targets.Count > 8) + //targets.RemoveRange(8, targets.Count - 8); + + //Curaga starts with lowest health players, so the targets are definitely sorted at least for some abilities + //Other aoe abilities might be sorted by distance? + //Protect is random + targets.Sort(delegate (Character a, Character b) { return a.GetHP().CompareTo(b.GetHP()); }); + } + + /// + /// Find targets within a box using owner's coordinates and target's coordinates as length + /// with corners being `maxDistance` yalms to either side of self and target + /// + private bool IsWithinBox(Character target, bool withPet) + { + Vector3 vec = target.GetPosAsVector3() - aoeTargetPosition; + Vector3 relativePos = new Vector3(); + + //Get target's position relative to owner's position where owner's front is facing positive z axis + relativePos.X = (float)(vec.X * Math.Cos(aoeTargetRotation) - vec.Z * Math.Sin(aoeTargetRotation)); + relativePos.Z = (float)(vec.X * Math.Sin(aoeTargetRotation) + vec.Z * Math.Cos(aoeTargetRotation)); + + float halfHeight = height / 2; + float halfWidth = width / 2; + + Vector3 closeBottomLeft = new Vector3(-halfWidth, -halfHeight, minDistance); + Vector3 farTopRight = new Vector3(halfWidth, halfHeight, maxDistance); + + return relativePos.IsWithinBox(closeBottomLeft, farTopRight); + } + + private bool IsWithinCone(Character target, bool withPet) + { + double distance = Utils.XZDistance(aoeTargetPosition, target.GetPosAsVector3()); + + //Make sure target is within the correct range first + if (!IsWithinCircle(target)) + return false; + + //This might not be 100% right or the most optimal way to do this + //Get between taget's position and our position + return target.GetPosAsVector3().IsWithinCone(aoeTargetPosition, aoeTargetRotation, coneAngle); + } + + private void AddTarget(Character target, bool withPet) + { + if (CanTarget(target)) + { + // todo: add pets too + targets.Add(target); + } + } + + private void AddAllInParty(Character target, bool withPet) + { + var party = target.currentParty as Party; + if (party != null) + { + foreach (var actorId in party.members) + { + AddTarget(owner.zone.FindActorInArea(actorId), withPet); + } + } + } + + private void AddAllInAlliance(Character target, bool withPet) + { + // todo: + AddAllInParty(target, withPet); + } + + private void AddAllBattleNpcs(Character target, bool withPet) + { + int dist = (int)maxDistance; + var actors = owner.zone.GetActorsAroundActor(target, dist); + + foreach (BattleNpc actor in actors) + { + AddTarget(actor, false); + } + } + + private void AddAllInZone(Character target, bool withPet) + { + var actors = owner.zone.GetAllActors(); + foreach (Character actor in actors) + { + AddTarget(actor, withPet); + } + } + + private void AddAllInRange(Character target, bool withPet) + { + int dist = (int)maxDistance; + var actors = owner.zone.GetActorsAroundActor(target, dist); + + foreach (Character actor in actors) + { + AddTarget(actor, false); + } + + } + + private void AddAllInHateList() + { + if (!(owner is BattleNpc)) + { + Program.Log.Error($"TargetFind.AddAllInHateList() owner [{owner.actorId}] {owner.customDisplayName} {owner.actorName} is not a BattleNpc"); + } + else + { + foreach (var hateEntry in ((BattleNpc)owner).hateContainer.GetHateList()) + { + AddTarget(hateEntry.Value.actor, false); + } + } + } + + public bool CanTarget(Character target, bool withPet = false, bool retarget = false, bool ignoreAOE = false) + { + // already targeted, dont target again + if (target == null || !retarget && targets.Contains(target)) + return false; + + //This skill can't be used on self and target is self, return false + if ((validTarget & ValidTarget.Self) == 0 && target == owner) + return false; + + //This skill can't be used on NPCs and target is an NPC, return false + if ((validTarget & ValidTarget.NPC) == 0 && target.isStatic) + return false; + + //This skill can't be used on corpses and target is dead, return false + if ((validTarget & ValidTarget.Corpse) == 0 && target.IsDead()) + return false; + + //This skill must be used on Allies and target is not an ally, return false + if ((validTarget & ValidTarget.Ally) != 0 && target.allegiance != owner.allegiance) + return false; + + + //This skill can't be used on players and target is a player, return false + //Do we need a player flag? Ally/Enemy flags probably serve the same purpose + //if ((validTarget & ValidTarget.Player) == 0 && target is Player) + //return false; + + + //This skill must be used on enemies an target is not an enemy + if ((validTarget & ValidTarget.Enemy) != 0 && target.allegiance == owner.allegiance) + return false; + + //This skill must be used on a party member and target is not in owner's party, return false + if ((validTarget & ValidTarget.PartyMember) != 0 && target.currentParty != owner.currentParty) + return false; + + //This skill must be used on a corpse and target is alive, return false + if ((validTarget & ValidTarget.CorpseOnly) != 0 && target.IsAlive()) + return false; + + // todo: why is player always zoning? + // cant target if zoning + if (target is Player && ((Player)target).playerSession.isUpdatesLocked) + { + owner.aiContainer.ChangeTarget(null); + return false; + } + + if (/*target.isZoning || owner.isZoning || */target.zone != owner.zone) + return false; + + if (validTarget == ValidTarget.Self && aoeType == TargetFindAOEType.None && owner != target) + return false; + + // this is fuckin retarded, think of a better way l8r + if (!ignoreAOE) + { + // hit everything within zone or within aoe region + if (param == -1.0f || aoeType == TargetFindAOEType.Circle && !IsWithinCircle(target)) + return false; + + if (aoeType == TargetFindAOEType.Cone && !IsWithinCone(target, withPet)) + return false; + + if (aoeType == TargetFindAOEType.Box && !IsWithinBox(target, withPet)) + return false; + + if (aoeType == TargetFindAOEType.None && targets.Count != 0) + return false; + } + return true; + } + + private bool IsWithinCircle(Character target) + { + //Check if XZ is in circle and that y difference isn't larger than half height + return target.GetPosAsVector3().IsWithinCircle(aoeTargetPosition, maxDistance, minDistance) && Math.Abs(owner.positionY - target.positionY) <= (height / 2); + } + + private bool IsPlayer(Character target) + { + if (target is Player) + return true; + + // treat player owned pets as players too + return TryGetMasterTarget(target) is Player; + } + + private Character TryGetMasterTarget(Character target) + { + // if character is a player owned pet, treat as a player + if (target.aiContainer != null) + { + var controller = target.aiContainer.GetController(); + if (controller != null) + return controller.GetPetMaster(); + } + return null; + } + + private bool IsBattleNpcOwner(Character target) + { + // i know i copied this from dsp but what even + if (!(owner is Player) || target is Player) + return true; + + // todo: check hate list + if (owner is BattleNpc && ((BattleNpc)owner).hateContainer.GetMostHatedTarget() != target) + { + return false; + } + return false; + } + + public Character GetValidTarget(Character target, ValidTarget findFlags) + { + if (target == null || target is Player && ((Player)target).playerSession.isUpdatesLocked) + return null; + + if ((findFlags & ValidTarget.Ally) != 0) + { + return owner.pet; + } + + // todo: this is beyond retarded + var oldFlags = this.validTarget; + this.validTarget = findFlags; + if (CanTarget(target, false, true)) + { + this.validTarget = oldFlags; + return target; + } + this.validTarget = oldFlags; + + return null; + } + } +} diff --git a/FFXIVClassic Map Server/actors/chara/ai/state/AbilityState.cs b/FFXIVClassic Map Server/actors/chara/ai/state/AbilityState.cs new file mode 100644 index 00000000..5376b6d9 --- /dev/null +++ b/FFXIVClassic Map Server/actors/chara/ai/state/AbilityState.cs @@ -0,0 +1,153 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using FFXIVClassic.Common; +using FFXIVClassic_Map_Server.Actors; +using FFXIVClassic_Map_Server.packets.send.actor; +using FFXIVClassic_Map_Server.packets.send.actor.battle; +using FFXIVClassic_Map_Server.packets.send; + +namespace FFXIVClassic_Map_Server.actors.chara.ai.state +{ + class AbilityState : State + { + + private BattleCommand skill; + + public AbilityState(Character owner, Character target, ushort skillId) : + base(owner, target) + { + this.startTime = DateTime.Now; + this.skill = Server.GetWorldManager().GetBattleCommand(skillId); + var returnCode = lua.LuaEngine.CallLuaBattleCommandFunction(owner, skill, "ability", "onAbilityPrepare", owner, target, skill); + + this.target = target != null ? target : owner; + + if (returnCode == 0) + { + OnStart(); + } + else + { + errorResult = null; + interrupt = true; + } + } + + public override void OnStart() + { + var returnCode = lua.LuaEngine.CallLuaBattleCommandFunction(owner, skill, "ability", "onAbilityStart", owner, target, skill); + + if (returnCode != 0) + { + interrupt = true; + errorResult = new CommandResult(owner.actorId, (ushort)(returnCode == -1 ? 32558 : returnCode), 0); + } + else + { + if (!skill.IsInstantCast()) + { + float castTime = skill.castTimeMs; + + // command casting duration + if (owner is Player) + { + // todo: modify spellSpeed based on modifiers and stuff + ((Player)owner).SendStartCastbar(skill.id, Utils.UnixTimeStampUTC(DateTime.Now.AddMilliseconds(castTime))); + } + owner.GetSubState().chantId = 0xf0; + owner.SubstateModified(); + //You ready [skill] (6F000002: BLM, 6F000003: WHM, 0x6F000008: BRD) + owner.DoBattleAction(skill.id, (uint)0x6F000000 | skill.castType, new CommandResult(target.actorId, 30126, 1, 0, 1)); + } + } + } + + public override bool Update(DateTime tick) + { + if (skill != null) + { + TryInterrupt(); + + if (interrupt) + { + OnInterrupt(); + return true; + } + + // todo: check weapon delay/haste etc and use that + var actualCastTime = skill.castTimeMs; + + if ((tick - startTime).TotalMilliseconds >= skill.castTimeMs) + { + OnComplete(); + return true; + } + return false; + } + return true; + } + + public override void OnInterrupt() + { + // todo: send paralyzed/sleep message etc. + if (errorResult != null) + { + owner.DoBattleAction(skill.id, errorResult.animation, errorResult); + errorResult = null; + } + } + + public override void OnComplete() + { + owner.LookAt(target); + bool hitTarget = false; + + skill.targetFind.FindWithinArea(target, skill.validTarget, skill.aoeTarget); + isCompleted = true; + + owner.DoBattleCommand(skill, "ability"); + } + + public override void TryInterrupt() + { + if (interrupt) + return; + + if (owner.statusEffects.HasStatusEffectsByFlag((uint)StatusEffectFlags.PreventAbility)) + { + // todo: sometimes paralyze can let you attack, get random percentage of actually letting you attack + var list = owner.statusEffects.GetStatusEffectsByFlag((uint)StatusEffectFlags.PreventAbility); + uint effectId = 0; + if (list.Count > 0) + { + // todo: actually check proc rate/random chance of whatever effect + effectId = list[0].GetStatusEffectId(); + } + interrupt = true; + return; + } + + interrupt = !CanUse(); + } + + private bool CanUse() + { + return skill.IsValidMainTarget(owner, target); + } + + public BattleCommand GetWeaponSkill() + { + return skill; + } + + public override void Cleanup() + { + owner.GetSubState().chantId = 0x0; + owner.SubstateModified(); + owner.aiContainer.UpdateLastActionTime(skill.animationDurationSeconds); + } + } +} diff --git a/FFXIVClassic Map Server/actors/chara/ai/state/AttackState.cs b/FFXIVClassic Map Server/actors/chara/ai/state/AttackState.cs new file mode 100644 index 00000000..b1cd3cc1 --- /dev/null +++ b/FFXIVClassic Map Server/actors/chara/ai/state/AttackState.cs @@ -0,0 +1,206 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using FFXIVClassic.Common; +using FFXIVClassic_Map_Server.Actors; +using FFXIVClassic_Map_Server.packets.send.actor; +using FFXIVClassic_Map_Server.packets.send.actor.battle; +namespace FFXIVClassic_Map_Server.actors.chara.ai.state +{ + class AttackState : State + { + private DateTime attackTime; + + public AttackState(Character owner, Character target) : + base(owner, target) + { + this.canInterrupt = false; + this.startTime = DateTime.Now; + + owner.ChangeState(SetActorStatePacket.MAIN_STATE_ACTIVE); + ChangeTarget(target); + attackTime = startTime; + owner.aiContainer.pathFind?.Clear(); + } + + public override void OnStart() + { + + } + + public override bool Update(DateTime tick) + { + if ((target == null || owner.target != target || owner.target?.actorId != owner.currentLockedTarget) && owner.isAutoAttackEnabled) + owner.aiContainer.ChangeTarget(target = owner.zone.FindActorInArea(owner.currentTarget)); + + if (target == null || target.IsDead()) + { + if (owner.IsMonster() || owner.IsAlly()) + target = ((BattleNpc)owner).hateContainer.GetMostHatedTarget(); + } + else + { + if (IsAttackReady()) + { + if (CanAttack()) + { + TryInterrupt(); + + // todo: check weapon delay/haste etc and use that + if (!interrupt) + { + OnComplete(); + } + else + { + + } + SetInterrupted(false); + } + else + { + // todo: handle interrupt/paralyze etc + } + attackTime = DateTime.Now.AddMilliseconds(owner.GetAttackDelayMs()); + } + } + return false; + } + + public override void OnInterrupt() + { + // todo: send paralyzed/sleep message etc. + if (errorResult != null) + { + owner.zone.BroadcastPacketAroundActor(owner, CommandResultX01Packet.BuildPacket(errorResult.targetId, errorResult.animation, 0x765D, errorResult)); + errorResult = null; + } + } + + public override void OnComplete() + { + //BattleAction action = new BattleAction(target.actorId, 0x765D, (uint) HitEffect.Hit, 0, (byte) HitDirection.None); + errorResult = null; + + // todo: implement auto attack damage bonus in Character.OnAttack + /* + ≪Auto-attack Damage Bonus≫ + Class Bonus 1 Bonus 2 + Pugilist Intelligence Strength + Gladiator Mind Strength + Marauder Vitality Strength + Archer Dexterity Piety + Lancer Piety Strength + Conjurer Mind Piety + Thaumaturge Mind Piety + * The above damage bonus also applies to “Shot” attacks by archers. + */ + // handle paralyze/intimidate/sleep/whatever in Character.OnAttack + + + // todo: Change this to use a BattleCommand like the other states + + //List actions = new List(); + CommandResultContainer actions = new CommandResultContainer(); + + var i = 0; + for (int hitNum = 0; hitNum < 1 /* owner.GetMod((uint) Modifier.HitCount)*/; hitNum++) + { + CommandResult action = new CommandResult(target.actorId, 0x765D, (uint)HitEffect.Hit, 100, (byte)HitDirection.None, (byte) hitNum); + action.commandType = CommandType.AutoAttack; + action.actionType = ActionType.Physical; + action.actionProperty = (ActionProperty) owner.GetMod(Modifier.AttackType); + // evasion, miss, dodge, etc to be handled in script, calling helpers from scripts/weaponskills.lua + // temporary evade/miss/etc function to test hit effects + action.DoAction(owner, target, null, actions); + } + + // todo: this is fuckin stupid, probably only need *one* error packet, not an error for each action + CommandResult[] errors = (CommandResult[])actions.GetList().ToArray().Clone(); + CommandResult error = null;// new BattleAction(0, null, 0, 0); + //owner.DoActions(null, actions.GetList(), ref error); + //owner.OnAttack(this, actions[0], ref errorResult); + var anim = (uint)(17 << 24 | 1 << 12); + owner.DoBattleAction(22104, anim, actions.GetList()); + } + + public override void TryInterrupt() + { + if (owner.statusEffects.HasStatusEffectsByFlag((uint)StatusEffectFlags.PreventAttack)) + { + // todo: sometimes paralyze can let you attack, calculate proc rate + var list = owner.statusEffects.GetStatusEffectsByFlag((uint)StatusEffectFlags.PreventAttack); + uint statusId = 0; + if (list.Count > 0) + { + statusId = list[0].GetStatusId(); + } + interrupt = true; + return; + } + + interrupt = !CanAttack(); + } + + private bool IsAttackReady() + { + // todo: this enforced delay should really be changed if it's not retail.. + return Program.Tick >= attackTime && Program.Tick >= owner.aiContainer.GetLastActionTime(); + } + + private bool CanAttack() + { + if (!owner.isAutoAttackEnabled || target.allegiance == owner.allegiance) + { + return false; + } + + if (target == null) + { + return false; + } + + if (!owner.IsFacing(target)) + { + return false; + } + // todo: shouldnt need to check if owner is dead since all states would be cleared + if (owner.IsDead() || target.IsDead()) + { + if (owner.IsMonster() || owner.IsAlly()) + ((BattleNpc)owner).hateContainer.ClearHate(target); + + owner.aiContainer.ChangeTarget(null); + return false; + } + else if (!owner.IsValidTarget(target, ValidTarget.Enemy) || !owner.aiContainer.GetTargetFind().CanTarget(target, false, true)) + { + return false; + } + // todo: use a mod for melee range + else if (Utils.Distance(owner.positionX, owner.positionY, owner.positionZ, target.positionX, target.positionY, target.positionZ) > owner.GetAttackRange()) + { + if (owner is Player) + { + //The target is too far away + ((Player)owner).SendGameMessage(Server.GetWorldManager().GetActor(), 32537, 0x20); + } + return false; + } + return true; + } + + public override void Cleanup() + { + if (owner.IsDead()) + owner.Disengage(); + } + + public override bool CanChangeState() + { + return true; + } + } +} diff --git a/FFXIVClassic Map Server/actors/chara/ai/state/DeathState.cs b/FFXIVClassic Map Server/actors/chara/ai/state/DeathState.cs new file mode 100644 index 00000000..efe06436 --- /dev/null +++ b/FFXIVClassic Map Server/actors/chara/ai/state/DeathState.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using FFXIVClassic_Map_Server.Actors; +using FFXIVClassic_Map_Server.packets.send.actor; + +namespace FFXIVClassic_Map_Server.actors.chara.ai.state +{ + class DeathState : State + { + DateTime despawnTime; + public DeathState(Character owner, DateTime tick, uint timeToFadeOut) + : base(owner, null) + { + owner.Disengage(); + owner.ChangeState(SetActorStatePacket.MAIN_STATE_DEAD); + owner.statusEffects.RemoveStatusEffectsByFlags((uint)StatusEffectFlags.LoseOnDeath, true); + //var deathStatePacket = SetActorStatePacket.BuildPacket(owner.actorId, SetActorStatePacket.MAIN_STATE_DEAD2, owner.currentSubState); + //owner.zone.BroadcastPacketAroundActor(owner, deathStatePacket); + canInterrupt = false; + startTime = tick; + despawnTime = startTime.AddSeconds(timeToFadeOut); + } + + public override bool Update(DateTime tick) + { + // todo: set a flag on chara for accept raise, play animation and spawn + if (owner.GetMod((uint)Modifier.Raise) > 0) + { + owner.Spawn(tick); + return true; + } + + // todo: handle raise etc + if (tick >= despawnTime) + { + // todo: for players, return them to homepoint + owner.Despawn(tick); + return true; + } + return false; + } + } +} diff --git a/FFXIVClassic Map Server/actors/chara/ai/state/DespawnState.cs b/FFXIVClassic Map Server/actors/chara/ai/state/DespawnState.cs new file mode 100644 index 00000000..4ba940b2 --- /dev/null +++ b/FFXIVClassic Map Server/actors/chara/ai/state/DespawnState.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using FFXIVClassic_Map_Server.Actors; +using FFXIVClassic_Map_Server.packets.send.actor; + +namespace FFXIVClassic_Map_Server.actors.chara.ai.state +{ + class DespawnState : State + { + private DateTime respawnTime; + public DespawnState(Character owner, uint respawnTimeSeconds) : + base(owner, null) + { + startTime = Program.Tick; + respawnTime = startTime.AddSeconds(respawnTimeSeconds); + owner.ChangeState(SetActorStatePacket.MAIN_STATE_DEAD2); + owner.OnDespawn(); + } + + public override bool Update(DateTime tick) + { + if (tick >= respawnTime) + { + owner.ResetTempVars(); + owner.Spawn(tick); + return true; + } + return false; + } + } +} diff --git a/FFXIVClassic Map Server/actors/chara/ai/state/InactiveState.cs b/FFXIVClassic Map Server/actors/chara/ai/state/InactiveState.cs new file mode 100644 index 00000000..735d7765 --- /dev/null +++ b/FFXIVClassic Map Server/actors/chara/ai/state/InactiveState.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using FFXIVClassic_Map_Server.Actors; + +namespace FFXIVClassic_Map_Server.actors.chara.ai.state +{ + class InactiveState : State + { + private DateTime endTime; + private uint durationMs; + public InactiveState(Character owner, uint durationMs, bool canChangeState) : + base(owner, null) + { + if (!canChangeState) + owner.aiContainer.InterruptStates(); + this.durationMs = durationMs; + endTime = DateTime.Now.AddMilliseconds(durationMs); + } + + public override bool Update(DateTime tick) + { + if (durationMs == 0) + { + if (owner.IsDead()) + return true; + + if (!owner.statusEffects.HasStatusEffectsByFlag(StatusEffectFlags.PreventMovement)) + return true; + } + + if (durationMs != 0 && tick > endTime) + { + return true; + } + + return false; + } + } +} diff --git a/FFXIVClassic Map Server/actors/chara/ai/state/ItemState.cs b/FFXIVClassic Map Server/actors/chara/ai/state/ItemState.cs new file mode 100644 index 00000000..dad3d6b8 --- /dev/null +++ b/FFXIVClassic Map Server/actors/chara/ai/state/ItemState.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using FFXIVClassic_Map_Server.Actors; +using FFXIVClassic_Map_Server.actors.chara.player; +using FFXIVClassic_Map_Server.dataobjects; + +namespace FFXIVClassic_Map_Server.actors.chara.ai.state +{ + class ItemState : State + { + ItemData item; + new Player owner; + public ItemState(Player owner, Character target, ushort slot, uint itemId) : + base(owner, target) + { + this.owner = owner; + this.target = target; + } + } +} diff --git a/FFXIVClassic Map Server/actors/chara/ai/state/MagicState.cs b/FFXIVClassic Map Server/actors/chara/ai/state/MagicState.cs new file mode 100644 index 00000000..d424a3da --- /dev/null +++ b/FFXIVClassic Map Server/actors/chara/ai/state/MagicState.cs @@ -0,0 +1,202 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using FFXIVClassic.Common; +using FFXIVClassic_Map_Server.Actors; +using FFXIVClassic_Map_Server.packets.send.actor; +using FFXIVClassic_Map_Server.packets.send.actor.battle; +using FFXIVClassic_Map_Server.packets.send; +using FFXIVClassic_Map_Server.utils; + +namespace FFXIVClassic_Map_Server.actors.chara.ai.state +{ + class MagicState : State + { + + private BattleCommand spell; + private Vector3 startPos; + + public MagicState(Character owner, Character target, ushort spellId) : + base(owner, target) + { + this.startPos = owner.GetPosAsVector3(); + this.startTime = DateTime.Now; + this.spell = Server.GetWorldManager().GetBattleCommand(spellId); + var returnCode = lua.LuaEngine.CallLuaBattleCommandFunction(owner, spell, "magic", "onMagicPrepare", owner, target, spell); + + //Modify spell based on status effects. Need to do it here because they can modify cast times + List effects = owner.statusEffects.GetStatusEffectsByFlag((uint)(StatusEffectFlags.ActivateOnCastStart)); + + //modify skill based on status effects + //Do this here to allow buffs like Resonance to increase range before checking CanCast() + foreach (var effect in effects) + lua.LuaEngine.CallLuaStatusEffectFunction(owner, effect, "onMagicCast", owner, effect, spell); + + this.target = target != null ? target : owner; + + if (returnCode == 0 && owner.CanCast(this.target, spell)) + { + OnStart(); + } + else + { + errorResult = new CommandResult(owner.actorId, 32553, 0); + interrupt = true; + } + } + + public override void OnStart() + { + var returnCode = lua.LuaEngine.CallLuaBattleCommandFunction(owner, spell, "magic", "onMagicStart", owner, target, spell); + + if (returnCode != 0) + { + interrupt = true; + errorResult = new CommandResult(target.actorId, (ushort)(returnCode == -1 ? 32553 : returnCode), 0, 0, 0, 1); + } + else + { + // todo: check within attack range + float[] baseCastDuration = { 1.0f, 0.25f }; + + //There are no positional spells, so just check onCombo, need to check first because certain spells change aoe type/accuracy + //If owner is a player and the spell being used is part of the current combo + if (owner is Player && ((Player)owner).GetClass() == spell.job) + { + Player p = (Player)owner; + if (spell.comboStep == 1 || ((p.playerWork.comboNextCommandId[0] == spell.id || p.playerWork.comboNextCommandId[1] == spell.id))) + { + lua.LuaEngine.CallLuaBattleCommandFunction(owner, spell, "magic", "onCombo", owner, target, spell); + spell.isCombo = true; + } + } + + //Check combo stuff here because combos can impact spell cast times + + float spellSpeed = spell.castTimeMs; + + if (!spell.IsInstantCast()) + { + // command casting duration + if (owner is Player) + { + // todo: modify spellSpeed based on modifiers and stuff + ((Player)owner).SendStartCastbar(spell.id, Utils.UnixTimeStampUTC(DateTime.Now.AddMilliseconds(spellSpeed))); + } + owner.GetSubState().chantId = 0xf0; + owner.SubstateModified(); + owner.DoBattleAction(spell.id, (uint) 0x6F000000 | spell.castType, new CommandResult(target.actorId, 30128, 1, 0, 1)); //You begin casting (6F000002: BLM, 6F000003: WHM, 0x6F000008: BRD) + } + } + } + + public override bool Update(DateTime tick) + { + if (spell != null) + { + TryInterrupt(); + + if (interrupt) + { + OnInterrupt(); + return true; + } + + // todo: check weapon delay/haste etc and use that + var actualCastTime = spell.castTimeMs; + + if ((tick - startTime).TotalMilliseconds >= spell.castTimeMs) + { + OnComplete(); + return true; + } + return false; + } + return true; + } + + public override void OnInterrupt() + { + // todo: send paralyzed/sleep message etc. + if (errorResult != null) + { + owner.GetSubState().chantId = 0x0; + owner.SubstateModified(); + owner.DoBattleAction(spell.id, errorResult.animation, errorResult); + errorResult = null; + } + } + + public override void OnComplete() + { + //How do combos/hitdirs work for aoe abilities or does that not matter for aoe? + HitDirection hitDir = owner.GetHitDirection(target); + bool hitTarget = false; + + spell.targetFind.FindWithinArea(target, spell.validTarget, spell.aoeTarget); + isCompleted = true; + var targets = spell.targetFind.GetTargets(); + + owner.DoBattleCommand(spell, "magic"); + } + + public override void TryInterrupt() + { + if (interrupt) + return; + + if (owner.statusEffects.HasStatusEffectsByFlag((uint)StatusEffectFlags.PreventSpell)) + { + // todo: sometimes paralyze can let you attack, get random percentage of actually letting you attack + var list = owner.statusEffects.GetStatusEffectsByFlag((uint)StatusEffectFlags.PreventSpell); + uint effectId = 0; + if (list.Count > 0) + { + // todo: actually check proc rate/random chance of whatever effect + effectId = list[0].GetStatusEffectId(); + } + interrupt = true; + return; + } + + if (HasMoved()) + { + errorResult = new CommandResult(owner.actorId, 30211, 0); + errorResult.animation = 0x7F000002; + interrupt = true; + return; + } + + interrupt = !CanCast(); + } + + private bool CanCast() + { + return owner.CanCast(target, spell) && spell.IsValidMainTarget(owner, target) && !HasMoved(); + } + + private bool HasMoved() + { + return (owner.GetPosAsVector3() != startPos); + } + + public override void Cleanup() + { + owner.GetSubState().chantId = 0x0; + owner.SubstateModified(); + + if (owner is Player) + { + ((Player)owner).SendEndCastbar(); + } + owner.aiContainer.UpdateLastActionTime(spell.animationDurationSeconds); + } + + public BattleCommand GetSpell() + { + return spell; + } + } +} diff --git a/FFXIVClassic Map Server/actors/chara/ai/state/State.cs b/FFXIVClassic Map Server/actors/chara/ai/state/State.cs new file mode 100644 index 00000000..cebd3227 --- /dev/null +++ b/FFXIVClassic Map Server/actors/chara/ai/state/State.cs @@ -0,0 +1,69 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using FFXIVClassic_Map_Server.Actors; +using FFXIVClassic.Common; +using FFXIVClassic_Map_Server.packets.send.actor.battle; + +namespace FFXIVClassic_Map_Server.actors.chara.ai.state +{ + class State + { + protected Character owner; + protected Character target; + + protected bool canInterrupt; + protected bool interrupt = false; + + protected DateTime startTime; + + protected CommandResult errorResult; + + protected bool isCompleted; + + public State(Character owner, Character target) + { + this.owner = owner; + this.target = target; + this.canInterrupt = true; + this.interrupt = false; + } + + public virtual bool Update(DateTime tick) { return true; } + public virtual void OnStart() { } + public virtual void OnInterrupt() { } + public virtual void OnComplete() { isCompleted = true; } + public virtual bool CanChangeState() { return false; } + public virtual void TryInterrupt() { } + + public virtual void Cleanup() { } + + public bool CanInterrupt() + { + return canInterrupt; + } + + public void SetInterrupted(bool interrupt) + { + this.interrupt = interrupt; + } + + public bool IsCompleted() + { + return isCompleted; + } + + public void ChangeTarget(Character target) + { + this.target = target; + } + + public Character GetTarget() + { + return target; + } + + } +} diff --git a/FFXIVClassic Map Server/actors/chara/ai/state/WeaponSkillState.cs b/FFXIVClassic Map Server/actors/chara/ai/state/WeaponSkillState.cs new file mode 100644 index 00000000..57ca36f8 --- /dev/null +++ b/FFXIVClassic Map Server/actors/chara/ai/state/WeaponSkillState.cs @@ -0,0 +1,183 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using FFXIVClassic.Common; +using FFXIVClassic_Map_Server.Actors; +using FFXIVClassic_Map_Server.packets.send.actor; +using FFXIVClassic_Map_Server.packets.send.actor.battle; +using FFXIVClassic_Map_Server.packets.send; + +namespace FFXIVClassic_Map_Server.actors.chara.ai.state +{ + class WeaponSkillState : State + { + + private BattleCommand skill; + private HitDirection hitDirection; + public WeaponSkillState(Character owner, Character target, ushort skillId) : + base(owner, target) + { + this.startTime = DateTime.Now; + //this.target = skill.targetFind. + this.skill = Server.GetWorldManager().GetBattleCommand(skillId); + var returnCode = lua.LuaEngine.CallLuaBattleCommandFunction(owner, skill, "weaponskill", "onSkillPrepare", owner, target, skill); + + if (returnCode == 0 && owner.CanWeaponSkill(target, skill)) + { + OnStart(); + } + else + { + errorResult = null; + interrupt = true; + } + } + + public override void OnStart() + { + var returnCode = lua.LuaEngine.CallLuaBattleCommandFunction(owner, skill, "weaponskill", "onSkillStart", owner, target, skill); + + if (returnCode != 0) + { + interrupt = true; + errorResult = new CommandResult(owner.actorId, (ushort)(returnCode == -1 ? 32558 : returnCode), 0); + } + else + { + hitDirection = owner.GetHitDirection(target); + + //Do positionals and combo effects first because these can influence accuracy and amount of targets/numhits, which influence the rest of the steps + //If there is no positon required or if the position bonus should be activated + if ((skill.positionBonus & utils.BattleUtils.ConvertHitDirToPosition(hitDirection)) == skill.positionBonus) + { + //If there is a position bonus + if (skill.positionBonus != BattleCommandPositionBonus.None) + //lua.LuaEngine.CallLuaBattleCommandFunction(owner, skill, "weaponskill", "onPositional", owner, target, skill); + skill.CallLuaFunction(owner, "onPositional", owner, target, skill); + + //Combo stuff + if (owner is Player) + { + Player p = (Player)owner; + //If skill is part of owner's class/job, it can be used in a combo + if (skill.job == p.GetClass() || skill.job == p.GetCurrentClassOrJob()) + { + //If owner is a player and the skill being used is part of the current combo + if (p.playerWork.comboNextCommandId[0] == skill.id || p.playerWork.comboNextCommandId[1] == skill.id) + { + lua.LuaEngine.CallLuaBattleCommandFunction(owner, skill, "weaponskill", "onCombo", owner, target, skill); + skill.CallLuaFunction(owner, "onCombo", owner, target, skill); + skill.isCombo = true; + } + //or if this just the start of a combo + else if (skill.comboStep == 1) + skill.isCombo = true; + } + } + + if (!skill.IsInstantCast()) + { + float castTime = skill.castTimeMs; + + // command casting duration + if (owner is Player) + { + // todo: modify spellSpeed based on modifiers and stuff + ((Player)owner).SendStartCastbar(skill.id, Utils.UnixTimeStampUTC(DateTime.Now.AddMilliseconds(castTime))); + } + owner.GetSubState().chantId = 0xf0; + owner.SubstateModified(); + //You ready [skill] (6F000002: BLM, 6F000003: WHM, 0x6F000008: BRD) + owner.DoBattleAction(skill.id, (uint)0x6F000000 | skill.castType, new CommandResult(target.actorId, 30126, 1, 0, 1)); + } + } + } + } + + public override bool Update(DateTime tick) + { + if (skill != null) + { + TryInterrupt(); + + if (interrupt) + { + OnInterrupt(); + return true; + } + + // todo: check weapon delay/haste etc and use that + var actualCastTime = skill.castTimeMs; + + if ((tick - startTime).TotalMilliseconds >= skill.castTimeMs) + { + OnComplete(); + return true; + } + return false; + } + return true; + } + + public override void OnInterrupt() + { + // todo: send paralyzed/sleep message etc. + if (errorResult != null) + { + owner.DoBattleAction(skill.id, errorResult.animation, errorResult); + errorResult = null; + } + } + + public override void OnComplete() + { + owner.LookAt(target); + skill.targetFind.FindWithinArea(target, skill.validTarget, skill.aoeTarget); + isCompleted = true; + + owner.DoBattleCommand(skill, "weaponskill"); + owner.statusEffects.RemoveStatusEffectsByFlags((uint) StatusEffectFlags.LoseOnAttacking); + + lua.LuaEngine.GetInstance().OnSignal("weaponskillUsed"); + } + + public override void TryInterrupt() + { + if (interrupt) + return; + + if (owner.statusEffects.HasStatusEffectsByFlag((uint)StatusEffectFlags.PreventWeaponSkill)) + { + // todo: sometimes paralyze can let you attack, get random percentage of actually letting you attack + var list = owner.statusEffects.GetStatusEffectsByFlag((uint)StatusEffectFlags.PreventWeaponSkill); + uint effectId = 0; + if (list.Count > 0) + { + // todo: actually check proc rate/random chance of whatever effect + effectId = list[0].GetStatusEffectId(); + } + interrupt = true; + return; + } + + interrupt = !CanUse(); + } + + private bool CanUse() + { + return owner.CanWeaponSkill(target, skill) && skill.IsValidMainTarget(owner, target); + } + + public BattleCommand GetWeaponSkill() + { + return skill; + } + + public override void Cleanup() + { + owner.aiContainer.UpdateLastActionTime(skill.animationDurationSeconds); + } + } +} diff --git a/FFXIVClassic Map Server/actors/chara/ai/utils/AttackUtils.cs b/FFXIVClassic Map Server/actors/chara/ai/utils/AttackUtils.cs new file mode 100644 index 00000000..cdd7865d --- /dev/null +++ b/FFXIVClassic Map Server/actors/chara/ai/utils/AttackUtils.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using FFXIVClassic_Map_Server.Actors; +namespace FFXIVClassic_Map_Server.actors.chara.ai.utils +{ + static class AttackUtils + { + public static int CalculateDamage(Character attacker, Character defender) + { + int dmg = CalculateBaseDamage(attacker, defender); + + return dmg; + } + + public static int CalculateBaseDamage(Character attacker, Character defender) + { + // todo: actually calculate damage + return Program.Random.Next(10) * 10; + } + } +} \ No newline at end of file diff --git a/FFXIVClassic Map Server/actors/chara/ai/utils/BattleUtils.cs b/FFXIVClassic Map Server/actors/chara/ai/utils/BattleUtils.cs new file mode 100644 index 00000000..bfdf9eed --- /dev/null +++ b/FFXIVClassic Map Server/actors/chara/ai/utils/BattleUtils.cs @@ -0,0 +1,883 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +using FFXIVClassic_Map_Server.Actors; +using FFXIVClassic_Map_Server.packets.send.actor; +using FFXIVClassic_Map_Server.packets.send.actor.battle; +using FFXIVClassic_Map_Server.actors.chara.player; +using FFXIVClassic_Map_Server.actors.chara.npc; +using FFXIVClassic_Map_Server.dataobjects; +using FFXIVClassic.Common; + +namespace FFXIVClassic_Map_Server.actors.chara.ai.utils +{ + static class BattleUtils + { + + public static Dictionary SingleHitTypeTextIds = new Dictionary() + { + { HitType.Miss, 30311 }, + { HitType.Evade, 30310 }, + { HitType.Parry, 30308 }, + { HitType.Block, 30306 }, + { HitType.Resist, 30310 }, //Resists seem to use the evade text id + { HitType.Hit, 30301 }, + { HitType.Crit, 30302 } + }; + + public static Dictionary MultiHitTypeTextIds = new Dictionary() + { + { HitType.Miss, 30449 }, //The attack misses. + { HitType.Evade, 0 }, //Evades were removed before multi hit skills got their own messages, so this doesnt exist + { HitType.Parry, 30448 }, //[Target] parries, taking x points of damage. + { HitType.Block, 30447 }, //[Target] blocks, taking x points of damage. + { HitType.Resist, 0 }, //No spells are multi-hit, so this doesn't exist + { HitType.Hit, 30443 }, //[Target] tales x points of damage + { HitType.Crit, 30444 } //Critical! [Target] takes x points of damage. + }; + + public static Dictionary HitTypeEffects = new Dictionary() + { + { HitType.Miss, 0 }, + { HitType.Evade, HitEffect.Evade }, + { HitType.Parry, HitEffect.Parry }, + { HitType.Block, HitEffect.Block }, + { HitType.Resist, HitEffect.RecoilLv1 },//Probably don't need this, resists are handled differently to the rest + { HitType.Hit, HitEffect.Hit }, + { HitType.Crit, HitEffect.Crit } + }; + + public static Dictionary KnockbackEffects = new Dictionary() + { + { KnockbackType.None, 0 }, + { KnockbackType.Level1, HitEffect.KnockbackLv1 }, + { KnockbackType.Level2, HitEffect.KnockbackLv2 }, + { KnockbackType.Level3, HitEffect.KnockbackLv3 }, + { KnockbackType.Level4, HitEffect.KnockbackLv4 }, + { KnockbackType.Level5, HitEffect.KnockbackLv5 }, + { KnockbackType.Clockwise1, HitEffect.KnockbackClockwiseLv1 }, + { KnockbackType.Clockwise2, HitEffect.KnockbackClockwiseLv2 }, + { KnockbackType.CounterClockwise1, HitEffect.KnockbackCounterClockwiseLv1 }, + { KnockbackType.CounterClockwise2, HitEffect.KnockbackCounterClockwiseLv2 }, + { KnockbackType.DrawIn, HitEffect.DrawIn } + }; + + public static Dictionary ClassExperienceTextIds = new Dictionary() + { + { 2, 33934 }, //Pugilist + { 3, 33935 }, //Gladiator + { 4, 33936 }, //Marauder + { 7, 33937 }, //Archer + { 8, 33938 }, //Lancer + { 10, 33939 }, //Sentinel, this doesn't exist anymore but it's still in the files so may as well put it here just in case + { 22, 33940 }, //Thaumaturge + { 23, 33941 }, //Conjurer + { 29, 33945 }, //Carpenter, for some reason there's a a few different messages between 33941 and 33945 + { 30, 33946 }, //Blacksmith + { 31, 33947 }, //Armorer + { 32, 33948 }, //Goldsmith + { 33, 33949 }, //Leatherworker + { 34, 33950 }, //Weaver + { 35, 33951 }, //Alchemist + { 36, 33952 }, //Culinarian + { 39, 33953 }, //Miner + { 40, 33954 }, //Botanist + { 41, 33955 } //Fisher + }; + + //Most of these numbers I'm fairly certain are correct. The repeated numbers at levels 23 and 48 I'm less sure about but they do match some weird spots in the EXP graph + + public static ushort[] BASEEXP = {150, 150, 150, 150, 150, 150, 150, 150, 150, 150, //Level <= 10 + 150, 150, 150, 150, 150, 150, 150, 150, 160, 170, //Level <= 20 + 180, 190, 190, 200, 210, 220, 230, 240, 250, 260, //Level <= 30 + 270, 280, 290, 300, 310, 320, 330, 340, 350, 360, //Level <= 40 + 370, 380, 380, 390, 400, 410, 420, 430, 430, 440}; //Level <= 50 + + public static bool TryAttack(Character attacker, Character defender, CommandResult action, ref CommandResult error) + { + // todo: get hit rate, hit count, set hit effect + //action.effectId |= (uint)(HitEffect.RecoilLv2 | HitEffect.Hit | HitEffect.HitVisual1); + return true; + } + + private static double CalculateDlvlModifier(short dlvl) + { + //this is just a really, really simplified version of the graph from http://kanican.livejournal.com/55915.html + //actual formula is definitely more complicated + //I'm going to assum these formulas are linear, and they're clamped so the modifier never goes below 0. + double modifier = 0; + + + if (dlvl >= 0) + modifier = (.35 * dlvl) + .225; + else + modifier = (.01 * dlvl) + .25; + + return modifier.Clamp(0, 1); + } + + //Damage calculations + //Calculate damage of action + //We could probably just do this when determining the action's hit type + public static void CalculatePhysicalDamageTaken(Character attacker, Character defender, BattleCommand skill, CommandResult action) + { + short dlvl = (short)(defender.GetLevel() - attacker.GetLevel()); + + // todo: physical resistances + + //dlvl, Defense, and Vitality all effect how much damage is taken after hittype takes effect + //player attacks cannot do more than 9999 damage. + //VIT is turned into Defense at a 3:2 ratio in calculatestats, so don't need to do that here + double damageTakenPercent = 1 - (defender.GetMod(Modifier.DamageTakenDown) / 100.0); + action.amount = (ushort)(action.amount - CalculateDlvlModifier(dlvl) * (defender.GetMod((uint)Modifier.Defense))).Clamp(0, 9999); + action.amount = (ushort)(action.amount * damageTakenPercent).Clamp(0, 9999); + } + + + public static void CalculateSpellDamageTaken(Character attacker, Character defender, BattleCommand skill, CommandResult action) + { + short dlvl = (short)(defender.GetLevel() - attacker.GetLevel()); + + // todo: elemental resistances + //Patch 1.19: + //Magic Defense has been abolished and no longer appears in equipment attributes. + //The effect of elemental attributes has been changed to that of reducing damage from element-based attacks. + + //http://kanican.livejournal.com/55370.html: + //elemental resistance stats are not actually related to resists (except for status effects), instead they impact damage taken + + + //dlvl, Defense, and Vitality all effect how much damage is taken after hittype takes effect + //player attacks cannot do more than 9999 damage. + double damageTakenPercent = 1 - (defender.GetMod(Modifier.DamageTakenDown) / 100.0); + action.amount = (ushort)(action.amount - CalculateDlvlModifier(dlvl) * (defender.GetMod((uint)Modifier.Defense) + 0.67 * defender.GetMod((uint)Modifier.Vitality))).Clamp(0, 9999); + action.amount = (ushort)(action.amount * damageTakenPercent).Clamp(0, 9999); + } + + + public static void CalculateBlockDamage(Character attacker, Character defender, BattleCommand skill, CommandResult action) + { + double percentBlocked; + + //Aegis boon forces a full block + if (defender.statusEffects.HasStatusEffect(StatusEffectId.AegisBoon)) + percentBlocked = 1.0; + else + { + //Is this a case where VIT gives Block? + percentBlocked = defender.GetMod((uint)Modifier.Block) * 0.002;//Every point of Block adds .2% to how much is blocked + percentBlocked += defender.GetMod((uint)Modifier.Vitality) * 0.001;//Every point of vitality adds .1% to how much is blocked + } + + action.amountMitigated = (ushort)(action.amount * percentBlocked); + action.amount = (ushort)(action.amount * (1.0 - percentBlocked)); + } + + //don't know exact crit bonus formula + public static void CalculateCritDamage(Character attacker, Character defender, BattleCommand skill, CommandResult action) + { + short dlvl = (short)(defender.GetLevel() - attacker.GetLevel()); + double bonus = (.04 * (dlvl * dlvl)) - 2 * dlvl; + bonus += 1.20; + double potencyModifier = (-.075 * dlvl) + 1.73; + + // + potency bonus + //bonus += attacker.GetMod((uint) Modifier.CriticalPotency) * potencyModifier; + // - Crit resilience + //bonus -= attacker.GetMod((uint)Modifier.CriticalResilience) * potencyModifier; + + //need to add something for bonus potency as a part of skill (ie thundara, which breaks the cap) + action.amount = (ushort)(action.amount * bonus.Clamp(1.15, 1.75));//min bonus of 115, max bonus of 175 + } + + public static void CalculateParryDamage(Character attacker, Character defender, BattleCommand skill, CommandResult action) + { + double percentParry = 0.75; + + action.amountMitigated = (ushort)(action.amount * (1 - percentParry)); + action.amount = (ushort)(action.amount * percentParry); + } + + //There are 3 or 4 tiers of resist that are flat 25% decreases in damage. + //It's possible we could just calculate the damage at the same time as we determine the hit type (the same goes for the rest of the hit types) + //Or we could have HitTypes for DoubleResist, TripleResist, and FullResist that get used here. + public static void CalculateResistDamage(Character attacker, Character defender, BattleCommand skill, CommandResult action) + { + double percentResist = 0.5; + + action.amountMitigated = (ushort)(action.amount * (1 - percentResist)); + action.amount = (ushort)(action.amount * percentResist); + } + + //It's weird that stoneskin is handled in C# and all other buffs are in scripts right now + //But it's because stoneskin acts like both a preaction and postaction buff in that it falls off after damage is dealt but impacts how much damage is dealt + public static void HandleStoneskin(Character defender, CommandResult action) + { + var mitigation = Math.Min(action.amount, defender.GetMod(Modifier.Stoneskin)); + + action.amount = (ushort) (action.amount - mitigation).Clamp(0, 9999); + defender.SubtractMod((uint)Modifier.Stoneskin, mitigation); + } + + public static void DamageTarget(Character attacker, Character defender, CommandResult action, CommandResultContainer actionContainer= null) + { + if (defender != null) + { + + //Bugfix, mobs that instantly died were insta disappearing due to lastAttacker == null. + if (defender is BattleNpc) + { + var bnpc = defender as BattleNpc; + if (bnpc.lastAttacker == null) + bnpc.lastAttacker = attacker; + } + + defender.DelHP((short)action.amount); + attacker.OnDamageDealt(defender, action, actionContainer); + defender.OnDamageTaken(attacker, action, actionContainer); + + // todo: other stuff too + if (defender is BattleNpc) + { + var bnpc = defender as BattleNpc; + if (!bnpc.hateContainer.HasHateForTarget(attacker)) + { + bnpc.hateContainer.AddBaseHate(attacker); + } + bnpc.hateContainer.UpdateHate(attacker, action.enmity); + bnpc.lastAttacker = attacker; + } + } + } + + public static void HealTarget(Character caster, Character target, CommandResult action, CommandResultContainer actionContainer = null) + { + if (target != null) + { + target.AddHP(action.amount); + + target.statusEffects.CallLuaFunctionByFlag((uint) StatusEffectFlags.ActivateOnHealed, "onHealed", caster, target, action, actionContainer); + } + } + + + #region Rate Functions + + //How is accuracy actually calculated? + public static double GetHitRate(Character attacker, Character defender, BattleCommand skill, CommandResult action) + { + double hitRate = 80.0; + + //Add raw hit rate buffs, subtract raw evade buffs, take into account skill's accuracy modifier. + double hitBuff = attacker.GetMod(Modifier.RawHitRate); + double evadeBuff = defender.GetMod(Modifier.RawEvadeRate); + float modifier = skill != null ? skill.accuracyModifier : 0; + hitRate += (hitBuff + modifier).Clamp(0, 100.0); + hitRate -= evadeBuff; + return hitRate.Clamp(0, 100.0); + } + + //Whats the parry formula? + public static double GetParryRate(Character attacker, Character defender, BattleCommand skill, CommandResult action) + { + //Can't parry with shield, can't parry rear attacks + if (defender.GetMod((uint)Modifier.HasShield) != 0 || action.param == (byte) HitDirection.Rear) + return 0; + + double parryRate = 10.0; + + parryRate += defender.GetMod(Modifier.Parry) * 0.1;//.1% rate for every point of Parry + + return parryRate + (defender.GetMod(Modifier.RawParryRate)); + } + + public static double GetCritRate(Character attacker, Character defender, BattleCommand skill, CommandResult action) + { + if (action.actionType == ActionType.Status) + return 0.0; + + //using 10.0 for now since gear isn't working + double critRate = 10.0;// 0.16 * attacker.GetMod((uint)Modifier.CritRating);//Crit rating adds .16% per point + + //Add additional crit rate from skill + //Should this be a raw percent or a flat crit raitng? the wording on skills/buffs isn't clear. + critRate += 0.16 * (skill != null ? skill.bonusCritRate : 0); + + return critRate + attacker.GetMod(Modifier.RawCritRate); + } + + //http://kanican.livejournal.com/55370.html + // todo: figure that out + public static double GetResistRate(Character attacker, Character defender, BattleCommand skill, CommandResult action) + { + // todo: add elemental stuff + //Can only resist spells? + if (action.commandType != CommandType.Spell && action.actionProperty <= ActionProperty.Projectile) + return 0.0; + + return 15.0 + defender.GetMod(Modifier.RawResistRate); + } + + //Block Rate follows 4 simple rules: + //(1) Every point in DEX gives +0.1% rate + //(2) Every point in "Block Rate" gives +0.2% rate + //(3) True block proc rate is capped at 75%. No clue on a possible floor. + //(4) The baseline rate is based on dLVL only(mob stats play no role). The baseline rate is summarized in this raw data sheet: https://imgbox.com/aasLyaJz + public static double GetBlockRate(Character attacker, Character defender, BattleCommand skill, CommandResult action) + { + //Shields are required to block and can't block from rear. + if (defender.GetMod((uint)Modifier.HasShield) == 0 || action.param == (byte)HitDirection.Rear) + return 0; + + short dlvl = (short)(defender.GetLevel() - attacker.GetLevel()); + double blockRate = (2.5 * dlvl) + 5; // Base block rate + + //Is this one of those thing where DEX gives block rate and this would be taking DEX into account twice? + blockRate += defender.GetMod((uint)Modifier.Dexterity) * 0.1;// .1% for every dex + blockRate += defender.GetMod((uint)Modifier.BlockRate) * 0.2;// .2% for every block rate + + return Math.Min(blockRate, 25.0) + defender.GetMod((uint)Modifier.RawBlockRate); + } + + #endregion + + public static bool TryCrit(Character attacker, Character defender, BattleCommand skill, CommandResult action) + { + if ((Program.Random.NextDouble() * 100) <= action.critRate) + { + action.hitType = HitType.Crit; + CalculateCritDamage(attacker, defender, skill, action); + + if(skill != null) + skill.actionCrit = true; + + return true; + } + + return false; + } + + public static bool TryResist(Character attacker, Character defender, BattleCommand skill, CommandResult action) + { + if ((Program.Random.NextDouble() * 100) <= action.resistRate) + { + action.hitType = HitType.Resist; + CalculateResistDamage(attacker, defender, skill, action); + return true; + } + + return false; + } + + public static bool TryBlock(Character attacker, Character defender, BattleCommand skill, CommandResult action) + { + if ((Program.Random.NextDouble() * 100) <= action.blockRate) + { + action.hitType = HitType.Block; + CalculateBlockDamage(attacker, defender, skill, action); + return true; + } + + return false; + } + + public static bool TryParry(Character attacker, Character defender, BattleCommand skill, CommandResult action) + { + if ((Program.Random.NextDouble() * 100) <= action.parryRate) + { + action.hitType = HitType.Parry; + CalculateParryDamage(attacker, defender, skill, action); + return true; + } + + return false; + } + + //TryMiss instead of tryHit because hits are the default and don't change damage + public static bool TryMiss(Character attacker, Character defender, BattleCommand skill, CommandResult action) + { + if ((Program.Random.NextDouble() * 100) >= GetHitRate(attacker, defender, skill, action)) + { + action.hitType = (ushort)HitType.Miss; + //On misses, the entire amount is considered mitigated + action.amountMitigated = action.amount; + action.amount = 0; + return true; + } + return false; + } + + /* + * Hit Effecthelpers. Different types of hit effects hits use some flags for different things, so they're split into physical, magical, heal, and status + */ + public static void DoAction(Character caster, Character target, BattleCommand skill, CommandResult action, CommandResultContainer actionContainer = null) + { + switch (action.actionType) + { + case (ActionType.Physical): + FinishActionPhysical(caster, target, skill, action, actionContainer); + break; + case (ActionType.Magic): + FinishActionSpell(caster, target, skill, action, actionContainer); + break; + case (ActionType.Heal): + FinishActionHeal(caster, target, skill, action, actionContainer); + break; + case (ActionType.Status): + FinishActionStatus(caster, target, skill, action, actionContainer); + break; + default: + actionContainer.AddAction(action); + break; + } + } + + //Determine the hit type, set the hit effect, modify damage based on stoneskin and hit type, hit target + public static void FinishActionPhysical(Character attacker, Character defender, BattleCommand skill, CommandResult action, CommandResultContainer actionContainer = null) + { + //Figure out the hit type and change damage depending on hit type + if (!TryMiss(attacker, defender, skill, action)) + { + //Handle Stoneskin here because it seems like stoneskin mitigates damage done before taking into consideration crit/block/parry damage reductions. + //This is based on the fact that a 0 damage attack due to stoneskin will heal for 0 with Aegis Boon, meaning Aegis Boon didn't mitigate any damage + HandleStoneskin(defender, action); + + //Crits can't be blocked (is this true for Aegis Boon and Divine Veil?) or parried so they are checked first. + if (!TryCrit(attacker, defender, skill, action)) + //Block and parry order don't really matter because if you can block you can't parry and vice versa + if (!TryBlock(attacker, defender, skill, action)) + if(!TryParry(attacker, defender, skill, action)) + //Finally if it's none of these, the attack was a hit + action.hitType = HitType.Hit; + } + + //Actions have different text ids depending on whether they're a part of a multi-hit ws or not. + Dictionary textIds = SingleHitTypeTextIds; + + //If this is the first hit of a multi hit command, add the "You use [command] on [target]" action + //Needs to be done here because certain buff messages appear before it. + if (skill != null && skill.numHits > 1) + { + if (action.hitNum == 1) + actionContainer?.AddAction(new CommandResult(attacker.actorId, 30441, 0)); + + textIds = MultiHitTypeTextIds; + } + + //Set the correct textId + action.worldMasterTextId = textIds[action.hitType]; + + //Set the hit effect + SetHitEffectPhysical(attacker, defender, skill, action, actionContainer); + + //Modify damage based on defender's stats + CalculatePhysicalDamageTaken(attacker, defender, skill, action); + + actionContainer.AddAction(action); + action.enmity = (ushort) (action.enmity * (skill != null ? skill.enmityModifier : 1)); + //Damage the target + DamageTarget(attacker, defender, action, actionContainer); + } + + public static void FinishActionSpell(Character attacker, Character defender, BattleCommand skill, CommandResult action, CommandResultContainer actionContainer = null) + { + //Determine the hit type of the action + if (!TryMiss(attacker, defender, skill, action)) + { + HandleStoneskin(defender, action); + if (!TryCrit(attacker, defender, skill, action)) + if (!TryResist(attacker, defender, skill, action)) + action.hitType = HitType.Hit; + } + + //There are no multi-hit spells + action.worldMasterTextId = SingleHitTypeTextIds[action.hitType]; + + //Set the hit effect + SetHitEffectSpell(attacker, defender, skill, action); + + HandleStoneskin(defender, action); + + CalculateSpellDamageTaken(attacker, defender, skill, action); + + actionContainer.AddAction(action); + + DamageTarget(attacker, defender, action, actionContainer); + } + + public static void FinishActionHeal(Character attacker, Character defender, BattleCommand skill, CommandResult action, CommandResultContainer actionContainer = null) + { + //Set the hit effect + SetHitEffectHeal(attacker, defender, skill, action); + + actionContainer.AddAction(action); + + HealTarget(attacker, defender, action, actionContainer); + } + + public static void FinishActionStatus(Character attacker, Character defender, BattleCommand skill, CommandResult action, CommandResultContainer actionContainer = null) + { + //Set the hit effect + SetHitEffectStatus(attacker, defender, skill, action); + + TryStatus(attacker, defender, skill, action, actionContainer, false); + + actionContainer.AddAction(action); + } + + public static void SetHitEffectPhysical(Character attacker, Character defender, BattleCommand skill, CommandResult action, CommandResultContainer actionContainer) + { + var hitEffect = HitEffect.HitEffectType; + HitType hitType = action.hitType; + + //Don't know what recoil is actually based on, just guessing + //Crit is 2 and 3 together + if (hitType == HitType.Crit) + hitEffect |= HitEffect.CriticalHit; + else + { + //It's not clear what recoil level is based on for physical attacks + double percentDealt = (100.0 * (action.amount / defender.GetMaxHP())); + if (percentDealt > 5.0) + hitEffect |= HitEffect.RecoilLv2; + else if (percentDealt > 10) + hitEffect |= HitEffect.RecoilLv3; + } + + hitEffect |= HitTypeEffects[hitType]; + + //For combos that land, add the combo effect + if (skill != null && skill.isCombo && hitType > HitType.Evade && hitType != HitType.Evade && !skill.comboEffectAdded) + { + hitEffect |= (HitEffect)(skill.comboStep << 15); + skill.comboEffectAdded = true; + } + + //if attack hit the target, take into account protective status effects + if (hitType >= HitType.Parry) + { + //Protect / Shell only show on physical/ magical attacks respectively. + if (defender.statusEffects.HasStatusEffect(StatusEffectId.Protect)) + if (action != null) + hitEffect |= HitEffect.Protect; + + if (defender.statusEffects.HasStatusEffect(StatusEffectId.Stoneskin)) + if (action != null) + hitEffect |= HitEffect.Stoneskin; + } + + action.effectId = (uint)hitEffect; + } + + public static void SetHitEffectSpell(Character attacker, Character defender, BattleCommand skill, CommandResult action, CommandResultContainer actionContainer = null) + { + var hitEffect = HitEffect.MagicEffectType; + HitType hitType = action.hitType; + + //Recoil levels for spells are a bit different than physical. Recoil levels are used for resists. + //Lv1 is for larger resists, Lv2 is for smaller resists and Lv3 is for no resists. Crit is still used for crits + if (hitType == HitType.Resist) + { + //todo: calculate resist levels and figure out what the difference between Lv1 and 2 in retail was. For now assuming a full resist with 0 damage dealt is Lv1, all other resists Lv2 + if (action.amount == 0) + hitEffect |= HitEffect.RecoilLv1; + else + hitEffect |= HitEffect.RecoilLv2; + } + else + hitEffect |= HitEffect.RecoilLv3; + + hitEffect |= HitTypeEffects[hitType]; + + if (skill != null && skill.isCombo && !skill.comboEffectAdded) + { + hitEffect |= (HitEffect)(skill.comboStep << 15); + skill.comboEffectAdded = true; + } + + //if attack hit the target, take into account protective status effects + if (hitType >= HitType.Block) + { + //Protect / Shell only show on physical/ magical attacks respectively. + if (defender.statusEffects.HasStatusEffect(StatusEffectId.Shell)) + if (action != null) + hitEffect |= HitEffect.Shell; + + if (defender.statusEffects.HasStatusEffect(StatusEffectId.Stoneskin)) + if (action != null) + hitEffect |= HitEffect.Stoneskin; + } + action.effectId = (uint)hitEffect; + } + + + public static void SetHitEffectHeal(Character caster, Character receiver, BattleCommand skill, CommandResult action) + { + var hitEffect = HitEffect.MagicEffectType | HitEffect.Heal; + //Heals use recoil levels in some way as well. Possibly for very low health clutch heals or based on percentage of current health healed (not max health). + // todo: figure recoil levels out for heals + hitEffect |= HitEffect.RecoilLv3; + //do heals crit? + + action.effectId = (uint)hitEffect; + } + + public static void SetHitEffectStatus(Character caster, Character receiver, BattleCommand skill, CommandResult action) + { + var hitEffect = (uint)HitEffect.StatusEffectType | skill.statusId; + action.effectId = hitEffect; + + action.hitType = HitType.Hit; + } + + public static uint CalculateSpellCost(Character caster, Character target, BattleCommand spell) + { + var scaledCost = spell.CalculateMpCost(caster); + + // todo: calculate cost for mob/player + if (caster is BattleNpc) + { + + } + else + { + + } + return scaledCost; + } + + + //IsAdditional is needed because additional actions may be required for some actions' effects + //For instance, Goring Blade's bleed effect requires another action so the first action can still show damage numbers + //Sentinel doesn't require an additional action because it doesn't need to show those numbers + //this is stupid + public static void TryStatus(Character caster, Character target, BattleCommand skill, CommandResult action, CommandResultContainer results, bool isAdditional = true) + { + double rand = Program.Random.NextDouble(); + + //Statuses only land for non-resisted attacks and attacks that hit + if (skill != null && skill.statusId != 0 && (action.hitType > HitType.Evade && action.hitType != HitType.Resist) && rand < skill.statusChance) + { + StatusEffect effect = Server.GetWorldManager().GetStatusEffect(skill.statusId); + //Because combos might change duration or tier + if (effect != null) + { + effect.SetDuration(skill.statusDuration); + effect.SetTier(skill.statusTier); + effect.SetMagnitude(skill.statusMagnitude); + effect.SetOwner(target); + effect.SetSource(caster); + + if (target.statusEffects.AddStatusEffect(effect, caster)) + { + //If we need an extra action to show the status text + if (isAdditional) + results.AddAction(target.actorId, 30328, skill.statusId | (uint) HitEffect.StatusEffectType); + } + else + action.worldMasterTextId = 32002;//Is this right? + } + else + { + //until all effects are scripted and added to db just doing this + if (target.statusEffects.AddStatusEffect(skill.statusId, skill.statusTier, skill.statusMagnitude, skill.statusDuration, 3000)) + { + //If we need an extra action to show the status text + if (isAdditional) + results.AddAction(target.actorId, 30328, skill.statusId | (uint) HitEffect.StatusEffectType); + } + else + action.worldMasterTextId = 32002;//Is this right? + } + } + } + + //Convert a HitDirection to a BattleCommandPositionBonus. Basically just combining left/right into flank + public static BattleCommandPositionBonus ConvertHitDirToPosition(HitDirection hitDir) + { + BattleCommandPositionBonus position = BattleCommandPositionBonus.None; + + switch (hitDir) + { + case (HitDirection.Front): + position = BattleCommandPositionBonus.Front; + break; + case (HitDirection.Right): + case (HitDirection.Left): + position = BattleCommandPositionBonus.Flank; + break; + case (HitDirection.Rear): + position = BattleCommandPositionBonus.Rear; + break; + } + return position; + } + + + #region experience helpers + //See 1.19 patch notes for exp info. + public static ushort GetBaseEXP(Player player, BattleNpc mob) + { + //The way EXP seems to work for most enemies is that it gets the lower character's level, gets the base exp for that level, then uses dlvl to modify that exp + //Less than -19 dlvl gives 0 exp and no message is sent. + //This equation doesn't seem to work for certain bosses or NMs. + //Some enemies might give less EXP? Unsure on this. It seems like there might have been a change in base exp amounts after 1.19 + + //Example: + //Level 50 in a party kills a level 45 enemy + //Base exp is 400, as that's the base EXP for level 45 + //That's multiplied by the dlvl modifier for -5, which is 0.5625, which gives 225 + //That's then multiplied by the party modifier, which seems to be 0.667 regardless of party size, which gives 150 + //150 is then modified by bonus experience from food, rested exp, links, and chains + + int dlvl = mob.GetLevel() - player.GetLevel(); + if (dlvl <= -20) + return 0; + + int baseLevel = Math.Min(player.GetLevel(), mob.GetLevel()); + ushort baseEXP = BASEEXP[baseLevel]; + + double dlvlModifier = 1.0; + + //There's 2 functions depending on if the dlvl is positive or negative. + if (dlvl >= 0) + //I'm not sure if this caps out at some point. This is correct up to at least +9 dlvl though. + dlvlModifier += 0.2 * dlvl; + else + //0.1x + 0.0025x^2 + dlvlModifier += 0.1 * dlvl + 0.0025 * (dlvl * dlvl); + + //The party modifier isn't clear yet. It seems like it might just be 0.667 for any number of members in a group, but the 1.19 notes say it's variable + //There also seem to be some cases where it simply doesn't apply but it isn't obvious if that's correct or when it applies if it is correct + double partyModifier = player.currentParty.GetMemberCount() == 1 ? 1.0 : 0.667; + + baseEXP = (ushort) (baseEXP * dlvlModifier * partyModifier); + + return baseEXP; + } + + //Gets the EXP bonus when enemies link + public static byte GetLinkBonus(ushort linkCount) + { + byte bonus = 0; + + switch (linkCount) + { + case (0): + break; + case (1): + bonus = 25; + break; + case (2): + bonus = 50; + break; + case (3): + bonus = 75; + break; + case (4): + default: + bonus = 100; + break; + } + + return bonus; + } + + //Gets EXP chain bonus for Attacker fighting Defender + //Official text on EXP Chains: An EXP Chain occurs when players consecutively defeat enemies of equal or higher level than themselves within a specific amount of time. + //Assuming this means that there is no bonus for enemies below player's level and EXP chains are specific to the person, not party + public static byte GetChainBonus(ushort tier) + { + byte bonus = 0; + + switch (tier) + { + case (0): + break; + case (1): + bonus = 20; + break; + case (2): + bonus = 25; + break; + case (3): + bonus = 30; + break; + case (4): + bonus = 40; + break; + default: + bonus = 50; + break; + } + return bonus; + } + + public static byte GetChainTimeLimit(ushort tier) + { + byte timeLimit = 0; + + switch (tier) + { + case (0): + timeLimit = 100; + break; + case (1): + timeLimit = 80; + break; + case (2): + timeLimit = 60; + break; + case (3): + timeLimit = 20; + break; + default: + timeLimit = 10; + break; + } + + return timeLimit; + } + + //Calculates bonus EXP for Links and Chains + public static void AddBattleBonusEXP(Player attacker, BattleNpc defender, CommandResultContainer actionContainer) + { + ushort baseExp = GetBaseEXP(attacker, defender); + + //Only bother calculating the rest if there's actually exp to be gained. + //0 exp sends no message + if (baseExp > 0) + { + int totalBonus = 0;//GetMod(Modifier.bonusEXP) + + var linkCount = defender.GetMobMod(MobModifier.LinkCount); + totalBonus += GetLinkBonus((byte)Math.Min(linkCount, 255)); + + StatusEffect effect = attacker.statusEffects.GetStatusEffectById((uint)StatusEffectId.EXPChain); + ushort expChainNumber = 0; + uint timeLimit = 100; + if (effect != null) + { + expChainNumber = effect.GetTier(); + timeLimit = (uint)(GetChainTimeLimit(expChainNumber)); + actionContainer?.AddEXPAction(new CommandResult(attacker.actorId, 33919, 0, expChainNumber, (byte)timeLimit)); + } + + totalBonus += GetChainBonus(expChainNumber); + + StatusEffect newChain = Server.GetWorldManager().GetStatusEffect((uint)StatusEffectId.EXPChain); + newChain.SetSilent(true); + newChain.SetDuration(timeLimit); + newChain.SetTier((byte)(Math.Min(expChainNumber + 1, 255))); + attacker.statusEffects.AddStatusEffect(newChain, attacker, true, true); + + actionContainer?.AddEXPActions(attacker.AddExp(baseExp, (byte)attacker.GetClass(), (byte)(totalBonus.Min(255)))); + } + } + + #endregion + } +} \ No newline at end of file diff --git a/FFXIVClassic Map Server/actors/chara/npc/Ally.cs b/FFXIVClassic Map Server/actors/chara/npc/Ally.cs new file mode 100644 index 00000000..d8924544 --- /dev/null +++ b/FFXIVClassic Map Server/actors/chara/npc/Ally.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using FFXIVClassic_Map_Server.Actors; +using FFXIVClassic_Map_Server.actors.chara.ai; +using FFXIVClassic_Map_Server.actors.chara.ai.controllers; + +namespace FFXIVClassic_Map_Server.actors.chara.npc +{ + class Ally : BattleNpc + { + // todo: ally class is probably not necessary + public Ally(int actorNumber, ActorClass actorClass, string uniqueId, Area spawnedArea, float posX, float posY, float posZ, float rot, + ushort actorState, uint animationId, string customDisplayName) + : base(actorNumber, actorClass, uniqueId, spawnedArea, posX, posY, posZ, rot, actorState, animationId, customDisplayName) + { + aiContainer = new AIContainer(this, new AllyController(this), new PathFind(this), new TargetFind(this)); + this.allegiance = CharacterTargetingAllegiance.Player; + this.isAutoAttackEnabled = true; + this.isMovingToSpawn = false; + } + } +} diff --git a/FFXIVClassic Map Server/actors/chara/npc/BattleNpc.cs b/FFXIVClassic Map Server/actors/chara/npc/BattleNpc.cs new file mode 100644 index 00000000..f7476e8a --- /dev/null +++ b/FFXIVClassic Map Server/actors/chara/npc/BattleNpc.cs @@ -0,0 +1,463 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using FFXIVClassic.Common; +using FFXIVClassic_Map_Server.Actors; +using FFXIVClassic_Map_Server.actors.chara.npc; +using FFXIVClassic_Map_Server.actors; +using FFXIVClassic_Map_Server.actors.chara; +using FFXIVClassic_Map_Server.actors.chara.ai; +using FFXIVClassic_Map_Server.actors.chara.ai.controllers; +using FFXIVClassic_Map_Server.packets.send.actor; +using FFXIVClassic_Map_Server.actors.chara.ai.state; +using FFXIVClassic_Map_Server.utils; +using FFXIVClassic_Map_Server.packets.send.actor.battle; +using FFXIVClassic_Map_Server.actors.chara.ai.utils; +using FFXIVClassic_Map_Server.actors.group; +using FFXIVClassic_Map_Server.packets.send; +using FFXIVClassic_Map_Server.Actors.Chara; + +namespace FFXIVClassic_Map_Server.Actors +{ + [Flags] + enum DetectionType + { + None = 0x00, + Sight = 0x01, + Scent = 0x02, + Sound = 0x04, + LowHp = 0x08, + IgnoreLevelDifference = 0x10, + Magic = 0x20, + } + + enum KindredType + { + Unknown = 0, + Beast = 1, + Plantoid = 2, + Aquan = 3, + Spoken = 4, + Reptilian = 5, + Insect = 6, + Avian = 7, + Undead = 8, + Cursed = 9, + Voidsent = 10, + } + + class BattleNpc : Npc + { + public HateContainer hateContainer; + public DetectionType detectionType; + public KindredType kindredType; + public bool neutral; + protected uint despawnTime; + protected uint respawnTime; + protected uint spawnDistance; + protected uint bnpcId; + public Character lastAttacker; + + public uint spellListId, skillListId, dropListId; + public Dictionary skillList = new Dictionary(); + public Dictionary spellList = new Dictionary(); + + public uint poolId, genusId; + public ModifierList poolMods; + public ModifierList genusMods; + public ModifierList spawnMods; + + protected Dictionary mobModifiers = new Dictionary(); + + public BattleNpc(int actorNumber, ActorClass actorClass, string uniqueId, Area spawnedArea, float posX, float posY, float posZ, float rot, + ushort actorState, uint animationId, string customDisplayName) + : base(actorNumber, actorClass, uniqueId, spawnedArea, posX, posY, posZ, rot, actorState, animationId, customDisplayName) + { + this.aiContainer = new AIContainer(this, new BattleNpcController(this), new PathFind(this), new TargetFind(this)); + + //this.currentSubState = SetActorStatePacket.SUB_STATE_MONSTER; + //this.currentMainState = SetActorStatePacket.MAIN_STATE_ACTIVE; + + //charaWork.property[2] = 1; + //npcWork.hateType = 1; + + this.hateContainer = new HateContainer(this); + this.allegiance = CharacterTargetingAllegiance.BattleNpcs; + + spawnX = posX; + spawnY = posY; + spawnZ = posZ; + + despawnTime = 10; + CalculateBaseStats(); + } + + public override List GetSpawnPackets(Player player, ushort spawnType) + { + List subpackets = new List(); + if (IsAlive()) + { + subpackets.Add(CreateAddActorPacket()); + subpackets.AddRange(GetEventConditionPackets()); + subpackets.Add(CreateSpeedPacket()); + subpackets.Add(CreateSpawnPositonPacket(0x0)); + + subpackets.Add(CreateAppearancePacket()); + + subpackets.Add(CreateNamePacket()); + subpackets.Add(CreateStatePacket()); + subpackets.Add(CreateSubStatePacket()); + subpackets.Add(CreateInitStatusPacket()); + subpackets.Add(CreateSetActorIconPacket()); + subpackets.Add(CreateIsZoneingPacket()); + subpackets.Add(CreateScriptBindPacket(player)); + subpackets.Add(GetHateTypePacket(player)); + } + return subpackets; + } + + //This might need more work + //I think there migh be something that ties mobs to parties + //and the client checks if any mobs are tied to the current party + //and bases the color on that. Adding mob to party obviously doesn't work + //Based on depictionjudge script: + //HATE_TYPE_NONE is for passive + //HATE_TYPE_ENGAGED is for aggroed mobs + //HATE_TYPE_ENGAGED_PARTY is for claimed mobs, client uses occupancy group to determine if mob is claimed by player's party + //for now i'm just going to assume that occupancygroup will be BattleNpc's currentparties when they're in combat, + //so if party isn't null, they're claimed. + public SubPacket GetHateTypePacket(Player player) + { + npcWork.hateType = NpcWork.HATE_TYPE_NONE; + if (player != null) + { + if (aiContainer.IsEngaged()) + { + npcWork.hateType = NpcWork.HATE_TYPE_ENGAGED; + + if (this.currentParty != null) + { + npcWork.hateType = NpcWork.HATE_TYPE_ENGAGED_PARTY; + } + } + } + npcWork.hateType = 3; + var propPacketUtil = new ActorPropertyPacketUtil("npcWork/hate", this); + propPacketUtil.AddProperty("npcWork.hateType"); + return propPacketUtil.Done()[0]; + } + + public uint GetDetectionType() + { + return (uint)detectionType; + } + + public void SetDetectionType(uint detectionType) + { + this.detectionType = (DetectionType)detectionType; + } + + public override void Update(DateTime tick) + { + this.aiContainer.Update(tick); + this.statusEffects.Update(tick); + } + + public override void PostUpdate(DateTime tick, List packets = null) + { + // todo: should probably add another flag for battleTemp since all this uses reflection + packets = new List(); + if ((updateFlags & ActorUpdateFlags.HpTpMp) != 0) + { + var propPacketUtil = new ActorPropertyPacketUtil("charaWork/stateAtQuicklyForAll", this); + propPacketUtil.AddProperty("charaWork.parameterSave.state_mainSkill[0]"); + propPacketUtil.AddProperty("charaWork.parameterSave.state_mainSkillLevel"); + + propPacketUtil.AddProperty("charaWork.battleTemp.castGauge_speed[0]"); + propPacketUtil.AddProperty("charaWork.battleTemp.castGauge_speed[1]"); + packets.AddRange(propPacketUtil.Done()); + } + base.PostUpdate(tick, packets); + } + + public override bool CanAttack() + { + // todo: + return true; + } + + public override bool CanCast(Character target, BattleCommand spell) + { + // todo: + if (target == null) + { + // Target does not exist. + return false; + } + if (Utils.Distance(positionX, positionY, positionZ, target.positionX, target.positionY, target.positionZ) > spell.range) + { + // The target is out of range. + return false; + } + if (!IsValidTarget(target, spell.mainTarget) || !spell.IsValidMainTarget(this, target)) + { + // error packet is set in IsValidTarget + return false; + } + return true; + } + + public override bool CanWeaponSkill(Character target, BattleCommand skill) + { + // todo: + return true; + } + + public override bool CanUseAbility(Character target, BattleCommand ability) + { + // todo: + return false; + } + + public uint GetDespawnTime() + { + return despawnTime; + } + + public void SetDespawnTime(uint seconds) + { + despawnTime = seconds; + } + + public uint GetRespawnTime() + { + return respawnTime; + } + + public void SetRespawnTime(uint seconds) + { + respawnTime = seconds; + } + + /// // todo: create an action object? + public bool OnAttack(AttackState state) + { + return false; + } + + public override void Spawn(DateTime tick) + { + if (respawnTime > 0) + { + ForceRespawn(); + } + } + + public void ForceRespawn() + { + base.Spawn(Program.Tick); + + this.isMovingToSpawn = false; + this.hateContainer.ClearHate(); + zone.BroadcastPacketsAroundActor(this, GetSpawnPackets(null, 0x01)); + zone.BroadcastPacketsAroundActor(this, GetInitPackets()); + charaWork.parameterSave.hp = charaWork.parameterSave.hpMax; + charaWork.parameterSave.mp = charaWork.parameterSave.mpMax; + RecalculateStats(); + + OnSpawn(); + updateFlags |= ActorUpdateFlags.AllNpc; + } + + public override void Die(DateTime tick, CommandResultContainer actionContainer = null) + { + if (IsAlive()) + { + // todo: does retail + if (lastAttacker is Pet && lastAttacker.aiContainer.GetController() != null && lastAttacker.aiContainer.GetController().GetPetMaster() is Player) + { + lastAttacker = lastAttacker.aiContainer.GetController().GetPetMaster(); + } + + if (lastAttacker is Player) + { + //I think this is, or should be odne in DoBattleAction. Packet capture had the message in the same packet as an attack + // defeat/defeats + if (actionContainer != null) + actionContainer.AddEXPAction(new CommandResult(actorId, 30108, 0)); + if (lastAttacker.currentParty != null && lastAttacker.currentParty is Party) + { + foreach (var memberId in ((Party)lastAttacker.currentParty).members) + { + var partyMember = zone.FindActorInArea(memberId); + // onDeath(monster, player, killer) + lua.LuaEngine.CallLuaBattleFunction(this, "onDeath", this, partyMember, lastAttacker); + + // todo: add actual experience calculation and exp bonus values. + if (partyMember is Player) + BattleUtils.AddBattleBonusEXP((Player)partyMember, this, actionContainer); + } + } + else + { + // onDeath(monster, player, killer) + lua.LuaEngine.CallLuaBattleFunction(this, "onDeath", this, lastAttacker, lastAttacker); + //((Player)lastAttacker).QueuePacket(BattleActionX01Packet.BuildPacket(lastAttacker.actorId, 0, 0, new BattleAction(actorId, 30108, 0))); + } + } + + if (positionUpdates != null) + positionUpdates.Clear(); + aiContainer.InternalDie(tick, despawnTime); + //this.ResetMoveSpeeds(); + // todo: reset cooldowns + + lua.LuaEngine.GetInstance().OnSignal("mobkill"); + } + else + { + var err = String.Format("[{0}][{1}] {2} {3} {4} {5} tried to die ded", actorId, GetUniqueId(), positionX, positionY, positionZ, GetZone().GetName()); + Program.Log.Error(err); + //throw new Exception(err); + } + } + + public override void Despawn(DateTime tick) + { + // todo: probably didnt need to make a new state... + aiContainer.InternalDespawn(tick, respawnTime); + lua.LuaEngine.CallLuaBattleFunction(this, "onDespawn", this); + this.isAtSpawn = true; + } + + public void OnRoam(DateTime tick) + { + // leash back to spawn + if (!IsCloseToSpawn()) + { + if (!isMovingToSpawn) + { + aiContainer.Reset(); + isMovingToSpawn = true; + } + else + { + if (target == null && !aiContainer.pathFind.IsFollowingPath()) + aiContainer.pathFind.PathInRange(spawnX, spawnY, spawnZ, 1.5f, 15.0f); + } + } + else + { + // recover hp + if (GetHPP() < 100) + { + AddHP(GetMaxHP() / 10); + } + else + { + this.isMovingToSpawn = false; + } + } + } + + public bool IsCloseToSpawn() + { + return this.isAtSpawn = Utils.DistanceSquared(positionX, positionY, positionZ, spawnX, spawnY, spawnZ) <= 2500.0f; + } + + public override void OnAttack(State state, CommandResult action, ref CommandResult error) + { + base.OnAttack(state, action, ref error); + // todo: move this somewhere else prolly and change based on model/appearance (so maybe in Character.cs instead) + action.animation = 0x11001000; // (temporary) wolf anim + + if (GetMobMod((uint)MobModifier.AttackScript) != 0) + lua.LuaEngine.CallLuaBattleFunction(this, "onAttack", this, state.GetTarget(), action.amount); + } + + public override void OnCast(State state, CommandResult[] actions, BattleCommand spell, ref CommandResult[] errors) + { + base.OnCast(state, actions, spell, ref errors); + + if (GetMobMod((uint)MobModifier.SpellScript) != 0) + foreach (var action in actions) + lua.LuaEngine.CallLuaBattleFunction(this, "onCast", this, zone.FindActorInArea(action.targetId), ((MagicState)state).GetSpell(), action); + } + + public override void OnAbility(State state, CommandResult[] actions, BattleCommand ability, ref CommandResult[] errors) + { + base.OnAbility(state, actions, ability, ref errors); + + /* + if (GetMobMod((uint)MobModifier.AbilityScript) != 0) + foreach (var action in actions) + lua.LuaEngine.CallLuaBattleFunction(this, "onAbility", this, zone.FindActorInArea(action.targetId), ((AbilityState)state).GetAbility(), action); + */ + } + + public override void OnWeaponSkill(State state, CommandResult[] actions, BattleCommand skill, ref CommandResult[] errors) + { + base.OnWeaponSkill(state, actions, skill, ref errors); + + if (GetMobMod((uint)MobModifier.WeaponSkillScript) != 0) + foreach (var action in actions) + lua.LuaEngine.CallLuaBattleFunction(this, "onWeaponSkill", this, zone.FindActorInArea(action.targetId), ((WeaponSkillState)state).GetWeaponSkill(), action); + } + + public override void OnSpawn() + { + base.OnSpawn(); + lua.LuaEngine.CallLuaBattleFunction(this, "onSpawn", this); + } + + public override void OnDeath() + { + base.OnDeath(); + } + + public override void OnDespawn() + { + base.OnDespawn(); + } + + public uint GetBattleNpcId() + { + return bnpcId; + } + + public void SetBattleNpcId(uint id) + { + this.bnpcId = id; + } + + public Int64 GetMobMod(MobModifier mobMod) + { + return GetMobMod((uint)mobMod); + } + + public Int64 GetMobMod(uint mobModId) + { + Int64 res; + if (mobModifiers.TryGetValue((MobModifier)mobModId, out res)) + return res; + return 0; + } + + public void SetMobMod(uint mobModId, Int64 val) + { + if (mobModifiers.ContainsKey((MobModifier)mobModId)) + mobModifiers[(MobModifier)mobModId] = val; + else + mobModifiers.Add((MobModifier)mobModId, val); + } + + public override void OnDamageTaken(Character attacker, CommandResult action, CommandResultContainer actionContainer = null) + { + if (GetMobMod((uint)MobModifier.DefendScript) != 0) + lua.LuaEngine.CallLuaBattleFunction(this, "onDamageTaken", this, attacker, action.amount); + base.OnDamageTaken(attacker, action, actionContainer); + } + } +} diff --git a/FFXIVClassic Map Server/actors/chara/npc/MobModifier.cs b/FFXIVClassic Map Server/actors/chara/npc/MobModifier.cs new file mode 100644 index 00000000..1e525cb0 --- /dev/null +++ b/FFXIVClassic Map Server/actors/chara/npc/MobModifier.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FFXIVClassic_Map_Server.actors.chara.npc +{ + enum MobModifier + { + None = 0, + SpawnLeash = 1, // how far can i move before i deaggro target + SightRange = 2, // how close does target need to be for me to detect by sight + SoundRange = 3, // how close does target need to be for me to detect by sound + BuffChance = 4, + HealChance = 5, + SkillUseChance = 6, + LinkRadius = 7, + MagicDelay = 8, + SpecialDelay = 9, + ExpBonus = 10, // + IgnoreSpawnLeash = 11, // pursue target forever + DrawIn = 12, // do i suck people in around me + HpScale = 13, // + Assist = 14, // gotta call the bois + NoMove = 15, // cant move + ShareTarget = 16, // use this actor's id as target id + AttackScript = 17, // call my script's onAttack whenever i attack + DefendScript = 18, // call my script's onDamageTaken whenever i take damage + SpellScript = 19, // call my script's onSpellCast whenever i finish casting + WeaponSkillScript = 20, // call my script's onWeaponSkill whenever i finish using a weaponskill + AbilityScript = 21, // call my script's onAbility whenever i finish using an ability + CallForHelp = 22, // actor with this id outside of target's party with this can attack me + FreeForAll = 23, // any actor can attack me + Roams = 24, // Do I walk around? + RoamDelay = 25, // What is the delay between roam ticks + Linked = 26, // Did I get aggroed via linking? + LinkCount = 27 // How many BattleNPCs got linked with me + } +} \ No newline at end of file diff --git a/FFXIVClassic Map Server/actors/chara/npc/Npc.cs b/FFXIVClassic Map Server/actors/chara/npc/Npc.cs index edae3e77..a351e73b 100644 --- a/FFXIVClassic Map Server/actors/chara/npc/Npc.cs +++ b/FFXIVClassic Map Server/actors/chara/npc/Npc.cs @@ -17,9 +17,21 @@ using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; +using FFXIVClassic_Map_Server.actors.chara.ai; namespace FFXIVClassic_Map_Server.Actors { + [Flags] + enum NpcSpawnType : ushort + { + Normal = 0x00, + Scripted = 0x01, + Nighttime = 0x02, + Evening = 0x04, + Daytime = 0x08, + Weather = 0x10, + } + class Npc : Character { private uint actorClassId; @@ -29,6 +41,7 @@ namespace FFXIVClassic_Map_Server.Actors private uint layout, instance; public NpcWork npcWork = new NpcWork(); + public NpcSpawnType npcSpawnType; public Npc(int actorNumber, ActorClass actorClass, string uniqueId, Area spawnedArea, float posX, float posY, float posZ, float rot, ushort actorState, uint animationId, string customDisplayName) : base((4 << 28 | spawnedArea.actorId << 19 | (uint)actorNumber)) @@ -50,6 +63,8 @@ namespace FFXIVClassic_Map_Server.Actors this.actorClassId = actorClass.actorClassId; + this.currentSubState.motionPack = (ushort) animationId; + LoadNpcAppearance(actorClass.actorClassId); className = actorClass.classPath.Substring(actorClass.classPath.LastIndexOf("/") + 1); @@ -57,15 +72,17 @@ namespace FFXIVClassic_Map_Server.Actors charaWork.battleSave.potencial = 1.0f; - charaWork.parameterSave.state_mainSkill[0] = 3; - charaWork.parameterSave.state_mainSkill[2] = 3; - charaWork.parameterSave.state_mainSkillLevel = 2; + // todo: these really need to be read from db etc + { + charaWork.parameterSave.state_mainSkill[0] = 3; + charaWork.parameterSave.state_mainSkill[2] = 3; + charaWork.parameterSave.state_mainSkillLevel = 1; - charaWork.parameterSave.hp[0] = 500; - charaWork.parameterSave.hpMax[0] = 500; - - for (int i = 0; i < 32; i++ ) - charaWork.property[i] = (byte)(((int)actorClass.propertyFlags >> i) & 1); + charaWork.parameterSave.hp[0] = 80; + charaWork.parameterSave.hpMax[0] = 80; + } + for (int i = 0; i < 32; i++ ) + charaWork.property[i] = (byte)(((int)actorClass.propertyFlags >> i) & 1); npcWork.pushCommand = actorClass.pushCommand; npcWork.pushCommandSub = actorClass.pushCommandSub; @@ -84,8 +101,8 @@ namespace FFXIVClassic_Map_Server.Actors isStatic = true; } } - - GenerateActorName((int)actorNumber); + GenerateActorName((int)actorNumber); + this.aiContainer = new AIContainer(this, null, new PathFind(this), new TargetFind(this)); } public Npc(int actorNumber, ActorClass actorClass, string uniqueId, Area spawnedArea, float posX, float posY, float posZ, float rot, uint layout, uint instance) @@ -124,6 +141,7 @@ namespace FFXIVClassic_Map_Server.Actors this.instance = instance; GenerateActorName((int)actorNumber); + this.aiContainer = new AIContainer(this, null, new PathFind(this), new TargetFind(null)); } public SubPacket CreateAddActorPacket() @@ -142,8 +160,8 @@ namespace FFXIVClassic_Map_Server.Actors isStatic = true; else { - // charaWork.property[2] = 1; - // npcWork.hateType = 1; + //charaWork.property[2] = 1; + //npcWork.hateType = 1; } if (lParams == null) @@ -178,14 +196,14 @@ namespace FFXIVClassic_Map_Server.Actors subpackets.Add(CreateSpeedPacket()); subpackets.Add(CreateSpawnPositonPacket(0x0)); - if (isMapObj) - subpackets.Add(SetActorBGPropertiesPacket.BuildPacket(actorId, instance, layout)); + if (isMapObj) + subpackets.Add(SetActorBGPropertiesPacket.BuildPacket(actorId, instance, layout)); else subpackets.Add(CreateAppearancePacket()); subpackets.Add(CreateNamePacket()); subpackets.Add(CreateStatePacket()); - subpackets.Add(CreateIdleAnimationPacket()); + subpackets.Add(CreateSubStatePacket()); subpackets.Add(CreateInitStatusPacket()); subpackets.Add(CreateSetActorIconPacket()); subpackets.Add(CreateIsZoneingPacket()); @@ -229,7 +247,7 @@ namespace FFXIVClassic_Map_Server.Actors //Status Times for (int i = 0; i < charaWork.statusShownTime.Length; i++) { - if (charaWork.statusShownTime[i] != 0xFFFFFFFF) + if (charaWork.statusShownTime[i] != 0) propPacketUtil.AddProperty(String.Format("charaWork.statusShownTime[{0}]", i)); } @@ -392,18 +410,46 @@ namespace FFXIVClassic_Map_Server.Actors zone.DespawnActor(this); } - public void Update(double deltaTime) + public override void Update(DateTime tick) { - LuaEngine.GetInstance().CallLuaFunction(null, this, "onUpdate", true, deltaTime); + // todo: can normal npcs have status effects? + aiContainer.Update(tick); } - //A party member list packet came, set the party - /* public void SetParty(MonsterPartyGroup group) + public override void PostUpdate(DateTime tick, List packets = null) { - if (group is MonsterPartyGroup) - currentParty = group; + packets = packets ?? new List(); + + if ((updateFlags & ActorUpdateFlags.Work) != 0) + { + + } + base.PostUpdate(tick, packets); } - */ + + public override void OnSpawn() + { + base.OnSpawn(); + } + + public override void OnDeath() + { + base.OnDeath(); + } + + public override void OnDespawn() + { + zone.BroadcastPacketAroundActor(this, RemoveActorPacket.BuildPacket(this.actorId)); + QueuePositionUpdate(spawnX, spawnY, spawnZ); + LuaEngine.CallLuaBattleFunction(this, "onDespawn", this); + } + //A party member list packet came, set the party + /* public void SetParty(MonsterPartyGroup group) + { + if (group is MonsterPartyGroup) + currentParty = group; + } + */ } } diff --git a/FFXIVClassic Map Server/actors/chara/npc/NpcWork.cs b/FFXIVClassic Map Server/actors/chara/npc/NpcWork.cs index ca21d437..7827f7f5 100644 --- a/FFXIVClassic Map Server/actors/chara/npc/NpcWork.cs +++ b/FFXIVClassic Map Server/actors/chara/npc/NpcWork.cs @@ -2,6 +2,10 @@ { class NpcWork { + public static byte HATE_TYPE_NONE = 0; + public static byte HATE_TYPE_ENGAGED = 2; + public static byte HATE_TYPE_ENGAGED_PARTY = 3; + public ushort pushCommand; public int pushCommandSub; public byte pushCommandPriority; diff --git a/FFXIVClassic Map Server/actors/chara/npc/Pet.cs b/FFXIVClassic Map Server/actors/chara/npc/Pet.cs new file mode 100644 index 00000000..3068d023 --- /dev/null +++ b/FFXIVClassic Map Server/actors/chara/npc/Pet.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +using FFXIVClassic_Map_Server.actors.chara.ai; +using FFXIVClassic_Map_Server.actors.chara.ai.controllers; +using FFXIVClassic_Map_Server.actors.chara.npc; +using FFXIVClassic_Map_Server.packets.send.actor; + +namespace FFXIVClassic_Map_Server.Actors +{ + class Pet : BattleNpc + { + public Pet(int actorNumber, ActorClass actorClass, string uniqueId, Area spawnedArea, float posX, float posY, float posZ, float rot, + ushort actorState, uint animationId, string customDisplayName) + : base(actorNumber, actorClass, uniqueId, spawnedArea, posX, posY, posZ, rot, actorState, animationId, customDisplayName) + { + this.aiContainer = new AIContainer(this, new PetController(this), new PathFind(this), new TargetFind(this)); + this.hateContainer = new HateContainer(this); + } + } +} diff --git a/FFXIVClassic Map Server/actors/chara/player/Equipment.cs b/FFXIVClassic Map Server/actors/chara/player/Equipment.cs index 9ab22d2a..87ad1210 100644 --- a/FFXIVClassic Map Server/actors/chara/player/Equipment.cs +++ b/FFXIVClassic Map Server/actors/chara/player/Equipment.cs @@ -163,6 +163,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.player owner.QueuePacket(InventoryEndChangePacket.BuildPacket(owner.actorId)); list[slot] = item; + owner.CalculateBaseStats();// RecalculateStats(); } public void ToggleDBWrite(bool flag) @@ -189,6 +190,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.player owner.QueuePacket(InventoryEndChangePacket.BuildPacket(owner.actorId)); list[slot] = null; + owner.RecalculateStats(); } private void SendEquipmentPackets(ushort equipSlot, InventoryItem item) diff --git a/FFXIVClassic Map Server/actors/chara/player/Inventory.cs b/FFXIVClassic Map Server/actors/chara/player/Inventory.cs index a8fa7458..a0d741d9 100644 --- a/FFXIVClassic Map Server/actors/chara/player/Inventory.cs +++ b/FFXIVClassic Map Server/actors/chara/player/Inventory.cs @@ -1,5 +1,4 @@ - -using FFXIVClassic.Common; +using FFXIVClassic.Common; using FFXIVClassic_Map_Server.actors.chara.npc; using FFXIVClassic_Map_Server.Actors; using FFXIVClassic_Map_Server.dataobjects; @@ -7,66 +6,66 @@ using FFXIVClassic_Map_Server.packets.send.actor.inventory; using System; using System.Collections.Generic; using System.Diagnostics; -using System.Linq; - -namespace FFXIVClassic_Map_Server.actors.chara.player -{ - class Inventory - { +using System.Linq; + +namespace FFXIVClassic_Map_Server.actors.chara.player +{ + class Inventory + { public const ushort NORMAL = 0; //Max 0xC8 - public const ushort TRADE = 1; //Max 0x96 - public const ushort LOOT = 4; //Max 0xA + public const ushort TRADE = 1; //Max 0x96 + public const ushort LOOT = 4; //Max 0xA public const ushort MELDREQUEST = 5; //Max 0x04 - public const ushort BAZAAR = 7; //Max 0x0A - public const ushort CURRENCY_CRYSTALS = 99; //Max 0x140 - public const ushort KEYITEMS = 100; //Max 0x500 - public const ushort EQUIPMENT = 0x00FE; //Max 0x23 + public const ushort BAZAAR = 7; //Max 0x0A + public const ushort CURRENCY_CRYSTALS = 99; //Max 0x140 + public const ushort KEYITEMS = 100; //Max 0x500 + public const ushort EQUIPMENT = 0x00FE; //Max 0x23 public const ushort EQUIPMENT_OTHERPLAYER = 0x00F9; //Max 0x23 - - public enum INV_ERROR { - SUCCESS = 0, + + public enum INV_ERROR { + SUCCESS = 0, INVENTORY_FULL, ALREADY_HAS_UNIQUE, SYSTEM_ERROR - }; - - private Character owner; - private ushort inventoryCapacity; + }; + + private Character owner; + private ushort inventoryCapacity; private ushort inventoryCode; - private bool isTemporary; + private bool isTemporary; private InventoryItem[] list; private bool[] isDirty; private int endOfListIndex = 0; - public Inventory(Character ownerPlayer, ushort capacity, ushort code, bool temporary = false) - { - owner = ownerPlayer; - inventoryCapacity = capacity; + public Inventory(Character ownerPlayer, ushort capacity, ushort code, bool temporary = false) + { + owner = ownerPlayer; + inventoryCapacity = capacity; inventoryCode = code; isTemporary = temporary; list = new InventoryItem[capacity]; - isDirty = new bool[capacity]; - } - - #region Inventory Management - public void InitList(List itemsFromDB) - { + isDirty = new bool[capacity]; + } + + #region Inventory Management + public void InitList(List itemsFromDB) + { int i = 0; foreach (InventoryItem item in itemsFromDB) list[i++] = item; - endOfListIndex = i; - } - - public InventoryItem GetItemAtSlot(ushort slot) - { - if (slot < list.Length) - return list[slot]; - else - return null; - } - - public InventoryItem GetItemByUniqueId(ulong uniqueItemId) + endOfListIndex = i; + } + + public InventoryItem GetItemAtSlot(ushort slot) + { + if (slot < list.Length) + return list[slot]; + else + return null; + } + + public InventoryItem GetItemByUniqueId(ulong uniqueItemId) { for (int i = 0; i < endOfListIndex; i++) { @@ -74,10 +73,10 @@ namespace FFXIVClassic_Map_Server.actors.chara.player Debug.Assert(item != null, "Item slot was null!!!"); - if (item.uniqueId == uniqueItemId) - return item; - } - return null; + if (item.uniqueId == uniqueItemId) + return item; + } + return null; } public InventoryItem GetItemByCatelogId(ulong catelogId) @@ -95,9 +94,9 @@ namespace FFXIVClassic_Map_Server.actors.chara.player } - public int GetItemQuantity(uint itemId) - { - return GetItemQuantity(itemId, 1); + public int GetItemQuantity(uint itemId) + { + return GetItemQuantity(itemId, 1); } public int GetItemQuantity(uint itemId, uint quality) @@ -111,9 +110,9 @@ namespace FFXIVClassic_Map_Server.actors.chara.player if (item.itemId == itemId && item.quality == quality) count += item.quantity; - } - - return count; + } + + return count; } @@ -128,99 +127,99 @@ namespace FFXIVClassic_Map_Server.actors.chara.player AddItem(itemId[i]); } - public int AddItem(uint itemId, int quantity) + public int AddItem(uint itemId, int quantity) { - return AddItem(itemId, quantity, 1); - } - - public int AddItem(uint itemId, int quantity, byte quality) - { - if (!IsSpaceForAdd(itemId, quantity, quality)) - return (int)INV_ERROR.INVENTORY_FULL; - - ItemData gItem = Server.GetItemGamedata(itemId); - + return AddItem(itemId, quantity, 1); + } + + public int AddItem(uint itemId, int quantity, byte quality) + { + if (!IsSpaceForAdd(itemId, quantity, quality)) + return (int)INV_ERROR.INVENTORY_FULL; + + ItemData gItem = Server.GetItemGamedata(itemId); + if (gItem == null) { Program.Log.Error("Inventory.AddItem: unable to find item %u", itemId); return (int)INV_ERROR.SYSTEM_ERROR; - } - - //Check if item id exists + } + + //Check if item id exists int quantityCount = quantity; - for (int i = 0; i < endOfListIndex; i++) - { + for (int i = 0; i < endOfListIndex; i++) + { InventoryItem item = list[i]; - Debug.Assert(item != null, "Item slot was null!!!"); - - if (item.itemId == itemId && item.quality == quality && item.quantity < gItem.maxStack) - { - int oldQuantity = item.quantity; + Debug.Assert(item != null, "Item slot was null!!!"); + + if (item.itemId == itemId && item.quality == quality && item.quantity < gItem.maxStack) + { + int oldQuantity = item.quantity; item.quantity = Math.Min(item.quantity + quantityCount, gItem.maxStack); - isDirty[i] = true; + isDirty[i] = true; quantityCount -= (gItem.maxStack - oldQuantity); DoDatabaseQuantity(item.uniqueId, item.quantity); - - if (quantityCount <= 0) - break; - } - } - - //If it's unique, abort - if (HasItem(itemId) && gItem.isRare) - return (int)INV_ERROR.ALREADY_HAS_UNIQUE; - - //New item that spilled over - while (quantityCount > 0) - { + + if (quantityCount <= 0) + break; + } + } + + //If it's unique, abort + if (HasItem(itemId) && gItem.isRare) + return (int)INV_ERROR.ALREADY_HAS_UNIQUE; + + //New item that spilled over + while (quantityCount > 0) + { InventoryItem addedItem = Database.CreateItem(itemId, Math.Min(quantityCount, gItem.maxStack), quality, gItem.isExclusive ? (byte)0x3 : (byte)0x0, gItem.durability); addedItem.slot = (ushort)endOfListIndex; isDirty[endOfListIndex] = true; - list[endOfListIndex++] = addedItem; + list[endOfListIndex++] = addedItem; quantityCount -= gItem.maxStack; - DoDatabaseAdd(addedItem); + DoDatabaseAdd(addedItem); } SendUpdatePackets(); - return (int)INV_ERROR.SUCCESS; - } - + return (int)INV_ERROR.SUCCESS; + } + public void RemoveItem(uint itemId) { RemoveItem(itemId, 1); - } - + } + public void RemoveItem(uint itemId, int quantity) { RemoveItem(itemId, quantity, 1); - } - - public void RemoveItem(uint itemId, int quantity, int quality) - { - if (!HasItem(itemId, quantity, quality)) - return; - - List slotsToUpdate = new List(); - List itemsToRemove = new List(); - List slotsToRemove = new List(); - List AddItemPackets = new List(); - - //Remove as we go along - int quantityCount = quantity; - ushort lowestSlot = 0; - for (int i = endOfListIndex - 1; i >= 0; i--) - { + } + + public void RemoveItem(uint itemId, int quantity, int quality) + { + if (!HasItem(itemId, quantity, quality)) + return; + + List slotsToUpdate = new List(); + List itemsToRemove = new List(); + List slotsToRemove = new List(); + List AddItemPackets = new List(); + + //Remove as we go along + int quantityCount = quantity; + ushort lowestSlot = 0; + for (int i = endOfListIndex - 1; i >= 0; i--) + { InventoryItem item = list[i]; - Debug.Assert(item != null, "Item slot was null!!!"); - - if (item.itemId == itemId && item.quality == quality) - { - int oldQuantity = item.quantity; + Debug.Assert(item != null, "Item slot was null!!!"); + + if (item.itemId == itemId && item.quality == quality) + { + int oldQuantity = item.quantity; //Stack nomnomed if (item.quantity - quantityCount <= 0) { @@ -234,53 +233,53 @@ namespace FFXIVClassic_Map_Server.actors.chara.player DoDatabaseQuantity(list[i].uniqueId, list[i].quantity); } - isDirty[i] = true; - - quantityCount -= oldQuantity; - lowestSlot = item.slot; - - if (quantityCount <= 0) - break; - } + isDirty[i] = true; + + quantityCount -= oldQuantity; + lowestSlot = item.slot; + + if (quantityCount <= 0) + break; + } } DoRealign(); - SendUpdatePackets(); - } - - public void RemoveItemByUniqueId(ulong itemDBId) - { - ushort slot = 0; + SendUpdatePackets(); + } + + public void RemoveItemByUniqueId(ulong itemDBId) + { + ushort slot = 0; InventoryItem toDelete = null; for (int i = endOfListIndex - 1; i >= 0; i--) { InventoryItem item = list[i]; - Debug.Assert(item != null, "Item slot was null!!!"); - - if (item.uniqueId == itemDBId) - { - toDelete = item; - break; - } - slot++; - } - - if (toDelete == null) + Debug.Assert(item != null, "Item slot was null!!!"); + + if (item.uniqueId == itemDBId) + { + toDelete = item; + break; + } + slot++; + } + + if (toDelete == null) return; - DoDatabaseRemove(toDelete.uniqueId); - + DoDatabaseRemove(toDelete.uniqueId); + list[slot] = null; isDirty[slot] = true; DoRealign(); - SendUpdatePackets(); - } - - public void RemoveItemAtSlot(ushort slot) - { - if (slot >= endOfListIndex) + SendUpdatePackets(); + } + + public void RemoveItemAtSlot(ushort slot) + { + if (slot >= endOfListIndex) return; DoDatabaseRemove(list[slot].uniqueId); @@ -289,7 +288,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.player isDirty[slot] = true; DoRealign(); - SendUpdatePackets(); + SendUpdatePackets(); } public void RemoveItemAtSlot(ushort slot, int quantity) @@ -314,64 +313,64 @@ namespace FFXIVClassic_Map_Server.actors.chara.player isDirty[slot] = true; SendUpdatePackets(); } - } - - public void ChangeDurability(uint slot, uint durabilityChange) + } + + public void ChangeDurability(uint slot, uint durabilityChange) { - isDirty[slot] = true; - } - - public void ChangeSpiritBind(uint slot, uint spiritBindChange) + isDirty[slot] = true; + } + + public void ChangeSpiritBind(uint slot, uint spiritBindChange) { - isDirty[slot] = true; - } - - public void ChangeMateria(uint slot, byte materiaSlot, byte materiaId) + isDirty[slot] = true; + } + + public void ChangeMateria(uint slot, byte materiaSlot, byte materiaId) { - isDirty[slot] = true; - } - #endregion - - #region Packet Functions - public void SendFullInventory(Player player) + isDirty[slot] = true; + } + #endregion + + #region Packet Functions + public void SendFullInventory(Player player) { - player.QueuePacket(InventorySetBeginPacket.BuildPacket(owner.actorId, inventoryCapacity, inventoryCode)); + player.QueuePacket(InventorySetBeginPacket.BuildPacket(owner.actorId, inventoryCapacity, inventoryCode)); SendInventoryPackets(player, 0); - player.QueuePacket(InventorySetEndPacket.BuildPacket(owner.actorId)); + player.QueuePacket(InventorySetEndPacket.BuildPacket(owner.actorId)); } - private void SendInventoryPackets(Player player, InventoryItem item) + private void SendInventoryPackets(Player player, InventoryItem item) { - player.QueuePacket(InventoryListX01Packet.BuildPacket(owner.actorId, item)); + player.QueuePacket(InventoryListX01Packet.BuildPacket(owner.actorId, item)); } - private void SendInventoryPackets(Player player, List items) - { - int currentIndex = 0; - - while (true) - { + private void SendInventoryPackets(Player player, List items) + { + int currentIndex = 0; + + while (true) + { if (items.Count - currentIndex >= 64) - player.QueuePacket(InventoryListX64Packet.BuildPacket(owner.actorId, items, ref currentIndex)); + player.QueuePacket(InventoryListX64Packet.BuildPacket(owner.actorId, items, ref currentIndex)); else if (items.Count - currentIndex >= 32) - player.QueuePacket(InventoryListX32Packet.BuildPacket(owner.actorId, items, ref currentIndex)); + player.QueuePacket(InventoryListX32Packet.BuildPacket(owner.actorId, items, ref currentIndex)); else if (items.Count - currentIndex >= 16) - player.QueuePacket(InventoryListX16Packet.BuildPacket(owner.actorId, items, ref currentIndex)); + player.QueuePacket(InventoryListX16Packet.BuildPacket(owner.actorId, items, ref currentIndex)); else if (items.Count - currentIndex > 1) - player.QueuePacket(InventoryListX08Packet.BuildPacket(owner.actorId, items, ref currentIndex)); - else if (items.Count - currentIndex == 1) + player.QueuePacket(InventoryListX08Packet.BuildPacket(owner.actorId, items, ref currentIndex)); + else if (items.Count - currentIndex == 1) { - player.QueuePacket(InventoryListX01Packet.BuildPacket(owner.actorId, items[currentIndex])); - currentIndex++; - } - else - break; - } - + player.QueuePacket(InventoryListX01Packet.BuildPacket(owner.actorId, items[currentIndex])); + currentIndex++; + } + else + break; + } + } - private void SendInventoryPackets(Player player, int startOffset) - { + private void SendInventoryPackets(Player player, int startOffset) + { int currentIndex = startOffset; List lst = new List(); @@ -395,38 +394,38 @@ namespace FFXIVClassic_Map_Server.actors.chara.player } else break; - } - + } + } - private void SendInventoryRemovePackets(Player player, ushort index) - { - player.QueuePacket(InventoryRemoveX01Packet.BuildPacket(owner.actorId, index)); + private void SendInventoryRemovePackets(Player player, ushort index) + { + player.QueuePacket(InventoryRemoveX01Packet.BuildPacket(owner.actorId, index)); } - - private void SendInventoryRemovePackets(Player player, List indexes) - { - int currentIndex = 0; - - while (true) - { + + private void SendInventoryRemovePackets(Player player, List indexes) + { + int currentIndex = 0; + + while (true) + { if (indexes.Count - currentIndex >= 64) - player.QueuePacket(InventoryRemoveX64Packet.BuildPacket(owner.actorId, indexes, ref currentIndex)); + player.QueuePacket(InventoryRemoveX64Packet.BuildPacket(owner.actorId, indexes, ref currentIndex)); else if (indexes.Count - currentIndex >= 32) - player.QueuePacket(InventoryRemoveX32Packet.BuildPacket(owner.actorId, indexes, ref currentIndex)); + player.QueuePacket(InventoryRemoveX32Packet.BuildPacket(owner.actorId, indexes, ref currentIndex)); else if (indexes.Count - currentIndex >= 16) - player.QueuePacket(InventoryRemoveX16Packet.BuildPacket(owner.actorId, indexes, ref currentIndex)); + player.QueuePacket(InventoryRemoveX16Packet.BuildPacket(owner.actorId, indexes, ref currentIndex)); else if (indexes.Count - currentIndex > 1) - player.QueuePacket(InventoryRemoveX08Packet.BuildPacket(owner.actorId, indexes, ref currentIndex)); - else if (indexes.Count - currentIndex == 1) + player.QueuePacket(InventoryRemoveX08Packet.BuildPacket(owner.actorId, indexes, ref currentIndex)); + else if (indexes.Count - currentIndex == 1) { - player.QueuePacket(InventoryRemoveX01Packet.BuildPacket(owner.actorId, indexes[currentIndex])); - currentIndex++; - } - else - break; - } - + player.QueuePacket(InventoryRemoveX01Packet.BuildPacket(owner.actorId, indexes[currentIndex])); + currentIndex++; + } + else + break; + } + } public void RefreshItem(Player player, InventoryItem item) @@ -448,8 +447,8 @@ namespace FFXIVClassic_Map_Server.actors.chara.player player.QueuePacket(InventorySetBeginPacket.BuildPacket(owner.actorId, inventoryCapacity, inventoryCode)); SendInventoryPackets(player, items); player.QueuePacket(InventorySetEndPacket.BuildPacket(owner.actorId)); - } - + } + #endregion #region Automatic Client and DB Updating @@ -536,41 +535,41 @@ namespace FFXIVClassic_Map_Server.actors.chara.player #region Inventory Utils - public bool IsFull() - { - return endOfListIndex >= inventoryCapacity; - } - - public bool IsSpaceForAdd(uint itemId, int quantity, int quality) - { + public bool IsFull() + { + return endOfListIndex >= inventoryCapacity; + } + + public bool IsSpaceForAdd(uint itemId, int quantity, int quality) + { int quantityCount = quantity; - for (int i = 0; i < endOfListIndex; i++) - { - InventoryItem item = list[i]; + for (int i = 0; i < endOfListIndex; i++) + { + InventoryItem item = list[i]; ItemData gItem = Server.GetItemGamedata(item.itemId); - if (item.itemId == itemId && item.quality == quality && item.quantity < gItem.maxStack) - { - quantityCount -= (gItem.maxStack - item.quantity); - if (quantityCount <= 0) - break; - } - } - - return quantityCount <= 0 || (quantityCount > 0 && !IsFull()); - } - - public bool HasItem(uint itemId) - { - return HasItem(itemId, 1); + if (item.itemId == itemId && item.quality == quality && item.quantity < gItem.maxStack) + { + quantityCount -= (gItem.maxStack - item.quantity); + if (quantityCount <= 0) + break; + } + } + + return quantityCount <= 0 || (quantityCount > 0 && !IsFull()); + } + + public bool HasItem(uint itemId) + { + return HasItem(itemId, 1); } public bool HasItem(uint itemId, int minQuantity) { return HasItem(itemId, minQuantity, 1); - } - - public bool HasItem(uint itemId, int minQuantity, int quality) - { + } + + public bool HasItem(uint itemId, int minQuantity, int quality) + { int count = 0; for (int i = endOfListIndex - 1; i >= 0; i--) @@ -584,16 +583,16 @@ namespace FFXIVClassic_Map_Server.actors.chara.player if (count >= minQuantity) return true; - } - - return false; - } - - public int GetNextEmptySlot() + } + + return false; + } + + public int GetNextEmptySlot() { - return endOfListIndex; - } - + return endOfListIndex; + } + private void DoRealign() { int lastNullSlot = -1; @@ -618,9 +617,9 @@ namespace FFXIVClassic_Map_Server.actors.chara.player if (lastNullSlot != -1) endOfListIndex = lastNullSlot; - } - - #endregion - - } -} + } + + #endregion + + } +} diff --git a/FFXIVClassic Map Server/actors/chara/player/Player.cs b/FFXIVClassic Map Server/actors/chara/player/Player.cs index bb98227e..3b1691e8 100644 --- a/FFXIVClassic Map Server/actors/chara/player/Player.cs +++ b/FFXIVClassic Map Server/actors/chara/player/Player.cs @@ -21,32 +21,18 @@ using FFXIVClassic_Map_Server.actors.group; using FFXIVClassic_Map_Server.packets.send.group; using FFXIVClassic_Map_Server.packets.WorldPackets.Send.Group; using FFXIVClassic_Map_Server.actors.chara.npc; +using FFXIVClassic_Map_Server.actors.chara.ai; +using FFXIVClassic_Map_Server.actors.chara.ai.controllers; +using FFXIVClassic_Map_Server.packets.send.actor.battle; +using FFXIVClassic_Map_Server.actors.chara.ai.utils; +using FFXIVClassic_Map_Server.actors.chara.ai.state; +using FFXIVClassic_Map_Server.actors.chara.npc; +using FFXIVClassic_Map_Server.actors.chara; namespace FFXIVClassic_Map_Server.Actors { class Player : Character { - public const int CLASSID_PUG = 2; - public const int CLASSID_GLA = 3; - public const int CLASSID_MRD = 4; - public const int CLASSID_ARC = 7; - public const int CLASSID_LNC = 8; - public const int CLASSID_THM = 22; - public const int CLASSID_CNJ = 23; - - public const int CLASSID_CRP = 29; - public const int CLASSID_BSM = 30; - public const int CLASSID_ARM = 31; - public const int CLASSID_GSM = 32; - public const int CLASSID_LTW = 33; - public const int CLASSID_WVR = 34; - public const int CLASSID_ALC = 35; - public const int CLASSID_CUL = 36; - - public const int CLASSID_MIN = 39; - public const int CLASSID_BTN = 40; - public const int CLASSID_FSH = 41; - public const int MAXSIZE_INVENTORY_NORMAL = 200; public const int MAXSIZE_INVENTORY_CURRANCY = 320; public const int MAXSIZE_INVENTORY_KEYITEMS = 500; @@ -97,7 +83,6 @@ namespace FFXIVClassic_Map_Server.Actors public uint destinationZone; public ushort destinationSpawnType; public uint[] timers = new uint[20]; - public ushort currentJob; public uint currentTitle; public uint playTime; public uint lastPlayTimeUpdate; @@ -152,7 +137,6 @@ namespace FFXIVClassic_Map_Server.Actors playerSession = cp; actorName = String.Format("_pc{0:00000000}", actorID); className = "Player"; - currentSubState = SetActorStatePacket.SUB_STATE_PLAYER; moveSpeeds[0] = SetActorSpeedPacket.DEFAULT_STOP; moveSpeeds[1] = SetActorSpeedPacket.DEFAULT_WALK; @@ -217,11 +201,7 @@ namespace FFXIVClassic_Map_Server.Actors charaWork.command[12] = 0xA0F00000 | 22012; charaWork.command[13] = 0xA0F00000 | 22013; charaWork.command[14] = 0xA0F00000 | 29497; - charaWork.command[15] = 0xA0F00000 | 22015; - - charaWork.command[32] = 0xA0F00000 | 27191; - charaWork.command[33] = 0xA0F00000 | 22302; - charaWork.command[34] = 0xA0F00000 | 28466; + charaWork.command[15] = 0xA0F00000 | 22015; charaWork.commandAcquired[27150 - 26000] = true; @@ -243,20 +223,20 @@ namespace FFXIVClassic_Map_Server.Actors charaWork.commandCategory[0] = 1; charaWork.commandCategory[1] = 1; - charaWork.commandCategory[32] = 1; - charaWork.commandCategory[33] = 1; - charaWork.commandCategory[34] = 1; charaWork.parameterSave.commandSlot_compatibility[0] = true; charaWork.parameterSave.commandSlot_compatibility[1] = true; - charaWork.parameterSave.commandSlot_compatibility[32] = true; charaWork.commandBorder = 0x20; - charaWork.parameterTemp.tp = 3000; + charaWork.parameterTemp.tp = 0; Database.LoadPlayerCharacter(this); lastPlayTimeUpdate = Utils.UnixTimeStampUTC(); + + this.aiContainer = new AIContainer(this, new PlayerController(this), null, new TargetFind(this)); + allegiance = CharacterTargetingAllegiance.Player; + CalculateBaseStats(); } public List Create0x132Packets() @@ -299,6 +279,7 @@ namespace FFXIVClassic_Map_Server.Actors ActorInstantiatePacket.BuildPacket(actorId, actorName, className, lParams).DebugPrintSubPacket(); + return ActorInstantiatePacket.BuildPacket(actorId, actorName, className, lParams); } @@ -314,7 +295,7 @@ namespace FFXIVClassic_Map_Server.Actors subpackets.Add(CreateNamePacket()); subpackets.Add(_0xFPacket.BuildPacket(actorId)); subpackets.Add(CreateStatePacket()); - subpackets.Add(CreateIdleAnimationPacket()); + subpackets.Add(CreateSubStatePacket()); subpackets.Add(CreateInitStatusPacket()); subpackets.Add(CreateSetActorIconPacket()); subpackets.Add(CreateIsZoneingPacket()); @@ -389,7 +370,7 @@ namespace FFXIVClassic_Map_Server.Actors //Status Times for (int i = 0; i < charaWork.statusShownTime.Length; i++) { - if (charaWork.statusShownTime[i] != 0xFFFFFFFF) + if (charaWork.statusShownTime[i] != 0) propPacketUtil.AddProperty(String.Format("charaWork.statusShownTime[{0}]", i)); } @@ -402,20 +383,28 @@ namespace FFXIVClassic_Map_Server.Actors propPacketUtil.AddProperty("charaWork.battleTemp.castGauge_speed[0]"); propPacketUtil.AddProperty("charaWork.battleTemp.castGauge_speed[1]"); - + //Battle Save Skillpoint - + propPacketUtil.AddProperty(String.Format("charaWork.battleSave.skillPoint[{0}]", charaWork.parameterSave.state_mainSkill[0] - 1)); + //Commands propPacketUtil.AddProperty("charaWork.commandBorder"); - + propPacketUtil.AddProperty("charaWork.battleSave.negotiationFlag[0]"); - + for (int i = 0; i < charaWork.command.Length; i++) { if (charaWork.command[i] != 0) + { propPacketUtil.AddProperty(String.Format("charaWork.command[{0}]", i)); + //Recast Timers + if(i >= charaWork.commandBorder) + { + propPacketUtil.AddProperty(String.Format("charaWork.parameterTemp.maxCommandRecastTime[{0}]", i - charaWork.commandBorder)); + propPacketUtil.AddProperty(String.Format("charaWork.parameterSave.commandSlot_recastTime[{0}]", i - charaWork.commandBorder)); + } + } } - for (int i = 0; i < charaWork.commandCategory.Length; i++) { @@ -429,7 +418,6 @@ namespace FFXIVClassic_Map_Server.Actors if (charaWork.commandAcquired[i] != false) propPacketUtil.AddProperty(String.Format("charaWork.commandAcquired[{0}]", i)); } - for (int i = 0; i < charaWork.additionalCommandAcquired.Length; i++) { @@ -444,13 +432,11 @@ namespace FFXIVClassic_Map_Server.Actors propPacketUtil.AddProperty(String.Format("charaWork.parameterSave.commandSlot_compatibility[{0}]", i)); } - /* - for (int i = 0; i < charaWork.parameterSave.commandSlot_recastTime.Length; i++) - { - if (charaWork.parameterSave.commandSlot_recastTime[i] != 0) - propPacketUtil.AddProperty(String.Format("charaWork.parameterSave.commandSlot_recastTime[{0}]", i)); - } - */ + for (int i = 0; i < charaWork.parameterSave.commandSlot_recastTime.Length; i++) + { + if (charaWork.parameterSave.commandSlot_recastTime[i] != 0) + propPacketUtil.AddProperty(String.Format("charaWork.parameterSave.commandSlot_recastTime[{0}]", i)); + } //System propPacketUtil.AddProperty("charaWork.parameterTemp.forceControl_float_forClientSelf[0]"); @@ -526,7 +512,7 @@ namespace FFXIVClassic_Map_Server.Actors QueuePacket(SetDalamudPacket.BuildPacket(actorId, 0)); QueuePacket(SetMusicPacket.BuildPacket(actorId, zone.bgmDay, 0x01)); QueuePacket(SetWeatherPacket.BuildPacket(actorId, SetWeatherPacket.WEATHER_CLEAR, 1)); - + QueuePacket(SetMapPacket.BuildPacket(actorId, zone.regionId, zone.actorId)); QueuePackets(GetSpawnPackets(this, spawnType)); @@ -551,7 +537,7 @@ namespace FFXIVClassic_Map_Server.Actors List worldMasterSpawn = world.GetActor().GetSpawnPackets(); playerSession.QueuePacket(areaMasterSpawn); - playerSession.QueuePacket(debugSpawn); + playerSession.QueuePacket(debugSpawn); playerSession.QueuePacket(worldMasterSpawn); //Inn Packets (Dream, Cutscenes, Armoire) @@ -582,6 +568,9 @@ namespace FFXIVClassic_Map_Server.Actors if (currentContentGroup != null) currentContentGroup.SendGroupPackets(playerSession); + + if (currentParty != null) + currentParty.SendGroupPackets(playerSession); } private void SendRemoveInventoryPackets(List slots) @@ -627,13 +616,15 @@ namespace FFXIVClassic_Map_Server.Actors try { BasePacket packet = new BasePacket(path); + packet.ReplaceActorID(actorId); - foreach (SubPacket p in packet.GetSubpackets()) - playerSession.QueuePacket(p); + var packets = packet.GetSubpackets(); + QueuePackets(packets); } catch (Exception e) { this.SendMessage(SendMessagePacket.MESSAGE_TYPE_SYSTEM_ERROR, "[SendPacket]", "Unable to send packet."); + this.SendMessage(SendMessagePacket.MESSAGE_TYPE_SYSTEM_ERROR, "[SendPacket]", e.Message); } } @@ -699,6 +690,7 @@ namespace FFXIVClassic_Map_Server.Actors //Save Player Database.SavePlayerPlayTime(this); Database.SavePlayerPosition(this); + Database.SavePlayerStatusEffects(this); } public void CleanupAndSave(uint destinationZone, ushort spawnType, float destinationX, float destinationY, float destinationZ, float destinationRot) @@ -722,6 +714,8 @@ namespace FFXIVClassic_Map_Server.Actors //Save Player Database.SavePlayerPlayTime(this); Database.SavePlayerPosition(this); + this.statusEffects.RemoveStatusEffectsByFlags((uint)StatusEffectFlags.LoseOnZoning, true); + Database.SavePlayerStatusEffects(this); } public Area GetZone() @@ -736,13 +730,16 @@ namespace FFXIVClassic_Map_Server.Actors public void Logout() { + // todo: really this should be in CleanupAndSave but we might want logout/disconnect handled separately for some effects QueuePacket(LogoutPacket.BuildPacket(actorId)); + statusEffects.RemoveStatusEffectsByFlags((uint)StatusEffectFlags.LoseOnLogout); CleanupAndSave(); } public void QuitGame() { QueuePacket(QuitPacket.BuildPacket(actorId)); + statusEffects.RemoveStatusEffectsByFlags((uint)StatusEffectFlags.LoseOnLogout); CleanupAndSave(); } @@ -956,11 +953,11 @@ namespace FFXIVClassic_Map_Server.Actors //Calculate hp/mp //Get Potenciel ?????? - + //Set HP/MP/TP PARAMS //Set mainskill and level - + //Set Parameters //Set current EXP @@ -972,11 +969,14 @@ namespace FFXIVClassic_Map_Server.Actors //Check if bonus point available... set //Set rested EXP - charaWork.parameterSave.state_mainSkill[0] = classId; charaWork.parameterSave.state_mainSkillLevel = charaWork.battleSave.skillLevel[classId-1]; - playerWork.restBonusExpRate = 0.0f; + for(int i = charaWork.commandBorder; i < charaWork.command.Length; i++) + { + charaWork.command[i] = 0; + charaWork.commandCategory[i] = 0; + } ActorPropertyPacketUtil propertyBuilder = new ActorPropertyPacketUtil("charaWork/stateForAll", this); @@ -984,6 +984,20 @@ namespace FFXIVClassic_Map_Server.Actors propertyBuilder.AddProperty("charaWork.parameterSave.state_mainSkillLevel"); propertyBuilder.NewTarget("playerWork/expBonus"); propertyBuilder.AddProperty("playerWork.restBonusExpRate"); + propertyBuilder.NewTarget("charaWork/battleStateForSelf"); + propertyBuilder.AddProperty(String.Format("charaWork.battleSave.skillPoint[{0}]", classId - 1)); + Database.LoadHotbar(this); + + var time = Utils.UnixTimeStampUTC(); + for(int i = charaWork.commandBorder; i < charaWork.command.Length; i++) + { + if(charaWork.command[i] != 0) + { + charaWork.parameterSave.commandSlot_recastTime[i - charaWork.commandBorder] = time + charaWork.parameterTemp.maxCommandRecastTime[i - charaWork.commandBorder]; + } + } + + UpdateHotbar(); List packets = propertyBuilder.Done(); @@ -991,6 +1005,7 @@ namespace FFXIVClassic_Map_Server.Actors BroadcastPacket(packet, true); Database.SavePlayerCurrentClass(this); + RecalculateStats(); } public void GraphicChange(int slot, InventoryItem invItem) @@ -1517,7 +1532,7 @@ namespace FFXIVClassic_Map_Server.Actors director.RemoveMember(this); } } - + public GuildleveDirector GetGuildleveDirector() { foreach (Director d in ownedDirectors) @@ -1635,7 +1650,7 @@ namespace FFXIVClassic_Map_Server.Actors //Update Instance List aroundMe = new List(); - if (zone != null) + if (zone != null) aroundMe.AddRange(zone.GetActorsAroundActor(this, 50)); if (zone2 != null) aroundMe.AddRange(zone2.GetActorsAroundActor(this, 50)); @@ -1697,7 +1712,7 @@ namespace FFXIVClassic_Map_Server.Actors //A party member list packet came, set the party public void SetParty(Party group) { - if (group is Party) + if (group is Party && currentParty != group) { RemoveFromCurrentPartyAndCleanup(); currentParty = group; @@ -1724,16 +1739,10 @@ namespace FFXIVClassic_Map_Server.Actors //currentParty.members.Remove(this); if (partyGroup.members.Count == 0) Server.GetWorldManager().NoMembersInParty((Party)currentParty); + currentParty = null; } - - - public void Update(double delta) - { - LuaEngine.GetInstance().CallLuaFunction(this, this, "OnUpdate", true, delta); - } - public void IssueChocobo(byte appearanceId, string nameResponse) { Database.IssuePlayerChocobo(this, appearanceId, nameResponse); @@ -1747,7 +1756,7 @@ namespace FFXIVClassic_Map_Server.Actors Database.ChangePlayerChocoboAppearance(this, appearanceId); chocoboAppearance = appearanceId; } - + public Retainer SpawnMyRetainer(Npc bell, int retainerIndex) { Retainer retainer = Database.LoadRetainer(this, retainerIndex); @@ -1779,6 +1788,794 @@ namespace FFXIVClassic_Map_Server.Actors retainerMeetingGroup = null; } } + + public override void Update(DateTime tick) + { + aiContainer.Update(tick); + statusEffects.Update(tick); + } + + public override void PostUpdate(DateTime tick, List packets = null) + { + // todo: is this correct? + if (this.playerSession.isUpdatesLocked) + return; + + // todo: should probably add another flag for battleTemp since all this uses reflection + packets = new List(); + + // we only want the latest update for the player + if ((updateFlags & ActorUpdateFlags.Position) != 0) + { + if (positionUpdates.Count > 1) + positionUpdates.RemoveRange(1, positionUpdates.Count - 1); + } + + if ((updateFlags & ActorUpdateFlags.HpTpMp) != 0) + { + var propPacketUtil = new ActorPropertyPacketUtil("charaWork/stateAtQuicklyForAll", this); + + // todo: should this be using job as index? + propPacketUtil.AddProperty("charaWork.parameterSave.hp[0]"); + propPacketUtil.AddProperty("charaWork.parameterSave.hpMax[0]"); + propPacketUtil.AddProperty("charaWork.parameterSave.state_mainSkill[0]"); + propPacketUtil.AddProperty("charaWork.parameterSave.state_mainSkillLevel"); + + packets.AddRange(propPacketUtil.Done()); + } + + + if ((updateFlags & ActorUpdateFlags.Stats) != 0) + { + var propPacketUtil = new ActorPropertyPacketUtil("charaWork/battleParameter", this); + + for (uint i = 0; i < 35; i++) + { + if (GetMod(i) != charaWork.battleTemp.generalParameter[i]) + { + charaWork.battleTemp.generalParameter[i] = (short)GetMod(i); + propPacketUtil.AddProperty(String.Format("charaWork.battleTemp.generalParameter[{0}]", i)); + } + } + + QueuePackets(propPacketUtil.Done()); + + } + + + base.PostUpdate(tick, packets); + } + + public override void Die(DateTime tick, CommandResultContainer actionContainer = null) + { + // todo: death timer + aiContainer.InternalDie(tick, 60); + } + + //Update commands and recast timers for the entire hotbar + public void UpdateHotbar() + { + List slotsToUpdate = new List(); + for (ushort i = charaWork.commandBorder; i < charaWork.commandBorder + 30; i++) + { + slotsToUpdate.Add(i); + } + UpdateHotbar(slotsToUpdate); + } + + //Updates the hotbar and recast timers for only certain hotbar slots + public void UpdateHotbar(List slotsToUpdate) + { + UpdateHotbarCommands(slotsToUpdate); + UpdateRecastTimers(slotsToUpdate); + } + + //Update command ids for the passed in hotbar slots + public void UpdateHotbarCommands(List slotsToUpdate) + { + ActorPropertyPacketUtil propPacketUtil = new ActorPropertyPacketUtil("charaWork/command", this); + foreach (ushort slot in slotsToUpdate) + { + propPacketUtil.AddProperty(String.Format("charaWork.command[{0}]", slot)); + propPacketUtil.AddProperty(String.Format("charaWork.commandCategory[{0}]", slot)); + } + + propPacketUtil.NewTarget("charaWork/commandDetailForSelf"); + //Enable or disable slots based on whether there is an ability in that slot + foreach (ushort slot in slotsToUpdate) + { + charaWork.parameterSave.commandSlot_compatibility[slot - charaWork.commandBorder] = charaWork.command[slot] != 0; + propPacketUtil.AddProperty(String.Format("charaWork.parameterSave.commandSlot_compatibility[{0}]", slot - charaWork.commandBorder)); + } + + QueuePackets(propPacketUtil.Done()); + //QueuePackets(compatibiltyUtil.Done()); + } + + //Update recast timers for the passed in hotbar slots + public void UpdateRecastTimers(List slotsToUpdate) + { + ActorPropertyPacketUtil recastPacketUtil = new ActorPropertyPacketUtil("charaWork/commandDetailForSelf", this); + + foreach (ushort slot in slotsToUpdate) + { + recastPacketUtil.AddProperty(String.Format("charaWork.parameterTemp.maxCommandRecastTime[{0}]", slot - charaWork.commandBorder)); + recastPacketUtil.AddProperty(String.Format("charaWork.parameterSave.commandSlot_recastTime[{0}]", slot - charaWork.commandBorder)); + } + + QueuePackets(recastPacketUtil.Done()); + } + + //Find the first open slot in classId's hotbar and equip an ability there. + public void EquipAbilityInFirstOpenSlot(byte classId, uint commandId, bool printMessage = true) + { + //Find first open slot on class's hotbar slot, then call EquipAbility with that slot. + ushort hotbarSlot = 0; + + //If the class we're equipping for is the current class, we can just look at charawork.command + if(classId == charaWork.parameterSave.state_mainSkill[0]) + hotbarSlot = FindFirstCommandSlotById(0); + //Otherwise, we need to check the database. + else + hotbarSlot = (ushort) (Database.FindFirstCommandSlot(this, classId) + charaWork.commandBorder); + + EquipAbility(classId, commandId, hotbarSlot, printMessage); + } + + //Add commandId to classId's hotbar at hotbarSlot. + //If classId is not the current class, do it in the database + //hotbarSlot starts at 32 + public void EquipAbility(byte classId, uint commandId, ushort hotbarSlot, bool printMessage = true) + { + var ability = Server.GetWorldManager().GetBattleCommand(commandId); + uint trueCommandId = 0xA0F00000 + commandId; + ushort lowHotbarSlot = (ushort)(hotbarSlot - charaWork.commandBorder); + ushort maxRecastTime = (ushort)(ability != null ? ability.maxRecastTimeSeconds : 5); + uint recastEnd = Utils.UnixTimeStampUTC() + maxRecastTime; + List slotsToUpdate = new List(); + + Database.EquipAbility(this, classId, (ushort) (hotbarSlot - charaWork.commandBorder), commandId, recastEnd); + //If the class we're equipping for is the current class (need to find out if state_mainSkill is supposed to change when you're a job) + //then equip the ability in charawork.commands and save in databse, otherwise just save in database + if (classId == GetCurrentClassOrJob()) + { + charaWork.command[hotbarSlot] = trueCommandId; + charaWork.commandCategory[hotbarSlot] = 1; + charaWork.parameterTemp.maxCommandRecastTime[lowHotbarSlot] = maxRecastTime; + charaWork.parameterSave.commandSlot_recastTime[lowHotbarSlot] = recastEnd; + + slotsToUpdate.Add(hotbarSlot); + UpdateHotbar(slotsToUpdate); + } + + + if(printMessage) + SendGameMessage(Server.GetWorldManager().GetActor(), 30603, 0x20, 0, commandId); + } + + //Doesn't take a classId because the only way to swap abilities is through the ability equip widget oe /eaction, which only apply to current class + //hotbarSlot 1 and 2 are 32-indexed. + public void SwapAbilities(ushort hotbarSlot1, ushort hotbarSlot2) + { + //0 indexed hotbar slots for saving to database and recast timers + uint lowHotbarSlot1 = (ushort)(hotbarSlot1 - charaWork.commandBorder); + uint lowHotbarSlot2 = (ushort)(hotbarSlot2 - charaWork.commandBorder); + + //Store information about first command + uint commandId = charaWork.command[hotbarSlot1]; + uint recastEnd = charaWork.parameterSave.commandSlot_recastTime[lowHotbarSlot1]; + ushort recastMax = charaWork.parameterTemp.maxCommandRecastTime[lowHotbarSlot1]; + + //Move second command's info to first hotbar slot + charaWork.command[hotbarSlot1] = charaWork.command[hotbarSlot2]; + charaWork.parameterTemp.maxCommandRecastTime[lowHotbarSlot1] = charaWork.parameterTemp.maxCommandRecastTime[lowHotbarSlot2]; + charaWork.parameterSave.commandSlot_recastTime[lowHotbarSlot1] = charaWork.parameterSave.commandSlot_recastTime[lowHotbarSlot2]; + + //Move first command's info to second slot + charaWork.command[hotbarSlot2] = commandId; + charaWork.parameterTemp.maxCommandRecastTime[lowHotbarSlot2] = recastMax; + charaWork.parameterSave.commandSlot_recastTime[lowHotbarSlot2] = recastEnd; + + //Save changes to both slots + Database.EquipAbility(this, GetCurrentClassOrJob(), (ushort)(lowHotbarSlot1), 0xA0F00000 ^ charaWork.command[hotbarSlot1], charaWork.parameterSave.commandSlot_recastTime[lowHotbarSlot1]); + Database.EquipAbility(this, GetCurrentClassOrJob(), (ushort)(lowHotbarSlot2), 0xA0F00000 ^ charaWork.command[hotbarSlot2], charaWork.parameterSave.commandSlot_recastTime[lowHotbarSlot2]); + + //Update slots on client + List slotsToUpdate = new List(); + slotsToUpdate.Add(hotbarSlot1); + slotsToUpdate.Add(hotbarSlot2); + UpdateHotbar(slotsToUpdate); + } + + public void UnequipAbility(ushort hotbarSlot, bool printMessage = true) + { + List slotsToUpdate = new List(); + ushort trueHotbarSlot = (ushort)(hotbarSlot + charaWork.commandBorder - 1); + uint commandId = charaWork.command[trueHotbarSlot]; + Database.UnequipAbility(this, (ushort)(trueHotbarSlot - charaWork.commandBorder)); + charaWork.command[trueHotbarSlot] = 0; + slotsToUpdate.Add(trueHotbarSlot); + + if(printMessage) + SendGameMessage(Server.GetWorldManager().GetActor(), 30604, 0x20, 0, 0xA0F00000 ^ commandId); + + UpdateHotbar(slotsToUpdate); + } + + //Finds the first hotbar slot with a given commandId. + //If the returned value is outside the hotbar, it indicates it wasn't found. + public ushort FindFirstCommandSlotById(uint commandId) + { + if(commandId != 0) + commandId |= 0xA0F00000; + + ushort firstSlot = (ushort)(charaWork.commandBorder + 30); + + for (ushort i = charaWork.commandBorder; i < charaWork.commandBorder + 30; i++) + { + if (charaWork.command[i] == commandId) + { + firstSlot = i; + break; + } + } + + return firstSlot; + } + + private void UpdateHotbarTimer(uint commandId, uint recastTimeMs) + { + ushort slot = FindFirstCommandSlotById(commandId); + charaWork.parameterSave.commandSlot_recastTime[slot - charaWork.commandBorder] = Utils.UnixTimeStampUTC(DateTime.Now.AddMilliseconds(recastTimeMs)); + var slots = new List(); + slots.Add(slot); + UpdateRecastTimers(slots); + } + + private uint GetHotbarTimer(uint commandId) + { + ushort slot = FindFirstCommandSlotById(commandId); + return charaWork.parameterSave.commandSlot_recastTime[slot - charaWork.commandBorder]; + } + + public override void Cast(uint spellId, uint targetId = 0) + { + if (aiContainer.CanChangeState()) + aiContainer.Cast(zone.FindActorInArea(targetId == 0 ? currentTarget : targetId), spellId); + else if (aiContainer.IsCurrentState()) + // You are already casting. + SendGameMessage(Server.GetWorldManager().GetActor(), 32536, 0x20); + else + // Please wait a moment and try again. + SendGameMessage(Server.GetWorldManager().GetActor(), 32535, 0x20); + } + + public override void Ability(uint abilityId, uint targetId = 0) + { + if (aiContainer.CanChangeState()) + aiContainer.Ability(zone.FindActorInArea(targetId == 0 ? currentTarget : targetId), abilityId); + else + // Please wait a moment and try again. + SendGameMessage(Server.GetWorldManager().GetActor(), 32535, 0x20); + } + + public override void WeaponSkill(uint skillId, uint targetId = 0) + { + if (aiContainer.CanChangeState()) + aiContainer.WeaponSkill(zone.FindActorInArea(targetId == 0 ? currentTarget : targetId), skillId); + else + // Please wait a moment and try again. + SendGameMessage(Server.GetWorldManager().GetActor(), 32535, 0x20); + } + + public override bool IsValidTarget(Character target, ValidTarget validTarget) + { + if (target == null) + { + // Target does not exist. + SendGameMessage(Server.GetWorldManager().GetActor(), 32511, 0x20); + return false; + } + + if (target.isMovingToSpawn) + { + // That command cannot be performed on the current target. + SendGameMessage(Server.GetWorldManager().GetActor(), 32547, 0x20); + return false; + } + + // enemy only + if ((validTarget & ValidTarget.Enemy) != 0) + { + // todo: this seems ambiguous + if (target.isStatic) + { + // That command cannot be performed on the current target. + SendGameMessage(Server.GetWorldManager().GetActor(), 32547, 0x20); + return false; + } + if (currentParty != null && target.currentParty == currentParty) + { + // That command cannot be performed on a party member. + SendGameMessage(Server.GetWorldManager().GetActor(), 32548, 0x20); + return false; + } + // todo: pvp? + if (target.allegiance == allegiance) + { + // That command cannot be performed on an ally. + SendGameMessage(Server.GetWorldManager().GetActor(), 32549, 0x20); + return false; + } + + bool partyEngaged = false; + // todo: replace with confrontation status effect? (see how dsp does it) + if (target.aiContainer.IsEngaged()) + { + if (currentParty != null) + { + if (target is BattleNpc) + { + var helpingActorId = ((BattleNpc)target).GetMobMod((uint)MobModifier.CallForHelp); + partyEngaged = this.actorId == helpingActorId || (((BattleNpc)target).GetMobMod((uint)MobModifier.FreeForAll) != 0); + } + + if (!partyEngaged) + { + foreach (var memberId in ((Party)currentParty).members) + { + if (memberId == target.currentLockedTarget) + { + partyEngaged = true; + break; + } + } + } + } + else if (target.currentLockedTarget == actorId) + { + partyEngaged = true; + } + } + else + { + partyEngaged = true; + } + + if (!partyEngaged) + { + // That target is already engaged. + SendGameMessage(Server.GetWorldManager().GetActor(), 32520, 0x20); + return false; + } + } + + if ((validTarget & ValidTarget.Ally) != 0 && target.allegiance != allegiance) + { + // That command cannot be performed on the current target. + SendGameMessage(Server.GetWorldManager().GetActor(), 32547, 0x20); + return false; + } + + // todo: isStatic seems ambiguous? + if ((validTarget & ValidTarget.NPC) != 0 && target.isStatic) + return true; + + // todo: why is player always zoning? + // cant target if zoning + if (target is Player && ((Player)target).playerSession.isUpdatesLocked) + { + // That command cannot be performed on the current target. + SendGameMessage(Server.GetWorldManager().GetActor(), 32547, 0x20); + return false; + } + + return true; + } + + public override bool CanCast(Character target, BattleCommand spell) + { + //Might want to do these with a CommandResult instead to be consistent with the rest of command stuff + if (GetHotbarTimer(spell.id) > Utils.UnixTimeStampUTC()) + { + // todo: this needs confirming + // Please wait a moment and try again. + SendGameMessage(Server.GetWorldManager().GetActor(), 32535, 0x20, (uint)spell.id); + return false; + } + if (target == null) + { + // Target does not exist. + SendGameMessage(Server.GetWorldManager().GetActor(), 32511, 0x20, (uint)spell.id); + return false; + } + if (Utils.XZDistance(positionX, positionZ, target.positionX, target.positionZ) > spell.range) + { + // The target is too far away. + SendGameMessage(Server.GetWorldManager().GetActor(), 32539, 0x20, (uint)spell.id); + return false; + } + if (Utils.XZDistance(positionX, positionZ, target.positionX, target.positionZ) < spell.minRange) + { + // The target is too close. + SendGameMessage(Server.GetWorldManager().GetActor(), 32538, 0x20, (uint)spell.id); + return false; + } + if (target.positionY - positionY > (spell.rangeHeight / 2)) + { + // The target is too far above you. + SendGameMessage(Server.GetWorldManager().GetActor(), 32540, 0x20, (uint)spell.id); + return false; + } + if (positionY - target.positionY > (spell.rangeHeight / 2)) + { + // The target is too far below you. + SendGameMessage(Server.GetWorldManager().GetActor(), 32541, 0x20, (uint)spell.id); + return false; + } + if (!IsValidTarget(target, spell.mainTarget) || !spell.IsValidMainTarget(this, target)) + { + // error packet is set in IsValidTarget + return false; + } + return true; + } + + public override bool CanWeaponSkill(Character target, BattleCommand skill) + { + // todo: see worldmaster ids 32558~32557 for proper ko message and stuff + if (GetHotbarTimer(skill.id) > Utils.UnixTimeStampUTC()) + { + // todo: this needs confirming + // Please wait a moment and try again. + SendGameMessage(Server.GetWorldManager().GetActor(), 32535, 0x20, (uint)skill.id); + return false; + } + + if (target == null) + { + // Target does not exist. + SendGameMessage(Server.GetWorldManager().GetActor(), 32511, 0x20, (uint)skill.id); + return false; + } + + //Original game checked height difference before horizontal distance + if (target.positionY - positionY > (skill.rangeHeight / 2)) + { + // The target is too far above you. + SendGameMessage(Server.GetWorldManager().GetActor(), 32540, 0x20, (uint)skill.id); + return false; + } + + if (positionY - target.positionY > (skill.rangeHeight / 2)) + { + // The target is too far below you. + SendGameMessage(Server.GetWorldManager().GetActor(), 32541, 0x20, (uint)skill.id); + return false; + } + + var targetDist = Utils.XZDistance(positionX, positionZ, target.positionX, target.positionZ); + + if (targetDist > skill.range) + { + // The target is out of range. + SendGameMessage(Server.GetWorldManager().GetActor(), 32537, 0x20, (uint)skill.id); + return false; + } + + if (targetDist < skill.minRange) + { + // The target is too close. + SendGameMessage(Server.GetWorldManager().GetActor(), 32538, 0x20, (uint)skill.id); + return false; + } + + + if (!IsValidTarget(target, skill.validTarget) || !skill.IsValidMainTarget(this, target)) + { + // error packet is set in IsValidTarget + return false; + } + + return true; + } + + public override void OnAttack(State state, CommandResult action, ref CommandResult error) + { + var target = state.GetTarget(); + + base.OnAttack(state, action, ref error); + + // todo: switch based on main weap (also probably move this anim assignment somewhere else) + action.animation = 0x19001000; + if (error == null) + { + // melee attack animation + //action.animation = 0x19001000; + } + if (target is BattleNpc) + { + ((BattleNpc)target).hateContainer.UpdateHate(this, action.enmity); + } + + LuaEngine.GetInstance().OnSignal("playerAttack"); + } + + public override void OnCast(State state, CommandResult[] actions, BattleCommand spell, ref CommandResult[] errors) + { + // todo: update hotbar timers to skill's recast time (also needs to be done on class change or equip crap) + base.OnCast(state, actions, spell, ref errors); + // todo: should just make a thing that updates the one slot cause this is dumb as hell + UpdateHotbarTimer(spell.id, spell.recastTimeMs); + //LuaEngine.GetInstance().OnSignal("spellUse"); + } + + public override void OnWeaponSkill(State state, CommandResult[] actions, BattleCommand skill, ref CommandResult[] errors) + { + // todo: update hotbar timers to skill's recast time (also needs to be done on class change or equip crap) + base.OnWeaponSkill(state, actions, skill, ref errors); + + // todo: should just make a thing that updates the one slot cause this is dumb as hell + UpdateHotbarTimer(skill.id, skill.recastTimeMs); + // todo: this really shouldnt be called on each ws? + lua.LuaEngine.CallLuaBattleFunction(this, "onWeaponSkill", this, state.GetTarget(), skill); + LuaEngine.GetInstance().OnSignal("weaponskillUse"); + } + + public override void OnAbility(State state, CommandResult[] actions, BattleCommand ability, ref CommandResult[] errors) + { + base.OnAbility(state, actions, ability, ref errors); + UpdateHotbarTimer(ability.id, ability.recastTimeMs); + LuaEngine.GetInstance().OnSignal("abilityUse"); + } + + //Handles exp being added, does not handle figuring out exp bonus from buffs or skill/link chains or any of that + //Returns CommandResults that can be sent to display the EXP gained number and level ups + //exp should be a ushort single the exp graphic overflows after ~65k + public List AddExp(int exp, byte classId, byte bonusPercent = 0) + { + List actionList = new List(); + exp += (int) Math.Ceiling((exp * bonusPercent / 100.0f)); + + //You earn [exp] (+[bonusPercent]%) experience points. + //In non-english languages there are unique messages for each language, hence the use of ClassExperienceTextIds + actionList.Add(new CommandResult(actorId, BattleUtils.ClassExperienceTextIds[classId], 0, (ushort)exp, bonusPercent)); + + bool leveled = false; + int diff = MAXEXP[GetLevel() - 1] - charaWork.battleSave.skillPoint[classId - 1]; + //While there is enough experience to level up, keep leveling up, unlocking skills and removing experience from exp until we don't have enough to level up + while (exp >= diff && GetLevel() < charaWork.battleSave.skillLevelCap[classId]) + { + //Level up + LevelUp(classId); + leveled = true; + //Reduce exp based on how much exp is needed to level + exp -= diff; + diff = MAXEXP[GetLevel() - 1]; + } + + if(leveled) + { + //Set exp to current class to 0 so that exp is added correctly + charaWork.battleSave.skillPoint[classId - 1] = 0; + //send new level + ActorPropertyPacketUtil expPropertyPacket2 = new ActorPropertyPacketUtil("charaWork/exp", this); + ActorPropertyPacketUtil expPropertyPacket3 = new ActorPropertyPacketUtil("charaWork/stateForAll", this); + expPropertyPacket2.AddProperty(String.Format("charaWork.battleSave.skillLevel[{0}]", classId - 1)); + expPropertyPacket2.AddProperty("charaWork.parameterSave.state_mainSkillLevel"); + QueuePackets(expPropertyPacket2.Done()); + QueuePackets(expPropertyPacket3.Done()); + //play levelup animation (do this outside LevelUp so that it only plays once if multiple levels are earned + //also i dunno how to do this + + Database.SetLevel(this, classId, GetLevel()); + Database.SavePlayerCurrentClass(this); + } + //Cap experience for level 50 + charaWork.battleSave.skillPoint[classId - 1] = Math.Min(charaWork.battleSave.skillPoint[classId - 1] + exp, MAXEXP[GetLevel() - 1]); + + ActorPropertyPacketUtil expPropertyPacket = new ActorPropertyPacketUtil("charaWork/battleStateForSelf", this); + expPropertyPacket.AddProperty(String.Format("charaWork.battleSave.skillPoint[{0}]", classId - 1)); + + QueuePackets(expPropertyPacket.Done()); + Database.SetExp(this, classId, charaWork.battleSave.skillPoint[classId - 1]); + + return actionList; + } + + //Increaess level of current class and equips new abilities earned at that level + public void LevelUp(byte classId, List actionList = null) + { + if (charaWork.battleSave.skillLevel[classId - 1] < charaWork.battleSave.skillLevelCap[classId]) + { + //Increase level + charaWork.battleSave.skillLevel[classId - 1]++; + charaWork.parameterSave.state_mainSkillLevel++; + + //33909: You gain level [level] + if (actionList != null) + actionList.Add(new CommandResult(actorId, 33909, 0, (ushort) charaWork.battleSave.skillLevel[classId - 1])); + + //If there's any abilites that unlocks at this level, equip them. + List commandIds = Server.GetWorldManager().GetBattleCommandIdByLevel(classId, GetLevel()); + foreach(uint commandId in commandIds) + { + EquipAbilityInFirstOpenSlot(classId, commandId, false); + byte jobId = ConvertClassIdToJobId(classId); + if (jobId != classId) + EquipAbilityInFirstOpenSlot(jobId, commandId, false); + + //33926: You learn [command]. + if (actionList != null) + { + if(classId == GetCurrentClassOrJob() || jobId == GetCurrentClassOrJob()) + actionList.Add(new CommandResult(actorId, 33926, commandId)); + } + } + } + } + + public static byte ConvertClassIdToJobId(byte classId) + { + byte jobId = classId; + + switch(classId) + { + case CLASSID_PUG: + case CLASSID_GLA: + case CLASSID_MRD: + jobId += 13; + break; + case CLASSID_ARC: + case CLASSID_LNC: + jobId += 11; + break; + case CLASSID_THM: + case CLASSID_CNJ: + jobId += 4; + break; + } + + return jobId; + } + + public void SetCurrentJob(byte jobId) + { + currentJob = jobId; + BroadcastPacket(SetCurrentJobPacket.BuildPacket(actorId, jobId), true); + Database.LoadHotbar(this); + SendCharaExpInfo(); + } + + //Gets the id of the player's current job. If they aren't a job, gets the id of their class + public byte GetCurrentClassOrJob() + { + if (currentJob != 0) + return (byte) currentJob; + return charaWork.parameterSave.state_mainSkill[0]; + } + + public void hpstuff(uint hp) + { + SetMaxHP(hp); + SetHP(hp); + mpMaxBase = (ushort)hp; + charaWork.parameterSave.mpMax = (short)hp; + charaWork.parameterSave.mp = (short)hp; + AddTP(3000); + updateFlags |= ActorUpdateFlags.HpTpMp; + } + + public void SetCombos(int comboId1 = 0, int comboId2 = 0) + { + SetCombos(new int[] { comboId1, comboId2 }); + } + + public void SetCombos(int[] comboIds) + { + Array.Copy(comboIds, playerWork.comboNextCommandId, 2); + + //If we're starting or continuing a combo chain, add the status effect and combo cost bonus + if (comboIds[0] != 0) + { + StatusEffect comboEffect = new StatusEffect(this, Server.GetWorldManager().GetStatusEffect((uint) StatusEffectId.Combo)); + comboEffect.SetDuration(13); + comboEffect.SetOverwritable(1); + statusEffects.AddStatusEffect(comboEffect, this, true); + playerWork.comboCostBonusRate = 1; + } + //Otherwise we're ending a combo, remove the status + else + { + statusEffects.RemoveStatusEffect(statusEffects.GetStatusEffectById((uint) StatusEffectId.Combo)); + playerWork.comboCostBonusRate = 0; + } + + ActorPropertyPacketUtil comboPropertyPacket = new ActorPropertyPacketUtil("playerWork/combo", this); + comboPropertyPacket.AddProperty("playerWork.comboCostBonusRate"); + comboPropertyPacket.AddProperty("playerWork.comboNextCommandId[0]"); + comboPropertyPacket.AddProperty("playerWork.comboNextCommandId[1]"); + QueuePackets(comboPropertyPacket.Done()); + } + + public override void CalculateBaseStats() + { + base.CalculateBaseStats(); + //Add weapon property mod + var equip = GetEquipment(); + var mainHandItem = equip.GetItemAtSlot(Equipment.SLOT_MAINHAND); + var damageAttribute = 0; + var attackDelay = 3000; + var hitCount = 1; + + if (mainHandItem != null) + { + var mainHandWeapon = (Server.GetItemGamedata(mainHandItem.itemId) as WeaponItem); + damageAttribute = mainHandWeapon.damageAttributeType1; + attackDelay = (int) (mainHandWeapon.damageInterval * 1000); + hitCount = mainHandWeapon.frequency; + } + + var hasShield = equip.GetItemAtSlot(Equipment.SLOT_OFFHAND) != null ? 1 : 0; + SetMod((uint)Modifier.HasShield, hasShield); + + SetMod((uint)Modifier.AttackType, damageAttribute); + SetMod((uint)Modifier.AttackDelay, attackDelay); + SetMod((uint)Modifier.HitCount, hitCount); + + //These stats all correlate in a 3:2 fashion + //It seems these stats don't actually increase their respective stats. The magic stats do, however + AddMod((uint)Modifier.Attack, (long)(GetMod(Modifier.Strength) * 0.667)); + AddMod((uint)Modifier.Accuracy, (long)(GetMod(Modifier.Dexterity) * 0.667)); + AddMod((uint)Modifier.Defense, (long)(GetMod(Modifier.Vitality) * 0.667)); + + //These stats correlate in a 4:1 fashion. (Unsure if MND is accurate but it would make sense for it to be) + AddMod((uint)Modifier.MagicAttack, (long)((float)GetMod(Modifier.Intelligence) * 0.25)); + + AddMod((uint)Modifier.MagicAccuracy, (long)((float)GetMod(Modifier.Mind) * 0.25)); + AddMod((uint)Modifier.MagicHeal, (long)((float)GetMod(Modifier.Mind) * 0.25)); + + AddMod((uint)Modifier.MagicEvasion, (long)((float)GetMod(Modifier.Piety) * 0.25)); + AddMod((uint)Modifier.MagicEnfeeblingPotency, (long)((float)GetMod(Modifier.Piety) * 0.25)); + + //VIT correlates to HP in a 1:1 fashion + AddMod((uint)Modifier.Hp, (long)((float)Modifier.Vitality)); + + CalculateTraitMods(); + } + + public bool HasTrait(ushort id) + { + BattleTrait trait = Server.GetWorldManager().GetBattleTrait(id); + + return HasTrait(trait); + } + + public bool HasTrait(BattleTrait trait) + { + return (trait != null) && (trait.job == GetClass()) && (trait.level <= GetLevel()); + } + + public void CalculateTraitMods() + { + var traitIds = Server.GetWorldManager().GetAllBattleTraitIdsForClass((byte) GetClass()); + + foreach(var traitId in traitIds) + { + var trait = Server.GetWorldManager().GetBattleTrait(traitId); + if(HasTrait(trait)) + { + AddMod(trait.modifier, trait.bonus); + } + } + } + + public bool HasItemEquippedInSlot(uint itemId, ushort slot) + { + var equippedItem = equipment.GetItemAtSlot(slot); + + return equippedItem != null && equippedItem.itemId == itemId; + } } } diff --git a/FFXIVClassic Map Server/actors/director/Director.cs b/FFXIVClassic Map Server/actors/director/Director.cs index 321645ab..e2a566a6 100644 --- a/FFXIVClassic Map Server/actors/director/Director.cs +++ b/FFXIVClassic Map Server/actors/director/Director.cs @@ -103,7 +103,7 @@ namespace FFXIVClassic_Map_Server.actors.director List lparams = CallLuaScript("init", args2); - if (lparams.Count >= 1 && lparams[0].value is string) + if (lparams != null && lparams.Count >= 1 && lparams[0].value is string) { classPath = (string)lparams[0].value; className = classPath.Substring(classPath.LastIndexOf("/") + 1); @@ -127,8 +127,8 @@ namespace FFXIVClassic_Map_Server.actors.director { ((GuildleveDirector)this).LoadGuildleve(); } - - StartCoroutine("main", this); + + CallLuaScript("main", this, contentGroup); } public void StartContentGroup() @@ -161,6 +161,9 @@ namespace FFXIVClassic_Map_Server.actors.director { members.Add(actor); + if (actor is Player) + ((Player)actor).AddDirector(this); + if (contentGroup != null) contentGroup.AddMember(actor); } @@ -270,6 +273,7 @@ namespace FFXIVClassic_Map_Server.actors.director { if (directorScript != null) { + directorScript = LuaEngine.LoadScript(String.Format(LuaEngine.FILEPATH_DIRECTORS, directorScriptPath)); if (!directorScript.Globals.Get(funcName).IsNil()) { DynValue result = directorScript.Call(directorScript.Globals[funcName], args); @@ -314,8 +318,5 @@ namespace FFXIVClassic_Map_Server.actors.director DynValue value = coroutine.Resume(args2); LuaEngine.GetInstance().ResolveResume(player, coroutine, value); } - - - } } \ No newline at end of file diff --git a/FFXIVClassic Map Server/actors/group/ContentGroup.cs b/FFXIVClassic Map Server/actors/group/ContentGroup.cs index fcb3e32b..ca15fcbd 100644 --- a/FFXIVClassic Map Server/actors/group/ContentGroup.cs +++ b/FFXIVClassic Map Server/actors/group/ContentGroup.cs @@ -42,6 +42,7 @@ namespace FFXIVClassic_Map_Server.actors.group public void Start() { isStarted = true; + SendGroupPacketsAll(members); } @@ -49,8 +50,9 @@ namespace FFXIVClassic_Map_Server.actors.group { if (actor == null) return; - - members.Add(actor.actorId); + + if(!members.Contains(actor.actorId)) + members.Add(actor.actorId); if (actor is Character) ((Character)actor).SetCurrentContentGroup(this); @@ -121,7 +123,6 @@ namespace FFXIVClassic_Map_Server.actors.group } session.QueuePacket(GroupMembersEndPacket.buildPacket(session.id, session.GetActor().zoneId, time, this)); - } public override uint GetTypeId() @@ -169,5 +170,9 @@ namespace FFXIVClassic_Map_Server.actors.group DeleteGroup(); } + public List GetMembers() + { + return members; + } } } diff --git a/FFXIVClassic Map Server/actors/group/MonsterParty.cs b/FFXIVClassic Map Server/actors/group/MonsterParty.cs index 53f2a263..7c0b344f 100644 --- a/FFXIVClassic Map Server/actors/group/MonsterParty.cs +++ b/FFXIVClassic Map Server/actors/group/MonsterParty.cs @@ -17,8 +17,9 @@ namespace FFXIVClassic_Map_Server.actors.group public MonsterParty(ulong groupIndex, uint[] initialMonsterMembers) : base(groupIndex) { - for (int i = 0; i < initialMonsterMembers.Length; i++) - monsterMembers.Add(initialMonsterMembers[i]); + if(initialMonsterMembers != null) + for (int i = 0; i < initialMonsterMembers.Length; i++) + monsterMembers.Add(initialMonsterMembers[i]); } public void AddMember(uint memberId) @@ -47,7 +48,7 @@ namespace FFXIVClassic_Map_Server.actors.group public override void SendInitWorkValues(Session session) { - SynchGroupWorkValuesPacket groupWork = new SynchGroupWorkValuesPacket(groupIndex); + SynchGroupWorkValuesPacket groupWork = new SynchGroupWorkValuesPacket(groupIndex); groupWork.setTarget("/_init"); SubPacket test = groupWork.buildPacket(session.id); diff --git a/FFXIVClassic Map Server/actors/group/Party.cs b/FFXIVClassic Map Server/actors/group/Party.cs index 436cc9d9..58e438dd 100644 --- a/FFXIVClassic Map Server/actors/group/Party.cs +++ b/FFXIVClassic Map Server/actors/group/Party.cs @@ -63,12 +63,26 @@ namespace FFXIVClassic_Map_Server.actors.group List groupMembers = new List(); groupMembers.Add(new GroupMember(id, -1, 0, false, true, Server.GetWorldManager().GetActorInWorld(id).customDisplayName)); foreach (uint charaId in members) - { - if (charaId != id) - groupMembers.Add(new GroupMember(charaId, -1, 0, false, true, Server.GetWorldManager().GetActorInWorld(charaId).customDisplayName)); + { + var chara = Server.GetWorldManager().GetActorInWorld(charaId); + if (charaId != id && chara != null) + groupMembers.Add(new GroupMember(charaId, -1, 0, false, true, chara.customDisplayName)); } return groupMembers; } + public void AddMember(uint memberId) + { + members.Add(memberId); + SendGroupPacketsAll(members); + } + + public void RemoveMember(uint memberId) + { + members.Remove(memberId); + SendGroupPacketsAll(members); + if (members.Count == 0) + Server.GetWorldManager().NoMembersInParty(this); + } } } diff --git a/FFXIVClassic Map Server/actors/quest/Quest.cs b/FFXIVClassic Map Server/actors/quest/Quest.cs index 17a2e292..109f8570 100644 --- a/FFXIVClassic Map Server/actors/quest/Quest.cs +++ b/FFXIVClassic Map Server/actors/quest/Quest.cs @@ -93,7 +93,7 @@ namespace FFXIVClassic_Map_Server.Actors return false; } else - return (questFlags & (1 << bitIndex)) == (1 << bitIndex); + return (questFlags & (1 << bitIndex)) == (1 << bitIndex); } public uint GetPhase() diff --git a/FFXIVClassic Map Server/dataobjects/ItemData.cs b/FFXIVClassic Map Server/dataobjects/ItemData.cs index 14296e81..fcdcc9bb 100644 --- a/FFXIVClassic Map Server/dataobjects/ItemData.cs +++ b/FFXIVClassic Map Server/dataobjects/ItemData.cs @@ -481,7 +481,7 @@ namespace FFXIVClassic_Map_Server.dataobjects public readonly short craftMagicProcessing; public readonly short harvestPotency; public readonly short harvestLimit; - public readonly byte frequency; + public readonly byte frequency; // hit count, 2 for h2h weapons public readonly short rate; public readonly short magicRate; public readonly short craftProcessControl; @@ -490,7 +490,7 @@ namespace FFXIVClassic_Map_Server.dataobjects public readonly short magicCritical; public readonly short parry; - public readonly int damageAttributeType1; + public readonly int damageAttributeType1; // 1 slashing, 2 piercing, 3 blunt, 4 projectile public readonly float damageAttributeValue1; public readonly int damageAttributeType2; public readonly float damageAttributeValue2; @@ -500,6 +500,7 @@ namespace FFXIVClassic_Map_Server.dataobjects public readonly short damagePower; public readonly float damageInterval; public readonly short ammoVirtualDamagePower; + public readonly float dps; public WeaponItem(MySqlDataReader reader) : base(reader) @@ -536,6 +537,7 @@ namespace FFXIVClassic_Map_Server.dataobjects damagePower = reader.GetInt16("damagePower"); damageInterval = reader.GetFloat("damageInterval"); ammoVirtualDamagePower = reader.GetInt16("ammoVirtualDamagePower"); + dps = (damagePower + ammoVirtualDamagePower) / damageInterval; } } diff --git a/FFXIVClassic Map Server/dataobjects/Session.cs b/FFXIVClassic Map Server/dataobjects/Session.cs index e7d11f02..73e9e06b 100644 --- a/FFXIVClassic Map Server/dataobjects/Session.cs +++ b/FFXIVClassic Map Server/dataobjects/Session.cs @@ -1,14 +1,8 @@ -using FFXIVClassic_Map_Server; -using FFXIVClassic.Common; +using FFXIVClassic.Common; 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; using FFXIVClassic_Map_Server.actors.chara.npc; namespace FFXIVClassic_Map_Server.dataobjects @@ -70,21 +64,26 @@ namespace FFXIVClassic_Map_Server.dataobjects if (isUpdatesLocked) return; + if (playerActor.positionX == x && playerActor.positionY == y && playerActor.positionZ == z && playerActor.rotation == rot) + return; + + /* playerActor.oldPositionX = playerActor.positionX; playerActor.oldPositionY = playerActor.positionY; playerActor.oldPositionZ = playerActor.positionZ; playerActor.oldRotation = playerActor.rotation; - + playerActor.positionX = x; playerActor.positionY = y; playerActor.positionZ = z; + */ playerActor.rotation = rot; playerActor.moveState = moveState; - GetActor().GetZone().UpdateActorPosition(GetActor()); - + //GetActor().GetZone().UpdateActorPosition(GetActor()); + playerActor.QueuePositionUpdate(new Vector3(x,y,z)); } - long lastMilis = 0; + public void UpdateInstance(List list) { if (isUpdatesLocked) @@ -107,7 +106,7 @@ namespace FFXIVClassic_Map_Server.dataobjects { QueuePacket(RemoveActorPacket.BuildPacket(actorInstanceList[i].actorId)); actorInstanceList.RemoveAt(i); - } + } } //Retainer Instance @@ -132,15 +131,11 @@ namespace FFXIVClassic_Map_Server.dataobjects if (actorInstanceList.Contains(actor)) { - //Don't send for static characters (npcs) - if (actor is Character && ((Character)actor).isStatic) - continue; - QueuePacket(actor.CreatePositionUpdatePacket()); } else { - QueuePacket(actor.GetSpawnPackets(playerActor, 1)); + QueuePacket(actor.GetSpawnPackets(playerActor, 1)); QueuePacket(actor.GetInitPackets()); QueuePacket(actor.GetSetEventStatusPackets()); diff --git a/FFXIVClassic Map Server/dataobjects/ZoneConnection.cs b/FFXIVClassic Map Server/dataobjects/ZoneConnection.cs index 4a7fcc98..f4a377e9 100644 --- a/FFXIVClassic Map Server/dataobjects/ZoneConnection.cs +++ b/FFXIVClassic Map Server/dataobjects/ZoneConnection.cs @@ -19,12 +19,15 @@ namespace FFXIVClassic_Map_Server.dataobjects public void QueuePacket(SubPacket subpacket) { + if(SendPacketQueue.Count == 1000) + FlushQueuedSendPackets(); + SendPacketQueue.Add(subpacket); } public void FlushQueuedSendPackets() { - if (!socket.Connected) + if (socket == null || !socket.Connected) return; while (SendPacketQueue.Count > 0) diff --git a/FFXIVClassic Map Server/lua/LuaEngine.cs b/FFXIVClassic Map Server/lua/LuaEngine.cs index 6108d7e8..9382f4cb 100644 --- a/FFXIVClassic Map Server/lua/LuaEngine.cs +++ b/FFXIVClassic Map Server/lua/LuaEngine.cs @@ -16,6 +16,8 @@ using FFXIVClassic_Map_Server.lua; using FFXIVClassic.Common; using FFXIVClassic_Map_Server.actors.area; using System.Threading; +using FFXIVClassic_Map_Server.actors.chara.ai; +using FFXIVClassic_Map_Server.actors.chara.ai.controllers; namespace FFXIVClassic_Map_Server.lua { @@ -102,7 +104,7 @@ namespace FFXIVClassic_Map_Server.lua } foreach (Coroutine key in mToAwake) - { + { DynValue value = key.Resume(); ResolveResume(null, key, value); } @@ -129,7 +131,210 @@ namespace FFXIVClassic_Map_Server.lua player.EndEvent(); } - private static string GetScriptPath(Actor target) + /// + /// // todo: this is dumb, should probably make a function for each action with different default return values + /// or just make generic function and pass default value as first arg after functionName + /// + public static void CallLuaBattleFunction(Character actor, string functionName, params object[] args) + { + // todo: should use "scripts/zones/ZONE_NAME/battlenpcs/NAME.lua" instead of scripts/unique + string path = ""; + + // todo: should we call this for players too? + if (actor is Player) + { + // todo: check this is correct + path = FILEPATH_PLAYER; + } + else if (actor is Npc) + { + // todo: this is probably unnecessary as im not sure there were pets for players + if (!(actor.aiContainer.GetController()?.GetPetMaster() is Player)) + path = String.Format("./scripts/unique/{0}/{1}/{2}.lua", actor.zone.zoneName, actor is BattleNpc ? "Monster" : "PopulaceStandard", ((Npc)actor).GetUniqueId()); + } + // dont wanna throw an error if file doesnt exist + if (File.Exists(path)) + { + var script = LoadGlobals(); + try + { + script.DoFile(path); + } + catch (Exception e) + { + Program.Log.Error($"LuaEngine.CallLuaBattleFunction [{functionName}] {e.Message}"); + } + DynValue res = new DynValue(); + + if (!script.Globals.Get(functionName).IsNil()) + { + res = script.Call(script.Globals.Get(functionName), args); + } + } + } + + public static int CallLuaStatusEffectFunction(Character actor, StatusEffect effect, string functionName, params object[] args) + { + // todo: this is stupid, load the actual effect name from db table + string path = $"./scripts/effects/{effect.GetName()}.lua"; + + if (File.Exists(path)) + { + var script = LoadGlobals(); + + try + { + script.DoFile(path); + } + catch (Exception e) + { + Program.Log.Error($"LuaEngine.CallLuaStatusEffectFunction [{functionName}] {e.Message}"); + } + DynValue res = new DynValue(); + + if (!script.Globals.Get(functionName).IsNil()) + { + res = script.Call(script.Globals.Get(functionName), args); + if (res != null) + return (int)res.Number; + } + } + else + { + Program.Log.Error($"LuaEngine.CallLuaStatusEffectFunction [{effect.GetName()}] Unable to find script {path}"); + } + return -1; + } + + public static int CallLuaBattleCommandFunction(Character actor, BattleCommand command, string folder, string functionName, params object[] args) + { + string path = $"./scripts/commands/{folder}/{command.name}.lua"; + + if (File.Exists(path)) + { + var script = LoadGlobals(); + + try + { + script.DoFile(path); + } + catch (Exception e) + { + Program.Log.Error($"LuaEngine.CallLuaBattleCommandFunction [{functionName}] {e.Message}"); + } + DynValue res = new DynValue(); + + if (!script.Globals.Get(functionName).IsNil()) + { + res = script.Call(script.Globals.Get(functionName), args); + if (res != null) + return (int)res.Number; + } + } + else + { + path = $"./scripts/commands/{folder}/default.lua"; + //Program.Log.Error($"LuaEngine.CallLuaBattleCommandFunction [{command.name}] Unable to find script {path}"); + var script = LoadGlobals(); + + try + { + script.DoFile(path); + } + catch (Exception e) + { + Program.Log.Error($"LuaEngine.CallLuaBattleCommandFunction [{functionName}] {e.Message}"); + } + DynValue res = new DynValue(); + // DynValue r = script.Globals.Get(functionName); + + if (!script.Globals.Get(functionName).IsNil()) + { + res = script.Call(script.Globals.Get(functionName), args); + if (res != null) + return (int)res.Number; + } + } + return -1; + } + + + public static void LoadBattleCommandScript(BattleCommand command, string folder) + { + string path = $"./scripts/commands/{folder}/{command.name}.lua"; + + if (File.Exists(path)) + { + var script = LoadGlobals(); + + try + { + script.DoFile(path); + } + catch (Exception e) + { + Program.Log.Error($"LuaEngine.CallLuaBattleCommandFunction {e.Message}"); + } + command.script = script; + } + else + { + path = $"./scripts/commands/{folder}/default.lua"; + //Program.Log.Error($"LuaEngine.CallLuaBattleCommandFunction [{command.name}] Unable to find script {path}"); + var script = LoadGlobals(); + + try + { + script.DoFile(path); + } + catch (Exception e) + { + Program.Log.Error($"LuaEngine.CallLuaBattleCommandFunction {e.Message}"); + } + + command.script = script; + } + } + + public static void LoadStatusEffectScript(StatusEffect effect) + { + string path = $"./scripts/effects/{effect.GetName()}.lua"; + + if (File.Exists(path)) + { + var script = LoadGlobals(); + + try + { + script.DoFile(path); + } + catch (Exception e) + { + Program.Log.Error($"LuaEngine.CallLuaBattleCommandFunction {e.Message}"); + } + effect.script = script; + } + else + { + path = $"./scripts/effects/default.lua"; + //Program.Log.Error($"LuaEngine.CallLuaBattleCommandFunction [{command.name}] Unable to find script {path}"); + var script = LoadGlobals(); + + try + { + script.DoFile(path); + } + catch (Exception e) + { + Program.Log.Error($"LuaEngine.CallLuaBattleCommandFunction {e.Message}"); + } + + effect.script = script; + } + } + + + public static string GetScriptPath(Actor target) { if (target is Player) { @@ -215,7 +420,7 @@ namespace FFXIVClassic_Map_Server.lua private void CallLuaFunctionNpc(Player player, Npc target, string funcName, bool optional, params object[] args) { - object[] args2 = new object[args.Length + (player == null ? 1:2)]; + object[] args2 = new object[args.Length + (player == null ? 1 : 2)]; Array.Copy(args, 0, args2, (player == null ? 1 : 2), args.Length); if (player != null) { @@ -266,7 +471,7 @@ namespace FFXIVClassic_Map_Server.lua catch (ScriptRuntimeException e) { SendError(player, e.DecoratedMessage); - } + } } } @@ -291,9 +496,9 @@ namespace FFXIVClassic_Map_Server.lua if (script != null) { if (!script.Globals.Get(funcName).IsNil()) - { + { //Run Script - DynValue result = script.Call(script.Globals[funcName], args2); + DynValue result = script.Call(script.Globals[funcName], args2); List lparams = LuaUtils.CreateLuaParamList(result); return lparams; } @@ -323,7 +528,7 @@ namespace FFXIVClassic_Map_Server.lua DynValue result = script.Call(script.Globals[funcName], args); List lparams = LuaUtils.CreateLuaParamList(result); return lparams; - } + } } return null; } @@ -348,9 +553,18 @@ namespace FFXIVClassic_Map_Server.lua { if (!script.Globals.Get(funcName).IsNil()) { - Coroutine coroutine = script.CreateCoroutine(script.Globals[funcName]).Coroutine; - DynValue value = coroutine.Resume(args2); - ResolveResume(player, coroutine, value); + try + { + Coroutine coroutine = script.CreateCoroutine(script.Globals[funcName]).Coroutine; + DynValue value = coroutine.Resume(args2); + ResolveResume(player, coroutine, value); + } + catch(Exception e) + { + player.SendMessage(0x20, "", e.Message); + player.EndEvent(); + + } } else { @@ -362,7 +576,7 @@ namespace FFXIVClassic_Map_Server.lua { if (!(target is Area) && !optional) SendError(player, String.Format("Could not find script for actor {0}.", target.GetName())); - } + } } public void EventStarted(Player player, Actor target, EventStartPacket eventStart) @@ -371,26 +585,27 @@ namespace FFXIVClassic_Map_Server.lua lparams.Insert(0, new LuaParam(2, eventStart.triggerName)); if (mSleepingOnPlayerEvent.ContainsKey(player.actorId)) { - Coroutine coroutine = mSleepingOnPlayerEvent[player.actorId]; + Coroutine coroutine = mSleepingOnPlayerEvent[player.actorId]; mSleepingOnPlayerEvent.Remove(player.actorId); - try{ + try + { DynValue value = coroutine.Resume(); - ResolveResume(null, coroutine, value); + ResolveResume(null, coroutine, value); } catch (ScriptRuntimeException e) { LuaEngine.SendError(player, String.Format("OnEventStarted: {0}", e.DecoratedMessage)); player.EndEvent(); - } + } } else { - if (target is Director) + if (target is Director) ((Director)target).OnEventStart(player, LuaUtils.CreateLuaParamObjectList(lparams)); else CallLuaFunction(player, target, "onEventStarted", false, LuaUtils.CreateLuaParamObjectList(lparams)); - } + } } public DynValue ResolveResume(Player player, Coroutine coroutine, DynValue value) @@ -399,8 +614,8 @@ namespace FFXIVClassic_Map_Server.lua return value; if (player != null && value.String != null && value.String.Equals("_WAIT_EVENT")) - { - GetInstance().AddWaitEventCoroutine(player, coroutine); + { + GetInstance().AddWaitEventCoroutine(player, coroutine); } else if (value.Tuple != null && value.Tuple.Length >= 1 && value.Tuple[0].String != null) { @@ -427,9 +642,13 @@ namespace FFXIVClassic_Map_Server.lua public static void RunGMCommand(Player player, String cmd, string[] param, bool help = false) { bool playerNull = player == null; - if (playerNull && param.Length >= 3) - player = Server.GetWorldManager().GetPCInWorld(param[1] + " " + param[2]); - + if (playerNull) + { + if (param.Length >= 2 && param[1].Contains("\"")) + player = Server.GetWorldManager().GetPCInWorld(param[1]); + else if (param.Length > 2) + player = Server.GetWorldManager().GetPCInWorld(param[1] + param[2]); + } // load from scripts/commands/gm/ directory var path = String.Format("./scripts/commands/gm/{0}.lua", cmd.ToLower()); @@ -556,9 +775,17 @@ namespace FFXIVClassic_Map_Server.lua // run the script //script.Call(script.Globals["onTrigger"], LuaParam.ToArray()); - Coroutine coroutine = script.CreateCoroutine(script.Globals["onTrigger"]).Coroutine; - DynValue value = coroutine.Resume(LuaParam.ToArray()); - GetInstance().ResolveResume(player, coroutine, value); + // gm commands dont need to be coroutines? + try + { + Coroutine coroutine = script.CreateCoroutine(script.Globals["onTrigger"]).Coroutine; + DynValue value = coroutine.Resume(LuaParam.ToArray()); + GetInstance().ResolveResume(player, coroutine, value); + } + catch (Exception e) + { + Program.Log.Error("LuaEngine.RunGMCommand: {0} - {1}", path, e.Message); + } return; } } @@ -613,7 +840,6 @@ namespace FFXIVClassic_Map_Server.lua player.SendMessage(SendMessagePacket.MESSAGE_TYPE_SYSTEM_ERROR, "", message); player.QueuePacket(EndEventPacket.BuildPacket(player.actorId, player.currentEventOwner, player.currentEventName)); } - + } } - \ No newline at end of file diff --git a/FFXIVClassic Map Server/lua/LuaUtils.cs b/FFXIVClassic Map Server/lua/LuaUtils.cs index a0eb86a2..f1181564 100644 --- a/FFXIVClassic Map Server/lua/LuaUtils.cs +++ b/FFXIVClassic Map Server/lua/LuaUtils.cs @@ -116,6 +116,12 @@ namespace FFXIVClassic_Map_Server public static void WriteLuaParams(BinaryWriter writer, List luaParams) { + if (luaParams == null) + { + Program.Log.Error("LuaUtils.WriteLuaParams LuaParams are null!"); + return; + } + foreach (LuaParam l in luaParams) { if (l.typeID == 0x1) diff --git a/FFXIVClassic Map Server/navmesh/SHARPNAV_LICENSE b/FFXIVClassic Map Server/navmesh/SHARPNAV_LICENSE new file mode 100644 index 00000000..bfec8b95 --- /dev/null +++ b/FFXIVClassic Map Server/navmesh/SHARPNAV_LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2013-2016 Robert Rouhani and other contributors (see CONTRIBUTORS file). + +SharpNav contains some altered source code from Recast Navigation, Copyright (c) 2009 Mikko Mononen memon@inside.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/FFXIVClassic Map Server/navmesh/SharpNav.dll b/FFXIVClassic Map Server/navmesh/SharpNav.dll new file mode 100644 index 00000000..be560e8f Binary files /dev/null and b/FFXIVClassic Map Server/navmesh/SharpNav.dll differ diff --git a/FFXIVClassic Map Server/navmesh/wil0Field01.snb b/FFXIVClassic Map Server/navmesh/wil0Field01.snb new file mode 100644 index 00000000..e8a49ee9 Binary files /dev/null and b/FFXIVClassic Map Server/navmesh/wil0Field01.snb differ diff --git a/FFXIVClassic Map Server/packages.config b/FFXIVClassic Map Server/packages.config index 4e137685..2d2dc7c3 100644 --- a/FFXIVClassic Map Server/packages.config +++ b/FFXIVClassic Map Server/packages.config @@ -1,11 +1,10 @@  - - + diff --git a/FFXIVClassic Map Server/packets/receive/SetTargetPacket.cs b/FFXIVClassic Map Server/packets/receive/SetTargetPacket.cs index b38cd5a7..b433a094 100644 --- a/FFXIVClassic Map Server/packets/receive/SetTargetPacket.cs +++ b/FFXIVClassic Map Server/packets/receive/SetTargetPacket.cs @@ -7,7 +7,7 @@ namespace FFXIVClassic_Map_Server.packets.receive { public bool invalidPacket = false; public uint actorID; - public uint otherVal; //Usually 0xE0000000 + public uint attackTarget; //Usually 0xE0000000 public SetTargetPacket(byte[] data) { @@ -17,7 +17,7 @@ namespace FFXIVClassic_Map_Server.packets.receive { try{ actorID = binReader.ReadUInt32(); - otherVal = binReader.ReadUInt32(); + attackTarget = binReader.ReadUInt32(); } catch (Exception){ invalidPacket = true; diff --git a/FFXIVClassic Map Server/packets/send/Actor/SetActorPropetyPacket.cs b/FFXIVClassic Map Server/packets/send/Actor/SetActorPropetyPacket.cs index aabba72e..eec4278b 100644 --- a/FFXIVClassic Map Server/packets/send/Actor/SetActorPropetyPacket.cs +++ b/FFXIVClassic Map Server/packets/send/Actor/SetActorPropetyPacket.cs @@ -112,7 +112,6 @@ namespace FFXIVClassic_Map_Server.packets.send.actor { string[] split = name.Split('.'); int arrayIndex = 0; - if (!(split[0].Equals("work") || split[0].Equals("charaWork") || split[0].Equals("playerWork") || split[0].Equals("npcWork") || split[0].Equals("guildleveWork"))) return false; diff --git a/FFXIVClassic Map Server/packets/send/Actor/SetActorStatePacket.cs b/FFXIVClassic Map Server/packets/send/Actor/SetActorStatePacket.cs index ddc1fb43..8bab2346 100644 --- a/FFXIVClassic Map Server/packets/send/Actor/SetActorStatePacket.cs +++ b/FFXIVClassic Map Server/packets/send/Actor/SetActorStatePacket.cs @@ -1,8 +1,6 @@ using FFXIVClassic.Common; using System; -using FFXIVClassic.Common; - namespace FFXIVClassic_Map_Server.packets.send.actor { class SetActorStatePacket diff --git a/FFXIVClassic Map Server/packets/send/Actor/SetActorSubStatPacket.cs b/FFXIVClassic Map Server/packets/send/Actor/SetActorSubStatPacket.cs deleted file mode 100644 index 5c8da573..00000000 --- a/FFXIVClassic Map Server/packets/send/Actor/SetActorSubStatPacket.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System; -using System.IO; - -using FFXIVClassic.Common; - -namespace FFXIVClassic_Map_Server.packets.send.actor -{ - class SetActorSubStatPacket - { - public const ushort OPCODE = 0x144; - public const uint PACKET_SIZE = 0x28; - - public static SubPacket BuildPacket(uint sourceActorId, byte breakage, int leftChant, int rightChant, int guard, int wasteStat, int statMode, uint idleAnimationId) - { - byte[] data = new byte[PACKET_SIZE - 0x20]; - - using (MemoryStream mem = new MemoryStream(data)) - { - using (BinaryWriter binWriter = new BinaryWriter(mem)) - { - binWriter.Write((byte)breakage); - binWriter.Write((byte)(((leftChant & 0xF) << 8) | (rightChant & 0xF))); - binWriter.Write((byte)(guard & 0xF)); - binWriter.Write((byte)((wasteStat & 0xF) << 8)); - binWriter.Write((byte)(statMode & 0xF)); - binWriter.Write((byte)0); - binWriter.Write((UInt16)(idleAnimationId&0xFFFF)); - } - } - - return new SubPacket(OPCODE, sourceActorId, data); - } - } -} diff --git a/FFXIVClassic Map Server/packets/send/Actor/SetActorSubStatePacket.cs b/FFXIVClassic Map Server/packets/send/Actor/SetActorSubStatePacket.cs new file mode 100644 index 00000000..bbb2b747 --- /dev/null +++ b/FFXIVClassic Map Server/packets/send/Actor/SetActorSubStatePacket.cs @@ -0,0 +1,46 @@ +using System; +using System.IO; + +using FFXIVClassic.Common; +using FFXIVClassic_Map_Server.actors.chara; + +namespace FFXIVClassic_Map_Server.packets.send.actor +{ + class SetActorSubStatePacket + { + public const ushort OPCODE = 0x144; + public const uint PACKET_SIZE = 0x28; + + enum SubStat : int + { + Breakage = 0x00, // (index goes high to low, bitflags) + Chant = 0x01, // [Nibbles: left / right hand = value]) (AKA SubStatObject) + Guard = 0x02, // [left / right hand = true] 0,1,2,3) ||| High byte also defines how many bools to use as flags for byte 0x4. + Waste = 0x03, // (High Nibble) + Mode = 0x04, // ??? + Unknown = 0x05, // ??? + SubStatMotionPack = 0x06, + Unknown2 = 0x07, + } + public static SubPacket BuildPacket(uint sourceActorId, SubState substate) + { + byte[] data = new byte[PACKET_SIZE - 0x20]; + + using (MemoryStream mem = new MemoryStream(data)) + { + using (BinaryWriter binWriter = new BinaryWriter(mem)) + { + binWriter.Write((byte)substate.breakage); + binWriter.Write((byte)substate.chantId); + binWriter.Write((byte)(substate.guard & 0xF)); + binWriter.Write((byte)(substate.waste)); + binWriter.Write((byte)(substate.mode)); + binWriter.Write((byte)0); + binWriter.Write((ushort)substate.motionPack); + } + } + + return new SubPacket(OPCODE, sourceActorId, data); + } + } +} diff --git a/FFXIVClassic Map Server/packets/send/Actor/battle/BattleAction.cs b/FFXIVClassic Map Server/packets/send/Actor/battle/BattleAction.cs deleted file mode 100644 index e1958bf9..00000000 --- a/FFXIVClassic Map Server/packets/send/Actor/battle/BattleAction.cs +++ /dev/null @@ -1,14 +0,0 @@ -using FFXIVClassic.Common; - -namespace FFXIVClassic_Map_Server.packets.send.actor.battle -{ - class BattleAction - { - public uint targetId; - public ushort amount; - public ushort worldMasterTextId; - public uint effectId; - public byte param; - public byte unknown; - } -} diff --git a/FFXIVClassic Map Server/packets/send/Actor/battle/BattleActionX10Packet.cs b/FFXIVClassic Map Server/packets/send/Actor/battle/BattleActionX10Packet.cs deleted file mode 100644 index b09c7834..00000000 --- a/FFXIVClassic Map Server/packets/send/Actor/battle/BattleActionX10Packet.cs +++ /dev/null @@ -1,61 +0,0 @@ -using FFXIVClassic.Common; -using System; -using System.IO; - -using FFXIVClassic.Common; - -namespace FFXIVClassic_Map_Server.packets.send.actor.battle -{ - class BattleActionX10Packet - { - public const ushort OPCODE = 0x013A; - public const uint PACKET_SIZE = 0xD8; - - public static SubPacket BuildPacket(uint playerActorID, uint sourceActorId, uint animationId, ushort commandId, BattleAction[] actionList) - { - byte[] data = new byte[PACKET_SIZE - 0x20]; - - using (MemoryStream mem = new MemoryStream(data)) - { - using (BinaryWriter binWriter = new BinaryWriter(mem)) - { - binWriter.Write((UInt32)sourceActorId); - binWriter.Write((UInt32)animationId); - - //Missing... last value is float, string in here as well? - - binWriter.Seek(0x20, SeekOrigin.Begin); - binWriter.Write((UInt32) actionList.Length); //Num actions (always 1 for this) - binWriter.Write((UInt16)commandId); - binWriter.Write((UInt16)810); //? - - binWriter.Seek(0x20, SeekOrigin.Begin); - foreach (BattleAction action in actionList) - binWriter.Write((UInt32)action.targetId); - - binWriter.Seek(0x50, SeekOrigin.Begin); - foreach (BattleAction action in actionList) - binWriter.Write((UInt16)action.amount); - - binWriter.Seek(0x64, SeekOrigin.Begin); - foreach (BattleAction action in actionList) - binWriter.Write((UInt16)action.worldMasterTextId); - - binWriter.Seek(0x78, SeekOrigin.Begin); - foreach (BattleAction action in actionList) - binWriter.Write((UInt32)action.effectId); - - binWriter.Seek(0xA0, SeekOrigin.Begin); - foreach (BattleAction action in actionList) - binWriter.Write((Byte)action.param); - - binWriter.Seek(0xAA, SeekOrigin.Begin); - foreach (BattleAction action in actionList) - binWriter.Write((Byte)action.unknown); - } - } - - return new SubPacket(OPCODE, sourceActorId, data); - } - } -} diff --git a/FFXIVClassic Map Server/packets/send/Actor/battle/BattleActionX18Packet.cs b/FFXIVClassic Map Server/packets/send/Actor/battle/BattleActionX18Packet.cs deleted file mode 100644 index c080a32a..00000000 --- a/FFXIVClassic Map Server/packets/send/Actor/battle/BattleActionX18Packet.cs +++ /dev/null @@ -1,61 +0,0 @@ -using FFXIVClassic.Common; -using System; -using System.IO; - -using FFXIVClassic.Common; - -namespace FFXIVClassic_Map_Server.packets.send.actor.battle -{ - class BattleActionX18Packet - { - public const ushort OPCODE = 0x013B; - public const uint PACKET_SIZE = 0x148; - - public static SubPacket BuildPacket(uint playerActorID, uint sourceActorId, uint animationId, ushort commandId, BattleAction[] actionList) - { - byte[] data = new byte[PACKET_SIZE - 0x20]; - - using (MemoryStream mem = new MemoryStream(data)) - { - using (BinaryWriter binWriter = new BinaryWriter(mem)) - { - binWriter.Write((UInt32)sourceActorId); - binWriter.Write((UInt32)animationId); - - //Missing... last value is float, string in here as well? - - binWriter.Seek(0x20, SeekOrigin.Begin); - binWriter.Write((UInt32) actionList.Length); //Num actions (always 1 for this) - binWriter.Write((UInt16)commandId); - binWriter.Write((UInt16)810); //? - - binWriter.Seek(0x58, SeekOrigin.Begin); - foreach (BattleAction action in actionList) - binWriter.Write((UInt32)action.targetId); - - binWriter.Seek(0xA0, SeekOrigin.Begin); - foreach (BattleAction action in actionList) - binWriter.Write((UInt16)action.amount); - - binWriter.Seek(0xC4, SeekOrigin.Begin); - foreach (BattleAction action in actionList) - binWriter.Write((UInt16)action.worldMasterTextId); - - binWriter.Seek(0xE8, SeekOrigin.Begin); - foreach (BattleAction action in actionList) - binWriter.Write((UInt32)action.effectId); - - binWriter.Seek(0x130, SeekOrigin.Begin); - foreach (BattleAction action in actionList) - binWriter.Write((Byte)action.param); - - binWriter.Seek(0x142, SeekOrigin.Begin); - foreach (BattleAction action in actionList) - binWriter.Write((Byte)action.unknown); - } - } - - return new SubPacket(OPCODE, sourceActorId, data); - } - } -} diff --git a/FFXIVClassic Map Server/packets/send/Actor/battle/CommandResult.cs b/FFXIVClassic Map Server/packets/send/Actor/battle/CommandResult.cs new file mode 100644 index 00000000..f5c1ac94 --- /dev/null +++ b/FFXIVClassic Map Server/packets/send/Actor/battle/CommandResult.cs @@ -0,0 +1,333 @@ +using FFXIVClassic.Common; +using System; +using System.Collections.Generic; +using FFXIVClassic_Map_Server.actors.chara.ai; +using FFXIVClassic_Map_Server.actors.chara.ai.utils; +using FFXIVClassic_Map_Server.Actors; +using FFXIVClassic_Map_Server.packets.send.actor.battle; + +namespace FFXIVClassic_Map_Server.packets.send.actor.battle +{ + //These flags can be stacked and mixed, but the client will prioritize certain flags over others. + [Flags] + public enum HitEffect : uint + { + //All HitEffects have the last byte 0x8 + HitEffectType = 8 << 24, + //Status effects use 32 << 24 + StatusEffectType = 32 << 24, + //Magic effects use 48 << 24 + MagicEffectType = 48 << 24, + + //Not setting RecoilLv2 or RecoilLv3 results in the weaker RecoilLv1. + //These are the recoil animations that play on the target, ranging from weak to strong. + //The recoil that gets set was likely based on the percentage of HP lost from the attack. + //These also have a visual effect with heals and spells but in reverse. RecoilLv1 has a large effect, Lv3 has none. Crit is very large + //For spells they represent resists. Lv0 is a max resist, Lv3 is no resist. Crit is still used for crits. + //Heals used the same effects sometimes but it isn't clear what for, it seems random? Possibly something like a trait proccing or even just a bug + RecoilLv1 = 0, + RecoilLv2 = 1 << 0, + RecoilLv3 = 1 << 1, + + //Setting both recoil flags triggers the "Critical!" pop-up text and hit visual effect. + CriticalHit = RecoilLv2 | RecoilLv3, + + //Hit visual and sound effects when connecting with the target. + //Mixing these flags together will yield different results. + //Each visual likely relates to a specific weapon. + //Ex: HitVisual4 flag alone appears to be the visual and sound effect for hand-to-hand attacks. + + //HitVisual is probably based on attack property. + //HitVisual1 is for slashing attacks + //HitVisual2 is for piercing attacks + //HitVisual1 | Hitvisual2 is for blunt attacks + //HitVisual3 is for projectile attacks + //Basically take the attack property of a weapon and shift it left 2 + //For auto attacks attack property is weapon's damageAttributeType1 + //Still not totally sure how this works with weaponskills or what hitvisual4 or the other combinations are for + HitVisual1 = 1 << 2, + HitVisual2 = 1 << 3, + HitVisual3 = 1 << 4, + HitVisual4 = 1 << 5, + + //An additional visual effect that plays on the target when attacked if: + //The attack is physical and they have the protect buff on. + //The attack is magical and they have the shell buff on. + //Special Note: Shell was removed in later versions of the game. + //Another effect plays when both Protect and Shell flags are activated. + //Not sure what this effect is. + //Random guess: if the attack was a hybrid of both physical and magical and the target had both Protect and Shell buffs applied. + Protect = 1 << 6 | HitEffectType, + Shell = 1 << 7 | HitEffectType, + ProtectShellSpecial = Protect | Shell, + + // Required for heal text to be blue, not sure if that's all it's used for + Heal = 1 << 8, + MP = 1 << 9, //Causes "MP" text to appear when used with MagicEffectType. | with Heal to make text blue + TP = 1 << 10,//Causes "TP" text to appear when used with MagicEffectType. | with Heal to make text blue + + //If only HitEffect1 is set out of the hit effects, the "Evade!" pop-up text triggers along with the evade visual. + //If no hit effects are set, the "Miss!" pop-up is triggered and no hit visual is played. + HitEffect1 = 1 << 9, + HitEffect2 = 1 << 10, //Plays the standard hit visual effect, but with no sound if used alone. + HitEffect3 = 1 << 11, //Yellow effect, crit? + HitEffect4 = 1 << 12, //Plays the blocking animation + HitEffect5 = 1 << 13, + GustyHitEffect = HitEffect3 | HitEffect2, + GreenTintedHitEffect = HitEffect4 | HitEffect1, + + //For specific animations + Miss = 0, + Evade = HitEffect1, + Hit = HitEffect1 | HitEffect2, + Crit = HitEffect3, + Parry = Hit | HitEffect3, + Block = HitEffect4, + + //Knocks you back away from the attacker. + KnockbackLv1 = HitEffect4 | HitEffect2 | HitEffect1, + KnockbackLv2 = HitEffect4 | HitEffect3, + KnockbackLv3 = HitEffect4 | HitEffect3 | HitEffect1, + KnockbackLv4 = HitEffect4 | HitEffect3 | HitEffect2, + KnockbackLv5 = HitEffect4 | HitEffect3 | HitEffect2 | HitEffect1, + + //Knocks you away from the attacker in a counter-clockwise direction. + KnockbackCounterClockwiseLv1 = HitEffect5, + KnockbackCounterClockwiseLv2 = HitEffect5 | HitEffect1, + + //Knocks you away from the attacker in a clockwise direction. + KnockbackClockwiseLv1 = HitEffect5 | HitEffect2, + KnockbackClockwiseLv2 = HitEffect5 | HitEffect2 | HitEffect1, + + //Completely drags target to the attacker, even across large distances. + DrawIn = HitEffect5 | HitEffect3, + + //An additional visual effect that plays on the target based on according buff. + UnknownShieldEffect = HitEffect5 | HitEffect4, + Stoneskin = HitEffect5 | HitEffect4 | HitEffect1, + + //Unknown = 1 << 14, -- Not sure what this flag does; might be another HitEffect. + + //A special effect when performing appropriate skill combos in succession. + //Ex: Thunder (SkillCombo1 Effect) -> Thundara (SkillCombo2 Effect) -> Thundaga (SkillCombo3 Effect) + //Special Note: SkillCombo4 was never actually used in 1.0 since combos only chained up to 3 times maximum. + SkillCombo1 = 1 << 15, + SkillCombo2 = 1 << 16, + SkillCombo3 = SkillCombo1 | SkillCombo2, + SkillCombo4 = 1 << 17 + + //Flags beyond here are unknown/untested. + } + + //Mixing some of these flags will cause the client to crash. + //Setting a flag higher than Left (0x10-0x80) will cause the client to crash. + [Flags] + public enum HitDirection : byte + { + None = 0, + Front = 1 << 0, + Right = 1 << 1, + Rear = 1 << 2, + Left = 1 << 3 + } + + public enum HitType : ushort + { + Miss = 0, + Evade = 1, + Parry = 2, + Block = 3, + Resist = 4, + Hit = 5, + Crit = 6 + } + + //Type of action + public enum ActionType : ushort + { + None = 0, + Physical = 1, + Magic = 2, + Heal = 3, + Status = 4 + } + + //There's are two columns in gamecommand that are for action property and action element respectively and both have percentages next to them + //the percentages are for what percent that property or element factors into the attack. Astral and Umbral are always 33% because they are both 3 elments combined + //ActionProperty and ActionElement are slightly different. Property defines whta type of attack it is, and 11-13 are used for "sonic, breath, neutral". Neutral is always used for magic + //For Element 11-13 are used for astral, umbral, and healing magic. + //Right now we aren't actually using these but when things like resists get better defined we'll have to + public enum ActionProperty : ushort + { + None = 0, + Slashing = 1, + Piercing = 2, + Blunt = 3, + Projectile = 4, + + Fire = 5, + Ice = 6, + Wind = 7, + Earth = 8, + Lightning = 9, + Water = 10, + + //These I'm not sure about. Check gameCommand.csv + Astral = 11, + Umbral = 12, + Heal = 13 + } + + + /* + public enum ActionProperty : ushort + { + None = 0, + Slashing = 1, + Piercing = 2, + Blunt = 3, + Projectile = 4, + + Fire = 5, + Ice = 6, + Wind = 7, + Earth = 8, + Lightning = 9, + Water = 10, + + Sonic = 11, + Breath = 12, + Neutral = 13, + Astral = 14, + Umbral = 15 + } + + public enum ActionElement : ushort + { + None = 0, + Slashing = 1, + Piercing = 2, + Blunt = 3, + Projectile = 4, + + Fire = 5, + Ice = 6, + Wind = 7, + Earth = 8, + Lightning = 9, + Water = 10, + + //These I'm not sure about. Check gameCommand.csv + Astral = 11, + Umbral = 12, + Heal = 13 + }*/ + + + class CommandResult + { + public uint targetId; + public ushort amount; + public ushort amountMitigated; //Amount that got blocked/evaded or resisted + public ushort enmity; //Seperate from amount for abilities that cause a different amount of enmity than damage + public ushort worldMasterTextId; + public uint effectId; //Impact effect, damage/heal/status numbers or name + public byte param; //Which side the battle action is coming from + public byte hitNum; //Which hit in a sequence of hits this is + + /// + /// these fields are not actually part of the packet struct + /// + public uint animation; + public CommandType commandType; //What type of command was used (ie weaponskill, ability, etc) + public ActionProperty actionProperty; //Damage type of the action + public ActionType actionType; //Type of this action (ie physical, magic, heal) + public HitType hitType; + + //Rates, I'm not sure if these need to be stored like this but with the way some buffs work maybe they do? + //Makes things like Blindside easy at least. + public double parryRate = 0.0; + public double blockRate = 0.0; + public double resistRate = 0.0; + public double hitRate = 0.0; + public double critRate = 0.0; + + public CommandResult(uint targetId, ushort worldMasterTextId, uint effectId, ushort amount = 0, byte param = 0, byte hitNum = 1) + { + this.targetId = targetId; + this.worldMasterTextId = worldMasterTextId; + this.effectId = effectId; + this.amount = amount; + this.param = param; + this.hitNum = hitNum; + this.hitType = HitType.Hit; + this.enmity = amount; + this.commandType = (byte) CommandType.None; + } + + public CommandResult(uint targetId, BattleCommand command, byte param = 0, byte hitNum = 1) + { + this.targetId = targetId; + this.worldMasterTextId = command.worldMasterTextId; + this.param = param; + this.hitNum = hitNum; + this.commandType = command.commandType; + this.actionProperty = command.actionProperty; + this.actionType = command.actionType; + } + + //Order of what (probably) happens when a skill is used: + //Buffs that alter things like recast times or that only happen once per skill usage like Power Surge are activated + //Script calculates damage and handles any special requirements + //Rates are calculated + //Buffs that impact indiviudal hits like Blindside or Blood for Blood are activated + //The final hit type is determined + //Stoneskin takes damage + //Final damage amount is calculated using the hit type and defender's stats + //Buffs that activate or respond to damage like Rampage. Stoneskin gets removed AFTER damage if it falls off. + //Additional effects that are a part of the skill itself or weapon in case of auto attacks take place like status effects + //Certain buffs that alter the whole skill fall off (Resonance, Excruciate) + + public void DoAction(Character caster, Character target, BattleCommand skill, CommandResultContainer results) + { + //First calculate rates for hit/block/etc + CalcRates(caster, target, skill); + + //Next, modify those rates based on preaction buffs + //Still not sure how we shouldh andle these + PreAction(caster, target, skill, results); + + BattleUtils.DoAction(caster, target, skill, this, results); + } + + + //Calculate the chance of hitting/critting/etc + public void CalcRates(Character caster, Character target, BattleCommand skill) + { + hitRate = BattleUtils.GetHitRate(caster, target, skill, this); + critRate = BattleUtils.GetCritRate(caster, target, skill, this); + blockRate = BattleUtils.GetBlockRate(caster, target, skill, this); + parryRate = BattleUtils.GetParryRate(caster, target, skill, this); + resistRate = BattleUtils.GetResistRate(caster, target, skill, this); + } + + //These are buffs that activate before the action hits. Usually they change things like hit or crit rates or damage + public void PreAction(Character caster, Character target, BattleCommand skill, CommandResultContainer results) + { + target.statusEffects.CallLuaFunctionByFlag((uint)StatusEffectFlags.ActivateOnPreactionTarget, "onPreAction", caster, target, skill, this, results); + + caster.statusEffects.CallLuaFunctionByFlag((uint)StatusEffectFlags.ActivateOnPreactionCaster, "onPreAction", caster, target, skill, this, results); + } + + //Try and apply a status effect + public void TryStatus(Character caster, Character target, BattleCommand skill, CommandResultContainer results, bool isAdditional = true) + { + BattleUtils.TryStatus(caster, target, skill, this, results, isAdditional); + } + + public ushort GetHitType() + { + return (ushort)hitType; + } + } +} diff --git a/FFXIVClassic Map Server/packets/send/Actor/battle/CommandResultContainer.cs b/FFXIVClassic Map Server/packets/send/Actor/battle/CommandResultContainer.cs new file mode 100644 index 00000000..ac812ebe --- /dev/null +++ b/FFXIVClassic Map Server/packets/send/Actor/battle/CommandResultContainer.cs @@ -0,0 +1,76 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FFXIVClassic_Map_Server.packets.send.actor.battle +{ + class CommandResultContainer + { + private List actionsList = new List(); + + //EXP messages are always the last mesages in battlea ction packets, so they get appended after all the rest of the actions are done. + private List expActionList = new List(); + + public CommandResultContainer() + { + + } + + public void AddAction(uint targetId, ushort worldMasterTextId, uint effectId, ushort amount = 0, byte param = 0, byte hitNum = 0) + { + AddAction(new CommandResult(targetId, worldMasterTextId, effectId, amount, param, hitNum)); + } + + //Just to make scripting simpler + public void AddMPAction(uint targetId, ushort worldMasterTextId, ushort amount) + { + uint effectId = (uint) (HitEffect.MagicEffectType | HitEffect.MP | HitEffect.Heal); + AddAction(targetId, worldMasterTextId, effectId, amount); + } + + public void AddHPAction(uint targetId, ushort worldMasterTextId, ushort amount) + { + uint effectId = (uint)(HitEffect.MagicEffectType | HitEffect.Heal); + AddAction(targetId, worldMasterTextId, effectId, amount); + } + + public void AddTPAction(uint targetId, ushort worldMasterTextId, ushort amount) + { + uint effectId = (uint)(HitEffect.MagicEffectType | HitEffect.TP); + AddAction(targetId, worldMasterTextId, effectId, amount); + } + + public void AddAction(CommandResult action) + { + if (action != null) + actionsList.Add(action); + } + + public void AddActions(List actions) + { + actionsList.AddRange(actions); + } + + public void AddEXPAction(CommandResult action) + { + expActionList.Add(action); + } + + public void AddEXPActions(List actionList) + { + expActionList.AddRange(actionList); + } + + public void CombineLists() + { + actionsList.AddRange(expActionList); + } + + public List GetList() + { + return actionsList; + } + } +} diff --git a/FFXIVClassic Map Server/packets/send/Actor/battle/BattleActionX00Packet.cs b/FFXIVClassic Map Server/packets/send/Actor/battle/CommandResultX00Packet.cs similarity index 83% rename from FFXIVClassic Map Server/packets/send/Actor/battle/BattleActionX00Packet.cs rename to FFXIVClassic Map Server/packets/send/Actor/battle/CommandResultX00Packet.cs index 99781b9e..06cbe136 100644 --- a/FFXIVClassic Map Server/packets/send/Actor/battle/BattleActionX00Packet.cs +++ b/FFXIVClassic Map Server/packets/send/Actor/battle/CommandResultX00Packet.cs @@ -2,16 +2,14 @@ using System; using System.IO; -using FFXIVClassic.Common; - namespace FFXIVClassic_Map_Server.packets.send.actor.battle { - class BattleActionX00Packet + class CommandResultX00Packet { 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 sourceActorId, uint animationId, ushort commandId) { byte[] data = new byte[PACKET_SIZE - 0x20]; diff --git a/FFXIVClassic Map Server/packets/send/Actor/battle/BattleActionX01Packet.cs b/FFXIVClassic Map Server/packets/send/Actor/battle/CommandResultX01Packet.cs similarity index 53% rename from FFXIVClassic Map Server/packets/send/Actor/battle/BattleActionX01Packet.cs rename to FFXIVClassic Map Server/packets/send/Actor/battle/CommandResultX01Packet.cs index c172791e..035af7d7 100644 --- a/FFXIVClassic Map Server/packets/send/Actor/battle/BattleActionX01Packet.cs +++ b/FFXIVClassic Map Server/packets/send/Actor/battle/CommandResultX01Packet.cs @@ -2,14 +2,21 @@ using System; using System.IO; -namespace FFXIVClassic_Map_Server.packets.send.actor.battle +namespace FFXIVClassic_Map_Server.packets.send.actor.battle { - class BattleActionX01Packet + // see xtx_command + enum CommandResultX01PacketCommand : ushort + { + Disengage = 12002, + Attack = 22104, + } + + class CommandResultX01Packet { 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 sourceActorId, uint animationId, ushort commandId, CommandResult action) { byte[] data = new byte[PACKET_SIZE - 0x20]; @@ -18,6 +25,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.battle using (BinaryWriter binWriter = new BinaryWriter(mem)) { binWriter.Write((UInt32)sourceActorId); + binWriter.Write((UInt32)animationId); //Missing... last value is float, string in here as well? @@ -25,21 +33,20 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.battle binWriter.Seek(0x20, SeekOrigin.Begin); binWriter.Write((UInt32)1); //Num actions (always 1 for this) binWriter.Write((UInt16)commandId); - binWriter.Write((UInt16)810); //? + binWriter.Write((UInt16)0x810); //? - binWriter.Write((UInt32)targetActorId); + binWriter.Write((UInt32)action.targetId); - binWriter.Write((UInt16)amount); - binWriter.Write((UInt16)worldMasterTextId); + binWriter.Write((UInt16)action.amount); + binWriter.Write((UInt16)action.worldMasterTextId); - binWriter.Write((UInt32)effectId); - - binWriter.Write((Byte)param); - binWriter.Write((Byte)1); //? + binWriter.Write((UInt32)action.effectId); + binWriter.Write((Byte)action.param); + binWriter.Write((Byte)action.hitNum); } } return new SubPacket(OPCODE, sourceActorId, data); } } -} +} \ No newline at end of file diff --git a/FFXIVClassic Map Server/packets/send/Actor/battle/CommandResultX10Packet.cs b/FFXIVClassic Map Server/packets/send/Actor/battle/CommandResultX10Packet.cs new file mode 100644 index 00000000..3a0c4616 --- /dev/null +++ b/FFXIVClassic Map Server/packets/send/Actor/battle/CommandResultX10Packet.cs @@ -0,0 +1,127 @@ +using FFXIVClassic.Common; +using System; +using System.IO; + +using System.Collections.Generic; + +namespace FFXIVClassic_Map_Server.packets.send.actor.battle +{ + class CommandResultX10Packet + { + public const ushort OPCODE = 0x013A; + public const uint PACKET_SIZE = 0xD8; + + public static SubPacket BuildPacket(uint sourceActorId, uint animationId, ushort commandId, CommandResult[] actionList, ref int listOffset) + { + byte[] data = new byte[PACKET_SIZE - 0x20]; + + using (MemoryStream mem = new MemoryStream(data)) + { + using (BinaryWriter binWriter = new BinaryWriter(mem)) + { + int max; + if (actionList.Length - listOffset <= 10) + max = actionList.Length - listOffset; + else + max = 10; + + binWriter.Write((UInt32)sourceActorId); + binWriter.Write((UInt32)animationId); + + //Missing... last value is float, string in here as well? + + binWriter.Seek(0x20, SeekOrigin.Begin); + binWriter.Write((UInt32)max); //Num actions + binWriter.Write((UInt16)commandId); + binWriter.Write((UInt16)0x810); //? + + //binWriter.Seek(0x20, SeekOrigin.Begin); + for (int i = 0; i < max; i++) + binWriter.Write((UInt32)actionList[listOffset + i].targetId); + + binWriter.Seek(0x50, SeekOrigin.Begin); + for (int i = 0; i < max; i++) + binWriter.Write((UInt16)actionList[listOffset + i].amount); + + binWriter.Seek(0x64, SeekOrigin.Begin); + for (int i = 0; i < max; i++) + binWriter.Write((UInt16)actionList[listOffset + i].worldMasterTextId); + + binWriter.Seek(0x78, SeekOrigin.Begin); + for (int i = 0; i < max; i++) + binWriter.Write((UInt32)actionList[listOffset + i].effectId); + + binWriter.Seek(0xA0, SeekOrigin.Begin); + for (int i = 0; i < max; i++) + binWriter.Write((Byte)actionList[listOffset + i].param); + + binWriter.Seek(0xAA, SeekOrigin.Begin); + for (int i = 0; i < max; i++) + binWriter.Write((Byte)actionList[listOffset + i].hitNum); + + listOffset += max; + } + } + + return new SubPacket(OPCODE, sourceActorId, data); + } + + public static SubPacket BuildPacket(uint sourceActorId, uint animationId, ushort commandId, List actionList, ref int listOffset) + { + byte[] data = new byte[PACKET_SIZE - 0x20]; + + using (MemoryStream mem = new MemoryStream(data)) + { + using (BinaryWriter binWriter = new BinaryWriter(mem)) + { + int max; + if (actionList.Count - listOffset <= 10) + max = actionList.Count - listOffset; + else + max = 10; + + binWriter.Write((UInt32)sourceActorId); + binWriter.Write((UInt32)animationId); + + //Missing... last value is float, string in here as well? + + binWriter.Seek(0x20, SeekOrigin.Begin); + binWriter.Write((UInt32)max); //Num actions + binWriter.Write((UInt16)commandId); + binWriter.Write((UInt16)0x810); //? + + //binWriter.Seek(0x20, SeekOrigin.Begin); + for (int i = 0; i < max; i++) + binWriter.Write((UInt32)actionList[listOffset + i].targetId); + + binWriter.Seek(0x50, SeekOrigin.Begin); + for (int i = 0; i < max; i++) + binWriter.Write((UInt16)actionList[listOffset + i].amount); + + binWriter.Seek(0x64, SeekOrigin.Begin); + for (int i = 0; i < max; i++) + binWriter.Write((UInt16)actionList[listOffset + i].worldMasterTextId); + + binWriter.Seek(0x78, SeekOrigin.Begin); + for (int i = 0; i < max; i++) + { + binWriter.Write((UInt32)actionList[listOffset + i].effectId); + } + + binWriter.Seek(0xA0, SeekOrigin.Begin); + for (int i = 0; i < max; i++) + binWriter.Write((Byte)actionList[listOffset + i].param); + + binWriter.Seek(0xAA, SeekOrigin.Begin); + for (int i = 0; i < max; i++) + binWriter.Write((Byte) actionList[listOffset + i].hitNum); + + listOffset += max; + } + } + + return new SubPacket(OPCODE, sourceActorId, data); + } + + } +} diff --git a/FFXIVClassic Map Server/packets/send/Actor/battle/CommandResultX18Packet.cs b/FFXIVClassic Map Server/packets/send/Actor/battle/CommandResultX18Packet.cs new file mode 100644 index 00000000..1ec257d0 --- /dev/null +++ b/FFXIVClassic Map Server/packets/send/Actor/battle/CommandResultX18Packet.cs @@ -0,0 +1,124 @@ +using FFXIVClassic.Common; +using System; +using System.IO; + +using System.Collections.Generic; + +namespace FFXIVClassic_Map_Server.packets.send.actor.battle +{ + class CommandResultX18Packet + { + public const ushort OPCODE = 0x013B; + public const uint PACKET_SIZE = 0x148; + + public static SubPacket BuildPacket(uint sourceActorId, uint animationId, ushort commandId, CommandResult[] actionList, ref int listOffset) + { + byte[] data = new byte[PACKET_SIZE - 0x20]; + + using (MemoryStream mem = new MemoryStream(data)) + { + using (BinaryWriter binWriter = new BinaryWriter(mem)) + { + int max; + if (actionList.Length - listOffset <= 18) + max = actionList.Length - listOffset; + else + max = 18; + + binWriter.Write((UInt32)sourceActorId); + binWriter.Write((UInt32)animationId); + + //Missing... last value is float, string in here as well? + + binWriter.Seek(0x20, SeekOrigin.Begin); + binWriter.Write((UInt32)max); //Num actions + binWriter.Write((UInt16)commandId); + binWriter.Write((UInt16)0x810); //? + + binWriter.Seek(0x28, SeekOrigin.Begin); + for (int i = 0; i < max; i++) + binWriter.Write((UInt32)actionList[listOffset + i].targetId); + + binWriter.Seek(0x70, SeekOrigin.Begin); + for (int i = 0; i < max; i++) + binWriter.Write((UInt16)actionList[listOffset + i].amount); + + binWriter.Seek(0x94, SeekOrigin.Begin); + for (int i = 0; i < max; i++) + binWriter.Write((UInt16)actionList[listOffset + i].worldMasterTextId); + + binWriter.Seek(0xB8, SeekOrigin.Begin); + for (int i = 0; i < max; i++) + binWriter.Write((UInt32)actionList[listOffset + i].effectId); + + binWriter.Seek(0x100, SeekOrigin.Begin); + for (int i = 0; i < max; i++) + binWriter.Write((Byte)actionList[listOffset + i].param); + + binWriter.Seek(0x112, SeekOrigin.Begin); + for (int i = 0; i < max; i++) + binWriter.Write((Byte)actionList[listOffset + i].hitNum); + + listOffset += max; + } + } + + return new SubPacket(OPCODE, sourceActorId, data); + } + + public static SubPacket BuildPacket(uint sourceActorId, uint animationId, ushort commandId, List actionList, ref int listOffset) + { + byte[] data = new byte[PACKET_SIZE - 0x20]; + + using (MemoryStream mem = new MemoryStream(data)) + { + using (BinaryWriter binWriter = new BinaryWriter(mem)) + { + int max; + if (actionList.Count - listOffset <= 18) + max = actionList.Count - listOffset; + else + max = 18; + + binWriter.Write((UInt32)sourceActorId); + binWriter.Write((UInt32)animationId); + + //Missing... last value is float, string in here as well? + + binWriter.Seek(0x20, SeekOrigin.Begin); + binWriter.Write((UInt32)max); //Num actions + binWriter.Write((UInt16)commandId); + binWriter.Write((UInt16)0x818); //? + + binWriter.Seek(0x28, SeekOrigin.Begin); + for (int i = 0; i < max; i++) + binWriter.Write((UInt32)actionList[listOffset + i].targetId); + + binWriter.Seek(0x70, SeekOrigin.Begin); + for (int i = 0; i < max; i++) + binWriter.Write((UInt16)actionList[listOffset + i].amount); + + binWriter.Seek(0x94, SeekOrigin.Begin); + for (int i = 0; i < max; i++) + binWriter.Write((UInt16)actionList[listOffset + i].worldMasterTextId); + + binWriter.Seek(0xB8, SeekOrigin.Begin); + for (int i = 0; i < max; i++) + binWriter.Write((UInt32)actionList[listOffset + i].effectId); + + binWriter.Seek(0x100, SeekOrigin.Begin); + for (int i = 0; i < max; i++) + binWriter.Write((Byte)actionList[listOffset + i].param); + + binWriter.Seek(0x112, SeekOrigin.Begin); + for (int i = 0; i < max; i++) + binWriter.Write((Byte)actionList[listOffset + i].hitNum); + + listOffset += max; + } + } + + return new SubPacket(OPCODE, sourceActorId, data); + } + } +} diff --git a/FFXIVClassic Map Server/packets/send/groups/GroupMembersX16Packet.cs b/FFXIVClassic Map Server/packets/send/groups/GroupMembersX16Packet.cs index 2c1c4855..b4ba775b 100644 --- a/FFXIVClassic Map Server/packets/send/groups/GroupMembersX16Packet.cs +++ b/FFXIVClassic Map Server/packets/send/groups/GroupMembersX16Packet.cs @@ -41,7 +41,7 @@ namespace FFXIVClassic_Map_Server.packets.send.group binWriter.Write(Encoding.ASCII.GetBytes(entry.name), 0, Encoding.ASCII.GetByteCount(entry.name) >= 0x20 ? 0x20 : Encoding.ASCII.GetByteCount(entry.name)); offset++; - } + } } } diff --git a/FFXIVClassic Map Server/utils/CharacterUtils.cs b/FFXIVClassic Map Server/utils/CharacterUtils.cs index 3df2bc6a..b420b5fa 100644 --- a/FFXIVClassic Map Server/utils/CharacterUtils.cs +++ b/FFXIVClassic Map Server/utils/CharacterUtils.cs @@ -96,5 +96,31 @@ namespace FFXIVClassic_Map_Server.utils } } + public static string GetClassNameForId(short id) + { + switch (id) + { + case 2: return "pug"; + case 3: return "gla"; + case 4: return "mrd"; + case 7: return "arc"; + case 8: return "lnc"; + case 22: return "thm"; + case 23: return "cnj"; + case 29: return "crp"; + case 30: return "bsm"; + case 31: return "arm"; + case 32: return "gsm"; + case 33: return "ltw"; + case 34: return "wvr"; + case 35: return "alc"; + case 36: return "cul"; + case 39: return "min"; + case 40: return "btn"; + case 41: return "fsh"; + default: return "undefined"; + } + } + } } diff --git a/FFXIVClassic Map Server/utils/NavmeshUtils.cs b/FFXIVClassic Map Server/utils/NavmeshUtils.cs new file mode 100644 index 00000000..8145d0cb --- /dev/null +++ b/FFXIVClassic Map Server/utils/NavmeshUtils.cs @@ -0,0 +1,266 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.IO; +using SharpNav; +using SharpNav.Pathfinding; +using SharpNav.Crowds; +using SharpNav.IO; +using FFXIVClassic.Common; + +namespace FFXIVClassic_Map_Server.utils +{ + class NavmeshUtils + { + + // navmesh + public static bool CanSee(actors.area.Zone zone, float x1, float y1, float z1, float x2, float y2, float z2) + { + // todo: prolly shouldnt raycast + var navMesh = zone.tiledNavMesh; + if (navMesh != null) + { + var navMeshQuery = zone.navMeshQuery; + + NavPoint startPt, endPt; + SharpNav.Pathfinding.Path path = new SharpNav.Pathfinding.Path(); + + RaycastHit hit = new RaycastHit(); + + SharpNav.Geometry.Vector3 c = new SharpNav.Geometry.Vector3(x1, y1, z1); + SharpNav.Geometry.Vector3 ep = new SharpNav.Geometry.Vector3(x2, y2, z2); + + SharpNav.Geometry.Vector3 e = new SharpNav.Geometry.Vector3(5, 5, 5); + navMeshQuery.FindNearestPoly(ref c, ref e, out startPt); + navMeshQuery.FindNearestPoly(ref ep, ref e, out endPt); + + + if (navMeshQuery.Raycast(ref startPt, ref ep, RaycastOptions.None, out hit, path)) + { + return true; + } + return false; + } + return true; + } + + public static SharpNav.TiledNavMesh LoadNavmesh(TiledNavMesh navmesh, string filePath) + { + SharpNav.IO.NavMeshSerializer serializer; + if (System.IO.Path.GetExtension(filePath) == ".snb") + serializer = new SharpNav.IO.Binary.NavMeshBinarySerializer(); + else + serializer = new SharpNav.IO.Json.NavMeshJsonSerializer(); + + return serializer.Deserialize(System.IO.Path.Combine("../../navmesh/", filePath)); + //return navmesh = new SharpNav.IO.Json.NavMeshJsonSerializer().Deserialize(filePath); + } + + public static List GetPath(actors.area.Zone zone, float x, float y, float z, float targetX, float targetY, float targetZ, float stepSize = 0.70f, int pathSize = 45, float polyRadius = 0.0f, bool skipToTarget = false) + { + return GetPath(zone, new Vector3(x, y, z), new Vector3(targetX, targetY, targetZ), stepSize, pathSize, polyRadius, skipToTarget); + } + + #region sharpnav stuff + // Copyright (c) 2013-2016 Robert Rouhani and other contributors (see CONTRIBUTORS file). + // Licensed under the MIT License - https://raw.github.com/Robmaister/SharpNav/master/LICENSE + + public static List GetPath(actors.area.Zone zone, Vector3 startVec, Vector3 endVec, float stepSize = 0.70f, int pathSize = 45, float polyRadius = 0.0f, bool skipToTarget = false) + { + var navMesh = zone.tiledNavMesh; + var navMeshQuery = zone.navMeshQuery; + + // no navmesh loaded, run straight to player + if (navMesh == null) + { + return new List() { endVec }; + } + + // no need to waste cycles finding path to same point + if (startVec.X == endVec.X && startVec.Y == endVec.Y && startVec.Z == endVec.Z && polyRadius == 0.0f) + { + return null; + } + + var smoothPath = new List(pathSize) { }; + + NavQueryFilter filter = new NavQueryFilter(); + + NavPoint startPt, endPt; + + try + { + SharpNav.Geometry.Vector3 c = new SharpNav.Geometry.Vector3(startVec.X, startVec.Y, startVec.Z); + SharpNav.Geometry.Vector3 ep = new SharpNav.Geometry.Vector3(endVec.X, endVec.Y, endVec.Z); + + SharpNav.Geometry.Vector3 e = new SharpNav.Geometry.Vector3(5, 5, 5); + navMeshQuery.FindNearestPoly(ref c, ref e, out startPt); + navMeshQuery.FindNearestPoly(ref ep, ref e, out endPt); + + //calculate the overall path, which contains an array of polygon references + int MAX_POLYS = 256; + var path = new SharpNav.Pathfinding.Path(); + + navMeshQuery.FindPath(ref startPt, ref endPt, filter, path); + + //find a smooth path over the mesh surface + int npolys = path.Count; + SharpNav.Geometry.Vector3 iterPos = new SharpNav.Geometry.Vector3(); + SharpNav.Geometry.Vector3 targetPos = new SharpNav.Geometry.Vector3(); + navMeshQuery.ClosestPointOnPoly(startPt.Polygon, startPt.Position, ref iterPos); + navMeshQuery.ClosestPointOnPoly(path[npolys - 1], endPt.Position, ref targetPos); + + // set target to random point at end of path + if (polyRadius != 0.0f) + { + var randPoly = navMeshQuery.FindRandomPointAroundCircle(endPt, polyRadius); + targetPos = randPoly.Position; + } + + if (skipToTarget) + { + return new List() { new Vector3(targetPos.X, targetPos.Y, targetPos.Z) }; + } + smoothPath.Add(new Vector3(iterPos.X, iterPos.Y, iterPos.Z)); + + //float STEP_SIZE = 0.70f; + float SLOP = 0.15f; + while (npolys > 0 && smoothPath.Count < smoothPath.Capacity) + { + //find location to steer towards + SharpNav.Geometry.Vector3 steerPos = new SharpNav.Geometry.Vector3(); + StraightPathFlags steerPosFlag = 0; + NavPolyId steerPosRef = NavPolyId.Null; + + if (!GetSteerTarget(navMeshQuery, iterPos, targetPos, SLOP, path, ref steerPos, ref steerPosFlag, ref steerPosRef)) + break; + + bool endOfPath = (steerPosFlag & StraightPathFlags.End) != 0 ? true : false; + bool offMeshConnection = (steerPosFlag & StraightPathFlags.OffMeshConnection) != 0 ? true : false; + + //find movement delta + SharpNav.Geometry.Vector3 delta = steerPos - iterPos; + float len = (float)Math.Sqrt(SharpNav.Geometry.Vector3.Dot(delta, delta)); + + //if steer target is at end of path or off-mesh link + //don't move past location + if ((endOfPath || offMeshConnection) && len < stepSize) + len = 1; + else + len = stepSize / len; + + SharpNav.Geometry.Vector3 moveTgt = new SharpNav.Geometry.Vector3(); + VMad(ref moveTgt, iterPos, delta, len); + + //move + SharpNav.Geometry.Vector3 result = new SharpNav.Geometry.Vector3(); + List visited = new List(pathSize); + NavPoint startPoint = new NavPoint(path[0], iterPos); + navMeshQuery.MoveAlongSurface(ref startPoint, ref moveTgt, out result, visited); + path.FixupCorridor(visited); + npolys = path.Count; + float h = 0; + navMeshQuery.GetPolyHeight(path[0], result, ref h); + result.Y = h; + iterPos = result; + + //handle end of path when close enough + if (endOfPath && InRange(iterPos, steerPos, SLOP, 1000.0f)) + { + //reached end of path + iterPos = targetPos; + if (smoothPath.Count < smoothPath.Capacity) + { + smoothPath.Add(new Vector3(iterPos.X, iterPos.Y, iterPos.Z)); + } + break; + } + + //store results + if (smoothPath.Count < smoothPath.Capacity) + { + smoothPath.Add(new Vector3(iterPos.X, iterPos.Y, iterPos.Z)); + } + } + } + catch(Exception e) + { + Program.Log.Error(e.Message); + Program.Log.Error("Start pos {0} {1} {2} end pos {3} {4} {5}", startVec.X, startVec.Y, startVec.Z, endVec.X, endVec.Y, endVec.Z); + // todo: probably log this + return new List() { endVec }; + } + return smoothPath; + } + + /// + /// Scaled vector addition + /// + /// Result + /// Vector 1 + /// Vector 2 + /// Scalar + private static void VMad(ref SharpNav.Geometry.Vector3 dest, SharpNav.Geometry.Vector3 v1, SharpNav.Geometry.Vector3 v2, float s) + { + dest.X = v1.X + v2.X * s; + dest.Y = v1.Y + v2.Y * s; + dest.Z = v1.Z + v2.Z * s; + } + + private static bool GetSteerTarget(NavMeshQuery navMeshQuery, SharpNav.Geometry.Vector3 startPos, SharpNav.Geometry.Vector3 endPos, float minTargetDist, SharpNav.Pathfinding.Path path, + ref SharpNav.Geometry.Vector3 steerPos, ref StraightPathFlags steerPosFlag, ref NavPolyId steerPosRef) + { + StraightPath steerPath = new StraightPath(); + navMeshQuery.FindStraightPath(startPos, endPos, path, steerPath, 0); + int nsteerPath = steerPath.Count; + if (nsteerPath == 0) + return false; + + //find vertex far enough to steer to + int ns = 0; + while (ns < nsteerPath) + { + if ((steerPath[ns].Flags & StraightPathFlags.OffMeshConnection) != 0 || + !InRange(steerPath[ns].Point.Position, startPos, minTargetDist, 1000.0f)) + break; + + ns++; + } + + //failed to find good point to steer to + if (ns >= nsteerPath) + return false; + + steerPos = steerPath[ns].Point.Position; + steerPos.Y = startPos.Y; + steerPosFlag = steerPath[ns].Flags; + if (steerPosFlag == StraightPathFlags.None && ns == (nsteerPath - 1)) + steerPosFlag = StraightPathFlags.End; // otherwise seeks path infinitely!!! + steerPosRef = steerPath[ns].Point.Polygon; + + return true; + } + + private static bool InRange(SharpNav.Geometry.Vector3 v1, SharpNav.Geometry.Vector3 v2, float r, float h) + { + float dx = v2.X - v1.X; + float dy = v2.Y - v1.Y; + float dz = v2.Z - v1.Z; + return (dx * dx + dz * dz) < (r * r) && Math.Abs(dy) < h; + } + #endregion + + public static Vector3 GamePosToNavmeshPos(float x, float y, float z) + { + return new Vector3(x, -z, y); + } + + public static Vector3 NavmeshPosToGamePos(float x, float y, float z) + { + return new Vector3(x, z, -y); + } + + } +} diff --git a/FFXIVClassic World Server/App.config b/FFXIVClassic World Server/App.config index 329f3599..0860683f 100644 --- a/FFXIVClassic World Server/App.config +++ b/FFXIVClassic World Server/App.config @@ -1,7 +1,7 @@ - + diff --git a/FFXIVClassic World Server/DataObjects/Session.cs b/FFXIVClassic World Server/DataObjects/Session.cs index 0358c9e5..4746f659 100644 --- a/FFXIVClassic World Server/DataObjects/Session.cs +++ b/FFXIVClassic World Server/DataObjects/Session.cs @@ -1,13 +1,4 @@ -using FFXIVClassic.Common; -using FFXIVClassic_World_Server.DataObjects.Group; -using FFXIVClassic_World_Server.Packets.Send.Subpackets; -using FFXIVClassic_World_Server.Packets.Send.Subpackets.Groups; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net.Sockets; -using System.Text; -using System.Threading.Tasks; +using FFXIVClassic_World_Server.Packets.Send.Subpackets; namespace FFXIVClassic_World_Server.DataObjects { diff --git a/FFXIVClassic World Server/FFXIVClassic World Server.csproj b/FFXIVClassic World Server/FFXIVClassic World Server.csproj index 1ea63867..affed8c5 100644 --- a/FFXIVClassic World Server/FFXIVClassic World Server.csproj +++ b/FFXIVClassic World Server/FFXIVClassic World Server.csproj @@ -9,7 +9,7 @@ Properties FFXIVClassic_World_Server FFXIVClassic World Server - v4.5 + v4.5.1 512 true @@ -48,15 +48,31 @@ prompt 4 + + true + bin\Debug\ + DEBUG;TRACE + full + x64 + prompt + MinimumRecommendedRules.ruleset + true + + + bin\x64\Release\ + TRACE + true + pdbonly + x64 + prompt + MinimumRecommendedRules.ruleset + true + ..\packages\Cyotek.CircularBuffer.1.0.0.0\lib\net20\Cyotek.Collections.Generic.CircularBuffer.dll True - - ..\packages\Dapper.1.42\lib\net45\Dapper.dll - True - ..\packages\MySql.Data.6.9.8\lib\net45\MySql.Data.dll True diff --git a/FFXIVClassic World Server/Server.cs b/FFXIVClassic World Server/Server.cs index efc7a6e6..1dddb069 100644 --- a/FFXIVClassic World Server/Server.cs +++ b/FFXIVClassic World Server/Server.cs @@ -172,6 +172,7 @@ namespace FFXIVClassic_World_Server if (subpacket.gameMessage.opcode != 0x1 && subpacket.gameMessage.opcode != 0xca) subpacket.DebugPrintSubPacket(); + if (subpacket.gameMessage.opcode >= 0x1000) { //subpacket.DebugPrintSubPacket(); diff --git a/FFXIVClassic World Server/packages.config b/FFXIVClassic World Server/packages.config index e99b9209..d1ec938c 100644 --- a/FFXIVClassic World Server/packages.config +++ b/FFXIVClassic World Server/packages.config @@ -1,7 +1,6 @@  - diff --git a/FFXIVClassic.sln b/FFXIVClassic.sln index 4a0fe45b..6f1f6f32 100644 --- a/FFXIVClassic.sln +++ b/FFXIVClassic.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.23107.0 +# Visual Studio 2013 +VisualStudioVersion = 12.0.31101.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FFXIVClassic Map Server", "FFXIVClassic Map Server\FFXIVClassic Map Server.csproj", "{E8FA2784-D4B9-4711-8CC6-712A4B1CD54F}" ProjectSection(ProjectDependencies) = postProject @@ -25,31 +25,56 @@ EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {E8FA2784-D4B9-4711-8CC6-712A4B1CD54F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E8FA2784-D4B9-4711-8CC6-712A4B1CD54F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E8FA2784-D4B9-4711-8CC6-712A4B1CD54F}.Debug|x64.ActiveCfg = Debug|x64 + {E8FA2784-D4B9-4711-8CC6-712A4B1CD54F}.Debug|x64.Build.0 = Debug|x64 {E8FA2784-D4B9-4711-8CC6-712A4B1CD54F}.Release|Any CPU.ActiveCfg = Release|Any CPU {E8FA2784-D4B9-4711-8CC6-712A4B1CD54F}.Release|Any CPU.Build.0 = Release|Any CPU + {E8FA2784-D4B9-4711-8CC6-712A4B1CD54F}.Release|x64.ActiveCfg = Release|x64 + {E8FA2784-D4B9-4711-8CC6-712A4B1CD54F}.Release|x64.Build.0 = Release|x64 {703091E0-F69C-4177-8FAE-C258AC6A65AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {703091E0-F69C-4177-8FAE-C258AC6A65AA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {703091E0-F69C-4177-8FAE-C258AC6A65AA}.Debug|x64.ActiveCfg = Debug|x64 + {703091E0-F69C-4177-8FAE-C258AC6A65AA}.Debug|x64.Build.0 = Debug|x64 {703091E0-F69C-4177-8FAE-C258AC6A65AA}.Release|Any CPU.ActiveCfg = Release|Any CPU {703091E0-F69C-4177-8FAE-C258AC6A65AA}.Release|Any CPU.Build.0 = Release|Any CPU + {703091E0-F69C-4177-8FAE-C258AC6A65AA}.Release|x64.ActiveCfg = Release|x64 + {703091E0-F69C-4177-8FAE-C258AC6A65AA}.Release|x64.Build.0 = Release|x64 {3A3D6626-C820-4C18-8C81-64811424F20E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3A3D6626-C820-4C18-8C81-64811424F20E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3A3D6626-C820-4C18-8C81-64811424F20E}.Debug|x64.ActiveCfg = Debug|x64 + {3A3D6626-C820-4C18-8C81-64811424F20E}.Debug|x64.Build.0 = Debug|x64 {3A3D6626-C820-4C18-8C81-64811424F20E}.Release|Any CPU.ActiveCfg = Release|Any CPU {3A3D6626-C820-4C18-8C81-64811424F20E}.Release|Any CPU.Build.0 = Release|Any CPU + {3A3D6626-C820-4C18-8C81-64811424F20E}.Release|x64.ActiveCfg = Release|x64 + {3A3D6626-C820-4C18-8C81-64811424F20E}.Release|x64.Build.0 = Release|x64 {3067889D-8A50-40D6-9CD5-23AA8EA96F26}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3067889D-8A50-40D6-9CD5-23AA8EA96F26}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3067889D-8A50-40D6-9CD5-23AA8EA96F26}.Debug|x64.ActiveCfg = Debug|x64 + {3067889D-8A50-40D6-9CD5-23AA8EA96F26}.Debug|x64.Build.0 = Debug|x64 {3067889D-8A50-40D6-9CD5-23AA8EA96F26}.Release|Any CPU.ActiveCfg = Release|Any CPU {3067889D-8A50-40D6-9CD5-23AA8EA96F26}.Release|Any CPU.Build.0 = Release|Any CPU + {3067889D-8A50-40D6-9CD5-23AA8EA96F26}.Release|x64.ActiveCfg = Release|x64 + {3067889D-8A50-40D6-9CD5-23AA8EA96F26}.Release|x64.Build.0 = Release|x64 {0FFA9D2F-41C6-443C-99B7-665702CF548F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {0FFA9D2F-41C6-443C-99B7-665702CF548F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0FFA9D2F-41C6-443C-99B7-665702CF548F}.Debug|x64.ActiveCfg = Debug|x64 + {0FFA9D2F-41C6-443C-99B7-665702CF548F}.Debug|x64.Build.0 = Debug|x64 {0FFA9D2F-41C6-443C-99B7-665702CF548F}.Release|Any CPU.ActiveCfg = Release|Any CPU {0FFA9D2F-41C6-443C-99B7-665702CF548F}.Release|Any CPU.Build.0 = Release|Any CPU + {0FFA9D2F-41C6-443C-99B7-665702CF548F}.Release|x64.ActiveCfg = Release|x64 + {0FFA9D2F-41C6-443C-99B7-665702CF548F}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {F350E848-7622-48E1-87DC-4C2B1596122B} + EndGlobalSection EndGlobal diff --git a/Launcher Editor/Launcher Editor.csproj b/Launcher Editor/Launcher Editor.csproj index c1a98e86..7a304e49 100644 --- a/Launcher Editor/Launcher Editor.csproj +++ b/Launcher Editor/Launcher Editor.csproj @@ -32,6 +32,26 @@ prompt 4 + + true + bin\Debug\ + DEBUG;TRACE + full + x64 + prompt + MinimumRecommendedRules.ruleset + true + + + bin\x64\Release\ + TRACE + true + pdbonly + x64 + prompt + MinimumRecommendedRules.ruleset + true + diff --git a/data/scripts/ability.lua b/data/scripts/ability.lua new file mode 100644 index 00000000..b3d59883 --- /dev/null +++ b/data/scripts/ability.lua @@ -0,0 +1,58 @@ +-- todo: add enums for status effects in global.lua +require("global") +require("battleutils") + +--[[ + statId - see BattleTemp.cs + modifier - Modifier.Intelligence, Modifier.Mind (see Modifier.cs) + multiplier - + ]] +function HandleHealingSkill(caster, target, skill, action, statId, modifierId, multiplier, baseAmount) + potency = potency or 1.0; + healAmount = baseAmount; + + -- todo: shit based on mnd + local mind = caster.GetMod(Modifier.Mind); +end; + +function HandleAttackSkill(caster, target, skill, action, statId, modifierId, multiplier, baseAmount) + -- todo: actually handle this + damage = baseAmount or math.random(1,10) * 10; + + return damage; +end; + +function HandleStoneskin(caster, target, skill, action, statId, modifierId, damage) + --[[ + if target.statusEffects.HasStatusEffect(StatusEffect.Stoneskin) then + -- todo: damage reduction + return true; + end; + ]] + return false; +end; + +--For abilities that inflict statuses, like aegis boon or taunt +function onStatusAbilityFinish(caster, target, skill, action) + --action.CalcHitType(caster, target, skill); + action.DoAction(caster, target, skill); + action.TryStatus(caster, target, skill, false); + + return action.amount; +end; + +function onAttackAbilityFinish(caster, target, skill, action) + local damage = math.random(50, 150); + action.amount = damage; + action.DoAction(caster, target, skill); + + return action.amount; +end; + +function onHealAbilityFinish(caster, target, skill, action) + local amount = math.random(150, 250); + action.amount = amount; + action.DoAction(caster, target, skill); + action.TryStatus(caster, target, skill, true); + return action.amount; +end; \ No newline at end of file diff --git a/data/scripts/ally.lua b/data/scripts/ally.lua new file mode 100644 index 00000000..e1e06d30 --- /dev/null +++ b/data/scripts/ally.lua @@ -0,0 +1,117 @@ +require ("global") +require ("magic") +require ("weaponskill") + +allyGlobal = +{ +} + +function allyGlobal.onSpawn(ally, target) + +end + +function allyGlobal.onEngage(ally, target) + +end + +function allyGlobal.onAttack(ally, target, damage) + +end + +function allyGlobal.onDamageTaken(ally, attacker, damage) + +end + +function allyGlobal.onCombatTick(ally, target, tick, contentGroupCharas) + allyGlobal.HelpPlayers(ally, contentGroupCharas) +end + +function allyGlobal.onDeath(ally, player, lastAttacker) + +end + +function allyGlobal.onDespawn(ally) + +end + +function allyGlobal.HelpPlayers(ally, contentGroupCharas, pickRandomTarget) + print("helpPlayers"); + if contentGroupCharas and not ally.IsEngaged() then + print("contentGroup exists"); + for chara in contentGroupCharas do + print("looping"); + if chara then + -- probably a player, or another ally + -- todo: queue support actions, heal, try pull hate off player etc + if chara.IsPlayer() then + print("chara is a player"); + -- do stuff + if not ally.IsEngaged() then + if chara.IsEngaged() then + allyGlobal.EngageTarget(ally, chara.target, nil); + break; + end + end + elseif chara.IsMonster() and chara.IsEngaged() then + if not ally.IsEngaged() then + print("Engaging monster that is engaged"); + allyGlobal.EngageTarget(ally, chara, nil); + break; + end + end + end + end + end +end + +function allyGlobal.tryAggro(ally, contentGroupCharas) + local count = 0; + if contentGroupCharas and not ally.IsEngaged() then + for i = 0, #contentGroupCharas - 1 do + if contentGroupCharas[i] and ally then + if contentGroupCharas[i].IsPlayer() then + -- probably a player, or another ally + -- todo: queue support actions, heal, try pull hate off player etc + if contentGroupCharas[i].target then + if ally.aiContainer:GetTargetFind():CanTarget(contentGroupCharas[i].target) and contentGroupCharas[i].target.IsMonster() and contentGroupCharas[i].target.hateContainer:HasHateForTarget(contentGroupCharas[i]) then + -- do stuff + allyGlobal.EngageTarget(ally, contentGroupCharas[i].target, nil); + break; + end + end + elseif contentGroupCharas[i].IsMonster() and contentGroupCharas[i].IsEngaged() then + if not ally.IsEngaged() then + print("Engaging monster that is engaged"); + allyGlobal.EngageTarget(ally, contentGroupCharas[i], nil); + break; + end + end + end + end + end +end + +function allyGlobal.HealPlayer(ally, player) + +end + +function allyGlobal.SupportAction(ally, player) + +end + +function allyGlobal.EngageTarget(ally, target, contentGroupCharas) + if contentGroupCharas then + for chara in contentGroupCharas do + if chara.IsMonster() then + if chara.allegiance ~= ally.allegiance then + ally.Engage(chara) + break; + end + end + end + elseif target then + print("Engaging"); + ally.Engage(target) + ally.hateContainer.AddBaseHate(target); + end +end \ No newline at end of file diff --git a/data/scripts/battlenpc.lua b/data/scripts/battlenpc.lua new file mode 100644 index 00000000..542e0aae --- /dev/null +++ b/data/scripts/battlenpc.lua @@ -0,0 +1,175 @@ +local initClassItems, initRaceItems; + +function onBeginLogin(player) + --New character, set the initial quest + if (player:GetPlayTime(false) == 0) then + initialTown = player:GetInitialTown(); + + if (initialTown == 1 and player:HasQuest(110001) == false) then + player:AddQuest(110001); + player:SetHomePoint(1280001); + elseif (initialTown == 2 and player:HasQuest(110005) == false) then + player:AddQuest(110005); + player:SetHomePoint(1280061); + elseif (initialTown == 3 and player:HasQuest(110009) == false) then + player:AddQuest(110009); + player:SetHomePoint(1280031); + end + + end + + --For Opening. Set Director and reset position incase d/c + if (player:HasQuest(110001) == true and player:GetZoneID() == 193) then + director = player:GetZone():CreateDirector("OpeningDirector", false); + player:AddDirector(director); + director:StartDirector(true); + player:SetLoginDirector(director); + player:KickEvent(director, "noticeEvent", true); + + player.positionX = 0.016; + player.positionY = 10.35; + player.positionZ = -36.91; + player.rotation = 0.025; + player:GetQuest(110001):ClearQuestData(); + player:GetQuest(110001):ClearQuestFlags(); + elseif (player:HasQuest(110005) == true and player:GetZoneID() == 166) then + director = player:GetZone():CreateDirector("OpeningDirector", false); + player:AddDirector(director); + director:StartDirector(false); + player:SetLoginDirector(director); + player:KickEvent(director, "noticeEvent", true); + + player.positionX = 369.5434; + player.positionY = 4.21; + player.positionZ = -706.1074; + player.rotation = -1.26721; + player:GetQuest(110005):ClearQuestData(); + player:GetQuest(110005):ClearQuestFlags(); + elseif (player:HasQuest(110009) == true and player:GetZoneID() == 184) then + --director = player:GetZone():CreateDirector("OpeningDirector", false); + --player:AddDirector(director); + --director:StartDirector(false); + --player:SetLoginDirector(director); + --player:KickEvent(director, "noticeEvent", true); + -- + player.positionX = 5.364327; + player.positionY = 196.0; + player.positionZ = 133.6561; + player.rotation = -2.849384; + player:GetQuest(110009):ClearQuestData(); + player:GetQuest(110009):ClearQuestFlags(); + end +end + +function onLogin(player) + + if (player:GetPlayTime(false) == 0) then + player:SendMessage(0x1D,"",">PlayTime == 0, new player!"); + + initClassItems(player); + initRaceItems(player); + + player:SavePlayTime(); + end + +end + +function initClassItems(player) + + local slotTable; + local invSlotTable; + + --DoW + if (player.charaWork.parameterSave.state_mainSkill[0] == 2) then --PUG + player:GetInventory(0):AddItem({4020001, 8030701, 8050728, 8080601, 8090307}); + player:GetEquipment():SetEquipment({0, 10, 12, 14, 15},{0, 1, 2, 3, 4}); + elseif (player.charaWork.parameterSave.state_mainSkill[0] == 3) then --GLA + player:GetInventory(0):AddItem({4030010, 8031120, 8050245, 8080601, 8090307}); + player:GetEquipment():SetEquipment({0, 10, 12, 14, 15},{0, 1, 2, 3, 4}); + elseif (player.charaWork.parameterSave.state_mainSkill[0] == 4) then --MRD + player:GetInventory(0):AddItem({4040001, 8011001, 8050621, 8070346, 8090307}); + player:GetEquipment():SetEquipment({0, 8, 12, 13, 15},{0, 1, 2, 3, 4}); + elseif (player.charaWork.parameterSave.state_mainSkill[0] == 7) then --ARC + player:GetInventory(0):AddItem({4070001, 8030601, 8050622, 8080601, 8090307}); + player:GetEquipment():SetEquipment({0, 10, 12, 14, 15},{0, 1, 2, 3, 4}); + elseif (player.charaWork.parameterSave.state_mainSkill[0] == 8) then --LNC + player:GetInventory(0):AddItem({4080201, 8030801, 8051015, 8080501, 8090307}); + player:GetEquipment():SetEquipment({0, 10, 12, 14, 15},{0, 1, 2, 3, 4}); + --DoM + elseif (player.charaWork.parameterSave.state_mainSkill[0] == 22) then --THM + player:GetInventory(0):AddItem({5020001, 8030245, 8050346, 8080346, 8090208}); + player:GetEquipment():SetEquipment({0, 10, 12, 14, 15},{0, 1, 2, 3, 4}); + elseif (player.charaWork.parameterSave.state_mainSkill[0] == 23) then --CNJ + player:GetInventory(0):AddItem({5030101, 8030445, 8050031, 8080246, 8090208}); + player:GetEquipment():SetEquipment({0, 10, 12, 14, 15},{0, 1, 2, 3, 4}); + + --DoH + elseif (player.charaWork.parameterSave.state_mainSkill[0] == 29) then -- + elseif (player.charaWork.parameterSave.state_mainSkill[0] == 30) then -- + elseif (player.charaWork.parameterSave.state_mainSkill[0] == 31) then -- + elseif (player.charaWork.parameterSave.state_mainSkill[0] == 32) then -- + elseif (player.charaWork.parameterSave.state_mainSkill[0] == 33) then -- + elseif (player.charaWork.parameterSave.state_mainSkill[0] == 34) then -- + elseif (player.charaWork.parameterSave.state_mainSkill[0] == 35) then -- + elseif (player.charaWork.parameterSave.state_mainSkill[0] == 36) then -- + + --DoL + elseif (player.charaWork.parameterSave.state_mainSkill[0] == 39) then --MIN + elseif (player.charaWork.parameterSave.state_mainSkill[0] == 40) then --BTN + elseif (player.charaWork.parameterSave.state_mainSkill[0] == 41) then --FSH + end + +end + +function initRaceItems(player) + + if (player.playerWork.tribe == 1) then --Hyur Midlander Male + player:GetInventory(0):AddItem(8040001); + player:GetInventory(0):AddItem(8060001); + elseif (player.playerWork.tribe == 2) then --Hyur Midlander Female + player:GetInventory(0):AddItem(8040002); + player:GetInventory(0):AddItem(8060002); + elseif (player.playerWork.tribe == 3) then --Hyur Highlander Male + player:GetInventory(0):AddItem(8040003); + player:GetInventory(0):AddItem(8060003); + elseif (player.playerWork.tribe == 4) then --Elezen Wildwood Male + player:GetInventory(0):AddItem(8040004); + player:GetInventory(0):AddItem(8060004); + elseif (player.playerWork.tribe == 5) then --Elezen Wildwood Female + player:GetInventory(0):AddItem(8040006); + player:GetInventory(0):AddItem(8060006); + elseif (player.playerWork.tribe == 6) then --Elezen Duskwight Male + player:GetInventory(0):AddItem(8040005); + player:GetInventory(0):AddItem(8060005); + elseif (player.playerWork.tribe == 7) then --Elezen Duskwight Female + player:GetInventory(0):AddItem(8040007); + player:GetInventory(0):AddItem(8060007); + elseif (player.playerWork.tribe == 8) then --Lalafell Plainsfolk Male + player:GetInventory(0):AddItem(8040008); + player:GetInventory(0):AddItem(8060008); + elseif (player.playerWork.tribe == 9) then --Lalafell Plainsfolk Female + player:GetInventory(0):AddItem(8040010); + player:GetInventory(0):AddItem(8060010); + elseif (player.playerWork.tribe == 10) then --Lalafell Dunesfolk Male + player:GetInventory(0):AddItem(8040009); + player:GetInventory(0):AddItem(8060009); + elseif (player.playerWork.tribe == 11) then --Lalafell Dunesfolk Female + player:GetInventory(0):AddItem(8040011); + player:GetInventory(0):AddItem(8060011); + elseif (player.playerWork.tribe == 12) then --Miqo'te Seekers of the Sun + player:GetInventory(0):AddItem(8040012); + player:GetInventory(0):AddItem(8060012); + elseif (player.playerWork.tribe == 13) then --Miqo'te Seekers of the Moon + player:GetInventory(0):AddItem(8040013); + player:GetInventory(0):AddItem(8060013); + elseif (player.playerWork.tribe == 14) then --Roegadyn Sea Wolf + player:GetInventory(0):AddItem(8040014); + player:GetInventory(0):AddItem(8060014); + elseif (player.playerWork.tribe == 15) then --Roegadyn Hellsguard + player:GetInventory(0):AddItem(8040015); + player:GetInventory(0):AddItem(8060015); + end + + player:GetEquipment():SetEquipment({9, 11},{5,6}); + +end \ No newline at end of file diff --git a/data/scripts/battleutils.lua b/data/scripts/battleutils.lua new file mode 100644 index 00000000..6cfe600e --- /dev/null +++ b/data/scripts/battleutils.lua @@ -0,0 +1,64 @@ +CommandType = +{ + None = 0, + AutoAttack = 1, + Weaponskill = 2, + Ability = 3, + Spell = 4 +} + +ActionType = +{ + None = 0, + Physical = 1, + Magic = 2, + Heal = 3, + Status = 4 +} + +ActionProperty = +{ + None = 0, + Physical = 1, + Magic = 2, + Heal = 4, + Status = 8, + Ranged = 16 +} + +DamageTakenType = +{ + None, + Attack, + Magic, + Weaponskill, + Ability +} + +HitDirection = +{ + None = 0, + Front = 1, + Right = 2, + Rear = 4, + Left = 8 +} + +HitType = +{ + Miss = 0, + Evade = 1, + Parry = 2, + Block = 3, + Resist = 4, + Hit = 5, + Crit = 6 +} + +TargetFindAOEType = +{ + None = 0, + Circle = 1, + Cone = 2, + Box = 3 +} \ No newline at end of file diff --git a/data/scripts/commands/Ability.lua b/data/scripts/commands/Ability.lua new file mode 100644 index 00000000..a9429e93 --- /dev/null +++ b/data/scripts/commands/Ability.lua @@ -0,0 +1,19 @@ +require ("global") +require ("utils") + +--[[ + +AttackWeaponSkill Script + +Finds the correct weaponskill subscript to fire when a weaponskill actor is activated. + +--]] + +local attackMagicHandlers = { + +} + +function onEventStarted(player, command, triggerName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8) + player.Ability(command.actorId, targetActor); + player:endEvent(); +end \ No newline at end of file diff --git a/data/scripts/commands/AbilityCure.lua b/data/scripts/commands/AbilityCure.lua new file mode 100644 index 00000000..98e2eec7 --- /dev/null +++ b/data/scripts/commands/AbilityCure.lua @@ -0,0 +1,5 @@ +require("global") + +function onEventStarted(player, command, triggerName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8) + +end \ No newline at end of file diff --git a/data/scripts/commands/ActivateCommand.lua b/data/scripts/commands/ActivateCommand.lua index 71c84183..5afd87dc 100644 --- a/data/scripts/commands/ActivateCommand.lua +++ b/data/scripts/commands/ActivateCommand.lua @@ -8,15 +8,13 @@ Switches between active and passive mode states --]] -function onEventStarted(player, command, triggerName) - - if (player:GetState() == 0) then - player:ChangeState(2); - elseif (player:GetState() == 2) then - player:ChangeState(0); +function onEventStarted(player, command, triggerName) + + if (player.currentMainState == 0x0000) then + player.Engage(0, 0x0002); + elseif (player.currentMainState == 0x0002) then + player.Disengage(0x0000); end player:endEvent(); - sendSignal("playerActive"); - -end \ No newline at end of file +end; \ No newline at end of file diff --git a/data/scripts/commands/AttackAbility.lua b/data/scripts/commands/AttackAbility.lua new file mode 100644 index 00000000..47b04053 --- /dev/null +++ b/data/scripts/commands/AttackAbility.lua @@ -0,0 +1,20 @@ +require ("global") +require ("utils") + +--[[ + +AttackWeaponSkill Script + +Finds the correct weaponskill subscript to fire when a weaponskill actor is activated. + +--]] + +local attackMagicHandlers = { + +} + +function onEventStarted(player, command, triggerName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8) + player.Ability(command.actorId, targetActor); + player:endEvent(); + +end \ No newline at end of file diff --git a/data/scripts/commands/AttackMagic.lua b/data/scripts/commands/AttackMagic.lua new file mode 100644 index 00000000..b5538141 --- /dev/null +++ b/data/scripts/commands/AttackMagic.lua @@ -0,0 +1,19 @@ +require ("global") +require ("utils") + +--[[ + +AttackWeaponSkill Script + +Finds the correct weaponskill subscript to fire when a weaponskill actor is activated. + +--]] + +local attackMagicHandlers = { + +} + +function onEventStarted(player, command, triggerName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8) + player.Cast(command.actorId, targetActor); + player:endEvent(); +end; \ No newline at end of file diff --git a/data/scripts/commands/AttackWeaponSkill.lua b/data/scripts/commands/AttackWeaponSkill.lua index 61fe969f..3a0e8ff2 100644 --- a/data/scripts/commands/AttackWeaponSkill.lua +++ b/data/scripts/commands/AttackWeaponSkill.lua @@ -9,80 +9,6 @@ Finds the correct weaponskill subscript to fire when a weaponskill actor is acti --]] -local function handlePummel(player, target) - player:SendMessage(0x20, "", "DOING PUMMEL!!!!"); - - params = {}; - params.range = 10.0; - params.recast = 10; - - params.hpCost = 0; - params.mpCost = 0; - params.tpCost = 1000; - - params.targetType = 2; - params.canCrit = true; - params.animationId = 0x12312312; - - -end - -local function handleSkullSunder(player) - player:SendMessage(0x20, "", "DOING SKULL SUNDER!!!!"); -end - -local weaponskillHandlers = { - [0xA0F069E6] = handlePummel, - [0xA0F069E7] = nil, - [0xA0F069E8] = nil, - [0xA0F069E9] = nil, - [0xA0F069EA] = nil, - [0xA0F069EB] = nil, - [0xA0F069EC] = nil, - [0xA0F069ED] = nil, - [0xA0F069EE] = nil, - [0xA0F069EF] = nil, - [0xA0F06A0E] = nil, - [0xA0F06A0F] = nil, - [0xA0F06A10] = nil, - [0xA0F06A11] = nil, - [0xA0F06A12] = nil, - [0xA0F06A13] = nil, - [0xA0F06A14] = nil, - [0xA0F06A15] = nil, - [0xA0F06A16] = nil, - [0xA0F06A17] = nil, - [0xA0F06A36] = nil, - [0xA0F06A37] = handleSkullSunder, - [0xA0F06A38] = nil, - [0xA0F06A39] = nil, - [0xA0F06A3A] = nil, - [0xA0F06A3B] = nil, - [0xA0F06A3C] = nil, - [0xA0F06A3D] = nil, - [0xA0F06A3E] = nil, - [0xA0F06A3F] = nil, - [0xA0F06A5C] = nil, - [0xA0F06A5D] = nil, - [0xA0F06A5E] = nil, - [0xA0F06A60] = nil, - [0xA0F06A61] = nil, - [0xA0F06A62] = nil, - [0xA0F06A63] = nil, - [0xA0F06A64] = nil, - [0xA0F06A85] = nil, - [0xA0F06A86] = nil, - [0xA0F06A87] = nil, - [0xA0F06A88] = nil, - [0xA0F06A89] = nil, - [0xA0F06A8A] = nil, - [0xA0F06A8B] = nil, - [0xA0F06A8C] = nil, - [0xA0F06A8D] = nil, - [0xA0F06A8E] = nil, - [0xA0F06A8F] = nil -} - function onEventStarted(player, command, triggerName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8) --Are they in active mode? @@ -92,27 +18,9 @@ function onEventStarted(player, command, triggerName, arg1, arg2, arg3, arg4, ta return; end - --Does the target exist - target = player:getZone():FindActorInArea(targetActor); - if (target == nil) then - player:SendGameMessage(GetWorldMaster(), 30203, 0x20); - player:endEvent(); - return; - end - - --Are you too far away? - if (getDistanceBetweenActors(player, target) > 7) then - player:SendGameMessage(GetWorldMaster(), 32539, 0x20); - player:endEvent(); - return; - end - - if (weaponskillHandlers[command.actorId] ~= nil) then - weaponskillHandlers[command.actorId](player); - else - player:SendMessage(0x20, "", "That weaponskill is not implemented yet."); - end - - player:endEvent(); - -end \ No newline at end of file + if not player.aiContainer.IsEngaged() then + player.Engage(targetActor); + end; + player.WeaponSkill(command.actorId, targetActor); + player:endEvent(); +end; \ No newline at end of file diff --git a/data/scripts/commands/ChangeJobCommand.lua b/data/scripts/commands/ChangeJobCommand.lua new file mode 100644 index 00000000..4cb38f6a --- /dev/null +++ b/data/scripts/commands/ChangeJobCommand.lua @@ -0,0 +1,6 @@ +function onEventStarted(player, caller, commandRequest, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) + + player:SetCurrentJob(17); + + player:EndEvent(); +end \ No newline at end of file diff --git a/data/scripts/commands/CureMagic.lua b/data/scripts/commands/CureMagic.lua new file mode 100644 index 00000000..a349c17a --- /dev/null +++ b/data/scripts/commands/CureMagic.lua @@ -0,0 +1,5 @@ +function onEventStarted(player, command, triggerName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8) + player.Cast(command.actorId, targetActor); + + player:endEvent(); +end \ No newline at end of file diff --git a/data/scripts/commands/CuregaMagic.lua b/data/scripts/commands/CuregaMagic.lua new file mode 100644 index 00000000..a349c17a --- /dev/null +++ b/data/scripts/commands/CuregaMagic.lua @@ -0,0 +1,5 @@ +function onEventStarted(player, command, triggerName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8) + player.Cast(command.actorId, targetActor); + + player:endEvent(); +end \ No newline at end of file diff --git a/data/scripts/commands/DevideAttackWeaponSkill.lua b/data/scripts/commands/DevideAttackWeaponSkill.lua new file mode 100644 index 00000000..3a0e8ff2 --- /dev/null +++ b/data/scripts/commands/DevideAttackWeaponSkill.lua @@ -0,0 +1,26 @@ +require ("global") +require ("utils") + +--[[ + +AttackWeaponSkill Script + +Finds the correct weaponskill subscript to fire when a weaponskill actor is activated. + +--]] + +function onEventStarted(player, command, triggerName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8) + + --Are they in active mode? + if (player:GetState() != 2) then + player:SendGameMessage(GetWorldMaster(), 32503, 0x20); + player:endEvent(); + return; + end + + if not player.aiContainer.IsEngaged() then + player.Engage(targetActor); + end; + player.WeaponSkill(command.actorId, targetActor); + player:endEvent(); +end; \ No newline at end of file diff --git a/data/scripts/commands/EffectMagic.lua b/data/scripts/commands/EffectMagic.lua new file mode 100644 index 00000000..a349c17a --- /dev/null +++ b/data/scripts/commands/EffectMagic.lua @@ -0,0 +1,5 @@ +function onEventStarted(player, command, triggerName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8) + player.Cast(command.actorId, targetActor); + + player:endEvent(); +end \ No newline at end of file diff --git a/data/scripts/commands/EquipAbilityCommand.lua b/data/scripts/commands/EquipAbilityCommand.lua new file mode 100644 index 00000000..2a92841e --- /dev/null +++ b/data/scripts/commands/EquipAbilityCommand.lua @@ -0,0 +1,85 @@ +require ("global") +--player: Player that called this command +--equipAbilityWidget: Widget that calls this command +--triggername: Event Starter ? +--slot: Which slot the ability will go into +--commandid: command being equipped + + +function onEventStarted(player, equipAbilityWidget, triggername, slot, commandid, unkown, arg1, arg2, arg3, arg4, arg5, arg6) + local worldManager = GetWorldManager(); + local ability = worldManager:GetBattleCommand(commandid); + + + --Equip + if (commandid > 0) then + --[[]] + --Can the player equip any more cross class actions + if (player.charaWork.parameterTemp.otherClassAbilityCount[0] >= player.charaWork.parameterTemp.otherClassAbilityCount[1]) then + --"You cannot set any more actions." + player:SendGameMessage(GetWorldMaster(), 30720, 0x20, 0, 0); + player:endEvent(); + return; + end + + --Is the player high enough level in that class to equip the ability + if (player.charaWork.battleSave.skillLevel[ability.job - 1] < ability.level) then + --"You have not yet acquired that action." + player:SendGameMessage(GetWorldMaster(), 30742, 0x20, 0, 0); + player:endEvent(); + return; + end + + + local oldSlot = player:FindFirstCommandSlotById(commandid); + local isEquipped = oldSlot < player.charaWork.commandBorder + 30; + --If slot is 0, find the first open slot + if (slot == 0) then + --If the ability is already equipped and slot is 0, then it can't be equipped again + --If the slot isn't 0, it's a move or a swap command + if (isEquipped == true) then + --"That action is already set to an action slot." + player:SendGameMessage(GetWorldMaster(), 30719, 0x20, 0); + player:endEvent(); + return; + end + + slot = player:FindFirstCommandSlotById(0) - player.charaWork.commandBorder; + + --If the first open slot is outside the hotbar, then the hotbar is full + if(slot >= 30) then + --"You cannot set any more actions." + player:SendGameMessage(Server.GetWorldManager().GetActor(), 30720, 0x20, 0); + player:endEvent(); + return; + end + else + slot = slot - 1; + end + + if(isEquipped == true) then + player:SwapAbilities(oldSlot, slot + player.charaWork.commandBorder); + else + local tslot = slot + player.charaWork.commandBorder; + player:EquipAbility(player.GetCurrentClassOrJob(), commandid, tslot, true); + end + + --Unequip + elseif (commandid == 0) then + commandid = player.charaWork.command[slot + player.charaWork.commandBorder - 1]; + ability = worldManager.GetBattleCommand(commandid); + --Is the ability a part of the player's current class? + --This check isn't correct because of jobs having different ids + local classId = player:GetCurrentClassOrJob(); + local jobId = player:ConvertClassIdToJobId(classId); + + if(ability.job == classId or ability.job == jobId) then + --"Actions of your current class or job cannot be removed." + player:SendGameMessage(GetWorldMaster(), 30745, 0x20, 0, 0); + elseif (commandid != 0) then + player:UnequipAbility(slot); + end + end + + player:endEvent(); +end \ No newline at end of file diff --git a/data/scripts/commands/EquipCommand.lua b/data/scripts/commands/EquipCommand.lua index c9894c91..0713d1f2 100644 --- a/data/scripts/commands/EquipCommand.lua +++ b/data/scripts/commands/EquipCommand.lua @@ -145,6 +145,12 @@ function equipItem(player, equipSlot, item) --Item Equipped message player:SendGameMessage(player, worldMaster, 30601, 0x20, equipSlot+1, item.itemId, item.quality, 0, 0, 1); + --Load gearset for new class and begin class change + if (classId ~= nil) then + loadGearset(player, classId); + player:DoClassChange(classId); + end + player:GetEquipment():Equip(equipSlot, item); if (equipSlot == EQUIPSLOT_MAINHAND and gItem:IsNailWeapon() == false) then graphicSlot = GRAPHICSLOT_MAINHAND; @@ -170,14 +176,7 @@ function equipItem(player, equipSlot, item) elseif (equipSlot == EQUIPSLOT_EARS) then player:GraphicChange(GRAPHICSLOT_R_EAR, item); player:GraphicChange(GRAPHICSLOT_L_EAR, item); - end - - --Load gearset for new class and begin class change - if (classId ~= nil) then - loadGearset(player, classId); - player:DoClassChange(classId); - end - + end end end diff --git a/data/scripts/commands/PointSearchAbility.lua b/data/scripts/commands/PointSearchAbility.lua new file mode 100644 index 00000000..ee05e8c4 --- /dev/null +++ b/data/scripts/commands/PointSearchAbility.lua @@ -0,0 +1,7 @@ + +function onEventStarted(player, command, triggerName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8) + + + player.Cast(command.actorId, targetActor); + player:endEvent(); +end \ No newline at end of file diff --git a/data/scripts/commands/RaiseMagic.lua b/data/scripts/commands/RaiseMagic.lua new file mode 100644 index 00000000..a349c17a --- /dev/null +++ b/data/scripts/commands/RaiseMagic.lua @@ -0,0 +1,5 @@ +function onEventStarted(player, command, triggerName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8) + player.Cast(command.actorId, targetActor); + + player:endEvent(); +end \ No newline at end of file diff --git a/data/scripts/commands/ShotCommand.lua b/data/scripts/commands/ShotCommand.lua new file mode 100644 index 00000000..8397d8c9 --- /dev/null +++ b/data/scripts/commands/ShotCommand.lua @@ -0,0 +1,15 @@ +require ("global") +require ("utils") + +--[[ + +AttackWeaponSkill Script + +Finds the correct weaponskill subscript to fire when a weaponskill actor is activated. + +--]] + +function onEventStarted(player, command, triggerName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8) + player.Ability(command.actorId, targetActor); + player:endEvent(); +end; \ No newline at end of file diff --git a/data/scripts/commands/SongMagic.lua b/data/scripts/commands/SongMagic.lua new file mode 100644 index 00000000..b5538141 --- /dev/null +++ b/data/scripts/commands/SongMagic.lua @@ -0,0 +1,19 @@ +require ("global") +require ("utils") + +--[[ + +AttackWeaponSkill Script + +Finds the correct weaponskill subscript to fire when a weaponskill actor is activated. + +--]] + +local attackMagicHandlers = { + +} + +function onEventStarted(player, command, triggerName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8) + player.Cast(command.actorId, targetActor); + player:endEvent(); +end; \ No newline at end of file diff --git a/data/scripts/commands/TeleportCommand.lua b/data/scripts/commands/TeleportCommand.lua index 8c4bcd55..b3a1b310 100644 --- a/data/scripts/commands/TeleportCommand.lua +++ b/data/scripts/commands/TeleportCommand.lua @@ -91,7 +91,7 @@ function onEventStarted(player, actor, triggerName, isTeleport) local choice, isInn = callClientFunction(player, "delegateCommand", actor, "eventConfirm", true, false, player:GetHomePointInn(), player:GetHomePoint(), false); if (choice == 1) then player:PlayAnimation(0x4000FFB); - player:SendGameMessage(worldMaster, 34104, 0x20); + player:SendGameMessage(worldMaster, 34104, 0x20); if (isInn) then --Return to Inn if (player:GetHomePointInn() == 1) then @@ -107,7 +107,14 @@ function onEventStarted(player, actor, triggerName, isTeleport) if (destination ~= nil) then randoPos = getRandomPointInBand(destination[2], destination[4], 3, 5); rotation = getAngleFacing(randoPos.x, randoPos.y, destination[2], destination[4]); + --bandaid fix for returning while dead, missing things like weakness and the heal number + if (player:GetHP() == 0) then + player:SetHP(player.GetMaxHP()); + player:ChangeState(0); + player:PlayAnimation(0x01000066); + end GetWorldManager():DoZoneChange(player, destination[1], nil, 0, 2, randoPos.x, destination[3], randoPos.y, rotation); + end end end diff --git a/data/scripts/commands/ability/aegis_boon.lua b/data/scripts/commands/ability/aegis_boon.lua new file mode 100644 index 00000000..84d41871 --- /dev/null +++ b/data/scripts/commands/ability/aegis_boon.lua @@ -0,0 +1,18 @@ +require("global"); +require("ability"); + +function onAbilityPrepare(caster, target, ability) + return 0; +end; + +function onAbilityStart(caster, target, ability) + --27164: Swift Aegis Boon + if caster.HasTrait(27164) then + ability.recastTimeMs = ability.recastTimeMs - 15000; + end + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/ability/barrage.lua b/data/scripts/commands/ability/barrage.lua new file mode 100644 index 00000000..3cbd270d --- /dev/null +++ b/data/scripts/commands/ability/barrage.lua @@ -0,0 +1,22 @@ +require("global"); +require("ability"); + +function onAbilityPrepare(caster, target, ability) + return 0; +end; + +function onAbilityStart(caster, target, ability) + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + skill.statusMagnitude = 4; + + --27242: Enhanced Barrage: Adds an additional attack to barrage ( 4 -> 5 ) + if caster.HasTrait(27242) then + skill.statusMagnitude = 5; + end + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/ability/battle_voice.lua b/data/scripts/commands/ability/battle_voice.lua new file mode 100644 index 00000000..cecc4d45 --- /dev/null +++ b/data/scripts/commands/ability/battle_voice.lua @@ -0,0 +1,19 @@ +require("global"); +require("ability"); + +function onAbilityPrepare(caster, target, ability) + return 0; +end; + +function onAbilityStart(caster, target, ability) + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --Only the bard gets the Battle Voice effect + if caster == target then + actionContainer.AddAction(caster.statusEffects.AddStatusForBattleAction(223253, 1, 0, 30)); + end + + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/ability/berserk.lua b/data/scripts/commands/ability/berserk.lua new file mode 100644 index 00000000..5163866b --- /dev/null +++ b/data/scripts/commands/ability/berserk.lua @@ -0,0 +1,19 @@ +require("global"); +require("ability"); + +function onAbilityPrepare(caster, target, ability) + return 0; +end; + +function onAbilityStart(caster, target, ability) + --27205: Enhanced Berserk: Increases the effect of Berserk by 20% + if caster.HasTrait(27205) then + ability.statusTier = 2; + end + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/ability/blindside.lua b/data/scripts/commands/ability/blindside.lua new file mode 100644 index 00000000..a3182ea8 --- /dev/null +++ b/data/scripts/commands/ability/blindside.lua @@ -0,0 +1,19 @@ +require("global"); +require("ability"); + +function onAbilityPrepare(caster, target, ability) + return 0; +end; + +function onAbilityStart(caster, target, ability) + --27121: Enhanced Blindside + if caster.HasTrait(27121) then + ability.statusTier = 2; + end + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/ability/blissful_mind.lua b/data/scripts/commands/ability/blissful_mind.lua new file mode 100644 index 00000000..7af11cf1 --- /dev/null +++ b/data/scripts/commands/ability/blissful_mind.lua @@ -0,0 +1,43 @@ +require("global"); +require("ability"); + +function onAbilityPrepare(caster, target, ability) + return 0; +end; + +function onAbilityStart(caster, target, ability) + --27362: Enhanced Blissful Mind + if caster.HasTrait(27362) then + ability.statusTier = 2; + end + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --Blissful Mind + --223228: Blissful Mind + --223242: Fully Blissful Mind + local buff = caster.statusEffects.GetStatusEffectById(223228) or caster.statusEffects.GetStatusEffectById(223242); + + --If we have a buff then Blissful Mind removes that buff and restores MP. Otherwise, it adds the Blissful Mind effect + if buff ~= nil then + local amount = buff.GetExtra(); + local remAction = caster.statusEffects.RemoveStatusEffectForBattleAction(buff, 30329); + + caster.AddMP(amount); + + actionContainer.AddMPAction(caster.actorId, 33007, amount); + actionContainer.AddAction(remAction); + else + --Blissful mind takes 25% of CURRENT HP and begins storing MP up to that point, at which point the buff changes to indicate its full + local amount = caster.GetHP() * 0.25; + + caster.DelHP(amount); + skill.statusMagnitude = amount; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); + + end + +end; \ No newline at end of file diff --git a/data/scripts/commands/ability/blood_for_blood.lua b/data/scripts/commands/ability/blood_for_blood.lua new file mode 100644 index 00000000..e722cd9c --- /dev/null +++ b/data/scripts/commands/ability/blood_for_blood.lua @@ -0,0 +1,24 @@ +require("global"); +require("ability"); + +function onAbilityPrepare(caster, target, ability) + return 0; +end; + +function onAbilityStart(caster, target, ability) + --27283: Enhanced Blood for Blood: Increases damage dealt to enemies by B4B by 25% + if caster.HasTrait(27283) then + ability.statusTier = 2; + end + + --27284: Swift Blood for Blood: Reduces recast time of B4B by 15 seconds + if caster.HasTrait(27284) then + ability.recastTimeMs = ability.recastTimeMs - 15000; + end + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/ability/bloodbath.lua b/data/scripts/commands/ability/bloodbath.lua new file mode 100644 index 00000000..6ae86efa --- /dev/null +++ b/data/scripts/commands/ability/bloodbath.lua @@ -0,0 +1,19 @@ +require("global"); +require("ability"); + +function onAbilityPrepare(caster, target, ability) + return 0; +end; + +function onAbilityStart(caster, target, ability) + --27202: Swift Bloodbath + if caster.HasTrait(27202) then + ability.recastTimeMs = ability.recastTimeMs - 15000; + end + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/ability/chameleon.lua b/data/scripts/commands/ability/chameleon.lua new file mode 100644 index 00000000..92e6c1a5 --- /dev/null +++ b/data/scripts/commands/ability/chameleon.lua @@ -0,0 +1,18 @@ +require("global"); +require("ability"); + +function onAbilityPrepare(caster, target, ability) + return 0; +end; + +function onAbilityStart(caster, target, ability) + --27245: Swift Chameleon + if caster.HasTrait(27245) then + ability.recastTimeMs = ability.recastTimeMs - 60000; + end + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + target.hateContainer.UpdateHate(caster, -840); +end; \ No newline at end of file diff --git a/data/scripts/commands/ability/cleric_stance.lua b/data/scripts/commands/ability/cleric_stance.lua new file mode 100644 index 00000000..0cae6d8d --- /dev/null +++ b/data/scripts/commands/ability/cleric_stance.lua @@ -0,0 +1,15 @@ +require("global"); +require("ability"); + +function onAbilityPrepare(caster, target, ability) + return 0; +end; + +function onAbilityStart(caster, target, ability) + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/ability/collusion.lua b/data/scripts/commands/ability/collusion.lua new file mode 100644 index 00000000..a77587c3 --- /dev/null +++ b/data/scripts/commands/ability/collusion.lua @@ -0,0 +1,19 @@ +require("global"); +require("ability"); + +function onAbilityPrepare(caster, target, ability) + return 0; +end; + +function onAbilityStart(caster, target, ability) + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --8032701: Fighter's Gauntlets: Reduces Collusion cooldown by 10 seconds + if caster.HasItemEquippedInSlot(8032701, 13) then + skill.recastTimeMs = skill.recastTimeMs - 10000; + end + + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/ability/cover.lua b/data/scripts/commands/ability/cover.lua new file mode 100644 index 00000000..0f4be40a --- /dev/null +++ b/data/scripts/commands/ability/cover.lua @@ -0,0 +1,24 @@ +require("global"); +require("ability"); + +function onAbilityPrepare(caster, target, ability) + return 0; +end; + +function onAbilityStart(caster, target, ability) + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --This is for the "Cover" effect the caster receives. + local coverTier = 1 + --8032701: Gallant Surcoat: Enhances Cover + if caster.HasItemEquippedInSlot(8032701, 10) then + coverTier = 2; + end + + actionContainer.AddAction(caster.statusEffects.AddStatusForBattleAction(223063, coverTier, skill.statusDuration)); + + --Apply Covered to target + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/ability/dark_seal.lua b/data/scripts/commands/ability/dark_seal.lua new file mode 100644 index 00000000..1e2f2cd2 --- /dev/null +++ b/data/scripts/commands/ability/dark_seal.lua @@ -0,0 +1,19 @@ +require("global"); +require("ability"); + +function onAbilityPrepare(caster, target, ability) + return 0; +end; + +function onAbilityStart(caster, target, ability) + --27320: Swift Dark Seal + if caster.HasTrait(27320) then + ability.recastTimeMs = ability.recastTimeMs - 30000; + end + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/ability/decoy.lua b/data/scripts/commands/ability/decoy.lua new file mode 100644 index 00000000..4e6f4d4b --- /dev/null +++ b/data/scripts/commands/ability/decoy.lua @@ -0,0 +1,19 @@ +require("global"); +require("ability"); + +function onAbilityPrepare(caster, target, ability) + return 0; +end; + +function onAbilityStart(caster, target, ability) + --27244: Enhanced Decoy: Renders Decoy capable of evading melee attacks + if caster.HasTrait(27244) then + ability.statusId = 223238; + end + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/ability/default.lua b/data/scripts/commands/ability/default.lua new file mode 100644 index 00000000..dca16b3d --- /dev/null +++ b/data/scripts/commands/ability/default.lua @@ -0,0 +1,17 @@ +require("global"); +require("ability"); + +function onAbilityPrepare(caster, target, skill) + return 0; +end; + +function onAbilityStart(caster, target, skill) + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/ability/divine_veil.lua b/data/scripts/commands/ability/divine_veil.lua new file mode 100644 index 00000000..99fb16cc --- /dev/null +++ b/data/scripts/commands/ability/divine_veil.lua @@ -0,0 +1,20 @@ +require("global"); +require("ability"); + +function onAbilityPrepare(caster, target, ability) + return 0; +end; + +function onAbilityStart(caster, target, ability) + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --8051401: Gallant Cuisses + if caster.HasItemEquippedInSlot(8051401, 12) then + ability.statusTier = 2; + end + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/ability/dragonfire_dive.lua b/data/scripts/commands/ability/dragonfire_dive.lua new file mode 100644 index 00000000..4375f9fb --- /dev/null +++ b/data/scripts/commands/ability/dragonfire_dive.lua @@ -0,0 +1,16 @@ +require("global"); +require("ability"); + +function onAbilityPrepare(caster, target, ability) + return 0; +end; + +function onAbilityStart(caster, target, ability) + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + action.amount = skill.basePotency; + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/ability/dread_spike.lua b/data/scripts/commands/ability/dread_spike.lua new file mode 100644 index 00000000..c17ac693 --- /dev/null +++ b/data/scripts/commands/ability/dread_spike.lua @@ -0,0 +1,24 @@ +require("global"); +require("ability"); + +function onAbilityPrepare(caster, target, ability) + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --Need a better way to do this + + for i = 223212,223217 do + local remAction = caster.statusEffects.RemoveStatusEffectForBattleAction(i, 30329) + + if remAction ~= nil then + actionContainer.AddAction(remAction); + skill.statusTier = 2; + break; + end + + end + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/ability/elusive_jump.lua b/data/scripts/commands/ability/elusive_jump.lua new file mode 100644 index 00000000..f1d12012 --- /dev/null +++ b/data/scripts/commands/ability/elusive_jump.lua @@ -0,0 +1,16 @@ +require("global"); +require("ability"); + +function onAbilityPrepare(caster, target, ability) + return 0; +end; + +function onAbilityStart(caster, target, ability) + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --How to do enmity? + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/ability/enduring_march.lua b/data/scripts/commands/ability/enduring_march.lua new file mode 100644 index 00000000..ba3969d0 --- /dev/null +++ b/data/scripts/commands/ability/enduring_march.lua @@ -0,0 +1,19 @@ +require("global"); +require("ability"); + +function onAbilityPrepare(caster, target, ability) + return 0; +end; + +function onAbilityStart(caster, target, ability) + --27203: Enhanced Outmaneuver + if caster.HasTrait(27203) then + ability.statusTier = 2; + end + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/ability/excruciate.lua b/data/scripts/commands/ability/excruciate.lua new file mode 100644 index 00000000..1432ddef --- /dev/null +++ b/data/scripts/commands/ability/excruciate.lua @@ -0,0 +1,19 @@ +require("global"); +require("ability"); + +function onAbilityPrepare(caster, target, ability) + return 0; +end; + +function onAbilityStart(caster, target, ability) + --27321: Enhanced Excruciate: Increases critical rate bonus from Excruciate. + if caster.HasTrait(27321) then + ability.statusTier = 2; + end + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/ability/featherfoot.lua b/data/scripts/commands/ability/featherfoot.lua new file mode 100644 index 00000000..f4120804 --- /dev/null +++ b/data/scripts/commands/ability/featherfoot.lua @@ -0,0 +1,19 @@ +require("global"); +require("ability"); + +function onAbilityPrepare(caster, target, ability) + return 0; +end; + +function onAbilityStart(caster, target, ability) + --27123: Enhanced Featherfoot + if caster.HasTrait(27123) then + ability.statusTier = 2; + end + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/ability/fists_of_earth.lua b/data/scripts/commands/ability/fists_of_earth.lua new file mode 100644 index 00000000..8416595e --- /dev/null +++ b/data/scripts/commands/ability/fists_of_earth.lua @@ -0,0 +1,19 @@ +require("global"); +require("ability"); + +function onAbilityPrepare(caster, target, ability) + return 0; +end; + +function onAbilityStart(caster, target, ability) + --27124: Enhanced Fists of Earth + if caster.HasTrait(27125) then + ability.statusTier = 2; + end + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/ability/fists_of_fire.lua b/data/scripts/commands/ability/fists_of_fire.lua new file mode 100644 index 00000000..84ac5ce7 --- /dev/null +++ b/data/scripts/commands/ability/fists_of_fire.lua @@ -0,0 +1,19 @@ +require("global"); +require("ability"); + +function onAbilityPrepare(caster, target, ability) + return 0; +end; + +function onAbilityStart(caster, target, ability) + --27124: Enhanced Fists of Fire + if caster.HasTrait(27124) then + ability.statusTier = 2; + end + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/ability/flash.lua b/data/scripts/commands/ability/flash.lua new file mode 100644 index 00000000..ec4f7b05 --- /dev/null +++ b/data/scripts/commands/ability/flash.lua @@ -0,0 +1,27 @@ +require("global"); +require("ability"); + +function onAbilityPrepare(caster, target, ability) + return 0; +end; + +function onAbilityStart(caster, target, ability) + --27161: Enhanced Flash: Adds Blind effect to flash + if caster.HasTrait(27161) then + ability.statusChance = 1; + end + + --27162: Enhanced Flash II: Expands Flash to affect enemies near target + if caster.HasTrait(27162) then + ability.aoeTarget = TargetFindAOEType.Circle; + end + + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + action.enmity = 400; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/ability/foresight.lua b/data/scripts/commands/ability/foresight.lua new file mode 100644 index 00000000..a54dff7e --- /dev/null +++ b/data/scripts/commands/ability/foresight.lua @@ -0,0 +1,19 @@ +require("global"); +require("ability"); + +function onAbilityPrepare(caster, target, ability) + return 0; +end; + +function onAbilityStart(caster, target, ability) + --27201: Swift Foresight + if caster.HasTrait(27201) then + ability.recastTimeMs = ability.recastTimeMs - 15000; + end + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/ability/hallowed_ground.lua b/data/scripts/commands/ability/hallowed_ground.lua new file mode 100644 index 00000000..7fe937d3 --- /dev/null +++ b/data/scripts/commands/ability/hallowed_ground.lua @@ -0,0 +1,28 @@ +require("global"); +require("ability"); + +function onAbilityPrepare(caster, target, ability) + return 0; +end; + +function onAbilityStart(caster, target, ability) + --27245: Swift Chameleon + if caster.HasTrait(27245) then + ability.recastTimeMs = ability.recastTimeMs - 60000; + end + return 0; +end; + +--Get all targets with hate on caster and spread 1140 enmity between them. +function onSkillFinish(caster, target, skill, action, actionContainer) + --[[ + local enemies = caster.GetTargetsWithHate() + local enmity = 1140 / enemies.Count + for enemy in enemies do + enemy.hateContainer.updateHate(enmity); + end]] + + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/ability/hawks_eye.lua b/data/scripts/commands/ability/hawks_eye.lua new file mode 100644 index 00000000..e1b2ed10 --- /dev/null +++ b/data/scripts/commands/ability/hawks_eye.lua @@ -0,0 +1,19 @@ +require("global"); +require("ability"); + +function onAbilityPrepare(caster, target, ability) + return 0; +end; + +function onAbilityStart(caster, target, ability) + --27240: Enhanced Hawks Eye + --Increases accuracy gained by 50%. (Hawks Eye normally gives 12.5% of your accuracy, Traited it gives 18.75%) + if caster.HasTrait(27240) then + ability.statusTier = 2 + end + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/ability/hundred_fists.lua b/data/scripts/commands/ability/hundred_fists.lua new file mode 100644 index 00000000..716534d7 --- /dev/null +++ b/data/scripts/commands/ability/hundred_fists.lua @@ -0,0 +1,17 @@ +require("global"); +require("ability"); +require("modifiers"); + +function onAbilityPrepare(caster, target, ability) + return 0; +end; + +function onAbilityStart(caster, target, ability) + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --Take off 1/3 of attack delay. Not sure if this is the exact amount HF reduces by + action.statusMagnitude = 0.33 * caster.GetMod(modifiersGlobal.AttackDelay); + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/ability/invigorate.lua b/data/scripts/commands/ability/invigorate.lua new file mode 100644 index 00000000..cb2b1e53 --- /dev/null +++ b/data/scripts/commands/ability/invigorate.lua @@ -0,0 +1,29 @@ +require("global"); +require("Ability"); + +function onAbilityPrepare(caster, target, ability) + return 0; +end; + +function onAbilityStart(caster, target, ability) + --27280: Enhanced Invigorate: Increases duration of Invigorate by 15 seconds + if caster.HasTrait(27280) then + ability.statusDuration = ability.statusDuration + 15; + end + + --Drachen Mail: Increases Invigorate TP tick from 100 to 120. + local magnitude = 100; + + --8032704: Drachen Mail + if caster.HasItemEquippedInSlot(8032704, 10) then + magnitude = 120; + end + + ability.statusMagnitude = magnitude; + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/ability/jump.lua b/data/scripts/commands/ability/jump.lua new file mode 100644 index 00000000..85f185b6 --- /dev/null +++ b/data/scripts/commands/ability/jump.lua @@ -0,0 +1,17 @@ +require("global"); +require("ability"); + +function onAbilityPrepare(caster, target, ability) + return 0; +end; + +function onAbilityStart(caster, target, ability) + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/ability/keen_flurry.lua b/data/scripts/commands/ability/keen_flurry.lua new file mode 100644 index 00000000..f06ec21a --- /dev/null +++ b/data/scripts/commands/ability/keen_flurry.lua @@ -0,0 +1,19 @@ +require("global"); +require("ability"); + +function onAbilityPrepare(caster, target, ability) + return 0; +end; + +function onAbilityStart(caster, target, ability) + --27285: Enhanced Keen Flurry: Reduces recast time of WS used during KF by 50% + if caster.HasTrait(27285) then + ability.statusTier = 2; + end + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/ability/life_surge.lua b/data/scripts/commands/ability/life_surge.lua new file mode 100644 index 00000000..06f165fd --- /dev/null +++ b/data/scripts/commands/ability/life_surge.lua @@ -0,0 +1,53 @@ +require("global"); +require("ability"); + +function onAbilityPrepare(caster, target, ability) + return 0; +end; + +function onAbilityStart(caster, target, ability) + --27282: Enhanced Life Surge: Increases effect of Life Surge by 20% + if caster.HasTrait(27282) then + ability.statusTier = 2; + end + + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --Need a better way to do this + --223212: Power Surge I + --223213: Power Surge II + --223212: Power Surge III + --No message is sent when PS is removed by Life Surge + caster.statusEffects.RemoveStatusEffect(223212, true); + caster.statusEffects.RemoveStatusEffect(223213, true); + caster.statusEffects.RemoveStatusEffect(223214, true); + + + --Using this ability moves to the next LS buff + local removeId = 0; + --223215: Life Surge I + --223216: Life Surge II + --223217: Life Surge III + if caster.statusEffects.HasStatusEffect(223215) then + removeId = 223215; + skill.statusId = 223216; + skill.statusTier = 2; + elseif caster.statusEffects.HasStatusEffect(223216) then + removeId = 223216; + skill.statusId = 223217; + skill.statusTier = 3; + elseif caster.statusEffects.HasStatusEffect(223217) then + effect = caster.statusEffects.GetStatusEffectById(223217) + effect.RefreshTime(); + skill.statusId = 223217; + end + + if not (removeId == 0) then + --caster.statusEffects.RemoveStatusEffect(removeId, true); + caster.statusEffects.ReplaceEffect(caster.statusEffects.GetStatusEffectById(removeId), skill.statusId, skill.statusTier, skill.statusMagnitude, skill.statusDuration); + end + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/ability/light_shot.lua b/data/scripts/commands/ability/light_shot.lua new file mode 100644 index 00000000..a2567b77 --- /dev/null +++ b/data/scripts/commands/ability/light_shot.lua @@ -0,0 +1,20 @@ +require("global"); +require("ability"); + +function onAbilityPrepare(caster, target, ability) + return 0; +end; + +function onAbilityStart(caster, target, ability) + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --For some reason, light shot's hitNum is always 1 (or 0, idk), even with barrage. + --If you set the hitnum like any other multi-hit WS it will play the animation repeatedly. + action.hitNum = 1; + + action.amount = skill.basePotency; + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/ability/necrogenesis.lua b/data/scripts/commands/ability/necrogenesis.lua new file mode 100644 index 00000000..ef6f241e --- /dev/null +++ b/data/scripts/commands/ability/necrogenesis.lua @@ -0,0 +1,19 @@ +require("global"); +require("ability"); + +function onAbilityPrepare(caster, target, ability) + return 0; +end; + +function onAbilityStart(caster, target, ability) + --27322: Swift Dark Seal + if caster.HasTrait(27322) then + ability.recastTimeMs = ability.recastTimeMs - 30000; + end + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/ability/outmaneuver.lua b/data/scripts/commands/ability/outmaneuver.lua new file mode 100644 index 00000000..699d7eba --- /dev/null +++ b/data/scripts/commands/ability/outmaneuver.lua @@ -0,0 +1,19 @@ +require("global"); +require("ability"); + +function onAbilityPrepare(caster, target, ability) + return 0; +end; + +function onAbilityStart(caster, target, ability) + --27164: Enhanced Outmaneuver + if caster.HasTrait(27164) then + ability.statusTier = 2; + end + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/ability/parsimony.lua b/data/scripts/commands/ability/parsimony.lua new file mode 100644 index 00000000..ce1ff01a --- /dev/null +++ b/data/scripts/commands/ability/parsimony.lua @@ -0,0 +1,19 @@ +require("global"); +require("ability"); + +function onAbilityPrepare(caster, target, ability) + return 0; +end; + +function onAbilityStart(caster, target, ability) + --27323: Enhanced Parsimony: Increases MP gained from Parsimony by 25% + if caster.HasTrait(27323) then + ability.statusTier = 2; + end + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/ability/power_surge.lua b/data/scripts/commands/ability/power_surge.lua new file mode 100644 index 00000000..54976f89 --- /dev/null +++ b/data/scripts/commands/ability/power_surge.lua @@ -0,0 +1,24 @@ +require("global"); +require("ability"); + +function onAbilityPrepare(caster, target, ability) + return 0; +end; + +function onAbilityStart(caster, target, ability) + --27281: Enhanced Power Surge: Increases effect of Power Surge by 50% + if caster.HasTrait(27281) then + ability.statusTier = 2; + end + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --Need a better way to do this + actionContainer.AddAction(caster.statusEffects.RemoveStatusEffectForBattleAction(223215)); + actionContainer.AddAction(caster.statusEffects.RemoveStatusEffectForBattleAction(223216)); + actionContainer.AddAction(caster.statusEffects.RemoveStatusEffectForBattleAction(223217)); + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/ability/provoke.lua b/data/scripts/commands/ability/provoke.lua new file mode 100644 index 00000000..64830e2d --- /dev/null +++ b/data/scripts/commands/ability/provoke.lua @@ -0,0 +1,21 @@ +require("global"); +require("ability"); + +function onAbilityPrepare(caster, target, ability) + return 0; +end; + +function onAbilityStart(caster, target, ability) + --27200: Enhanced Provoke: Adds Attack Down effect to Provoke. + if caster.HasTrait(27200) then + ability.statusChance = 1.0; + end + return 0; +end; + +--http://forum.square-enix.com/ffxiv/threads/47393-Tachi-s-Guide-to-Paladin-%28post-1.22b%29 +function onSkillFinish(caster, target, skill, action, actionContainer) + action.enmity = 750; + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/ability/quelling_strike.lua b/data/scripts/commands/ability/quelling_strike.lua new file mode 100644 index 00000000..35c507a4 --- /dev/null +++ b/data/scripts/commands/ability/quelling_strike.lua @@ -0,0 +1,29 @@ +require("global"); +require("ability"); + +function onAbilityPrepare(caster, target, ability) + return 0; +end; + +function onAbilityStart(caster, target, ability) + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --QS gives 300 TP by default. + skill.statusMagnitude = 300; + --I'm assuming that with raging strikes, that increases to 500. + --and traited that increases again to 750 (or 450 without RS) + if caster.statusEffects.HasStatusEffect(223221) then + actionContainer.AddAction(caster.statusEffects.RemoveStatusEffectForBattleAction(223221)); + skill.statusMagnitude = 500; + end + + --27241: Enhanced Quelling Strike: Increases TP gained from QS by 50% + if caster.HasTrait(27241) then + skill.statusMagnitude = skill.statusMagnitude * 1.5; + end + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/ability/raging_strike.lua b/data/scripts/commands/ability/raging_strike.lua new file mode 100644 index 00000000..5e265f08 --- /dev/null +++ b/data/scripts/commands/ability/raging_strike.lua @@ -0,0 +1,19 @@ +require("global"); +require("ability"); + +function onAbilityPrepare(caster, target, ability) + return 0; +end; + +function onAbilityStart(caster, target, ability) + --27243: Enhanced Raging Strike: Increases effect of Raging Strike by 50% + if caster.HasTrait(27241) then + ability.statusTier = 2; + end + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/ability/rampage.lua b/data/scripts/commands/ability/rampage.lua new file mode 100644 index 00000000..49c9bd60 --- /dev/null +++ b/data/scripts/commands/ability/rampage.lua @@ -0,0 +1,19 @@ +require("global"); +require("ability"); + +function onAbilityPrepare(caster, target, ability) + return 0; +end; + +function onAbilityStart(caster, target, ability) + --27204: Enhanced Rampage + if caster.HasTrait(27204) then + ability.statusTier = 2; + end + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/ability/rampart.lua b/data/scripts/commands/ability/rampart.lua new file mode 100644 index 00000000..604d4929 --- /dev/null +++ b/data/scripts/commands/ability/rampart.lua @@ -0,0 +1,27 @@ +require("global"); +require("ability"); +require("battleutils") + +function onAbilityPrepare(caster, target, ability) + return 0; +end; + +function onAbilityStart(caster, target, ability) + + --27163: Enhanced Rampart:Expands rampart to affect party members + if caster.HasTrait(27163) then + ability.aoeType = TargetFindAOEType.Circle; + end + + return 0; +end; + +--http://forum.square-enix.com/ffxiv/threads/47393-Tachi-s-Guide-to-Paladin-%28post-1.22b%29 +--180 enmity per member that has enmity on the current enemy +--Need to figure out enmity system +function onSkillFinish(caster, target, skill, action, actionContainer) + action.enmity = 180; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/ability/resonance.lua b/data/scripts/commands/ability/resonance.lua new file mode 100644 index 00000000..0cae6d8d --- /dev/null +++ b/data/scripts/commands/ability/resonance.lua @@ -0,0 +1,15 @@ +require("global"); +require("ability"); + +function onAbilityPrepare(caster, target, ability) + return 0; +end; + +function onAbilityStart(caster, target, ability) + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/ability/sacred_prism.lua b/data/scripts/commands/ability/sacred_prism.lua new file mode 100644 index 00000000..9affbf67 --- /dev/null +++ b/data/scripts/commands/ability/sacred_prism.lua @@ -0,0 +1,19 @@ +require("global"); +require("ability"); + +function onAbilityPrepare(caster, target, ability) + return 0; +end; + +function onAbilityStart(caster, target, ability) + --27360: Swift Sacred Prism: Reduces recast by 30 seconds + if caster.HasTrait(27360) then + ability.recastTimeMs = ability.recastTimeMs - 30000; + end + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/ability/second_wind.lua b/data/scripts/commands/ability/second_wind.lua new file mode 100644 index 00000000..7bbd4986 --- /dev/null +++ b/data/scripts/commands/ability/second_wind.lua @@ -0,0 +1,43 @@ +require("global"); +require("modifiers"); +require("utils") +--require("ability"); + +function onAbilityPrepare(caster, target, ability) + return 0; +end; + +function onAbilityStart(caster, target, ability) + + return 0; +end; + +--http://forum.square-enix.com/ffxiv/threads/51208-2nd-wind-modifier +--The primary modifier for SW is class level. + +--There are three other factors that contribute to SW: +-- PGL's SW trait, which increases potency by 25%. +-- A bonus from INT (2INT=1HP) +-- An additional random integer (580 at level 50. +/- 3%) +function onSkillFinish(caster, target, skill, action, actionContainer) + --Base amount seems to be 0.215x^2 - 0.35x + 60 + --^ this isn't totally correct + local amount = (0.215 * math.pow(caster.GetLevel(), 2)) - (0.35 * caster.GetLevel()) + 60; + + --Heals can vary by up to 3.5% + amount = math.Clamp(amount * (0.965 + (math.random() * 0.07)), 0, 9999); + + --PGL gets an INT bonus for Second Wind + if caster.GetClass() == 2 then + amount = amount + caster.GetMod(modifiersGlobal.Intelligence) / 2; + end; + + --27120: Enhanced Second Wind + if caster.HasTrait(27120) then + amount = amount * 1.25; + end; + + action.amount = amount; + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/ability/sentinel.lua b/data/scripts/commands/ability/sentinel.lua new file mode 100644 index 00000000..4a4b1a7e --- /dev/null +++ b/data/scripts/commands/ability/sentinel.lua @@ -0,0 +1,19 @@ +require("global"); +require("ability"); + +function onAbilityPrepare(caster, target, ability) + return 0; +end; + +function onAbilityStart(caster, target, ability) + --27160: Enhanced Sentinel + if caster.HasTrait(27160) then + ability.statusTier = 2; + end + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/ability/shroud_of_saints.lua b/data/scripts/commands/ability/shroud_of_saints.lua new file mode 100644 index 00000000..7e5af422 --- /dev/null +++ b/data/scripts/commands/ability/shroud_of_saints.lua @@ -0,0 +1,19 @@ +require("global"); +require("ability"); + +function onAbilityPrepare(caster, target, ability) + return 0; +end; + +function onAbilityStart(caster, target, ability) + --27361: Swift Shroud of Saints + if caster.HasTrait(27361) then + ability.recastTimeMs = ability.recastTimeMs - 60000; + end + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/ability/taunt.lua b/data/scripts/commands/ability/taunt.lua new file mode 100644 index 00000000..a73b5378 --- /dev/null +++ b/data/scripts/commands/ability/taunt.lua @@ -0,0 +1,19 @@ +require("global"); +require("ability"); + +function onAbilityPrepare(caster, target, ability) + return 0; +end; + +function onAbilityStart(caster, target, ability) + --27122: Swift Taunt: Reduces recast time by 15 seconds. + if caster.HasTrait(27121) then + ability.recastTimeMs = ability.recastTimeMs - 15000; + end + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/ability/tempered_will.lua b/data/scripts/commands/ability/tempered_will.lua new file mode 100644 index 00000000..f024acaf --- /dev/null +++ b/data/scripts/commands/ability/tempered_will.lua @@ -0,0 +1,20 @@ +require("global"); +require("ability"); + +function onAbilityPrepare(caster, target, ability) + return 0; +end; + +function onAbilityStart(caster, target, ability) + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --Is this before or after status is gained? + --Will probably need to switch to a flag for this because it might include more than just these 3 effects. + actionContainer.AddAction(caster.statusEffects.RemoveStatusEffectForBattleAction(228011)); + actionContainer.AddAction(caster.statusEffects.RemoveStatusEffectForBattleAction(228013)); + actionContainer.AddAction(caster.statusEffects.RemoveStatusEffectForBattleAction(228021)); + + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/ability/vengeance.lua b/data/scripts/commands/ability/vengeance.lua new file mode 100644 index 00000000..3506bbaa --- /dev/null +++ b/data/scripts/commands/ability/vengeance.lua @@ -0,0 +1,22 @@ +require("global"); +require("ability"); +require("battleutils") + +function onAbilityPrepare(caster, target, ability) + return 0; +end; + +function onAbilityStart(caster, target, ability) + + --8032703: Fighter's Cuirass: Enhances Vengeance + if caster.HasItemEquippedInSlot(8032703, 10) then + skill.statusTier = 2; + end + + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/gm/addtoparty.lua b/data/scripts/commands/gm/addtoparty.lua new file mode 100644 index 00000000..fe01fb46 --- /dev/null +++ b/data/scripts/commands/gm/addtoparty.lua @@ -0,0 +1,29 @@ +require("global"); + +properties = { + permissions = 0, + parameters = "sss", + description = +[[ +Adds target to party +]] +} + +function onTrigger(player, argc) + local sender = "[addtoparty] "; + + if player then + if player.target then + print("hi") + local id = player.target.actorId + print("hi") + player.currentParty:AddMember(id); + player.target.currentParty = player.currentParty; + print("hi") + else + print(sender.." no target") + end + else + print(sender.." no player"); + end; +end; \ No newline at end of file diff --git a/data/scripts/commands/gm/ba.lua b/data/scripts/commands/gm/ba.lua new file mode 100644 index 00000000..43354441 --- /dev/null +++ b/data/scripts/commands/gm/ba.lua @@ -0,0 +1,29 @@ +require("global"); + +properties = { + permissions = 0, + parameters = "sssss", + description = +[[ +Adds experience to player or . +!giveexp | +!giveexp | +]], +} + +function onTrigger(player, argc, commandId, animationId, textId, effectId, amount) + local sender = "[battleaction] "; + + if player then + cid = tonumber(commandId) or 0; + aid = tonumber(animationId) or 0; + tid = tonumber(textId) or 0; + print(effectId) + eid = tonumber(effectId) or 0; + amt = tonumber(amount) or 0; + + player:DoBattleActionAnimation(cid, aid, tid, eid, amt); + else + print(sender.."unable to add experience, ensure player name is valid."); + end; +end; \ No newline at end of file diff --git a/data/scripts/commands/gm/eaction.lua b/data/scripts/commands/gm/eaction.lua new file mode 100644 index 00000000..1c6d9cb9 --- /dev/null +++ b/data/scripts/commands/gm/eaction.lua @@ -0,0 +1,34 @@ +require("global"); + +properties = { + permissions = 0, + parameters = "s", + description = +[[ +Equips in the first open slot without checking if you can. +!eaction +]], +} + +function onTrigger(player, argc, commandid) + local sender = "[eaction] "; + + print(commandid); + if name then + if lastName then + player = GetWorldManager():GetPCInWorld(name.." "..lastName) or nil; + else + player = GetWorldManager():GetPCInWorld(name) or nil; + end; + end; + + if player then + classid = player:GetCurrentClassOrJob(); + commandid = tonumber(commandid) or 0; + + local added = player:EquipAbilityInFirstOpenSlot(classid, commandid); + + else + print(sender.."unable to add command, ensure player name is valid."); + end; +end; \ No newline at end of file diff --git a/data/scripts/commands/gm/effect.lua b/data/scripts/commands/gm/effect.lua new file mode 100644 index 00000000..99826e2c --- /dev/null +++ b/data/scripts/commands/gm/effect.lua @@ -0,0 +1,31 @@ +require("global"); +require("bit32"); + +properties = { + permissions = 0, + parameters = "iiii", + description = +[[ +effect +]], +} + +function onTrigger(player, argc, effectId, magnitude, tick, duration) + local messageId = MESSAGE_TYPE_SYSTEM_ERROR; + local sender = "effect"; + + if player then + player.AddHP(100000); + player.DelHP(500); + + effectId = tonumber(effectId) or 223180; + magnitude = tonumber(magnitude) or 700; + tick = tonumber(tick) or 3; + duration = tonumber(duration) or 360; + + while player.statusEffects.HasStatusEffect(effectId) do + player.statusEffects.RemoveStatusEffect(effectId); + end; + player.statusEffects.AddStatusEffect(effectId, magnitude, tick, duration); + end; +end; \ No newline at end of file diff --git a/data/scripts/commands/gm/giveexp.lua b/data/scripts/commands/gm/giveexp.lua new file mode 100644 index 00000000..5ac50b62 --- /dev/null +++ b/data/scripts/commands/gm/giveexp.lua @@ -0,0 +1,35 @@ +require("global"); + +properties = { + permissions = 0, + parameters = "sss", + description = +[[ +Adds experience to player or . +!giveexp | +!giveexp | +]], +} + +function onTrigger(player, argc, qty, name, lastName) + local sender = "[giveexp] "; + + if name then + if lastName then + player = GetWorldManager():GetPCInWorld(name.." "..lastName) or nil; + else + player = GetWorldManager():GetPCInWorld(name) or nil; + end; + end; + + if player then + currency = 1000001; + qty = tonumber(qty) or 1; + location = INVENTORY_CURRENCY; + + actionList = player:AddExp(qty, player.charaWork.parameterSave.state_mainSkill[0], 0); + player:DoBattleAction(0, 0, actionList); + else + print(sender.."unable to add experience, ensure player name is valid."); + end; +end; \ No newline at end of file diff --git a/data/scripts/commands/gm/graphic.lua b/data/scripts/commands/gm/graphic.lua index 33e70754..d2c0e7fe 100644 --- a/data/scripts/commands/gm/graphic.lua +++ b/data/scripts/commands/gm/graphic.lua @@ -21,9 +21,13 @@ function onTrigger(player, argc, slot, wId, eId, vId, cId) cId = tonumber(cId) or 0; if player and argc > 0 then - player:GraphicChange(slot, wId, eId, vId, cId); + if argc > 2 then + player:GraphicChange(slot, wId, eId, vId, cId); + player:SendMessage(messageID, sender, string.format("Changing appearance on slot %u", slot)); + else + player:GraphicChange(slot, wId); + end player:SendAppearance(); - player:SendMessage(messageID, sender, string.format("Changing appearance on slot %u", slot)); else player:SendMessage(messageID, sender, "No parameters sent! Usage: "..properties.description); end; diff --git a/data/scripts/commands/gm/setappearance.lua b/data/scripts/commands/gm/setappearance.lua new file mode 100644 index 00000000..88ee7869 --- /dev/null +++ b/data/scripts/commands/gm/setappearance.lua @@ -0,0 +1,25 @@ +require("global"); + +properties = { + permissions = 0, + parameters = "s", + description = +[[ +Changes appearance for equipment with given parameters. +!graphic +]], +} + +function onTrigger(player, argc, appearanceId) + local messageID = MESSAGE_TYPE_SYSTEM_ERROR; + local sender = "[setappearance] "; + + app = tonumber(appearanceId) or 0; + player:SendMessage(messageID, sender, string.format("appearance %u", app)); + + if player and player.target then + player.target.ChangeNpcAppearance(app); + player:SendMessage(messageID, sender, string.format("appearance %u", app)); + end; + +end; \ No newline at end of file diff --git a/data/scripts/commands/gm/setjob.lua b/data/scripts/commands/gm/setjob.lua new file mode 100644 index 00000000..b6a78e31 --- /dev/null +++ b/data/scripts/commands/gm/setjob.lua @@ -0,0 +1,21 @@ +require("global"); + +properties = { + permissions = 0, + parameters = "sss", + description = +[[ +Adds experience to player or . +!giveexp | +!giveexp | +]], +} + +function onTrigger(player, argc, jobId) + local sender = "[setjob] "; + + jobId = tonumber(jobId) + if player then + player:SetCurrentJob(jobId); + end; +end; \ No newline at end of file diff --git a/data/scripts/commands/gm/setmaxhp.lua b/data/scripts/commands/gm/setmaxhp.lua new file mode 100644 index 00000000..5088680c --- /dev/null +++ b/data/scripts/commands/gm/setmaxhp.lua @@ -0,0 +1,33 @@ +require("global"); + +properties = { + permissions = 0, + parameters = "sss", + description = +[[ +Sets player or 's maximum hp to and heals them to full. +!setmaxhp | +!setmaxhp +]], +} + +function onTrigger(player, argc, hp, name, lastName) + local sender = "[setmaxhp] "; + + if name then + if lastName then + player = GetWorldManager():GetPCInWorld(name.." "..lastName) or nil; + else + player = GetWorldManager():GetPCInWorld(name) or nil; + end; + end; + + if player then + hp = tonumber(hp) or 1; + location = INVENTORY_CURRENCY; + + player:hpstuff(hp); + else + print(sender.."unable to add experience, ensure player name is valid."); + end; +end; \ No newline at end of file diff --git a/data/scripts/commands/gm/setmaxmp.lua b/data/scripts/commands/gm/setmaxmp.lua new file mode 100644 index 00000000..5088680c --- /dev/null +++ b/data/scripts/commands/gm/setmaxmp.lua @@ -0,0 +1,33 @@ +require("global"); + +properties = { + permissions = 0, + parameters = "sss", + description = +[[ +Sets player or 's maximum hp to and heals them to full. +!setmaxhp | +!setmaxhp +]], +} + +function onTrigger(player, argc, hp, name, lastName) + local sender = "[setmaxhp] "; + + if name then + if lastName then + player = GetWorldManager():GetPCInWorld(name.." "..lastName) or nil; + else + player = GetWorldManager():GetPCInWorld(name) or nil; + end; + end; + + if player then + hp = tonumber(hp) or 1; + location = INVENTORY_CURRENCY; + + player:hpstuff(hp); + else + print(sender.."unable to add experience, ensure player name is valid."); + end; +end; \ No newline at end of file diff --git a/data/scripts/commands/gm/setmod.lua b/data/scripts/commands/gm/setmod.lua new file mode 100644 index 00000000..ca18cd42 --- /dev/null +++ b/data/scripts/commands/gm/setmod.lua @@ -0,0 +1,18 @@ +require("global"); + +properties = { + permissions = 0, + parameters = "ss", + description = +[[ +Sets a modifier of player +!setmod | +]], +} + +function onTrigger(player, argc, modId, modVal) + local sender = "[setmod] "; + local mod = tonumber(modId) + local val = tonumber(modVal) + player:SetMod(mod, val); +end; \ No newline at end of file diff --git a/data/scripts/commands/gm/setproc.lua b/data/scripts/commands/gm/setproc.lua new file mode 100644 index 00000000..b8aa1e3c --- /dev/null +++ b/data/scripts/commands/gm/setproc.lua @@ -0,0 +1,18 @@ +require("global"); + +properties = { + permissions = 0, + parameters = "sss", + description = +[[ +Adds experience to player or . +!giveexp | +!giveexp | +]], +} + +function onTrigger(player, argc, procid) + local sender = "[giveexp] "; + local pid = tonumber(procid) + player:SetProc(pid, true); +end; \ No newline at end of file diff --git a/data/scripts/commands/gm/setsize.lua b/data/scripts/commands/gm/setsize.lua new file mode 100644 index 00000000..87a62425 --- /dev/null +++ b/data/scripts/commands/gm/setsize.lua @@ -0,0 +1,24 @@ +require("global"); + +properties = { + permissions = 0, + parameters = "s", + description = +[[ +Changes appearance for equipment with given parameters. +!graphic +]], +} + +function onTrigger(player, argc, size) + local messageID = MESSAGE_TYPE_SYSTEM_ERROR; + local sender = "[setappearance] "; + + s = tonumber(size) or 0; + + if player and player.target then + player.target.appearanceIds[0] = s; + player.target.zone.BroadcastPacketAroundActor(player.target, player.target.CreateAppearancePacket()); + end; + +end; \ No newline at end of file diff --git a/data/scripts/commands/gm/setstate.lua b/data/scripts/commands/gm/setstate.lua new file mode 100644 index 00000000..cfff2cb0 --- /dev/null +++ b/data/scripts/commands/gm/setstate.lua @@ -0,0 +1,24 @@ +require("global"); + +properties = { + permissions = 0, + parameters = "s", + description = +[[ +Changes appearance for equipment with given parameters. +!graphic +]], +} + +function onTrigger(player, argc, state) + local messageID = MESSAGE_TYPE_SYSTEM_ERROR; + local sender = "[setstate] "; + + local s = tonumber(state); + local actor = GetWorldManager():GetActorInWorld(player.currentTarget) or nil; + if player and actor then + actor:ChangeState(s); + wait(0.8); + player:SendMessage(0x20, "", "state: "..s); + end; +end; \ No newline at end of file diff --git a/data/scripts/commands/gm/settp.lua b/data/scripts/commands/gm/settp.lua new file mode 100644 index 00000000..37ae85fa --- /dev/null +++ b/data/scripts/commands/gm/settp.lua @@ -0,0 +1,27 @@ +require("global"); + +properties = { + permissions = 0, + parameters = "sss", + description = +[[ +Sets player or 's maximum tp to and heals them to full. +!setmaxtp | +!setmaxtp +]], +} + +function onTrigger(player, argc, tp) + local sender = "[setmaxtp] "; + + + + if player then + tp = tonumber(tp) or 0; + location = INVENTORY_CURRENCY; + + player:SetTP(tp); + else + print(sender.."unable to add experience, ensure player name is valid."); + end; +end; \ No newline at end of file diff --git a/data/scripts/commands/gm/spawn.lua b/data/scripts/commands/gm/spawn.lua index 1ff4d900..1f3f1852 100644 --- a/data/scripts/commands/gm/spawn.lua +++ b/data/scripts/commands/gm/spawn.lua @@ -6,7 +6,7 @@ properties = { description = "Spawns a actor", } -function onTrigger(player, argc, actorClassId) +function onTrigger(player, argc, actorClassId, width, height) if (actorClassId == nil) then player:SendMessage(0x20, "", "No actor class id provided."); @@ -24,7 +24,16 @@ function onTrigger(player, argc, actorClassId) if (actorClassId ~= nil) then zone = player:GetZone(); - actor = zone:SpawnActor(actorClassId, "test", pos[0], pos[1], pos[2], pos[3]); + local w = tonumber(width) or 0; + local h = tonumber(height) or 0; + printf("%f %f %f", x, y, z); + --local x, y, z = player.GetPos(); + for i = 0, w do + for j = 0, h do + actor = zone:SpawnActor(actorClassId, "test", pos[0] + (i - (w / 2) * 3), pos[1], pos[2] + (j - (h / 2) * 3), pos[3]); + actor.SetAppearance(1001149) + end + end end if (actor == nil) then diff --git a/data/scripts/commands/gm/yolo.lua b/data/scripts/commands/gm/yolo.lua new file mode 100644 index 00000000..724694c7 --- /dev/null +++ b/data/scripts/commands/gm/yolo.lua @@ -0,0 +1,192 @@ +require("global"); +require("modifiers"); +properties = { + permissions = 0, + parameters = "ssss", + description = +[[ +yolo +]], +} + +local quests = +{ + [111807] = { level = 25, weight = 4, rewardexp = 1080 }, + [110868] = { level = 50, weight = 4, rewardexp = 4400 }, + [111603] = { level = 22, weight = 5, rewardexp = 1100 }, + [111602] = { level = 22, weight = 5, rewardexp = 1100 }, + [111420] = { level = 45, weight = 5, rewardexp = 4450 }, + [110811] = { level = 18, weight = 6, rewardexp = 780 }, + [110814] = { level = 18, weight = 6, rewardexp = 780 }, + [110707] = { level = 25, weight = 6, rewardexp = 1620 }, + [110682] = { level = 34, weight = 6, rewardexp = 3180 }, + [111202] = { level = 35, weight = 6, rewardexp = 3360 }, + [111222] = { level = 35, weight = 6, rewardexp = 3360 }, + [111302] = { level = 35, weight = 6, rewardexp = 3360 }, + [111223] = { level = 40, weight = 6, rewardexp = 4260 }, + [110819] = { level = 45, weight = 6, rewardexp = 5340 }, + [111224] = { level = 45, weight = 6, rewardexp = 5340 }, + [111225] = { level = 45, weight = 6, rewardexp = 5340 }, + [110867] = { level = 45, weight = 6, rewardexp = 5340 }, + [110869] = { level = 45, weight = 6, rewardexp = 5340 }, + [110708] = { level = 45, weight = 6, rewardexp = 5340 }, + [110627] = { level = 45, weight = 6, rewardexp = 5340 }, + [111434] = { level = 50, weight = 6, rewardexp = 6600 }, + [110850] = { level = 1, weight = 7, rewardexp = 40 }, + [110851] = { level = 1, weight = 7, rewardexp = 40 }, + [110841] = { level = 20, weight = 7, rewardexp = 1120 }, + [110642] = { level = 20, weight = 7, rewardexp = 1120 }, + [110840] = { level = 20, weight = 7, rewardexp = 1120 }, + [110727] = { level = 21, weight = 7, rewardexp = 1401 }, + [111221] = { level = 30, weight = 7, rewardexp = 2661 }, + [111241] = { level = 30, weight = 7, rewardexp = 2661 }, + [110687] = { level = 28, weight = 9, rewardexp = 2970 }, + [110016] = { level = 34, weight = 50, rewardexp = 26500 }, + [110017] = { level = 38, weight = 50, rewardexp = 32500 }, + [110019] = { level = 46, weight = 50, rewardexp = 46000 } +}; + +local expTable = { + 570, -- 1 + 700, + 880, + 1100, + 1500, + 1800, + 2300, + 3200, + 4300, + 5000, -- 10 + 5900, + 6800, + 7700, + 8700, + 9700, + 11000, + 12000, + 13000, + 15000, + 16000, -- 20 + 20000, + 22000, + 23000, + 25000, + 27000, + 29000, + 31000, + 33000, + 35000, + 38000, -- 30 + 45000, + 47000, + 50000, + 53000, + 56000, + 59000, + 62000, + 65000, + 68000, + 71000, -- 40 + 74000, + 78000, + 81000, + 85000, + 89000, + 92000, + 96000, + 100000, + 100000, + 110000 -- 50 +}; + +local commandCost = { + ["raise"] = 150, + ["cure"] = 40, + ["cura"] = 100, + ["curaga"] = 150, +}; +-- stone: (1, 9) (5, 12) (10, ) +-- cure: (1, 5) (5, 6) (10, ) +-- aero: (1, 9) (5, 12) (10, ) +-- protect: (1, 9) (5, 12) (10, ) +--[[ +function onTrigger(player, argc, id, level, weight) + id = tonumber(id) or 111807; + level = tonumber(level) or quests[id].level; + weight = tonumber(weight) or quests[id].weight; + local messageId = MESSAGE_TYPE_SYSTEM_ERROR; + local sender = "yolo"; + + if id == 1 then + return + end + local message = calcSkillPoint(player, level, weight); + if player then + player.SendMessage(messageId, sender, string.format("calculated %s | expected %s", message, quests[id].rewardexp)); + end; + printf("calculated %s | expected %s", message, quests[id].rewardexp); +end; +]] + + + +function onTrigger(player, argc, width, height, blockCount) + local messageId = MESSAGE_TYPE_SYSTEM_ERROR; + local sender = "yolo"; + + if player then + if false then + local effectId = 223004; + + player.statusEffects.RemoveStatusEffect(effectId); + player.statusEffects.AddStatusEffect(effectId, 1, 0, 5); + return; + end; + + local pos = player:GetPos(); + local x = tonumber(pos[0]); + local y = tonumber(pos[1]); + local z = tonumber(pos[2]); + local rot = tonumber(pos[3]); + local zone = pos[4]; + local w = tonumber(width) or 0; + + local h = tonumber(height) or 0; + local blocks = tonumber(blockCount) or 0; + + printf("%f %f %f", x, y, z); + --local x, y, z = player.GetPos(); + for b = 0, blocks do + for i = 0, w do + for j = 0, h do + local actor = player.GetZone().SpawnActor(2104001, 'ass', x + (i * 1), y, z + (j * 1), rot, 0, 0, true); + actor.ChangeNpcAppearance(2200905); + actor.SetMaxHP(5000); + actor.SetHP(5000); + actor.SetMod(modifiersGlobal.HasShield, 1); + actor.SetMod(modifiersGlobal.AttackRange, 3); + actor.SetMod(modifiersGlobal.Speed, 5); + actor.SetMobMod(mobModifiersGlobal.Roams, 1); + actor.SetMobMod(mobModifiersGlobal.RoamDelay, 3); + actor.moveState = 3; + end + end + + x = x + 500 + end + return; + end +end; + +function calculateCommandCost(player, skillName, level) + if skillName and level and commandCost[skillName] then + return math.ceil((8000 + (level - 70) * 500) * (commandCost[skillName] * 0.001)); + end; + return 1; +end + +function calcSkillPoint(player, lvl, weight) + weight = weight / 100 + + return math.ceil(expTable[lvl] * weight) +end \ No newline at end of file diff --git a/data/scripts/commands/gm/zonecount.lua b/data/scripts/commands/gm/zonecount.lua new file mode 100644 index 00000000..ca0f28b4 --- /dev/null +++ b/data/scripts/commands/gm/zonecount.lua @@ -0,0 +1,19 @@ +require("global"); + +properties = { + permissions = 0, + parameters = "", + description = +[[ +Get the amount of actors in this zone. +!zonecount +]] + +} + +function onTrigger(player, argc) + + local message = tostring(player.zone.GetAllActors().Count); + + player.SendMessage(0x20, "", message); +end \ No newline at end of file diff --git a/data/scripts/commands/magic/aero.lua b/data/scripts/commands/magic/aero.lua new file mode 100644 index 00000000..3deb8462 --- /dev/null +++ b/data/scripts/commands/magic/aero.lua @@ -0,0 +1,22 @@ +require("global"); +require("magic"); + +function onMagicPrepare(caster, target, spell) + return 0; +end; + +function onMagicStart(caster, target, spell) + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate damage + action.amount = skill.basePotency; + action.statusMagnitude = 15; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); + + --Try to apply status effect + action.TryStatus(caster, target, skill, actionContainer, true); +end; \ No newline at end of file diff --git a/data/scripts/commands/magic/aerora.lua b/data/scripts/commands/magic/aerora.lua new file mode 100644 index 00000000..d8e01c53 --- /dev/null +++ b/data/scripts/commands/magic/aerora.lua @@ -0,0 +1,33 @@ +require("global"); +require("magic"); + +function onMagicPrepare(caster, target, spell) + return 0; +end; + +function onMagicStart(caster, target, spell) + return 0; +end; + +--Increased damage and conversion to single target +function onCombo(caster, target, spell) + spell.aoeType = 0; + spell.potency = spell.potency * 1.5; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --Dispels an effect on each target. + local effects = target.statusEffects.GetStatusEffectsByFlag2(16); --lose on dispel + if effects != nil then + target.statusEffects.RemoveStatusEffect(effects[0]); + end; + + --calculate damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); + + --Try to apply status effect + action.TryStatus(caster, target, skill, actionContainer, true); +end; \ No newline at end of file diff --git a/data/scripts/commands/magic/ballad_of_magi.lua b/data/scripts/commands/magic/ballad_of_magi.lua new file mode 100644 index 00000000..839f79a8 --- /dev/null +++ b/data/scripts/commands/magic/ballad_of_magi.lua @@ -0,0 +1,57 @@ +require("global"); +require("magic"); + +function onMagicPrepare(caster, target, skill) + return 0; +end; + +function onMagicStart(caster, target, skill) + --Ballad gives 20 MP a tick at 50 + --BV gives 40 MP per tick + --Formula seems to be 0.8 * level - 20, not sure why BV gives 71 at 50 then + local mpPerTick = (0.8 * caster.GetLevel()) - 20; + + --8032705: Choral Shirt: Enhances Ballad of Magi + --With Choral Shirt, Ballad gives 26 mp a tick. It could be a flat 6 or multiply by 1.3 + --Because minuet seemed like a normal addition I'm assuming this is too + if caster.HasItemEquippedInSlot(8032705, 10) then + mpPerTick = mpPerTick + 6; + end + + --223253: Battle Voice + --Battle Voice doubles effect of songs + if caster.statusEffects.HasStatusEffect(223253) then + mpPerTick = mpPerTick * 2; + --Set status tier so we can check it later when BV falls off + skill.statusTier = 2; + end + + skill.statusMagnitude = mpPerTick; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --223224: Swiftsong + --223255: Paeon of War + --223256: Minuet of Rigor + -- + local oldSong; + local swiftSong = target.statusEffects.GetStatusEffectById(223224); + local paeon = target.statusEffects.GetStatusEffectById(223255); + local minuet = target.statusEffects.GetStatusEffectById(223256); + if swiftSong and swiftSong.GetSource() == caster then + oldSong = swiftSong; + elseif paeon and paeon.GetSource() == caster then + oldSong = paeon; + elseif minuet and minuet.GetSource() == caster then + oldSong = minuet; + elseif ballad and ballad.GetSource() == caster then + oldSong = ballad; + end + + if oldSong then + target.statusEffects.RemoveStatusEffect(oldSong); + end + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/magic/blizzara.lua b/data/scripts/commands/magic/blizzara.lua new file mode 100644 index 00000000..6fbe1c9b --- /dev/null +++ b/data/scripts/commands/magic/blizzara.lua @@ -0,0 +1,21 @@ +require("global"); +require("magic"); + +function onMagicPrepare(caster, target, spell) + return 0; +end; + +function onMagicStart(caster, target, spell) + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); + + --Try to apply status effect + action.TryStatus(caster, target, skill, actionContainer, true); +end; \ No newline at end of file diff --git a/data/scripts/commands/magic/blizzard.lua b/data/scripts/commands/magic/blizzard.lua new file mode 100644 index 00000000..96482678 --- /dev/null +++ b/data/scripts/commands/magic/blizzard.lua @@ -0,0 +1,20 @@ +require("magic"); + +function onMagicPrepare(caster, target, spell) + return 0; +end; + +function onMagicStart(caster, target, spell) + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); + + --Try to apply status effect + action.TryStatus(caster, target, skill, actionContainer, true); +end; \ No newline at end of file diff --git a/data/scripts/commands/magic/burst.lua b/data/scripts/commands/magic/burst.lua new file mode 100644 index 00000000..1c94a9f8 --- /dev/null +++ b/data/scripts/commands/magic/burst.lua @@ -0,0 +1,26 @@ +require("global"); +require("magic"); + +function onMagicPrepare(caster, target, spell) + return 0; +end; + +function onMagicStart(caster, target, spell) + return 0; +end; + +--Increased damage with lesser current hp +function onCombo(caster, target, spell) + +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); + + --Try to apply status effect + action.TryStatus(caster, target, skill, actionContainer, true); +end; \ No newline at end of file diff --git a/data/scripts/commands/magic/cura.lua b/data/scripts/commands/magic/cura.lua new file mode 100644 index 00000000..6713dadc --- /dev/null +++ b/data/scripts/commands/magic/cura.lua @@ -0,0 +1,21 @@ +require("global"); +require("magic"); + +function onMagicPrepare(caster, target, spell) + return 0; +end; + +function onMagicStart(caster, target, spell) + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --http://forum.square-enix.com/ffxiv/threads/41900-White-Mage-A-Guide + --2.5 HP per Healing Magic Potency + --0.5 HP per MND + --this is WITH WHM AF chest, don't know formula without AF. AF seems to increase healing by 7-10%? + action.amount = 2.5 * caster.GetMod(modifiersGlobal.MagicHeal) + 0.5 * (caster.GetMod(modifiersGlobal.Mind)); + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/magic/curaga.lua b/data/scripts/commands/magic/curaga.lua new file mode 100644 index 00000000..dadd1241 --- /dev/null +++ b/data/scripts/commands/magic/curaga.lua @@ -0,0 +1,19 @@ +require("global"); +require("magic"); + +function onMagicPrepare(caster, target, spell) + return 0; +end; + +--Idea: add way to sort list of targets by hp here? +function onMagicStart(caster, target, spell) + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/magic/cure.lua b/data/scripts/commands/magic/cure.lua new file mode 100644 index 00000000..cafa30a2 --- /dev/null +++ b/data/scripts/commands/magic/cure.lua @@ -0,0 +1,37 @@ +require("global"); +require("magic"); +require("modifiers"); + +function onMagicPrepare(caster, target, spell) + return 0; +end; + +function onMagicStart(caster, target, spell) + return 0; +end; + +--http://forum.square-enix.com/ffxiv/threads/41900-White-Mage-A-Guide +function onSkillFinish(caster, target, skill, action, actionContainer) + + --Non-CNJ + --1.10 per HMP + --0 per MND + local hpPerHMP = 1.10; + local hpPerMND = 0; + + --CNJ + --With AF: + --1.25 HP per Healing Magic Potency + --0.25 HP per MND + --This is WITH AF chest. Without is lower. AF is ~7-10% increase apparently + --I'm guessing without AF hpPerHMP will be 1.1? + if (caster.GetClass() == 23) then + hpPerHMP = 1.25; + hpPerMND = 0.25; + end + + action.amount = hpPerHMP * caster.GetMod(modifiersGlobal.MagicHeal) + hpPerMND * (caster.GetMod(modifiersGlobal.Mind)); + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/magic/default.lua b/data/scripts/commands/magic/default.lua new file mode 100644 index 00000000..6fbe1c9b --- /dev/null +++ b/data/scripts/commands/magic/default.lua @@ -0,0 +1,21 @@ +require("global"); +require("magic"); + +function onMagicPrepare(caster, target, spell) + return 0; +end; + +function onMagicStart(caster, target, spell) + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); + + --Try to apply status effect + action.TryStatus(caster, target, skill, actionContainer, true); +end; \ No newline at end of file diff --git a/data/scripts/commands/magic/fira.lua b/data/scripts/commands/magic/fira.lua new file mode 100644 index 00000000..c7dc3f48 --- /dev/null +++ b/data/scripts/commands/magic/fira.lua @@ -0,0 +1,23 @@ +require("global"); +require("magic"); + +function onMagicPrepare(caster, target, spell) + return 0; +end; + +function onMagicStart(caster, target, spell) + return 0; +end; + +--Increased Damage and reduced recast time in place of stun +function onCombo(caster, target, spell) + spell.castTimeMs = spell.castTimeMs / 2; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/magic/firaga.lua b/data/scripts/commands/magic/firaga.lua new file mode 100644 index 00000000..e145c551 --- /dev/null +++ b/data/scripts/commands/magic/firaga.lua @@ -0,0 +1,23 @@ +require("global"); +require("magic"); + +function onMagicPrepare(caster, target, spell) + return 0; +end; + +function onMagicStart(caster, target, spell) + return 0; +end; + +--Increased critical damage +function onCombo(caster, target, spell) + spell.castTimeMs = spell.castTimeMs / 2; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/magic/fire.lua b/data/scripts/commands/magic/fire.lua new file mode 100644 index 00000000..cb88bda7 --- /dev/null +++ b/data/scripts/commands/magic/fire.lua @@ -0,0 +1,18 @@ +require("global"); +require("magic"); + +function onMagicPrepare(caster, target, spell) + return 0; +end; + +function onMagicStart(caster, target, spell) + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/magic/flare.lua b/data/scripts/commands/magic/flare.lua new file mode 100644 index 00000000..6fbe1c9b --- /dev/null +++ b/data/scripts/commands/magic/flare.lua @@ -0,0 +1,21 @@ +require("global"); +require("magic"); + +function onMagicPrepare(caster, target, spell) + return 0; +end; + +function onMagicStart(caster, target, spell) + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); + + --Try to apply status effect + action.TryStatus(caster, target, skill, actionContainer, true); +end; \ No newline at end of file diff --git a/data/scripts/commands/magic/freeze.lua b/data/scripts/commands/magic/freeze.lua new file mode 100644 index 00000000..5d7349bb --- /dev/null +++ b/data/scripts/commands/magic/freeze.lua @@ -0,0 +1,22 @@ +require("global"); +require("magic"); + +function onMagicPrepare(caster, target, spell) + return 0; +end; + +function onMagicStart(caster, target, spell) + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --Freeze generates 0 enmity and removes a flat 720 enmity + spell.enmityModifier = 0; + target.hateContainer.UpdateHate(caster, -720); + + --calculate damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/magic/holy.lua b/data/scripts/commands/magic/holy.lua new file mode 100644 index 00000000..6fbe1c9b --- /dev/null +++ b/data/scripts/commands/magic/holy.lua @@ -0,0 +1,21 @@ +require("global"); +require("magic"); + +function onMagicPrepare(caster, target, spell) + return 0; +end; + +function onMagicStart(caster, target, spell) + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); + + --Try to apply status effect + action.TryStatus(caster, target, skill, actionContainer, true); +end; \ No newline at end of file diff --git a/data/scripts/commands/magic/holy_succor.lua b/data/scripts/commands/magic/holy_succor.lua new file mode 100644 index 00000000..4ce6c182 --- /dev/null +++ b/data/scripts/commands/magic/holy_succor.lua @@ -0,0 +1,29 @@ +require("global"); +require("magic"); + +function onMagicPrepare(caster, target, spell) + return 0; +end; + +function onMagicStart(caster, target, spell) + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + action.amount = skill.basePotency; + + --8071401: Gallant Gauntlets: Enhances Holy Succor + if caster.HasItemEquippedInSlot(8071401, 13) then + action.amount = action.amount * 1.10; + end + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); + + --When cast on another player you also heal 50% of the amount restored. + if caster != target then + caster.AddHP(action.amount / 2) + --33012: You recover [amount] HP. + actionContainer.AddHPAction(caster.actorId, 33012, (action.amount / 2)); + end +end; \ No newline at end of file diff --git a/data/scripts/commands/magic/minuet_of_rigor.lua b/data/scripts/commands/magic/minuet_of_rigor.lua new file mode 100644 index 00000000..eac2ab46 --- /dev/null +++ b/data/scripts/commands/magic/minuet_of_rigor.lua @@ -0,0 +1,55 @@ +require("global"); +require("magic"); + +function onMagicPrepare(caster, target, skill) + return 0; +end; + +function onMagicStart(caster, target, skill) + --Miuet gives 35 ACC/MACC by default at level 50. Minuet does scale with level + --BV apparetnly gives 71 ACc/MACC + --Formula seems to be level - 15, not sure why BV gives 71 at 50 then + local acc = caster.GetLevel() - 15; + + --8071405: Choral Ringbands: Enhances Minuet of Rigor + --With Choral Tights, Minuet gives 60 ACC/MACC at 50. Unsure what it is at lower levels (ie if it's a flat added 25 MP or a multiplier) + --Assuming it's a flat 25 because that makes more sense than multiplying by 1.714 + if caster.HasItemEquippedInSlot(8071405, 13) then + acc = acc + 25; + end + + --223253: Battle Voice + --Battle Voice doubles effect of songs + if caster.statusEffects.HasStatusEffect(223253) then + acc = acc * 2; + --Set status tier so we can check it later when BV falls off + skill.statusTier = 2; + end + + skill.statusMagnitude = acc; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --223224: Swiftsong + --223254: Ballad Of Magi + --223255: Paeon of War + --If target has one of these effects that was from this caster, remove it + local oldSong; + local swiftSong = target.statusEffects.GetStatusEffectById(223224); + local ballad = target.statusEffects.GetStatusEffectById(223254); + local paeon = target.statusEffects.GetStatusEffectById(223255); + if swiftSong and swiftSong.GetSource() == caster then + oldSong = swiftSong; + elseif ballad and ballad.GetSource() == caster then + oldSong = ballad; + elseif paeon and paeon.GetSource() == caster then + oldSong = paeon; + end + + if oldSong then + target.statusEffects.RemoveStatusEffect(oldSong); + end + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/magic/paeon_of_war.lua b/data/scripts/commands/magic/paeon_of_war.lua new file mode 100644 index 00000000..930bd7b8 --- /dev/null +++ b/data/scripts/commands/magic/paeon_of_war.lua @@ -0,0 +1,53 @@ +require("global"); +require("magic"); + +function onMagicPrepare(caster, target, skill) + return 0; +end; + +function onMagicStart(caster, target, skill) + --Restores 50 TP/tick normally. With Choral Tights it's 60 TP. With Battle voice it's 100, 120 with Coral Tights. + --Battle voice is handled in the Battle Voice script + --Paeon does not scale with level + local tpPerTick = 50; + + --8051405: Choral Tights: Enhances Paeon Of War + if caster.HasItemEquippedInSlot(8051405, 12) then + tpPerTick = 60; + end + + --223253: Battle Voice + --Battle Voice doubles effect of songs + if caster.statusEffects.HasStatusEffect(223253) then + tpPerTick = tpPerTick * 2; + --Set status tier so we can check it later when BV falls off + skill.statusTier = 2; + end + + skill.statusMagnitude = tpPerTick; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --223224: Swiftsong + --223254: Ballad Of Magi + --223256: Minuet of Rigor + --If target has one of these effects that was from this caster, remove it + local oldSong; + local swiftSong = target.statusEffects.GetStatusEffectById(223224); + local ballad = target.statusEffects.GetStatusEffectById(223254); + local minuet = target.statusEffects.GetStatusEffectById(223256); + if swiftSong and swiftSong.GetSource() == caster then + oldSong = swiftSong; + elseif ballad and ballad.GetSource() == caster then + oldSong = ballad; + elseif minuet and minuet.GetSource() == caster then + oldSong = minuet; + end + + if oldSong then + target.statusEffects.RemoveStatusEffect(oldSong); + end + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/magic/protect.lua b/data/scripts/commands/magic/protect.lua new file mode 100644 index 00000000..454e030a --- /dev/null +++ b/data/scripts/commands/magic/protect.lua @@ -0,0 +1,24 @@ +require("global"); +require("magic"); +require("modifiers"); + +function onMagicPrepare(caster, target, spell) + return 0; +end; + +function onMagicStart(caster, target, spell) + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --Actual amount of def/mdef will be calculated in OnGain + skill.statusMagnitude = caster.GetMod(modifiersGlobal.MagicEnhancePotency); + + --27365: Enhanced Protect: Increases magic defense gained from Protect. + if caster.HasTrait(27365) then + skill.statusId = 223129 + end + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/magic/raise.lua b/data/scripts/commands/magic/raise.lua new file mode 100644 index 00000000..ea794ea8 --- /dev/null +++ b/data/scripts/commands/magic/raise.lua @@ -0,0 +1,18 @@ +require("global"); +require("magic"); + +function onMagicPrepare(caster, target, spell) + return 0; +end; + +function onMagicStart(caster, target, spell) + --27363: Enhanced Raise: No longer inflicts weakness. + if caster.HasTrait(27363) then + ability.statusId = 0; + end + return 0; +end; + +--Not sure how raise works yet. +function onSkillFinish(caster, target, skill, action, actionContainer) +end; \ No newline at end of file diff --git a/data/scripts/commands/magic/regen.lua b/data/scripts/commands/magic/regen.lua new file mode 100644 index 00000000..db4bc502 --- /dev/null +++ b/data/scripts/commands/magic/regen.lua @@ -0,0 +1,34 @@ +require("global"); +require("magic"); +require("modifiers"); + +function onMagicPrepare(caster, target, spell) + return 0; +end; + +function onMagicStart(caster, target, spell) + return 0; +end; + +--http://forum.square-enix.com/ffxiv/threads/41900-White-Mage-A-Guide +function onSkillFinish(caster, target, skill, action, actionContainer) + --For every 1-2-2-1-2 (repeating 3x) then 1-2-1-2-2 (repeating 3x) Enhancing magic potency you have, the amount your Regen cures per tic increases by 1. + --.625 * Enhancing + local slope = 0.625; + local intercept = -110; + + --8051406: Healer's Culottes: Enhances Regen + if caster.HasItemEquippedInSlot(8051406, 14) then + --I don't know if the numbers in that thread are completely correct because the AF Regen table has 3 1555s in a row. + --If we assume that AF boots multiply both static parts of the regenTick equation by 1.25, we get a decently close match to actual numbers + slope = slope * 1.25; + intercept = intercept * 1.25; + end + + local regenTick = (slope * caster.GetMod(modifiersGlobal.MagicEnhancePotency)) + intercept) + 1; + + spell.statusMagnitude = regenTick; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/magic/repose.lua b/data/scripts/commands/magic/repose.lua new file mode 100644 index 00000000..8f1a2003 --- /dev/null +++ b/data/scripts/commands/magic/repose.lua @@ -0,0 +1,15 @@ +require("global"); +require("magic"); + +function onMagicPrepare(caster, target, spell) + return 0; +end; + +function onMagicStart(caster, target, spell) + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/magic/sanguine_rite.lua b/data/scripts/commands/magic/sanguine_rite.lua new file mode 100644 index 00000000..f34b3319 --- /dev/null +++ b/data/scripts/commands/magic/sanguine_rite.lua @@ -0,0 +1,21 @@ +require("global"); +require("magic"); + +function onMagicPrepare(caster, target, spell) + return 0; +end; + +function onMagicStart(caster, target, spell) + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + + --27324: Enhanced Sanguine Rite: Reduces damage taken + if caster.HasTrait(27365) then + skill.statusId = 223240 + end + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/magic/sleep.lua b/data/scripts/commands/magic/sleep.lua new file mode 100644 index 00000000..8f1a2003 --- /dev/null +++ b/data/scripts/commands/magic/sleep.lua @@ -0,0 +1,15 @@ +require("global"); +require("magic"); + +function onMagicPrepare(caster, target, spell) + return 0; +end; + +function onMagicStart(caster, target, spell) + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/magic/stone.lua b/data/scripts/commands/magic/stone.lua new file mode 100644 index 00000000..728384d3 --- /dev/null +++ b/data/scripts/commands/magic/stone.lua @@ -0,0 +1,22 @@ +require("global"); +require("magic"); + +function onMagicPrepare(caster, target, spell) + return 0; +end; + +function onMagicStart(caster, target, spell) + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate damage + action.amount = skill.basePotency; + action.statusMagnitude = 50; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); + + --Try to apply status effect + action.TryStatus(caster, target, skill, actionContainer, true); +end; \ No newline at end of file diff --git a/data/scripts/commands/magic/stonera.lua b/data/scripts/commands/magic/stonera.lua new file mode 100644 index 00000000..bc535ed2 --- /dev/null +++ b/data/scripts/commands/magic/stonera.lua @@ -0,0 +1,27 @@ +require("global"); +require("magic"); + +function onMagicPrepare(caster, target, spell) + return 0; +end; + +function onMagicStart(caster, target, spell) + return 0; +end; + +--Increased damage and conversion to single target +function onCombo(caster, target, spell) + spell.aoeType = 0; + spell.basePotency = spell.basePotency * 1.5; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); + + --Try to apply status effect + action.TryStatus(caster, target, skill, actionContainer, true); +end; \ No newline at end of file diff --git a/data/scripts/commands/magic/stoneskin.lua b/data/scripts/commands/magic/stoneskin.lua new file mode 100644 index 00000000..c49b190a --- /dev/null +++ b/data/scripts/commands/magic/stoneskin.lua @@ -0,0 +1,26 @@ +require("global"); +require("magic"); + +function onMagicPrepare(caster, target, spell) + return 0; +end; + +function onMagicStart(caster, target, spell) + return 0; +end; + +--http://forum.square-enix.com/ffxiv/threads/41900-White-Mage-A-Guide +function onSkillFinish(caster, target, skill, action, actionContainer) + + local hpPerPoint = 1.34;--? 1.33? + + --27364: Enhanced Stoneskin: Increases efficacy of Stoneskin + if caster.HasTrait(27364) then + hpPerPoint = 1.96; + end + + spell.statusMagnitude = hpPerPoint * caster.GetMod(modifiersGlobal.MagicEnhancePotency); + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/magic/thundaga.lua b/data/scripts/commands/magic/thundaga.lua new file mode 100644 index 00000000..61b2834e --- /dev/null +++ b/data/scripts/commands/magic/thundaga.lua @@ -0,0 +1,25 @@ +require("magic"); + +function onMagicPrepare(caster, target, spell) + return 0; +end; + +function onMagicStart(caster, target, spell) + return 0; +end; + +--Increased critical damage +function onCombo(caster, target, spell) + spell.critDamageModifier = 1.5; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); + + --Try to apply status effect + action.TryStatus(caster, target, skill, actionContainer, true); +end; \ No newline at end of file diff --git a/data/scripts/commands/magic/thundara.lua b/data/scripts/commands/magic/thundara.lua new file mode 100644 index 00000000..a828567a --- /dev/null +++ b/data/scripts/commands/magic/thundara.lua @@ -0,0 +1,27 @@ +require("magic"); + +function onMagicPrepare(caster, target, spell) + return 0; +end; + +function onMagicStart(caster, target, spell) + return 0; +end; + +--Increased Damage and reduced recast time in place of stun +function onCombo(caster, target, spell) + spell.statusChance = 0; + spell.basePotency = spell.basePotency * 1.5; + spell.recastTimeMs = spell.recastTimeMs / 2; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); + + --Try to apply status effect + action.TryStatus(caster, target, skill, actionContainer, true); +end; \ No newline at end of file diff --git a/data/scripts/commands/magic/thunder.lua b/data/scripts/commands/magic/thunder.lua new file mode 100644 index 00000000..96482678 --- /dev/null +++ b/data/scripts/commands/magic/thunder.lua @@ -0,0 +1,20 @@ +require("magic"); + +function onMagicPrepare(caster, target, spell) + return 0; +end; + +function onMagicStart(caster, target, spell) + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); + + --Try to apply status effect + action.TryStatus(caster, target, skill, actionContainer, true); +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/aura_pulse.lua b/data/scripts/commands/weaponskill/aura_pulse.lua new file mode 100644 index 00000000..0bf98213 --- /dev/null +++ b/data/scripts/commands/weaponskill/aura_pulse.lua @@ -0,0 +1,26 @@ +require("global"); +require("weaponskill"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +--Chance to inflict slow +function onCombo(caster, target, skill) + skill.statusChance = 0.50; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate ws damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); + + --Try to apply status effect + action.TryStatus(caster, target, skill, actionContainer, true); +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/bloodletter.lua b/data/scripts/commands/weaponskill/bloodletter.lua new file mode 100644 index 00000000..62e5988f --- /dev/null +++ b/data/scripts/commands/weaponskill/bloodletter.lua @@ -0,0 +1,26 @@ +require("global"); +require("weaponskill"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +--Changes status to Bloodletter from Bloodletter2. Changes icon of dot and adds additional damage at the end. +function onCombo(caster, target, skill) + skill.statusId = 223127; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate ws damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); + + --Try to apply status effect + action.TryStatus(caster, target, skill, actionContainer, true); +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/brutal_swing.lua b/data/scripts/commands/weaponskill/brutal_swing.lua new file mode 100644 index 00000000..a304d23e --- /dev/null +++ b/data/scripts/commands/weaponskill/brutal_swing.lua @@ -0,0 +1,23 @@ +require("global"); +require("weaponskill"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +--Increased damage +function onPositional(caster, target, skill) + skill.basePotency = skill.basePotency * 1.5; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate ws damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/chaos_thrust.lua b/data/scripts/commands/weaponskill/chaos_thrust.lua new file mode 100644 index 00000000..ed58cdab --- /dev/null +++ b/data/scripts/commands/weaponskill/chaos_thrust.lua @@ -0,0 +1,26 @@ +require("global"); +require("weaponskill"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +--Increased crit hit rating +function onCombo(caster, target, skill) + skill.bonusCritRate = 100; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate ws damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); + + --Try to apply status effect + action.TryStatus(caster, target, skill, actionContainer, true); +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/concussive_blow.lua b/data/scripts/commands/weaponskill/concussive_blow.lua new file mode 100644 index 00000000..2271f588 --- /dev/null +++ b/data/scripts/commands/weaponskill/concussive_blow.lua @@ -0,0 +1,31 @@ +require("global"); +require("weaponskill"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +--Chance to inflict blind on flank +function onPositional(caster, target, skill) + skill.statusChance = 0.75; +end; + +function onCombo(caster, target, skill) + skill.basePotency = skill.basePotency * 1.5; +end; + + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate ws damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); + + --Try to apply status effect + action.TryStatus(caster, target, skill, actionContainer, true); +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/default.lua b/data/scripts/commands/weaponskill/default.lua new file mode 100644 index 00000000..a9da9873 --- /dev/null +++ b/data/scripts/commands/weaponskill/default.lua @@ -0,0 +1,21 @@ +require("global"); +require("weaponskill"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate ws damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); + + --Try to apply status effect + action.TryStatus(caster, target, skill, actionContainer, true); +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/demolish.lua b/data/scripts/commands/weaponskill/demolish.lua new file mode 100644 index 00000000..733e9e4d --- /dev/null +++ b/data/scripts/commands/weaponskill/demolish.lua @@ -0,0 +1,30 @@ +require("global"); +require("weaponskill"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +--Dispel +--Does dispel have a text id? +function onCombo(caster, target, skill) + local effects = target.statusEffects.GetStatusEffectsByFlag(16); --lose on dispel + if effects != nil then + target.statusEffects.RemoveStatusEffect(effects[0]); + end; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate ws damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); + + --Try to apply status effect + action.TryStatus(caster, target, skill, actionContainer, true); +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/disembowel.lua b/data/scripts/commands/weaponskill/disembowel.lua new file mode 100644 index 00000000..b58a2b8e --- /dev/null +++ b/data/scripts/commands/weaponskill/disembowel.lua @@ -0,0 +1,26 @@ +require("global"); +require("weaponskill"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +--Increased paralysis duration +function onCombo(caster, target, skill) + skill.statusDuration = skill.statusDuration * 2; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate ws damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); + + --Try to apply status effect + action.TryStatus(caster, target, skill, actionContainer, true); +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/doom_spike.lua b/data/scripts/commands/weaponskill/doom_spike.lua new file mode 100644 index 00000000..e40f0057 --- /dev/null +++ b/data/scripts/commands/weaponskill/doom_spike.lua @@ -0,0 +1,23 @@ +require("global"); +require("weaponskill"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +--Increased accuracy +function onCombo(caster, target, skill) + skill.accuracyModifier = 50; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate ws damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/dragon_kick.lua b/data/scripts/commands/weaponskill/dragon_kick.lua new file mode 100644 index 00000000..115ab485 --- /dev/null +++ b/data/scripts/commands/weaponskill/dragon_kick.lua @@ -0,0 +1,26 @@ +require("global"); +require("weaponskill"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +--Chance to render target unable to use weaponskills (pacification) +function onPositional(caster, target, skill) + skill.statusChance = 0.50; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate ws damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); + + --Try to apply status effect + action.TryStatus(caster, target, skill, actionContainer, true); +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/fast_blade.lua b/data/scripts/commands/weaponskill/fast_blade.lua new file mode 100644 index 00000000..996efacb --- /dev/null +++ b/data/scripts/commands/weaponskill/fast_blade.lua @@ -0,0 +1,22 @@ +require("global"); +require("weaponskill"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +function onPositional(caster, target, skill) + skill.basePotency = skill.basePotency * 1.25; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate ws damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/feint.lua b/data/scripts/commands/weaponskill/feint.lua new file mode 100644 index 00000000..620db241 --- /dev/null +++ b/data/scripts/commands/weaponskill/feint.lua @@ -0,0 +1,18 @@ +require("global"); +require("weaponskill"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate ws damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/flat_blade.lua b/data/scripts/commands/weaponskill/flat_blade.lua new file mode 100644 index 00000000..0cbd4acf --- /dev/null +++ b/data/scripts/commands/weaponskill/flat_blade.lua @@ -0,0 +1,25 @@ +require("global"); +require("weaponskill"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +function onCombo(caster, target, skill) + --http://forum.square-enix.com/ffxiv/threads/50479-Gladiator-Paladin-STR-MND-Stat-Caps/page7 + --4.5 is a bonus on top of the 1x of normal flat blade + --This is modified by MND and dlvl and caps at 4.5, dont know the values used though + skill.enmityModifier = 5.5; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate ws damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/fracture.lua b/data/scripts/commands/weaponskill/fracture.lua new file mode 100644 index 00000000..31a84a97 --- /dev/null +++ b/data/scripts/commands/weaponskill/fracture.lua @@ -0,0 +1,21 @@ +require("global"); +require("weaponskill"); + +function onSkillPrepare(caster, target, spell) + return 0; +end; + +function onSkillStart(caster, target, spell) + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate ws damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); + + --Try to apply status effect + action.TryStatus(caster, target, skill, actionContainer, true); +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/full_thrust.lua b/data/scripts/commands/weaponskill/full_thrust.lua new file mode 100644 index 00000000..7e6e7327 --- /dev/null +++ b/data/scripts/commands/weaponskill/full_thrust.lua @@ -0,0 +1,20 @@ +require("global"); +require("weaponskill"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate ws damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); + + caster.AddTP(1000); +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/gloom_arrow.lua b/data/scripts/commands/weaponskill/gloom_arrow.lua new file mode 100644 index 00000000..1045af26 --- /dev/null +++ b/data/scripts/commands/weaponskill/gloom_arrow.lua @@ -0,0 +1,26 @@ +require("global"); +require("weaponskill"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +--Chance to inflict blind +function onCombo(caster, target, skill) + skill.statusChance = 0.75; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate ws damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); + + --Try to apply status effect + action.TryStatus(caster, target, skill, actionContainer, true); +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/godsbane.lua b/data/scripts/commands/weaponskill/godsbane.lua new file mode 100644 index 00000000..d47129ac --- /dev/null +++ b/data/scripts/commands/weaponskill/godsbane.lua @@ -0,0 +1,45 @@ +require("global"); +require("weaponskill"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +--Increased crit rate +function onCombo(caster, target, skill) + --Get Berserk statuseffect + local berserk = caster.statusEffects.GetStatusEffectById(223160); + + --if it isn't nil, remove the AP and Defense mods and reset extra to 0, increase potency + if berserk != nil then + local apPerHit = 20; + local defPerHit = 20; + + if berserk.GetTier() == 2 then + apPerHit = 24; + end + + attacker.SubtractMod(modifiersGlobal.Attack, apPerHit * berserk.GetExtra()); + attacker.Add(modifiersGlobal.Defense, defPerHit * berserk.GetExtra()); + + berserk.SetExtra(0); + + --This is about 50% crit. Don't know if that's what it gave on retail but seems kind of reasonable + skill.critRateBonus = 300; + end; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate ws damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); + + --Try to apply status effect + action.TryStatus(caster, target, skill, actionContainer, true); +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/goring_blade.lua b/data/scripts/commands/weaponskill/goring_blade.lua new file mode 100644 index 00000000..a63b71ba --- /dev/null +++ b/data/scripts/commands/weaponskill/goring_blade.lua @@ -0,0 +1,33 @@ +require("global"); +require("weaponskill"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + skill.statusMagnitude = 25;--could probalby have a status magnitude value + return 0; +end; + +--Chance to increase defense when executed from behind the target +function onPositional(caster, target, skill) + skill.statusChance = 0.90; +end; + +--Increases bleed damage +--Bleed damage seems like it's 25 with comboed being 38 (25 * 1.5 rounded up) +function onCombo(caster, target, skill) + skill.statusMagnitude = 38; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate ws damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); + + --Try to apply status effect + action.TryStatus(caster, target, skill, actionContainer, true); +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/haymaker.lua b/data/scripts/commands/weaponskill/haymaker.lua new file mode 100644 index 00000000..a9da9873 --- /dev/null +++ b/data/scripts/commands/weaponskill/haymaker.lua @@ -0,0 +1,21 @@ +require("global"); +require("weaponskill"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate ws damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); + + --Try to apply status effect + action.TryStatus(caster, target, skill, actionContainer, true); +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/heavy_shot.lua b/data/scripts/commands/weaponskill/heavy_shot.lua new file mode 100644 index 00000000..620db241 --- /dev/null +++ b/data/scripts/commands/weaponskill/heavy_shot.lua @@ -0,0 +1,18 @@ +require("global"); +require("weaponskill"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate ws damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/heavy_swing.lua b/data/scripts/commands/weaponskill/heavy_swing.lua new file mode 100644 index 00000000..ce72c59b --- /dev/null +++ b/data/scripts/commands/weaponskill/heavy_swing.lua @@ -0,0 +1,24 @@ +require("global"); +require("weaponskill"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +--Increased accuracy +function onCombo(caster, target, skill) + skill.accuracyModifier = 50; +end; + + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate ws damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/heavy_thrust.lua b/data/scripts/commands/weaponskill/heavy_thrust.lua new file mode 100644 index 00000000..cbdea342 --- /dev/null +++ b/data/scripts/commands/weaponskill/heavy_thrust.lua @@ -0,0 +1,26 @@ +require("global"); +require("weaponskill"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +--Increased stun duration +function onCombo(caster, target, skill) + skill.statusDuration = 10; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate ws damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); + + --Try to apply status effect + action.TryStatus(caster, target, skill, actionContainer, true); +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/howling_fist.lua b/data/scripts/commands/weaponskill/howling_fist.lua new file mode 100644 index 00000000..d588268b --- /dev/null +++ b/data/scripts/commands/weaponskill/howling_fist.lua @@ -0,0 +1,28 @@ +require("global"); +require("weaponskill"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +--Increased accuracy +function onPositional(caster, target, skill) + skill.accuracyModifier = 50; +end; + +--Increased damage +function onCombo(caster, target, skill) + skill.basePotency = skill.basePotency * 1.5; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate ws damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/impulse_drive.lua b/data/scripts/commands/weaponskill/impulse_drive.lua new file mode 100644 index 00000000..1459ebf6 --- /dev/null +++ b/data/scripts/commands/weaponskill/impulse_drive.lua @@ -0,0 +1,28 @@ +require("global"); +require("weaponskill"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +--Increased damage +function onPositional(caster, target, skill) + skill.basePotency = skill.basePotency * 1.25 +end; + +--Increased crit hit rating +function onCombo(caster, target, skill) + skill.bonusCritRate = 200; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate ws damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/leaden_arrow.lua b/data/scripts/commands/weaponskill/leaden_arrow.lua new file mode 100644 index 00000000..e94da64b --- /dev/null +++ b/data/scripts/commands/weaponskill/leaden_arrow.lua @@ -0,0 +1,26 @@ +require("global"); +require("weaponskill"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +--Increased Heavy duration, becomes 60 seconds +function onCombo(caster, target, skill) + skill.statusDuration = 60; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate ws damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); + + --Try to apply status effect + action.TryStatus(caster, target, skill, actionContainer, true); +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/leg_sweep.lua b/data/scripts/commands/weaponskill/leg_sweep.lua new file mode 100644 index 00000000..a8428109 --- /dev/null +++ b/data/scripts/commands/weaponskill/leg_sweep.lua @@ -0,0 +1,26 @@ +require("global"); +require("weaponskill"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +--Chance to inflict stun +function onCombo(caster, target, skill) + skill.statusChance = 0.50; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate ws damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); + + --Try to apply status effect + action.TryStatus(caster, target, skill, actionContainer, true); +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/maim.lua b/data/scripts/commands/weaponskill/maim.lua new file mode 100644 index 00000000..861e4315 --- /dev/null +++ b/data/scripts/commands/weaponskill/maim.lua @@ -0,0 +1,22 @@ +require("global"); +require("weaponskill"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +function onCombo(caster, target, skill) + skill.accuracyModifier = 50; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate ws damage + skill.Potency = 100; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/overpower.lua b/data/scripts/commands/weaponskill/overpower.lua new file mode 100644 index 00000000..620db241 --- /dev/null +++ b/data/scripts/commands/weaponskill/overpower.lua @@ -0,0 +1,18 @@ +require("global"); +require("weaponskill"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate ws damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/path_of_the_storm.lua b/data/scripts/commands/weaponskill/path_of_the_storm.lua new file mode 100644 index 00000000..e8a48aaf --- /dev/null +++ b/data/scripts/commands/weaponskill/path_of_the_storm.lua @@ -0,0 +1,26 @@ +require("global"); +require("weaponskill"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +--Chance to inflict heavy when executed from behind +function onPositional(caster, target, skill) + skill.statusChance = 0.50; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate ws damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); + + --Try to apply status effect + action.TryStatus(caster, target, skill, actionContainer, true); +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/phalanx.lua b/data/scripts/commands/weaponskill/phalanx.lua new file mode 100644 index 00000000..620db241 --- /dev/null +++ b/data/scripts/commands/weaponskill/phalanx.lua @@ -0,0 +1,18 @@ +require("global"); +require("weaponskill"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate ws damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/piercing_arrow.lua b/data/scripts/commands/weaponskill/piercing_arrow.lua new file mode 100644 index 00000000..620db241 --- /dev/null +++ b/data/scripts/commands/weaponskill/piercing_arrow.lua @@ -0,0 +1,18 @@ +require("global"); +require("weaponskill"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate ws damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/pounce.lua b/data/scripts/commands/weaponskill/pounce.lua new file mode 100644 index 00000000..31089960 --- /dev/null +++ b/data/scripts/commands/weaponskill/pounce.lua @@ -0,0 +1,25 @@ +require("global"); +require("weaponskill"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +function onPositional(caster, target, skill) + skill.statusChance = 0.50; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate ws damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); + + --Try to apply status effect + action.TryStatus(caster, target, skill, actionContainer, true); +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/pummel.lua b/data/scripts/commands/weaponskill/pummel.lua new file mode 100644 index 00000000..996efacb --- /dev/null +++ b/data/scripts/commands/weaponskill/pummel.lua @@ -0,0 +1,22 @@ +require("global"); +require("weaponskill"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +function onPositional(caster, target, skill) + skill.basePotency = skill.basePotency * 1.25; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate ws damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/quick_nock.lua b/data/scripts/commands/weaponskill/quick_nock.lua new file mode 100644 index 00000000..8ff7da1c --- /dev/null +++ b/data/scripts/commands/weaponskill/quick_nock.lua @@ -0,0 +1,26 @@ +require("global"); +require("weaponskill"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +--fivefold attack/conversion +function onCombo(caster, target, skill) + skill.numHits = 5; + skill.aoeType = 0; + skill.aoeTarget = 2; + --animation change? +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate ws damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/rage_of_halone.lua b/data/scripts/commands/weaponskill/rage_of_halone.lua new file mode 100644 index 00000000..d459bdbe --- /dev/null +++ b/data/scripts/commands/weaponskill/rage_of_halone.lua @@ -0,0 +1,25 @@ +require("global"); +require("weaponskill"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +--Accuracy increase +function onCombo(caster, target, skill) + --Rage of Halone normally has a -40% hit rate modifier. + --Does the combo negate that, or does it make it even more accurate than if it didnt have the modifier? + skill.accuracyModifier = 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate ws damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/rain_of_death.lua b/data/scripts/commands/weaponskill/rain_of_death.lua new file mode 100644 index 00000000..53e84097 --- /dev/null +++ b/data/scripts/commands/weaponskill/rain_of_death.lua @@ -0,0 +1,26 @@ +require("global"); +require("weaponskill"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +--Chance to inflict stun +function onCombo(caster, target, skill) + skill.statusChance = 0.75 +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate ws damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); + + --Try to apply status effect + action.TryStatus(caster, target, skill, actionContainer, true); +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/ring_of_talons.lua b/data/scripts/commands/weaponskill/ring_of_talons.lua new file mode 100644 index 00000000..ffa4994a --- /dev/null +++ b/data/scripts/commands/weaponskill/ring_of_talons.lua @@ -0,0 +1,23 @@ +require("global"); +require("weaponskill"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +--Increased critical hit rate +function onCombo(caster, target, skill) + skill.bonusCritRate = 100; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate ws damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/riot_blade.lua b/data/scripts/commands/weaponskill/riot_blade.lua new file mode 100644 index 00000000..d4cd7c07 --- /dev/null +++ b/data/scripts/commands/weaponskill/riot_blade.lua @@ -0,0 +1,27 @@ +require("global"); +require("weaponskill"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +--Chance to decrease defense when executed from behind the target +function onPositional(caster, target, skill) + skill.statusChance = 0.75; + skill.statusMagnitude = 100; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate ws damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); + + --Try to apply status effect + action.TryStatus(caster, target, skill, actionContainer, true); +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/savage_blade.lua b/data/scripts/commands/weaponskill/savage_blade.lua new file mode 100644 index 00000000..75985bc7 --- /dev/null +++ b/data/scripts/commands/weaponskill/savage_blade.lua @@ -0,0 +1,22 @@ +require("global"); +require("weaponskill"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +function onCombo(caster, target, skill) + skill.basePotency = skill.basePotency * 1.25; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate ws damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/shadowbind.lua b/data/scripts/commands/weaponskill/shadowbind.lua new file mode 100644 index 00000000..829a81db --- /dev/null +++ b/data/scripts/commands/weaponskill/shadowbind.lua @@ -0,0 +1,26 @@ +require("global"); +require("weaponskill"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +--Increased Bind duration +function onCombo(caster, target, skill) + skill.statusDuration = 30; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate ws damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); + + --Try to apply status effect + action.TryStatus(caster, target, skill, actionContainer, true); +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/shield_bash.lua b/data/scripts/commands/weaponskill/shield_bash.lua new file mode 100644 index 00000000..a9da9873 --- /dev/null +++ b/data/scripts/commands/weaponskill/shield_bash.lua @@ -0,0 +1,21 @@ +require("global"); +require("weaponskill"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate ws damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); + + --Try to apply status effect + action.TryStatus(caster, target, skill, actionContainer, true); +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/shoulder_tackle.lua b/data/scripts/commands/weaponskill/shoulder_tackle.lua new file mode 100644 index 00000000..2fef254a --- /dev/null +++ b/data/scripts/commands/weaponskill/shoulder_tackle.lua @@ -0,0 +1,26 @@ +require("global"); +require("weaponskill"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --chance to influct stun only when target has no enmity towards you + if not (target.hateContainer.HasHateForTarget(caster)) then + skill.statusChance = 0.50; + end + + --calculate ws damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); + + --Try to apply status effect + action.TryStatus(caster, target, skill, actionContainer, true); +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/simian_thrash.lua b/data/scripts/commands/weaponskill/simian_thrash.lua new file mode 100644 index 00000000..545468c0 --- /dev/null +++ b/data/scripts/commands/weaponskill/simian_thrash.lua @@ -0,0 +1,23 @@ +require("global"); +require("weaponskill"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +--Increased damage +function onCombo(caster, target, skill) + skill.basePotency = skill.basePotency * 1.5; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate ws damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/skull_sunder.lua b/data/scripts/commands/weaponskill/skull_sunder.lua new file mode 100644 index 00000000..ac7056dd --- /dev/null +++ b/data/scripts/commands/weaponskill/skull_sunder.lua @@ -0,0 +1,24 @@ +require("global"); +require("weaponskill"); + +function onSkillPrepare(caster, target, spell) + return 0; +end; + +function onSkillStart(caster, target, spell) + return 0; +end; + +--Increased enmity +function onCombo(caster, target, skill) + --https://www.bluegartr.com/threads/107403-Stats-and-how-they-work/page17 + skill.enmityModifier = 2.75; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate ws damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/spirits_within.lua b/data/scripts/commands/weaponskill/spirits_within.lua new file mode 100644 index 00000000..193a7a70 --- /dev/null +++ b/data/scripts/commands/weaponskill/spirits_within.lua @@ -0,0 +1,29 @@ +require("global"); +require("weaponskill"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +--Increased enmity +function onCombo(caster, target, skill) + skill.enmityModifier = 2.5; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --Increased damage with higher hp + --random guess + local potencyModifier = caster:GetHPP() + 25; + + skill.basePotency = skill.basePotency * potencyModifier; + + --calculate ws damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/steel_cyclone.lua b/data/scripts/commands/weaponskill/steel_cyclone.lua new file mode 100644 index 00000000..4f1314cd --- /dev/null +++ b/data/scripts/commands/weaponskill/steel_cyclone.lua @@ -0,0 +1,26 @@ +require("global"); +require("weaponskill"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +--Increased critical hit rate +function onCombo(caster, target, skill) + skill.bonusCritRate = 200; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate ws damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); + + --Try to apply status effect + action.TryStatus(caster, target, skill, actionContainer, true); +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/sucker_punch.lua b/data/scripts/commands/weaponskill/sucker_punch.lua new file mode 100644 index 00000000..5f188546 --- /dev/null +++ b/data/scripts/commands/weaponskill/sucker_punch.lua @@ -0,0 +1,44 @@ +require("global"); +require("weaponskill"); +require("battleutils"); +require("hiteffect"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +-- +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate ws damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, action); + + --additional effect + --Restores MP + --Comboed formula seems to be (0.40 * damage) + 180 + --Uncomboed formula seems to be 0.30 * damage + --These may be wrong. It seems like max mp might influence the slope + + --1.21: Equation used to calculate amount of MP adjusted. + --fug + --This might mean max MP isn't involved and the difference was between patches. need to recheck videos + if action.GetHitType() > HitType.Evade and (action.param == HitDirection.Right or action.param == HitDirection.Left) then + local mpToReturn = 0; + + if skill.isCombo then + mpToReturn = (0.40 * action.amount) + 180; + else + mpToReturn = (0.30 * action.amount); + end + + caster.AddMP(mpToReturn); + --30452: You recover x MP. + actionContainer.AddMPAction(caster.actorId, 30452, mpToReturn); + end +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/true_thrust.lua b/data/scripts/commands/weaponskill/true_thrust.lua new file mode 100644 index 00000000..ec3d888f --- /dev/null +++ b/data/scripts/commands/weaponskill/true_thrust.lua @@ -0,0 +1,23 @@ +require("global"); +require("weaponskill"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +--Increased accuracy from in front +function onPositional(caster, target, skill) + skill.accuracyModifier = 50; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate ws damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/vorpal_thrust.lua b/data/scripts/commands/weaponskill/vorpal_thrust.lua new file mode 100644 index 00000000..7669640d --- /dev/null +++ b/data/scripts/commands/weaponskill/vorpal_thrust.lua @@ -0,0 +1,26 @@ +require("global"); +require("weaponskill"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +--Increased crit rating from behind +function onPositional(caster, target, skill) + skill.bonusCritRate = 200; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate ws damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); + + --Try to apply status effect + action.TryStatus(caster, target, skill, actionContainer, true); +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/war_drum.lua b/data/scripts/commands/weaponskill/war_drum.lua new file mode 100644 index 00000000..e71feea1 --- /dev/null +++ b/data/scripts/commands/weaponskill/war_drum.lua @@ -0,0 +1,20 @@ +require("global"); +require("weaponskill"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate ws damage + action.amount = skill.basePotency; + + --might be wrong + action.enmity = action.enmity + 400; + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/whirlwind.lua b/data/scripts/commands/weaponskill/whirlwind.lua new file mode 100644 index 00000000..26b7a7e1 --- /dev/null +++ b/data/scripts/commands/weaponskill/whirlwind.lua @@ -0,0 +1,40 @@ +require("global"); +require("weaponskill"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +--Reset Berserk effect, increase damage? +function onCombo(caster, target, skill) + --Get Berserk statuseffect + local berserk = caster.statusEffects.GetStatusEffectById(223160); + + --if it isn't nil, remove the AP and Defense mods and reset extra to 0, increase potency + if berserk != nil then + local apPerHit = 20; + local defPerHit = 20; + + if berserk.GetTier() == 2 then + apPerHit = 24; + end + + attacker.SubtractMod(modifiersGlobal.Attack, apPerHit * berserk.GetExtra()); + attacker.Add(modifiersGlobal.Defense, defPerHit * berserk.GetExtra()); + + berserk.SetExtra(0); + skill.basePotency = skill.basePotency * 1.5; + end; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate ws damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/commands/weaponskill/wide_volley.lua b/data/scripts/commands/weaponskill/wide_volley.lua new file mode 100644 index 00000000..a16f8cd1 --- /dev/null +++ b/data/scripts/commands/weaponskill/wide_volley.lua @@ -0,0 +1,23 @@ +require("global"); +require("weaponskill"); + +function onSkillPrepare(caster, target, skill) + return 0; +end; + +function onSkillStart(caster, target, skill) + return 0; +end; + +--Increased Accuracy +function onCombo(caster, target, skill) + skill.accuracyModifier = 40; +end; + +function onSkillFinish(caster, target, skill, action, actionContainer) + --calculate ws damage + action.amount = skill.basePotency; + + --DoAction handles rates, buffs, dealing damage + action.DoAction(caster, target, skill, actionContainer); +end; \ No newline at end of file diff --git a/data/scripts/content/SimpleContent30010.lua b/data/scripts/content/SimpleContent30010.lua index d78c2935..f510c173 100644 --- a/data/scripts/content/SimpleContent30010.lua +++ b/data/scripts/content/SimpleContent30010.lua @@ -1,30 +1,79 @@ +require ("global") +require ("modifiers") function onCreate(starterPlayer, contentArea, director) + --papalymo = contentArea:SpawnActor(2290005, "papalymo", 365.89, 4.0943, -706.72, -0.718); + --yda = contentArea:SpawnActor(2290006, "yda", 365.266, 4.122, -700.73, 1.5659); + + --mob1 = contentArea:SpawnActor(2201407, "mob1", 374.427, 4.4, -698.711, -1.942); + --mob2 = contentArea:SpawnActor(2201407, "mob2", 375.377, 4.4, -700.247, -1.992); + --mob3 = contentArea:SpawnActor(2201407, "mob3", 375.125, 4.4, -703.591, -1.54); + yda = GetWorldManager().SpawnBattleNpcById(6, contentArea); + papalymo = GetWorldManager().SpawnBattleNpcById(7, contentArea); + --yda:ChangeState(2); + mob1 = GetWorldManager().SpawnBattleNpcById(3, contentArea); + mob2 = GetWorldManager().SpawnBattleNpcById(4, contentArea); + mob3 = GetWorldManager().SpawnBattleNpcById(5, contentArea); + starterPlayer.currentParty:AddMember(papalymo.actorId); + starterPlayer.currentParty:AddMember(yda.actorId); + starterPlayer:SetMod(modifiersGlobal.MinimumHpLock, 1); - papalymo = contentArea:SpawnActor(2290005, "papalymo", 365.89, 4.0943, -706.72, -0.718); - yda = contentArea:SpawnActor(2290006, "yda", 365.266, 4.122, -700.73, 1.5659); - yda:ChangeState(2); - - mob1 = contentArea:SpawnActor(2201407, "mob1", 374.427, 4.4, -698.711, -1.942); - mob2 = contentArea:SpawnActor(2201407, "mob2", 375.377, 4.4, -700.247, -1.992); - mob3 = contentArea:SpawnActor(2201407, "mob3", 375.125, 4.4, -703.591, -1.54); openingStoper = contentArea:SpawnActor(1090384, "openingstoper", 356.09, 3.74, -701.62, -1.41); director:AddMember(starterPlayer); director:AddMember(director); - director:AddMember(papalymo); + director:AddMember(papalymo); director:AddMember(yda); director:AddMember(mob1); director:AddMember(mob2); director:AddMember(mob3); - director:StartContentGroup(); + --director:StartContentGroup(); end function onDestroy() - +end +function onUpdate(tick, area) + if area then + local players = area:GetPlayers() + local mobs = area:GetMonsters() + local allies = area:GetAllies() + local resumeChecks = true + for player in players do + if player then + local exitLoop = false + + if allies then + for i = 0, #allies - 1 do + if allies[i] then + if not allies[i]:IsEngaged() then + if player:IsEngaged() and player.target then + + allies[i].neutral = false + allies[i].isAutoAttackEnabled = true + allies[i]:SetMod(modifiersGlobal.Speed, 8) + allyGlobal.EngageTarget(allies[i], player.target) + exitLoop = true + break + -- todo: support scripted paths + elseif allies[i]:GetSpeed() > 0 then + end + end + end + end + end + if exitLoop then + resumeChecks = false + break + end + end + end + if not resumeChecks then + return + end + end end \ No newline at end of file diff --git a/data/scripts/directors/OpeningDirector.lua b/data/scripts/directors/OpeningDirector.lua index b9952fad..bc226d81 100644 --- a/data/scripts/directors/OpeningDirector.lua +++ b/data/scripts/directors/OpeningDirector.lua @@ -28,7 +28,7 @@ function onUpdate() end function onTalkEvent(player, npc) -; + if (player:HasQuest(110001) == true) then man0l0Quest = player:GetQuest("man0l0"); diff --git a/data/scripts/directors/Quest/QuestDirectorMan0g001.lua b/data/scripts/directors/Quest/QuestDirectorMan0g001.lua index ebb44989..934e48be 100644 --- a/data/scripts/directors/Quest/QuestDirectorMan0g001.lua +++ b/data/scripts/directors/Quest/QuestDirectorMan0g001.lua @@ -1,5 +1,6 @@ require ("global") require ("tutorial") +require ("modifiers") require ("quests/man/man0g0") --processTtrBtl001: Active Mode Tutorial @@ -9,38 +10,90 @@ function init() return "/Director/Quest/QuestDirectorMan0g001"; end -function onEventStarted(player, actor, triggerName) +function onCreateContentArea(players, director, contentArea, contentGroup) + director:StartContentGroup(); +end +function onEventStarted(player, actor, triggerName) man0g0Quest = player:GetQuest("Man0g0"); + player:SetMod(modifiersGlobal.MinimumHpLock, 1); + player:SendMessage(0x20, "", "Starting"); startTutorialMode(player); callClientFunction(player, "delegateEvent", player, man0g0Quest, "processTtrBtl001", nil, nil, nil); player:EndEvent(); + player:SendMessage(0x20, "", "Waiting for player active"); waitForSignal("playerActive"); + player:SendMessage(0x20, "", "player active"); wait(1); --If this isn't here, the scripts bugs out. TODO: Find a better alternative. kickEventContinue(player, actor, "noticeEvent", "noticeEvent"); callClientFunction(player, "delegateEvent", player, man0g0Quest, "processTtrBtl002", nil, nil, nil); + player:SendMessage(0x20, "", "processTtrBtl002 called"); player:EndEvent(); - wait(4); - closeTutorialWidget(player); - showTutorialSuccessWidget(player, 9055); --Open TutorialSuccessWidget for attacking enemy - wait(3); - openTutorialWidget(player, CONTROLLER_KEYBOARD, TUTORIAL_TP); - wait(5); - closeTutorialWidget(player); - openTutorialWidget(player, CONTROLLER_KEYBOARD, TUTORIAL_WEAPONSKILLS); - wait(4); --Should be wait for weaponskillUsed signal - closeTutorialWidget(player); - showTutorialSuccessWidget(player, 9065); --Open TutorialSuccessWidget for weapon skill + + --Combat portion of tutorial - wait(6); --Should be wait for mobkill + if player:IsDiscipleOfWar() then + player:SendMessage(0x20, "", "Is DoW"); + waitForSignal("playerAttack"); + closeTutorialWidget(player); + showTutorialSuccessWidget(player, 9055); --Open TutorialSuccessWidget for attacking enemy + openTutorialWidget(player, CONTROLLER_KEYBOARD, TUTORIAL_TP); + waitForSignal("tpOver1000"); + player:SetMod(modifiersGlobal.MinimumTpLock, 1000); + closeTutorialWidget(player); + openTutorialWidget(player, CONTROLLER_KEYBOARD, TUTORIAL_WEAPONSKILLS); + waitForSignal("weaponskillUsed"); + player:SetMod(modifiersGlobal.MinimumTpLock, 0); + closeTutorialWidget(player); + showTutorialSuccessWidget(player, 9065); --Open TutorialSuccessWidget for weapon skill + elseif player:IsDiscipleOfMagic() then + player:SendMessage(0x20, "", "Is DoM"); + openTutorialWidget(player, CONTROLLER_KEYBOARD, TUTORIAL_CASTING); + waitForSignal("spellUsed"); + closeTutorialWidget(player); + elseif player:IsDiscipleOfHand() then + waitForSignal("abilityUsed"); + elseif player:IsDiscipleOfLand() then + waitForSignal("abilityUsed"); + end + + player:SendMessage(0x20, "", "Waiting for mobkill1"); + waitForSignal("mobkill"); --Should be wait for mobkill + player:SendMessage(0x20, "", "Waiting for mobkill2"); + waitForSignal("mobkill"); + player:SendMessage(0x20, "", "Waiting for mobkill3"); + waitForSignal("mobkill"); worldMaster = GetWorldMaster(); + player:SetMod(modifiersGlobal.MinimumHpLock, 0); + player:SendMessage(0x20, "", "Sending data packet 'attention'"); player:SendDataPacket("attention", worldMaster, "", 51073, 2); - wait(7); - player:ChangeMusic(7); - player:ChangeState(0); - kickEventContinue(player, actor, "noticeEvent", "noticeEvent"); - callClientFunction(player, "delegateEvent", player, man0g0Quest, "processEvent020_1", nil, nil, nil); + wait(5); + player:SendMessage(0x20, "", "Disengaging"); + player:Disengage(0x0000); + wait(5); + player:SendMessage(0x20, "", "NextPhase(10)"); + man0g0Quest:NextPhase(10); + wait(5); + player:SendMessage(0x20, "", "ProcessEvent020_1"); + callClientFunction(player, "delegateEvent", player, man0g0Quest, "processEvent020_1", nil, nil, nil); + + wait(5); + player:SendMessage(0x20, "", "Changing music"); + player:ChangeMusic(7); + wait(5); + + player:SendMessage(0x20, "", "Kick notice event"); + kickEventContinue(player, actor, "noticeEvent", "noticeEvent"); + wait(5); + + player:SendMessage(0x20, "", "ContentFinished"); + player:GetZone():ContentFinished(); + wait(5); + player:SendMessage(0x20, "", "Remove from party"); + player:RemoveFromCurrentPartyAndCleanup(); + --player:EndEvent(); + --GetWorldManager():DoZoneChange(player, 155, "PrivateAreaMasterPast", 1, 15, 175.38, -1.21, -1156.51, -2.1); --[[ IF DoW: OpenWidget (TP) @@ -51,17 +104,18 @@ function onEventStarted(player, actor, triggerName) Success CloseWidget ELSE MAGIC: - OpenWidget (DEFEAT ENEMY) + OpenWidget (DEFEAT ENEMY) ]] - man0g0Quest:NextPhase(10); player:EndEvent(); + wait(5); + player:SendMessage(0x20, "", "Zone change"); GetWorldManager():DoZoneChange(player, 155, "PrivateAreaMasterPast", 1, 15, 175.38, -1.21, -1156.51, -2.1); end -function onUpdate() +function onUpdate(deltaTime, area) end function onTalkEvent(player, npc) @@ -79,4 +133,8 @@ function onEventUpdate(player, npc) end function onCommand(player, command) -end \ No newline at end of file +end + +function main(director, contentGroup) + onCreateContentArea(director:GetPlayerMembers(), director, director:GetZone(), contentGroup); +end; \ No newline at end of file diff --git a/data/scripts/directors/Quest/QuestDirectorMan0l001.lua b/data/scripts/directors/Quest/QuestDirectorMan0l001.lua index f26b1094..eb6d4d75 100644 --- a/data/scripts/directors/Quest/QuestDirectorMan0l001.lua +++ b/data/scripts/directors/Quest/QuestDirectorMan0l001.lua @@ -15,7 +15,9 @@ function onCreateContentArea(players, director, contentArea, contentGroup) mob2 = contentArea:SpawnActor(2205403, "mob2", -3.02, 17.35, 14.24, -2.81); mob3 = contentArea:SpawnActor(2205403, "mob3", -3.02-3, 17.35, 14.24, -2.81); - contentGroup:AddMember(player); + for _, player in pairs(players) do + contentGroup:AddMember(player); + end; contentGroup:AddMember(director); contentGroup:AddMember(yshtola); contentGroup:AddMember(stahlmann); diff --git a/data/scripts/effects/aegis_boon.lua b/data/scripts/effects/aegis_boon.lua new file mode 100644 index 00000000..2f909fd1 --- /dev/null +++ b/data/scripts/effects/aegis_boon.lua @@ -0,0 +1,19 @@ +require("modifiers") +require("utils") + +--Forces a full block (0 damage taken) +function onPreAction(effect, caster, target, skill, action, actionContainer) + --If action hit from the rear and is a weaponskill ation + action.blockRate = 100.0; +end; + +--Heals for the amount of HP blocked, up to a certain point. I don't know what determines the cap but it seems to be 703 at level 50. Unsure if it scales down based on level, dlvl, or if that's an arbitrary cap added. +function onBlock(effect, attacker, defender, action, actionContainer) + --Amount blocked + local absorbAmount = math.Clamp(action.amountMitigated, 0, 703); + + --33008: You recover x HP from Aegis Boon + defender.AddHP(absorbAmount); + actionContainer.AddHPAction(defender.actorId, 33008, absorbAmount); + actionContainer.AddAction(defender.statusEffects.RemoveStatusEffectForBattleAction(effect)); +end; \ No newline at end of file diff --git a/data/scripts/effects/aero.lua b/data/scripts/effects/aero.lua new file mode 100644 index 00000000..53a413c4 --- /dev/null +++ b/data/scripts/effects/aero.lua @@ -0,0 +1,10 @@ +require("modifiers") + +--Doesn't do flat damage. 20 on Lv 50 Truffle Hog, 11 on Coincounter, 7 on nael hard, 19 on 52 fachan +function onGain(owner, effect) + owner.AddMod(modifiersGlobal.RegenDown, effect.GetMagnitude()); +end; + +function onLose(owner, effect) + owner.AddMod(modifiersGlobal.RegenDown, effect.GetMagnitude()); +end; \ No newline at end of file diff --git a/data/scripts/effects/antagonize.lua b/data/scripts/effects/antagonize.lua new file mode 100644 index 00000000..a88cedf7 --- /dev/null +++ b/data/scripts/effects/antagonize.lua @@ -0,0 +1,13 @@ +require("modifiers") + +--Antagonize's enmity bonus is x1.5 (works for both abilities and damage dealt). x1.65 when AF is worn. +--Is does this mean it's 1.5* or 2.5*? +function onCommandStart(effect, owner, skill, actionContainer) + local enmityModifier = 1.5 + + if effect.GetTier() == 2 then + enmityModifier = 1.65; + end + + skill.enmityModifier = skill.enmityModifier + enmityModifier; +end \ No newline at end of file diff --git a/data/scripts/effects/ballad_of_magi.lua b/data/scripts/effects/ballad_of_magi.lua new file mode 100644 index 00000000..e64f5751 --- /dev/null +++ b/data/scripts/effects/ballad_of_magi.lua @@ -0,0 +1,10 @@ +require("modifiers") + +function onGain(owner, effect) + --Only one song per bard can be active, need to figure out a good way to do this + owner.AddMod(modifiersGlobal.Refresh, effect.GetMagnitude()); +end; + +function onLose(owner, effect) + owner.SubtractMod(modifiersGlobal.Refresh, effect.GetMagnitude()); +end; \ No newline at end of file diff --git a/data/scripts/effects/barrage.lua b/data/scripts/effects/barrage.lua new file mode 100644 index 00000000..59c097da --- /dev/null +++ b/data/scripts/effects/barrage.lua @@ -0,0 +1,13 @@ +function onCommandStart(effect, owner, skill, actionContainer) + --27259: Light Shot + if skill.id == 27259 then + skill.numHits = effect.GetMagnitude(); + end +end; + +function onCommandFinish(effect, owner, skill, actionContainer) + --27259: Light Shot + if skill.id == 27259 then + actionContainer.AddAction(owner.statusEffects.RemoveStatusEffectForBattleAction(effect)); + end +end; \ No newline at end of file diff --git a/data/scripts/effects/battle_voice.lua b/data/scripts/effects/battle_voice.lua new file mode 100644 index 00000000..4cbc19ff --- /dev/null +++ b/data/scripts/effects/battle_voice.lua @@ -0,0 +1,3 @@ +require("modifiers") + +--BV doesn't really do anything i think \ No newline at end of file diff --git a/data/scripts/effects/berserk2.lua b/data/scripts/effects/berserk2.lua new file mode 100644 index 00000000..0a7d37ec --- /dev/null +++ b/data/scripts/effects/berserk2.lua @@ -0,0 +1,58 @@ +require("modifiers"); + +function onGain(owner, effect) + owner.statusEffects.RemoveStatusEffect(223208); +end + +--Increases attack power and reduces defense with each successful attack +--Does this include weaponskills? +--Is this on every hit or every succesfull skill useage? +function onHit(effect, attacker, defender, action, actionContainer) + --Trait increases effect by 20%. Does this include the reduced defense, + --does this increase the cap or the rate at which you get AP or both? + + if (effect.GetExtra() < 10) then + --This will count how many hits there have been + effect.SetExtra(effect.GetExtra() + 1); + + --If you update these make sure to update them in Whirlwind as well + local apPerHit = 20; + local defPerHit = 20; + + if effect.GetTier() == 2 then + apPerHit = 24; + end + + --Just going to say every hit adds 20 AP up to 200 + --Same for defense + --Traited will be 24 up to 240 + --assuming defense is static + attacker.AddMod(modifiersGlobal.Attack, apPerHit); + attacker.SubtractMod(modifiersGlobal.Defense, defPerHit); + end +end; + +function onDamageTaken(effect, attacker, defender, action, actionContainer) + local apPerHit = 20; + local defPerHit = 20; + + if effect.GetTier() == 2 then + apPerHit = 24; + end + + defender.SubtractMod(modifiersGlobal.Attack, effect.GetExtra() * apPerHit); + defender.SubtractMod(modifiersGlobal.Defense, effect.GetExtra() * defPerHit); + effect.SetExtra(0); +end + +function onLose(owner, effect) + local apPerHit = 20; + local defPerHit = 20; + + if effect.GetTier() == 2 then + apPerHit = 24; + end + + owner.SubtractMod(modifiersGlobal.Attack, effect.GetExtra() * apPerHit); + owner.SubtractMod(modifiersGlobal.Defense, effect.GetExtra() * defPerHit); +end \ No newline at end of file diff --git a/data/scripts/effects/bind.lua b/data/scripts/effects/bind.lua new file mode 100644 index 00000000..2ef3b0f4 --- /dev/null +++ b/data/scripts/effects/bind.lua @@ -0,0 +1,7 @@ +require("modifiers"); + +function onGain(target, effect) +end; + +function onLose(target, effect) +end; \ No newline at end of file diff --git a/data/scripts/effects/blind.lua b/data/scripts/effects/blind.lua new file mode 100644 index 00000000..59e06fbd --- /dev/null +++ b/data/scripts/effects/blind.lua @@ -0,0 +1,9 @@ +require("modifiers") + +function onGain(owner, effect) + owner.SubtractMod(modifiersGlobal.Accuracy, effect.GetMagnitude()); +end; + +function onLose(owner, effect) + owner.AddMod(modifiersGlobal.Accuracy, effect.GetMagnitude()); +end; \ No newline at end of file diff --git a/data/scripts/effects/blindside.lua b/data/scripts/effects/blindside.lua new file mode 100644 index 00000000..27590af4 --- /dev/null +++ b/data/scripts/effects/blindside.lua @@ -0,0 +1,15 @@ +require("modifiers") +require("battleutils") + +--Forces crit of a single WS action from rear. +function onPreAction(effect, caster, target, skill, action, actionContainer) + --If action hit from the rear and is a weaponskill ation + if (action.param == HitDirection.Rear and action.commandType == CommandType.WeaponSkill) then + --Set action's crit rate to 100% + action.critRate = 100.0; + end + + --Remove status and add message + actionsList.AddAction(target.statusEffects.RemoveForBattleAction(effect)); +end; + diff --git a/data/scripts/effects/blissful_mind.lua b/data/scripts/effects/blissful_mind.lua new file mode 100644 index 00000000..1c12cfff --- /dev/null +++ b/data/scripts/effects/blissful_mind.lua @@ -0,0 +1,21 @@ +--The amount of time it takes to fully charge varies depending on how much MP it has to restore, meaning its not just a percent every tick +--Based on a few videos it seems like it heals for 0.5% of max MP every second, traited. This is an early guess but it seems correct +--Untraited is less clear. It could be 0.25%, 0.30%, or 0.40%. Guessing it's 0.30 + +function onTick(owner, effect) + local percentPerSecond = 0.0030; + + if effect.GetTier() == 2 then + percentPerSecond = 0.005; + end + + print(effect.GetExtra()); + + local amount = percentPerSecond * owner.GetMaxMP() + 0.25; + effect.SetExtra(effect.GetExtra() + amount); + if effect.GetExtra() >= effect.GetMagnitude() then + --223242: Fully Blissful Mind + owner.statusEffects.ReplaceEffect(effect, 223242, 1, effect.GetMagnitude(), 0xffffffff); + --owner.statusEffects.ReplaceEffect(effect, true); + end +end \ No newline at end of file diff --git a/data/scripts/effects/block_proc.lua b/data/scripts/effects/block_proc.lua new file mode 100644 index 00000000..1f6d7161 --- /dev/null +++ b/data/scripts/effects/block_proc.lua @@ -0,0 +1,3 @@ +function onLose(target, effect) + target:SetProc(1, false); +end; \ No newline at end of file diff --git a/data/scripts/effects/blood_for_blood.lua b/data/scripts/effects/blood_for_blood.lua new file mode 100644 index 00000000..b63c88bd --- /dev/null +++ b/data/scripts/effects/blood_for_blood.lua @@ -0,0 +1,20 @@ +require("battleUtils") + +--Takes 10% of hp rounded down when using a weaponskill +--Random guess, but increases damage by 10% (12.5% traited)? +function onPreAction(effect, caster, target, skill, action, actionContainer) + if skill.commandType == CommandType.Weaponskill then + local hpToRemove = math.floor(caster.GetHP() * 0.10); + local modifier = 1.10; + + if effect.GetTier() == 2 then + modifier = 1.125; + end + + action.amount = action.amount * modifier; + caster.DelHP(hpToRemove); + + --Remove status and add message + actionContainer.AddAction(target.statusEffects.RemoveForBattleAction(effect)); + end +end; \ No newline at end of file diff --git a/data/scripts/effects/bloodbath.lua b/data/scripts/effects/bloodbath.lua new file mode 100644 index 00000000..b74d099e --- /dev/null +++ b/data/scripts/effects/bloodbath.lua @@ -0,0 +1,24 @@ +require("modifiers"); + +--Absorb HP on next WS or ability +function onHit(effect, attacker, defender, action, actionContainer) + + --1.21: Absorb HP amount no longer affected by player VIT rating. + --Bloodbath seems based on both defener and attacker's stats, even after 1.21. + --Miser's Mistriss seems to resist the effect, whereas nael gets absorbed more than 100% + --Garuda resists a small amount + --Unclear what it's based on. + --Possibly magic resist? Slashing resist? + + --For now using 1.0 as baseline since that seems to be the average + if action.commandType == CommandType.Weaponskill or action.commandType == CommandType.Ability then + local absorbModifier = 1.0 + local absorbAmount = action.amount * absorbModifier; + + attacker.AddHP(absorbAmount); + --30332: You absorb hp from target + actionContainer.AddHPAction(defender.actorId, 30332, absorbAmount) + --Bloodbath is lost after absorbing hp + actionContainer.AddAction(defender.statusEffects.RemoveStatusEffectForBattleAction(effect)); + end +end; \ No newline at end of file diff --git a/data/scripts/effects/bloodletter.lua b/data/scripts/effects/bloodletter.lua new file mode 100644 index 00000000..2a4b0129 --- /dev/null +++ b/data/scripts/effects/bloodletter.lua @@ -0,0 +1,20 @@ +require("modifiers") + +--This is the comboed version of bloodletter. +--All videos I can find have it dealing 15 damage. +--Damage type is projectile. +--DoT damage is combined and all hits on a single tick. ie a blodletter doing 15 damage and aero doing 11 will combine and tick for 26. + +--Bloodletter is apparently impacted by PIE +--http://forum.square-enix.com/ffxiv/threads/35795-STR-DEX-PIE-ATK-Testing/page2 +--Chance to land is also impacted by PIE +function onGain(owner, effect) + owner.AddMod(modifiersGlobal.RegenDown, 15); +end + +--Additional damage is 570 at level 50 +--https://ffxiv.gamerescape.com/w/index.php?title=Bloodletter&oldid=298020 +function onLose(owner, effect) + owner.SubtractMod(modifiersGlobal.RegenDown, 15); + owner.DelHP(570); +end diff --git a/data/scripts/effects/bloodletter2.lua b/data/scripts/effects/bloodletter2.lua new file mode 100644 index 00000000..01449669 --- /dev/null +++ b/data/scripts/effects/bloodletter2.lua @@ -0,0 +1,10 @@ +require("modifiers") + +--Bloodletter2 is the uncomboed version of Bloodletter. It doesn't deal any additional damage when it falls off but has the same tick damage +function onGain(owner, effect) + owner.AddMod(modifiersGlobal.RegenDown, 15); +end + +function onLose(owner, effect) + owner.SubtractMod(modifiersGlobal.RegenDown, 15); +end diff --git a/data/scripts/effects/cleric_stance.lua b/data/scripts/effects/cleric_stance.lua new file mode 100644 index 00000000..2bb252d8 --- /dev/null +++ b/data/scripts/effects/cleric_stance.lua @@ -0,0 +1,12 @@ +require("modifiers") + +function onGain(target, effect) + --Multiples Attack Magic Potency by 1.2 and Healing Magic Potency by 0.8 + target.SetMod(modifiersGlobal.MagicAttack, target.GetMod(modifiersGlobal.MagicAttack) * 1.2); + target.SetMod(modifiersGlobal.MagicHeal, target.GetMod(modifiersGlobal.MagicHeal) * 0.8); +end; + +function onLose(target, effect) + target.SetMod(modifiersGlobal.MagicAttack, target.GetMod(modifiersGlobal.MagicAttack) / 1.2); + target.SetMod(modifiersGlobal.MagicHeal, target.GetMod(modifiersGlobal.MagicHeal) / 0.8); +end; \ No newline at end of file diff --git a/data/scripts/effects/collusion.lua b/data/scripts/effects/collusion.lua new file mode 100644 index 00000000..7f015f81 --- /dev/null +++ b/data/scripts/effects/collusion.lua @@ -0,0 +1,10 @@ +require("modifiers") + +function onHit(effect, attacker, defender, action, actionContainer) + local enmity = action.enmity; + action.enmity = 0; + + defender.hateContainer.UpdateHate(effect.GetSource(), enmity); + --Does collusion send a message? + actionContainer.AddAction(attacker.statusEffects.RemoveStatusEffectForBattleAction(effect)); +end; \ No newline at end of file diff --git a/data/scripts/effects/combo.lua b/data/scripts/effects/combo.lua new file mode 100644 index 00000000..44503843 --- /dev/null +++ b/data/scripts/effects/combo.lua @@ -0,0 +1,3 @@ +function onLose(target, effect) + target:SetCombos(); +end; \ No newline at end of file diff --git a/data/scripts/effects/cover.lua b/data/scripts/effects/cover.lua new file mode 100644 index 00000000..b63b5e5c --- /dev/null +++ b/data/scripts/effects/cover.lua @@ -0,0 +1,8 @@ +require("modifiers") + +--Enahnced Cover: Restores 25% of damage taken as MP. Does not send a message +function onDamageTaken(effect, attacker, defender, action, actionContainer) + if effect.GetTier() == 2 then + defender.AddMP(0.25 * action.amount); + end +end; \ No newline at end of file diff --git a/data/scripts/effects/covered.lua b/data/scripts/effects/covered.lua new file mode 100644 index 00000000..129ba9a3 --- /dev/null +++ b/data/scripts/effects/covered.lua @@ -0,0 +1,15 @@ +require("battleUtils") + +--If person who cast cover is within 8y, change the action's target to them +--Not sure what attacks are valid. It only says "melee attacks", unsure if that includes weaponskills and abilities or just auto attacks +--Right now this will probably be really buggy, since Covered is not necessarily the first effect that will activate on the target + +--Really need to do more research on this, figure out how it interacts with multi-hit attacks, aoe attacks (if those count as melee ever?), etc. +--If it redirects the whole attack instead of a single hit, we might need a new that activates while iterating over targets. +function onPreAction(effect, caster, target, skill, action, actionContainer) + if not skill.isRanged then + if effect.GetSource().IsAlive() and getDistanceBetweenActors(effect.GetSource(), target) <= 8 then + target = effect.GetSource(); + end + end +end; \ No newline at end of file diff --git a/data/scripts/effects/dark_seal2.lua b/data/scripts/effects/dark_seal2.lua new file mode 100644 index 00000000..61cf1a1e --- /dev/null +++ b/data/scripts/effects/dark_seal2.lua @@ -0,0 +1,13 @@ +require("modifiers") +require("battleutils") + +--Increases accuracy of next cast. +--There isn't really any information on this, but due to the fact it falls off BEFORE the target is hit, +--I'm assuming it increases a spell's accuracy modifier instead of giving actual magic accuracy +function onCommandStart(effect, owner, skill, actionContainer) + if skill.actionType == ActionType.Magic then + --50 is random guess. + skill.accuracyModifier = skill.accuracyModifier + 50; + actionContainer.AddAction(owner.RemoveStatusEffectForBattleAction(effect)); + end +end \ No newline at end of file diff --git a/data/scripts/effects/decoy.lua b/data/scripts/effects/decoy.lua new file mode 100644 index 00000000..e5a6e860 --- /dev/null +++ b/data/scripts/effects/decoy.lua @@ -0,0 +1,16 @@ +require("modifiers") +require("battleutils") + +--This is the untraited version of decoy. +function onPreAction(effect, caster, target, skill, action, actionContainer) + --Evade single ranged or magic attack + --Traited allows for physical attacks + if target.allegiance != caster.allegiance and (skill.isRanged or action.actionType == ActionType.Magic) then + --Set action's hit rate to 0 + action.hirRate = 0.0; + + --Remove status and add message + actionContainer.AddAction(target.statusEffects.RemoveStatusEffectForBattleAction(effect)); + end + +end; \ No newline at end of file diff --git a/data/scripts/effects/decoy2.lua b/data/scripts/effects/decoy2.lua new file mode 100644 index 00000000..bac5a365 --- /dev/null +++ b/data/scripts/effects/decoy2.lua @@ -0,0 +1,15 @@ +require("modifiers") +require("battleutils") + +--This is the traited version of Decoy. It can also evade physical attacks. +function onPreAction(effect, caster, target, skill, action, actionContainer) + --Evade single ranged or magic attack + --Traited allows for physical attacks + if target.allegiance != caster.allegiance and (skill.isRanged or action.actionType == ActionType.Magic or action.actionType == ActionType.Physical) then + --Set action's hit rate to 0 + action.hirRate = 0.0; + --Remove status and add message + actionContainer.AddAction(target.statusEffects.RemoveStatusEffectForBattleAction(effect)); + end + +end; \ No newline at end of file diff --git a/data/scripts/effects/default.lua b/data/scripts/effects/default.lua new file mode 100644 index 00000000..b74871e4 --- /dev/null +++ b/data/scripts/effects/default.lua @@ -0,0 +1,5 @@ +function onGain(target, effect) +end; + +function onLose(target, effect) +end; \ No newline at end of file diff --git a/data/scripts/effects/defense_down.lua b/data/scripts/effects/defense_down.lua new file mode 100644 index 00000000..19b20cc9 --- /dev/null +++ b/data/scripts/effects/defense_down.lua @@ -0,0 +1,9 @@ +require("modifiers") + +function onGain(owner, effect) + owner.SubtractMod(modifiersGlobal.Defense, effect.GetMagnitude()); +end + +function onLose(owner, effect) + owner.AddMod(modifiersGlobal.Defense, effect.GetMagnitude()); +end diff --git a/data/scripts/effects/divine_regen.lua b/data/scripts/effects/divine_regen.lua new file mode 100644 index 00000000..f137f72a --- /dev/null +++ b/data/scripts/effects/divine_regen.lua @@ -0,0 +1,9 @@ +require("modifiers") + +function onGain(owner, effect) + owner.AddMod(modifiersGlobal.Regen, effect.GetMagnitude()); +end + +function onLose(owner, effect) + owner.SubtractMod(modifiersGlobal.Regen, effect.GetMagnitude()); +end diff --git a/data/scripts/effects/divine_veil.lua b/data/scripts/effects/divine_veil.lua new file mode 100644 index 00000000..b81fb802 --- /dev/null +++ b/data/scripts/effects/divine_veil.lua @@ -0,0 +1,31 @@ +require("modifiers") + +--Increases block rate by 100% +function onGain(owner, effect) + owner.AddMod(modifiersGlobal.RawBlockRate, 100); +end + +function onLose(owner, effect) + owner.SubtractMod(modifiersGlobal.RawBlockRate, 100); +end + +--Applys Divine Regen to party in range when healed by cure or cura +function onHealed(caster, target, effect, skill, action, actionContainer) + -- cure cura + if (skill.id == 27346 or skill.id == 27347) and (caster != owner) then + local regenDuration = 30; + --Apparently heals for 85 without AF, 113 with. Unsure if these can be improved with stats + local magnitude = 85 + + --Need a better way to set magnitude when adding effects + if effect.GetTier() == 2 then + magnitude = 113; + end + + --For each party member in range, add divine regen + for chara in owner.GetPartyMembersInRange(8) do + local addAction = chara.statusEffects.AddStatusForBattleAction(223264, effect.GetTier(), magnitude, regenDuration); + actionContainer.AddAction(addAction); + end + end +end; \ No newline at end of file diff --git a/data/scripts/effects/dread_spike.lua b/data/scripts/effects/dread_spike.lua new file mode 100644 index 00000000..e5677cd1 --- /dev/null +++ b/data/scripts/effects/dread_spike.lua @@ -0,0 +1,30 @@ +require("modifiers") +require("battleutils") + +--Dread spike completely nullifies a physical action and absorbs how much damage it would have done (when it's powered up) +--I'm going to assume it only absorbs half damage without LS/PS up +--When I say it nullifies an attack, it even gets rid of the message. It's as if the damage action didn't happen. +--It still shows the enemy's "Enemy used [command]." message but there is no 0 damage dealt message. +--Don't know how this works with multi-hit attacks or even how it works with stoneskin or other buffs that respond to damage +-- I dont really know how this should work... +function onDamageTaken(effect, attacker, defender, action, actionContainer) + if action.actionType == ActionType.Physical then + --maybe this works? + local absorbPercent = 0.5; + + if effect.GetTier() == 2 then + absorbPercent = 1; + end + + local absorbAmount = action.amount * absorbPercent; + action.amount = 0; + action.worldMasterTextId = 0; + + defender.AddHP(absorbAmount); + --30451: You recover [absorbAmount] HP. + actionContainer.AddHPAction(defender.actorId, 30451, absorbAmount) + --Dread Spike is lost after absorbing hp + actionContainer.AddAction(defender.statusEffects.RemoveStatusEffectForBattleAction(effect)); + end +end; + diff --git a/data/scripts/effects/enduring_march.lua b/data/scripts/effects/enduring_march.lua new file mode 100644 index 00000000..32aaa489 --- /dev/null +++ b/data/scripts/effects/enduring_march.lua @@ -0,0 +1,20 @@ +require("modifiers") + +function onGain(target, effect) + --Traited increases speed by 20%. Assuming that means it actually increases speed instead of simply offsetting the negative speed it has by default + local speedModifier = 0.8; + if effect.GetTier() == 2 then + speedModifier = 1.2; + end + + target.SetMod(modifiersGlobal.Speed, target.GetMod(modifiersGlobal.Speed) * speedModifier); +end; + +function onLose(target, effect) + local speedModifier = 0.8; + if effect.GetTier() == 2 then + speedModifier = 1.2; + end + + target.SetMod(modifiersGlobal.Speed, target.GetMod(modifiersGlobal.Speed) / speedModifier); +end; \ No newline at end of file diff --git a/data/scripts/effects/evade_proc.lua b/data/scripts/effects/evade_proc.lua new file mode 100644 index 00000000..5e6a46e2 --- /dev/null +++ b/data/scripts/effects/evade_proc.lua @@ -0,0 +1,3 @@ +function onLose(target, effect) + target:SetProc(0, false); +end; \ No newline at end of file diff --git a/data/scripts/effects/excruciate.lua b/data/scripts/effects/excruciate.lua new file mode 100644 index 00000000..59e3e499 --- /dev/null +++ b/data/scripts/effects/excruciate.lua @@ -0,0 +1,30 @@ +require("modifiers") +require("battleutils") + +--Gradually increases critical rate of spells +function onTick(owner, effect) + --No clue how fast the crit rate increases or how often it ticks + --Only clue I have to go on is that the strategy seemed to be to use it + --before or after fire/thunder and you'd usually get a crit at firaga/thundaga + --Random guess, going to assume it's 25 crit rating every 3s, 50 crit rating traited + --That's 4% and 8% every 3 seconds of actual crit + local ratePerTick = 25; + + if effect.GetTier() == 2 then + ratePerTick = 50; + end + + effect.SetMagnitude(effect.GetMagnitude() + ratePerTick); +end + +--Excruciate seems to have an effect on all hits of aoe spells, so it's changing the crit bonus of the skill itself +--rather than on a hit by hit basis +function onCommandStart(effect, owner, skill, actionContainer) + skill.bonusCritRate = skill.bonusCritRate + effect.GetMagnitude(); +end + +function onCrit(effect, attacker, defender, action, actionContainer) + if action.commandType == CommandType.Spell then + actionContainer.AddAction(attacker.statusEffects.RemoveStatusEffectForBattleAction(effect)); + end +end \ No newline at end of file diff --git a/data/scripts/effects/featherfoot.lua b/data/scripts/effects/featherfoot.lua new file mode 100644 index 00000000..13f635c3 --- /dev/null +++ b/data/scripts/effects/featherfoot.lua @@ -0,0 +1,26 @@ +require("modifiers"); + +--15% in ARR, dont know how it worked in 1.0 +function onGain(target, effect) + target.AddMod(modifiersGlobal.RawEvadeRate, 15); +end; + +function onLose(target, effect) + target.SubtractMod(modifiersGlobal.RawEvadeRate, 15); +end; + +--Returns 25%? of amount dodged as MP +function onEvade(effect, attacker, defender, action, actionContainer) + --25% of amount dodged untraited, 50% traited + local percent = 0.25; + if (effect.GetTier() == 2) then + percent = 0.50; + end + + local mpToReturn = percent * action.amountMitigated; + defender.AddMP(math.ceil(mpToReturn)); + --33010: You recover x MP from Featherfoot + actionContainer.AddMPAction(defender.actorId, 33010, mpToReturn); + --Featherfoot is lost after evading + actionContainer.AddAction(defender.statusEffects.RemoveStatusEffectForBattleAction(effect)); +end; \ No newline at end of file diff --git a/data/scripts/effects/fists_of_earth.lua b/data/scripts/effects/fists_of_earth.lua new file mode 100644 index 00000000..d9ce7955 --- /dev/null +++ b/data/scripts/effects/fists_of_earth.lua @@ -0,0 +1,8 @@ +function onGain(target, effect) + target.statusEffects.RemoveStatusEffect(223209) + target.statusEffects.RemoveStatusEffect(223211) +end; + +--Need to do more research on these. +--From what I've seen, they changed the property of the attack to magic and the element to the respective element +--Unsure if it applies to weaponskills or if it's auto attacks only. \ No newline at end of file diff --git a/data/scripts/effects/fists_of_fire.lua b/data/scripts/effects/fists_of_fire.lua new file mode 100644 index 00000000..36442318 --- /dev/null +++ b/data/scripts/effects/fists_of_fire.lua @@ -0,0 +1,4 @@ +function onGain(target, effect) + target.statusEffects.RemoveStatusEffect(223210) + target.statusEffects.RemoveStatusEffect(223211) +end; \ No newline at end of file diff --git a/data/scripts/effects/fists_of_wind.lua b/data/scripts/effects/fists_of_wind.lua new file mode 100644 index 00000000..06eaf213 --- /dev/null +++ b/data/scripts/effects/fists_of_wind.lua @@ -0,0 +1,4 @@ +function onGain(target, effect) + target.statusEffects.RemoveStatusEffect(223210) + target.statusEffects.RemoveStatusEffect(223209) +end; \ No newline at end of file diff --git a/data/scripts/effects/foresight.lua b/data/scripts/effects/foresight.lua new file mode 100644 index 00000000..2ffcde2f --- /dev/null +++ b/data/scripts/effects/foresight.lua @@ -0,0 +1,15 @@ +require("modifiers") + +function onGain(target, effect) + --Parry is .1% per , Random guess but gonna say it gives 20% worth of parry. + target.AddMod(modifiersGlobal.Parry, 200); +end; + +function onParry(effect, attacker, defender, action, actionContainer) + --Foresight is lost after parrying + actionContainer.AddAction(defender.statusEffects.RemoveStatusEffectForBattleAction(effect)); +end; + +function onLose(target, effect) + target.SubtractMod(modifiersGlobal.Parry, 200); +end; \ No newline at end of file diff --git a/data/scripts/effects/fully_blissful_mind.lua b/data/scripts/effects/fully_blissful_mind.lua new file mode 100644 index 00000000..bbd1b7ef --- /dev/null +++ b/data/scripts/effects/fully_blissful_mind.lua @@ -0,0 +1,7 @@ +function onGain(owner, effect) + --Using extra because that's what blissful_mind uses + effect.SetExtra(effect.GetMagnitude()); +end + +function onLose(owner, effect) +end diff --git a/data/scripts/effects/goring_blade.lua b/data/scripts/effects/goring_blade.lua new file mode 100644 index 00000000..c1f8d794 --- /dev/null +++ b/data/scripts/effects/goring_blade.lua @@ -0,0 +1,9 @@ +require("modifiers") + +function onGain(owner, effect) + owner.AddMod(modifiersGlobal.RegenDown, effect.GetMagnitude()); +end + +function onLose(owner, effect) + owner.SubtractMod(modifiersGlobal.RegenDown, effect.GetMagnitude()); +end diff --git a/data/scripts/effects/haste.lua b/data/scripts/effects/haste.lua new file mode 100644 index 00000000..328f0f90 --- /dev/null +++ b/data/scripts/effects/haste.lua @@ -0,0 +1,10 @@ +require("modifiers") + +--Set magnitude to milliseconds that HF will reduce delay by +function onGain(target, effect) + target.SubtractMod(modifiersGlobal.AttackDelay, effect.GetMagnitude()); +end; + +function onLose(target, effect) + target.AddMod(modifiersGlobal.AttackDelay, effect.GetMagnitude()); +end; \ No newline at end of file diff --git a/data/scripts/effects/hawks_eye.lua b/data/scripts/effects/hawks_eye.lua new file mode 100644 index 00000000..a62f2b9a --- /dev/null +++ b/data/scripts/effects/hawks_eye.lua @@ -0,0 +1,24 @@ +require("modifiers"); + +--In one capture, hawks eye seemed to give 18.75% additional accuracy (379 to 450) +--The player in this capture was a Dragoon, so this is untraited. +--Traited Hawk's Eye says it increases Accuracy by 50%. +--This could mean traited hawk's eye gives 28.125% (18.75% * 1.5) or it could mean it gives 68.75% (18.75% + 50%) +--It's also possible that Hawk's Eye gives 15 + 15% accuracy untraited, which would give 450.85, which would be rounded down. +--In that case, traited hawks eye could be 15 + 22.5% or 22.5 + 22.5% or (15 + 15%) * 1.5 +function onGain(target, effect) + local accuracyMod = 0.1875; + + if effect.GetTier() == 2 then + accuracyMod = 0.28125; + end + + local amountGained = accuracyMod * target.GetMod(modifiersGlobal.Accuracy); + effect.SetMagnitude(amountGained); + target.AddMod(modifiersGlobal.Accuracy, effect.GetMagnitude()); +end; + +function onLose(target, effect) + + target.SubtractMod(modifiersGlobal.Accuracy, effect.GetMagnitude()); +end; \ No newline at end of file diff --git a/data/scripts/effects/heavy.lua b/data/scripts/effects/heavy.lua new file mode 100644 index 00000000..e49f8813 --- /dev/null +++ b/data/scripts/effects/heavy.lua @@ -0,0 +1,13 @@ +require("modifiers") + +function onGain(target, effect) + local speedModifier = 0.5; + + target.SetMod(modifiersGlobal.Speed, target.GetMod(modifiersGlobal.Speed) * speedModifier); +end; + +function onLose(target, effect) + local speedModifier = 0.5; + + target.SetMod(modifiersGlobal.Speed, target.GetMod(modifiersGlobal.Speed) / speedModifier); +end; \ No newline at end of file diff --git a/data/scripts/effects/hp_boost.lua b/data/scripts/effects/hp_boost.lua new file mode 100644 index 00000000..d3c93575 --- /dev/null +++ b/data/scripts/effects/hp_boost.lua @@ -0,0 +1,15 @@ +require("modifiers") + +--Battle Voice grants HP_Boost and it sets max hp to 125% normal amount and heals for the difference between current +--This doesn't seem like the correct way to do this. If max HP changes between gainign and losing wont this break? +function onGain(target, effect) + local newMaxHP = target.GetMaxHP() * 1.25; + local healAmount = newMaxHP - target.GetMaxHP(); + + target.SetMaxHP(newMaxHP); + target.AddHP(healAmount); +end; + +function onLose(target, effect) + target.SetMaxHP(target.GetMaxHP() / 1.25); +end; \ No newline at end of file diff --git a/data/scripts/effects/hundred_fists.lua b/data/scripts/effects/hundred_fists.lua new file mode 100644 index 00000000..28b32b7b --- /dev/null +++ b/data/scripts/effects/hundred_fists.lua @@ -0,0 +1,10 @@ +require("modifiers") + +--Set magnitude to milliseconds that HF will reduce delay by +function onGain(target, effect) + target.SubtractMod(modifiersGlobal.AttackDelay), effect.GetMagnitude()); +end; + +function onLose(target, effect) + target.AddMod(modifiersGlobal.AttackDelay), effect.GetMagnitude()); +end; \ No newline at end of file diff --git a/data/scripts/effects/invigorate.lua b/data/scripts/effects/invigorate.lua new file mode 100644 index 00000000..a4aac14c --- /dev/null +++ b/data/scripts/effects/invigorate.lua @@ -0,0 +1,10 @@ +require("modifiers") + +--100 TP per tick without AF. 133 TP per tick with AF +function onGain(owner, effect) + owner.AddMod(modifiersGlobal.Regain, effect.GetMagnitude()); +end + +function onLose(owner, effect) + owner.SubtractMod(modifiersGlobal.Regain, effect.GetMagnitude()); +end diff --git a/data/scripts/effects/keen_flurry.lua b/data/scripts/effects/keen_flurry.lua new file mode 100644 index 00000000..d80ea770 --- /dev/null +++ b/data/scripts/effects/keen_flurry.lua @@ -0,0 +1,15 @@ +require("battleutils") + +--Untraited reduces cooldown by 50% +--Traited reduces cooldown by 100% +function onCommandStart(effect, owner, skill, actionContainer) + if skill.commandType == CommandType.Weaponskill then + local reduction = 0.5; + + if effect.GetTier() == 2 then + reduction = 1.0; + end + + skill.recastTimeMs = skill.recastTimeMs - (reduction * skill.recastTimeMs); + end +end; \ No newline at end of file diff --git a/data/scripts/effects/life_surge_I.lua b/data/scripts/effects/life_surge_I.lua new file mode 100644 index 00000000..3f3a5ab5 --- /dev/null +++ b/data/scripts/effects/life_surge_I.lua @@ -0,0 +1,19 @@ +require("battleutils") + +--Heals for 30%? of damage dealt on auto attacks. +--Trait: Increases healing by 20%. Is this the base % or the amount after taking the base percent? +--I'm guessing the way it works is that LSI/II/III have 10/20/30% absorb by default and 30/40/50% traited. +--Seems to match what i can find in videos +function onHit(effect, attacker, defender, action, actionContainer) + if action.commandType == CommandType.AutoAttack then + local healPercent = 0.10; + + if effect.GetTier() == 2 then + healPercent = 0.30; + end + + local amount = math.floor((healPercent * action.amount) + 1); + attacker.AddHP(amount); + actionContainer.AddHPAction(defender.actorId, 30332, amount); + end +end; \ No newline at end of file diff --git a/data/scripts/effects/life_surge_II.lua b/data/scripts/effects/life_surge_II.lua new file mode 100644 index 00000000..3b74a94e --- /dev/null +++ b/data/scripts/effects/life_surge_II.lua @@ -0,0 +1,15 @@ +require("battleutils") + +function onHit(effect, attacker, defender, action, actionContainer) + if action.commandType == CommandType.AutoAttack then + local healPercent = 0.20; + + if effect.GetTier() == 2 then + healPercent = 0.40; + end + + local amount = math.floor((healPercent * action.amount) + 1); + attacker.AddHP(amount); + actionContainer.AddHPAction(defender.actorId, 30332, amount); + end +end; \ No newline at end of file diff --git a/data/scripts/effects/life_surge_III.lua b/data/scripts/effects/life_surge_III.lua new file mode 100644 index 00000000..3f3a5ab5 --- /dev/null +++ b/data/scripts/effects/life_surge_III.lua @@ -0,0 +1,19 @@ +require("battleutils") + +--Heals for 30%? of damage dealt on auto attacks. +--Trait: Increases healing by 20%. Is this the base % or the amount after taking the base percent? +--I'm guessing the way it works is that LSI/II/III have 10/20/30% absorb by default and 30/40/50% traited. +--Seems to match what i can find in videos +function onHit(effect, attacker, defender, action, actionContainer) + if action.commandType == CommandType.AutoAttack then + local healPercent = 0.10; + + if effect.GetTier() == 2 then + healPercent = 0.30; + end + + local amount = math.floor((healPercent * action.amount) + 1); + attacker.AddHP(amount); + actionContainer.AddHPAction(defender.actorId, 30332, amount); + end +end; \ No newline at end of file diff --git a/data/scripts/effects/magic_evasion_down.lua b/data/scripts/effects/magic_evasion_down.lua new file mode 100644 index 00000000..2afa58ba --- /dev/null +++ b/data/scripts/effects/magic_evasion_down.lua @@ -0,0 +1,9 @@ +require("modifiers") + +function onGain(owner, effect) + owner.SubtractMod(modifiersGlobal.MagicEvasion, effect.GetMagnitude()); +end + +function onLose(owner, effect) + owner.AddMod(modifiersGlobal.MagicEvasion, effect.GetMagnitude()); +end diff --git a/data/scripts/effects/mighty_strikes.lua b/data/scripts/effects/mighty_strikes.lua new file mode 100644 index 00000000..5778c3d9 --- /dev/null +++ b/data/scripts/effects/mighty_strikes.lua @@ -0,0 +1,9 @@ +--Forces crit on attacks made with axes +function onPreAction(effect, caster, target, skill, action, actionContainer) + --Assuming "attacks made with axes" means skills specific to MRD/WAR + if (skill.job == 3 or skill.job == 17) then + --Set action's crit rate to 100% + action.critRate = 100.0; + end +end; + diff --git a/data/scripts/effects/minuet_of_rigor.lua b/data/scripts/effects/minuet_of_rigor.lua new file mode 100644 index 00000000..87919522 --- /dev/null +++ b/data/scripts/effects/minuet_of_rigor.lua @@ -0,0 +1,12 @@ +require("modifiers") + +function onGain(owner, effect) + --Only one song per bard can be active, need to figure out a good way to do this + owner.AddMod(modifiersGlobal.Accuracy, effect.GetMagnitude()); + owner.AddMod(modifiersGlobal.MagicAccuracy, effect.GetMagnitude()); +end; + +function onLose(owner, effect) + owner.SubtractMod(modifiersGlobal.Accuracy, effect.GetMagnitude()); + owner.SubtractMod(modifiersGlobal.MagicAccuracy, effect.GetMagnitude()); +end; \ No newline at end of file diff --git a/data/scripts/effects/miss_proc.lua b/data/scripts/effects/miss_proc.lua new file mode 100644 index 00000000..2983289a --- /dev/null +++ b/data/scripts/effects/miss_proc.lua @@ -0,0 +1,3 @@ +function onLose(target, effect) + target:SetProc(3, false); +end; \ No newline at end of file diff --git a/data/scripts/effects/necrogenesis.lua b/data/scripts/effects/necrogenesis.lua new file mode 100644 index 00000000..e340f958 --- /dev/null +++ b/data/scripts/effects/necrogenesis.lua @@ -0,0 +1,12 @@ +require("modifiers") +require("battleutils") + +function onHit(effect, attacker, defender, action, actionContainer) + if action.commandType == CommandType.Spell then + --Necrogenesis returns 75% of damage done rounded up(?) as MP. + local hpToReturn = math.ceil(0.75 * action.amount); + attacker.AddMp(hpToReturn); + actionContainer.AddHPAction(attacker.actorId, 33012, mpToReturn); + actionContainer.AddAction(attacker.statusEffects.RemoveStatusEffectForBattleAction(effect)); + end +end \ No newline at end of file diff --git a/data/scripts/effects/outmaneuver2.lua b/data/scripts/effects/outmaneuver2.lua new file mode 100644 index 00000000..f54e864e --- /dev/null +++ b/data/scripts/effects/outmaneuver2.lua @@ -0,0 +1,24 @@ +require("modifiers") + +--Add 30 raw block rate. No idea how much block it actually gives. +function onGain(owner, effect) + owner.AddMod(modifiersGlobal.RawBlockRate, 30); +end + +function onLose(owner, effect) + owner.SubtractMod(modifiersGlobal.RawBlockRate, 30); +end + +--Gives 200 TP on block. Traited: Gives 10% of the amount blocked back as MP +function onBlock(effect, attacker, defender, action, actionContainer) + --200 TP on block + defender.AddTP(200); + + --If traited, add 10% of damage taken as MP + if(effect.GetTier() == 2) then + local mpToReturn = math.ceil(0.10 * action.amount); + defender.AddMP(math.ceil(mpToReturn)); + --33009: You recover x MP from Outmaneuver + actionContainer.AddMPAction(defender.actorId, 33009, mpToReturn); + end +end; \ No newline at end of file diff --git a/data/scripts/effects/paeon_of_war.lua b/data/scripts/effects/paeon_of_war.lua new file mode 100644 index 00000000..ec50abf6 --- /dev/null +++ b/data/scripts/effects/paeon_of_war.lua @@ -0,0 +1,10 @@ +require("modifiers") + +function onGain(owner, effect) + --Only one song per bard can be active, need to figure out a good way to do this + owner.AddMod(modifiersGlobal.Regain, effect.GetMagnitude()); +end; + +function onLose(owner, effect) + owner.SubtractMod(modifiersGlobal.Regain, effect.GetMagnitude()); +end; \ No newline at end of file diff --git a/data/scripts/effects/parry_proc.lua b/data/scripts/effects/parry_proc.lua new file mode 100644 index 00000000..97e6911a --- /dev/null +++ b/data/scripts/effects/parry_proc.lua @@ -0,0 +1,3 @@ +function onLose(target, effect) + target:SetProc(2, false); +end; \ No newline at end of file diff --git a/data/scripts/effects/parsimony.lua b/data/scripts/effects/parsimony.lua new file mode 100644 index 00000000..cb3ea325 --- /dev/null +++ b/data/scripts/effects/parsimony.lua @@ -0,0 +1,17 @@ +require("modifiers") +require("battleutils") + +--Forces crit of a single WS action from rear. +function onMagicCast(caster, effect, skill) + skill.mpCost = skill.mpCost / 2; +end; + +function onHit(effect, attacker, defender, action, actionContainer) + if action.commandType == CommandType.Spell then + --Parsimony returns 35% of damage done rounded up as MP. + local mpToReturn = math.ceil(0.35 * action.amount); + attacker.AddMp(mpToReturn); + actionContainer.AddMPAction(attacker.actorId, 33007, mpToReturn); + actionContainer.AddAction(attacker.statusEffects.RemoveStatusEffectForBattleAction(effect)); + end +end \ No newline at end of file diff --git a/data/scripts/effects/poison.lua b/data/scripts/effects/poison.lua new file mode 100644 index 00000000..34f9ca6c --- /dev/null +++ b/data/scripts/effects/poison.lua @@ -0,0 +1,7 @@ +function onGain(owner, effect) + owner.AddMod(modifiersGlobal.RegenDown, effect.GetMagnitude()); +end + +function onLose(owner, effect) + owner.SubtractMod(modifiersGlobal.RegenDown, effect.GetMagnitude()); +end diff --git a/data/scripts/effects/power_surge_I.lua b/data/scripts/effects/power_surge_I.lua new file mode 100644 index 00000000..ccef5719 --- /dev/null +++ b/data/scripts/effects/power_surge_I.lua @@ -0,0 +1,29 @@ +require("modifiers") +require("battleutils") + +--https://www.bluegartr.com/threads/107403-Stats-and-how-they-work/page22 +function onGain(owner, effect) + owner.AddMod(modifiersGlobal.Attack, 115); + owner.SubtractMod(modifiersGlobal.Defense, 158); +end + +function onCommandStart(effect, owner, command, actionContainer) + --if command is a weaponskill or jump + --27266: jump + if command.GetCommandType() == CommandType.Weaponskill or command.id == 27266 then + effect.SetTier(effect.GetTier() + 1); + + --Takes 10 weaponskills/jumps to increase level + if effect.GetTier() > 10 then + local action = owner.statusEffects.ReplaceEffect(effect, 223213, 1, 1, 60); + actionContainer.AddAction(action); + else + effect.RefreshTime(); + end + end +end + +function onLose(owner, effect) + owner.SubtractMod(modifiersGlobal.Attack, 115); + owner.AddMod(modifiersGlobal.Defense, 158); +end \ No newline at end of file diff --git a/data/scripts/effects/power_surge_II.lua b/data/scripts/effects/power_surge_II.lua new file mode 100644 index 00000000..dc87d18f --- /dev/null +++ b/data/scripts/effects/power_surge_II.lua @@ -0,0 +1,30 @@ +require("modifiers") +require("battleutils") + +--https://www.bluegartr.com/threads/107403-Stats-and-how-they-work/page22 +function onGain(owner, effect) + owner.AddMod(modifiersGlobal.Attack, 230); + owner.SubtractMod(modifiersGlobal.Defense, 158); +end + +function onCommandStart(effect, owner, command, actionContainer) + --if command is a weaponskill or jump + --27266: jump + if command.GetCommandType() == CommandType.Weaponskill or command.id == 27266 then + effect.SetTier(effect.GetTier() + 1); + + --Takes 10 weaponskills/jumps to increase level + if effect.GetTier() > 10 then + local action = owner.statusEffects.ReplaceEffect(effect, 223214, 1, 1, 60); + actionContainer.AddAction(action); + else + effect.RefreshTime(); + end + end +end + +function onLose(owner, effect) + owner.SubtractMod(modifiersGlobal.Attack, 230); + owner.AddMod(modifiersGlobal.Defense, 158); +end + diff --git a/data/scripts/effects/power_surge_III.lua b/data/scripts/effects/power_surge_III.lua new file mode 100644 index 00000000..5d9e46c8 --- /dev/null +++ b/data/scripts/effects/power_surge_III.lua @@ -0,0 +1,23 @@ +require("modifiers") +require("battleutils") + +--https://www.bluegartr.com/threads/107403-Stats-and-how-they-work/page22 +function onGain(owner, effect) + owner.AddMod(modifiersGlobal.Attack, 345); + owner.SubtractMod(modifiersGlobal.Defense, 158); +end + +function onCommandStart(effect, owner, command, actionContainer) + --if command is a weaponskill or jump + --27266: jump + if command.GetCommandType() == CommandType.Weaponskill or command.id == 27266 then + --At III just refresh the effect + effect.RefreshTime(); + end +end + +function onLose(owner, effect) + owner.SubtractMod(modifiersGlobal.Attack, 345); + owner.AddMod(modifiersGlobal.Defense, 158); +end + diff --git a/data/scripts/effects/protect.lua b/data/scripts/effects/protect.lua new file mode 100644 index 00000000..2a30e14b --- /dev/null +++ b/data/scripts/effects/protect.lua @@ -0,0 +1,18 @@ +require("modifiers") + +function onGain(target, effect) + --Magnitude is caster's Enhancing Magic Potency. + --http://forum.square-enix.com/ffxiv/threads/41900-White-Mage-A-Guide + --5-4-5-4-5-4-5-4-5 repeating points of Enhancing for 1 defense + --4.56 * Enhancing Potency + local defenseBuff = 4.56 * effect.GetMagnitude(); + + target.AddMod(modifiersGlobal.Defense, defenseBuff); +end; + +function onLose(target, effect) + local defenseBuff = 4.56 * effect.GetMagnitude(); + + target.SubtractMod(modifiersGlobal.Defense, defenseBuff); +end; + diff --git a/data/scripts/effects/protect2.lua b/data/scripts/effects/protect2.lua new file mode 100644 index 00000000..0065e980 --- /dev/null +++ b/data/scripts/effects/protect2.lua @@ -0,0 +1,36 @@ +require("modifiers") + +function onGain(target, effect) + --Magnitude is caster's Enhancing Magic Potency. + --http://forum.square-enix.com/ffxiv/threads/41900-White-Mage-A-Guide + --5-4-5-4-5-4-5-4-5 repeating points of Enhancing for 1 defense + --4.56 * Enhancing Potency + local defenseBuff = 4.56 * effect.GetMagnitude(); + local magicDefenseBuff = 0; + + target.AddMod(modifiersGlobal.Defense, defenseBuff); + + --27365: Enhanced Protect: Increases magic defense gained from Protect. + --There is no "magic defense" stat, instead it gives stats to each resist stat. + magicDefenseBuff = 6.67 * effect.GetMagnitude(); + for i = modifiersGlobal.ResistFire, modifiersGlobal.ResistWater do + target.AddMod(i, magicDefenseBuff); + end + + +end; + +function onLose(target, effect) + local defenseBuff = 4.56 * effect.GetMagnitude(); + local magicDefenseBuff = 0; + + target.SubtractMod(modifiersGlobal.Defense, defenseBuff); + + --27365: Enhanced Protect: Increases magic defense gained from Protect. + --There is no "magic defense" stat, instead it gives stats to each resist stat. + magicDefenseBuff = 6.67 * effect.GetMagnitude(); + for i = modifiersGlobal.ResistFire, modifiersGlobal.ResistWater do + target.SubtractMod(i, magicDefenseBuff); + end +end; + diff --git a/data/scripts/effects/quelling_strike.lua b/data/scripts/effects/quelling_strike.lua new file mode 100644 index 00000000..347b8e1a --- /dev/null +++ b/data/scripts/effects/quelling_strike.lua @@ -0,0 +1,16 @@ +require("modifiers") +require("battleutils") + +--Untraited reduces cooldown by 50% +--Traited reduces cooldown by 100% +function onCommandStart(effect, owner, skill, actionContainer) + --Does this apply to auto attacks? + if skill.commandType == CommandType.Weaponskill or skill.commandType == CommandType.Ability or skill.commandType == CommandType.Magic then + if skill.actionType == ActionType.Physical or skill.actionType == ActionType.Magic then + --No idea what the enmity effect is + skill.enmityModifier = skill.enmityModifier * 0.5; + + owner.AddTP(effect.GetMagnitude()); + end + end +end; \ No newline at end of file diff --git a/data/scripts/effects/quick.lua b/data/scripts/effects/quick.lua new file mode 100644 index 00000000..65861376 --- /dev/null +++ b/data/scripts/effects/quick.lua @@ -0,0 +1,13 @@ +require("modifiers") + +function onGain(target, effect) + local speedModifier = 1.25; + + target.SetMod(modifiersGlobal.Speed, target.GetMod(modifiersGlobal.Speed) * speedModifier); +end; + +function onLose(target, effect) + local speedModifier = 1.25; + + target.SetMod(modifiersGlobal.Speed, target.GetMod(modifiersGlobal.Speed) / speedModifier); +end; \ No newline at end of file diff --git a/data/scripts/effects/rampage2.lua b/data/scripts/effects/rampage2.lua new file mode 100644 index 00000000..80e7895a --- /dev/null +++ b/data/scripts/effects/rampage2.lua @@ -0,0 +1,48 @@ +require("modifiers") +require("utils") + +parryPerDT = 20; +delayMsPerDT = 100; + +function onGain(owner, effect) + owner.statusEffects.RemoveStatusEffect(223207); +end + +--Increases parry rating and attack speed for each hit. (Need more info) +function onDamageTaken(effect, attacker, defender, action, actionContainer) + + --Assuming 20 parry rating every time you're hit up to 200 + --Delay is more complicated. Most axes are around 4 seconds, so i'm gonna assume it cuts off a full second at max + if (effect.GetExtra() < 10) then + effect.SetExtra(effect.GetExtra() + 1); + + attacker.AddMod(modifiersGlobal.Parry, parryPerDT); + attacker.SubtractMod(modifiersGlobal.AttackDelay, delayMsPerDT); + end +end + +--Heals for 50% of damage dealt on crits with a maximum of 20% of max hp +--Also only heals for as much hp as you're missing at most +function onCrit(effect, attacker, defender, action, actionContainer) + local healAmount = math.Clamp(action.amount * 0.50, 0, defender.GetMaxHP() * 0.20); + healAmount = math.Clamp(healAmount, 0, defender.GetMaxHP() - defender.GetHP()); + defender.AddHP(healAmount); + --33012: You recover [healAmount] HP. + actionContainer.AddHPAction(owner.actorId, 33008, healAmount); +end; + +--"Effect fades over time" +function onTick(owner, effect) + --Enduring march prevents fading of rampage effect + if not owner.statusEffects.HasStatusEffect(223078) and (effect.GetExtra() > 0) then + --Going to assume that every 5 seconds a single hits worth of rampage is lost. + attacker.SubtractMod(modifiersGlobal.Parry, parryPerDT); + attacker.AddMod(modifiersGlobal.Delay, delayMsPerDT); + effect.SetExtra(effect.GetExtra() - 1); + end +end + +function onLose(owner, effect) + attacker.SubtractMod(modifiersGlobal.Parry, effect.GetExtra() * parryPerDT); + attacker.AddMod(modifiersGlobal.Delay, effect.GetExtra() * delayMsPerDT); +end \ No newline at end of file diff --git a/data/scripts/effects/rampart.lua b/data/scripts/effects/rampart.lua new file mode 100644 index 00000000..6602e09a --- /dev/null +++ b/data/scripts/effects/rampart.lua @@ -0,0 +1,15 @@ +require("modifiers") + +--Rampart gives 105 defense at level 50. +--Guessing it scales with level. If I had to guess it's either 2.1 * level or (2 * level) + 5. +--I'm going to guess the latter since it always leaves you with a whole number. I could be completely wrong though +--The party_battle_leve has rampart giving 36? defense. It's from an earlier patch so probably useless +function onGain(target, effect) + effect.SetMagnitude(2 * target.GetLevel() + 5); + + target.AddMod(modifiersGlobal.Defense, effect.GetMagnitude()); +end; + +function onLose(target, effect) + target.SubtractMod(modifiersGlobal.Defense, effect.GetMagnitude()); +end; \ No newline at end of file diff --git a/data/scripts/effects/refresh.lua b/data/scripts/effects/refresh.lua new file mode 100644 index 00000000..b5d53fdc --- /dev/null +++ b/data/scripts/effects/refresh.lua @@ -0,0 +1,7 @@ +function onGain(owner, effect) + owner.AddMod(modifiersGlobal.Refresh, effect.GetMagnitude()); +end + +function onLose(owner, effect) + owner.SubtractMod(modifiersGlobal.Refresh, effect.GetMagnitude()); +end diff --git a/data/scripts/effects/regain.lua b/data/scripts/effects/regain.lua new file mode 100644 index 00000000..cec064eb --- /dev/null +++ b/data/scripts/effects/regain.lua @@ -0,0 +1,7 @@ +function onGain(owner, effect) + owner.AddMod(modifiersGlobal.Regain, effect.GetMagnitude()); +end + +function onLose(owner, effect) + owner.SubtractMod(modifiersGlobal.Regain, effect.GetMagnitude()); +end diff --git a/data/scripts/effects/regen.lua b/data/scripts/effects/regen.lua new file mode 100644 index 00000000..e63ed6d9 --- /dev/null +++ b/data/scripts/effects/regen.lua @@ -0,0 +1,8 @@ +--Regen is modified by Enhancing Magic Potency. Formula here: http://forum.square-enix.com/ffxiv/threads/41900-White-Mage-A-Guide +function onGain(owner, effect) + owner.AddMod(modifiersGlobal.Regen, effect.GetMagnitude()); +end + +function onLose(owner, effect) + owner.SubtractMod(modifiersGlobal.Regen, effect.GetMagnitude()); +end diff --git a/data/scripts/effects/resonance2.lua b/data/scripts/effects/resonance2.lua new file mode 100644 index 00000000..34b3748a --- /dev/null +++ b/data/scripts/effects/resonance2.lua @@ -0,0 +1,15 @@ +require("modifiers") +require("battleutils") + +--Increases range of a single spell, no clue by how much, 25% is a random guess +--It isn't clear if it has an effect on the aoe portion of skills or just the normal range, i've seen people on the OF say both. +function onMagicStart(caster, effect, skill) + skill.range = skill.range * 1.25; +end; + +--The effect falls off after the skill is finished, meaning if you start a cast and cancel, it shouldn't fall off. +function onCommandFinish(effect, owner, skill, actionContainer) + if action.commandType == CommandType.Spell then + actionContainer.AddAction(owner.statusEffects.RemoveStatusEffectForBattleAction(effect)); + end +end \ No newline at end of file diff --git a/data/scripts/effects/sanguine_rite2.lua b/data/scripts/effects/sanguine_rite2.lua new file mode 100644 index 00000000..969284ae --- /dev/null +++ b/data/scripts/effects/sanguine_rite2.lua @@ -0,0 +1,8 @@ +require("modifiers") + +--Sanguine Rite restores 30% of damage taken as MP +function onDamageTaken(effect, attacker, defender, action, actionContainer) + local mpToRestore = action.amount * 0.30; + defender.AddMP(mpToRestore); + actionContainer.AddMPAction(defender, 33011, mpToRestore); +end \ No newline at end of file diff --git a/data/scripts/effects/sanguine_rite3.lua b/data/scripts/effects/sanguine_rite3.lua new file mode 100644 index 00000000..e702d0b2 --- /dev/null +++ b/data/scripts/effects/sanguine_rite3.lua @@ -0,0 +1,22 @@ +require("modifiers") + +function onGain(target, effect) + --Traited Sanguine Rite reduces damage taken by 25%. + --The icon in game says it's 50%, but it's lying + local amount = 25; + + target.AddMod(modifiersGlobal.DamageTakenDown, amount); +end; + +function onLose(target, effect) + local amount = 25; + + target.SubtractMod(modifiersGlobal.DamageTakenDown, amount); +end; + +--Sanguine Rite restores 30% of damage taken as MP +function onDamageTaken(effect, attacker, defender, action, actionContainer) + local mpToRestore = action.amount * 0.30; + defender.AddMP(mpToRestore); + actionContainer.AddMPAction(defender, 33011, mpToRestore); +end \ No newline at end of file diff --git a/data/scripts/effects/sentinel.lua b/data/scripts/effects/sentinel.lua new file mode 100644 index 00000000..6ca3b4a1 --- /dev/null +++ b/data/scripts/effects/sentinel.lua @@ -0,0 +1,30 @@ +require("modifiers") +require("battleutils") + +function onGain(target, effect) + --Untraited Sentinel is 30% damage taken down, traited is 50% + local amount = 30; + if effect.GetTier() == 2 then + amount = 50; + end + + target.AddMod(modifiersGlobal.DamageTakenDown, amount); +end; + +function onLose(target, effect) + local amount = 30; + if effect.GetTier() == 2 then + amount = 50; + end + + target.SubtractMod(modifiersGlobal.DamageTakenDown, amount); +end; + +--Increases action's enmity by 100 for weaponskills +--http://forum.square-enix.com/ffxiv/threads/47393-Tachi-s-Guide-to-Paladin-%28post-1.22b%29 +--Sentinel only works on weaponskills. It's possible that was a bug because the description says actions +function onHit(effect, attacker, defender, action, actionContainer) + if action.commandType == CommandType.WeaponSkill then + action.enmity = action.enmity + 100; + end +end \ No newline at end of file diff --git a/data/scripts/effects/spinning_heel.lua b/data/scripts/effects/spinning_heel.lua new file mode 100644 index 00000000..d8531b82 --- /dev/null +++ b/data/scripts/effects/spinning_heel.lua @@ -0,0 +1,10 @@ +require("modifiers") + +function onGain(target, effect) + target.SetMod(modifiersGlobal.HitCount, 3); +end; + +function onLose(target, effect) + target.SetMod(modifiersGlobal.HitCount, 2); +end; + diff --git a/data/scripts/effects/stoneskin.lua b/data/scripts/effects/stoneskin.lua new file mode 100644 index 00000000..9905d3fc --- /dev/null +++ b/data/scripts/effects/stoneskin.lua @@ -0,0 +1,13 @@ +require("modifiers") + +function onGain(owner, effect) + + owner.AddMod(modifiersGlobal.Stoneskin, effect.GetMagnitude()); +end + +--Using extra for how much mitigation stoneskin has +function onPostAction(caster, target, effect, skill, action, actionContainer) + if (owner.GetMod(modifiersGlobal.Stoneskin) <= 0) then + actionContainer.AddAction(owner.statusEffects.RemoveStatusEffectForBattleAction(effect)); + end +end; \ No newline at end of file diff --git a/data/scripts/effects/tempered_will.lua b/data/scripts/effects/tempered_will.lua new file mode 100644 index 00000000..4cef7878 --- /dev/null +++ b/data/scripts/effects/tempered_will.lua @@ -0,0 +1,7 @@ +function onGain(owner, effect) + owner.AddMod(modifiersGlobal.KnockbackImmune, 1); +end + +function onLose(owner, effect) + owner.SubtractMod(modifiersGlobal.KnockbackImmune, 1); +end \ No newline at end of file diff --git a/data/scripts/effects/tp_bleed.lua b/data/scripts/effects/tp_bleed.lua new file mode 100644 index 00000000..435c4842 --- /dev/null +++ b/data/scripts/effects/tp_bleed.lua @@ -0,0 +1,7 @@ +function onGain(owner, effect) + owner.SubtractMod(modifiersGlobal.Regain, effect.GetMagnitude()); +end + +function onLose(owner, effect) + owner.AddMod(modifiersGlobal.Regain, effect.GetMagnitude()); +end diff --git a/data/scripts/effects/vengeance.lua b/data/scripts/effects/vengeance.lua new file mode 100644 index 00000000..5c5379c4 --- /dev/null +++ b/data/scripts/effects/vengeance.lua @@ -0,0 +1,15 @@ +require("modifiers") +require("battleutils") + +--Unclear what the exact damage is but it seems like it's the total amount of damage the attack would have done before parrying +function onDamageTaken(effect, attacker, defender, action, actionContainer) + local amount = action.amount + action.mitigatedAmount; + + --Only reflects magical attacks if wearing AF chest + if action.actionType == ActionType.Physical or (action.actionType == ActionType.Magic and effect.GetTier() == 2) then + --30350: Counter! You hit target for x points of damage + --There are counter messages for blocks, can Vengeance be blocked/parried? + attacker.DelHP(amount); + actionContainer.AddHitAction(attacker.actorId, 30350, amount); + end; +end; \ No newline at end of file diff --git a/data/scripts/global.lua b/data/scripts/global.lua index 107307f7..e021fe76 100644 --- a/data/scripts/global.lua +++ b/data/scripts/global.lua @@ -75,6 +75,63 @@ CHOCOBO_ULDAH2 = 0x3E; CHOCOBO_ULDAH3 = 0x3F; CHOCOBO_ULDAH4 = 0x40; +-- NPC LS +NPCLS_GONE = 0; +NPCLS_INACTIVE = 1; +NPCLS_ACTIVE = 2; +NPCLS_ALERT = 3; + +-- BATTLETEMP GENERAL PARAMETERS +NAMEPLATE_SHOWN = 0; +TARGETABLE = 1; +NAMEPLATE_SHOWN2 = 2; +NAMEPLATE_SHOWN2 = 3; +STAT_STRENGTH = 3; +STAT_VITALITY = 4; +STAT_DEXTERITY = 5; +STAT_INTELLIGENCE = 6; +STAT_MIND = 7; +STAT_PIETY = 8; +STAT_RESISTANCE_FIRE = 9; +STAT_RESISTANCE_ICE = 10; +STAT_RESISTANCE_WIND = 11; +STAT_RESISTANCE_LIGHTNING = 12; +STAT_RESISTANCE_EARTH = 13; +STAT_RESISTANCE_WATER = 14; +STAT_ATTACK = 17; +STAT_ACCURACY = 15; +STAT_NORMALDEFENSE = 18; +STAT_EVASION = 16; +STAT_ATTACK_MAGIC = 24; +STAT_HEAL_MAGIC = 25; +STAT_ENCHANCEMENT_MAGIC_POTENCY = 26; +STAT_ENFEEBLING_MAGIC_POTENCY = 27; +STAT_MAGIC_ACCURACY = 28; +STAT_MAGIC_EVASION = 29; +STAT_CRAFT_PROCESSING = 30; +STAT_CRAFT_MAGIC_PROCESSING = 31; +STAT_CRAFT_PROCESS_CONTROL = 32; +STAT_HARVEST_POTENCY = 33; +STAT_HARVEST_LIMIT = 34; +STAT_HARVEST_RATE = 35; + +-- DAMAGE TAKEN TYPE +DAMAGE_TAKEN_TYPE_NONE = 0; +DAMAGE_TAKEN_TYPE_ATTACK = 1; +DAMAGE_TAKEN_TYPE_MAGIC = 2; +DAMAGE_TAKEN_TYPE_WEAPONSKILL = 3; +DAMAGE_TAKEN_TYPE_ABILITY = 4; + +-- CLASSID +CLASSID_PUG = 2; +CLASSID_GLA = 3; +CLASSID_MRD = 4; +CLASSID_ARC = 7; +CLASSID_LNC = 8; +CLASSID_THM = 22; +CLASSID_CNJ = 23; + + --UTILS function kickEventContinue(player, actor, trigger, ...) diff --git a/data/scripts/hiteffect.lua b/data/scripts/hiteffect.lua new file mode 100644 index 00000000..1285d363 --- /dev/null +++ b/data/scripts/hiteffect.lua @@ -0,0 +1,105 @@ +HitEffect = +{ + --All HitEffects have the last byte 0x8 + HitEffectType = 134217728, --8 << 24 + --Status effects use 32 <<,24 + StatusEffectType = 536870912,--32 << 24, + --Heal effects use 48 << 24 + MagicEffectType = 805306368,--48 << 24 + + --Not setting RecoilLv2 or RecoilLv3 results in the weaker RecoilLv1. + --These are the recoil animations that play on the target, ranging from weak to strong. + --The recoil that gets set was likely based on the percentage of HP lost from the attack. + --These are used for resists for spells. RecoilLV1 is a full resist, RecoilLv2 is a partial resist, RecoilLv3 is no resist, CriticalHit is a crit + RecoilLv1 = 0, + RecoilLv2 = 1, + RecoilLv3 = 2, + + --Setting both recoil flags triggers the "Critical!" pop-up text and hit visual effect. + CriticalHit = 3, + + --Hit visual and sound effects when connecting with the target. + --Mixing these flags together will yield different results. + --Each visual likely relates to a specific weapon. + --Ex: HitVisual4 flag alone appears to be the visual and sound effect for hand-to-hand attacks. + + --HitVisual is probably based on attack property. + --HitVisual1 is for slashing attacks + --HitVisual2 is for piercing attacks + --HitVisual1 | Hitvisual2 is for blunt attacks + --HitVisual3 is for projectile attacks + --Basically, takes the attack property as defined by the weapon and shifts it left 2 + --For auto attacks attack property is weapon's damageAttributeType1 + --Still not totally sure how this works with weaponskills or what hitvisual4 or the other combinations are for + HitVisual1 = 4, + HitVisual2 = 8, + HitVisual3 = 16, + HitVisual4 = 32, + + + --An additional visual effect that plays on the target when attacked if: + --The attack is physical and they have the protect buff on. + --The attack is magical and they have the shell buff on. + --Special Note: Shell was removed in later versions of the game. + --Another effect plays when both Protect and Shell flags are activated. + --Not sure what this effect is. + --Random guess: if the attack was a hybrid of both physical and magical and the target had both Protect and Shell buffs applied. + Protect = 64, + Shell = 128, + ProtectShellSpecial = 192,-- Protect | Shell, + + Heal = 256,-- Required for heal text to be blue along with HealEffectType, not sure if that's all it's used for + MP = 512, + + --If only HitEffect1 is set out of the hit effects, the "Evade!" pop-up text triggers along with the evade visual. + --If no hit effects are set, the "Miss!" pop-up is triggered and no hit visual is played. + HitEffect1 = 512, + HitEffect2 = 1024, --Plays the standard hit visual effect, but with no sound if used alone. + HitEffect3 = 2048, --Yellow effect, crit? + HitEffect4 = 4096, --Plays the blocking animation + HitEffect5 = 8192, + GustyHitEffect = 3072,--HitEffect3 | HitEffect2, + GreenTintedHitEffect = 4608,-- HitEffect4 | HitEffect1, + + --For specific animations + Miss = 0, + Evade = 512, + Hit = 1536, --HitEffect1 | HitEffect2, + Parry = 3584, --Hit | HitEffect3, + Block = 4096, + Crit = 2048, + + --Knocks you back away from the attacker. + KnockbackLv1 = 5632,-- HitEffect4 | HitEffect2 | HitEffect1, + KnockbackLv2 = 6144,-- HitEffect4 | HitEffect3, + KnockbackLv3 = 6656,-- HitEffect4 | HitEffect3 | HitEffect1, + KnockbackLv4 = 7168,-- HitEffect4 | HitEffect3 | HitEffect2, + KnockbackLv5 = 7680,-- HitEffect4 | HitEffect3 | HitEffect2 | HitEffect1, + + --Knocks you away from the attacker in a counter-clockwise direction. + KnockbackCounterClockwiseLv1 = 8192, + KnockbackCounterClockwiseLv2 = 8704,-- HitEffect5 | HitEffect1, + + --Knocks you away from the attacker in a clockwise direction. + KnockbackClockwiseLv1 = 9216,-- HitEffect5 | HitEffect2, + KnockbackClockwiseLv2 = 9728,-- HitEffect5 | HitEffect2 | HitEffect1, + + --Completely drags target to the attacker, even across large distances. + DrawIn = 10240,-- HitEffect5 | HitEffect3, + + --An additional visual effect that plays on the target based on according buff. + UnknownShieldEffect = 12288,-- HitEffect5 | HitEffect4, + Stoneskin = 12800,-- HitEffect5 | HitEffect4 | HitEffect1, + + --Unknown = 1 << 14, -- Not sure what this flag does; might be another HitEffect. + + --A special effect when performing appropriate skill combos in succession. + --Ex: Thunder (SkillCombo1 Effect) -> Thundara (SkillCombo2 Effect) -> Thundaga (SkillCombo3 Effect) + --Special Note: SkillCombo4 was never actually used in 1.0 since combos only chained up to 3 times maximum. + SkillCombo1 = 32768, + SkillCombo2 = 65536, + SkillCombo3 = 98304,-- SkillCombo1 | SkillCombo2, + SkillCombo4 = 131072 + + --Flags beyond here are unknown/untested. +} \ No newline at end of file diff --git a/data/scripts/magic.lua b/data/scripts/magic.lua new file mode 100644 index 00000000..15387d97 --- /dev/null +++ b/data/scripts/magic.lua @@ -0,0 +1,43 @@ +-- todo: add enums for status effects in global.lua +require("global") +require("battleutils") + +magic = +{ + +}; + +--[[ + statId - see BattleTemp.cs + modifierId - Modifier.Intelligence, Modifier.Mind (see Modifier.cs) + multiplier - + ]] +function magic.HandleHealingMagic(caster, target, spell, action, statId, modifierId, multiplier, baseAmount) + potency = potency or 1.0; + healAmount = baseAmount; + + -- todo: shit based on mnd + local mind = caster.GetMod(Modifier.Mind); +end; + +function magic.HandleAttackMagic(caster, target, spell, action, statId, modifierId, multiplier, baseAmount) + -- todo: actually handle this + damage = baseAmount or math.random(1,10) * 10; + + return damage; +end; + +function magic.HandleEvasion(caster, target, spell, action, statId, modifierId) + + return false; +end; + +function magic.HandleStoneskin(caster, target, spell, action, statId, modifierId, damage) + --[[ + if target.statusEffects.HasStatusEffect(StatusEffect.Stoneskin) then + -- todo: damage reduction + return true; + end; + ]] + return false; +end; \ No newline at end of file diff --git a/data/scripts/modifiers.lua b/data/scripts/modifiers.lua new file mode 100644 index 00000000..c760753b --- /dev/null +++ b/data/scripts/modifiers.lua @@ -0,0 +1,116 @@ +modifiersGlobal = +{ + NAMEPLATE_SHOWN = 0, + TARGETABLE = 1, + NAMEPLATE_SHOWN2 = 2, + --NAMEPLATE_SHOWN2 = 3, + + Strength = 3, + Vitality = 4, + Dexterity = 5, + Intelligence = 6, + Mind = 7, + Piety = 8, + + ResistFire = 9, + ResistIce = 10, + ResistWind = 11, + ResistLightning = 12, + ResistEarth = 13, + ResistWater = 14, + + Accuracy = 15, + Evasion = 16, + Attack = 17, + Defense = 18, --Is there a magic defense stat? 19 maybe? + MagicAttack = 23, + MagicHeal = 24, + MagicEnhancePotency = 25, + MagicEnfeeblingPotency = 26, + + MagicAccuracy = 27, + MagicEvasion = 28, + + CraftProcessing = 30, + CraftMagicProcessing = 31, + CraftProcessControl = 32, + + HarvestPotency = 33, + HarvestLimit = 34, + HarvestRate = 35, + + None = 36, + Hp = 37, + HpPercent = 38, + Mp = 39, + MpPercent = 40, + Tp = 41, + TpPercent = 42, + Regen = 43, + Refresh = 44, + + AttackRange = 45, + Speed = 46, + AttackDelay = 47, + + Raise = 48, + MinimumHpLock = 49, -- hp cannot fall below this value + AttackType = 50, -- slashing, piercing, etc + BlockRate = 51, + Block = 52, + CritRating = 53, + HasShield = 54, -- Need this because shields are required for blocks. Could have used BlockRate or Block but BlockRate is provided by Gallant Sollerets and Block is provided by some buffs. + HitCount = 55, -- Amount of hits in an auto attack. Usually 1, 2 for h2h, 3 with spinning heel + + --Flat percent increases to these rates. Probably a better way to do this + RawEvadeRate = 56, + RawParryRate = 57, + RawBlockRate = 58, + RawResistRate = 59, + RawHitRate = 60, + RawCritRate = 61, + + DamageTakenDown = 62, -- Percent damage taken down + StoreTP = 63, --.1% extra tp per point. Lancer trait is 50 StoreTP + PhysicalCritRate = 64, --CritRating but only for physical attacks. Increases chance of critting. + PhysicalCritEvasion = 65, --Opposite of CritRating. Reduces chance of being crit by phyiscal attacks + PhysicalCritAttack = 66, --Increases damage done by Physical Critical hits + PhysicalCritResilience = 67, --Decreases damage taken by Physical Critical hits + Parry = 68, --Increases chance to parry + MagicCritPotency = 69, --Increases + Regain = 70, --TP regen, should be -90 out of combat, Invigorate sets to 100+ depending on traits + RegenDown = 71, --Damage over time effects. Separate from normal Regen because of how they are displayed in game + Stoneskin = 72, --Nullifies damage + MinimumTpLock = 73, --Don't let TP fall below this, used in openings + KnockbackImmune = 74 --Immune to knockback effects when above 0 +} + +mobModifiersGlobal = +{ + None = 0, + SpawnLeash = 1, -- how far can i move before i deaggro target + SightRange = 2, -- how close does target need to be for me to detect by sight + SoundRange = 3, -- how close does target need to be for me to detect by sound + BuffChance = 4, + HealChance = 5, + SkillUseChance = 6, + LinkRadius = 7, + MagicDelay = 8, + SpecialDelay = 9, + ExpBonus = 10, -- + IgnoreSpawnLeash = 11, -- pursue target forever + DrawIn = 12, -- do i suck people in around me + HpScale = 13, -- + Assist = 14, -- gotta call the bois + NoMove = 15, -- cant move + ShareTarget = 16, -- use this actor's id as target id + AttackScript = 17, -- call my script's onAttack whenever i attack + DefendScript = 18, -- call my script's onDamageTaken whenever i take damage + SpellScript = 19, -- call my script's onSpellCast whenever i finish casting + WeaponskillScript = 20, -- call my script's onWeaponSkill whenever i finish using a weaponskill + AbilityScript = 21, -- call my script's onAbility whenever i finish using an ability + CallForHelp = 22, -- actor with this id outside of target's party with this can attack me + FreeForAll = 23, -- any actor can attack me + Roams = 24, -- Do I walk around? + RoamDelay = 25 -- What is the delay between roam ticks +} \ No newline at end of file diff --git a/data/scripts/player.lua b/data/scripts/player.lua index d7939b20..4fdbddd7 100644 --- a/data/scripts/player.lua +++ b/data/scripts/player.lua @@ -1,26 +1,26 @@ +require("global"); + local initClassItems, initRaceItems; -function onBeginLogin(player) - +function onBeginLogin(player) --New character, set the initial quest if (player:GetPlayTime(false) == 0) then initialTown = player:GetInitialTown(); - if (initialTown == 1 and player:HasQuest(110001) == false) then - player:AddQuest(110001); + --player:AddQuest(110001); player:SetHomePoint(1280001); elseif (initialTown == 2 and player:HasQuest(110005) == false) then - player:AddQuest(110005); + --player:AddQuest(110005); player:SetHomePoint(1280061); elseif (initialTown == 3 and player:HasQuest(110009) == false) then - player:AddQuest(110009); + --player:AddQuest(110009); player:SetHomePoint(1280031); end end - + --For Opening. Set Director and reset position incase d/c - if (player:HasQuest(110001) == true and player:GetZoneID() == 193) then + if (player:HasQuest(110001) == true and player:GetZoneID() == 193) then director = player:GetZone():CreateDirector("OpeningDirector", false); player:AddDirector(director); director:StartDirector(true); @@ -60,7 +60,6 @@ function onBeginLogin(player) player:GetQuest(110009):ClearQuestData(); player:GetQuest(110009):ClearQuestFlags(); end - end function onLogin(player) diff --git a/data/scripts/statuseffectids.lua b/data/scripts/statuseffectids.lua new file mode 100644 index 00000000..fcf5cf6a --- /dev/null +++ b/data/scripts/statuseffectids.lua @@ -0,0 +1,318 @@ +StatusEffectId = +{ + RageofHalone = 221021, + + Quick = 223001, + Haste = 223002, + Slow = 223003, + Petrification = 223004, + Paralysis = 223005, + Silence = 223006, + Blind = 223007, + Mute = 223008, + Slowcast = 223009, + Glare = 223010, + Poison = 223011, + Transfixion = 223012, + Pacification = 223013, + Amnesia = 223014, + Stun = 223015, + Daze = 223016, + ExposedFront = 223017, + ExposedRight = 223018, + ExposedRear = 223019, + ExposedLeft = 223020, + Incapacitation = 223021, + Incapacitation2 = 223022, + Incapacitation3 = 223023, + Incapacitation4 = 223024, + Incapacitation5 = 223025, + Incapacitation6 = 223026, + Incapacitation7 = 223027, + Incapacitation8 = 223028, + HPBoost = 223029, + HPPenalty = 223030, + MPBoost = 223031, + MPPenalty = 223032, + AttackUp = 223033, + AttackDown = 223034, + AccuracyUp = 223035, + AccuracyDown = 223036, + DefenseUp = 223037, + DefenseDown = 223038, + EvasionUp = 223039, + EvasionDown = 223040, + MagicPotencyUp = 223041, + MagicPotencyDown = 223042, + MagicAccuracyUp = 223043, + MagicAccuracyDown = 223044, + MagicDefenseUp = 223045, + MagicDefenseDown = 223046, + MagicResistanceUp = 223047, + MagicResistanceDown = 223048, + CombatFinesse = 223049, + CombatHindrance = 223050, + MagicFinesse = 223051, + MagicHindrance = 223052, + CombatResilience = 223053, + CombatVulnerability = 223054, + MagicVulnerability = 223055, + MagicResilience = 223056, + Inhibited = 223057, + AegisBoon = 223058, + Deflection = 223059, + Outmaneuver = 223060, + Provoked = 223061, + Sentinel = 223062, + Cover = 223063, + Rampart = 223064, + StillPrecision = 223065, + Cadence = 223066, + DiscerningEye = 223067, + TemperedWill = 223068, + Obsess = 223069, + Ambidexterity = 223070, + BattleCalm = 223071, + MasterofArms = 223072, + Taunted = 223073, + Blindside = 223074, + Featherfoot = 223075, + PresenceofMind = 223076, + CoeurlStep = 223077, + EnduringMarch = 223078, + MurderousIntent = 223079, + Entrench = 223080, + Bloodbath = 223081, + Retaliation = 223082, + Foresight = 223083, + Defender = 223084, + Rampage = 223085, + Enraged = 223086, + Warmonger = 223087, + Disorientx1 = 223088, + Disorientx2 = 223089, + Disorientx3 = 223090, + KeenFlurry = 223091, + ComradeinArms = 223092, + Ferocity = 223093, + Invigorate = 223094, + LineofFire = 223095, + Jump = 223096, + Collusion = 223097, + Diversion = 223098, + SpeedSurge = 223099, + LifeSurge = 223100, + SpeedSap = 223101, + LifeSap = 223102, + Farshot = 223103, + QuellingStrike = 223104, + RagingStrike = 223105, + HawksEye = 223106, + SubtleRelease = 223107, + Decoy = 223108, + Profundity = 223109, + TranceChant = 223110, + RoamingSoul = 223111, + Purge = 223112, + Spiritsong = 223113, + Resonance = 223114, + Soughspeak = 223115, + PresenceofMind2 = 223116, + SanguineRite = 223117, + PunishingBarbs = 223118, + DarkSeal = 223119, + Emulate = 223120, + ParadigmShift = 223121, + ConcussiveBlowx1 = 223123, + ConcussiveBlowx2 = 223124, + ConcussiveBlowx3 = 223125, + SkullSunder = 223126, + Bloodletter = 223127, + Levinbolt = 223128, + Protect = 223129, + Shell = 223130, + Reraise = 223131, + ShockSpikes = 223132, + Stoneskin = 223133, + Scourge = 223134, + Bio = 223135, + Dia = 223136, + Banish = 223137, + StygianSpikes = 223138, + ATKAbsorbed = 223139, + DEFAbsorbed = 223140, + ACCAbsorbed = 223141, + EVAAbsorbed = 223142, + AbsorbATK = 223143, + AbsorbDEF = 223144, + AbsorbACC = 223145, + AbsorbEVA = 223146, + SoulWard = 223147, + Burn = 223148, + Frost = 223149, + Shock = 223150, + Drown = 223151, + Choke = 223152, + Rasp = 223153, + Flare = 223154, + Freeze = 223155, + Burst = 223156, + Flood = 223157, + Tornado = 223158, + Quake = 223159, + Berserk = 223160, + RegimenofRuin = 223161, + RegimenofTrauma = 223162, + RegimenofDespair = 223163, + RegimenofConstraint = 223164, + Weakness = 223165, + Scavenge = 223166, + Fastcast = 223167, + MidnightHowl = 223168, + Outlast = 223169, + Steadfast = 223170, + DoubleNock = 223171, + TripleNock = 223172, + Covered = 223173, + PerfectDodge = 223174, + ExpertMining = 223175, + ExpertLogging = 223176, + ExpertHarvesting = 223177, + ExpertFishing = 223178, + ExpertSpearfishing = 223179, + Regen = 223180, + Refresh = 223181, + Regain = 223182, + TPBleed = 223183, + Empowered = 223184, + Imperiled = 223185, + Adept = 223186, + Inept = 223187, + Quick2 = 223188, + Quick3 = 223189, + WristFlick = 223190, + Glossolalia = 223191, + SonorousBlast = 223192, + Comradery = 223193, + StrengthinNumbers = 223194, + + BrinkofDeath = 223197, + CraftersGrace = 223198, + GatherersGrace = 223199, + Rebirth = 223200, + Stealth = 223201, + StealthII = 223202, + StealthIII = 223203, + StealthIV = 223204, + Combo = 223205, + GoringBlade = 223206, + Berserk2 = 223207, + Rampage2 = 223208, + FistsofFire = 223209, + FistsofEarth = 223210, + FistsofWind = 223211, + PowerSurgeI = 223212, + PowerSurgeII = 223213, + PowerSurgeIII = 223214, + LifeSurgeI = 223215, + LifeSurgeII = 223216, + LifeSurgeIII = 223217, + DreadSpike = 223218, + BloodforBlood = 223219, + Barrage = 223220, + RagingStrike2 = 223221, + + Swiftsong = 223224, + SacredPrism = 223225, + ShroudofSaints = 223226, + ClericStance = 223227, + BlissfulMind = 223228, + DarkSeal2 = 223229, + Resonance2 = 223230, + Excruciate = 223231, + Necrogenesis = 223232, + Parsimony = 223233, + SanguineRite2 = 223234, + Aero = 223235, + Outmaneuver2 = 223236, + Blindside2 = 223237, + Decoy2 = 223238, + Protect2 = 223239, + SanguineRite3 = 223240, + Bloodletter2 = 223241, + FullyBlissfulMind = 223242, + MagicEvasionDown = 223243, + HundredFists = 223244, + SpinningHeel = 223245, + DivineVeil = 223248, + HallowedGround = 223249, + Vengeance = 223250, + Antagonize = 223251, + MightyStrikes = 223252, + BattleVoice = 223253, + BalladofMagi = 223254, + PaeonofWar = 223255, + MinuetofRigor = 223256, + GoldLung = 223258, + Goldbile = 223259, + AurumVeil = 223260, + AurumVeilII = 223261, + Flare2 = 223262, + Resting = 223263, + DivineRegen = 223264, + DefenseAndEvasionUp = 223265, + MagicDefenseAndEvasionUp = 223266, + AttackUp2 = 223267, + MagicPotencyUp2 = 223268, + DefenseAndEvasionDown = 223269, + MagicDefenseAndEvasionDown = 223270, + Poison2 = 223271, + DeepBurn = 223272, + LunarCurtain = 223273, + DefenseUp2 = 223274, + AttackDown2 = 223275, + Sanction = 223992, + IntactPodlingToting = 223993, + RedRidingHooded = 223994, + Medicated = 223998, + WellFed = 223999, + + Sleep = 228001, + Bind = 228011, + Fixation = 228012, + Bind2 = 228013, + Heavy = 228021, + Charm = 228031, + Flee = 228041, + Doom = 228051, + SynthesisSupport = 230001, + WoodyardAccess = 230002, + SmithsForgeAccess = 230003, + ArmorersForgeAccess = 230004, + GemmaryAccess = 230005, + TanneryAccess = 230006, + ClothshopAccess = 230007, + LaboratoryAccess = 230008, + CookeryAccess = 230009, + MinersSupport = 230010, + BotanistsSupport = 230011, + FishersSupport = 230012, + GearChange = 230013, + GearDamage = 230014, + HeavyGearDamage = 230015, + Lamed = 230016, + Lamed2 = 230017, + Lamed3 = 230018, + Poison3 = 231002, + Envenom = 231003, + Berserk4 = 231004, + GuardiansAspect = 253002, + + + -- custom effects here + -- status for having procs fall off + EvadeProc = 253003, + BlockProc = 253004, + ParryProc = 253005, + MissProc = 253006 +} \ No newline at end of file diff --git a/data/scripts/unique/fst0Battle03/Monster/bloodthirsty_wolf.lua b/data/scripts/unique/fst0Battle03/Monster/bloodthirsty_wolf.lua new file mode 100644 index 00000000..e69de29b diff --git a/data/scripts/unique/fst0Battle03/Monster/papalymo.lua b/data/scripts/unique/fst0Battle03/Monster/papalymo.lua new file mode 100644 index 00000000..7ed63cac --- /dev/null +++ b/data/scripts/unique/fst0Battle03/Monster/papalymo.lua @@ -0,0 +1,28 @@ +require ("global") +require ("ally") + +function onSpawn(ally) + ally:SetMaxHP(69420) + ally:SetHP(ally:GetMaxHP()) + ally.isAutoAttackEnabled = false; + ally.neutral = false +end + +function onCombatTick(ally, target, tick, contentGroupCharas) + allyGlobal.onCombatTick(ally, target, tick, contentGroupCharas); +end + + +function onRoam(ally, contentGroupCharas) + ally.detectionType = 0xFF + ally.isMovingToSpawn = false + ally.neutral = false + ally.animationId = 0 + allyGlobal.onCombatTick(ally, nil, nil, contentGroupCharas) +end + + +function tryAggro(ally, contentGroupCharas) + allyGlobal.tryAggro(ally, contentGroupCharas) + +end \ No newline at end of file diff --git a/data/scripts/unique/fst0Battle03/Monster/yda.lua b/data/scripts/unique/fst0Battle03/Monster/yda.lua new file mode 100644 index 00000000..4462774b --- /dev/null +++ b/data/scripts/unique/fst0Battle03/Monster/yda.lua @@ -0,0 +1,26 @@ +require ("global") + +require ("ally") + +function onSpawn(ally) + ally:SetMaxHP(69420) + ally:SetHP(ally:GetMaxHP()) + ally.isAutoAttackEnabled = false + ally.neutral = false +end + +function onCombatTick(ally, target, tick, contentGroupCharas) + allyGlobal.onCombatTick(ally, target, tick, contentGroupCharas) +end + +function tryAggro(ally, contentGroupCharas) + allyGlobal.tryAggro(ally, contentGroupCharas) +end + +function onRoam(ally, contentGroupCharas) + ally.detectionType = 0xFF + ally.isMovingToSpawn = false + ally.neutral = false + ally.animationId = 0 + --allyGlobal.onCombatTick(ally, contentGroupCharas) +end \ No newline at end of file diff --git a/data/scripts/unique/fst0Battle03/PopulaceStandard/yda.lua b/data/scripts/unique/fst0Battle03/PopulaceStandard/yda.lua index a82963ad..e0e54fdf 100644 --- a/data/scripts/unique/fst0Battle03/PopulaceStandard/yda.lua +++ b/data/scripts/unique/fst0Battle03/PopulaceStandard/yda.lua @@ -7,9 +7,10 @@ end function onEventStarted(player, npc, triggerName) man0g0Quest = player:GetQuest("Man0g0"); - + print("Got Quest Man0g0"); if (man0g0Quest ~= nil) then - + + print("Man0g0Quest is not nil"); if (triggerName == "pushDefault") then callClientFunction(player, "delegateEvent", player, man0g0Quest, "processTtrNomal002", nil, nil, nil); elseif (triggerName == "talkDefault") then @@ -23,6 +24,7 @@ function onEventStarted(player, npc, triggerName) player:GetDirector("OpeningDirector"):onTalkEvent(player, npc); --Was she talked to after papalymo? else + print("Making content area"); if (man0g0Quest:GetQuestFlag(MAN0G0_FLAG_MINITUT_DONE1) == true) then player:EndEvent(); @@ -35,13 +37,16 @@ function onEventStarted(player, npc, triggerName) end director = contentArea:GetContentDirector(); - player:AddDirector(director); + --player:AddDirector(director); director:StartDirector(false); player:KickEvent(director, "noticeEvent", true); player:SetLoginDirector(director); + print("Content area and director made"); + player:ChangeState(0); GetWorldManager():DoZoneChangeContent(player, contentArea, 362.4087, 4, -703.8168, 1.5419, 16); + print("Zone Change"); return; else callClientFunction(player, "delegateEvent", player, man0g0Quest, "processEvent000_1", nil, nil, nil); diff --git a/data/scripts/unique/fst0Town01/Monster/ass.lua b/data/scripts/unique/fst0Town01/Monster/ass.lua new file mode 100644 index 00000000..21e27867 --- /dev/null +++ b/data/scripts/unique/fst0Town01/Monster/ass.lua @@ -0,0 +1,2 @@ +function onDeath(monster, player, lastAttacker) +end \ No newline at end of file diff --git a/data/scripts/unique/fst0Town01/PopulaceStandard/serpent_private_hill.lua b/data/scripts/unique/fst0Town01/PopulaceStandard/serpent_private_hill.lua new file mode 100644 index 00000000..02e67d32 --- /dev/null +++ b/data/scripts/unique/fst0Town01/PopulaceStandard/serpent_private_hill.lua @@ -0,0 +1,7 @@ +require ("global") + +function onEventStarted(player, npc) + defaultFst = GetStaticActor("DftFst"); + callClientFunction(player, "delegateEvent", player, defaultFst, "defaultTalkWithSerpent_private_hill_001", nil, nil, nil); + player:endEvent(); +end \ No newline at end of file diff --git a/data/scripts/unique/fst0Town01/PopulaceStandard/task_board.lua b/data/scripts/unique/fst0Town01/PopulaceStandard/task_board.lua new file mode 100644 index 00000000..b7448428 --- /dev/null +++ b/data/scripts/unique/fst0Town01/PopulaceStandard/task_board.lua @@ -0,0 +1,7 @@ +require ("global") + +function onEventStarted(player, npc) + defaultFst = GetStaticActor("DftFst"); + callClientFunction(player, "delegateEvent", player, defaultFst, "defaultTalkWithTask_board_001", nil, nil, nil); + player:endEvent(); +end \ No newline at end of file diff --git a/data/scripts/unique/fst0Town01a/PopulaceStandard/gagaroon.lua b/data/scripts/unique/fst0Town01a/PopulaceStandard/gagaroon.lua new file mode 100644 index 00000000..19143bdf --- /dev/null +++ b/data/scripts/unique/fst0Town01a/PopulaceStandard/gagaroon.lua @@ -0,0 +1,7 @@ +require ("global") + +function onEventStarted(player, npc) + defaultFst = GetStaticActor("DftFst"); + callClientFunction(player, "delegateEvent", player, defaultFst, "defaultTalkWithGagaroon_001", nil, nil, nil); + player:endEvent(); +end \ No newline at end of file diff --git a/data/scripts/unique/fst0Town01a/PopulaceStandard/louisoix.lua b/data/scripts/unique/fst0Town01a/PopulaceStandard/louisoix.lua new file mode 100644 index 00000000..b0b08cd5 --- /dev/null +++ b/data/scripts/unique/fst0Town01a/PopulaceStandard/louisoix.lua @@ -0,0 +1,7 @@ +require ("global") + +function onEventStarted(player, npc) + defaultFst = GetStaticActor("DftFst"); + callClientFunction(player, "delegateEvent", player, defaultFst, "defaultTalkWithLouisoix_001", nil, nil, nil); + player:endEvent(); +end \ No newline at end of file diff --git a/data/scripts/unique/fst0Town01a/PopulaceStandard/serpent_private_carver.lua b/data/scripts/unique/fst0Town01a/PopulaceStandard/serpent_private_carver.lua new file mode 100644 index 00000000..0a24f7e7 --- /dev/null +++ b/data/scripts/unique/fst0Town01a/PopulaceStandard/serpent_private_carver.lua @@ -0,0 +1,7 @@ +require ("global") + +function onEventStarted(player, npc) + defaultFst = GetStaticActor("DftFst"); + callClientFunction(player, "delegateEvent", player, defaultFst, "defaultTalkWithSerpent_private_carver_001", nil, nil, nil); + player:endEvent(); +end \ No newline at end of file diff --git a/data/scripts/unique/fst0Town01a/PopulaceStandard/serpent_private_holmes.lua b/data/scripts/unique/fst0Town01a/PopulaceStandard/serpent_private_holmes.lua new file mode 100644 index 00000000..fc7c975d --- /dev/null +++ b/data/scripts/unique/fst0Town01a/PopulaceStandard/serpent_private_holmes.lua @@ -0,0 +1,7 @@ +require ("global") + +function onEventStarted(player, npc) + defaultFst = GetStaticActor("DftFst"); + callClientFunction(player, "delegateEvent", player, defaultFst, "defaultTalkWithSerpent_private_holmes_001", nil, nil, nil); + player:endEvent(); +end \ No newline at end of file diff --git a/data/scripts/unique/fst0Town01a/PopulaceStandard/serpent_private_kirk.lua b/data/scripts/unique/fst0Town01a/PopulaceStandard/serpent_private_kirk.lua new file mode 100644 index 00000000..c7b840aa --- /dev/null +++ b/data/scripts/unique/fst0Town01a/PopulaceStandard/serpent_private_kirk.lua @@ -0,0 +1,7 @@ +require ("global") + +function onEventStarted(player, npc) + defaultFst = GetStaticActor("DftFst"); + callClientFunction(player, "delegateEvent", player, defaultFst, "defaultTalkWithSerpent_private_kirk_001", nil, nil, nil); + player:endEvent(); +end \ No newline at end of file diff --git a/data/scripts/unique/fst0Town01a/PopulaceStandard/serpent_private_stone.lua b/data/scripts/unique/fst0Town01a/PopulaceStandard/serpent_private_stone.lua new file mode 100644 index 00000000..d6d2ff82 --- /dev/null +++ b/data/scripts/unique/fst0Town01a/PopulaceStandard/serpent_private_stone.lua @@ -0,0 +1,7 @@ +require ("global") + +function onEventStarted(player, npc) + defaultFst = GetStaticActor("DftFst"); + callClientFunction(player, "delegateEvent", player, defaultFst, "defaultTalkWithSerpent_private_stone_001", nil, nil, nil); + player:endEvent(); +end \ No newline at end of file diff --git a/data/scripts/unique/fst0Town01a/PopulaceStandard/serpent_private_white.lua b/data/scripts/unique/fst0Town01a/PopulaceStandard/serpent_private_white.lua new file mode 100644 index 00000000..d66e5dad --- /dev/null +++ b/data/scripts/unique/fst0Town01a/PopulaceStandard/serpent_private_white.lua @@ -0,0 +1,7 @@ +require ("global") + +function onEventStarted(player, npc) + defaultFst = GetStaticActor("DftFst"); + callClientFunction(player, "delegateEvent", player, defaultFst, "defaultTalkWithSerpent_private_white_001", nil, nil, nil); + player:endEvent(); +end \ No newline at end of file diff --git a/data/scripts/unique/sea0Town01a/PopulaceStandard/rubh_hob.lua b/data/scripts/unique/sea0Town01a/PopulaceStandard/rubh_hob.lua new file mode 100644 index 00000000..2b97c724 --- /dev/null +++ b/data/scripts/unique/sea0Town01a/PopulaceStandard/rubh_hob.lua @@ -0,0 +1,7 @@ +require ("global") + +function onEventStarted(player, npc) + defaultSea = GetStaticActor("DftSea"); + callClientFunction(player, "delegateEvent", player, defaultSea, "defaultTalkWithRubh_hob_001", nil, nil, nil); + player:endEvent(); +end \ No newline at end of file diff --git a/data/scripts/utils.lua b/data/scripts/utils.lua index 2aff7f62..46cd1399 100644 --- a/data/scripts/utils.lua +++ b/data/scripts/utils.lua @@ -26,4 +26,19 @@ function getDistanceBetweenActors(actor1, actor2) local dz = pos1[2] - pos2[2] return math.sqrt(dx * dx + dy * dy + dz *dz); +end + +function getXZDistanceBetweenActors(actor1, actor2) + local pos1 = actor1:GetPos(); + local pos2 = actor2:GetPos(); + + local dx = pos1[0] - pos2[0]; + local dz = pos1[2] - pos2[2]; + + return math.sqrt(dx * dx + dz *dz); +end + +function math.Clamp(val, lower, upper) + if lower > upper then lower, upper = upper, lower end -- swap if boundaries supplied the wrong way + return math.max(lower, math.min(upper, val)) end \ No newline at end of file diff --git a/data/scripts/weaponskill.lua b/data/scripts/weaponskill.lua new file mode 100644 index 00000000..8fb6dabb --- /dev/null +++ b/data/scripts/weaponskill.lua @@ -0,0 +1,62 @@ +-- todo: add enums for status effects in global.lua +--require("global") +require("battleutils") +--[[ + statId - see BattleTemp.cs + modifier - Modifier.Intelligence, Modifier.Mind (see Modifier.cs) + multiplier - + ]] + + +function CalculateDamage(caster, target, skill, action) + --http://forum.square-enix.com/ffxiv/threads/36412-STR-PIE-ATK-Testing/page2 + --DRG numbers + --Against Level 52 Halberdiers: + --0.8 damage/STR. Caps at 350 + --0.67=0.69 damage/PIE. Hard cap at 310 + --0.35-0.37 damage/ATK for both AA and WS. + + --^ Old? + --http://prestigexiv.guildwork.com/forum/threads/4fecdc94205cb248b5000526-dragoon-and-other-dd-dpsbase-damage-study?page=1#4fecdc94205cb248b5000525 + --10/09/2012 http://forum.square-enix.com/ffxiv/threads/55291-DPS-Testing/page4 + -- 1 point prim: 0.8 damage + -- ATK: .1% damage? .38 damage? + + --Possible formula for melee?: + --local strCap = CalculateCapOfWeapon(caster.getweapon)<- not sure how this is calculated yet, just an example + --local secondaryCap = CalculateSecondaryCapOfWeapon(caster.getweapon) + --local cappedStr = math.min(caster.GetMod(modifiersGlobal.Strength), strCap); + --local cappedSec = math.min(caster.GetMod(caster.secondaryStat), secCap); + --local damageBase = skill.basePotency + (0.85 * cappedStr) + (0.65 * cappedSec); + + --The maximum deviation for weaponskills is ~8%. + --local dev = 0.96 + (math.random() * 8); + --damageBase = math.Clamp(damageBase * dev, 1, 9999); + --return damageBase; + return 100; +end + +function HandleHealingSkill(caster, target, skill, action, statId, modifierId, multiplier, baseAmount) + potency = potency or 1.0; + healAmount = baseAmount; + + -- todo: shit based on mnd + local mind = caster.GetMod(Modifier.Mind); +end; + +function HandleAttackSkill(caster, target, skill, action, statId, modifierId, multiplier, baseAmount) + -- todo: actually handle this + damage = baseAmount or math.random(1,10) * 10; + + return damage; +end; + +function HandleStoneskin(caster, target, skill, action, statId, modifierId, damage) + --[[ + if target.statusEffects.HasStatusEffect(StatusEffect.Stoneskin) then + -- todo: damage reduction + return true; + end; + ]] + return false; +end; \ No newline at end of file diff --git a/research/worldMasterTextIds.txt b/research/worldMasterTextIds.txt new file mode 100644 index 00000000..82d75096 --- /dev/null +++ b/research/worldMasterTextIds.txt @@ -0,0 +1,129 @@ +# battle commands +## general +30101 [@2B([@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])])] [@IF($E4($EB(1),$EB(2)),use,uses)] [@SHEET(xtx/command,$E8(1),3)]. +30102 [@2B([@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])])] [@IF($E4($EB(1),$EB(2)),use,uses)] [@SHEET(xtx/command,$E8(1),3)] again. +30103 [@2B([@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])])] [@IF($E4($EB(1),$EB(3)),switch,switches)] to [@SHEET(xtx/text_jobName,$E8(3),1)]. +30104 [@2B([@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])])]'s group has been engaged. +30105 Readying [@SHEET(xtx/command,$E8(1),3)]... +30106 [@2B([@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])])] [@IF($E4($EB(1),$EB(2)),begin,begins)] casting [@SHEET(xtx/command,$E8(1),3)]. +30107 [@2B([@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])])] [@IF($E4($EB(1),$EB(3)),fall,falls)] to the ground. +30108 [@2B([@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])])] [@IF($E4($EB(1),$EB(2)),defeat,defeats)] [@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])]. +30109 [@2B([@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])])] [@IF($E4($EB(1),$EB(3)),regain,regains)] consciousness. +30110 [@2B([@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])])]'s party is defeated. +30111 [@IF($E4($EB(1),$EB(3)),Your,[@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])]'s)] party is defeated. +30112 [@2B([@IF($E4($EB(1),$EB(3)),your,[@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])]'s)])] [@SHEET(xtx/text_partsName,$E8(12),1)] incapacitated. +30113 [@2B([@IF($E4($EB(1),$EB(3)),your,[@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])]'s)])] [@SHEET(xtx/text_partsName,$E8(12),1)] no longer incapacitated. +30114 [@2B([@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])])] [@IF($E4($EB(1),$EB(3)),fall,falls)] to the ground. +30115 [@2B([@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])])] [@IF($E4($EB(1),$EB(3)),fall,falls)] to the ground. +30116 [@2B([@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])])] [@IF($E4($EB(1),$EB(2)),defeat,defeats)] [@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])]. +30117 [@2B([@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])])] [@IF($E4($EB(1),$EB(2)),defeat,defeats)] [@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])]. +30118 [@2B([@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])])]'s group is engaged. +30119 [@2B([@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])])]'s group is defeated. +30120 [@2B([@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])])] is engaged. +30121 [@2B([@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])])] is defeated. +30122 [@2B([@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])])] is engaged. +30123 [@2B([@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])])] is defeated. +30124 [@2B([@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])])] is aware of your presence. +30125 [@2B([@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])])] is defeated. +30126 [@2B([@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])])] [@IF($E4($EB(1),$EB(2)),ready,readies)] [@SHEET(xtx/command,$E8(1),3)]. +30127 [@2B([@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])])] [@IF($E4($EB(1),$EB(2)),ready,readies)] [@SHEET(xtx/command,$E8(1),3)]. +30128 [@2B([@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])])] [@IF($E4($EB(1),$EB(2)),begin,begins)] casting [@SHEET(xtx/command,$E8(1),3)]. +30129 [@2B([@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])])] [@IF($E4($EB(1),$EB(3)),call,calls)] for help. [@IF($E4($E8(12),1),Another enemy joins,[@2B([@IF($E5($E8(12),0),[@IF($E2($E8(12),10),[@SWITCH($E8(12),one,two,three,four,five,six,seven,eight,nine,ten)],[@VALUE($E8(12))])],[@VALUE($E8(12))])])] more enemies join)] the fight! + +## combat +30201 [@2B([@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])])] [@IF($E4($EB(1),$EB(2)),interrupt,interrupts)] the [@SHEET(xtx/command,$E8(10),2)]. +30202 [@2B([@IF($E4($EB(1),$EB(2)),your,[@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])]'s)])] [@SHEET(xtx/command,$E8(1),3)] fails. +30203 Invalid target. [@2B([@IF($E4($EB(1),$EB(2)),your,[@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])]'s)])] [@SHEET(xtx/command,$E8(1),3)] fails. +30204 [@2B([@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])])] cannot use that weaponskill at this time. +30205 [@2B([@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])])] cannot use that ability at this time. +30206 Target not in line of sight. [@2B([@IF($E4($EB(1),$EB(2)),your,[@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])]'s)])] [@SHEET(xtx/command,$E8(1),3)] fails. +30207 Target out of range. [@IF($E4($E8(1),12004),Battle Regimen cannot be begun,[@SHEET(xtx/command,$E8(1),3)] fails)]. +30208 [@2B([@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])])] [@IF($E4($EB(1),$EB(2)),use,uses)] [@SHEET(xtx/command,$E8(1),3)] on [@IF($E4($EB(2),$EB(3)),[@IF($E4($EB(1),$EB(2)),yourself,[@IF($E9(6),herself,himself)])],[@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])])], but [@IF($E4($EB(1),$EB(2)),fail,fails)]. +30209 [@2B([@IF($E4($EB(1),$EB(2)),your,[@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])]'s)])] [@SHEET(xtx/command,$E8(1),3)] fails. +30210 Unable to claim [@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])]. Party leader is in a different area. +30211 You cannot cast spells while moving. +30301 [@2B([@IF($E4($EB(1),$EB(2)),your,[@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])]'s)])] [@SHEET(xtx/command,$E8(1),3)] hits [@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])][@IF($E2($E8(12),1),, from the [@SHEET(xtx/text_directName,$E8(12),1)])] for [@VALUE($E8(10))] [@IF($E4($E8(10),1),point,points)] of damage. +30302 Critical! [@2B([@IF($E4($EB(1),$EB(2)),your,[@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])]'s)])] [@SHEET(xtx/command,$E8(1),3)] hits [@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])][@IF($E2($E8(12),1),, from the [@SHEET(xtx/text_directName,$E8(12),1)])] for [@VALUE($E8(10))] [@IF($E4($E8(10),1),point,points)] of damage. +30303 [@2B([@IF($E4($EB(1),$EB(2)),your,[@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])]'s)])] [@SHEET(xtx/command,$E8(1),3)] hits [@IF($E4($EB(1),$EB(3)),your,[@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])]'s)] [@SHEET(xtx/text_partsName,$E8(12),2)] for [@VALUE($E8(10))] [@IF($E4($E8(10),1),point,points)] of damage. +30304 Critical! [@2B([@IF($E4($EB(1),$EB(2)),your,[@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])]'s)])] [@SHEET(xtx/command,$E8(1),3)] hits [@IF($E4($EB(1),$EB(3)),your,[@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])]'s)] [@SHEET(xtx/text_partsName,$E8(12),2)] for [@VALUE($E8(10))] [@IF($E4($E8(10),1),point,points)] of damage. +30305 [@2B([@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])])][@IF($E4($E8(10),0),, partially)] [@IF($E4($EB(1),$EB(3)),block,blocks)] [@IF($E4($EB(1),$EB(2)),your,[@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])]'s)] [@SHEET(xtx/command,$E8(1),3)][@IF($E2($E8(12),1),, from the [@SHEET(xtx/text_directName,$E8(12),1)])], taking [@VALUE($E8(10))] [@IF($E4($E8(10),1),point,points)] of damage. +30306 [@2B([@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])])][@IF($E4($E8(10),0),, partially)] [@IF($E4($EB(1),$EB(3)),block,blocks)] [@IF($E4($EB(1),$EB(2)),your,[@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])]'s)] [@SHEET(xtx/command,$E8(1),3)][@IF($E2($E8(12),1),, from the [@SHEET(xtx/text_directName,$E8(12),1)])], taking [@VALUE($E8(10))] [@IF($E4($E8(10),1),point,points)] of damage. +30307 [@2B([@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])])][@IF($E4($E8(10),0),, partially)] [@IF($E4($EB(1),$EB(3)),block,blocks)] [@IF($E4($EB(1),$EB(2)),your,[@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])]'s)] [@SHEET(xtx/command,$E8(1),3)][@IF($E2($E8(12),1),, from the [@SHEET(xtx/text_directName,$E8(12),1)])], taking [@VALUE($E8(10))] [@IF($E4($E8(10),1),point,points)] of damage. +30308 [@2B([@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])])][@IF($E4($E8(10),0),, partially)] [@IF($E4($EB(1),$EB(3)),parry,parries)] [@IF($E4($EB(1),$EB(2)),your,[@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])]'s)] [@SHEET(xtx/command,$E8(1),3)][@IF($E2($E8(12),1),, from the [@SHEET(xtx/text_directName,$E8(12),1)])], taking [@VALUE($E8(10))] [@IF($E4($E8(10),1),point,points)] of damage. +30309 [@2B([@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])])][@IF($E4($E8(10),0),, partially)] [@IF($E4($EB(1),$EB(3)),parry,parries)] [@IF($E4($EB(1),$EB(2)),your,[@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])]'s)] [@SHEET(xtx/command,$E8(1),3)][@IF($E2($E8(12),1),, from the [@SHEET(xtx/text_directName,$E8(12),1)])], taking [@VALUE($E8(10))] [@IF($E4($E8(10),1),point,points)] of damage. +30310 [@2B([@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])])] [@IF($E4($EB(1),$EB(3)),evade,evades)] [@IF($E4($EB(1),$EB(2)),your,[@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])]'s)] [@SHEET(xtx/command,$E8(1),3)]. +30311 [@2B([@IF($E4($EB(1),$EB(2)),your,[@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])]'s)])] [@SHEET(xtx/command,$E8(1),3)] misses[@IF($E4($EB(2),$EB(3)),[@IF($E4($E9(7),$E9(8)),, [@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])])], [@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])])][@IF($E2($E8(12),1),, from the [@SHEET(xtx/text_directName,$E8(12),1)])]. +30312 [@2B([@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])])] [@IF($E4($EB(1),$EB(3)),are,is)] obstructing [@IF($E4($EB(1),$EB(2)),your,[@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])]'s)] [@SHEET(xtx/command,$E8(1),3)]. +30313 [@2B([@IF($E4($EB(1),$EB(2)),your,[@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])]'s)])] [@SHEET(xtx/command,$E8(1),3)] hits [@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])][@IF($E2($E8(12),1),, from the[@SHEET(xtx/text_directName,$E8(12),1)])] for [@VALUE($E8(10))] [@IF($E4($E8(10),1),point,points)] of damage. +30314 [@2B([@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])])] [@IF($E4($EB(1),$EB(3)),are,is)] impervious to [@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])]'s [@SHEET(xtx/command,$E8(1),3)]. +30315 [@2B([@IF($E4($EB(1),$EB(2)),your,[@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])]'s)])] [@SHEET(xtx/command,$E8(1),3)] hits [@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])][@IF($E2($E8(12),1),, from the [@SHEET(xtx/text_directName,$E8(12),1)])]. +30316 [@2B([@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])])] [@IF($E4($EB(1),$EB(3)),evade,evades)] [@IF($E4($EB(1),$EB(2)),your,[@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])]'s)] [@SHEET(xtx/command,$E8(1),3)][@IF($E4($E8(10),0),.,, taking [@VALUE($E8(10))] [@IF($E4($E8(10),1),point,points)] of damage.)] +30317 [@2B([@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])])] partially [@IF($E4($EB(1),$EB(3)),evade,evades)] [@IF($E4($EB(1),$EB(2)),your,[@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])]'s)] [@SHEET(xtx/command,$E8(1),3)], taking [@VALUE($E8(10))] [@IF($E4($E8(10),1),point,points)] of damage. +30318 [@2B([@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])])] slightly [@IF($E4($EB(1),$EB(3)),evade,evades)] [@IF($E4($EB(1),$EB(2)),your,[@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])]'s)] [@SHEET(xtx/command,$E8(1),3)], taking [@VALUE($E8(10))] [@IF($E4($E8(10),1),point,points)] of damage. +30319 [@2B([@IF($E4($EB(1),$EB(2)),your,[@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])]'s)])] [@SHEET(xtx/command,$E8(1),3)] hits [@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])] for [@VALUE($E8(10))] [@IF($E4($E8(10),1),point,points)] of damage. +30320 [@2B([@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])])] [@IF($E4($EB(1),$EB(2)),use,uses)] [@IF($E4($E8(1),21007),[@SWITCH([@SHEET(itemData,$E8(3),41)],[@COLOR(#fff3f3f3)],[@COLOR(#ffc0ffa0)],[@COLOR(#ff60c8ff)],[@COLOR(#ffb38cff)],[@COLOR(#ffffa666)],[@COLOR(#ffe5dd7e)])][@EDGECOLOR(#ff262626)][@SHEETEN(xtx/itemName,1,$E8(3),1,1)][@EDGECOLOR($EC)][@COLOR($EC)],[@SHEET(xtx/command,$E8(1),3)])][@IF($E4($EB(1),$EB(3)),, on [@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])])]. [@2B([@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])])] [@IF($E4($EB(1),$EB(3)),recover,recovers)] [@VALUE($E8(10))] HP. +30321 [@2B([@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])])] [@IF($E4($EB(1),$EB(2)),use,uses)] [@IF($E4($E8(1),21007),[@SWITCH([@SHEET(itemData,$E8(3),41)],[@COLOR(#fff3f3f3)],[@COLOR(#ffc0ffa0)],[@COLOR(#ff60c8ff)],[@COLOR(#ffb38cff)],[@COLOR(#ffffa666)],[@COLOR(#ffe5dd7e)])][@EDGECOLOR(#ff262626)][@SHEETEN(xtx/itemName,1,$E8(3),1,1)][@EDGECOLOR($EC)][@COLOR($EC)],[@SHEET(xtx/command,$E8(1),3)])][@IF($E4($EB(1),$EB(3)),, on [@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])])]. [@2B([@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])])] [@IF($E4($EB(1),$EB(3)),recover,recovers)] [@VALUE($E8(10))] MP. +30322 [@2B([@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])])] [@IF($E4($EB(1),$EB(2)),use,uses)] [@IF($E4($E8(1),21007),[@SWITCH([@SHEET(itemData,$E8(3),41)],[@COLOR(#fff3f3f3)],[@COLOR(#ffc0ffa0)],[@COLOR(#ff60c8ff)],[@COLOR(#ffb38cff)],[@COLOR(#ffffa666)],[@COLOR(#ffe5dd7e)])][@EDGECOLOR(#ff262626)][@SHEETEN(xtx/itemName,1,$E8(3),1,1)][@EDGECOLOR($EC)][@COLOR($EC)],[@SHEET(xtx/command,$E8(1),3)])][@IF($E4($EB(1),$EB(3)),, on [@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])])]. [@2B([@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])])] [@IF($E4($EB(1),$EB(3)),recover,recovers)] [@VALUE($E8(10))] MP. +30323 Additional effect: [@VALUE($E8(10))] [@IF($E4($E8(10),1),point,points)] of damage dealt. +30328 [@2B([@IF($E4($EB(1),$EB(2)),your,[@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])]'s)])] [@SHEET(xtx/command,$E8(1),3)] [@SHEET(xtx/status,$E8(11),5)]. +30329 [@2B([@IF($E4($EB(1),$EB(2)),your,[@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])]'s)])] [@SHEET(xtx/command,$E8(1),3)] removes [@IF($E4($EB(1),$EB(3)),your,[@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])]'s)] [@SHEET(xtx/status,$E8(11),3)] effect. +30330 [@SHEET(xtx/status,$E8(11),2)]. +30331 [@SHEET(xtx/status,$E8(11),4)]. +30332 [@2B([@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])])] [@IF($E4($EB(1),$EB(2)),absorb,absorbs)] [@VALUE($E8(10))] HP from [@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])]. +30333 [@2B([@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])])] [@IF($E4($EB(1),$EB(2)),absorb,absorbs)] [@VALUE($E8(10))] MP from [@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])]. +30334 [@2B([@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])])] [@IF($E4($EB(1),$EB(2)),absorb,absorbs)] [@VALUE($E8(10))] TP from [@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])]. +30335 [@2B([@IF($E4($EB(1),$EB(2)),your,[@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])]'s)])] [@SHEET(xtx/command,$E8(1),3)] [@SHEET(xtx/status,$E8(11),5)]. +30336 [@2B([@IF($E4($EB(1),$EB(2)),your,[@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])]'s)])] [@SHEET(xtx/command,$E8(1),3)] removes [@IF($E4($EB(1),$EB(3)),your,[@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])]'s)] [@SHEET(xtx/status,$E8(11),3)] effect. +30337 [@SHEET(xtx/status,$E8(11),2)]. +30338 [@SHEET(xtx/status,$E8(11),4)]. +30339 [@2B([@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])])] [@IF($E4($EB(1),$EB(3)),absorb,absorbs)] [@VALUE($E8(10))] HP from [@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])]. +30340 [@2B([@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])])] [@IF($E4($EB(1),$EB(3)),absorb,absorbs)] [@VALUE($E8(10))] MP from [@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])]. +30350 Counter! [@2B([@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])])] [@IF($E4($EB(1),$EB(2)),hit,hits)] [@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])] for [@VALUE($E8(10))] [@IF($E4($E8(10),1),point,points)] of damage. +30351 Counter! [@2B([@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])])] [@IF($E4($EB(1),$EB(2)),absorb,absorbs)] [@VALUE($E8(10))] MP from [@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])]. +30352 [@2B([@IF($E4($EB(1),$EB(2)),your,[@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])]'s)])] attack hits [@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])] for [@VALUE($E8(10))] [@IF($E4($E8(10),1),point,points)] of damage. +30353 [@2B([@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])])] [@IF($E4($EB(1),$EB(2)),steal,steals)] an item from [@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])]! +30354 [@2B([@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])])] [@IF($E4($EB(1),$EB(2)),use,uses)] [@SHEET(xtx/command,$E8(1),3)] on [@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])]. +30355 [@2B([@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])])] [@IF($E4($EB(1),$EB(2)),expend,expends)] [@VALUE($E8(10))] HP searching for projectiles. +30356 [@2B([@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])])] [@IF($E4($EB(1),$EB(2)),use,uses)] [@SHEET(xtx/command,$E8(1),3)] on [@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])]. [@2B([@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])])] [@IF($E4($EB(1),$EB(3)),lose,loses)] [@VALUE($E8(10))] MP. +30357 [@2B([@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])])] [@IF($E4($EB(1),$EB(2)),use,uses)] [@SHEET(xtx/command,$E8(1),3)] on [@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])]. [@2B([@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])])] [@IF($E4($EB(1),$EB(3)),lose,loses)] [@VALUE($E8(10))] TP. +30358 [@2B([@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])])] [@IF($E4($EB(1),$EB(2)),cover,covers)] [@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])], taking [@VALUE($E8(10))] [@IF($E4($E8(10),1),point,points)] of damage. +30359 [@2B([@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])])] [@IF($E4($EB(1),$EB(2)),use,uses)] [@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])] as a shield, diverting [@VALUE($E8(10))] [@IF($E4($E8(10),1),point,points)] of damage. +30360 [@2B([@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])])] [@IF($E4($EB(1),$EB(2)),use,uses)] [@SHEET(xtx/command,$E8(1),3)] on [@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])], but it was only a [@IF($E0($E8(1),27605),diversion,decoy)]. +30361 Counter! [@2B([@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])])] [@IF($E4($EB(1),$EB(3)),hit,hits)] [@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])] for [@VALUE($E8(10))] [@IF($E4($E8(10),1),point,points)] of damage. +30362 Critical counter! [@2B([@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])])] [@IF($E4($EB(1),$EB(3)),hit,hits)] [@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])] for [@VALUE($E8(10))] [@IF($E4($E8(10),1),point,points)] of damage. +30363 Counter! [@2B([@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])])] [@IF($E4($EB(1),$EB(3)),hit,hits)] [@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])] for [@VALUE($E8(10))] [@IF($E4($E8(10),1),point,points)] of damage. +30364 Critical counter! [@2B([@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])])] [@IF($E4($EB(1),$EB(3)),hit,hits)] [@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])] for [@VALUE($E8(10))] [@IF($E4($E8(10),1),point,points)] of damage. +30365 Counter! [@2B([@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])])] [@IF($E4($E8(10),0),,partially)] [@IF($E4($EB(1),$EB(3)),block,blocks)] [@IF($E4($EB(1),$EB(3)),your,[@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])]'s)] counter, taking [@VALUE($E8(10))] [@IF($E4($E8(10),1),point,points)] of damage. +30366 Counter! [@2B([@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])])] [@IF($E4($E8(10),0),,partially)] [@IF($E4($EB(1),$EB(3)),block,blocks)] [@IF($E4($EB(1),$EB(3)),your,[@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])]'s)] counter, taking [@VALUE($E8(10))] [@IF($E4($E8(10),1),point,points)] of damage. +30367 Counter! [@2B([@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])])] [@IF($E4($E8(10),0),,partially)] [@IF($E4($EB(1),$EB(3)),block,blocks)] [@IF($E4($EB(1),$EB(3)),your,[@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])]'s)] counter, taking [@VALUE($E8(10))] [@IF($E4($E8(10),1),point,points)] of damage. +30368 Counter! [@2B([@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])])] [@IF($E4($E8(10),0),,partially)] [@IF($E4($EB(1),$EB(3)),parry,parries)] [@IF($E4($EB(1),$EB(3)),your,[@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])]'s)] counter, taking [@VALUE($E8(10))] [@IF($E4($E8(10),1),point,points)] of damage. +30369 Counter! [@2B([@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])])] [@IF($E4($E8(10),0),,partially)] [@IF($E4($EB(1),$EB(3)),parry,parries)] [@IF($E4($EB(1),$EB(3)),your,[@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])]'s)] counter, taking [@VALUE($E8(10))] [@IF($E4($E8(10),1),point,points)] of damage. +30370 Counter! [@2B([@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])])] [@IF($E4($EB(1),$EB(2)),evade,evades)] [@IF($E4($EB(1),$EB(3)),your,[@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])]'s)] attack. +30371 Counter! [@2B([@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])])] [@IF($E4($EB(1),$EB(3)),miss,misses)] [@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])]. +30372 Counter! [@2B([@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])])] [@IF($E4($EB(1),$EB(2)),disrupt,disrupts)] [@IF($E4($EB(1),$EB(3)),your,[@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])]'s)] attack. +30373 Counter! [@2B([@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])])] [@IF($E4($EB(1),$EB(3)),hit,hits)] [@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])] for [@VALUE($E8(10))] [@IF($E4($E8(10),1),point,points)] of damage. +30374 Counter! [@2B([@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])])] [@IF($E4($EB(1),$EB(2)),anticipate,anticipates)] [@IF($E4($EB(1),$EB(3)),your,[@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])]'s)] attack. +30375 Counter! [@2B([@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])])] [@IF($E4($EB(1),$EB(3)),hit,hits)] [@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])] [@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])]. +30376 Counter! [@2B([@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])])] [@IF($E4($EB(1),$EB(2)),evade,evades)] [@IF($E4($EB(1),$EB(3)),your,[@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])]'s)] attack, taking [@VALUE($E8(10))] [@IF($E4($E8(10),1),point,points)] of damage. +30377 Counter![@2B([@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])])] partially [@IF($E4($EB(1),$EB(2)),evade,evades)] [@IF($E4($EB(1),$EB(3)),your,[@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])]'s)] attack, taking [@VALUE($E8(10))] [@IF($E4($E8(10),1),point,points)] of damage. +30378 Counter! [@2B([@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])])] slightly [@IF($E4($EB(1),$EB(2)),evade,evades)] [@IF($E4($EB(1),$EB(3)),your,[@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])]'s)] attack, taking [@VALUE($E8(10))] [@IF($E4($E8(10),1),point,points)] of damage. +30379 Counter! [@2B([@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])])] [@IF($E4($EB(1),$EB(3)),hit,hits)] [@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])] for [@VALUE($E8(10))] [@IF($E4($E8(10),1),point,points)] of damage. +30380 Counter! [@2B([@IF($E4($EB(1),$EB(3)),your,[@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])]'s)])] attack causes [@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])] to restores [@VALUE($E8(10))] HP. +30381 Counter! [@2B([@IF($E4($EB(1),$EB(3)),your,[@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])]'s)])] attack causes [@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])] to restores [@VALUE($E8(10))] MP. +30382 Counter! [@2B([@IF($E4($EB(1),$EB(3)),your,[@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])]'s)])] attack causes [@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])] to gain [@VALUE($E8(10))] TP. +30383 Counter! [@2B([@IF($E4($EB(1),$EB(3)),your,[@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])]'s)])] attack causes [@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])] to lose [@VALUE($E8(10))] MP. +30384 Counter! [@2B([@IF($E4($EB(1),$EB(3)),your,[@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])]'s)])] attack causes [@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])] to lose [@VALUE($E8(10))] TP. +30385 [@2B([@IF($E4($EB(1),$EB(3)),your,[@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])]'s)])] TP is now 0. +30386 [@2B([@IF($E4($EB(1),$EB(2)),your,[@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])]'s)])] [@SHEET(xtx/command,$E8(1),3)] removes [@VALUE($E8(10))] [@IF($E4($E8(10),1),status,statuses)] from [@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])]. +30387 [@2B([@IF($E4($EB(1),$EB(2)),your,[@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])]'s)])] [@SHEET(xtx/command,$E8(1),3)] places [@VALUE($E8(10))] [@IF($E4($E8(10),1),status,statuses)] on [@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])]. +30388 [@2B([@IF($E4($EB(1),$EB(2)),your,[@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])]'s)])] [@SHEET(xtx/command,$E8(1),3)] absorbs [@IF($E4($EB(1),$EB(3)),your,[@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])]'s)] [@SHEET(xtx/status,$E8(11),3)]. +30389 [@2B([@IF($E4($EB(1),$EB(2)),your,[@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])]'s)])] [@SHEET(xtx/command,$E8(1),3)] transfers [@SHEET(xtx/status,$E8(11),3)] to [@IF($E4($EB(1),$EB(3)),you,[@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])])]. +30390 [@2B([@IF($E4($EB(1),$EB(2)),your,[@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])]'s)])] [@SHEET(xtx/command,$E8(1),3)] absorbs [@VALUE($E8(10))] of [@IF($E4($EB(1),$EB(3)),your,[@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])]'s)] status effects. +30391 [@2B([@IF($E4($EB(1),$EB(2)),your,[@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])]'s)])] [@SHEET(xtx/command,$E8(1),3)] transfers [@VALUE($E8(10))] status effects to [@IF($E4($EB(1),$EB(3)),you,[@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])])]. +30392 Critical! [@2B([@IF($E4($EB(1),$EB(2)),your,[@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])]'s)])] [@SHEET(xtx/command,$E8(1),3)] hits [@IF($E4($EB(1),$EB(3)),you,[@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])])] for [@VALUE($E8(10))] [@IF($E4($E8(10),1),point,points)] of damage. +30393 [@2B([@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])])] [@IF($E4($E8(10),0),blocks,partially blocks)] [@IF($E4($EB(1),$EB(2)),your,[@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])]'s)] [@SHEET(xtx/command,$E8(1),3)][@IF($E2($E8(12),1),, from the [@SHEET(xtx/text_directName,$E8(12),1)])][@IF($E4($E8(10),0),.,, taking [@VALUE($E8(10))] [@IF($E4($E8(10),1),point,points)] of damage.)] +30394 Counter! [@2B([@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])])] [@IF($E4($E8(10),0),blocks,partially blocks)] [@IF($E4($EB(1),$EB(2)),your,[@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])]'s)] counter[@IF($E4($E8(10),0),.,, taking [@VALUE($E8(10))] [@IF($E4($E8(10),1),point,points)] of damage.)] +30395 [@2B([@IF($E4($EB(1),$EB(2)),your,[@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])]'s)])] [@SHEET(xtx/command,$E8(1),3)] absorbs [@VALUE($E8(10))] HP from [@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])]. +30396 [@2B([@IF($E4($EB(1),$EB(2)),your,[@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])]'s)])] [@SHEET(xtx/command,$E8(1),3)] absorbs [@VALUE($E8(10))] MP from [@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])]. +30397 [@2B([@IF($E4($EB(1),$EB(2)),your,[@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])]'s)])] [@SHEET(xtx/command,$E8(1),3)] absorbs [@VALUE($E8(10))] TP from [@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])]. +30398 [@2B([@IF($E4($EB(1),$EB(2)),your,[@IF($E4($EB(1),$EB(2)),you,[@IF($E9(7),[@SHEETEN(xtx/displayName,2,$E9(7),1,1)],$EB(2))])]'s)])] [@SHEET(xtx/command,$E8(1),3)] reduces [@IF($E4($EB(1),$EB(3)),your,[@IF($E4($EB(1),$EB(3)),you,[@IF($E9(8),[@SHEETEN(xtx/displayName,2,$E9(8),1,1)],$EB(3))])]'s)] TP to 0. diff --git a/sql/characters_hotbar.sql b/sql/characters_hotbar.sql index 8b6a1523..1952ef93 100644 --- a/sql/characters_hotbar.sql +++ b/sql/characters_hotbar.sql @@ -1,8 +1,8 @@ --- MySQL dump 10.13 Distrib 5.7.10, for Win64 (x86_64) +-- MySQL dump 10.13 Distrib 5.7.11, for Win64 (x86_64) -- --- Host: localhost Database: ffxiv_database +-- Host: localhost Database: ffxiv_server -- ------------------------------------------------------ --- Server version 5.7.10-log +-- Server version 5.7.11 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -23,13 +23,12 @@ DROP TABLE IF EXISTS `characters_hotbar`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `characters_hotbar` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `characterId` int(10) unsigned NOT NULL, `classId` smallint(5) unsigned NOT NULL, `hotbarSlot` smallint(5) unsigned NOT NULL, `commandId` int(10) unsigned NOT NULL, - `recastTime` int(10) unsigned DEFAULT NULL, - PRIMARY KEY (`id`) + `recastTime` int(10) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`characterId`,`classId`,`hotbarSlot`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -51,4 +50,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2016-06-07 22:54:46 +-- Dump completed on 2018-02-15 0:04:39 diff --git a/sql/characters_statuseffect.sql b/sql/characters_statuseffect.sql index 4e60bf4c..92564138 100644 --- a/sql/characters_statuseffect.sql +++ b/sql/characters_statuseffect.sql @@ -1,8 +1,8 @@ --- MySQL dump 10.13 Distrib 5.7.10, for Win64 (x86_64) +-- MySQL dump 10.13 Distrib 5.7.11, for Win64 (x86_64) -- --- Host: localhost Database: ffxiv_database +-- Host: localhost Database: ffxiv_server -- ------------------------------------------------------ --- Server version 5.7.10-log +-- Server version 5.7.11 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -23,11 +23,14 @@ DROP TABLE IF EXISTS `characters_statuseffect`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `characters_statuseffect` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `characterId` int(10) unsigned NOT NULL, - `statusId` tinyint(3) unsigned NOT NULL, - `expireTime` int(10) unsigned NOT NULL, - PRIMARY KEY (`id`) + `statusId` mediumint(8) unsigned NOT NULL, + `magnitude` bigint(20) unsigned NOT NULL, + `duration` int(10) unsigned NOT NULL, + `tick` int(10) unsigned NOT NULL, + `tier` tinyint(3) unsigned NOT NULL, + `extra` bigint(20) unsigned NOT NULL, + PRIMARY KEY (`characterId`,`statusId`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -49,4 +52,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2016-06-07 22:54:49 +-- Dump completed on 2018-05-27 17:59:07 diff --git a/sql/export.sh b/sql/export.sh index 9070a4e9..4ac94db3 100644 --- a/sql/export.sh +++ b/sql/export.sh @@ -6,5 +6,5 @@ DBNAME=ffxiv_server for T in `mysqlshow -u $USER -p$PASS $DBNAME %`; do echo "Backing up $T" - mysqldump -u $USER -p$PASS $DBNAME $T --extended-insert=FALSE --no-tablespaces > $EXPORT_PATH/$T.sql + mysqldump -u $USER -p$PASS $DBNAME $T --extended-insert=FALSE --no-tablespaces --no-autocommit > $EXPORT_PATH/$T.sql done; \ No newline at end of file diff --git a/sql/gamedata_actor_class.sql b/sql/gamedata_actor_class.sql index 736a2649..637c2e60 100644 --- a/sql/gamedata_actor_class.sql +++ b/sql/gamedata_actor_class.sql @@ -8,6 +8,7 @@ Date: 9/9/2017 2:32:38 PM */ SET FOREIGN_KEY_CHECKS=0; +SET autocommit=0; -- ---------------------------- -- Table structure for gamedata_actor_class -- ---------------------------- @@ -8007,3 +8008,5 @@ INSERT INTO `gamedata_actor_class` VALUES ('9220405', '', '2', '0', null); INSERT INTO `gamedata_actor_class` VALUES ('9220406', '', '2', '0', null); INSERT INTO `gamedata_actor_class` VALUES ('9220407', '', '2', '0', null); INSERT INTO `gamedata_actor_class` VALUES ('9220408', '', '2', '0', null); + +COMMIT; \ No newline at end of file diff --git a/sql/server_battle_commands.sql b/sql/server_battle_commands.sql new file mode 100644 index 00000000..3dc81887 --- /dev/null +++ b/sql/server_battle_commands.sql @@ -0,0 +1,246 @@ +-- MySQL dump 10.13 Distrib 5.7.11, for Win64 (x86_64) +-- +-- Host: localhost Database: ffxiv_server +-- ------------------------------------------------------ +-- Server version 5.7.11 + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `server_battle_commands` +-- + +DROP TABLE IF EXISTS `server_battle_commands`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `server_battle_commands` ( + `id` smallint(5) unsigned NOT NULL, + `name` varchar(255) NOT NULL, + `classJob` tinyint(3) unsigned NOT NULL, + `lvl` tinyint(3) unsigned NOT NULL, + `requirements` smallint(5) unsigned NOT NULL, + `mainTarget` tinyint(3) unsigned NOT NULL, + `validTarget` tinyint(3) unsigned NOT NULL, + `aoeType` tinyint(3) unsigned NOT NULL, + `aoeRange` float NOT NULL DEFAULT '0', + `aoeMinRange` float NOT NULL DEFAULT '0', + `aoeConeAngle` float NOT NULL DEFAULT '0', + `aoeRotateAngle` float NOT NULL DEFAULT '0', + `aoeTarget` tinyint(3) NOT NULL, + `basePotency` smallint(5) unsigned NOT NULL, + `numHits` tinyint(3) unsigned NOT NULL, + `positionBonus` tinyint(3) unsigned NOT NULL, + `procRequirement` tinyint(3) unsigned NOT NULL, + `range` int(10) unsigned NOT NULL, + `minRange` int(10) unsigned NOT NULL DEFAULT '0', + `bestRange` int(10) unsigned NOT NULL DEFAULT '0', + `rangeHeight` int(10) unsigned NOT NULL DEFAULT '10', + `rangeWidth` int(10) unsigned NOT NULL DEFAULT '2', + `statusId` int(10) NOT NULL, + `statusDuration` int(10) unsigned NOT NULL, + `statusChance` float NOT NULL DEFAULT '0.5', + `castType` tinyint(3) unsigned NOT NULL, + `castTime` int(10) unsigned NOT NULL, + `recastTime` int(10) unsigned NOT NULL, + `mpCost` smallint(5) unsigned NOT NULL, + `tpCost` smallint(5) unsigned NOT NULL, + `animationType` tinyint(3) unsigned NOT NULL, + `effectAnimation` smallint(5) unsigned NOT NULL, + `modelAnimation` smallint(5) unsigned NOT NULL, + `animationDuration` smallint(5) unsigned NOT NULL, + `battleAnimation` int(10) unsigned NOT NULL DEFAULT '0', + `validUser` tinyint(3) unsigned NOT NULL DEFAULT '0', + `comboId1` int(11) NOT NULL DEFAULT '0', + `comboId2` int(11) NOT NULL DEFAULT '0', + `comboStep` tinyint(4) NOT NULL DEFAULT '0', + `accuracyMod` float NOT NULL DEFAULT '1', + `worldMasterTextId` smallint(5) unsigned NOT NULL DEFAULT '0', + `commandType` tinyint(3) unsigned NOT NULL DEFAULT '0', + `actionType` tinyint(3) unsigned NOT NULL DEFAULT '0', + `actionProperty` tinyint(3) unsigned NOT NULL DEFAULT '0', + `isRanged` tinyint(4) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `server_battle_commands` +-- + +LOCK TABLES `server_battle_commands` WRITE; +/*!40000 ALTER TABLE `server_battle_commands` DISABLE KEYS */; +set autocommit=0; +INSERT INTO `server_battle_commands` VALUES (23456,'breath_of_the_lion',0,1,0,1,32,2,12,0,0.5,0,1,100,1,0,0,0,0,0,10,2,0,0,0,11,3500,10,0,0,19,0,1,3,318771200,0,0,0,3,0,30301,2,2,9,1); +INSERT INTO `server_battle_commands` VALUES (23457,'voice_of_the_lion',0,1,0,1,32,3,20,0,0,0,1,100,1,0,0,0,0,0,10,2,0,0,0,11,3500,10,0,0,19,0,2,3,318775296,0,0,0,3,0,30301,2,2,9,1); +INSERT INTO `server_battle_commands` VALUES (23458,'breath_of_the_dragon',0,1,0,1,32,2,12,0,0.666667,0.25,1,100,1,0,0,0,0,0,10,2,0,0,0,11,3500,10,0,0,19,0,3,3,318779392,0,0,0,3,0,30301,2,2,9,1); +INSERT INTO `server_battle_commands` VALUES (23459,'voice_of_the_dragon',0,1,0,1,32,1,22,15,2,0,1,100,1,0,0,0,0,0,10,2,0,0,0,11,3500,10,0,0,19,0,4,3,318783488,0,0,0,3,0,30301,2,2,9,1); +INSERT INTO `server_battle_commands` VALUES (23460,'breath_of_the_ram',0,1,0,1,32,2,12,0,0.666667,-0.25,1,100,1,0,0,0,0,0,10,2,0,0,0,11,3500,10,0,0,19,0,5,3,318787584,0,0,0,3,0,30301,2,2,9,1); +INSERT INTO `server_battle_commands` VALUES (23461,'voice_of_the_ram',0,1,0,1,32,1,10,0,2,0,1,100,1,0,0,0,0,0,10,2,0,0,0,11,3500,10,0,0,19,0,6,3,318791680,0,0,0,3,0,30301,2,2,9,1); +INSERT INTO `server_battle_commands` VALUES (23462,'dissent_of_the_bat',0,1,0,1,32,2,16,0,0.66667,0,1,100,1,0,0,0,0,0,10,2,0,0,0,11,3500,10,0,0,19,0,7,3,318795776,0,0,0,3,0,30301,2,2,9,1); +INSERT INTO `server_battle_commands` VALUES (23463,'chaotic_chorus',0,1,0,1,32,1,16,0,2,0,1,100,1,0,0,0,0,0,10,2,0,0,0,11,3500,10,0,0,19,0,8,3,318799872,0,0,0,3,0,30301,2,2,9,1); +INSERT INTO `server_battle_commands` VALUES (23464,'the_scorpions_sting',0,1,0,1,32,2,12,0,0.5,1,1,100,1,0,0,0,0,0,10,2,0,0,0,11,3500,10,0,0,19,0,9,3,318803968,0,0,0,3,0,30301,2,2,9,1); +INSERT INTO `server_battle_commands` VALUES (27100,'second_wind',2,6,3,1,1,0,0,0,0,0,0,100,1,0,0,0,0,0,10,2,0,0,0,0,0,45,0,0,14,519,2,3,234889735,0,0,0,0,0,30320,3,3,13,0); +INSERT INTO `server_battle_commands` VALUES (27101,'blindside',2,14,3,1,1,0,0,0,0,0,0,100,1,0,0,0,0,0,10,2,223237,60,1,0,0,60,0,0,14,635,2,3,234889851,0,0,0,0,0,30328,3,4,0,0); +INSERT INTO `server_battle_commands` VALUES (27102,'taunt',2,42,4,32,32,0,0,0,0,0,0,100,1,0,0,15,0,0,10,2,223073,5,1,0,0,60,0,0,14,517,2,3,234889733,0,0,0,0,0,30328,3,4,0,0); +INSERT INTO `server_battle_commands` VALUES (27103,'featherfoot',2,2,3,1,1,0,0,0,0,0,0,100,1,0,0,0,0,0,10,2,223075,30,1,0,0,60,0,0,14,535,2,3,234889751,0,0,0,0,0,30328,3,4,0,0); +INSERT INTO `server_battle_commands` VALUES (27104,'fists_of_fire',2,34,4,1,1,0,0,0,0,0,0,100,1,0,0,0,0,0,10,2,223209,4294967295,1,0,0,10,0,0,14,684,2,3,234889900,0,0,0,0,0,30328,3,4,0,0); +INSERT INTO `server_battle_commands` VALUES (27105,'fists_of_earth',2,22,4,1,1,0,0,0,0,0,0,100,1,0,0,0,0,0,10,2,223210,4294967295,1,0,0,10,0,0,14,685,2,3,234889901,0,0,0,0,0,30328,3,4,0,0); +INSERT INTO `server_battle_commands` VALUES (27106,'hundred_fists',15,50,0,1,1,0,0,0,0,0,0,100,1,0,0,0,0,0,10,2,223244,15,1,0,0,900,0,0,14,712,2,3,234889928,0,0,0,0,0,30328,3,4,0,0); +INSERT INTO `server_battle_commands` VALUES (27107,'spinning_heel',15,35,0,1,1,0,0,0,0,0,0,100,1,0,0,0,0,0,10,2,223245,20,1,0,0,120,0,0,14,718,2,3,234889934,0,0,0,0,0,30328,3,4,0,0); +INSERT INTO `server_battle_commands` VALUES (27108,'shoulder_tackle',15,30,0,32,32,0,0,0,0,0,0,100,1,0,0,15,0,0,10,2,223015,10,0.75,0,0,60,0,0,18,1048,205,3,302830616,0,0,0,0,0,30301,3,4,0,0); +INSERT INTO `server_battle_commands` VALUES (27109,'fists_of_wind',15,40,0,1,1,0,0,0,0,0,0,100,1,0,0,0,0,0,10,2,223211,4294967295,1,0,0,10,0,0,14,720,2,3,234889936,0,0,0,0,0,30328,3,4,0,0); +INSERT INTO `server_battle_commands` VALUES (27110,'pummel',2,1,1,32,32,0,0,0,0,0,0,100,1,1,0,5,0,0,10,2,0,0,0,0,0,10,0,1000,18,1027,1,3,301995011,0,27111,27113,1,0,30301,2,1,3,0); +INSERT INTO `server_battle_commands` VALUES (27111,'concussive_blow',2,10,1,32,32,0,0,0,0,0,0,100,1,4,0,5,0,0,10,2,223007,30,0,0,0,30,0,1500,18,20,3,3,302002196,0,27112,0,2,0,30301,2,1,3,0); +INSERT INTO `server_battle_commands` VALUES (27112,'simian_thrash',2,50,4,32,32,0,0,0,0,0,0,100,9,0,0,5,0,0,10,2,0,0,0,0,0,80,0,2000,18,1003,202,3,302818283,0,0,0,3,0,30301,2,1,3,0); +INSERT INTO `server_battle_commands` VALUES (27113,'aura_pulse',2,38,4,32,32,1,8,0,0,0,1,100,1,0,0,5,0,0,10,2,223003,30,0,0,0,40,0,1500,18,66,203,3,302821442,0,0,0,2,0,30301,2,1,3,0); +INSERT INTO `server_battle_commands` VALUES (27114,'pounce',2,4,4,32,32,0,0,0,0,0,0,100,1,2,0,5,0,0,10,2,223015,10,0,0,0,20,0,1500,18,8,3,3,302002184,0,27115,27117,1,0,30301,2,1,3,0); +INSERT INTO `server_battle_commands` VALUES (27115,'demolish',2,30,1,32,32,0,0,0,0,0,0,100,1,0,0,5,0,0,10,2,0,0,0,0,0,30,0,1500,18,1028,2,3,301999108,0,27116,0,2,0,30301,2,1,3,0); +INSERT INTO `server_battle_commands` VALUES (27116,'howling_fist',2,46,4,32,32,0,0,0,0,0,0,100,1,4,0,5,0,0,10,2,0,0,0,0,0,80,0,3000,18,1029,2,3,301999109,0,0,0,3,0,30301,2,1,3,0); +INSERT INTO `server_battle_commands` VALUES (27117,'sucker_punch',2,26,1,32,32,0,0,0,0,0,0,100,1,4,0,5,0,0,10,2,0,0,0,0,0,15,0,1000,18,73,3,3,302002249,0,0,0,3,0,30301,2,1,3,0); +INSERT INTO `server_battle_commands` VALUES (27118,'dragon_kick',15,45,0,32,32,0,0,0,0,0,0,100,1,0,0,5,0,0,10,2,223013,10,0,0,0,60,0,2000,18,1041,204,3,302826513,0,0,0,0,0,30301,2,1,3,0); +INSERT INTO `server_battle_commands` VALUES (27119,'haymaker',2,18,4,32,32,0,0,0,0,0,0,100,1,0,2,5,0,0,10,2,223015,10,0.75,0,0,5,0,250,18,23,201,3,302813207,0,0,0,0,0,30301,2,1,3,0); +INSERT INTO `server_battle_commands` VALUES (27140,'sentinel',3,22,3,1,1,0,0,0,0,0,0,100,1,0,0,0,0,0,10,2,223062,15,1,0,0,90,0,0,14,526,2,3,234889742,0,0,0,0,0,30328,3,4,0,0); +INSERT INTO `server_battle_commands` VALUES (27141,'aegis_boon',3,6,8,1,1,0,0,0,0,0,0,100,1,0,0,0,0,0,10,2,223058,30,1,0,0,60,0,0,14,583,21,3,234967623,0,0,0,0,0,30328,3,4,0,0); +INSERT INTO `server_battle_commands` VALUES (27142,'rampart',3,2,3,1,5,0,8,0,0,0,1,100,1,0,0,0,0,0,10,2,223064,60,1,0,0,120,0,0,14,536,2,3,234889752,0,0,0,0,0,30328,3,4,0,0); +INSERT INTO `server_battle_commands` VALUES (27143,'tempered_will',3,42,8,1,1,0,0,0,0,0,0,100,1,0,0,0,0,0,10,2,223068,20,1,0,0,180,0,0,14,515,2,3,234889731,0,0,0,0,0,30328,3,4,0,0); +INSERT INTO `server_battle_commands` VALUES (27144,'outmaneuver',3,34,8,1,1,0,0,0,0,0,0,100,1,0,0,0,0,0,10,2,223236,30,1,0,0,90,0,0,14,512,21,3,234967552,0,0,0,0,0,30328,3,4,0,0); +INSERT INTO `server_battle_commands` VALUES (27145,'flash',3,14,3,32,32,0,8,0,0,0,0,100,1,0,0,15,0,0,10,2,223007,10,0,0,0,30,0,0,14,696,2,3,234889912,0,0,0,0,0,30101,3,4,0,0); +INSERT INTO `server_battle_commands` VALUES (27146,'cover',16,30,0,12,12,0,0,0,0,0,0,100,1,0,0,15,0,0,10,2,223173,15,1,0,0,60,0,0,14,725,2,3,234889941,0,0,0,0,0,30328,3,4,0,0); +INSERT INTO `server_battle_commands` VALUES (27147,'divine_veil',16,35,0,1,1,0,0,0,0,0,0,100,1,0,0,0,0,0,10,2,223248,20,1,0,0,60,0,0,14,713,2,3,234889929,0,0,0,0,0,30328,3,4,0,0); +INSERT INTO `server_battle_commands` VALUES (27148,'hallowed_ground',16,50,0,1,1,0,0,0,0,0,0,100,1,0,0,0,0,0,10,2,223249,20,1,0,0,900,0,0,14,709,2,3,234889925,0,0,0,0,0,30328,3,4,0,0); +INSERT INTO `server_battle_commands` VALUES (27149,'holy_succor',16,40,0,9,9,0,0,0,0,0,0,100,1,0,0,15,0,0,10,2,0,0,0,3,2000,10,100,0,1,701,1,3,16782013,0,0,0,0,0,30328,3,3,13,0); +INSERT INTO `server_battle_commands` VALUES (27150,'fast_blade',3,1,1,32,32,0,0,0,0,0,0,100,1,1,0,5,0,0,10,2,0,0,0,0,0,10,0,1000,18,1023,1,3,301995007,0,27151,27152,1,0,30301,2,1,1,0); +INSERT INTO `server_battle_commands` VALUES (27151,'flat_blade',3,26,1,32,32,0,0,0,0,0,0,100,1,0,0,5,0,0,10,2,0,0,0,0,0,10,0,1500,18,1024,2,3,301999104,0,0,0,2,0,30301,2,1,1,0); +INSERT INTO `server_battle_commands` VALUES (27152,'savage_blade',3,10,1,32,32,0,0,0,0,0,0,100,1,0,0,5,0,0,10,2,0,0,0,0,0,30,0,1000,18,1025,1,3,301995009,0,27153,0,2,0,30301,2,1,1,0); +INSERT INTO `server_battle_commands` VALUES (27153,'goring_blade',3,50,8,32,32,0,0,0,0,0,0,100,1,2,0,5,0,0,10,2,223206,30,0,0,0,60,0,3000,18,1026,301,3,303223810,0,0,0,3,0,30301,2,1,1,0); +INSERT INTO `server_battle_commands` VALUES (27154,'riot_blade',3,30,8,32,32,0,0,0,0,0,0,100,1,2,0,15,0,0,10,2,223038,30,0,0,0,80,0,2000,18,75,2,3,301998155,0,27155,0,1,0,30301,2,1,1,1); +INSERT INTO `server_battle_commands` VALUES (27155,'rage_of_halone',3,46,8,32,32,0,0,0,0,0,0,100,5,0,0,5,0,0,10,2,0,0,0,0,0,20,0,1500,18,1008,302,3,303227888,0,0,0,2,-40,30301,2,1,1,0); +INSERT INTO `server_battle_commands` VALUES (27156,'shield_bash',3,18,17,32,32,0,0,0,0,0,0,100,1,0,0,5,0,0,10,2,223015,5,0.75,0,0,30,0,250,18,5,26,3,302096389,0,0,0,0,0,30301,2,1,1,0); +INSERT INTO `server_battle_commands` VALUES (27157,'war_drum',3,38,24,32,32,1,8,0,0,0,1,100,1,0,4,5,0,0,10,2,0,0,0,0,0,60,0,500,14,502,21,3,234967542,0,0,0,0,0,30301,2,1,1,0); +INSERT INTO `server_battle_commands` VALUES (27158,'phalanx',3,4,8,32,32,0,0,0,0,0,0,100,1,0,4,5,0,0,10,2,0,0,0,0,0,5,0,250,18,32,1,3,301994016,0,27159,0,1,0,30301,2,1,1,0); +INSERT INTO `server_battle_commands` VALUES (27159,'spirits_within',16,45,0,32,32,0,0,0,0,0,0,100,1,0,0,5,0,0,10,2,0,0,0,0,0,60,0,3000,18,1044,304,3,303236116,0,0,0,2,50,30301,2,1,1,0); +INSERT INTO `server_battle_commands` VALUES (27180,'provoke',4,14,3,32,32,0,0,0,0,0,0,100,1,0,0,15,0,0,10,2,223034,30,0,0,0,30,0,0,14,600,2,3,234889816,0,0,0,0,0,30101,3,4,0,0); +INSERT INTO `server_battle_commands` VALUES (27181,'foresight',4,2,3,1,1,0,0,0,0,0,0,100,1,0,0,0,0,0,10,2,223083,30,1,0,0,60,0,0,14,545,2,3,234889761,0,0,0,0,0,30328,3,4,0,0); +INSERT INTO `server_battle_commands` VALUES (27182,'bloodbath',4,6,3,1,1,0,0,0,0,0,0,100,1,0,0,0,0,0,10,2,223081,30,1,0,0,60,0,0,14,581,2,3,234889797,0,0,0,0,0,30328,3,4,0,0); +INSERT INTO `server_battle_commands` VALUES (27183,'berserk',4,22,32,1,1,0,0,0,0,0,0,100,1,0,0,0,0,0,10,2,223207,4294967295,1,0,0,10,0,0,14,682,2,3,234889898,0,0,0,0,0,30328,3,4,0,0); +INSERT INTO `server_battle_commands` VALUES (27184,'rampage',4,34,32,1,1,0,0,0,0,0,0,100,1,0,0,0,0,0,10,2,223208,4294967295,1,0,0,10,0,0,14,546,2,3,234889762,0,0,0,0,0,30328,3,4,0,0); +INSERT INTO `server_battle_commands` VALUES (27185,'enduring_march',4,42,32,1,1,0,0,0,0,0,0,100,1,0,0,0,0,0,10,2,223078,20,1,0,0,180,0,0,14,539,2,3,234889755,0,0,0,0,0,30328,3,4,0,0); +INSERT INTO `server_battle_commands` VALUES (27186,'vengeance',17,30,0,1,1,0,0,0,0,0,0,100,1,0,0,0,0,0,10,2,223250,15,1,0,0,150,0,0,14,714,2,3,234889930,0,0,0,0,0,30328,3,4,0,0); +INSERT INTO `server_battle_commands` VALUES (27187,'antagonize',17,35,0,1,1,0,0,0,0,0,0,100,1,0,0,0,0,0,10,2,223251,15,1,0,0,120,0,0,14,715,2,3,234889931,0,0,0,0,0,30328,3,4,0,0); +INSERT INTO `server_battle_commands` VALUES (27188,'collusion',17,40,0,12,12,0,0,0,0,0,0,100,1,0,0,15,0,0,10,2,223097,15,1,0,0,90,0,0,14,711,2,3,234889927,0,0,0,0,0,30328,3,4,0,0); +INSERT INTO `server_battle_commands` VALUES (27189,'mighty_strikes',17,50,0,1,1,0,0,0,0,0,0,100,1,0,0,0,0,0,10,2,223252,15,1,0,0,900,0,0,14,716,2,3,234889932,0,0,0,0,0,30328,3,4,0,0); +INSERT INTO `server_battle_commands` VALUES (27190,'heavy_swing',4,1,1,32,32,0,0,0,0,0,0,100,1,1,0,5,0,0,10,2,0,0,0,0,0,10,0,1000,18,14,1,3,301993998,0,27191,0,1,0,30301,2,1,1,0); +INSERT INTO `server_battle_commands` VALUES (27191,'skull_sunder',4,10,1,32,32,0,0,0,0,0,0,100,1,0,0,5,0,0,10,2,0,0,0,0,0,30,0,1500,18,43,1,3,301994027,0,27192,0,2,0,30301,2,1,1,0); +INSERT INTO `server_battle_commands` VALUES (27192,'steel_cyclone',17,45,0,32,32,1,8,0,0,0,1,100,1,0,0,5,0,0,10,2,223015,3,0,0,0,30,0,2000,18,1040,404,3,303645712,0,0,0,3,0,30301,2,1,1,0); +INSERT INTO `server_battle_commands` VALUES (27193,'brutal_swing',4,4,1,32,32,0,0,0,0,0,0,100,1,4,0,5,0,0,10,2,0,0,0,0,0,20,0,1500,18,15,3,3,302002191,0,27194,0,1,0,30301,2,1,1,0); +INSERT INTO `server_battle_commands` VALUES (27194,'maim',4,26,1,32,32,0,0,0,0,0,0,100,1,0,0,5,0,0,10,2,0,0,0,0,0,30,0,1500,18,88,1,3,301994072,0,27195,0,2,0,30301,2,1,1,0); +INSERT INTO `server_battle_commands` VALUES (27195,'godsbane',4,50,32,32,32,0,0,0,0,0,0,100,3,0,0,5,0,0,10,2,0,0,0,0,0,60,0,3000,18,1014,402,3,303637494,0,0,0,3,0,30301,2,1,1,0); +INSERT INTO `server_battle_commands` VALUES (27196,'path_of_the_storm',4,38,32,32,32,0,0,0,0,0,0,100,1,2,0,5,0,0,10,2,228021,30,0,0,0,30,0,1500,18,44,401,3,303632428,0,27197,0,1,0,30301,2,1,1,0); +INSERT INTO `server_battle_commands` VALUES (27197,'whirlwind',4,46,32,32,32,1,8,0,0,0,1,100,1,0,0,5,0,0,10,2,0,0,0,0,0,80,0,3000,18,1015,403,3,303641591,0,0,0,2,0,30301,2,1,1,0); +INSERT INTO `server_battle_commands` VALUES (27198,'fracture',4,18,32,32,32,0,0,0,0,0,0,100,1,0,3,5,0,0,10,2,223013,8,0.75,0,0,40,0,500,18,42,3,3,302002218,0,0,0,0,0,30301,2,1,1,0); +INSERT INTO `server_battle_commands` VALUES (27199,'overpower',4,30,1,32,32,2,8,0,0.5,0,1,100,1,0,3,8,0,0,10,2,0,0,0,0,0,5,0,250,18,89,1,3,301994073,0,0,0,0,0,30301,2,1,1,0); +INSERT INTO `server_battle_commands` VALUES (27220,'hawks_eye',7,6,3,1,1,0,0,0,0,0,0,100,1,0,0,0,0,0,10,2,223106,15,1,0,0,90,0,0,14,516,2,3,234889732,0,0,0,0,0,30328,3,4,0,0); +INSERT INTO `server_battle_commands` VALUES (27221,'quelling_strike',7,22,3,1,1,0,0,0,0,0,0,100,1,0,0,0,0,0,10,2,223104,30,1,0,0,60,0,0,14,614,2,3,234889830,0,0,0,0,0,30328,3,4,0,0); +INSERT INTO `server_battle_commands` VALUES (27222,'decoy',7,2,3,1,1,0,0,0,0,0,0,100,1,0,0,0,0,0,10,2,223108,60,1,0,0,90,100,0,14,565,2,3,234889781,0,0,0,0,0,30328,3,4,0,0); +INSERT INTO `server_battle_commands` VALUES (27223,'chameleon',7,42,3,1,1,0,0,0,0,0,0,100,1,0,0,0,0,0,10,2,0,0,0,0,0,180,0,0,14,504,2,3,234889720,0,0,0,0,0,30328,3,4,0,0); +INSERT INTO `server_battle_commands` VALUES (27224,'barrage',7,34,64,1,1,0,0,0,0,0,0,100,1,0,0,0,0,0,10,2,223220,60,1,0,0,90,0,0,14,683,2,3,234889899,0,0,0,0,0,30328,3,4,0,0); +INSERT INTO `server_battle_commands` VALUES (27225,'raging_strike',7,14,64,1,1,0,0,0,0,0,0,100,1,0,0,0,0,0,10,2,223221,4294967295,1,0,0,10,0,0,14,632,2,3,234889848,0,0,0,0,0,30328,3,4,0,0); +INSERT INTO `server_battle_commands` VALUES (27226,'swiftsong',7,26,64,1,5,1,20,0,0,0,1,100,1,0,0,0,0,0,10,2,223224,180,1,0,0,10,100,0,1,150,1,3,16781462,0,0,0,0,0,30328,3,4,0,0); +INSERT INTO `server_battle_commands` VALUES (27227,'battle_voice',18,50,0,1,5,1,20,0,0,0,1,100,1,0,0,0,0,0,10,2,223029,60,1,0,0,900,0,0,14,721,2,3,234889937,0,0,0,0,0,30328,3,4,0,0); +INSERT INTO `server_battle_commands` VALUES (27228,'heavy_shot',7,1,1,32,32,0,0,0,0,0,0,100,1,0,0,20,0,8,10,2,0,0,0,0,0,10,0,1000,18,1036,4,3,302007308,0,27229,27231,1,0,30301,2,1,4,1); +INSERT INTO `server_battle_commands` VALUES (27229,'leaden_arrow',7,10,1,32,32,0,0,0,0,0,0,100,1,0,0,20,0,0,10,2,228021,30,0.75,0,0,30,0,1500,18,1035,4,3,302007307,0,27230,0,2,0,30301,2,1,4,1); +INSERT INTO `server_battle_commands` VALUES (27230,'wide_volley',7,50,64,32,32,1,8,0,0,0,0,100,1,0,0,20,0,0,10,2,0,0,0,0,0,80,0,2000,18,18,703,3,304869394,0,0,0,3,-20,30301,2,1,4,1); +INSERT INTO `server_battle_commands` VALUES (27231,'quick_nock',7,38,64,32,32,2,10,0,0.5,0,1,100,1,0,0,10,0,0,10,2,0,0,0,0,0,180,0,1000,18,1017,702,3,304866297,0,27232,0,2,0,30301,2,1,4,1); +INSERT INTO `server_battle_commands` VALUES (27232,'rain_of_death',18,45,0,32,32,1,8,0,0,0,0,100,1,0,0,20,0,0,10,2,223015,5,0.75,0,0,30,0,3000,18,1037,704,3,304874509,0,0,0,3,0,30301,2,1,4,1); +INSERT INTO `server_battle_commands` VALUES (27233,'piercing_arrow',7,4,1,32,32,0,0,0,0,0,0,100,1,0,0,20,0,8,10,2,0,0,0,0,0,20,0,1000,18,1038,1,3,301995022,0,27234,27236,1,0,30301,2,1,4,1); +INSERT INTO `server_battle_commands` VALUES (27234,'gloom_arrow',7,30,1,32,32,0,0,0,0,0,0,100,1,0,0,20,0,0,10,2,223007,30,0,0,0,10,0,1000,18,1039,4,3,302007311,0,27235,0,2,0,30301,2,1,4,1); +INSERT INTO `server_battle_commands` VALUES (27235,'bloodletter',7,46,64,32,32,0,0,0,0,0,0,100,1,0,0,20,0,0,10,2,223241,30,0.75,0,0,80,0,1500,18,53,701,3,304861237,0,0,0,3,0,30301,2,1,4,1); +INSERT INTO `server_battle_commands` VALUES (27236,'shadowbind',7,18,64,32,32,0,0,0,0,0,0,100,1,0,0,20,0,0,10,2,228011,15,0.9,0,0,40,0,250,18,17,4,3,302006289,0,0,0,2,0,30301,2,1,4,1); +INSERT INTO `server_battle_commands` VALUES (27237,'ballad_of_magi',18,30,0,1,5,1,20,0,0,0,1,100,1,0,0,0,0,0,10,2,223254,180,1,8,3000,10,100,0,1,709,1,3,16782021,0,0,0,0,0,30328,3,4,0,0); +INSERT INTO `server_battle_commands` VALUES (27238,'paeon_of_war',18,40,0,1,5,1,20,0,0,0,1,100,1,0,0,0,0,0,10,2,223255,180,1,8,3000,10,50,1000,1,710,1,3,16782022,0,0,0,0,0,30328,3,4,0,0); +INSERT INTO `server_battle_commands` VALUES (27239,'minuet_of_rigor',18,35,0,1,5,1,20,0,0,0,1,100,1,0,0,0,0,0,10,2,223256,180,1,8,3000,10,100,0,1,711,1,3,16782023,0,0,0,0,0,30328,3,4,0,0); +INSERT INTO `server_battle_commands` VALUES (27258,'refill',7,1,0,1,1,0,0,0,0,0,0,100,1,0,0,0,0,0,10,2,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,32613,3,0,0,0); +INSERT INTO `server_battle_commands` VALUES (27259,'light_shot',7,1,0,32,32,0,0,0,0,0,0,100,1,0,0,20,0,0,10,2,0,0,0,0,0,0,0,0,17,0,1,3,285216768,0,0,0,0,0,30301,3,1,0,1); +INSERT INTO `server_battle_commands` VALUES (27260,'invigorate',8,14,3,1,1,0,0,0,0,0,0,100,1,0,0,0,0,0,10,2,223094,30,1,0,0,90,0,0,14,575,2,3,234889791,0,0,0,0,0,30328,3,4,0,0); +INSERT INTO `server_battle_commands` VALUES (27261,'power_surge',8,34,128,1,1,0,0,0,0,0,0,100,1,0,0,0,0,0,10,2,223212,60,1,0,0,10,0,0,14,686,2,3,234889902,0,0,0,0,0,30328,3,4,0,0); +INSERT INTO `server_battle_commands` VALUES (27262,'life_surge',8,22,128,1,1,0,0,0,0,0,0,100,1,0,0,0,0,0,10,2,223215,180,1,0,0,15,0,250,14,687,2,3,234889903,0,0,0,0,0,30328,3,4,0,0); +INSERT INTO `server_battle_commands` VALUES (27263,'dread_spike',8,42,128,1,1,0,0,0,0,0,0,100,1,0,0,0,0,0,10,2,223218,30,1,0,0,120,0,0,14,686,2,3,234889902,0,0,0,0,0,30328,3,4,0,0); +INSERT INTO `server_battle_commands` VALUES (27264,'blood_for_blood',8,6,3,1,1,0,0,0,0,0,0,100,1,0,0,0,0,0,10,2,223219,60,1,0,0,60,0,0,14,689,2,3,234889905,0,0,0,0,0,30328,3,4,0,0); +INSERT INTO `server_battle_commands` VALUES (27265,'keen_flurry',8,26,3,1,1,0,0,0,0,0,0,100,1,0,0,0,0,0,10,2,223091,30,1,0,0,90,0,0,14,569,2,3,234889785,0,0,0,0,0,30328,3,4,0,0); +INSERT INTO `server_battle_commands` VALUES (27266,'jump',19,30,0,32,32,0,0,0,0,0,0,100,1,0,0,20,0,0,10,2,0,0,0,0,0,60,0,0,18,1045,804,3,305284117,0,0,0,0,0,30301,3,1,2,0); +INSERT INTO `server_battle_commands` VALUES (27267,'elusive_jump',19,40,0,1,1,0,0,0,0,0,0,100,1,0,0,0,0,0,10,2,0,0,0,0,0,180,0,0,18,1046,806,3,305292310,0,0,0,0,0,30101,3,0,0,0); +INSERT INTO `server_battle_commands` VALUES (27268,'dragonfire_dive',19,50,0,32,32,1,4,0,0,0,0,100,1,0,0,20,0,0,10,2,0,0,0,0,0,900,0,0,18,1045,804,3,305284117,0,0,0,0,0,30301,3,2,5,0); +INSERT INTO `server_battle_commands` VALUES (27269,'true_thrust',8,1,1,32,32,0,0,0,0,0,0,100,1,1,0,5,0,0,10,2,0,0,0,0,0,10,0,1000,18,1030,2,3,301999110,0,27270,27273,1,0,30301,2,1,2,0); +INSERT INTO `server_battle_commands` VALUES (27270,'leg_sweep',8,30,1,32,32,2,8,0,0.5,0,1,100,1,0,0,5,0,0,10,2,223015,8,0,0,0,30,0,1000,18,37,1,3,301994021,0,27271,0,2,0,30301,2,1,2,0); +INSERT INTO `server_battle_commands` VALUES (27271,'doom_spike',8,46,128,32,32,3,5,0,0,0,1,100,1,0,0,5,0,0,10,2,0,0,0,0,0,60,0,3000,18,83,801,3,305270867,0,0,0,3,0,30301,2,1,2,0); +INSERT INTO `server_battle_commands` VALUES (27272,'disembowel',19,35,0,32,32,0,0,0,0,0,0,100,1,0,0,5,0,0,10,2,223005,15,0.75,0,0,30,0,750,18,1042,2,3,301999122,0,0,0,0,0,30301,2,1,2,0); +INSERT INTO `server_battle_commands` VALUES (27273,'heavy_thrust',8,10,1,32,32,0,0,0,0,0,0,100,1,0,0,5,0,0,10,2,223015,4,0.75,0,0,20,0,1500,18,1031,1,3,301995015,0,0,0,0,0,30301,2,1,2,0); +INSERT INTO `server_battle_commands` VALUES (27274,'vorpal_thrust',8,2,1,32,32,0,0,0,0,0,0,100,1,2,0,5,0,0,10,2,0,0,0,0,0,20,0,1500,18,1032,2,3,301999112,0,27275,0,1,0,30301,2,1,2,0); +INSERT INTO `server_battle_commands` VALUES (27275,'impulse_drive',8,18,1,32,32,0,0,0,0,0,0,100,1,4,0,5,0,0,10,2,0,0,0,0,0,30,0,1500,18,1033,2,3,301999113,0,27276,27277,2,0,30301,2,1,2,0); +INSERT INTO `server_battle_commands` VALUES (27276,'chaos_thrust',8,50,128,32,32,0,0,0,0,0,0,100,6,0,0,5,0,0,10,2,0,0,0,0,0,80,0,3000,18,40,802,3,305274920,0,0,0,3,0,30301,2,1,2,0); +INSERT INTO `server_battle_commands` VALUES (27277,'ring_of_talons',19,45,0,32,32,1,8,0,0,0,1,100,1,0,0,5,0,0,10,2,0,0,0,0,0,60,0,2000,18,1009,803,3,305279985,0,0,0,3,0,30301,2,1,2,0); +INSERT INTO `server_battle_commands` VALUES (27278,'feint',8,4,1,32,32,0,0,0,0,0,0,100,1,0,1,5,0,0,10,2,0,0,0,0,0,10,0,250,18,39,2,3,301998119,0,27272,0,1,100,30301,2,1,2,0); +INSERT INTO `server_battle_commands` VALUES (27279,'full_thrust',8,38,128,32,32,0,0,0,0,0,0,100,1,0,1,5,0,0,10,2,0,0,0,0,0,30,0,250,18,1034,801,3,305271818,0,0,0,0,50,30301,2,1,2,0); +INSERT INTO `server_battle_commands` VALUES (27300,'dark_seal',22,14,3,1,1,0,0,0,0,0,0,100,1,0,0,0,0,0,10,2,223229,30,1,0,0,90,0,0,14,518,2,3,234889734,0,0,0,0,0,30328,3,4,0,0); +INSERT INTO `server_battle_commands` VALUES (27301,'resonance',22,22,3,1,1,0,0,0,0,0,0,100,1,0,0,0,0,0,10,2,223230,30,1,0,0,90,0,0,14,669,2,3,234889885,0,0,0,0,0,30328,3,4,0,0); +INSERT INTO `server_battle_commands` VALUES (27302,'excruciate',22,38,256,1,1,0,0,0,0,0,0,100,1,0,0,0,0,0,10,2,223231,30,1,0,0,90,0,0,14,694,2,3,234889910,0,0,0,0,0,30328,3,4,0,0); +INSERT INTO `server_battle_commands` VALUES (27303,'necrogenesis',22,6,3,1,1,0,0,0,0,0,0,100,1,0,0,0,0,0,10,2,223232,30,1,0,0,90,0,0,14,695,2,3,234889911,0,0,0,0,0,30328,3,4,0,0); +INSERT INTO `server_battle_commands` VALUES (27304,'parsimony',22,2,256,1,1,0,0,0,0,0,0,100,1,0,0,0,0,0,10,2,223233,30,1,0,0,90,0,0,14,568,2,3,234889784,0,0,0,0,0,30328,3,4,0,0); +INSERT INTO `server_battle_commands` VALUES (27305,'convert',26,30,0,1,1,0,0,0,0,0,0,100,1,0,0,0,0,0,10,2,0,0,0,0,0,450,0,0,14,724,2,3,234889940,0,0,0,0,0,30101,3,0,0,0); +INSERT INTO `server_battle_commands` VALUES (27306,'sleep',22,42,256,32,32,0,0,0,0,0,0,100,1,0,0,20,0,0,10,2,228001,60,0.9,2,3000,0,75,0,1,651,1,3,16781963,0,0,0,0,0,30328,4,4,12,0); +INSERT INTO `server_battle_commands` VALUES (27307,'sanguine_rite',22,30,3,1,1,0,0,0,0,0,0,100,1,0,0,0,0,0,10,2,223234,20,1,0,0,60,120,0,1,152,1,3,16781464,0,0,0,0,0,30328,4,4,0,0); +INSERT INTO `server_battle_commands` VALUES (27308,'blizzard',22,4,256,32,32,0,0,0,0,0,0,100,1,0,0,20,0,0,10,2,228021,30,0.75,2,3000,10,90,0,1,502,1,3,16781814,0,0,0,0,0,30301,4,2,6,0); +INSERT INTO `server_battle_commands` VALUES (27309,'blizzara',22,26,256,32,32,1,8,0,0,0,0,100,1,0,0,20,0,0,10,2,228011,30,0.75,0,0,40,150,0,1,506,1,3,16781818,0,0,0,0,0,30301,4,2,6,0); +INSERT INTO `server_battle_commands` VALUES (27310,'fire',22,10,3,32,32,1,8,0,0,0,0,100,1,0,0,20,0,0,10,2,0,0,0,2,3000,8,105,0,1,501,1,3,16781813,0,27311,0,1,0,30301,4,2,5,0); +INSERT INTO `server_battle_commands` VALUES (27311,'fira',22,34,3,32,32,1,8,0,0,0,0,100,1,0,0,20,0,0,10,2,0,0,0,2,5000,16,180,0,1,504,1,3,16781816,0,27312,0,2,0,30301,4,2,5,0); +INSERT INTO `server_battle_commands` VALUES (27312,'firaga',22,50,256,32,32,1,8,0,0,0,0,100,1,0,0,20,0,0,10,2,0,0,0,2,8000,7,255,0,1,700,1,3,16782012,0,0,0,3,0,30301,4,2,5,0); +INSERT INTO `server_battle_commands` VALUES (27313,'thunder',22,1,3,32,32,0,0,0,0,0,0,100,1,0,0,20,0,0,10,2,0,0,0,2,2000,6,75,0,1,503,1,3,16781815,0,27314,0,1,0,30301,4,2,9,0); +INSERT INTO `server_battle_commands` VALUES (27314,'thundara',22,18,256,32,32,0,0,0,0,0,0,100,1,0,0,20,0,0,10,2,223015,4,0.75,0,0,30,135,0,1,508,1,3,16781820,0,27315,27316,2,0,30301,4,2,9,0); +INSERT INTO `server_battle_commands` VALUES (27315,'thundaga',22,46,256,32,32,0,0,0,0,0,0,100,1,0,0,20,0,0,10,2,0,0,0,2,5000,45,195,0,1,509,1,3,16781821,0,0,0,3,0,30301,4,2,9,0); +INSERT INTO `server_battle_commands` VALUES (27316,'burst',26,50,0,32,32,0,0,0,0,0,0,100,1,0,0,20,0,0,10,2,0,0,0,2,4000,900,90,0,1,705,1,3,16782017,0,0,0,3,0,30301,4,2,9,0); +INSERT INTO `server_battle_commands` VALUES (27317,'sleepga',26,45,0,32,32,1,8,0,0,0,0,100,1,0,0,20,0,0,10,2,228001,60,0.9,2,4000,0,100,0,1,704,1,3,16782016,0,0,0,0,0,30328,4,4,12,0); +INSERT INTO `server_battle_commands` VALUES (27318,'flare',26,40,0,1,32,1,8,0,0,0,1,100,1,0,0,20,0,0,10,2,223262,30,0.75,2,8000,120,200,0,1,706,1,3,16782018,0,0,0,0,0,30301,4,2,5,0); +INSERT INTO `server_battle_commands` VALUES (27319,'freeze',26,35,0,32,32,0,0,0,0,0,0,100,1,0,0,20,0,0,10,2,0,0,0,2,5000,120,120,0,1,707,1,3,16782019,0,0,0,0,0,30301,4,2,6,0); +INSERT INTO `server_battle_commands` VALUES (27340,'sacred_prism',23,34,3,1,1,0,0,0,0,0,0,100,1,0,0,0,0,0,10,2,223225,60,1,0,0,90,0,0,14,690,2,3,234889906,0,0,0,0,0,30328,3,4,0,0); +INSERT INTO `server_battle_commands` VALUES (27341,'shroud_of_saints',23,38,512,1,1,0,0,0,0,0,0,100,1,0,0,0,0,0,10,2,223226,20,1,0,0,180,0,0,14,691,2,3,234889907,0,0,0,0,0,30328,3,4,0,0); +INSERT INTO `server_battle_commands` VALUES (27342,'cleric_stance',23,10,512,1,1,0,0,0,0,0,0,100,1,0,0,0,0,0,10,2,223227,4294967295,1,0,0,30,0,0,14,692,2,3,234889908,0,0,0,0,0,30328,3,4,0,0); +INSERT INTO `server_battle_commands` VALUES (27343,'blissful_mind',23,14,512,1,1,0,0,0,0,0,0,100,1,0,0,0,0,0,10,2,223228,4294967295,1,0,0,30,0,0,14,693,2,3,234889909,0,0,0,0,0,30328,3,4,0,0); +INSERT INTO `server_battle_commands` VALUES (27344,'presence_of_mind',27,30,0,1,1,0,0,0,0,0,0,100,1,0,0,0,0,0,10,2,223116,30,1,0,0,300,0,0,14,722,2,3,234889938,0,0,0,0,0,30328,3,4,0,0); +INSERT INTO `server_battle_commands` VALUES (27345,'benediction',27,50,0,1,5,1,20,0,0,0,1,100,1,0,0,0,0,0,10,2,0,0,0,0,0,900,0,0,14,723,2,3,234889939,0,0,0,0,0,30320,3,3,13,0); +INSERT INTO `server_battle_commands` VALUES (27346,'cure',23,2,3,9,9,0,0,0,0,0,0,100,1,0,0,20,0,0,10,2,0,0,0,3,2000,5,40,0,1,101,1,3,16781413,0,0,0,0,0,30320,4,3,13,0); +INSERT INTO `server_battle_commands` VALUES (27347,'cura',23,30,512,9,9,0,0,0,0,0,0,100,1,0,0,20,0,0,10,2,0,0,0,3,2000,5,100,0,1,103,1,3,16781415,0,0,0,0,0,30320,4,3,13,0); +INSERT INTO `server_battle_commands` VALUES (27348,'curaga',23,46,512,5,5,1,15,0,0,0,0,100,1,0,0,20,0,0,10,2,0,0,0,3,3000,10,150,0,1,146,1,3,16781458,0,0,0,0,0,30320,4,3,13,0); +INSERT INTO `server_battle_commands` VALUES (27349,'raise',23,18,512,130,130,0,0,0,0,0,0,100,1,0,0,20,0,0,10,2,0,0,0,3,10000,300,150,0,1,148,1,3,16781460,0,0,0,0,0,30101,4,4,11,0); +INSERT INTO `server_battle_commands` VALUES (27350,'stoneskin',23,26,3,9,9,0,0,0,0,0,0,100,1,0,0,20,0,0,10,2,223133,300,1,3,3000,30,50,0,1,133,1,3,16781445,0,0,0,0,0,30328,4,4,8,0); +INSERT INTO `server_battle_commands` VALUES (27351,'protect',23,6,3,5,5,1,20,0,0,0,0,100,1,0,0,20,0,0,10,2,223129,300,1,3,3000,30,80,0,1,1085,1,3,16782397,0,0,0,0,0,30328,4,4,11,0); +INSERT INTO `server_battle_commands` VALUES (27352,'repose',23,50,0,32,32,0,0,0,0,0,0,100,1,0,0,20,0,0,10,2,228001,60,0.9,3,3000,0,80,0,1,151,1,3,16781463,0,0,0,0,0,30328,4,4,10,0); +INSERT INTO `server_battle_commands` VALUES (27353,'aero',23,4,3,32,32,0,0,0,0,0,0,100,1,0,0,20,0,0,10,2,223235,20,0.75,3,3000,6,75,0,1,510,1,3,16781822,0,27354,0,1,0,30301,4,2,7,0); +INSERT INTO `server_battle_commands` VALUES (27354,'aerora',23,42,512,32,32,1,0,0,0,0,0,100,1,0,0,20,0,0,10,2,0,0,0,3,4000,20,150,0,1,511,1,3,16781823,0,0,0,2,0,30301,4,2,7,0); +INSERT INTO `server_battle_commands` VALUES (27355,'stone',23,1,3,32,32,0,0,0,0,0,0,100,1,0,0,20,0,0,10,2,223243,10,0.75,3,2000,6,75,0,1,513,1,3,16781825,0,27356,0,1,0,30301,4,2,8,0); +INSERT INTO `server_battle_commands` VALUES (27356,'stonera',23,22,512,32,32,1,0,0,0,0,0,100,1,0,0,20,0,0,10,2,228021,30,0.75,3,3000,30,150,0,1,514,1,3,16781826,0,0,0,2,0,30301,4,2,8,0); +INSERT INTO `server_battle_commands` VALUES (27357,'esuna',27,40,0,9,9,0,0,0,0,0,0,100,1,0,0,20,0,0,10,2,0,0,0,3,2000,10,40,0,1,702,1,3,16782014,0,0,0,0,0,30329,4,0,13,0); +INSERT INTO `server_battle_commands` VALUES (27358,'regen',27,35,0,9,9,0,0,0,0,0,0,100,1,0,0,20,0,0,10,2,223180,45,1,3,2000,5,20,0,1,703,1,3,16782015,0,0,0,0,0,30328,4,4,13,0); +INSERT INTO `server_battle_commands` VALUES (27359,'holy',27,45,0,1,32,1,8,0,0,0,1,100,1,0,0,0,0,0,10,2,228011,10,0.9,0,0,300,100,0,1,708,1,3,16782020,0,0,0,0,0,30301,4,2,11,0); +/*!40000 ALTER TABLE `server_battle_commands` ENABLE KEYS */; +UNLOCK TABLES; +commit; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2018-07-02 0:22:43 diff --git a/sql/server_battle_traits.sql b/sql/server_battle_traits.sql new file mode 100644 index 00000000..89d7930f --- /dev/null +++ b/sql/server_battle_traits.sql @@ -0,0 +1,133 @@ +-- MySQL dump 10.13 Distrib 5.7.11, for Win64 (x86_64) +-- +-- Host: localhost Database: ffxiv_server +-- ------------------------------------------------------ +-- Server version 5.7.11 + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `server_battle_traits` +-- + +DROP TABLE IF EXISTS `server_battle_traits`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `server_battle_traits` ( + `id` smallint(6) NOT NULL, + `name` varchar(50) NOT NULL, + `classJob` tinyint(4) NOT NULL, + `lvl` tinyint(4) NOT NULL, + `modifier` int(11) NOT NULL DEFAULT '0', + `bonus` smallint(6) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `server_battle_traits` +-- + +LOCK TABLES `server_battle_traits` WRITE; +/*!40000 ALTER TABLE `server_battle_traits` DISABLE KEYS */; +set autocommit=0; +INSERT INTO `server_battle_traits` VALUES (27240,'enhanced_hawks_eye',7,28,0,0); +INSERT INTO `server_battle_traits` VALUES (27242,'enhanced_barrage',7,44,0,0); +INSERT INTO `server_battle_traits` VALUES (27241,'enhanced_quelling_strike',7,32,0,0); +INSERT INTO `server_battle_traits` VALUES (27243,'enhanced_raging_strike',7,36,0,0); +INSERT INTO `server_battle_traits` VALUES (27244,'enhanced_decoy',7,16,0,0); +INSERT INTO `server_battle_traits` VALUES (27245,'swift_chameleon',7,48,0,0); +INSERT INTO `server_battle_traits` VALUES (27246,'enhanced_physical_crit_accuracy',7,40,64,10); +INSERT INTO `server_battle_traits` VALUES (27247,'enhanced_physical_crit_evasion',7,20,65,10); +INSERT INTO `server_battle_traits` VALUES (27248,'enhanced_physical_evasion',7,12,16,8); +INSERT INTO `server_battle_traits` VALUES (27249,'enhanced_physical_accuracy',7,8,15,8); +INSERT INTO `server_battle_traits` VALUES (27250,'enhanced_physical_accuracy_ii',7,24,15,10); +INSERT INTO `server_battle_traits` VALUES (27120,'enhanced_second_wind',2,20,0,0); +INSERT INTO `server_battle_traits` VALUES (27121,'enhanced_blindside',2,24,0,0); +INSERT INTO `server_battle_traits` VALUES (27122,'swift_taunt',2,48,0,0); +INSERT INTO `server_battle_traits` VALUES (27123,'enhanced_featherfoot',2,28,0,0); +INSERT INTO `server_battle_traits` VALUES (27124,'enhanced_fists_of_fire',2,44,0,0); +INSERT INTO `server_battle_traits` VALUES (27125,'enhanced_fists_of_earth',2,36,0,0); +INSERT INTO `server_battle_traits` VALUES (27126,'enhanced_physical_accuracy',2,16,15,8); +INSERT INTO `server_battle_traits` VALUES (27127,'enhanced_physical_attack',2,8,17,8); +INSERT INTO `server_battle_traits` VALUES (27128,'enhanced_physical_attack_ii',2,40,17,10); +INSERT INTO `server_battle_traits` VALUES (27129,'enhanced_evasion',2,12,16,8); +INSERT INTO `server_battle_traits` VALUES (27130,'enhanced_physical_crit_damage',2,32,66,10); +INSERT INTO `server_battle_traits` VALUES (27160,'enhanced_sentinel',3,36,0,0); +INSERT INTO `server_battle_traits` VALUES (27161,'enhanced_flash',3,28,0,0); +INSERT INTO `server_battle_traits` VALUES (27162,'enhanced_flash_ii',3,48,0,0); +INSERT INTO `server_battle_traits` VALUES (27163,'enhanced_rampart',3,12,0,0); +INSERT INTO `server_battle_traits` VALUES (27164,'swift_aegis_boon',3,20,0,0); +INSERT INTO `server_battle_traits` VALUES (27165,'enhanced_outmaneuver',3,44,0,0); +INSERT INTO `server_battle_traits` VALUES (27167,'enhanced_block_rate',3,16,51,10); +INSERT INTO `server_battle_traits` VALUES (27166,'enhanced_physical_crit_resilience',3,32,67,10); +INSERT INTO `server_battle_traits` VALUES (27168,'enhanced_physical_defense',3,8,18,10); +INSERT INTO `server_battle_traits` VALUES (27169,'enhanced_physical_defense_ii',3,24,18,10); +INSERT INTO `server_battle_traits` VALUES (27170,'enhanced_physical_defense_iii',3,40,18,12); +INSERT INTO `server_battle_traits` VALUES (27200,'enhanced_provoke',4,28,0,0); +INSERT INTO `server_battle_traits` VALUES (27201,'swift_foresight',4,20,0,0); +INSERT INTO `server_battle_traits` VALUES (27202,'swift_bloodbath',4,16,0,0); +INSERT INTO `server_battle_traits` VALUES (27203,'enhanced_enduring_march',4,48,0,0); +INSERT INTO `server_battle_traits` VALUES (27204,'enhanced_rampage',4,44,0,0); +INSERT INTO `server_battle_traits` VALUES (27205,'enhanced_berserk',4,36,0,0); +INSERT INTO `server_battle_traits` VALUES (27206,'enhanced_physical_crit_evasion',4,32,65,10); +INSERT INTO `server_battle_traits` VALUES (27207,'enhanced_parry',4,24,68,8); +INSERT INTO `server_battle_traits` VALUES (27208,'enhanced_physical_defense',4,12,18,8); +INSERT INTO `server_battle_traits` VALUES (27209,'enhanced_physical_defense_ii',4,40,18,10); +INSERT INTO `server_battle_traits` VALUES (27210,'enhanced_physical_attack_power',4,8,17,8); +INSERT INTO `server_battle_traits` VALUES (27280,'enhanced_invigorate',8,28,0,0); +INSERT INTO `server_battle_traits` VALUES (27281,'enhanced_power_surge',8,44,0,0); +INSERT INTO `server_battle_traits` VALUES (27282,'enhanced_life_surge',8,32,0,0); +INSERT INTO `server_battle_traits` VALUES (27283,'enhanced_blood_for_blood',8,48,0,0); +INSERT INTO `server_battle_traits` VALUES (27284,'swift_blood_for_blood',8,16,0,0); +INSERT INTO `server_battle_traits` VALUES (27285,'enhanced_keen_flurry',8,36,0,0); +INSERT INTO `server_battle_traits` VALUES (27286,'store_tp',8,12,63,50); +INSERT INTO `server_battle_traits` VALUES (27287,'enhanced_physical_crit_accuracy',8,24,64,10); +INSERT INTO `server_battle_traits` VALUES (27288,'enhanced_physical_attack_power',8,8,17,8); +INSERT INTO `server_battle_traits` VALUES (27289,'enhanced_physical_attack_power_ii',8,20,17,10); +INSERT INTO `server_battle_traits` VALUES (27290,'enhanced_physical_attack_power_iii',8,40,17,10); +INSERT INTO `server_battle_traits` VALUES (27320,'swift_dark_seal',22,36,0,0); +INSERT INTO `server_battle_traits` VALUES (27321,'enhanced_excruciate',22,48,0,0); +INSERT INTO `server_battle_traits` VALUES (27322,'swift_necrogenesis',22,24,0,0); +INSERT INTO `server_battle_traits` VALUES (27323,'enhanced_parsimony',22,16,0,0); +INSERT INTO `server_battle_traits` VALUES (27324,'enhanced_sanguine_rite',22,44,0,0); +INSERT INTO `server_battle_traits` VALUES (27325,'enhanced_enfeebling_magic',22,12,26,8); +INSERT INTO `server_battle_traits` VALUES (27326,'enhanced_enfeebling_magic_ii',22,28,26,10); +INSERT INTO `server_battle_traits` VALUES (27327,'enhanced_magic_potency',22,8,23,8); +INSERT INTO `server_battle_traits` VALUES (27328,'enhanced_magic_potency_ii',22,28,23,10); +INSERT INTO `server_battle_traits` VALUES (27329,'enhanced_magic_crit_potency',22,40,69,10); +INSERT INTO `server_battle_traits` VALUES (27330,'auto-refresh',22,20,44,3); +INSERT INTO `server_battle_traits` VALUES (27360,'swift_sacred_prism',23,40,0,0); +INSERT INTO `server_battle_traits` VALUES (27361,'swift_shroud_of_saints',23,44,0,0); +INSERT INTO `server_battle_traits` VALUES (27362,'enhanced_blissful_mind',23,32,0,0); +INSERT INTO `server_battle_traits` VALUES (27363,'enhanced_raise',23,48,0,0); +INSERT INTO `server_battle_traits` VALUES (27364,'enhanced_stoneskin',23,36,0,0); +INSERT INTO `server_battle_traits` VALUES (27365,'enhanced_protect',23,24,0,0); +INSERT INTO `server_battle_traits` VALUES (27366,'greater_enhancing_magic',23,12,25,8); +INSERT INTO `server_battle_traits` VALUES (27367,'greater_healing',23,8,24,8); +INSERT INTO `server_battle_traits` VALUES (27368,'greater_healing_ii',23,18,24,10); +INSERT INTO `server_battle_traits` VALUES (27369,'enhanced_magic_accuracy',23,16,27,8); +INSERT INTO `server_battle_traits` VALUES (27370,'auto-refresh',23,20,44,3); +/*!40000 ALTER TABLE `server_battle_traits` ENABLE KEYS */; +UNLOCK TABLES; +commit; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2018-06-25 23:30:47 diff --git a/sql/server_battlenpc_genus.sql b/sql/server_battlenpc_genus.sql new file mode 100644 index 00000000..8c5793bb --- /dev/null +++ b/sql/server_battlenpc_genus.sql @@ -0,0 +1,146 @@ +-- MySQL dump 10.13 Distrib 5.7.18, for Win64 (x86_64) +-- +-- Host: localhost Database: ffxiv_server +-- ------------------------------------------------------ +-- Server version 5.7.18-log + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `server_battlenpc_genus` +-- + +DROP TABLE IF EXISTS `server_battlenpc_genus`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `server_battlenpc_genus` ( + `genusId` int(11) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(255) NOT NULL, + `modelSize` tinyint(3) unsigned NOT NULL DEFAULT '1', + `speed` tinyint(3) unsigned NOT NULL DEFAULT '0', + `kindredId` int(11) unsigned NOT NULL DEFAULT '0', + `kindredName` varchar(255) NOT NULL DEFAULT 'Unknown', + `detection` smallint(5) unsigned NOT NULL DEFAULT '0', + `hpp` smallint(5) unsigned NOT NULL DEFAULT '100', + `mpp` smallint(5) unsigned NOT NULL DEFAULT '100', + `tpp` smallint(5) unsigned NOT NULL DEFAULT '100', + `str` smallint(4) unsigned NOT NULL DEFAULT '1', + `vit` smallint(4) unsigned NOT NULL DEFAULT '1', + `dex` smallint(4) unsigned NOT NULL DEFAULT '1', + `int` smallint(4) unsigned NOT NULL DEFAULT '1', + `mnd` smallint(4) unsigned NOT NULL DEFAULT '1', + `pie` smallint(4) unsigned NOT NULL DEFAULT '1', + `att` smallint(4) unsigned NOT NULL DEFAULT '1', + `acc` smallint(4) unsigned NOT NULL DEFAULT '1', + `def` smallint(4) unsigned NOT NULL DEFAULT '1', + `eva` smallint(4) unsigned NOT NULL DEFAULT '1', + `slash` float NOT NULL DEFAULT '1', + `pierce` float NOT NULL DEFAULT '1', + `h2h` float NOT NULL DEFAULT '1', + `blunt` float NOT NULL DEFAULT '1', + `fire` float NOT NULL DEFAULT '1', + `ice` float NOT NULL DEFAULT '1', + `wind` float NOT NULL DEFAULT '1', + `lightning` float NOT NULL DEFAULT '1', + `earth` float NOT NULL DEFAULT '1', + `water` float NOT NULL DEFAULT '1', + `element` tinyint(4) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`genusId`) +) ENGINE=InnoDB AUTO_INCREMENT=66 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `server_battlenpc_genus` +-- + +LOCK TABLES `server_battlenpc_genus` WRITE; +/*!40000 ALTER TABLE `server_battlenpc_genus` DISABLE KEYS */; +set autocommit=0; +INSERT INTO `server_battlenpc_genus` VALUES (1,'Aldgoat',1,8,1,'Beast',1,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (2,'Antelope',1,8,1,'Beast',1,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (3,'Wolf',1,8,1,'Beast',2,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (4,'Opo-opo',1,8,1,'Beast',1,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (5,'Coeurl',1,8,1,'Beast',15,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (6,'Goobbue',1,8,1,'Beast',4,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (7,'Sheep',1,8,1,'Beast',1,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (8,'Buffalo',1,8,1,'Beast',4,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (9,'Boar',1,8,1,'Beast',2,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (10,'Moon-Mouse?',1,8,1,'Beast',2,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (11,'Mole',1,8,1,'Beast',4,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (12,'Rodent',1,8,1,'Beast',2,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (13,'Cactuar',1,8,2,'Plantoid',0,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (14,'Funguar',1,8,2,'Plantoid',0,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (15,'Flying-trap',1,8,2,'Plantoid',0,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (16,'Morbol',1,8,2,'Plantoid',0,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (17,'Orobon',1,8,3,'Aquan',0,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (18,'Gigantoad',1,8,3,'Aquan',0,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (19,'Salamander',1,8,3,'Aquan',0,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (20,'Jelly-fish',1,8,3,'Aquan',0,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (21,'Slug',1,8,3,'Aquan',0,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (22,'Megalo-crab',1,8,3,'Aquan',0,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (23,'Amaalja',1,8,4,'Spoken',0,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (24,'Ixal',1,8,4,'Spoken',0,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (25,'Qiqirn',1,8,4,'Spoken',0,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (26,'Goblin',1,8,4,'Spoken',0,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (27,'Kobold',1,8,4,'Spoken',0,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (28,'Sylph',1,8,4,'Spoken',0,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (29,'Person',1,8,4,'Spoken',0,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (30,'Drake',1,8,5,'Reptilian',0,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (31,'Basilisk',1,8,5,'Reptilian',0,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (32,'Raptor',1,8,5,'Reptilian',0,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (33,'Ant-ring',1,8,6,'Insect',0,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (34,'Swarm',1,8,6,'Insect',0,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (35,'Diremite',1,8,6,'Insect',0,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (36,'Chigoe',1,8,6,'Insect',0,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (37,'Gnat',1,8,6,'Insect',0,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (38,'Beetle',1,8,6,'Insect',0,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (39,'Yarzon',1,8,6,'Insect',0,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (40,'Apkallu',1,8,7,'Avian',0,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (41,'Vulture',1,8,7,'Avian',0,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (42,'Dodo',1,8,7,'Avian',0,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (43,'Bat',1,8,7,'Avian',0,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (44,'Hippogryph',1,8,7,'Avian',0,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (45,'Puk',1,8,7,'Avian',0,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (46,'Ghost',1,8,8,'Undead',0,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (47,'The-Damned',1,8,8,'Undead',0,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (48,'Wight',1,8,8,'Undead',0,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (49,'Coblyn',1,8,9,'Cursed',0,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (50,'Spriggan',1,8,9,'Cursed',0,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (51,'Ahriman',1,8,10,'Voidsent',0,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (52,'Imp',1,8,10,'Voidsent',0,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (53,'Will-O-Wisp',1,8,10,'Voidsent',0,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (54,'Fire-Elemental',1,8,10,'Voidsent',0,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (55,'Water-Elemental',1,8,10,'Voidsent',0,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (56,'Earth-Elemental',1,8,10,'Voidsent',0,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (57,'Lightning-Elemental',1,8,10,'Voidsent',0,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (58,'Ice-Elemental',1,8,10,'Voidsent',0,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (59,'Wind-Elemental',1,8,10,'Voidsent',0,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (60,'Ogre',1,8,10,'Voidsent',0,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (61,'Phurble',1,8,10,'Voidsent',0,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (62,'Plasmoid',1,8,10,'Voidsent',0,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (63,'Flan',1,8,10,'Voidsent',0,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (64,'Bomb',1,8,10,'Voidsent',0,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +INSERT INTO `server_battlenpc_genus` VALUES (65,'Grenade',1,8,10,'Voidsent',0,100,100,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0); +/*!40000 ALTER TABLE `server_battlenpc_genus` ENABLE KEYS */; +UNLOCK TABLES; +commit; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2017-10-11 14:48:52 diff --git a/sql/server_battlenpc_genus_mods.sql b/sql/server_battlenpc_genus_mods.sql new file mode 100644 index 00000000..1449d99f --- /dev/null +++ b/sql/server_battlenpc_genus_mods.sql @@ -0,0 +1,53 @@ +-- MySQL dump 10.13 Distrib 5.7.18, for Win64 (x86_64) +-- +-- Host: localhost Database: ffxiv_server +-- ------------------------------------------------------ +-- Server version 5.7.18-log + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `server_battlenpc_genus_mods` +-- + +DROP TABLE IF EXISTS `server_battlenpc_genus_mods`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `server_battlenpc_genus_mods` ( + `genusId` int(10) unsigned NOT NULL, + `modId` smallint(5) unsigned NOT NULL, + `modVal` bigint(20) NOT NULL, + `isMobMod` tinyint(1) unsigned NOT NULL DEFAULT '0' +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `server_battlenpc_genus_mods` +-- + +LOCK TABLES `server_battlenpc_genus_mods` WRITE; +/*!40000 ALTER TABLE `server_battlenpc_genus_mods` DISABLE KEYS */; +set autocommit=0; +/*!40000 ALTER TABLE `server_battlenpc_genus_mods` ENABLE KEYS */; +UNLOCK TABLES; +commit; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2017-09-16 2:43:01 diff --git a/sql/server_battlenpc_groups.sql b/sql/server_battlenpc_groups.sql new file mode 100644 index 00000000..d5bea565 --- /dev/null +++ b/sql/server_battlenpc_groups.sql @@ -0,0 +1,70 @@ +-- MySQL dump 10.13 Distrib 5.7.18, for Win64 (x86_64) +-- +-- Host: localhost Database: ffxiv_server +-- ------------------------------------------------------ +-- Server version 5.7.18-log + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `server_battlenpc_groups` +-- + +DROP TABLE IF EXISTS `server_battlenpc_groups`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `server_battlenpc_groups` ( + `groupId` int(10) unsigned NOT NULL DEFAULT '0', + `poolId` int(10) unsigned NOT NULL DEFAULT '0', + `scriptName` varchar(50) NOT NULL, + `minLevel` tinyint(3) unsigned NOT NULL DEFAULT '1', + `maxLevel` tinyint(3) unsigned NOT NULL DEFAULT '1', + `respawnTime` int(10) unsigned NOT NULL DEFAULT '10', + `hp` int(10) unsigned NOT NULL DEFAULT '0', + `mp` int(10) unsigned NOT NULL DEFAULT '0', + `dropListId` int(10) unsigned NOT NULL DEFAULT '0', + `allegiance` tinyint(3) unsigned NOT NULL DEFAULT '0', + `spawnType` smallint(5) unsigned NOT NULL DEFAULT '0', + `animationId` int(10) unsigned NOT NULL DEFAULT '0', + `actorState` smallint(5) unsigned NOT NULL DEFAULT '0', + `privateAreaName` varchar(32) NOT NULL DEFAULT '', + `privateAreaLevel` int(11) NOT NULL DEFAULT '0', + `zoneId` smallint(3) unsigned NOT NULL, + PRIMARY KEY (`groupId`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `server_battlenpc_groups` +-- + +LOCK TABLES `server_battlenpc_groups` WRITE; +/*!40000 ALTER TABLE `server_battlenpc_groups` DISABLE KEYS */; +set autocommit=0; +INSERT INTO `server_battlenpc_groups` VALUES (1,1,'wharf_rat',1,1,10,0,0,0,0,0,0,0,'',0,170); +INSERT INTO `server_battlenpc_groups` VALUES (2,2,'bloodthirsty_wolf',1,1,0,0,0,0,0,1,0,0,'',0,166); +INSERT INTO `server_battlenpc_groups` VALUES (3,3,'yda',1,1,0,0,0,0,1,1,0,0,'',0,166); +INSERT INTO `server_battlenpc_groups` VALUES (4,4,'papalymo',1,1,0,0,0,0,1,1,0,0,'',0,166); +/*!40000 ALTER TABLE `server_battlenpc_groups` ENABLE KEYS */; +UNLOCK TABLES; +commit; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2017-10-11 14:44:48 diff --git a/sql/server_battlenpc_pool_mods.sql b/sql/server_battlenpc_pool_mods.sql new file mode 100644 index 00000000..b76e11ef --- /dev/null +++ b/sql/server_battlenpc_pool_mods.sql @@ -0,0 +1,61 @@ +-- MySQL dump 10.13 Distrib 5.7.11, for Win64 (x86_64) +-- +-- Host: localhost Database: ffxiv_server +-- ------------------------------------------------------ +-- Server version 5.7.11 + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `server_battlenpc_pool_mods` +-- + +DROP TABLE IF EXISTS `server_battlenpc_pool_mods`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `server_battlenpc_pool_mods` ( + `poolId` int(10) unsigned NOT NULL, + `modId` smallint(5) unsigned NOT NULL, + `modVal` bigint(20) NOT NULL, + `isMobMod` tinyint(1) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`poolId`,`modId`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `server_battlenpc_pool_mods` +-- + +LOCK TABLES `server_battlenpc_pool_mods` WRITE; +/*!40000 ALTER TABLE `server_battlenpc_pool_mods` DISABLE KEYS */; +set autocommit=0; +INSERT INTO `server_battlenpc_pool_mods` VALUES (2,2,3,1); +INSERT INTO `server_battlenpc_pool_mods` VALUES (2,3,3,1); +INSERT INTO `server_battlenpc_pool_mods` VALUES (2,24,0,1); +INSERT INTO `server_battlenpc_pool_mods` VALUES (3,24,0,1); +INSERT INTO `server_battlenpc_pool_mods` VALUES (3,49,1,0); +INSERT INTO `server_battlenpc_pool_mods` VALUES (4,24,0,1); +INSERT INTO `server_battlenpc_pool_mods` VALUES (4,49,1,0); +/*!40000 ALTER TABLE `server_battlenpc_pool_mods` ENABLE KEYS */; +UNLOCK TABLES; +commit; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2018-04-18 14:54:09 diff --git a/sql/server_battlenpc_pools.sql b/sql/server_battlenpc_pools.sql new file mode 100644 index 00000000..11082723 --- /dev/null +++ b/sql/server_battlenpc_pools.sql @@ -0,0 +1,67 @@ +-- MySQL dump 10.13 Distrib 5.7.18, for Win64 (x86_64) +-- +-- Host: localhost Database: ffxiv_server +-- ------------------------------------------------------ +-- Server version 5.7.18-log + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `server_battlenpc_pools` +-- + +DROP TABLE IF EXISTS `server_battlenpc_pools`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `server_battlenpc_pools` ( + `poolId` int(10) unsigned NOT NULL, + `actorClassId` int(10) unsigned NOT NULL, + `name` varchar(50) NOT NULL, + `genusId` int(10) unsigned NOT NULL, + `currentJob` tinyint(3) unsigned NOT NULL DEFAULT '0', + `combatSkill` tinyint(3) unsigned NOT NULL, + `combatDelay` smallint(5) unsigned NOT NULL, + `combatDmgMult` float unsigned NOT NULL DEFAULT '1', + `aggroType` tinyint(3) unsigned NOT NULL DEFAULT '0', + `immunity` int(10) unsigned NOT NULL DEFAULT '0', + `linkType` tinyint(3) unsigned NOT NULL DEFAULT '0', + `spellListId` int(10) unsigned NOT NULL DEFAULT '0', + `skillListId` int(10) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`poolId`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `server_battlenpc_pools` +-- + +LOCK TABLES `server_battlenpc_pools` WRITE; +/*!40000 ALTER TABLE `server_battlenpc_pools` DISABLE KEYS */; +set autocommit=0; +INSERT INTO `server_battlenpc_pools` VALUES (1,2104001,'wharf_rat',12,0,1,4200,1,0,0,0,0,0); +INSERT INTO `server_battlenpc_pools` VALUES (2,2201407,'bloodthirsty_wolf',3,0,1,4200,1,0,0,0,0,0); +INSERT INTO `server_battlenpc_pools` VALUES (3,2290005,'yda',29,2,1,4200,1,0,0,0,0,0); +INSERT INTO `server_battlenpc_pools` VALUES (4,2290006,'papalymo',29,22,1,4200,1,0,0,0,0,0); +/*!40000 ALTER TABLE `server_battlenpc_pools` ENABLE KEYS */; +UNLOCK TABLES; +commit; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2017-10-11 14:47:40 diff --git a/sql/server_battlenpc_skill_list.sql b/sql/server_battlenpc_skill_list.sql new file mode 100644 index 00000000..195b7b34 --- /dev/null +++ b/sql/server_battlenpc_skill_list.sql @@ -0,0 +1,21 @@ +/* +MySQL Data Transfer +Source Host: localhost +Source Database: ffxiv_server +Target Host: localhost +Target Database: ffxiv_server +Date: 5/1/2017 10:28:15 PM +*/ + +SET FOREIGN_KEY_CHECKS=0; +-- ---------------------------- +-- Table structure for server_battlenpc_skill_list +-- ---------------------------- +DROP TABLE IF EXISTS `server_battlenpc_skill_list`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `server_battlenpc_skill_list` ( + `skillListId` int(10) unsigned NOT NULL DEFAULT '0', + `skillId` int(10) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`skillListId`) +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; \ No newline at end of file diff --git a/sql/server_battlenpc_spawn_locations.sql b/sql/server_battlenpc_spawn_locations.sql new file mode 100644 index 00000000..039614a2 --- /dev/null +++ b/sql/server_battlenpc_spawn_locations.sql @@ -0,0 +1,64 @@ +-- MySQL dump 10.13 Distrib 5.7.18, for Win64 (x86_64) +-- +-- Host: localhost Database: ffxiv_server +-- ------------------------------------------------------ +-- Server version 5.7.18-log + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `server_battlenpc_spawn_locations` +-- + +DROP TABLE IF EXISTS `server_battlenpc_spawn_locations`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `server_battlenpc_spawn_locations` ( + `bnpcId` int(10) unsigned NOT NULL AUTO_INCREMENT, + `customDisplayName` varchar(32) NOT NULL DEFAULT '', + `groupId` int(10) unsigned NOT NULL, + `positionX` float NOT NULL, + `positionY` float NOT NULL, + `positionZ` float NOT NULL, + `rotation` float NOT NULL, + PRIMARY KEY (`bnpcId`) +) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `server_battlenpc_spawn_locations` +-- + +LOCK TABLES `server_battlenpc_spawn_locations` WRITE; +/*!40000 ALTER TABLE `server_battlenpc_spawn_locations` DISABLE KEYS */; +set autocommit=0; +INSERT INTO `server_battlenpc_spawn_locations` VALUES (1,'test',1,25.584,200,-450,-2.514); +INSERT INTO `server_battlenpc_spawn_locations` VALUES (2,'test',1,20,200,-444,-3.14); +INSERT INTO `server_battlenpc_spawn_locations` VALUES (3,'bloodthirsty_wolf',2,374.427,4.4,-698.711,-1.942); +INSERT INTO `server_battlenpc_spawn_locations` VALUES (4,'bloodthirsty_wolf',2,375.377,4.4,-700.247,-1.992); +INSERT INTO `server_battlenpc_spawn_locations` VALUES (5,'bloodthirsty_wolf',2,375.125,4.4,-703.591,-1.54); +INSERT INTO `server_battlenpc_spawn_locations` VALUES (6,'yda',3,365.266,4.122,-700.73,1.5659); +INSERT INTO `server_battlenpc_spawn_locations` VALUES (7,'papalymo',4,365.89,4.0943,-706.72,-0.718); +/*!40000 ALTER TABLE `server_battlenpc_spawn_locations` ENABLE KEYS */; +UNLOCK TABLES; +commit; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2017-10-11 14:47:29 diff --git a/sql/server_battlenpc_spawn_mods.sql b/sql/server_battlenpc_spawn_mods.sql new file mode 100644 index 00000000..de13cced --- /dev/null +++ b/sql/server_battlenpc_spawn_mods.sql @@ -0,0 +1,56 @@ +-- MySQL dump 10.13 Distrib 5.7.11, for Win64 (x86_64) +-- +-- Host: localhost Database: ffxiv_server +-- ------------------------------------------------------ +-- Server version 5.7.11 + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `server_battlenpc_spawn_mods` +-- + +DROP TABLE IF EXISTS `server_battlenpc_spawn_mods`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `server_battlenpc_spawn_mods` ( + `bnpcId` int(10) unsigned NOT NULL, + `modId` smallint(5) unsigned NOT NULL, + `modVal` bigint(20) NOT NULL, + `isMobMod` tinyint(1) unsigned NOT NULL DEFAULT '0' +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `server_battlenpc_spawn_mods` +-- + +LOCK TABLES `server_battlenpc_spawn_mods` WRITE; +/*!40000 ALTER TABLE `server_battlenpc_spawn_mods` DISABLE KEYS */; +set autocommit=0; +INSERT INTO `server_battlenpc_spawn_mods` VALUES (3,25,30,1); +INSERT INTO `server_battlenpc_spawn_mods` VALUES (4,25,35,1); +INSERT INTO `server_battlenpc_spawn_mods` VALUES (5,25,40,1); +/*!40000 ALTER TABLE `server_battlenpc_spawn_mods` ENABLE KEYS */; +UNLOCK TABLES; +commit; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2018-02-15 0:04:49 diff --git a/sql/server_battlenpc_spell_list.sql b/sql/server_battlenpc_spell_list.sql new file mode 100644 index 00000000..999ca1b3 --- /dev/null +++ b/sql/server_battlenpc_spell_list.sql @@ -0,0 +1,21 @@ +/* +MySQL Data Transfer +Source Host: localhost +Source Database: ffxiv_server +Target Host: localhost +Target Database: ffxiv_server +Date: 5/1/2017 10:28:15 PM +*/ + +SET FOREIGN_KEY_CHECKS=0; +-- ---------------------------- +-- Table structure for server_battlenpc_spell_list +-- ---------------------------- +DROP TABLE IF EXISTS `server_battlenpc_spell_list`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `server_battlenpc_spell_list` ( + `spellListId` int(10) unsigned NOT NULL DEFAULT '0', + `spellId` int(10) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`spellListId`, `spellId`) +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; diff --git a/sql/server_spawn_locations.sql b/sql/server_spawn_locations.sql index 754d6c56..fd1d1b99 100644 --- a/sql/server_spawn_locations.sql +++ b/sql/server_spawn_locations.sql @@ -6,6 +6,7 @@ Target Host: localhost Target Database: ffxiv_server Date: 9/9/2017 2:33:14 PM */ +DROP TABLE IF EXISTS `server_spawn_locations`; SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- diff --git a/sql/server_statuseffects.sql b/sql/server_statuseffects.sql new file mode 100644 index 00000000..03c7b3c7 --- /dev/null +++ b/sql/server_statuseffects.sql @@ -0,0 +1,143 @@ +-- MySQL dump 10.13 Distrib 5.7.11, for Win64 (x86_64) +-- +-- Host: localhost Database: ffxiv_server +-- ------------------------------------------------------ +-- Server version 5.7.11 + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `server_statuseffects` +-- + +DROP TABLE IF EXISTS `server_statuseffects`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `server_statuseffects` ( + `id` int(10) unsigned NOT NULL, + `name` varchar(128) NOT NULL, + `flags` int(10) unsigned NOT NULL DEFAULT '10', + `overwrite` tinyint(3) unsigned NOT NULL DEFAULT '1', + `tickMs` int(10) unsigned NOT NULL DEFAULT '3000', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `server_statuseffects` +-- + +LOCK TABLES `server_statuseffects` WRITE; +/*!40000 ALTER TABLE `server_statuseffects` DISABLE KEYS */; +set autocommit=0; +INSERT INTO `server_statuseffects` VALUES (223001,'quick',18,2,0); +INSERT INTO `server_statuseffects` VALUES (223002,'haste',18,2,0); +INSERT INTO `server_statuseffects` VALUES (223004,'petrification',264241194,2,0); +INSERT INTO `server_statuseffects` VALUES (223005,'paralysis',42,2,3000); +INSERT INTO `server_statuseffects` VALUES (223006,'silence',4194346,2,0); +INSERT INTO `server_statuseffects` VALUES (223007,'blind',42,2,0); +INSERT INTO `server_statuseffects` VALUES (223008,'mute',4194346,2,0); +INSERT INTO `server_statuseffects` VALUES (223010,'glare',42,2,0); +INSERT INTO `server_statuseffects` VALUES (223011,'poison',42,2,0); +INSERT INTO `server_statuseffects` VALUES (223012,'transfixion',268435498,2,0); +INSERT INTO `server_statuseffects` VALUES (223013,'pacification',8388650,2,0); +INSERT INTO `server_statuseffects` VALUES (223014,'amnesia',16777258,2,0); +INSERT INTO `server_statuseffects` VALUES (223015,'stun',264241194,2,0); +INSERT INTO `server_statuseffects` VALUES (223016,'daze',264241194,2,0); +INSERT INTO `server_statuseffects` VALUES (223029,'hp_boost',18,2,0); +INSERT INTO `server_statuseffects` VALUES (223030,'hp_penalty',42,2,0); +INSERT INTO `server_statuseffects` VALUES (223038,'defense_down',42,2,0); +INSERT INTO `server_statuseffects` VALUES (223058,'aegis_boon',528434,2,0); +INSERT INTO `server_statuseffects` VALUES (223062,'sentinel',1048626,2,0); +INSERT INTO `server_statuseffects` VALUES (223063,'cover',16434,2,0); +INSERT INTO `server_statuseffects` VALUES (223064,'rampart',18,2,0); +INSERT INTO `server_statuseffects` VALUES (223068,'tempered_will',18,2,0); +INSERT INTO `server_statuseffects` VALUES (223075,'featherfoot',131122,2,0); +INSERT INTO `server_statuseffects` VALUES (223078,'enduring_march',18,2,0); +INSERT INTO `server_statuseffects` VALUES (223081,'bloodbath',1048626,2,0); +INSERT INTO `server_statuseffects` VALUES (223083,'foresight',262194,2,0); +INSERT INTO `server_statuseffects` VALUES (223091,'keen_flurry',18,2,0); +INSERT INTO `server_statuseffects` VALUES (223094,'invigorate',18,2,0); +INSERT INTO `server_statuseffects` VALUES (223097,'collusion',1048626,1,0); +INSERT INTO `server_statuseffects` VALUES (223104,'quelling_strike',1058,2,0); +INSERT INTO `server_statuseffects` VALUES (223106,'hawks_eye',18,2,0); +INSERT INTO `server_statuseffects` VALUES (223108,'decoy',4130,2,0); +INSERT INTO `server_statuseffects` VALUES (223127,'bloodletter',42,2,0); +INSERT INTO `server_statuseffects` VALUES (223129,'protect',18,2,0); +INSERT INTO `server_statuseffects` VALUES (223133,'stoneskin',16402,1,0); +INSERT INTO `server_statuseffects` VALUES (223173,'covered',42,2,0); +INSERT INTO `server_statuseffects` VALUES (223180,'regen',18,2,0); +INSERT INTO `server_statuseffects` VALUES (223181,'refresh',18,2,0); +INSERT INTO `server_statuseffects` VALUES (223182,'regain',18,2,0); +INSERT INTO `server_statuseffects` VALUES (223183,'tp_bleed',42,2,0); +INSERT INTO `server_statuseffects` VALUES (223205,'combo',42,2,0); +INSERT INTO `server_statuseffects` VALUES (223206,'goring_blade',42,2,0); +INSERT INTO `server_statuseffects` VALUES (223207,'berserk2',1074806818,1,0); +INSERT INTO `server_statuseffects` VALUES (223208,'rampage2',1075855394,1,5000); +INSERT INTO `server_statuseffects` VALUES (223209,'fists_of_fire',1073742882,2,0); +INSERT INTO `server_statuseffects` VALUES (223210,'fists_of_earth',1073742882,2,0); +INSERT INTO `server_statuseffects` VALUES (223211,'fists_of_wind',1073742882,2,0); +INSERT INTO `server_statuseffects` VALUES (223212,'power_surge_I',1058,2,0); +INSERT INTO `server_statuseffects` VALUES (223213,'power_surge_II',1058,2,0); +INSERT INTO `server_statuseffects` VALUES (223214,'power_surge_III',1058,2,0); +INSERT INTO `server_statuseffects` VALUES (223215,'life_surge_I',1048626,2,0); +INSERT INTO `server_statuseffects` VALUES (223216,'life_surge_II',1048626,2,0); +INSERT INTO `server_statuseffects` VALUES (223217,'life_surge_III',1048626,2,0); +INSERT INTO `server_statuseffects` VALUES (223218,'dread_spike',16418,2,0); +INSERT INTO `server_statuseffects` VALUES (223219,'blood_for_blood',8210,2,0); +INSERT INTO `server_statuseffects` VALUES (223220,'barrage',3090,2,0); +INSERT INTO `server_statuseffects` VALUES (223221,'raging_strike2',1074855970,1,0); +INSERT INTO `server_statuseffects` VALUES (223227,'cleric_stance',8226,1,0); +INSERT INTO `server_statuseffects` VALUES (223228,'blissful_mind',1073741858,1,1000); +INSERT INTO `server_statuseffects` VALUES (223229,'dark_seal2',1042,2,0); +INSERT INTO `server_statuseffects` VALUES (223230,'resonance2',2578,1,0); +INSERT INTO `server_statuseffects` VALUES (223231,'excruciate',2098194,2,3000); +INSERT INTO `server_statuseffects` VALUES (223232,'necrogenesis',1048594,1,0); +INSERT INTO `server_statuseffects` VALUES (223233,'parsimony',1049106,1,0); +INSERT INTO `server_statuseffects` VALUES (223234,'sanguine_rite2',16402,1,0); +INSERT INTO `server_statuseffects` VALUES (223236,'outmaneuver2',524338,2,0); +INSERT INTO `server_statuseffects` VALUES (223237,'blindside2',8226,1,0); +INSERT INTO `server_statuseffects` VALUES (223238,'decoy2',4130,2,0); +INSERT INTO `server_statuseffects` VALUES (223239,'protect2',18,2,0); +INSERT INTO `server_statuseffects` VALUES (223240,'sanguine_rite3',16402,1,0); +INSERT INTO `server_statuseffects` VALUES (223241,'bloodletter2',42,2,0); +INSERT INTO `server_statuseffects` VALUES (223242,'fully_blissful_mind',1073741858,1,0); +INSERT INTO `server_statuseffects` VALUES (223243,'magic_evasion_down',18,2,0); +INSERT INTO `server_statuseffects` VALUES (223245,'spinning_heel',18,1,0); +INSERT INTO `server_statuseffects` VALUES (223248,'divine_veil',36914,2,0); +INSERT INTO `server_statuseffects` VALUES (223250,'vengeance',16418,1,5000); +INSERT INTO `server_statuseffects` VALUES (223251,'antagonize',1048626,2,0); +INSERT INTO `server_statuseffects` VALUES (223253,'battle_voice',18,2,0); +INSERT INTO `server_statuseffects` VALUES (223254,'ballad_of_magi',18,2,0); +INSERT INTO `server_statuseffects` VALUES (223255,'paeon_of_war',18,2,0); +INSERT INTO `server_statuseffects` VALUES (223256,'minuet_of_rigor',18,2,0); +INSERT INTO `server_statuseffects` VALUES (223264,'divine_regen',18,2,0); +INSERT INTO `server_statuseffects` VALUES (228021,'heavy',42,2,0); +INSERT INTO `server_statuseffects` VALUES (253003,'evade_proc',34,1,0); +INSERT INTO `server_statuseffects` VALUES (253004,'block_proc',34,1,0); +INSERT INTO `server_statuseffects` VALUES (253005,'parry_proc',34,1,0); +INSERT INTO `server_statuseffects` VALUES (253006,'miss_proc',34,1,0); +INSERT INTO `server_statuseffects` VALUES (253007,'expchain',34,1,0); +/*!40000 ALTER TABLE `server_statuseffects` ENABLE KEYS */; +UNLOCK TABLES; +commit; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2018-06-25 23:30:50 diff --git a/sql/server_zones.sql b/sql/server_zones.sql index 86964759..16f14d9b 100644 --- a/sql/server_zones.sql +++ b/sql/server_zones.sql @@ -1,146 +1,177 @@ -/* -MySQL Data Transfer -Source Host: localhost -Source Database: ffxiv_server -Target Host: localhost -Target Database: ffxiv_server -Date: 6/14/2017 10:19:40 PM -*/ +-- MySQL dump 10.13 Distrib 5.7.18, for Win64 (x86_64) +-- +-- Host: localhost Database: ffxiv_server +-- ------------------------------------------------------ +-- Server version 5.7.18-log -SET FOREIGN_KEY_CHECKS=0; --- ---------------------------- --- Table structure for server_zones --- ---------------------------- -CREATE TABLE `server_zones` ( - `id` int(10) unsigned NOT NULL, - `regionId` smallint(6) unsigned NOT NULL, - `zoneName` varchar(255) DEFAULT NULL, - `placeName` varchar(255) NOT NULL, - `serverIp` varchar(32) NOT NULL, - `serverPort` int(10) unsigned NOT NULL, - `classPath` varchar(255) NOT NULL, - `dayMusic` smallint(6) unsigned DEFAULT '0', - `nightMusic` smallint(6) unsigned DEFAULT '0', - `battleMusic` smallint(6) unsigned DEFAULT '0', - `isIsolated` tinyint(1) DEFAULT '0', - `isInn` tinyint(1) DEFAULT '0', - `canRideChocobo` tinyint(1) DEFAULT '1', - `canStealth` tinyint(1) DEFAULT '0', - `isInstanceRaid` tinyint(1) unsigned DEFAULT '0', - PRIMARY KEY (`id`) +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `server_zones` +-- + +DROP TABLE IF EXISTS `server_zones`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `server_zones` ( + `id` int(10) unsigned NOT NULL, + `regionId` smallint(6) unsigned NOT NULL, + `zoneName` varchar(255) DEFAULT NULL, + `placeName` varchar(255) NOT NULL, + `serverIp` varchar(32) NOT NULL, + `serverPort` int(10) unsigned NOT NULL, + `classPath` varchar(255) NOT NULL, + `dayMusic` smallint(6) unsigned DEFAULT '0', + `nightMusic` smallint(6) unsigned DEFAULT '0', + `battleMusic` smallint(6) unsigned DEFAULT '0', + `isIsolated` tinyint(1) DEFAULT '0', + `isInn` tinyint(1) DEFAULT '0', + `canRideChocobo` tinyint(1) DEFAULT '1', + `canStealth` tinyint(1) DEFAULT '0', + `isInstanceRaid` tinyint(1) unsigned DEFAULT '0', + `loadNavMesh` tinyint(1) NOT NULL, + PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; --- ---------------------------- --- Records --- ---------------------------- -INSERT INTO `server_zones` VALUES ('0', '0', null, '--', '127.0.0.1', '1989', '', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('128', '101', 'sea0Field01', 'Lower La Noscea', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterSeaS0', '60', '60', '21', '0', '0', '1', '0', '0'); -INSERT INTO `server_zones` VALUES ('129', '101', 'sea0Field02', 'Western La Noscea', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterSeaS0', '60', '60', '21', '0', '0', '1', '0', '0'); -INSERT INTO `server_zones` VALUES ('130', '101', 'sea0Field03', 'Eastern La Noscea', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterSeaS0', '60', '60', '21', '0', '0', '1', '0', '0'); -INSERT INTO `server_zones` VALUES ('131', '101', 'sea0Dungeon01', 'Mistbeard Cove', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterSeaS0', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('132', '101', 'sea0Dungeon03', 'Cassiopeia Hollow', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterSeaS0', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('133', '101', 'sea0Town01', 'Limsa Lominsa', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterSeaS0', '59', '59', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('134', '202', 'sea0Market01', 'Market Wards', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterMarketSeaS0', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('135', '101', 'sea0Field04', 'Upper La Noscea', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterSeaS0', '60', '60', '21', '0', '0', '1', '0', '0'); -INSERT INTO `server_zones` VALUES ('137', '101', 'sea0Dungeon06', 'U\'Ghamaro Mines', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterSeaS0', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('138', '101', null, 'La Noscea', '127.0.0.1', '1989', '', '60', '60', '21', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('139', '112', 'sea0Field01a', 'The Cieldalaes', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterSeaS0', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('140', '101', null, 'Sailors Ward', '127.0.0.1', '1989', '', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('141', '101', 'sea0Field01a', 'Lower La Noscea', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterSeaS0', '60', '60', '21', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('143', '102', 'roc0Field01', 'Coerthas Central Highlands', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterRocR0', '55', '55', '15', '0', '0', '1', '0', '0'); -INSERT INTO `server_zones` VALUES ('144', '102', 'roc0Field02', 'Coerthas Eastern Highlands', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterRocR0', '55', '55', '15', '0', '0', '1', '0', '0'); -INSERT INTO `server_zones` VALUES ('145', '102', 'roc0Field03', 'Coerthas Eastern Lowlands', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterRocR0', '55', '55', '15', '0', '0', '1', '0', '0'); -INSERT INTO `server_zones` VALUES ('146', '102', null, 'Coerthas', '127.0.0.1', '1989', '', '55', '55', '15', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('147', '102', 'roc0Field04', 'Coerthas Central Lowlands', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterRocR0', '55', '55', '15', '0', '0', '1', '0', '0'); -INSERT INTO `server_zones` VALUES ('148', '102', 'roc0Field05', 'Coerthas Western Highlands', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterRocR0', '55', '55', '15', '0', '0', '1', '0', '0'); -INSERT INTO `server_zones` VALUES ('150', '103', 'fst0Field01', 'Central Shroud', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterFstF0', '52', '52', '13', '0', '0', '1', '0', '0'); -INSERT INTO `server_zones` VALUES ('151', '103', 'fst0Field02', 'East Shroud', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterFstF0', '52', '52', '13', '0', '0', '1', '0', '0'); -INSERT INTO `server_zones` VALUES ('152', '103', 'fst0Field03', 'North Shroud', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterFstF0', '52', '52', '13', '0', '0', '1', '0', '0'); -INSERT INTO `server_zones` VALUES ('153', '103', 'fst0Field04', 'West Shroud', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterFstF0', '52', '52', '13', '0', '0', '1', '0', '0'); -INSERT INTO `server_zones` VALUES ('154', '103', 'fst0Field05', 'South Shroud', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterFstF0', '52', '52', '13', '0', '0', '1', '0', '0'); -INSERT INTO `server_zones` VALUES ('155', '103', 'fst0Town01', 'Gridania', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterFstF0', '51', '51', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('156', '103', null, 'The Black Shroud', '127.0.0.1', '1989', '', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('157', '103', 'fst0Dungeon01', 'The Mun-Tuy Cellars', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterFstF0', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('158', '103', 'fst0Dungeon02', 'The Tam-Tara Deepcroft', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterFstF0', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('159', '103', 'fst0Dungeon03', 'The Thousand Maws of Toto-Rak', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterFstF0', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('160', '204', 'fst0Market01', 'Market Wards', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterMarketFstF0', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('161', '103', null, 'Peasants Ward', '127.0.0.1', '1989', '', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('162', '103', 'fst0Field01a', 'Central Shroud', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterFstF0', '52', '52', '13', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('164', '106', 'fst0Battle01', 'Central Shroud', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterBattleFstF0', '0', '0', '13', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('165', '106', 'fst0Battle02', 'Central Shroud', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterBattleFstF0', '0', '0', '13', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('166', '106', 'fst0Battle03', 'Central Shroud', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterBattleFstF0', '0', '0', '13', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('167', '106', 'fst0Battle04', 'Central Shroud', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterBattleFstF0', '0', '0', '13', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('168', '106', 'fst0Battle05', 'Central Shroud', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterBattleFstF0', '0', '0', '13', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('170', '104', 'wil0Field01', 'Central Thanalan', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterWilW0', '68', '68', '25', '0', '0', '1', '0', '0'); -INSERT INTO `server_zones` VALUES ('171', '104', 'wil0Field02', 'Eastern Thanalan', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterWilW0', '68', '68', '25', '0', '0', '1', '0', '0'); -INSERT INTO `server_zones` VALUES ('172', '104', 'wil0Field03', 'Western Thanalan', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterWilW0', '68', '68', '25', '0', '0', '1', '0', '0'); -INSERT INTO `server_zones` VALUES ('173', '104', 'wil0Field04', 'Northern Thanalan', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterWilW0', '68', '68', '25', '0', '0', '1', '0', '0'); -INSERT INTO `server_zones` VALUES ('174', '104', 'wil0Field05', 'Southern Thanalan', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterWilW0', '68', '68', '25', '0', '0', '1', '0', '0'); -INSERT INTO `server_zones` VALUES ('175', '104', 'wil0Town01', 'Ul\'dah', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterWilW0', '66', '66', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('176', '104', 'wil0Dungeon02', 'Nanawa Mines', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterWilW0', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('177', '207', '_jail', '-', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterJail', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('178', '104', 'wil0Dungeon04', 'Copperbell Mines', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterWilW0', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('179', '104', null, 'Thanalan', '127.0.0.1', '1989', '', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('180', '205', 'wil0Market01', 'Market Wards', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterMarketWilW0', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('181', '104', null, 'Merchants Ward', '127.0.0.1', '1989', '', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('182', '104', null, 'Central Thanalan', '127.0.0.1', '1989', '', '68', '68', '25', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('184', '107', 'wil0Battle01', 'Ul\'dah', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterBattleWilW0', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('185', '107', 'wil0Battle01', 'Ul\'dah', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterBattleWilW0', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('186', '104', 'wil0Battle02', 'Ul\'dah', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterBattleWilW0', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('187', '104', 'wil0Battle03', 'Ul\'dah', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterBattleWilW0', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('188', '104', 'wil0Battle04', 'Ul\'dah', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterBattleWilW0', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('190', '105', 'lak0Field01', 'Mor Dhona', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterLakL0', '49', '49', '11', '0', '0', '1', '0', '0'); -INSERT INTO `server_zones` VALUES ('192', '112', 'ocn1Battle01', 'Rhotano Sea', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterBattleOcnO1', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('193', '111', 'ocn0Battle02', 'Rhotano Sea', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterBattleOcnO0', '7', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('194', '112', 'ocn1Battle03', 'Rhotano Sea', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterBattleOcnO1', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('195', '112', 'ocn1Battle04', 'Rhotano Sea', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterBattleOcnO1', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('196', '112', 'ocn1Battle05', 'Rhotano Sea', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterBattleOcnO1', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('198', '112', 'ocn1Battle06', 'Rhotano Sea', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterBattleOcnO1', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('200', '805', 'sea1Cruise01', 'Strait of Merlthor', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterCruiseSeaS1', '65', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('201', '208', 'prv0Cottage00', '-', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterCottagePrv00', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('204', '101', 'sea0Field02a', 'Western La Noscea', '127.0.0.1', '1989', '', '60', '60', '21', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('205', '101', 'sea0Field03a', 'Eastern La Noscea', '127.0.0.1', '1989', '', '60', '60', '21', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('206', '103', 'fst0Town01a', 'Gridania', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterFstF0', '51', '51', '13', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('207', '103', 'fst0Field03a', 'North Shroud', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterFstF0', '52', '52', '13', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('208', '103', 'fst0Field05a', 'South Shroud', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterFstF0', '52', '52', '13', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('209', '104', 'wil0Town01a', 'Ul\'dah', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterWilW0', '66', '66', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('210', '104', null, 'Eastern Thanalan', '127.0.0.1', '1989', '', '68', '68', '25', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('211', '104', null, 'Western Thanalan', '127.0.0.1', '1989', '', '68', '68', '25', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('230', '101', 'sea0Town01a', 'Limsa Lominsa', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterSeaS0', '59', '59', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('231', '102', 'roc0Dungeon01', 'Dzemael Darkhold', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterRocR0', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('232', '202', 'sea0Office01', 'Maelstrom Command', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterOfficeSeaS0', '3', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('233', '205', 'wil0Office01', 'Hall of Flames', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterOfficeWilW0', '4', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('234', '204', 'fst0Office01', 'Adders\' Nest', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterOfficeFstF0', '2', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('235', '101', null, 'Shposhae', '127.0.0.1', '1989', '', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('236', '101', 'sea1Field01', 'Locke\'s Lie', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterSeaS1', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('237', '101', null, 'Turtleback Island', '127.0.0.1', '1989', '', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('238', '103', 'fst0Field04', 'Thornmarch', '127.0.0.1', '1989', '', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('239', '102', 'roc0Field02a', 'The Howling Eye', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterRocR0', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('240', '104', 'wil0Field05a', 'The Bowl of Embers', '127.0.0.1', '1989', '', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('244', '209', 'prv0Inn01', 'Inn Room', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterPrvI0', '61', '61', '0', '0', '1', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('245', '102', 'roc0Dungeon04', 'The Aurum Vale', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterRocR0', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('246', '104', null, 'Cutter\'s Cry', '127.0.0.1', '1989', '', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('247', '103', null, 'North Shroud', '127.0.0.1', '1989', '', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('248', '101', null, 'Western La Noscea', '127.0.0.1', '1989', '', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('249', '104', null, 'Eastern Thanalan', '127.0.0.1', '1989', '', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('250', '102', 'roc0Field02a', 'The Howling Eye', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterRocR0', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('251', '105', null, 'Transmission Tower', '127.0.0.1', '1989', '', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('252', '102', 'roc0Dungeon04', 'The Aurum Vale', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterRocR0', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('253', '102', 'roc0Dungeon04', 'The Aurum Vale', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterRocR0', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('254', '104', null, 'Cutter\'s Cry', '127.0.0.1', '1989', '', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('255', '104', null, 'Cutter\'s Cry', '127.0.0.1', '1989', '', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('256', '102', 'roc0Field02a', 'The Howling Eye', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterRocR0', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('257', '109', 'roc1Field01', 'Rivenroad', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterRocR1', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('258', '103', null, 'North Shroud', '127.0.0.1', '1989', '', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('259', '103', null, 'North Shroud', '127.0.0.1', '1989', '', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('260', '101', null, 'Western La Noscea', '127.0.0.1', '1989', '', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('261', '101', null, 'Western La Noscea', '127.0.0.1', '1989', '', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('262', '104', null, 'Eastern Thanalan', '127.0.0.1', '1989', '', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('263', '104', null, 'Eastern Thanalan', '127.0.0.1', '1989', '', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('264', '105', 'lak0Field01', 'Transmission Tower', '127.0.0.1', '1989', '', '0', '0', '0', '0', '0', '1', '0', '0'); -INSERT INTO `server_zones` VALUES ('265', '104', null, 'The Bowl of Embers', '127.0.0.1', '1989', '', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('266', '105', 'lak0Field01a', 'Mor Dhona', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterLakL0', '49', '49', '11', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('267', '109', 'roc1Field02', 'Rivenroad', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterRocR1', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('268', '109', 'roc1Field03', 'Rivenroad', '127.0.0.1', '1989', '/Area/Zone/ZoneMasterRocR1', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('269', '101', null, 'Locke\'s Lie', '127.0.0.1', '1989', '', '0', '0', '0', '0', '0', '0', '0', '0'); -INSERT INTO `server_zones` VALUES ('270', '101', null, 'Turtleback Island', '127.0.0.1', '1989', '', '0', '0', '0', '0', '0', '0', '0', '0'); +-- +-- Dumping data for table `server_zones` +-- + +LOCK TABLES `server_zones` WRITE; +/*!40000 ALTER TABLE `server_zones` DISABLE KEYS */; +set autocommit=0; +INSERT INTO `server_zones` VALUES (0,0,NULL,'--','127.0.0.1',1989,'',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (128,101,'sea0Field01','Lower La Noscea','127.0.0.1',1989,'/Area/Zone/ZoneMasterSeaS0',60,60,21,0,0,1,0,0,0); +INSERT INTO `server_zones` VALUES (129,101,'sea0Field02','Western La Noscea','127.0.0.1',1989,'/Area/Zone/ZoneMasterSeaS0',60,60,21,0,0,1,0,0,0); +INSERT INTO `server_zones` VALUES (130,101,'sea0Field03','Eastern La Noscea','127.0.0.1',1989,'/Area/Zone/ZoneMasterSeaS0',60,60,21,0,0,1,0,0,0); +INSERT INTO `server_zones` VALUES (131,101,'sea0Dungeon01','Mistbeard Cove','127.0.0.1',1989,'/Area/Zone/ZoneMasterSeaS0',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (132,101,'sea0Dungeon03','Cassiopeia Hollow','127.0.0.1',1989,'/Area/Zone/ZoneMasterSeaS0',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (133,101,'sea0Town01','Limsa Lominsa','127.0.0.1',1989,'/Area/Zone/ZoneMasterSeaS0',59,59,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (134,202,'sea0Market01','Market Wards','127.0.0.1',1989,'/Area/Zone/ZoneMasterMarketSeaS0',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (135,101,'sea0Field04','Upper La Noscea','127.0.0.1',1989,'/Area/Zone/ZoneMasterSeaS0',60,60,21,0,0,1,0,0,0); +INSERT INTO `server_zones` VALUES (137,101,'sea0Dungeon06','U\'Ghamaro Mines','127.0.0.1',1989,'/Area/Zone/ZoneMasterSeaS0',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (138,101,NULL,'La Noscea','127.0.0.1',1989,'',60,60,21,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (139,112,'sea0Field01a','The Cieldalaes','127.0.0.1',1989,'/Area/Zone/ZoneMasterSeaS0',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (140,101,NULL,'Sailors Ward','127.0.0.1',1989,'',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (141,101,'sea0Field01a','Lower La Noscea','127.0.0.1',1989,'/Area/Zone/ZoneMasterSeaS0',60,60,21,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (143,102,'roc0Field01','Coerthas Central Highlands','127.0.0.1',1989,'/Area/Zone/ZoneMasterRocR0',55,55,15,0,0,1,0,0,0); +INSERT INTO `server_zones` VALUES (144,102,'roc0Field02','Coerthas Eastern Highlands','127.0.0.1',1989,'/Area/Zone/ZoneMasterRocR0',55,55,15,0,0,1,0,0,0); +INSERT INTO `server_zones` VALUES (145,102,'roc0Field03','Coerthas Eastern Lowlands','127.0.0.1',1989,'/Area/Zone/ZoneMasterRocR0',55,55,15,0,0,1,0,0,0); +INSERT INTO `server_zones` VALUES (146,102,NULL,'Coerthas','127.0.0.1',1989,'',55,55,15,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (147,102,'roc0Field04','Coerthas Central Lowlands','127.0.0.1',1989,'/Area/Zone/ZoneMasterRocR0',55,55,15,0,0,1,0,0,0); +INSERT INTO `server_zones` VALUES (148,102,'roc0Field05','Coerthas Western Highlands','127.0.0.1',1989,'/Area/Zone/ZoneMasterRocR0',55,55,15,0,0,1,0,0,0); +INSERT INTO `server_zones` VALUES (150,103,'fst0Field01','Central Shroud','127.0.0.1',1989,'/Area/Zone/ZoneMasterFstF0',52,52,13,0,0,1,0,0,0); +INSERT INTO `server_zones` VALUES (151,103,'fst0Field02','East Shroud','127.0.0.1',1989,'/Area/Zone/ZoneMasterFstF0',52,52,13,0,0,1,0,0,0); +INSERT INTO `server_zones` VALUES (152,103,'fst0Field03','North Shroud','127.0.0.1',1989,'/Area/Zone/ZoneMasterFstF0',52,52,13,0,0,1,0,0,0); +INSERT INTO `server_zones` VALUES (153,103,'fst0Field04','West Shroud','127.0.0.1',1989,'/Area/Zone/ZoneMasterFstF0',52,52,13,0,0,1,0,0,0); +INSERT INTO `server_zones` VALUES (154,103,'fst0Field05','South Shroud','127.0.0.1',1989,'/Area/Zone/ZoneMasterFstF0',52,52,13,0,0,1,0,0,0); +INSERT INTO `server_zones` VALUES (155,103,'fst0Town01','Gridania','127.0.0.1',1989,'/Area/Zone/ZoneMasterFstF0',51,51,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (156,103,NULL,'The Black Shroud','127.0.0.1',1989,'',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (157,103,'fst0Dungeon01','The Mun-Tuy Cellars','127.0.0.1',1989,'/Area/Zone/ZoneMasterFstF0',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (158,103,'fst0Dungeon02','The Tam-Tara Deepcroft','127.0.0.1',1989,'/Area/Zone/ZoneMasterFstF0',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (159,103,'fst0Dungeon03','The Thousand Maws of Toto-Rak','127.0.0.1',1989,'/Area/Zone/ZoneMasterFstF0',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (160,204,'fst0Market01','Market Wards','127.0.0.1',1989,'/Area/Zone/ZoneMasterMarketFstF0',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (161,103,NULL,'Peasants Ward','127.0.0.1',1989,'',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (162,103,'fst0Field01a','Central Shroud','127.0.0.1',1989,'/Area/Zone/ZoneMasterFstF0',52,52,13,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (164,106,'fst0Battle01','Central Shroud','127.0.0.1',1989,'/Area/Zone/ZoneMasterBattleFstF0',0,0,13,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (165,106,'fst0Battle02','Central Shroud','127.0.0.1',1989,'/Area/Zone/ZoneMasterBattleFstF0',0,0,13,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (166,106,'fst0Battle03','Central Shroud','127.0.0.1',1989,'/Area/Zone/ZoneMasterBattleFstF0',0,0,13,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (167,106,'fst0Battle04','Central Shroud','127.0.0.1',1989,'/Area/Zone/ZoneMasterBattleFstF0',0,0,13,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (168,106,'fst0Battle05','Central Shroud','127.0.0.1',1989,'/Area/Zone/ZoneMasterBattleFstF0',0,0,13,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (170,104,'wil0Field01','Central Thanalan','127.0.0.1',1989,'/Area/Zone/ZoneMasterWilW0',68,68,25,0,0,1,0,0,0); +INSERT INTO `server_zones` VALUES (171,104,'wil0Field02','Eastern Thanalan','127.0.0.1',1989,'/Area/Zone/ZoneMasterWilW0',68,68,25,0,0,1,0,0,0); +INSERT INTO `server_zones` VALUES (172,104,'wil0Field03','Western Thanalan','127.0.0.1',1989,'/Area/Zone/ZoneMasterWilW0',68,68,25,0,0,1,0,0,0); +INSERT INTO `server_zones` VALUES (173,104,'wil0Field04','Northern Thanalan','127.0.0.1',1989,'/Area/Zone/ZoneMasterWilW0',68,68,25,0,0,1,0,0,0); +INSERT INTO `server_zones` VALUES (174,104,'wil0Field05','Southern Thanalan','127.0.0.1',1989,'/Area/Zone/ZoneMasterWilW0',68,68,25,0,0,1,0,0,0); +INSERT INTO `server_zones` VALUES (175,104,'wil0Town01','Ul\'dah','127.0.0.1',1989,'/Area/Zone/ZoneMasterWilW0',66,66,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (176,104,'wil0Dungeon02','Nanawa Mines','127.0.0.1',1989,'/Area/Zone/ZoneMasterWilW0',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (177,207,'_jail','-','127.0.0.1',1989,'/Area/Zone/ZoneMasterJail',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (178,104,'wil0Dungeon04','Copperbell Mines','127.0.0.1',1989,'/Area/Zone/ZoneMasterWilW0',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (179,104,NULL,'Thanalan','127.0.0.1',1989,'',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (180,205,'wil0Market01','Market Wards','127.0.0.1',1989,'/Area/Zone/ZoneMasterMarketWilW0',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (181,104,NULL,'Merchants Ward','127.0.0.1',1989,'',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (182,104,NULL,'Central Thanalan','127.0.0.1',1989,'',68,68,25,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (184,107,'wil0Battle01','Ul\'dah','127.0.0.1',1989,'/Area/Zone/ZoneMasterBattleWilW0',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (185,107,'wil0Battle01','Ul\'dah','127.0.0.1',1989,'/Area/Zone/ZoneMasterBattleWilW0',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (186,104,'wil0Battle02','Ul\'dah','127.0.0.1',1989,'/Area/Zone/ZoneMasterBattleWilW0',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (187,104,'wil0Battle03','Ul\'dah','127.0.0.1',1989,'/Area/Zone/ZoneMasterBattleWilW0',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (188,104,'wil0Battle04','Ul\'dah','127.0.0.1',1989,'/Area/Zone/ZoneMasterBattleWilW0',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (190,105,'lak0Field01','Mor Dhona','127.0.0.1',1989,'/Area/Zone/ZoneMasterLakL0',49,49,11,0,0,1,0,0,0); +INSERT INTO `server_zones` VALUES (192,112,'ocn1Battle01','Rhotano Sea','127.0.0.1',1989,'/Area/Zone/ZoneMasterBattleOcnO1',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (193,111,'ocn0Battle02','Rhotano Sea','127.0.0.1',1989,'/Area/Zone/ZoneMasterBattleOcnO0',7,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (194,112,'ocn1Battle03','Rhotano Sea','127.0.0.1',1989,'/Area/Zone/ZoneMasterBattleOcnO1',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (195,112,'ocn1Battle04','Rhotano Sea','127.0.0.1',1989,'/Area/Zone/ZoneMasterBattleOcnO1',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (196,112,'ocn1Battle05','Rhotano Sea','127.0.0.1',1989,'/Area/Zone/ZoneMasterBattleOcnO1',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (198,112,'ocn1Battle06','Rhotano Sea','127.0.0.1',1989,'/Area/Zone/ZoneMasterBattleOcnO1',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (200,805,'sea1Cruise01','Strait of Merlthor','127.0.0.1',1989,'/Area/Zone/ZoneMasterCruiseSeaS1',65,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (201,208,'prv0Cottage00','-','127.0.0.1',1989,'/Area/Zone/ZoneMasterCottagePrv00',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (204,101,'sea0Field02a','Western La Noscea','127.0.0.1',1989,'',60,60,21,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (205,101,'sea0Field03a','Eastern La Noscea','127.0.0.1',1989,'',60,60,21,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (206,103,'fst0Town01a','Gridania','127.0.0.1',1989,'/Area/Zone/ZoneMasterFstF0',51,51,13,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (207,103,'fst0Field03a','North Shroud','127.0.0.1',1989,'/Area/Zone/ZoneMasterFstF0',52,52,13,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (208,103,'fst0Field05a','South Shroud','127.0.0.1',1989,'/Area/Zone/ZoneMasterFstF0',52,52,13,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (209,104,'wil0Town01a','Ul\'dah','127.0.0.1',1989,'/Area/Zone/ZoneMasterWilW0',66,66,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (210,104,NULL,'Eastern Thanalan','127.0.0.1',1989,'',68,68,25,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (211,104,NULL,'Western Thanalan','127.0.0.1',1989,'',68,68,25,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (230,101,'sea0Town01a','Limsa Lominsa','127.0.0.1',1989,'/Area/Zone/ZoneMasterSeaS0',59,59,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (231,102,'roc0Dungeon01','Dzemael Darkhold','127.0.0.1',1989,'/Area/Zone/ZoneMasterRocR0',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (232,202,'sea0Office01','Maelstrom Command','127.0.0.1',1989,'/Area/Zone/ZoneMasterOfficeSeaS0',3,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (233,205,'wil0Office01','Hall of Flames','127.0.0.1',1989,'/Area/Zone/ZoneMasterOfficeWilW0',4,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (234,204,'fst0Office01','Adders\' Nest','127.0.0.1',1989,'/Area/Zone/ZoneMasterOfficeFstF0',2,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (235,101,NULL,'Shposhae','127.0.0.1',1989,'',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (236,101,'sea1Field01','Locke\'s Lie','127.0.0.1',1989,'/Area/Zone/ZoneMasterSeaS1',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (237,101,NULL,'Turtleback Island','127.0.0.1',1989,'',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (238,103,'fst0Field04','Thornmarch','127.0.0.1',1989,'',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (239,102,'roc0Field02a','The Howling Eye','127.0.0.1',1989,'/Area/Zone/ZoneMasterRocR0',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (240,104,'wil0Field05a','The Bowl of Embers','127.0.0.1',1989,'',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (244,209,'prv0Inn01','Inn Room','127.0.0.1',1989,'/Area/Zone/ZoneMasterPrvI0',61,61,0,0,1,0,0,0,0); +INSERT INTO `server_zones` VALUES (245,102,'roc0Dungeon04','The Aurum Vale','127.0.0.1',1989,'/Area/Zone/ZoneMasterRocR0',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (246,104,NULL,'Cutter\'s Cry','127.0.0.1',1989,'',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (247,103,NULL,'North Shroud','127.0.0.1',1989,'',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (248,101,NULL,'Western La Noscea','127.0.0.1',1989,'',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (249,104,NULL,'Eastern Thanalan','127.0.0.1',1989,'',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (250,102,'roc0Field02a','The Howling Eye','127.0.0.1',1989,'/Area/Zone/ZoneMasterRocR0',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (251,105,NULL,'Transmission Tower','127.0.0.1',1989,'',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (252,102,'roc0Dungeon04','The Aurum Vale','127.0.0.1',1989,'/Area/Zone/ZoneMasterRocR0',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (253,102,'roc0Dungeon04','The Aurum Vale','127.0.0.1',1989,'/Area/Zone/ZoneMasterRocR0',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (254,104,NULL,'Cutter\'s Cry','127.0.0.1',1989,'',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (255,104,NULL,'Cutter\'s Cry','127.0.0.1',1989,'',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (256,102,'roc0Field02a','The Howling Eye','127.0.0.1',1989,'/Area/Zone/ZoneMasterRocR0',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (257,109,'roc1Field01','Rivenroad','127.0.0.1',1989,'/Area/Zone/ZoneMasterRocR1',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (258,103,NULL,'North Shroud','127.0.0.1',1989,'',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (259,103,NULL,'North Shroud','127.0.0.1',1989,'',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (260,101,NULL,'Western La Noscea','127.0.0.1',1989,'',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (261,101,NULL,'Western La Noscea','127.0.0.1',1989,'',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (262,104,NULL,'Eastern Thanalan','127.0.0.1',1989,'',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (263,104,NULL,'Eastern Thanalan','127.0.0.1',1989,'',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (264,105,'lak0Field01','Transmission Tower','127.0.0.1',1989,'',0,0,0,0,0,1,0,0,0); +INSERT INTO `server_zones` VALUES (265,104,NULL,'The Bowl of Embers','127.0.0.1',1989,'',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (266,105,'lak0Field01a','Mor Dhona','127.0.0.1',1989,'/Area/Zone/ZoneMasterLakL0',49,49,11,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (267,109,'roc1Field02','Rivenroad','127.0.0.1',1989,'/Area/Zone/ZoneMasterRocR1',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (268,109,'roc1Field03','Rivenroad','127.0.0.1',1989,'/Area/Zone/ZoneMasterRocR1',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (269,101,NULL,'Locke\'s Lie','127.0.0.1',1989,'',0,0,0,0,0,0,0,0,0); +INSERT INTO `server_zones` VALUES (270,101,NULL,'Turtleback Island','127.0.0.1',1989,'',0,0,0,0,0,0,0,0,0); +/*!40000 ALTER TABLE `server_zones` ENABLE KEYS */; +UNLOCK TABLES; +commit; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2017-06-29 18:47:53