mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-02 19:42:05 -04:00
Merged in nxtstudios/ffxiv1.0-server (pull request #24)
Added DB support for Support Desk packets and fixed paths to work on Linux/OSX
This commit is contained in:
commit
c087fb44c0
@ -10,6 +10,7 @@ using FFXIVClassic_Map_Server.packets.send.player;
|
||||
using FFXIVClassic_Map_Server.dataobjects;
|
||||
using FFXIVClassic_Map_Server.Actors;
|
||||
using FFXIVClassic_Map_Server.actors.chara.player;
|
||||
using FFXIVClassic_Map_Server.packets.receive.supportdesk;
|
||||
|
||||
namespace FFXIVClassic_Map_Server
|
||||
{
|
||||
@ -29,10 +30,10 @@ namespace FFXIVClassic_Map_Server
|
||||
cmd.Parameters.AddWithValue("@sessionId", sessionId);
|
||||
using (MySqlDataReader Reader = cmd.ExecuteReader())
|
||||
{
|
||||
while (Reader.Read())
|
||||
{
|
||||
id = Reader.GetUInt32("userId");
|
||||
}
|
||||
while (Reader.Read())
|
||||
{
|
||||
id = Reader.GetUInt32("userId");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (MySqlException e)
|
||||
@ -42,11 +43,11 @@ namespace FFXIVClassic_Map_Server
|
||||
finally
|
||||
{
|
||||
conn.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
public static DBWorld 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)))
|
||||
@ -55,7 +56,7 @@ namespace FFXIVClassic_Map_Server
|
||||
try
|
||||
{
|
||||
conn.Open();
|
||||
world = conn.Query<DBWorld>("SELECT * FROM servers WHERE id=@ServerId", new {ServerId = serverId}).SingleOrDefault();
|
||||
world = conn.Query<DBWorld>("SELECT * FROM servers WHERE id=@ServerId", new { ServerId = serverId }).SingleOrDefault();
|
||||
}
|
||||
catch (MySqlException e)
|
||||
{
|
||||
@ -68,7 +69,7 @@ namespace FFXIVClassic_Map_Server
|
||||
|
||||
return world;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static List<Npc> GetNpcList()
|
||||
{
|
||||
@ -98,7 +99,7 @@ namespace FFXIVClassic_Map_Server
|
||||
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)))
|
||||
{
|
||||
Dictionary<uint, Item> gamedataItems = new Dictionary<uint, Item>();
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
conn.Open();
|
||||
@ -144,7 +145,7 @@ namespace FFXIVClassic_Map_Server
|
||||
{
|
||||
conn.Dispose();
|
||||
}
|
||||
|
||||
|
||||
return gamedataItems;
|
||||
}
|
||||
}
|
||||
@ -243,7 +244,7 @@ namespace FFXIVClassic_Map_Server
|
||||
|
||||
public static void SavePlayerPosition(Player player)
|
||||
{
|
||||
string query;
|
||||
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)))
|
||||
@ -261,7 +262,7 @@ namespace FFXIVClassic_Map_Server
|
||||
currentZoneId = @zoneId
|
||||
WHERE id = @charaId
|
||||
";
|
||||
|
||||
|
||||
cmd = new MySqlCommand(query, conn);
|
||||
cmd.Parameters.AddWithValue("@charaId", player.actorId);
|
||||
cmd.Parameters.AddWithValue("@x", player.positionX);
|
||||
@ -370,9 +371,9 @@ namespace FFXIVClassic_Map_Server
|
||||
}
|
||||
|
||||
public static void LoadPlayerCharacter(Player player)
|
||||
{
|
||||
{
|
||||
string query;
|
||||
MySqlCommand cmd;
|
||||
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)))
|
||||
{
|
||||
@ -403,7 +404,7 @@ namespace FFXIVClassic_Map_Server
|
||||
restBonus,
|
||||
achievementPoints,
|
||||
playTime
|
||||
FROM characters WHERE id = @charId";
|
||||
FROM characters WHERE id = @charId";
|
||||
|
||||
cmd = new MySqlCommand(query, conn);
|
||||
cmd.Parameters.AddWithValue("@charId", player.actorId);
|
||||
@ -436,7 +437,7 @@ namespace FFXIVClassic_Map_Server
|
||||
player.playTime = reader.GetUInt32(19);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Get class levels
|
||||
query = @"
|
||||
SELECT
|
||||
@ -469,7 +470,7 @@ namespace FFXIVClassic_Map_Server
|
||||
{
|
||||
if (reader.Read())
|
||||
{
|
||||
player.charaWork.battleSave.skillLevel[Player.CLASSID_PUG-1] = reader.GetInt16("pug");
|
||||
player.charaWork.battleSave.skillLevel[Player.CLASSID_PUG - 1] = reader.GetInt16("pug");
|
||||
player.charaWork.battleSave.skillLevel[Player.CLASSID_GLA - 1] = reader.GetInt16("gla");
|
||||
player.charaWork.battleSave.skillLevel[Player.CLASSID_MRD - 1] = reader.GetInt16("mrd");
|
||||
player.charaWork.battleSave.skillLevel[Player.CLASSID_ARC - 1] = reader.GetInt16("arc");
|
||||
@ -518,7 +519,7 @@ namespace FFXIVClassic_Map_Server
|
||||
player.charaWork.parameterSave.state_mainSkillLevel = player.charaWork.battleSave.skillLevel[reader.GetByte(4) - 1];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Load appearance
|
||||
query = @"
|
||||
SELECT
|
||||
@ -661,7 +662,7 @@ namespace FFXIVClassic_Map_Server
|
||||
player.timers[i] = reader.GetUInt32(i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Load Hotbar
|
||||
query = @"
|
||||
SELECT
|
||||
@ -674,11 +675,11 @@ namespace FFXIVClassic_Map_Server
|
||||
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.command[index + 32] = reader.GetUInt32(1);
|
||||
player.charaWork.parameterSave.commandSlot_recastTime[index] = reader.GetUInt32(2);
|
||||
}
|
||||
}
|
||||
@ -691,7 +692,7 @@ namespace FFXIVClassic_Map_Server
|
||||
questData,
|
||||
questFlags
|
||||
FROM characters_quest_scenario WHERE characterId = @charId";
|
||||
|
||||
|
||||
cmd = new MySqlCommand(query, conn);
|
||||
cmd.Parameters.AddWithValue("@charId", player.actorId);
|
||||
using (MySqlDataReader reader = cmd.ExecuteReader())
|
||||
@ -776,7 +777,7 @@ namespace FFXIVClassic_Map_Server
|
||||
{
|
||||
int npcLSId = reader.GetUInt16(0);
|
||||
player.playerWork.npcLinkshellChatCalling[npcLSId] = reader.GetBoolean(1);
|
||||
player.playerWork.npcLinkshellChatExtra[npcLSId] = reader.GetBoolean(2);
|
||||
player.playerWork.npcLinkshellChatExtra[npcLSId] = reader.GetBoolean(2);
|
||||
}
|
||||
}
|
||||
|
||||
@ -951,7 +952,7 @@ namespace FFXIVClassic_Map_Server
|
||||
cmd.Parameters.AddWithValue("@type", type);
|
||||
|
||||
using (MySqlDataReader reader = cmd.ExecuteReader())
|
||||
{
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
uint uniqueId = reader.GetUInt32(0);
|
||||
@ -998,7 +999,7 @@ namespace FFXIVClassic_Map_Server
|
||||
{
|
||||
conn.Open();
|
||||
|
||||
|
||||
|
||||
|
||||
string query = @"
|
||||
INSERT INTO server_items
|
||||
@ -1016,7 +1017,7 @@ namespace FFXIVClassic_Map_Server
|
||||
";
|
||||
|
||||
MySqlCommand cmd2 = new MySqlCommand(query2, conn);
|
||||
|
||||
|
||||
cmd.Parameters.AddWithValue("@itemId", itemId);
|
||||
cmd.Parameters.AddWithValue("@quality", quality);
|
||||
cmd.Parameters.AddWithValue("@itemType", itemType);
|
||||
@ -1052,12 +1053,12 @@ namespace FFXIVClassic_Map_Server
|
||||
{
|
||||
conn.Open();
|
||||
|
||||
string query = @"
|
||||
string query = @"
|
||||
UPDATE characters_inventory
|
||||
SET quantity = @quantity
|
||||
WHERE characterId = @charId AND slot = @slot AND inventoryType = @type;
|
||||
";
|
||||
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand(query, conn);
|
||||
cmd.Parameters.AddWithValue("@charId", player.actorId);
|
||||
cmd.Parameters.AddWithValue("@quantity", quantity);
|
||||
@ -1097,7 +1098,7 @@ namespace FFXIVClassic_Map_Server
|
||||
|
||||
DELETE FROM server_items
|
||||
WHERE id = @serverItemId;
|
||||
";
|
||||
";
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand(query, conn);
|
||||
cmd.Parameters.AddWithValue("@charId", player.actorId);
|
||||
@ -1167,7 +1168,7 @@ namespace FFXIVClassic_Map_Server
|
||||
try
|
||||
{
|
||||
conn.Open();
|
||||
|
||||
|
||||
//Load Last 5 Completed
|
||||
string query = @"
|
||||
SELECT
|
||||
@ -1182,7 +1183,7 @@ namespace FFXIVClassic_Map_Server
|
||||
int count = 0;
|
||||
while (reader.Read())
|
||||
{
|
||||
uint id = reader.GetUInt32(0);
|
||||
uint id = reader.GetUInt32(0);
|
||||
latestAchievements[count++] = id;
|
||||
}
|
||||
}
|
||||
@ -1209,7 +1210,7 @@ namespace FFXIVClassic_Map_Server
|
||||
try
|
||||
{
|
||||
conn.Open();
|
||||
|
||||
|
||||
string query = @"
|
||||
SELECT packetOffsetId
|
||||
FROM characters_achievements
|
||||
@ -1221,7 +1222,7 @@ namespace FFXIVClassic_Map_Server
|
||||
using (MySqlDataReader reader = cmd.ExecuteReader())
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
{
|
||||
uint offset = reader.GetUInt32(0);
|
||||
|
||||
if (offset < 0 || offset >= cheevosPacket.achievementFlags.Length)
|
||||
@ -1229,7 +1230,7 @@ namespace FFXIVClassic_Map_Server
|
||||
Program.Log.Error("SQL Error; achievement flag offset id out of range: " + offset);
|
||||
continue;
|
||||
}
|
||||
cheevosPacket.achievementFlags[offset] = true;
|
||||
cheevosPacket.achievementFlags[offset] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1246,6 +1247,202 @@ namespace FFXIVClassic_Map_Server
|
||||
return cheevosPacket.BuildPacket(player.actorId);
|
||||
}
|
||||
|
||||
public static void SaveSupportTicket(GMSupportTicketPacket gmTicket)
|
||||
{
|
||||
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();
|
||||
|
||||
query = @"
|
||||
INSERT INTO supportdesk_tickets
|
||||
(id, title, body, langCode)
|
||||
VALUES
|
||||
(@id, @title, @body, @langCode)";
|
||||
|
||||
cmd = new MySqlCommand(query, conn);
|
||||
cmd.Parameters.AddWithValue("@id", gmTicket.ticketIssueIndex);
|
||||
cmd.Parameters.AddWithValue("@title", gmTicket.ticketTitle);
|
||||
cmd.Parameters.AddWithValue("@body", gmTicket.ticketBody);
|
||||
cmd.Parameters.AddWithValue("@langCode", gmTicket.langCode);
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
catch (MySqlException e)
|
||||
{
|
||||
Program.Log.Error(e.ToString());
|
||||
}
|
||||
finally
|
||||
{
|
||||
conn.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static string[] getFAQNames(uint lanCode = 1)
|
||||
{
|
||||
string[] faqs = null;
|
||||
List<string> raw = new List<string>();
|
||||
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
|
||||
id,
|
||||
label,
|
||||
sort
|
||||
FROM supportdesk_faqs
|
||||
ORDER BY sort";
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand(query, conn);
|
||||
|
||||
using (MySqlDataReader reader = cmd.ExecuteReader())
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
uint id = reader.GetUInt32(0);
|
||||
string label = reader.GetString(1);
|
||||
raw.Add(label);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (MySqlException e)
|
||||
{
|
||||
Program.Log.Error(e.ToString());
|
||||
}
|
||||
finally
|
||||
{
|
||||
conn.Dispose();
|
||||
faqs = raw.ToArray();
|
||||
}
|
||||
}
|
||||
return faqs;
|
||||
}
|
||||
|
||||
public static string getFAQBody(uint id, uint lanCode = 1)
|
||||
{
|
||||
string body = string.Empty;
|
||||
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
|
||||
body
|
||||
FROM supportdesk_faqs
|
||||
WHERE id=@id";
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand(query, conn);
|
||||
cmd.Parameters.AddWithValue("@id", id);
|
||||
|
||||
using (MySqlDataReader reader = cmd.ExecuteReader())
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
body = reader.GetString(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (MySqlException e)
|
||||
{
|
||||
Program.Log.Error(e.ToString());
|
||||
}
|
||||
finally
|
||||
{
|
||||
conn.Dispose();
|
||||
}
|
||||
}
|
||||
return body;
|
||||
}
|
||||
|
||||
public static string[] getIssues(uint lanCode = 1)
|
||||
{
|
||||
string[] issues = null;
|
||||
List<string> raw = new List<string>();
|
||||
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
|
||||
id,
|
||||
title,
|
||||
sort
|
||||
FROM supportdesk_issues
|
||||
ORDER BY sort";
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand(query, conn);
|
||||
|
||||
using (MySqlDataReader reader = cmd.ExecuteReader())
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
uint id = reader.GetUInt32(0);
|
||||
string label = reader.GetString(1);
|
||||
raw.Add(label);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (MySqlException e)
|
||||
{
|
||||
Program.Log.Error(e.ToString());
|
||||
}
|
||||
finally
|
||||
{
|
||||
conn.Dispose();
|
||||
issues = raw.ToArray();
|
||||
}
|
||||
}
|
||||
return issues;
|
||||
}
|
||||
|
||||
public static void IssuePlayerChocobo(Player player, byte appearanceId, string name)
|
||||
{
|
||||
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();
|
||||
|
||||
query = @"
|
||||
INSERT INTO characters_chocobo
|
||||
(characterId, hasChocobo, chocoboAppearance, chocoboName)
|
||||
VALUES
|
||||
(@characterId, @hasChocobo, @chocoboAppearance, @chocoboName)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
hasChocobo=@hasChocobo, chocoboAppearance=@chocoboAppearance, chocoboName=@chocoboName";
|
||||
|
||||
cmd = new MySqlCommand(query, conn);
|
||||
cmd.Parameters.AddWithValue("@characterId", player.actorId);
|
||||
cmd.Parameters.AddWithValue("@hasChocobo", 1);
|
||||
cmd.Parameters.AddWithValue("@chocoboAppearance", appearanceId);
|
||||
cmd.Parameters.AddWithValue("@chocoboName", name);
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
catch (MySqlException e)
|
||||
{
|
||||
Program.Log.Error(e.ToString());
|
||||
}
|
||||
finally
|
||||
{
|
||||
conn.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -123,6 +123,7 @@
|
||||
<Compile Include="lua\LuaNpc.cs" />
|
||||
<Compile Include="lua\LuaPlayer.cs" />
|
||||
<Compile Include="lua\LuaScript.cs" />
|
||||
<Compile Include="managers\SupportDeskManager.cs" />
|
||||
<Compile Include="PacketProcessor.cs" />
|
||||
<Compile Include="packets\BasePacket.cs" />
|
||||
<Compile Include="packets\receive\ChatMessagePacket.cs" />
|
||||
|
@ -17,8 +17,8 @@ using FFXIVClassic_Map_Server.packets.receive.recruitment;
|
||||
using FFXIVClassic_Map_Server.packets.send.recruitment;
|
||||
using FFXIVClassic_Map_Server.packets.receive.events;
|
||||
using FFXIVClassic_Map_Server.lua;
|
||||
using FFXIVClassic_Map_Server.Actors;
|
||||
|
||||
using FFXIVClassic_Map_Server.Actors;
|
||||
|
||||
namespace FFXIVClassic_Map_Server
|
||||
{
|
||||
class PacketProcessor
|
||||
@ -374,17 +374,17 @@ namespace FFXIVClassic_Map_Server
|
||||
//Request for FAQ/Info List
|
||||
case 0x01D0:
|
||||
FaqListRequestPacket faqRequest = new FaqListRequestPacket(subpacket.data);
|
||||
client.QueuePacket(BasePacket.CreatePacket(FaqListResponsePacket.BuildPacket(player.actorID, new string[] { "Testing FAQ1", "Coded style!" }), true, false));
|
||||
client.QueuePacket(BasePacket.CreatePacket(FaqListResponsePacket.BuildPacket(player.actorID, Database.getFAQNames(faqRequest.langCode)), true, false));
|
||||
break;
|
||||
//Request for body of a faq/info selection
|
||||
case 0x01D1:
|
||||
FaqBodyRequestPacket faqBodyRequest = new FaqBodyRequestPacket(subpacket.data);
|
||||
client.QueuePacket(BasePacket.CreatePacket(FaqBodyResponsePacket.BuildPacket(player.actorID, "HERE IS A GIANT BODY. Nothing else to say!"), true, false));
|
||||
client.QueuePacket(BasePacket.CreatePacket(FaqBodyResponsePacket.BuildPacket(player.actorID, Database.getFAQBody(faqBodyRequest.faqIndex, faqBodyRequest.langCode)), true, false));
|
||||
break;
|
||||
//Request issue list
|
||||
case 0x01D2:
|
||||
GMTicketIssuesRequestPacket issuesRequest = new GMTicketIssuesRequestPacket(subpacket.data);
|
||||
client.QueuePacket(BasePacket.CreatePacket(IssueListResponsePacket.BuildPacket(player.actorID, new string[] { "Test1", "Test2", "Test3", "Test4", "Test5" }), true, false));
|
||||
client.QueuePacket(BasePacket.CreatePacket(IssueListResponsePacket.BuildPacket(player.actorID, Database.getIssues(issuesRequest.langCode)), true, false));
|
||||
break;
|
||||
//Request if GM ticket exists
|
||||
case 0x01D3:
|
||||
@ -392,12 +392,13 @@ namespace FFXIVClassic_Map_Server
|
||||
break;
|
||||
//Request for GM response message
|
||||
case 0x01D4:
|
||||
client.QueuePacket(BasePacket.CreatePacket(GMTicketPacket.BuildPacket(player.actorID, "This is a GM Ticket Title", "This is a GM Ticket Body."), true, false));
|
||||
client.QueuePacket(BasePacket.CreatePacket(GMTicketPacket.BuildPacket(player.actorID, "Ticket Title", "Enter your Help request here."), true, false));
|
||||
break;
|
||||
//GM Ticket Sent
|
||||
case 0x01D5:
|
||||
GMSupportTicketPacket gmTicket = new GMSupportTicketPacket(subpacket.data);
|
||||
Program.Log.Info("Got GM Ticket: \n" + gmTicket.ticketTitle + "\n" + gmTicket.ticketBody);
|
||||
GMSupportTicketPacket gmTicket = new GMSupportTicketPacket(subpacket.data);
|
||||
Program.Log.Info("Got GM Ticket: \n" + gmTicket.ticketTitle + "\n" + gmTicket.ticketBody);
|
||||
Database.SaveSupportTicket(gmTicket);
|
||||
client.QueuePacket(BasePacket.CreatePacket(GMTicketSentResponsePacket.BuildPacket(player.actorID, true), true, false));
|
||||
break;
|
||||
//Request to end ticket
|
||||
|
@ -735,7 +735,5 @@ namespace FFXIVClassic_Map_Server
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,358 +1,358 @@
|
||||
using FFXIVClassic_Map_Server;
|
||||
using FFXIVClassic.Common;
|
||||
using FFXIVClassic_Map_Server.packets;
|
||||
using FFXIVClassic_Map_Server.actors.area;
|
||||
using FFXIVClassic_Map_Server.actors.chara.npc;
|
||||
using FFXIVClassic_Map_Server.dataobjects;
|
||||
using FFXIVClassic_Map_Server.dataobjects.chara;
|
||||
using FFXIVClassic_Map_Server.lua;
|
||||
using FFXIVClassic_Map_Server.packets.send.actor;
|
||||
using MoonSharp.Interpreter;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using FFXIVClassic_Map_Server;
|
||||
using FFXIVClassic.Common;
|
||||
using FFXIVClassic_Map_Server.packets;
|
||||
using FFXIVClassic_Map_Server.actors.area;
|
||||
using FFXIVClassic_Map_Server.actors.chara.npc;
|
||||
using FFXIVClassic_Map_Server.dataobjects;
|
||||
using FFXIVClassic_Map_Server.dataobjects.chara;
|
||||
using FFXIVClassic_Map_Server.lua;
|
||||
using FFXIVClassic_Map_Server.packets.send.actor;
|
||||
using MoonSharp.Interpreter;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using FFXIVClassic_Map_Server.packets.send;
|
||||
|
||||
namespace FFXIVClassic_Map_Server.Actors
|
||||
{
|
||||
class Area : Actor
|
||||
{
|
||||
public string zoneName;
|
||||
public ushort regionId;
|
||||
public bool isIsolated, canStealth, isInn, canRideChocobo, isInstanceRaid;
|
||||
public ushort weatherNormal, weatherCommon, weatherRare;
|
||||
public ushort bgmDay, bgmNight, bgmBattle;
|
||||
|
||||
protected string classPath;
|
||||
|
||||
public int boundingGridSize = 50;
|
||||
public int minX = -1000, minY = -1000, maxX = 1000, maxY = 1000;
|
||||
protected int numXBlocks, numYBlocks;
|
||||
protected int halfWidth, halfHeight;
|
||||
|
||||
protected List<SpawnLocation> mSpawnLocations = new List<SpawnLocation>();
|
||||
protected Dictionary<uint, Actor> mActorList = new Dictionary<uint, Actor>();
|
||||
protected List<Actor>[,] mActorBlock;
|
||||
|
||||
LuaScript areaScript;
|
||||
|
||||
public Area(uint id, string zoneName, ushort regionId, string className, ushort bgmDay, ushort bgmNight, ushort bgmBattle, bool isIsolated, bool isInn, bool canRideChocobo, bool canStealth, bool isInstanceRaid)
|
||||
: base(id)
|
||||
{
|
||||
|
||||
this.zoneName = zoneName;
|
||||
this.regionId = regionId;
|
||||
this.canStealth = canStealth;
|
||||
this.isIsolated = isIsolated;
|
||||
this.isInn = isInn;
|
||||
this.canRideChocobo = canRideChocobo;
|
||||
this.isInstanceRaid = isInstanceRaid;
|
||||
|
||||
this.bgmDay = bgmDay;
|
||||
this.bgmNight = bgmNight;
|
||||
this.bgmBattle = bgmBattle;
|
||||
|
||||
this.displayNameId = 0;
|
||||
this.customDisplayName = "_areaMaster";
|
||||
this.actorName = String.Format("_areaMaster@{0:X5}",id<<8);
|
||||
|
||||
this.className = className;
|
||||
|
||||
numXBlocks = (maxX - minX) / boundingGridSize;
|
||||
numYBlocks = (maxY - minY) / boundingGridSize;
|
||||
mActorBlock = new List<Actor>[numXBlocks, numYBlocks];
|
||||
halfWidth = numXBlocks / 2;
|
||||
halfHeight = numYBlocks / 2;
|
||||
|
||||
for (int y = 0; y < numYBlocks; y++)
|
||||
{
|
||||
for (int x = 0; x < numXBlocks; x++ )
|
||||
{
|
||||
mActorBlock[x, y] = new List<Actor>();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public override SubPacket CreateScriptBindPacket(uint playerActorId)
|
||||
{
|
||||
List<LuaParam> lParams;
|
||||
lParams = LuaUtils.CreateLuaParamList(classPath, false, true, zoneName, "/Area/Zone/ZoneDefault", -1, (byte)1, true, false, false, false, false, false, false, false);
|
||||
return ActorInstantiatePacket.BuildPacket(actorId, playerActorId, actorName, "ZoneDefault", lParams);
|
||||
}
|
||||
|
||||
public override BasePacket GetSpawnPackets(uint playerActorId)
|
||||
{
|
||||
List<SubPacket> subpackets = new List<SubPacket>();
|
||||
subpackets.Add(CreateAddActorPacket(playerActorId, 0));
|
||||
subpackets.Add(CreateSpeedPacket(playerActorId));
|
||||
subpackets.Add(CreateSpawnPositonPacket(playerActorId, 0x1));
|
||||
subpackets.Add(CreateNamePacket(playerActorId));
|
||||
subpackets.Add(CreateStatePacket(playerActorId));
|
||||
subpackets.Add(CreateIsZoneingPacket(playerActorId));
|
||||
subpackets.Add(CreateScriptBindPacket(playerActorId));
|
||||
return BasePacket.CreatePacket(subpackets, true, false);
|
||||
}
|
||||
|
||||
#region Actor Management
|
||||
|
||||
public void AddActorToZone(Actor actor)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
public void RemoveActorFromZone(Actor actor)
|
||||
{
|
||||
mActorList.Remove(actor.actorId);
|
||||
|
||||
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].Remove(actor);
|
||||
}
|
||||
|
||||
public void UpdateActorPosition(Actor 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;
|
||||
|
||||
int gridOldX = (int)actor.oldPositionX / boundingGridSize;
|
||||
int gridOldY = (int)actor.oldPositionZ / boundingGridSize;
|
||||
|
||||
gridOldX += halfWidth;
|
||||
gridOldY += halfHeight;
|
||||
|
||||
//Boundries
|
||||
if (gridOldX < 0)
|
||||
gridOldX = 0;
|
||||
if (gridOldX >= numXBlocks)
|
||||
gridOldX = numXBlocks - 1;
|
||||
if (gridOldY < 0)
|
||||
gridOldY = 0;
|
||||
if (gridOldY >= numYBlocks)
|
||||
gridOldY = numYBlocks - 1;
|
||||
|
||||
//Still in same block
|
||||
if (gridX == gridOldX && gridY == gridOldY)
|
||||
return;
|
||||
|
||||
lock (mActorBlock)
|
||||
{
|
||||
mActorBlock[gridOldX, gridOldY].Remove(actor);
|
||||
mActorBlock[gridX, gridY].Add(actor);
|
||||
}
|
||||
}
|
||||
|
||||
public List<Actor> GetActorsAroundPoint(float x, float y, int checkDistance)
|
||||
{
|
||||
checkDistance /= boundingGridSize;
|
||||
|
||||
int gridX = (int)x/boundingGridSize;
|
||||
int gridY = (int)y/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;
|
||||
|
||||
List<Actor> result = new List<Actor>();
|
||||
|
||||
for (int gx = gridX - checkDistance; gx <= gridX + checkDistance; gx++)
|
||||
{
|
||||
for (int gy = gridY - checkDistance; gy <= gridY + checkDistance; gy++)
|
||||
{
|
||||
result.AddRange(mActorBlock[gx, gy]);
|
||||
}
|
||||
}
|
||||
|
||||
//Remove players if isolation zone
|
||||
if (isIsolated)
|
||||
{
|
||||
for (int i = 0; i < result.Count; i++)
|
||||
{
|
||||
if (result[i] is Player)
|
||||
result.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<Actor> GetActorsAroundActor(Actor actor, int checkDistance)
|
||||
{
|
||||
checkDistance /= boundingGridSize;
|
||||
|
||||
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;
|
||||
|
||||
List<Actor> result = new List<Actor>();
|
||||
|
||||
for (int gy = ((gridY - checkDistance) < 0 ? 0 : (gridY - checkDistance)); gy <= ((gridY + checkDistance) >= numYBlocks ? numYBlocks - 1 : (gridY + checkDistance)); gy++)
|
||||
{
|
||||
for (int gx = ((gridX - checkDistance) < 0 ? 0 : (gridX - checkDistance)); gx <= ((gridX + checkDistance) >= numXBlocks ? numXBlocks - 1 : (gridX + checkDistance)); gx++)
|
||||
{
|
||||
result.AddRange(mActorBlock[gx, gy]);
|
||||
}
|
||||
}
|
||||
|
||||
//Remove players if isolation zone
|
||||
if (isIsolated)
|
||||
{
|
||||
for (int i = 0; i < result.Count; i++)
|
||||
{
|
||||
if (result[i] is Player)
|
||||
result.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public Actor FindActorInZone(uint id)
|
||||
{
|
||||
if (!mActorList.ContainsKey(id))
|
||||
return null;
|
||||
return mActorList[id];
|
||||
}
|
||||
|
||||
public Player FindPCInZone(string name)
|
||||
{
|
||||
foreach (Actor a in mActorList.Values)
|
||||
{
|
||||
if (a is Player)
|
||||
{
|
||||
if (((Player)a).customDisplayName.ToLower().Equals(name.ToLower()))
|
||||
return (Player)a;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Player FindPCInZone(uint id)
|
||||
{
|
||||
if (!mActorList.ContainsKey(id))
|
||||
return null;
|
||||
return (Player)mActorList[id];
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
//Clear All
|
||||
mActorList.Clear();
|
||||
for (int y = 0; y < numYBlocks; y++)
|
||||
{
|
||||
for (int x = 0; x < numXBlocks; x++)
|
||||
{
|
||||
mActorBlock[x, y].Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void BroadcastPacketAroundActor(Actor actor, SubPacket packet)
|
||||
{
|
||||
if (isIsolated)
|
||||
return;
|
||||
|
||||
List<Actor> aroundActor = GetActorsAroundActor(actor, 50);
|
||||
foreach (Actor a in aroundActor)
|
||||
{
|
||||
if (a is Player)
|
||||
{
|
||||
if (isIsolated && packet.header.sourceId != a.actorId)
|
||||
continue;
|
||||
|
||||
SubPacket clonedPacket = new SubPacket(packet, actor.actorId);
|
||||
Player p = (Player)a;
|
||||
p.QueuePacket(clonedPacket);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SpawnActor(SpawnLocation location)
|
||||
{
|
||||
ActorClass actorClass = Server.GetWorldManager().GetActorClass(location.classId);
|
||||
|
||||
if (actorClass == null)
|
||||
namespace FFXIVClassic_Map_Server.Actors
|
||||
{
|
||||
class Area : Actor
|
||||
{
|
||||
public string zoneName;
|
||||
public ushort regionId;
|
||||
public bool isIsolated, canStealth, isInn, canRideChocobo, isInstanceRaid;
|
||||
public ushort weatherNormal, weatherCommon, weatherRare;
|
||||
public ushort bgmDay, bgmNight, bgmBattle;
|
||||
|
||||
protected string classPath;
|
||||
|
||||
public int boundingGridSize = 50;
|
||||
public int minX = -1000, minY = -1000, maxX = 1000, maxY = 1000;
|
||||
protected int numXBlocks, numYBlocks;
|
||||
protected int halfWidth, halfHeight;
|
||||
|
||||
protected List<SpawnLocation> mSpawnLocations = new List<SpawnLocation>();
|
||||
protected Dictionary<uint, Actor> mActorList = new Dictionary<uint, Actor>();
|
||||
protected List<Actor>[,] mActorBlock;
|
||||
|
||||
LuaScript areaScript;
|
||||
|
||||
public Area(uint id, string zoneName, ushort regionId, string className, ushort bgmDay, ushort bgmNight, ushort bgmBattle, bool isIsolated, bool isInn, bool canRideChocobo, bool canStealth, bool isInstanceRaid)
|
||||
: base(id)
|
||||
{
|
||||
|
||||
this.zoneName = zoneName;
|
||||
this.regionId = regionId;
|
||||
this.canStealth = canStealth;
|
||||
this.isIsolated = isIsolated;
|
||||
this.isInn = isInn;
|
||||
this.canRideChocobo = canRideChocobo;
|
||||
this.isInstanceRaid = isInstanceRaid;
|
||||
|
||||
this.bgmDay = bgmDay;
|
||||
this.bgmNight = bgmNight;
|
||||
this.bgmBattle = bgmBattle;
|
||||
|
||||
this.displayNameId = 0;
|
||||
this.customDisplayName = "_areaMaster";
|
||||
this.actorName = String.Format("_areaMaster@{0:X5}",id<<8);
|
||||
|
||||
this.className = className;
|
||||
|
||||
numXBlocks = (maxX - minX) / boundingGridSize;
|
||||
numYBlocks = (maxY - minY) / boundingGridSize;
|
||||
mActorBlock = new List<Actor>[numXBlocks, numYBlocks];
|
||||
halfWidth = numXBlocks / 2;
|
||||
halfHeight = numYBlocks / 2;
|
||||
|
||||
for (int y = 0; y < numYBlocks; y++)
|
||||
{
|
||||
for (int x = 0; x < numXBlocks; x++ )
|
||||
{
|
||||
mActorBlock[x, y] = new List<Actor>();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public override SubPacket CreateScriptBindPacket(uint playerActorId)
|
||||
{
|
||||
List<LuaParam> lParams;
|
||||
lParams = LuaUtils.CreateLuaParamList(classPath, false, true, zoneName, "/Area/Zone/ZoneDefault", -1, (byte)1, true, false, false, false, false, false, false, false);
|
||||
return ActorInstantiatePacket.BuildPacket(actorId, playerActorId, actorName, "ZoneDefault", lParams);
|
||||
}
|
||||
|
||||
public override BasePacket GetSpawnPackets(uint playerActorId)
|
||||
{
|
||||
List<SubPacket> subpackets = new List<SubPacket>();
|
||||
subpackets.Add(CreateAddActorPacket(playerActorId, 0));
|
||||
subpackets.Add(CreateSpeedPacket(playerActorId));
|
||||
subpackets.Add(CreateSpawnPositonPacket(playerActorId, 0x1));
|
||||
subpackets.Add(CreateNamePacket(playerActorId));
|
||||
subpackets.Add(CreateStatePacket(playerActorId));
|
||||
subpackets.Add(CreateIsZoneingPacket(playerActorId));
|
||||
subpackets.Add(CreateScriptBindPacket(playerActorId));
|
||||
return BasePacket.CreatePacket(subpackets, true, false);
|
||||
}
|
||||
|
||||
#region Actor Management
|
||||
|
||||
public void AddActorToZone(Actor actor)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
public void RemoveActorFromZone(Actor actor)
|
||||
{
|
||||
mActorList.Remove(actor.actorId);
|
||||
|
||||
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].Remove(actor);
|
||||
}
|
||||
|
||||
public void UpdateActorPosition(Actor 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;
|
||||
|
||||
int gridOldX = (int)actor.oldPositionX / boundingGridSize;
|
||||
int gridOldY = (int)actor.oldPositionZ / boundingGridSize;
|
||||
|
||||
gridOldX += halfWidth;
|
||||
gridOldY += halfHeight;
|
||||
|
||||
//Boundries
|
||||
if (gridOldX < 0)
|
||||
gridOldX = 0;
|
||||
if (gridOldX >= numXBlocks)
|
||||
gridOldX = numXBlocks - 1;
|
||||
if (gridOldY < 0)
|
||||
gridOldY = 0;
|
||||
if (gridOldY >= numYBlocks)
|
||||
gridOldY = numYBlocks - 1;
|
||||
|
||||
//Still in same block
|
||||
if (gridX == gridOldX && gridY == gridOldY)
|
||||
return;
|
||||
|
||||
Npc npc = new Npc(mActorList.Count + 1, actorClass, location.uniqueId, actorId, location.x, location.y, location.z, location.rot, location.state, location.animId, null);
|
||||
npc.LoadEventConditions(actorClass.eventConditions);
|
||||
|
||||
AddActorToZone(npc);
|
||||
}
|
||||
|
||||
lock (mActorBlock)
|
||||
{
|
||||
mActorBlock[gridOldX, gridOldY].Remove(actor);
|
||||
mActorBlock[gridX, gridY].Add(actor);
|
||||
}
|
||||
}
|
||||
|
||||
public List<Actor> GetActorsAroundPoint(float x, float y, int checkDistance)
|
||||
{
|
||||
checkDistance /= boundingGridSize;
|
||||
|
||||
int gridX = (int)x/boundingGridSize;
|
||||
int gridY = (int)y/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;
|
||||
|
||||
List<Actor> result = new List<Actor>();
|
||||
|
||||
for (int gx = gridX - checkDistance; gx <= gridX + checkDistance; gx++)
|
||||
{
|
||||
for (int gy = gridY - checkDistance; gy <= gridY + checkDistance; gy++)
|
||||
{
|
||||
result.AddRange(mActorBlock[gx, gy]);
|
||||
}
|
||||
}
|
||||
|
||||
//Remove players if isolation zone
|
||||
if (isIsolated)
|
||||
{
|
||||
for (int i = 0; i < result.Count; i++)
|
||||
{
|
||||
if (result[i] is Player)
|
||||
result.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<Actor> GetActorsAroundActor(Actor actor, int checkDistance)
|
||||
{
|
||||
checkDistance /= boundingGridSize;
|
||||
|
||||
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;
|
||||
|
||||
List<Actor> result = new List<Actor>();
|
||||
|
||||
for (int gy = ((gridY - checkDistance) < 0 ? 0 : (gridY - checkDistance)); gy <= ((gridY + checkDistance) >= numYBlocks ? numYBlocks - 1 : (gridY + checkDistance)); gy++)
|
||||
{
|
||||
for (int gx = ((gridX - checkDistance) < 0 ? 0 : (gridX - checkDistance)); gx <= ((gridX + checkDistance) >= numXBlocks ? numXBlocks - 1 : (gridX + checkDistance)); gx++)
|
||||
{
|
||||
result.AddRange(mActorBlock[gx, gy]);
|
||||
}
|
||||
}
|
||||
|
||||
//Remove players if isolation zone
|
||||
if (isIsolated)
|
||||
{
|
||||
for (int i = 0; i < result.Count; i++)
|
||||
{
|
||||
if (result[i] is Player)
|
||||
result.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public Actor FindActorInZone(uint id)
|
||||
{
|
||||
if (!mActorList.ContainsKey(id))
|
||||
return null;
|
||||
return mActorList[id];
|
||||
}
|
||||
|
||||
public Player FindPCInZone(string name)
|
||||
{
|
||||
foreach (Actor a in mActorList.Values)
|
||||
{
|
||||
if (a is Player)
|
||||
{
|
||||
if (((Player)a).customDisplayName.ToLower().Equals(name.ToLower()))
|
||||
return (Player)a;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Player FindPCInZone(uint id)
|
||||
{
|
||||
if (!mActorList.ContainsKey(id))
|
||||
return null;
|
||||
return (Player)mActorList[id];
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
//Clear All
|
||||
mActorList.Clear();
|
||||
for (int y = 0; y < numYBlocks; y++)
|
||||
{
|
||||
for (int x = 0; x < numXBlocks; x++)
|
||||
{
|
||||
mActorBlock[x, y].Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void BroadcastPacketAroundActor(Actor actor, SubPacket packet)
|
||||
{
|
||||
if (isIsolated)
|
||||
return;
|
||||
|
||||
List<Actor> aroundActor = GetActorsAroundActor(actor, 50);
|
||||
foreach (Actor a in aroundActor)
|
||||
{
|
||||
if (a is Player)
|
||||
{
|
||||
if (isIsolated && packet.header.sourceId != a.actorId)
|
||||
continue;
|
||||
|
||||
SubPacket clonedPacket = new SubPacket(packet, actor.actorId);
|
||||
Player p = (Player)a;
|
||||
p.QueuePacket(clonedPacket);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SpawnActor(SpawnLocation location)
|
||||
{
|
||||
ActorClass actorClass = Server.GetWorldManager().GetActorClass(location.classId);
|
||||
|
||||
if (actorClass == null)
|
||||
return;
|
||||
|
||||
Npc npc = new Npc(mActorList.Count + 1, actorClass, location.uniqueId, actorId, location.x, location.y, location.z, location.rot, location.state, location.animId, null);
|
||||
npc.LoadEventConditions(actorClass.eventConditions);
|
||||
|
||||
AddActorToZone(npc);
|
||||
}
|
||||
|
||||
public void ChangeWeather(ushort weather, ushort transitionTime, Player player, bool zoneWide = false)
|
||||
{
|
||||
weatherNormal = weather;
|
||||
@ -372,6 +372,6 @@ namespace FFXIVClassic_Map_Server.Actors
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -48,8 +48,8 @@ namespace FFXIVClassic_Map_Server.Actors
|
||||
|
||||
LoadNpcAppearance(actorClass.actorClassId);
|
||||
|
||||
this.classPath = actorClass.classPath;
|
||||
className = classPath.Substring(classPath.LastIndexOf("/")+1);
|
||||
className = actorClass.classPath.Substring(actorClass.classPath.LastIndexOf("/") + 1);
|
||||
this.classPath = String.Format("{0}/{1}", actorClass.classPath.Substring(0, actorClass.classPath.LastIndexOf('/')).ToLower(), className);
|
||||
|
||||
charaWork.battleSave.potencial = 1.0f;
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -25,6 +25,11 @@ namespace FFXIVClassic_Map_Server.lua
|
||||
player.playerSession.QueuePacket(SetWeatherPacket.BuildPacket(player.actorId, weatherID, 1), true, false);
|
||||
}
|
||||
|
||||
public void IssueChocobo(int appearanceId, string name)
|
||||
{
|
||||
player.IssueChocobo((byte) appearanceId, name);
|
||||
}
|
||||
|
||||
public void GetParameter(string paramName)
|
||||
{
|
||||
|
||||
|
@ -21,11 +21,79 @@ end
|
||||
|
||||
function onEventStarted(player, npc, triggerName)
|
||||
|
||||
--callClientFunction(player, "eventTalkWelcome", player);
|
||||
callClientFunction(player, "eventAskMainMenu", player, 20, true, true, true, true, 4);
|
||||
callClientFunction(player, "eventTalkMyChocobo", player);
|
||||
callClientFunction(player, "eventSetChocoboName", false);
|
||||
callClientFunction(player, "eventAfterChocoboName", player);
|
||||
|
||||
local curLevel = 20; -- TODO: pull from character
|
||||
local hasIssuance = true; -- TODO: pull from character
|
||||
local hasChocobo = player.hasChocobo;
|
||||
|
||||
if (player.isGM and hasChocobo == false) then -- Let GMs auto have the issuance for debugging
|
||||
hasIssuance = true;
|
||||
end
|
||||
|
||||
if (hasChocobo) then
|
||||
hasIssuance = false;
|
||||
end
|
||||
|
||||
local rentPrice = 800;
|
||||
local playerFunds = 0; --TODO: pull character's money
|
||||
local hasFunds = (playerFunds >= rentPrice);
|
||||
|
||||
callClientFunction(player, "eventTalkWelcome", player);
|
||||
local menuChoice = callClientFunction(player, "eventAskMainMenu", player, curLevel, hasFunds, hasIssuance, hasChocobo, hasChocobo, 4);
|
||||
|
||||
if (menuChoice == 1) then -- Issuance option
|
||||
callClientFunction(player, "eventTalkMyChocobo", player);
|
||||
local nameResponse = callClientFunction(player, "eventSetChocoboName", false);
|
||||
|
||||
if (nameResponse == "") then -- Cancel Chocobo naming
|
||||
local cancelState = callClientFunction(player, "eventCancelChocoboName", player);
|
||||
--Do anything with cancel state?
|
||||
end
|
||||
|
||||
local appearance = 1; -- TODO: pull correct appearance based on GC
|
||||
player:IssueChocobo(appearance, nameResponse);
|
||||
if (nameResponse ~= "") then -- Successfully named Chocobo
|
||||
callClientFunction(player, "eventAfterChocoboName", player);
|
||||
end
|
||||
|
||||
mountChocobo(player);
|
||||
teleportOutOfCity(player);
|
||||
elseif(menuChoice == 2) then -- Summon Bird
|
||||
mountChocobo(player);
|
||||
teleportOutOfCity(player);
|
||||
elseif(menuChoice == 3) then -- Change Barding
|
||||
callClientFunction(player, "eventTalkStepBreak", player);
|
||||
elseif(menuChoice == 5) then -- Rent Bird
|
||||
if (hasFunds == false) then -- Not enough money
|
||||
-- Do not enough money action??
|
||||
else
|
||||
--Issue rental chocobo
|
||||
end
|
||||
else
|
||||
callClientFunction(player, "eventTalkStepBreak", player);
|
||||
end
|
||||
|
||||
player:EndEvent();
|
||||
end
|
||||
|
||||
function mountChocobo(player)
|
||||
--TODO fix this
|
||||
--[[
|
||||
player:ChangeMusic(83);
|
||||
player:SendChocoboAppearance();
|
||||
player:SendGameMessage(player, worldMaster, 26001, 0x20);
|
||||
player:SetMountState(1);
|
||||
]]
|
||||
end
|
||||
|
||||
function teleportOutOfCity(player)
|
||||
--TODO: Teleport out of city
|
||||
local zoneId = player:GetPos()[4];
|
||||
local worldManager = GetWorldManager();
|
||||
if(zoneId == 155) then --Gridania
|
||||
worldManager:DoZoneChange(player, 150, nil, 0x02, 319, 4, -996, 0.00);
|
||||
elseif(zoneId == 133) then -- Limsa
|
||||
worldManager:DoZoneChange(player, 133, nil, 0x02, -73, 30, 169, 2);
|
||||
elseif(zoneId == 175) then -- Ul'dah
|
||||
|
||||
end
|
||||
end
|
53
sql/supportdesk_faqs.sql
Normal file
53
sql/supportdesk_faqs.sql
Normal file
@ -0,0 +1,53 @@
|
||||
-- MySQL dump 10.13 Distrib 5.7.13, for Linux (x86_64)
|
||||
--
|
||||
-- Host: localhost Database: ffxiv
|
||||
-- ------------------------------------------------------
|
||||
-- Server version 5.7.13-0ubuntu0.16.04.2
|
||||
|
||||
/*!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 `supportdesk_faqs`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `supportdesk_faqs`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `supportdesk_faqs` (
|
||||
`id` int(10) NOT NULL,
|
||||
`label` varchar(50) NOT NULL,
|
||||
`body` varchar(50) NOT NULL,
|
||||
`sort` int(11) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `supportdesk_faqs`
|
||||
--
|
||||
|
||||
LOCK TABLES `supportdesk_faqs` WRITE;
|
||||
/*!40000 ALTER TABLE `supportdesk_faqs` DISABLE KEYS */;
|
||||
INSERT INTO `supportdesk_faqs` VALUES (1,'Testing','Testy Test FAQ!',1);
|
||||
/*!40000 ALTER TABLE `supportdesk_faqs` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
/*!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 2016-08-19 5:05:33
|
54
sql/supportdesk_issues.sql
Normal file
54
sql/supportdesk_issues.sql
Normal file
@ -0,0 +1,54 @@
|
||||
-- MySQL dump 10.13 Distrib 5.7.13, for Linux (x86_64)
|
||||
--
|
||||
-- Host: localhost Database: ffxiv
|
||||
-- ------------------------------------------------------
|
||||
-- Server version 5.7.13-0ubuntu0.16.04.2
|
||||
|
||||
/*!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 `supportdesk_issues`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `supportdesk_issues`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `supportdesk_issues` (
|
||||
`id` int(11) NOT NULL,
|
||||
`title` varchar(50) NOT NULL,
|
||||
`sort` int(11) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `supportdesk_issues`
|
||||
--
|
||||
|
||||
LOCK TABLES `supportdesk_issues` WRITE;
|
||||
/*!40000 ALTER TABLE `supportdesk_issues` DISABLE KEYS */;
|
||||
INSERT INTO `supportdesk_issues` VALUES (1,'Report Harassment',1);
|
||||
INSERT INTO `supportdesk_issues` VALUES (2,'Report Cheating',2);
|
||||
INSERT INTO `supportdesk_issues` VALUES (3,'Leave Suggestion',3);
|
||||
/*!40000 ALTER TABLE `supportdesk_issues` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
/*!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 2016-08-19 5:05:51
|
52
sql/supportdesk_tickets.sql
Normal file
52
sql/supportdesk_tickets.sql
Normal file
@ -0,0 +1,52 @@
|
||||
-- MySQL dump 10.13 Distrib 5.7.13, for Linux (x86_64)
|
||||
--
|
||||
-- Host: localhost Database: ffxiv
|
||||
-- ------------------------------------------------------
|
||||
-- Server version 5.7.13-0ubuntu0.16.04.2
|
||||
|
||||
/*!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 `supportdesk_tickets`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `supportdesk_tickets`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `supportdesk_tickets` (
|
||||
`id` int(20) NOT NULL,
|
||||
`title` varchar(100) NOT NULL,
|
||||
`body` varchar(100) NOT NULL,
|
||||
`langCode` varchar(10) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `supportdesk_tickets`
|
||||
--
|
||||
|
||||
LOCK TABLES `supportdesk_tickets` WRITE;
|
||||
/*!40000 ALTER TABLE `supportdesk_tickets` DISABLE KEYS */;
|
||||
/*!40000 ALTER TABLE `supportdesk_tickets` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
/*!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 2016-08-19 5:06:23
|
Loading…
Reference in New Issue
Block a user