mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-17 03:08:26 +00:00
[Commands] Add #find ldon_theme Subcommand (#4564)
This commit is contained in:
+34
-34
@@ -329,7 +329,7 @@ Client::Client(EQStreamInterface *ieqs) : Mob(
|
||||
adventure_stats_timer = nullptr;
|
||||
adventure_leaderboard_timer = nullptr;
|
||||
adv_data = nullptr;
|
||||
adv_requested_theme = LDoNThemes::Unused;
|
||||
adv_requested_theme = LDoNTheme::Unused;
|
||||
adv_requested_id = 0;
|
||||
adv_requested_member_count = 0;
|
||||
|
||||
@@ -1469,7 +1469,7 @@ bool Client::UpdateLDoNPoints(uint32 theme_id, int points)
|
||||
bool is_loss = false;
|
||||
|
||||
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 guk_points = (split_points + (points % 5));
|
||||
@@ -1522,12 +1522,12 @@ bool Client::UpdateLDoNPoints(uint32 theme_id, int points)
|
||||
points -= split_points;
|
||||
|
||||
if (split_points != 0) { // if anything left, recursively loop thru again
|
||||
UpdateLDoNPoints(LDoNThemes::Unused, split_points);
|
||||
UpdateLDoNPoints(LDoNTheme::Unused, split_points);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case LDoNThemes::GUK: {
|
||||
case LDoNTheme::GUK: {
|
||||
if (points < 0) {
|
||||
if (m_pp.ldon_points_guk < (0 - points)) {
|
||||
return false;
|
||||
@@ -1539,7 +1539,7 @@ bool Client::UpdateLDoNPoints(uint32 theme_id, int points)
|
||||
m_pp.ldon_points_guk += points;
|
||||
break;
|
||||
}
|
||||
case LDoNThemes::MIR: {
|
||||
case LDoNTheme::MIR: {
|
||||
if (points < 0) {
|
||||
if (m_pp.ldon_points_mir < (0 - points)) {
|
||||
return false;
|
||||
@@ -1551,7 +1551,7 @@ bool Client::UpdateLDoNPoints(uint32 theme_id, int points)
|
||||
m_pp.ldon_points_mir += points;
|
||||
break;
|
||||
}
|
||||
case LDoNThemes::MMC: {
|
||||
case LDoNTheme::MMC: {
|
||||
if (points < 0) {
|
||||
if (m_pp.ldon_points_mmc < (0 - points)) {
|
||||
return false;
|
||||
@@ -1563,7 +1563,7 @@ bool Client::UpdateLDoNPoints(uint32 theme_id, int points)
|
||||
m_pp.ldon_points_mmc += points;
|
||||
break;
|
||||
}
|
||||
case LDoNThemes::RUJ: {
|
||||
case LDoNTheme::RUJ: {
|
||||
if (points < 0) {
|
||||
if (m_pp.ldon_points_ruj < (0 - points)) {
|
||||
return false;
|
||||
@@ -1575,7 +1575,7 @@ bool Client::UpdateLDoNPoints(uint32 theme_id, int points)
|
||||
m_pp.ldon_points_ruj += points;
|
||||
break;
|
||||
}
|
||||
case LDoNThemes::TAK: {
|
||||
case LDoNTheme::TAK: {
|
||||
if (points < 0) {
|
||||
if (m_pp.ldon_points_tak < (0 - points)) {
|
||||
return false;
|
||||
@@ -1623,23 +1623,23 @@ bool Client::UpdateLDoNPoints(uint32 theme_id, int points)
|
||||
void Client::SetLDoNPoints(uint32 theme_id, uint32 points)
|
||||
{
|
||||
switch (theme_id) {
|
||||
case LDoNThemes::GUK: {
|
||||
case LDoNTheme::GUK: {
|
||||
m_pp.ldon_points_guk = points;
|
||||
break;
|
||||
}
|
||||
case LDoNThemes::MIR: {
|
||||
case LDoNTheme::MIR: {
|
||||
m_pp.ldon_points_mir = points;
|
||||
break;
|
||||
}
|
||||
case LDoNThemes::MMC: {
|
||||
case LDoNTheme::MMC: {
|
||||
m_pp.ldon_points_mmc = points;
|
||||
break;
|
||||
}
|
||||
case LDoNThemes::RUJ: {
|
||||
case LDoNTheme::RUJ: {
|
||||
m_pp.ldon_points_ruj = points;
|
||||
break;
|
||||
}
|
||||
case LDoNThemes::TAK: {
|
||||
case LDoNTheme::TAK: {
|
||||
m_pp.ldon_points_tak = points;
|
||||
break;
|
||||
}
|
||||
@@ -5676,15 +5676,15 @@ uint32 Client::GetLDoNPointsTheme(uint32 t)
|
||||
{
|
||||
switch(t)
|
||||
{
|
||||
case LDoNThemes::GUK:
|
||||
case LDoNTheme::GUK:
|
||||
return m_pp.ldon_points_guk;
|
||||
case LDoNThemes::MIR:
|
||||
case LDoNTheme::MIR:
|
||||
return m_pp.ldon_points_mir;
|
||||
case LDoNThemes::MMC:
|
||||
case LDoNTheme::MMC:
|
||||
return m_pp.ldon_points_mmc;
|
||||
case LDoNThemes::RUJ:
|
||||
case LDoNTheme::RUJ:
|
||||
return m_pp.ldon_points_ruj;
|
||||
case LDoNThemes::TAK:
|
||||
case LDoNTheme::TAK:
|
||||
return m_pp.ldon_points_tak;
|
||||
default:
|
||||
return 0;
|
||||
@@ -5695,15 +5695,15 @@ uint32 Client::GetLDoNWinsTheme(uint32 t)
|
||||
{
|
||||
switch(t)
|
||||
{
|
||||
case LDoNThemes::GUK:
|
||||
case LDoNTheme::GUK:
|
||||
return m_pp.ldon_wins_guk;
|
||||
case LDoNThemes::MIR:
|
||||
case LDoNTheme::MIR:
|
||||
return m_pp.ldon_wins_mir;
|
||||
case LDoNThemes::MMC:
|
||||
case LDoNTheme::MMC:
|
||||
return m_pp.ldon_wins_mmc;
|
||||
case LDoNThemes::RUJ:
|
||||
case LDoNTheme::RUJ:
|
||||
return m_pp.ldon_wins_ruj;
|
||||
case LDoNThemes::TAK:
|
||||
case LDoNTheme::TAK:
|
||||
return m_pp.ldon_wins_tak;
|
||||
default:
|
||||
return 0;
|
||||
@@ -5714,15 +5714,15 @@ uint32 Client::GetLDoNLossesTheme(uint32 t)
|
||||
{
|
||||
switch(t)
|
||||
{
|
||||
case LDoNThemes::GUK:
|
||||
case LDoNTheme::GUK:
|
||||
return m_pp.ldon_losses_guk;
|
||||
case LDoNThemes::MIR:
|
||||
case LDoNTheme::MIR:
|
||||
return m_pp.ldon_losses_mir;
|
||||
case LDoNThemes::MMC:
|
||||
case LDoNTheme::MMC:
|
||||
return m_pp.ldon_losses_mmc;
|
||||
case LDoNThemes::RUJ:
|
||||
case LDoNTheme::RUJ:
|
||||
return m_pp.ldon_losses_ruj;
|
||||
case LDoNThemes::TAK:
|
||||
case LDoNTheme::TAK:
|
||||
return m_pp.ldon_losses_tak;
|
||||
default:
|
||||
return 0;
|
||||
@@ -5731,35 +5731,35 @@ uint32 Client::GetLDoNLossesTheme(uint32 t)
|
||||
|
||||
void Client::UpdateLDoNWinLoss(uint32 theme_id, bool win, bool remove) {
|
||||
switch (theme_id) {
|
||||
case LDoNThemes::GUK:
|
||||
case LDoNTheme::GUK:
|
||||
if (win) {
|
||||
m_pp.ldon_wins_guk += (remove ? -1 : 1);
|
||||
} else {
|
||||
m_pp.ldon_losses_guk += (remove ? -1 : 1);
|
||||
}
|
||||
break;
|
||||
case LDoNThemes::MIR:
|
||||
case LDoNTheme::MIR:
|
||||
if (win) {
|
||||
m_pp.ldon_wins_mir += (remove ? -1 : 1);
|
||||
} else {
|
||||
m_pp.ldon_losses_mir += (remove ? -1 : 1);
|
||||
}
|
||||
break;
|
||||
case LDoNThemes::MMC:
|
||||
case LDoNTheme::MMC:
|
||||
if (win) {
|
||||
m_pp.ldon_wins_mmc += (remove ? -1 : 1);
|
||||
} else {
|
||||
m_pp.ldon_losses_mmc += (remove ? -1 : 1);
|
||||
}
|
||||
break;
|
||||
case LDoNThemes::RUJ:
|
||||
case LDoNTheme::RUJ:
|
||||
if (win) {
|
||||
m_pp.ldon_wins_ruj += (remove ? -1 : 1);
|
||||
} else {
|
||||
m_pp.ldon_losses_ruj += (remove ? -1 : 1);
|
||||
}
|
||||
break;
|
||||
case LDoNThemes::TAK:
|
||||
case LDoNTheme::TAK:
|
||||
if (win) {
|
||||
m_pp.ldon_wins_tak += (remove ? -1 : 1);
|
||||
} else {
|
||||
@@ -6227,7 +6227,7 @@ void Client::NewAdventure(int id, int theme, const char *text, int member_count,
|
||||
void Client::ClearPendingAdventureData()
|
||||
{
|
||||
adv_requested_id = 0;
|
||||
adv_requested_theme = LDoNThemes::Unused;
|
||||
adv_requested_theme = LDoNTheme::Unused;
|
||||
safe_delete_array(adv_requested_data);
|
||||
adv_requested_member_count = 0;
|
||||
}
|
||||
|
||||
+25
-25
@@ -2019,38 +2019,38 @@ void Client::Handle_OP_AdventureMerchantPurchase(const EQApplicationPacket *app)
|
||||
return;
|
||||
}
|
||||
|
||||
if (item->LDoNTheme <= LDoNThemeBits::TAKBit) {
|
||||
if (item->LDoNTheme <= LDoNTheme::TAKBit) {
|
||||
uint32 ldon_theme;
|
||||
if (item->LDoNTheme & LDoNThemeBits::TAKBit) {
|
||||
if (item->LDoNTheme & LDoNTheme::TAKBit) {
|
||||
if (m_pp.ldon_points_tak < item_cost) {
|
||||
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) {
|
||||
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) {
|
||||
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) {
|
||||
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) {
|
||||
cannot_afford = true;
|
||||
ldon_theme = LDoNThemes::GUK;
|
||||
ldon_theme = LDoNTheme::GUK;
|
||||
}
|
||||
}
|
||||
|
||||
merchant_type = fmt::format(
|
||||
"{} Point{}",
|
||||
EQ::constants::GetLDoNThemeName(ldon_theme),
|
||||
LDoNTheme::GetName(ldon_theme),
|
||||
item_cost != 1 ? "s" : ""
|
||||
);
|
||||
}
|
||||
@@ -2194,19 +2194,19 @@ void Client::Handle_OP_AdventureMerchantRequest(const EQApplicationPacket *app)
|
||||
|
||||
item = database.GetItem(ml.item);
|
||||
if (item) {
|
||||
uint32 theme = LDoNThemes::Unused;
|
||||
if (item->LDoNTheme > LDoNThemeBits::TAKBit) {
|
||||
theme = LDoNThemes::Unused;
|
||||
} else if (item->LDoNTheme & LDoNThemeBits::TAKBit) {
|
||||
theme = LDoNThemes::TAK;
|
||||
} else if (item->LDoNTheme & LDoNThemeBits::RUJBit) {
|
||||
theme = LDoNThemes::RUJ;
|
||||
} else if (item->LDoNTheme & LDoNThemeBits::MMCBit) {
|
||||
theme = LDoNThemes::MMC;
|
||||
} else if (item->LDoNTheme & LDoNThemeBits::MIRBit) {
|
||||
theme = LDoNThemes::MIR;
|
||||
} else if (item->LDoNTheme & LDoNThemeBits::GUKBit) {
|
||||
theme = LDoNThemes::GUK;
|
||||
uint32 theme = LDoNTheme::Unused;
|
||||
if (item->LDoNTheme > LDoNTheme::TAKBit) {
|
||||
theme = LDoNTheme::Unused;
|
||||
} else if (item->LDoNTheme & LDoNTheme::TAKBit) {
|
||||
theme = LDoNTheme::TAK;
|
||||
} else if (item->LDoNTheme & LDoNTheme::RUJBit) {
|
||||
theme = LDoNTheme::RUJ;
|
||||
} else if (item->LDoNTheme & LDoNTheme::MMCBit) {
|
||||
theme = LDoNTheme::MMC;
|
||||
} else if (item->LDoNTheme & LDoNTheme::MIRBit) {
|
||||
theme = LDoNTheme::MIR;
|
||||
} else if (item->LDoNTheme & LDoNTheme::GUKBit) {
|
||||
theme = LDoNTheme::GUK;
|
||||
}
|
||||
ss << "^" << item->Name << "|";
|
||||
ss << item->ID << "|";
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "find/faction.cpp"
|
||||
#include "find/item.cpp"
|
||||
#include "find/language.cpp"
|
||||
#include "find/ldon_theme.cpp"
|
||||
#include "find/npctype.cpp"
|
||||
#include "find/object_type.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 = "item", .u = "item [Search Criteria]", .fn = FindItem, .a = {"#fi", "#finditem"}},
|
||||
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 = "npctype", .u = "npctype [Search Criteria]", .fn = FindNPCType, .a = {
|
||||
"#fn",
|
||||
|
||||
@@ -57,7 +57,7 @@ void FindClass(Client *c, const Seperator *sep)
|
||||
(
|
||||
IsPlayerClass(class_id) ?
|
||||
fmt::format(
|
||||
" | ({})",
|
||||
" ({})",
|
||||
Strings::Commify(GetPlayerClassBit(class_id))
|
||||
) :
|
||||
""
|
||||
|
||||
@@ -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()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -3,20 +3,21 @@
|
||||
|
||||
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)) {
|
||||
c->Message(Chat::White, "Usage: #set adventure_points [Theme] [Points]");
|
||||
|
||||
c->Message(Chat::White, "Valid themes are as follows:");
|
||||
|
||||
for (const auto& e : EQ::constants::GetLDoNThemeMap()) {
|
||||
if (e.first != LDoNThemes::Unused) {
|
||||
for (const auto& e : ldon_theme_names) {
|
||||
if (e.first != LDoNTheme::Unused) {
|
||||
c->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"Theme {} | {}",
|
||||
"Theme {} | {} ({})",
|
||||
e.first,
|
||||
e.second
|
||||
e.second.first,
|
||||
e.second.second
|
||||
).c_str()
|
||||
);
|
||||
}
|
||||
@@ -25,25 +26,26 @@ void SetAdventurePoints(Client *c, const Seperator *sep)
|
||||
return;
|
||||
}
|
||||
|
||||
auto t = c;
|
||||
Client* t = c;
|
||||
if (c->GetTarget() && c->GetTarget()->IsClient()) {
|
||||
t = c->GetTarget()->CastToClient();
|
||||
}
|
||||
|
||||
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:");
|
||||
|
||||
for (const auto& e : EQ::constants::GetLDoNThemeMap()) {
|
||||
if (e.first != LDoNThemes::Unused) {
|
||||
for (const auto& e : ldon_theme_names) {
|
||||
if (e.first != LDoNTheme::Unused) {
|
||||
c->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"Theme {} | {}",
|
||||
"Theme {} | {} ({})",
|
||||
e.first,
|
||||
e.second
|
||||
e.second.first,
|
||||
e.second.second
|
||||
).c_str()
|
||||
);
|
||||
}
|
||||
@@ -56,7 +58,7 @@ void SetAdventurePoints(Client *c, const Seperator *sep)
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"Set {} Points to {} for {}.",
|
||||
EQ::constants::GetLDoNThemeName(theme_id),
|
||||
LDoNTheme::GetName(theme_id),
|
||||
Strings::Commify(points),
|
||||
c->GetTargetDescription(t)
|
||||
).c_str()
|
||||
|
||||
@@ -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);
|
||||
if (ldon_currency_value) {
|
||||
currency_table += DialogueWindow::TableRow(
|
||||
DialogueWindow::TableCell(l.second) +
|
||||
DialogueWindow::TableCell(l.second.first) +
|
||||
DialogueWindow::TableCell(Strings::Commify(ldon_currency_value))
|
||||
);
|
||||
|
||||
|
||||
+1
-1
@@ -1287,7 +1287,7 @@ std::string QuestManager::getskillname(int skill_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) {
|
||||
|
||||
Reference in New Issue
Block a user