mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-19 16:31:29 +00:00
[Bug Fix] Fix #set faction/#setfaction Command (#3575)
# Notes - This was an oversight on my part in `#set` command consolidation.
This commit is contained in:
parent
9c3498b431
commit
ca933fce45
@ -13,6 +13,7 @@
|
|||||||
#include "set/endurance.cpp"
|
#include "set/endurance.cpp"
|
||||||
#include "set/endurance_full.cpp"
|
#include "set/endurance_full.cpp"
|
||||||
#include "set/exp.cpp"
|
#include "set/exp.cpp"
|
||||||
|
#include "set/faction.cpp"
|
||||||
#include "set/flymode.cpp"
|
#include "set/flymode.cpp"
|
||||||
#include "set/frozen.cpp"
|
#include "set/frozen.cpp"
|
||||||
#include "set/gender.cpp"
|
#include "set/gender.cpp"
|
||||||
@ -79,6 +80,7 @@ void command_set(Client *c, const Seperator *sep)
|
|||||||
Cmd{.cmd = "endurance", .u = "endurance [Amount]", .fn = SetEndurance, .a = {"#setendurance"}},
|
Cmd{.cmd = "endurance", .u = "endurance [Amount]", .fn = SetEndurance, .a = {"#setendurance"}},
|
||||||
Cmd{.cmd = "endurance_full", .u = "endurance_full", .fn = SetEnduranceFull, .a = {"#endurance"}},
|
Cmd{.cmd = "endurance_full", .u = "endurance_full", .fn = SetEnduranceFull, .a = {"#endurance"}},
|
||||||
Cmd{.cmd = "exp", .u = "exp [aa|exp] [Amount]", .fn = SetEXP, .a = {"#setxp"}},
|
Cmd{.cmd = "exp", .u = "exp [aa|exp] [Amount]", .fn = SetEXP, .a = {"#setxp"}},
|
||||||
|
Cmd{.cmd = "faction", .u = "faction [Faction ID]", .fn = SetFaction, .a = {"#setfaction"}},
|
||||||
Cmd{.cmd = "flymode", .u = "flymode [Flymode ID]", .fn = SetFlymode, .a = {"#flymode"}},
|
Cmd{.cmd = "flymode", .u = "flymode [Flymode ID]", .fn = SetFlymode, .a = {"#flymode"}},
|
||||||
Cmd{.cmd = "frozen", .u = "frozen [on|off]", .fn = SetFrozen, .a = {"#freeze", "#unfreeze"}},
|
Cmd{.cmd = "frozen", .u = "frozen [on|off]", .fn = SetFrozen, .a = {"#freeze", "#unfreeze"}},
|
||||||
Cmd{.cmd = "gender", .u = "gender [Gender ID]", .fn = SetGender, .a = {"#gender"}},
|
Cmd{.cmd = "gender", .u = "gender [Gender ID]", .fn = SetGender, .a = {"#gender"}},
|
||||||
|
|||||||
54
zone/gm_commands/set/faction.cpp
Executable file
54
zone/gm_commands/set/faction.cpp
Executable file
@ -0,0 +1,54 @@
|
|||||||
|
#include "../../client.h"
|
||||||
|
|
||||||
|
void SetFaction(Client *c, const Seperator *sep)
|
||||||
|
{
|
||||||
|
const auto arguments = sep->argnum;
|
||||||
|
if (arguments < 2 || !sep->IsNumber(2)) {
|
||||||
|
c->Message(Chat::White, "Usage: #set faction [Faction ID]");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
!c->GetTarget() ||
|
||||||
|
(
|
||||||
|
c->GetTarget() &&
|
||||||
|
c->GetTarget()->IsClient()
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
c->Message(Chat::White, "You must target an NPC to use this command.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
NPC* t = c->GetTarget()->CastToNPC();
|
||||||
|
|
||||||
|
const uint32 npc_id = t->GetNPCTypeID();
|
||||||
|
const int faction_id = Strings::ToInt(sep->arg[2]);
|
||||||
|
|
||||||
|
const std::string& faction_name = content_db.GetFactionName(faction_id);
|
||||||
|
|
||||||
|
if (faction_name.empty()) {
|
||||||
|
c->Message(
|
||||||
|
Chat::White,
|
||||||
|
"Invalid Faction ID, please specify a valid Faction ID."
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
c->Message(
|
||||||
|
Chat::White,
|
||||||
|
fmt::format(
|
||||||
|
"Faction Changed | Name: {} ({}) Faction: {} ({}).",
|
||||||
|
t->GetCleanName(),
|
||||||
|
npc_id,
|
||||||
|
content_db.GetFactionName(faction_id),
|
||||||
|
faction_id
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
|
|
||||||
|
const std::string &query = fmt::format(
|
||||||
|
"UPDATE npc_types SET npc_faction_id = {} WHERE id = {}",
|
||||||
|
faction_id,
|
||||||
|
npc_id
|
||||||
|
);
|
||||||
|
content_db.QueryDatabase(query);
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user