mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-02 19:42:05 -04:00
Added npc ls saving/functionality.
This commit is contained in:
parent
3d4bf3465b
commit
90e48f9ddd
@ -1385,6 +1385,45 @@ namespace FFXIVClassic_Map_Server
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void SaveNpcLS(Player player, uint npcLSId, bool isCalling, bool isExtra)
|
||||||
|
{
|
||||||
|
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_npclinkshell
|
||||||
|
(characterId, npcLinkshellId, isCalling, isExtra)
|
||||||
|
VALUES
|
||||||
|
(@charaId, @lsId, @calling, @extra)
|
||||||
|
ON DUPLICATE KEY UPDATE
|
||||||
|
characterId = @charaId, npcLinkshellId = @lsId, isCalling = @calling, isExtra = @extra
|
||||||
|
";
|
||||||
|
|
||||||
|
cmd = new MySqlCommand(query, conn);
|
||||||
|
cmd.Parameters.AddWithValue("@charaId", player.actorId);
|
||||||
|
cmd.Parameters.AddWithValue("@lsId", npcLSId);
|
||||||
|
cmd.Parameters.AddWithValue("@calling", isCalling ? 1 : 0);
|
||||||
|
cmd.Parameters.AddWithValue("@extra", isExtra ? 1 : 0);
|
||||||
|
|
||||||
|
cmd.ExecuteNonQuery();
|
||||||
|
}
|
||||||
|
catch (MySqlException e)
|
||||||
|
{
|
||||||
|
Program.Log.Error(e.ToString());
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
conn.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1254,6 +1254,19 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetNpcLS(uint npcLSId, bool isCalling, bool isExtra)
|
||||||
|
{
|
||||||
|
playerWork.npcLinkshellChatExtra[npcLSId] = isExtra;
|
||||||
|
playerWork.npcLinkshellChatCalling[npcLSId] = isCalling;
|
||||||
|
|
||||||
|
Database.SaveNpcLS(this, npcLSId, isCalling, isExtra);
|
||||||
|
|
||||||
|
ActorPropertyPacketUtil propPacketUtil = new ActorPropertyPacketUtil("playerWork/npcLinkshellChat", this, actorId);
|
||||||
|
propPacketUtil.AddProperty(String.Format("playerWork.npcLinkshellChatExtra[{0}]", npcLSId));
|
||||||
|
propPacketUtil.AddProperty(String.Format("playerWork.npcLinkshellChatCalling[{0}]", npcLSId));
|
||||||
|
QueuePackets(propPacketUtil.Done());
|
||||||
|
}
|
||||||
|
|
||||||
private void SendQuestClientUpdate(int slot)
|
private void SendQuestClientUpdate(int slot)
|
||||||
{
|
{
|
||||||
ActorPropertyPacketUtil propPacketUtil = new ActorPropertyPacketUtil("playerWork/journal", this, actorId);
|
ActorPropertyPacketUtil propPacketUtil = new ActorPropertyPacketUtil("playerWork/journal", this, actorId);
|
||||||
|
27
data/scripts/commands/gm/setnpcls.lua
Normal file
27
data/scripts/commands/gm/setnpcls.lua
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
require("global");
|
||||||
|
|
||||||
|
properties = {
|
||||||
|
permissions = 0,
|
||||||
|
parameters = "is",
|
||||||
|
description = "Sets a NPC LS' state. Args: npcLSId, <gone|inactive|active|alert>",
|
||||||
|
}
|
||||||
|
|
||||||
|
function onTrigger(player, argc, lsId, state)
|
||||||
|
local id = tonumber(lsId) or 0;
|
||||||
|
|
||||||
|
if (state == "alert") then
|
||||||
|
player:SetNpcLS(id, true, true);
|
||||||
|
elseif (state == "active") then
|
||||||
|
player:SetNpcLS(id, true, false);
|
||||||
|
elseif (state == "inactive") then
|
||||||
|
player:SetNpcLS(id, false, true);
|
||||||
|
elseif (state == "gone") then
|
||||||
|
player:SetNpcLS(id, false, false);
|
||||||
|
else
|
||||||
|
player:SendMessage(0x20, "", "Invalid state argument");
|
||||||
|
return;
|
||||||
|
end
|
||||||
|
|
||||||
|
player:SendMessage(0x20, "", string.format("NPC LS %d set to %s", id, state));
|
||||||
|
|
||||||
|
end
|
Loading…
Reference in New Issue
Block a user