mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 09:31:30 +00:00
[Commands] Add #viewcurrencies Command. (#1844)
* [Commands] Add #viewcurrencies Command. - Add #viewcurrencies command to view your or your target's currencies (Money, Crystals, Alternate Currency, LDoN, and PVP). - Add GetLDoNThemeName() helper method. * Update viewcurrencies.cpp * Cleanup name of map method. * Cleanup.
This commit is contained in:
parent
2be1321aa9
commit
7cac2e2bc3
@ -198,6 +198,28 @@ std::string EQ::constants::GetLanguageName(int language_id)
|
|||||||
return std::string();
|
return std::string();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 (theme_id >= LDoNThemes::Unused && theme_id <= LDoNThemes::TAK) {
|
||||||
|
auto ldon_themes = EQ::constants::GetLDoNThemeMap();
|
||||||
|
return ldon_themes[theme_id];
|
||||||
|
}
|
||||||
|
return std::string();
|
||||||
|
}
|
||||||
|
|
||||||
const std::map<uint8, std::string>& EQ::constants::GetFlyModeMap()
|
const std::map<uint8, std::string>& EQ::constants::GetFlyModeMap()
|
||||||
{
|
{
|
||||||
static const std::map<uint8, std::string> flymode_map = {
|
static const std::map<uint8, std::string> flymode_map = {
|
||||||
|
|||||||
@ -235,6 +235,9 @@ namespace EQ
|
|||||||
extern const std::map<int, std::string>& GetLanguageMap();
|
extern const std::map<int, std::string>& GetLanguageMap();
|
||||||
std::string GetLanguageName(int language_id);
|
std::string GetLanguageName(int language_id);
|
||||||
|
|
||||||
|
extern const std::map<uint32, std::string>& GetLDoNThemeMap();
|
||||||
|
std::string GetLDoNThemeName(uint32 theme_id);
|
||||||
|
|
||||||
extern const std::map<uint8, std::string>& GetFlyModeMap();
|
extern const std::map<uint8, std::string>& GetFlyModeMap();
|
||||||
std::string GetFlyModeName(uint8 flymode_id);
|
std::string GetFlyModeName(uint8 flymode_id);
|
||||||
|
|
||||||
|
|||||||
@ -547,6 +547,7 @@ SET(gm_commands
|
|||||||
gm_commands/untraindiscs.cpp
|
gm_commands/untraindiscs.cpp
|
||||||
gm_commands/uptime.cpp
|
gm_commands/uptime.cpp
|
||||||
gm_commands/version.cpp
|
gm_commands/version.cpp
|
||||||
|
gm_commands/viewcurrencies.cpp
|
||||||
gm_commands/viewnpctype.cpp
|
gm_commands/viewnpctype.cpp
|
||||||
gm_commands/viewpetition.cpp
|
gm_commands/viewpetition.cpp
|
||||||
gm_commands/viewzoneloot.cpp
|
gm_commands/viewzoneloot.cpp
|
||||||
|
|||||||
@ -1936,14 +1936,6 @@ void Client::Handle_OP_AdventureMerchantPurchase(const EQApplicationPacket *app)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Adventure_Purchase_Struct* aps = (Adventure_Purchase_Struct*)app->pBuffer;
|
Adventure_Purchase_Struct* aps = (Adventure_Purchase_Struct*)app->pBuffer;
|
||||||
/*
|
|
||||||
Get item apc->itemid (can check NPC if thats necessary), ldon point theme check only if theme is not 0 (I am not sure what 1-5 are though for themes)
|
|
||||||
if(ldon_points_available >= item ldonpointcost)
|
|
||||||
{
|
|
||||||
give item (67 00 00 00 for the packettype using opcode 0x02c5)
|
|
||||||
ldon_points_available -= ldonpointcost;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
uint32 merchantid = 0;
|
uint32 merchantid = 0;
|
||||||
Mob* tmp = entity_list.GetMob(aps->npcid);
|
Mob* tmp = entity_list.GetMob(aps->npcid);
|
||||||
if (tmp == 0 || !tmp->IsNPC() || ((tmp->GetClass() != ADVENTUREMERCHANT) &&
|
if (tmp == 0 || !tmp->IsNPC() || ((tmp->GetClass() != ADVENTUREMERCHANT) &&
|
||||||
@ -2000,39 +1992,47 @@ void Client::Handle_OP_AdventureMerchantPurchase(const EQApplicationPacket *app)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (item->LDoNTheme <= LDoNThemeBits::TAKBit) {
|
if (item->LDoNTheme <= LDoNThemeBits::TAKBit) {
|
||||||
|
uint32 ldon_theme;
|
||||||
if (item->LDoNTheme & LDoNThemeBits::TAKBit) {
|
if (item->LDoNTheme & LDoNThemeBits::TAKBit) {
|
||||||
if (m_pp.ldon_points_tak < item_cost) {
|
if (m_pp.ldon_points_tak < item_cost) {
|
||||||
cannot_afford = true;
|
cannot_afford = true;
|
||||||
merchant_type = fmt::format("Deepest Guk Point{}", item_cost != 1 ? "s" : "");
|
ldon_theme = LDoNThemes::TAK;
|
||||||
}
|
}
|
||||||
} else if (item->LDoNTheme & LDoNThemeBits::RUJBit) {
|
} else if (item->LDoNTheme & LDoNThemeBits::RUJBit) {
|
||||||
if (m_pp.ldon_points_ruj < item_cost) {
|
if (m_pp.ldon_points_ruj < item_cost) {
|
||||||
cannot_afford = true;
|
cannot_afford = true;
|
||||||
merchant_type = fmt::format("Miragul's Menagerie Point{}", item_cost != 1 ? "s" : "");
|
ldon_theme = LDoNThemes::RUJ;
|
||||||
}
|
}
|
||||||
} else if (item->LDoNTheme & LDoNThemeBits::MMCBit) {
|
} else if (item->LDoNTheme & LDoNThemeBits::MMCBit) {
|
||||||
if (m_pp.ldon_points_mmc < item_cost) {
|
if (m_pp.ldon_points_mmc < item_cost) {
|
||||||
cannot_afford = true;
|
cannot_afford = true;
|
||||||
merchant_type = fmt::format("Mistmoore Catacombs Point{}", item_cost != 1 ? "s" : "");
|
ldon_theme = LDoNThemes::MMC;
|
||||||
}
|
}
|
||||||
} else if (item->LDoNTheme & LDoNThemeBits::MIRBit) {
|
} else if (item->LDoNTheme & LDoNThemeBits::MIRBit) {
|
||||||
if (m_pp.ldon_points_mir < item_cost) {
|
if (m_pp.ldon_points_mir < item_cost) {
|
||||||
cannot_afford = true;
|
cannot_afford = true;
|
||||||
merchant_type = fmt::format("Rujarkian Hills Point{}", item_cost != 1 ? "s" : "");
|
ldon_theme = LDoNThemes::MIR;
|
||||||
}
|
}
|
||||||
} else if (item->LDoNTheme & LDoNThemeBits::GUKBit) {
|
} else if (item->LDoNTheme & LDoNThemeBits::GUKBit) {
|
||||||
if (m_pp.ldon_points_guk < item_cost) {
|
if (m_pp.ldon_points_guk < item_cost) {
|
||||||
cannot_afford = true;
|
cannot_afford = true;
|
||||||
merchant_type = fmt::format("Takish-Hiz Point{}", item_cost != 1 ? "s" : "");
|
ldon_theme = LDoNThemes::GUK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
merchant_type = fmt::format(
|
||||||
|
"{} Point{}",
|
||||||
|
EQ::constants::GetLDoNThemeName(ldon_theme),
|
||||||
|
item_cost != 1 ? "s" : ""
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} else if (aps->Type == DiscordMerchant) {
|
} else if (aps->Type == DiscordMerchant) {
|
||||||
if (GetPVPPoints() < item_cost) {
|
if (GetPVPPoints() < item_cost) {
|
||||||
cannot_afford = true;
|
cannot_afford = true;
|
||||||
merchant_type = fmt::format("PVP Point{}", item_cost != 1 ? "s" : "");
|
merchant_type = fmt::format(
|
||||||
|
"PVP Point{}",
|
||||||
|
item_cost != 1 ? "s" : ""
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} else if (aps->Type == NorrathsKeepersMerchant) {
|
} else if (aps->Type == NorrathsKeepersMerchant) {
|
||||||
if (GetRadiantCrystals() < item_cost) {
|
if (GetRadiantCrystals() < item_cost) {
|
||||||
|
|||||||
@ -384,6 +384,7 @@ int command_init(void)
|
|||||||
command_add("untraindiscs", "- Untrains all disciplines from your target.", AccountStatus::GMCoder, command_untraindiscs) ||
|
command_add("untraindiscs", "- Untrains all disciplines from your target.", AccountStatus::GMCoder, command_untraindiscs) ||
|
||||||
command_add("uptime", "[zone server id] - Get uptime of worldserver, or zone server if argument provided", AccountStatus::Steward, command_uptime) ||
|
command_add("uptime", "[zone server id] - Get uptime of worldserver, or zone server if argument provided", AccountStatus::Steward, command_uptime) ||
|
||||||
command_add("version", "- Display current version of EQEmu server", AccountStatus::Player, command_version) ||
|
command_add("version", "- Display current version of EQEmu server", AccountStatus::Player, command_version) ||
|
||||||
|
command_add("viewcurrencies", "- View your or your target's currencies", AccountStatus::GMAdmin, command_viewcurrencies) ||
|
||||||
command_add("viewnpctype", "[NPC ID] - Show stats for an NPC by NPC ID", AccountStatus::GMAdmin, command_viewnpctype) ||
|
command_add("viewnpctype", "[NPC ID] - Show stats for an NPC by NPC ID", AccountStatus::GMAdmin, command_viewnpctype) ||
|
||||||
command_add("viewpetition", "[petition number] - View a petition", AccountStatus::ApprenticeGuide, command_viewpetition) ||
|
command_add("viewpetition", "[petition number] - View a petition", AccountStatus::ApprenticeGuide, command_viewpetition) ||
|
||||||
command_add("viewzoneloot", "[item id] - Allows you to search a zone's loot for a specific item ID. (0 shows all loot in the zone)", AccountStatus::QuestTroupe, command_viewzoneloot) ||
|
command_add("viewzoneloot", "[item id] - Allows you to search a zone's loot for a specific item ID. (0 shows all loot in the zone)", AccountStatus::QuestTroupe, command_viewzoneloot) ||
|
||||||
|
|||||||
@ -307,8 +307,10 @@ void command_untraindisc(Client *c, const Seperator *sep);
|
|||||||
void command_untraindiscs(Client *c, const Seperator *sep);
|
void command_untraindiscs(Client *c, const Seperator *sep);
|
||||||
void command_uptime(Client *c, const Seperator *sep);
|
void command_uptime(Client *c, const Seperator *sep);
|
||||||
void command_version(Client *c, const Seperator *sep);
|
void command_version(Client *c, const Seperator *sep);
|
||||||
|
void command_viewcurrencies(Client *c, const Seperator *sep);
|
||||||
void command_viewnpctype(Client *c, const Seperator *sep);
|
void command_viewnpctype(Client *c, const Seperator *sep);
|
||||||
void command_viewpetition(Client *c, const Seperator *sep);
|
void command_viewpetition(Client *c, const Seperator *sep);
|
||||||
|
void command_viewzoneloot(Client *c, const Seperator *sep);
|
||||||
void command_wc(Client *c, const Seperator *sep);
|
void command_wc(Client *c, const Seperator *sep);
|
||||||
void command_weather(Client *c, const Seperator *sep);
|
void command_weather(Client *c, const Seperator *sep);
|
||||||
void command_who(Client *c, const Seperator *sep);
|
void command_who(Client *c, const Seperator *sep);
|
||||||
@ -325,7 +327,6 @@ void command_zone(Client *c, const Seperator *sep);
|
|||||||
void command_zone_instance(Client *c, const Seperator *sep);
|
void command_zone_instance(Client *c, const Seperator *sep);
|
||||||
void command_zonebootup(Client *c, const Seperator *sep);
|
void command_zonebootup(Client *c, const Seperator *sep);
|
||||||
void command_zonelock(Client *c, const Seperator *sep);
|
void command_zonelock(Client *c, const Seperator *sep);
|
||||||
void command_viewzoneloot(Client *c, const Seperator *sep);
|
|
||||||
void command_zoneshutdown(Client *c, const Seperator *sep);
|
void command_zoneshutdown(Client *c, const Seperator *sep);
|
||||||
void command_zonestatus(Client *c, const Seperator *sep);
|
void command_zonestatus(Client *c, const Seperator *sep);
|
||||||
void command_zopp(Client *c, const Seperator *sep);
|
void command_zopp(Client *c, const Seperator *sep);
|
||||||
|
|||||||
137
zone/gm_commands/viewcurrencies.cpp
Normal file
137
zone/gm_commands/viewcurrencies.cpp
Normal file
@ -0,0 +1,137 @@
|
|||||||
|
#include "../client.h"
|
||||||
|
|
||||||
|
void command_viewcurrencies(Client *c, const Seperator *sep)
|
||||||
|
{
|
||||||
|
Client *target = c;
|
||||||
|
if (c->GetTarget() && c->GetTarget()->IsClient()) {
|
||||||
|
target = c->GetTarget()->CastToClient();
|
||||||
|
}
|
||||||
|
|
||||||
|
auto target_string = (
|
||||||
|
c == target ?
|
||||||
|
"Yourself" :
|
||||||
|
fmt::format(
|
||||||
|
"{} ({})",
|
||||||
|
target->GetCleanName(),
|
||||||
|
target->GetID()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
auto platinum = (
|
||||||
|
target->GetMoney(3, 0) +
|
||||||
|
target->GetMoney(3, 1) +
|
||||||
|
target->GetMoney(3, 2) +
|
||||||
|
target->GetMoney(3, 3)
|
||||||
|
);
|
||||||
|
|
||||||
|
auto gold = (
|
||||||
|
target->GetMoney(2, 0) +
|
||||||
|
target->GetMoney(2, 1) +
|
||||||
|
target->GetMoney(2, 2)
|
||||||
|
);
|
||||||
|
|
||||||
|
auto silver = (
|
||||||
|
target->GetMoney(1, 0) +
|
||||||
|
target->GetMoney(1, 1) +
|
||||||
|
target->GetMoney(1, 2)
|
||||||
|
);
|
||||||
|
|
||||||
|
auto copper = (
|
||||||
|
target->GetMoney(0, 0) +
|
||||||
|
target->GetMoney(0, 1) +
|
||||||
|
target->GetMoney(0, 2)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (
|
||||||
|
platinum ||
|
||||||
|
gold ||
|
||||||
|
silver ||
|
||||||
|
copper
|
||||||
|
) {
|
||||||
|
c->Message(
|
||||||
|
Chat::White,
|
||||||
|
fmt::format(
|
||||||
|
"Money for {} | {}",
|
||||||
|
target_string,
|
||||||
|
ConvertMoneyToString(
|
||||||
|
platinum,
|
||||||
|
gold,
|
||||||
|
silver,
|
||||||
|
copper
|
||||||
|
)
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto ebon_crystals = target->GetEbonCrystals();
|
||||||
|
if (ebon_crystals) {
|
||||||
|
c->Message(
|
||||||
|
Chat::White,
|
||||||
|
fmt::format(
|
||||||
|
"{} for {} | {}",
|
||||||
|
database.CreateItemLink(RuleI(Zone, EbonCrystalItemID)),
|
||||||
|
target_string,
|
||||||
|
ebon_crystals
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto radiant_crystals = target->GetRadiantCrystals();
|
||||||
|
if (radiant_crystals) {
|
||||||
|
c->Message(
|
||||||
|
Chat::White,
|
||||||
|
fmt::format(
|
||||||
|
"{} for {} | {}",
|
||||||
|
database.CreateItemLink(RuleI(Zone, RadiantCrystalItemID)),
|
||||||
|
target_string,
|
||||||
|
radiant_crystals
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const auto& alternate_currency : zone->AlternateCurrencies) {
|
||||||
|
auto currency_value = target->GetAlternateCurrencyValue(alternate_currency.id);
|
||||||
|
if (currency_value) {
|
||||||
|
c->Message(
|
||||||
|
Chat::White,
|
||||||
|
fmt::format(
|
||||||
|
"{} for {} | {}",
|
||||||
|
database.CreateItemLink(alternate_currency.item_id),
|
||||||
|
target_string,
|
||||||
|
currency_value
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (
|
||||||
|
uint32 ldon_currency_id = LDoNThemes::GUK;
|
||||||
|
ldon_currency_id <= LDoNThemes::TAK;
|
||||||
|
ldon_currency_id++
|
||||||
|
) {
|
||||||
|
auto ldon_currency_value = target->GetLDoNPointsTheme(ldon_currency_id);
|
||||||
|
if (ldon_currency_value) {
|
||||||
|
c->Message(
|
||||||
|
Chat::White,
|
||||||
|
fmt::format(
|
||||||
|
"{} for {} | {}",
|
||||||
|
EQ::constants::GetLDoNThemeName(ldon_currency_id),
|
||||||
|
target_string,
|
||||||
|
ldon_currency_value
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
auto pvp_points = target->GetPVPPoints();
|
||||||
|
if (pvp_points) {
|
||||||
|
c->Message(
|
||||||
|
Chat::White,
|
||||||
|
fmt::format(
|
||||||
|
"PVP Points for {} | {}",
|
||||||
|
target_string,
|
||||||
|
pvp_points
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user