[Commands] Add #find ldon_theme Subcommand (#4564)

This commit is contained in:
Alex King 2024-12-12 02:27:25 -05:00 committed by GitHub
parent 0f164c456e
commit 3f3c0f2fda
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 194 additions and 125 deletions

View File

@ -140,29 +140,6 @@ std::string EQ::constants::GetLanguageName(uint8 language_id)
return EQ::constants::GetLanguageMap().find(language_id)->second; return EQ::constants::GetLanguageMap().find(language_id)->second;
} }
const std::map<uint32, std::string>& EQ::constants::GetLDoNThemeMap()
{
static const std::map<uint32, std::string> ldon_theme_map = {
{ LDoNThemes::Unused, "Unused" },
{ LDoNThemes::GUK, "Deepest Guk" },
{ LDoNThemes::MIR, "Miragul's Menagerie" },
{ LDoNThemes::MMC, "Mistmoore Catacombs" },
{ LDoNThemes::RUJ, "Rujarkian Hills" },
{ LDoNThemes::TAK, "Takish-Hiz" },
};
return ldon_theme_map;
}
std::string EQ::constants::GetLDoNThemeName(uint32 theme_id)
{
if (!EQ::ValueWithin(theme_id, LDoNThemes::Unused, LDoNThemes::TAK)) {
return std::string();
}
return EQ::constants::GetLDoNThemeMap().find(theme_id)->second;
}
const std::map<int8, std::string>& EQ::constants::GetFlyModeMap() const std::map<int8, std::string>& EQ::constants::GetFlyModeMap()
{ {
static const std::map<int8, std::string> flymode_map = { static const std::map<int8, std::string> flymode_map = {
@ -459,3 +436,18 @@ bool ComparisonType::IsValid(uint8 type)
{ {
return comparison_types.find(type) != comparison_types.end(); return comparison_types.find(type) != comparison_types.end();
} }
uint32 LDoNTheme::GetBitmask(uint32 theme_id)
{
return IsValid(theme_id) ? ldon_theme_names[theme_id].second : LDoNTheme::UnusedBit;
}
std::string LDoNTheme::GetName(uint32 theme_id)
{
return IsValid(theme_id) ? ldon_theme_names[theme_id].first : "UNKNOWN LDON THEME";
}
bool LDoNTheme::IsValid(uint32 theme_id)
{
return ldon_theme_names.find(theme_id) != ldon_theme_names.end();
}

View File

@ -352,9 +352,6 @@ namespace EQ
extern const std::map<uint8, std::string>& GetLanguageMap(); extern const std::map<uint8, std::string>& GetLanguageMap();
std::string GetLanguageName(uint8 language_id); std::string GetLanguageName(uint8 language_id);
extern const std::map<uint32, std::string>& GetLDoNThemeMap();
std::string GetLDoNThemeName(uint32 theme_id);
extern const std::map<int8, std::string>& GetFlyModeMap(); extern const std::map<int8, std::string>& GetFlyModeMap();
std::string GetFlyModeName(int8 flymode_id); std::string GetFlyModeName(int8 flymode_id);
@ -751,6 +748,35 @@ static std::map<uint32, std::string> stance_names = {
{ Stance::AEBurn, "AE Burn" } { Stance::AEBurn, "AE Burn" }
}; };
namespace LDoNTheme {
constexpr uint32 Unused = 0;
constexpr uint32 GUK = 1;
constexpr uint32 MIR = 2;
constexpr uint32 MMC = 3;
constexpr uint32 RUJ = 4;
constexpr uint32 TAK = 5;
constexpr uint32 UnusedBit = 0;
constexpr uint32 GUKBit = 1;
constexpr uint32 MIRBit = 2;
constexpr uint32 MMCBit = 4;
constexpr uint32 RUJBit = 8;
constexpr uint32 TAKBit = 16;
uint32 GetBitmask(uint32 theme_id);
std::string GetName(uint32 theme_id);
bool IsValid(uint32 theme_id);
}
static std::map<uint32, std::pair<std::string, uint32>> ldon_theme_names = {
{ LDoNTheme::Unused, { "Unused", LDoNTheme::UnusedBit }, },
{ LDoNTheme::GUK, { "Deepest Guk", LDoNTheme::GUKBit }, },
{ LDoNTheme::MIR, { "Miragul's Menagerie", LDoNTheme::MIRBit }, },
{ LDoNTheme::MMC, { "Mistmoore Catacombs", LDoNTheme::MMCBit }, },
{ LDoNTheme::RUJ, { "Rujarkian Hills", LDoNTheme::RUJBit }, },
{ LDoNTheme::TAK, { "Takish-Hiz", LDoNTheme::TAKBit }, },
};
namespace PCNPCOnlyFlagType { namespace PCNPCOnlyFlagType {
constexpr int PC = 1; constexpr int PC = 1;
constexpr int NPC = 2; constexpr int NPC = 2;

View File

@ -993,24 +993,6 @@ enum class DynamicZoneMemberStatus : uint8_t
LinkDead LinkDead
}; };
enum LDoNThemes {
Unused = 0,
GUK,
MIR,
MMC,
RUJ,
TAK
};
enum LDoNThemeBits {
UnusedBit = 0,
GUKBit = 1,
MIRBit = 2,
MMCBit = 4,
RUJBit = 8,
TAKBit = 16
};
enum StartZoneIndex { enum StartZoneIndex {
Odus = 0, Odus = 0,
Qeynos, Qeynos,

View File

@ -49,23 +49,23 @@ public:
std::string field; std::string field;
switch (theme_id) { switch (theme_id) {
case LDoNThemes::GUK: { case LDoNTheme::GUK: {
field = "guk_"; field = "guk_";
break; break;
} }
case LDoNThemes::MIR: { case LDoNTheme::MIR: {
field = "mir_"; field = "mir_";
break; break;
} }
case LDoNThemes::MMC: { case LDoNTheme::MMC: {
field = "mmc_"; field = "mmc_";
break; break;
} }
case LDoNThemes::RUJ: { case LDoNTheme::RUJ: {
field = "ruj_"; field = "ruj_";
break; break;
} }
case LDoNThemes::TAK: { case LDoNTheme::TAK: {
field = "tak_"; field = "tak_";
break; break;
} }

View File

@ -329,7 +329,7 @@ Client::Client(EQStreamInterface *ieqs) : Mob(
adventure_stats_timer = nullptr; adventure_stats_timer = nullptr;
adventure_leaderboard_timer = nullptr; adventure_leaderboard_timer = nullptr;
adv_data = nullptr; adv_data = nullptr;
adv_requested_theme = LDoNThemes::Unused; adv_requested_theme = LDoNTheme::Unused;
adv_requested_id = 0; adv_requested_id = 0;
adv_requested_member_count = 0; adv_requested_member_count = 0;
@ -1469,7 +1469,7 @@ bool Client::UpdateLDoNPoints(uint32 theme_id, int points)
bool is_loss = false; bool is_loss = false;
switch (theme_id) { switch (theme_id) {
case LDoNThemes::Unused: { // No theme, so distribute evenly across all case LDoNTheme::Unused: { // No theme, so distribute evenly across all
int split_points = (points / 5); int split_points = (points / 5);
int guk_points = (split_points + (points % 5)); int guk_points = (split_points + (points % 5));
@ -1522,12 +1522,12 @@ bool Client::UpdateLDoNPoints(uint32 theme_id, int points)
points -= split_points; points -= split_points;
if (split_points != 0) { // if anything left, recursively loop thru again if (split_points != 0) { // if anything left, recursively loop thru again
UpdateLDoNPoints(LDoNThemes::Unused, split_points); UpdateLDoNPoints(LDoNTheme::Unused, split_points);
} }
break; break;
} }
case LDoNThemes::GUK: { case LDoNTheme::GUK: {
if (points < 0) { if (points < 0) {
if (m_pp.ldon_points_guk < (0 - points)) { if (m_pp.ldon_points_guk < (0 - points)) {
return false; return false;
@ -1539,7 +1539,7 @@ bool Client::UpdateLDoNPoints(uint32 theme_id, int points)
m_pp.ldon_points_guk += points; m_pp.ldon_points_guk += points;
break; break;
} }
case LDoNThemes::MIR: { case LDoNTheme::MIR: {
if (points < 0) { if (points < 0) {
if (m_pp.ldon_points_mir < (0 - points)) { if (m_pp.ldon_points_mir < (0 - points)) {
return false; return false;
@ -1551,7 +1551,7 @@ bool Client::UpdateLDoNPoints(uint32 theme_id, int points)
m_pp.ldon_points_mir += points; m_pp.ldon_points_mir += points;
break; break;
} }
case LDoNThemes::MMC: { case LDoNTheme::MMC: {
if (points < 0) { if (points < 0) {
if (m_pp.ldon_points_mmc < (0 - points)) { if (m_pp.ldon_points_mmc < (0 - points)) {
return false; return false;
@ -1563,7 +1563,7 @@ bool Client::UpdateLDoNPoints(uint32 theme_id, int points)
m_pp.ldon_points_mmc += points; m_pp.ldon_points_mmc += points;
break; break;
} }
case LDoNThemes::RUJ: { case LDoNTheme::RUJ: {
if (points < 0) { if (points < 0) {
if (m_pp.ldon_points_ruj < (0 - points)) { if (m_pp.ldon_points_ruj < (0 - points)) {
return false; return false;
@ -1575,7 +1575,7 @@ bool Client::UpdateLDoNPoints(uint32 theme_id, int points)
m_pp.ldon_points_ruj += points; m_pp.ldon_points_ruj += points;
break; break;
} }
case LDoNThemes::TAK: { case LDoNTheme::TAK: {
if (points < 0) { if (points < 0) {
if (m_pp.ldon_points_tak < (0 - points)) { if (m_pp.ldon_points_tak < (0 - points)) {
return false; return false;
@ -1623,23 +1623,23 @@ bool Client::UpdateLDoNPoints(uint32 theme_id, int points)
void Client::SetLDoNPoints(uint32 theme_id, uint32 points) void Client::SetLDoNPoints(uint32 theme_id, uint32 points)
{ {
switch (theme_id) { switch (theme_id) {
case LDoNThemes::GUK: { case LDoNTheme::GUK: {
m_pp.ldon_points_guk = points; m_pp.ldon_points_guk = points;
break; break;
} }
case LDoNThemes::MIR: { case LDoNTheme::MIR: {
m_pp.ldon_points_mir = points; m_pp.ldon_points_mir = points;
break; break;
} }
case LDoNThemes::MMC: { case LDoNTheme::MMC: {
m_pp.ldon_points_mmc = points; m_pp.ldon_points_mmc = points;
break; break;
} }
case LDoNThemes::RUJ: { case LDoNTheme::RUJ: {
m_pp.ldon_points_ruj = points; m_pp.ldon_points_ruj = points;
break; break;
} }
case LDoNThemes::TAK: { case LDoNTheme::TAK: {
m_pp.ldon_points_tak = points; m_pp.ldon_points_tak = points;
break; break;
} }
@ -5676,15 +5676,15 @@ uint32 Client::GetLDoNPointsTheme(uint32 t)
{ {
switch(t) switch(t)
{ {
case LDoNThemes::GUK: case LDoNTheme::GUK:
return m_pp.ldon_points_guk; return m_pp.ldon_points_guk;
case LDoNThemes::MIR: case LDoNTheme::MIR:
return m_pp.ldon_points_mir; return m_pp.ldon_points_mir;
case LDoNThemes::MMC: case LDoNTheme::MMC:
return m_pp.ldon_points_mmc; return m_pp.ldon_points_mmc;
case LDoNThemes::RUJ: case LDoNTheme::RUJ:
return m_pp.ldon_points_ruj; return m_pp.ldon_points_ruj;
case LDoNThemes::TAK: case LDoNTheme::TAK:
return m_pp.ldon_points_tak; return m_pp.ldon_points_tak;
default: default:
return 0; return 0;
@ -5695,15 +5695,15 @@ uint32 Client::GetLDoNWinsTheme(uint32 t)
{ {
switch(t) switch(t)
{ {
case LDoNThemes::GUK: case LDoNTheme::GUK:
return m_pp.ldon_wins_guk; return m_pp.ldon_wins_guk;
case LDoNThemes::MIR: case LDoNTheme::MIR:
return m_pp.ldon_wins_mir; return m_pp.ldon_wins_mir;
case LDoNThemes::MMC: case LDoNTheme::MMC:
return m_pp.ldon_wins_mmc; return m_pp.ldon_wins_mmc;
case LDoNThemes::RUJ: case LDoNTheme::RUJ:
return m_pp.ldon_wins_ruj; return m_pp.ldon_wins_ruj;
case LDoNThemes::TAK: case LDoNTheme::TAK:
return m_pp.ldon_wins_tak; return m_pp.ldon_wins_tak;
default: default:
return 0; return 0;
@ -5714,15 +5714,15 @@ uint32 Client::GetLDoNLossesTheme(uint32 t)
{ {
switch(t) switch(t)
{ {
case LDoNThemes::GUK: case LDoNTheme::GUK:
return m_pp.ldon_losses_guk; return m_pp.ldon_losses_guk;
case LDoNThemes::MIR: case LDoNTheme::MIR:
return m_pp.ldon_losses_mir; return m_pp.ldon_losses_mir;
case LDoNThemes::MMC: case LDoNTheme::MMC:
return m_pp.ldon_losses_mmc; return m_pp.ldon_losses_mmc;
case LDoNThemes::RUJ: case LDoNTheme::RUJ:
return m_pp.ldon_losses_ruj; return m_pp.ldon_losses_ruj;
case LDoNThemes::TAK: case LDoNTheme::TAK:
return m_pp.ldon_losses_tak; return m_pp.ldon_losses_tak;
default: default:
return 0; return 0;
@ -5731,35 +5731,35 @@ uint32 Client::GetLDoNLossesTheme(uint32 t)
void Client::UpdateLDoNWinLoss(uint32 theme_id, bool win, bool remove) { void Client::UpdateLDoNWinLoss(uint32 theme_id, bool win, bool remove) {
switch (theme_id) { switch (theme_id) {
case LDoNThemes::GUK: case LDoNTheme::GUK:
if (win) { if (win) {
m_pp.ldon_wins_guk += (remove ? -1 : 1); m_pp.ldon_wins_guk += (remove ? -1 : 1);
} else { } else {
m_pp.ldon_losses_guk += (remove ? -1 : 1); m_pp.ldon_losses_guk += (remove ? -1 : 1);
} }
break; break;
case LDoNThemes::MIR: case LDoNTheme::MIR:
if (win) { if (win) {
m_pp.ldon_wins_mir += (remove ? -1 : 1); m_pp.ldon_wins_mir += (remove ? -1 : 1);
} else { } else {
m_pp.ldon_losses_mir += (remove ? -1 : 1); m_pp.ldon_losses_mir += (remove ? -1 : 1);
} }
break; break;
case LDoNThemes::MMC: case LDoNTheme::MMC:
if (win) { if (win) {
m_pp.ldon_wins_mmc += (remove ? -1 : 1); m_pp.ldon_wins_mmc += (remove ? -1 : 1);
} else { } else {
m_pp.ldon_losses_mmc += (remove ? -1 : 1); m_pp.ldon_losses_mmc += (remove ? -1 : 1);
} }
break; break;
case LDoNThemes::RUJ: case LDoNTheme::RUJ:
if (win) { if (win) {
m_pp.ldon_wins_ruj += (remove ? -1 : 1); m_pp.ldon_wins_ruj += (remove ? -1 : 1);
} else { } else {
m_pp.ldon_losses_ruj += (remove ? -1 : 1); m_pp.ldon_losses_ruj += (remove ? -1 : 1);
} }
break; break;
case LDoNThemes::TAK: case LDoNTheme::TAK:
if (win) { if (win) {
m_pp.ldon_wins_tak += (remove ? -1 : 1); m_pp.ldon_wins_tak += (remove ? -1 : 1);
} else { } else {
@ -6227,7 +6227,7 @@ void Client::NewAdventure(int id, int theme, const char *text, int member_count,
void Client::ClearPendingAdventureData() void Client::ClearPendingAdventureData()
{ {
adv_requested_id = 0; adv_requested_id = 0;
adv_requested_theme = LDoNThemes::Unused; adv_requested_theme = LDoNTheme::Unused;
safe_delete_array(adv_requested_data); safe_delete_array(adv_requested_data);
adv_requested_member_count = 0; adv_requested_member_count = 0;
} }

View File

@ -2019,38 +2019,38 @@ void Client::Handle_OP_AdventureMerchantPurchase(const EQApplicationPacket *app)
return; return;
} }
if (item->LDoNTheme <= LDoNThemeBits::TAKBit) { if (item->LDoNTheme <= LDoNTheme::TAKBit) {
uint32 ldon_theme; uint32 ldon_theme;
if (item->LDoNTheme & LDoNThemeBits::TAKBit) { if (item->LDoNTheme & LDoNTheme::TAKBit) {
if (m_pp.ldon_points_tak < item_cost) { if (m_pp.ldon_points_tak < item_cost) {
cannot_afford = true; cannot_afford = true;
ldon_theme = LDoNThemes::TAK; ldon_theme = LDoNTheme::TAK;
} }
} else if (item->LDoNTheme & LDoNThemeBits::RUJBit) { } else if (item->LDoNTheme & LDoNTheme::RUJBit) {
if (m_pp.ldon_points_ruj < item_cost) { if (m_pp.ldon_points_ruj < item_cost) {
cannot_afford = true; cannot_afford = true;
ldon_theme = LDoNThemes::RUJ; ldon_theme = LDoNTheme::RUJ;
} }
} else if (item->LDoNTheme & LDoNThemeBits::MMCBit) { } else if (item->LDoNTheme & LDoNTheme::MMCBit) {
if (m_pp.ldon_points_mmc < item_cost) { if (m_pp.ldon_points_mmc < item_cost) {
cannot_afford = true; cannot_afford = true;
ldon_theme = LDoNThemes::MMC; ldon_theme = LDoNTheme::MMC;
} }
} else if (item->LDoNTheme & LDoNThemeBits::MIRBit) { } else if (item->LDoNTheme & LDoNTheme::MIRBit) {
if (m_pp.ldon_points_mir < item_cost) { if (m_pp.ldon_points_mir < item_cost) {
cannot_afford = true; cannot_afford = true;
ldon_theme = LDoNThemes::MIR; ldon_theme = LDoNTheme::MIR;
} }
} else if (item->LDoNTheme & LDoNThemeBits::GUKBit) { } else if (item->LDoNTheme & LDoNTheme::GUKBit) {
if (m_pp.ldon_points_guk < item_cost) { if (m_pp.ldon_points_guk < item_cost) {
cannot_afford = true; cannot_afford = true;
ldon_theme = LDoNThemes::GUK; ldon_theme = LDoNTheme::GUK;
} }
} }
merchant_type = fmt::format( merchant_type = fmt::format(
"{} Point{}", "{} Point{}",
EQ::constants::GetLDoNThemeName(ldon_theme), LDoNTheme::GetName(ldon_theme),
item_cost != 1 ? "s" : "" item_cost != 1 ? "s" : ""
); );
} }
@ -2194,19 +2194,19 @@ void Client::Handle_OP_AdventureMerchantRequest(const EQApplicationPacket *app)
item = database.GetItem(ml.item); item = database.GetItem(ml.item);
if (item) { if (item) {
uint32 theme = LDoNThemes::Unused; uint32 theme = LDoNTheme::Unused;
if (item->LDoNTheme > LDoNThemeBits::TAKBit) { if (item->LDoNTheme > LDoNTheme::TAKBit) {
theme = LDoNThemes::Unused; theme = LDoNTheme::Unused;
} else if (item->LDoNTheme & LDoNThemeBits::TAKBit) { } else if (item->LDoNTheme & LDoNTheme::TAKBit) {
theme = LDoNThemes::TAK; theme = LDoNTheme::TAK;
} else if (item->LDoNTheme & LDoNThemeBits::RUJBit) { } else if (item->LDoNTheme & LDoNTheme::RUJBit) {
theme = LDoNThemes::RUJ; theme = LDoNTheme::RUJ;
} else if (item->LDoNTheme & LDoNThemeBits::MMCBit) { } else if (item->LDoNTheme & LDoNTheme::MMCBit) {
theme = LDoNThemes::MMC; theme = LDoNTheme::MMC;
} else if (item->LDoNTheme & LDoNThemeBits::MIRBit) { } else if (item->LDoNTheme & LDoNTheme::MIRBit) {
theme = LDoNThemes::MIR; theme = LDoNTheme::MIR;
} else if (item->LDoNTheme & LDoNThemeBits::GUKBit) { } else if (item->LDoNTheme & LDoNTheme::GUKBit) {
theme = LDoNThemes::GUK; theme = LDoNTheme::GUK;
} }
ss << "^" << item->Name << "|"; ss << "^" << item->Name << "|";
ss << item->ID << "|"; ss << item->ID << "|";

View File

@ -11,6 +11,7 @@
#include "find/faction.cpp" #include "find/faction.cpp"
#include "find/item.cpp" #include "find/item.cpp"
#include "find/language.cpp" #include "find/language.cpp"
#include "find/ldon_theme.cpp"
#include "find/npctype.cpp" #include "find/npctype.cpp"
#include "find/object_type.cpp" #include "find/object_type.cpp"
#include "find/race.cpp" #include "find/race.cpp"
@ -47,6 +48,7 @@ void command_find(Client *c, const Seperator *sep)
Cmd{.cmd = "faction", .u = "faction [Search Criteria]", .fn = FindFaction, .a = {"#findfaction"}}, Cmd{.cmd = "faction", .u = "faction [Search Criteria]", .fn = FindFaction, .a = {"#findfaction"}},
Cmd{.cmd = "item", .u = "item [Search Criteria]", .fn = FindItem, .a = {"#fi", "#finditem"}}, Cmd{.cmd = "item", .u = "item [Search Criteria]", .fn = FindItem, .a = {"#fi", "#finditem"}},
Cmd{.cmd = "language", .u = "language [Search Criteria]", .fn = FindLanguage, .a = {"#findlanguage"}}, Cmd{.cmd = "language", .u = "language [Search Criteria]", .fn = FindLanguage, .a = {"#findlanguage"}},
Cmd{.cmd = "ldon_theme", .u = "ldon_theme [Search Criteria]", .fn = FindLDoNTheme, .a = {"#findldontheme"}},
Cmd{ Cmd{
.cmd = "npctype", .u = "npctype [Search Criteria]", .fn = FindNPCType, .a = { .cmd = "npctype", .u = "npctype [Search Criteria]", .fn = FindNPCType, .a = {
"#fn", "#fn",

View File

@ -57,7 +57,7 @@ void FindClass(Client *c, const Seperator *sep)
( (
IsPlayerClass(class_id) ? IsPlayerClass(class_id) ?
fmt::format( fmt::format(
" | ({})", " ({})",
Strings::Commify(GetPlayerClassBit(class_id)) Strings::Commify(GetPlayerClassBit(class_id))
) : ) :
"" ""

View File

@ -0,0 +1,65 @@
#include "../../client.h"
void FindLDoNTheme(Client *c, const Seperator *sep)
{
if (sep->IsNumber(2)) {
const uint32 theme_id = Strings::ToUnsignedInt(sep->arg[2]);
if (LDoNTheme::IsValid(theme_id)) {
c->Message(
Chat::White,
fmt::format(
"Theme {} | {} ({})",
theme_id,
LDoNTheme::GetName(theme_id),
LDoNTheme::GetBitmask(theme_id)
).c_str()
);
return;
}
c->Message(
Chat::White,
fmt::format(
"Theme ID {} was not found.",
theme_id
).c_str()
);
return;
}
const std::string& search_criteria = Strings::ToLower(sep->argplus[2]);
uint32 found_count = 0;
for (const auto& l : ldon_theme_names) {
const std::string& ldon_theme_name_lower = Strings::ToLower(l.second.first);
if (!Strings::Contains(ldon_theme_name_lower, search_criteria)) {
continue;
}
c->Message(
Chat::White,
fmt::format(
"Theme {} | {} ({})",
l.first,
l.second.first,
l.second.second
).c_str()
);
found_count++;
}
c->Message(
Chat::White,
fmt::format(
"{} Theme{} found matching '{}'.",
found_count,
found_count != 1 ? "s" : "",
sep->argplus[2]
).c_str()
);
}

View File

@ -3,20 +3,21 @@
void SetAdventurePoints(Client *c, const Seperator *sep) void SetAdventurePoints(Client *c, const Seperator *sep)
{ {
const auto arguments = sep->argnum; const uint16 arguments = sep->argnum;
if (arguments < 3 || !sep->IsNumber(2) || !sep->IsNumber(3)) { if (arguments < 3 || !sep->IsNumber(2) || !sep->IsNumber(3)) {
c->Message(Chat::White, "Usage: #set adventure_points [Theme] [Points]"); c->Message(Chat::White, "Usage: #set adventure_points [Theme] [Points]");
c->Message(Chat::White, "Valid themes are as follows:"); c->Message(Chat::White, "Valid themes are as follows:");
for (const auto& e : EQ::constants::GetLDoNThemeMap()) { for (const auto& e : ldon_theme_names) {
if (e.first != LDoNThemes::Unused) { if (e.first != LDoNTheme::Unused) {
c->Message( c->Message(
Chat::White, Chat::White,
fmt::format( fmt::format(
"Theme {} | {}", "Theme {} | {} ({})",
e.first, e.first,
e.second e.second.first,
e.second.second
).c_str() ).c_str()
); );
} }
@ -25,25 +26,26 @@ void SetAdventurePoints(Client *c, const Seperator *sep)
return; return;
} }
auto t = c; Client* t = c;
if (c->GetTarget() && c->GetTarget()->IsClient()) { if (c->GetTarget() && c->GetTarget()->IsClient()) {
t = c->GetTarget()->CastToClient(); t = c->GetTarget()->CastToClient();
} }
const uint32 theme_id = Strings::ToUnsignedInt(sep->arg[2]); const uint32 theme_id = Strings::ToUnsignedInt(sep->arg[2]);
const uint32 points = Strings::ToUnsignedInt(sep->arg[3]); const uint32 points = Strings::ToUnsignedInt(sep->arg[3]);
if (!EQ::ValueWithin(theme_id, LDoNThemes::GUK, LDoNThemes::TAK)) { if (!LDoNTheme::IsValid(theme_id)) {
c->Message(Chat::White, "Valid themes are as follows:"); c->Message(Chat::White, "Valid themes are as follows:");
for (const auto& e : EQ::constants::GetLDoNThemeMap()) { for (const auto& e : ldon_theme_names) {
if (e.first != LDoNThemes::Unused) { if (e.first != LDoNTheme::Unused) {
c->Message( c->Message(
Chat::White, Chat::White,
fmt::format( fmt::format(
"Theme {} | {}", "Theme {} | {} ({})",
e.first, e.first,
e.second e.second.first,
e.second.second
).c_str() ).c_str()
); );
} }
@ -56,7 +58,7 @@ void SetAdventurePoints(Client *c, const Seperator *sep)
Chat::White, Chat::White,
fmt::format( fmt::format(
"Set {} Points to {} for {}.", "Set {} Points to {} for {}.",
EQ::constants::GetLDoNThemeName(theme_id), LDoNTheme::GetName(theme_id),
Strings::Commify(points), Strings::Commify(points),
c->GetTargetDescription(t) c->GetTargetDescription(t)
).c_str() ).c_str()

View File

@ -89,11 +89,11 @@ void ShowCurrencies(Client *c, const Seperator *sep)
} }
} }
for (const auto& l : EQ::constants::GetLDoNThemeMap()) { for (const auto& l : ldon_theme_names) {
const uint32 ldon_currency_value = t->GetLDoNPointsTheme(l.first); const uint32 ldon_currency_value = t->GetLDoNPointsTheme(l.first);
if (ldon_currency_value) { if (ldon_currency_value) {
currency_table += DialogueWindow::TableRow( currency_table += DialogueWindow::TableRow(
DialogueWindow::TableCell(l.second) + DialogueWindow::TableCell(l.second.first) +
DialogueWindow::TableCell(Strings::Commify(ldon_currency_value)) DialogueWindow::TableCell(Strings::Commify(ldon_currency_value))
); );

View File

@ -1287,7 +1287,7 @@ std::string QuestManager::getskillname(int skill_id) {
} }
std::string QuestManager::getldonthemename(uint32 theme_id) { std::string QuestManager::getldonthemename(uint32 theme_id) {
return EQ::constants::GetLDoNThemeName(theme_id); return LDoNTheme::GetName(theme_id);
} }
std::string QuestManager::getfactionname(int faction_id) { std::string QuestManager::getfactionname(int faction_id) {