[Commands] Consolidate #show commands into a singular #show command (#3478)

* [Cleanup] Consolidate #show commands into a singular #show command

# Notes
- All `#show` commands like `#showbuffs` are now subcommands of `#show`.
- All aliases like `#showbuffs` still function.

* Push up progress.

* Final push.

* Cleanup.

* Update ip_lookup.cpp

* emotes not emote

* Cleanup

* Update servertalk.h

* Update show.cpp

* Fix

* Final push.

* #aggro

* #who
This commit is contained in:
Alex King
2023-07-08 11:06:25 -04:00
committed by GitHub
parent d4962bb2ab
commit e55fb1cafd
90 changed files with 2767 additions and 2591 deletions
+22
View File
@@ -0,0 +1,22 @@
#include "../../client.h"
void ShowAggro(Client *c, const Seperator *sep)
{
const auto arguments = sep->argnum;
if (arguments < 2 || !sep->IsNumber(2)) {
c->Message(Chat::White, "Usage: #show aggro [Distance] [-v] (-v is verbose Faction Information)");
return;
}
if (!c->GetTarget() || !c->GetTarget()->IsNPC()) {
c->Message(Chat::White, "You must target an NPC to use this command.");
return;
}
const auto t = c->GetTarget()->CastToNPC();
const float distance = Strings::ToFloat(sep->arg[2]);
const bool is_verbose = Strings::EqualFold(sep->arg[3], "-v");
entity_list.DescribeAggro(c, t, distance, is_verbose);
}
+11
View File
@@ -0,0 +1,11 @@
#include "../../client.h"
void ShowBuffs(Client *c, const Seperator *sep)
{
Mob* t = c;
if (c->GetTarget()) {
t = c->GetTarget();
}
t->ShowBuffs(c);
}
@@ -0,0 +1,23 @@
#include "../../client.h"
#include "../../corpse.h"
void ShowBuriedCorpseCount(Client *c, const Seperator *sep)
{
auto t = c;
if (c->GetTarget() && c->GetTarget()->IsClient() && c->GetGM()) {
t = c->GetTarget()->CastToClient();
}
const uint32 corpse_count = database.GetCharacterBuriedCorpseCount(t->CharacterID());
c->Message(
Chat::White,
fmt::format(
"{} {} {} buried corpse{}.",
c->GetTargetDescription(t, TargetDescriptionType::UCYou),
c == t ? "have" : "has",
corpse_count,
corpse_count != 1 ? "s" : ""
).c_str()
);
}
@@ -0,0 +1,16 @@
#include "../../client.h"
#include "../../worldserver.h"
extern WorldServer worldserver;
void ShowClientVersionSummary(Client *c, const Seperator *sep)
{
auto pack = new ServerPacket(ServerOP_ClientVersionSummary, sizeof(ServerRequestClientVersionSummary_Struct));
auto s = (ServerRequestClientVersionSummary_Struct *) pack->pBuffer;
strn0cpy(s->Name, c->GetName(), sizeof(s->Name));
worldserver.SendPacket(pack);
safe_delete(pack);
}
+136
View File
@@ -0,0 +1,136 @@
#include "../../client.h"
#include "../../dialogue_window.h"
void ShowCurrencies(Client *c, const Seperator *sep)
{
auto t = c;
if (c->GetTarget() && c->GetTarget()->IsClient()) {
t = c->GetTarget()->CastToClient();
}
const uint32 platinum = (
t->GetMoney(3, 0) +
t->GetMoney(3, 1) +
t->GetMoney(3, 2) +
t->GetMoney(3, 3)
);
const uint32 gold = (
t->GetMoney(2, 0) +
t->GetMoney(2, 1) +
t->GetMoney(2, 2)
);
const uint32 silver = (
t->GetMoney(1, 0) +
t->GetMoney(1, 1) +
t->GetMoney(1, 2)
);
const uint32 copper = (
t->GetMoney(0, 0) +
t->GetMoney(0, 1) +
t->GetMoney(0, 2)
);
std::string currency_table;
bool has_currency = false;
currency_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Currency") +
DialogueWindow::TableCell("Amount")
);
if (
platinum ||
gold ||
silver ||
copper
) {
currency_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Money") +
DialogueWindow::TableCell(Strings::Money(platinum, gold, silver, copper))
);
has_currency = true;
}
const uint32 ebon_crystals = t->GetEbonCrystals();
if (ebon_crystals) {
currency_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Ebon Crystals") +
DialogueWindow::TableCell(Strings::Commify(ebon_crystals))
);
has_currency = true;
}
const uint32 radiant_crystals = t->GetRadiantCrystals();
if (radiant_crystals) {
currency_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Radiant Crystals") +
DialogueWindow::TableCell(Strings::Commify(radiant_crystals))
);
has_currency = true;
}
for (const auto& a : zone->AlternateCurrencies) {
const uint32 currency_value = t->GetAlternateCurrencyValue(a.id);
if (currency_value) {
const auto* d = database.GetItem(a.item_id);
currency_table += DialogueWindow::TableRow(
DialogueWindow::TableCell(d->Name) +
DialogueWindow::TableCell(Strings::Commify(currency_value))
);
has_currency = true;
}
}
for (const auto& l : EQ::constants::GetLDoNThemeMap()) {
const uint32 ldon_currency_value = t->GetLDoNPointsTheme(l.first);
if (ldon_currency_value) {
currency_table += DialogueWindow::TableRow(
DialogueWindow::TableCell(l.second) +
DialogueWindow::TableCell(Strings::Commify(ldon_currency_value))
);
has_currency = true;
}
}
const uint32 pvp_points = t->GetPVPPoints();
if (pvp_points) {
currency_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("PVP Points") +
DialogueWindow::TableCell(Strings::Commify(pvp_points))
);
has_currency = true;
}
currency_table = DialogueWindow::Table(currency_table);
if (!has_currency) {
c->Message(
Chat::White,
fmt::format(
"{} {} not have any currencies.",
c->GetTargetDescription(t, TargetDescriptionType::UCYou),
c == t ? "do" : "does"
).c_str()
);
return;
}
c->SendPopupToClient(
fmt::format(
"Currency for {}",
c->GetTargetDescription(t, TargetDescriptionType::UCSelf)
).c_str(),
currency_table.c_str()
);
}
+23
View File
@@ -0,0 +1,23 @@
#include "../../client.h"
void ShowDistance(Client *c, const Seperator *sep)
{
if (!c->GetTarget() || c->GetTarget() == c) {
c->Message(Chat::White, "You must have a target to use this command.");
return;
}
const auto t = c->GetTarget();
c->Message(
Chat::White,
fmt::format(
"{} is {:.2f} units from you.",
c->GetTargetDescription(t),
Distance(
c->GetPosition(),
t->GetPosition()
)
).c_str()
);
}
+57
View File
@@ -0,0 +1,57 @@
#include "../../client.h"
void ShowEmotes(Client *c, const Seperator *sep)
{
if (!c->GetTarget() || !c->GetTarget()->IsNPC()) {
c->Message(Chat::White, "You must target an NPC to view their emotes.");
return;
}
const auto t = c->GetTarget()->CastToNPC();
uint32 emote_count = 0;
const uint32 emote_id = t->GetEmoteID();
LinkedListIterator<NPC_Emote_Struct *> iterator(zone->NPCEmoteList);
iterator.Reset();
while (iterator.MoreElements()) {
const auto& e = iterator.GetData();
if (emote_id == e->emoteid) {
c->Message(
Chat::White,
fmt::format(
"Emote {} | Event: {} ({}) Type: {} ({})",
e->emoteid,
EQ::constants::GetEmoteEventTypeName(e->event_),
e->event_,
EQ::constants::GetEmoteTypeName(e->type),
e->type
).c_str()
);
c->Message(
Chat::White,
fmt::format(
"Emote {} | Text: {}",
e->emoteid,
e->text
).c_str()
);
emote_count++;
}
iterator.Advance();
}
c->Message(
Chat::White,
fmt::format(
"{} has {} emote{} on Emote ID {}.",
c->GetTargetDescription(t),
emote_count,
emote_count != 1 ? "s" : "",
emote_id
).c_str()
);
}
+23
View File
@@ -0,0 +1,23 @@
#include "../../client.h"
void ShowFieldOfView(Client *c, const Seperator *sep)
{
if (!c->GetTarget() || c->GetTarget() == c) {
c->Message(Chat::White, "You must have a target to use this command.");
return;
}
const auto t = c->GetTarget();
const bool is_behind = c->BehindMob(t, c->GetX(), c->GetY());
c->Message(
Chat::White,
fmt::format(
"You are {}behind {}, they have a heading of {}.",
is_behind ? "" : "not ",
c->GetTargetDescription(t),
t->GetHeading()
).c_str()
);
}
+16
View File
@@ -0,0 +1,16 @@
#include "../../client.h"
void ShowFlags(Client *c, const Seperator *sep)
{
auto t = c;
if (
c->GetTarget() &&
c->GetTarget()->IsClient() &&
c->Admin() >= minStatusToSeeOthersZoneFlags
) {
t = c->GetTarget()->CastToClient();
}
t->SendZoneFlagInfo(c);
}
+89
View File
@@ -0,0 +1,89 @@
#include "../../client.h"
#include "../../dialogue_window.h"
#include "../../groups.h"
void ShowGroupInfo(Client *c, const Seperator *sep)
{
auto t = c;
if (c->GetTarget() && c->GetTarget()->IsClient()) {
t = c->GetTarget()->CastToClient();
}
auto g = t->GetGroup();
if (!g) {
c->Message(
Chat::White,
fmt::format(
"{} {} not in a group.",
c->GetTargetDescription(t, TargetDescriptionType::UCYou),
c == t ? "are" : "is"
).c_str()
);
return;
}
std::string popup_table;
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Group ID") +
DialogueWindow::TableCell(Strings::Commify(g->GetID()))
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Members") +
DialogueWindow::TableCell(std::to_string(g->GroupCount()))
);
popup_table += DialogueWindow::Break(2);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Index") +
DialogueWindow::TableCell("Name") +
DialogueWindow::TableCell("In Zone") +
DialogueWindow::TableCell("Assist") +
DialogueWindow::TableCell("Puller") +
DialogueWindow::TableCell("Tank")
);
const std::string yes = DialogueWindow::ColorMessage("forest_green", "Y");
const std::string no = DialogueWindow::ColorMessage("red1", "N");
for (int group_member = 0; group_member < MAX_GROUP_MEMBERS; group_member++) {
if (g->membername[group_member][0] == '\0') {
continue;
}
const bool is_assist = g->MemberRoles[group_member] & RoleAssist;
const bool is_puller = g->MemberRoles[group_member] & RolePuller;
const bool is_tank = g->MemberRoles[group_member] & RoleTank;
popup_table += DialogueWindow::TableRow(
fmt::format(
"{}{}{}{}{}{}",
group_member,
(
strcmp(g->membername[group_member], c->GetCleanName()) ?
g->membername[group_member] :
fmt::format(
"{} (You)",
g->membername[group_member]
)
),
g->members[group_member] ? yes : no,
is_assist ? yes : no,
is_puller ? yes : no,
is_tank ? yes : no
)
);
}
popup_table = DialogueWindow::Table(popup_table);
c->SendPopupToClient(
fmt::format(
"Group Info for {}",
c->GetTargetDescription(t, TargetDescriptionType::UCSelf)
).c_str(),
popup_table.c_str()
);
}
+13
View File
@@ -0,0 +1,13 @@
#include "../../client.h"
void ShowHateList(Client *c, const Seperator *sep)
{
if (!c->GetTarget() || !c->GetTarget()->IsNPC()) {
c->Message(Chat::White, "You must target an NPC to use this command.");
return;
}
const auto t = c->GetTarget();
t->PrintHateListToClient(c);
}
+450
View File
@@ -0,0 +1,450 @@
#include "../../client.h"
#include "../../object.h"
void ShowInventory(Client *c, const Seperator *sep)
{
const auto arguments = sep->argnum;
if (arguments < 2) {
SendShowInventorySubCommands(c);
return;
}
// this can be cleaned up once inventory is cleaned up
enum {
peekNone = 0x0000,
peekEquip = 0x0001,
peekGen = 0x0002,
peekCursor = 0x0004,
peekLimbo = 0x0008,
peekTrib = 0x0010,
peekBank = 0x0020,
peekShBank = 0x0040,
peekTrade = 0x0080,
peekWorld = 0x0100,
peekOutOfScope = (peekWorld * 2)
};
static const int16 scope_range[][2] = {
{ EQ::invslot::EQUIPMENT_BEGIN, EQ::invslot::EQUIPMENT_END },
{ EQ::invslot::GENERAL_BEGIN, EQ::invslot::GENERAL_END },
{ EQ::invslot::slotCursor, EQ::invslot::slotCursor },
{ EQ::invslot::SLOT_INVALID, EQ::invslot::SLOT_INVALID },
{ EQ::invslot::TRIBUTE_BEGIN, EQ::invslot::TRIBUTE_END },
{ EQ::invslot::BANK_BEGIN, EQ::invslot::BANK_END },
{ EQ::invslot::SHARED_BANK_BEGIN, EQ::invslot::SHARED_BANK_END },
{ EQ::invslot::TRADE_BEGIN, EQ::invslot::TRADE_END },
{ EQ::invslot::SLOT_BEGIN, (EQ::invtype::WORLD_SIZE - 1) }
};
static const bool scope_bag[] = {
false, // Equip
true, // General
true, // Cursor
true, // Cursor Limbo
false, // Tribute
true, // Bank
true, // Shared Bank
true, // Trade
true // World
};
int scope_mask = peekNone;
const bool is_all = !strcasecmp(sep->arg[2], "all");
const bool is_all_bank = !strcasecmp(sep->arg[2], "allbank");
const bool is_bank = !strcasecmp(sep->arg[2], "bank");
const bool is_cursor = !strcasecmp(sep->arg[2], "cursor");
const bool is_cursor_limbo = !strcasecmp(sep->arg[2], "curlimbo");
const bool is_equipment = !strcasecmp(sep->arg[2], "equip");
const bool is_general = !strcasecmp(sep->arg[2], "gen");
const bool is_limbo = !strcasecmp(sep->arg[2], "limbo");
const bool is_possessions = !strcasecmp(sep->arg[2], "poss");
const bool is_shared_bank = !strcasecmp(sep->arg[2], "shbank");
const bool is_trade = !strcasecmp(sep->arg[2], "trade");
const bool is_tribute = !strcasecmp(sep->arg[2], "trib");
const bool is_world = !strcasecmp(sep->arg[2], "world");
if (is_all) {
scope_mask = (peekOutOfScope - 1);
} else if (is_all_bank) {
scope_mask |= (peekBank | peekShBank);
} else if (is_bank) {
scope_mask |= peekBank;
} else if (is_cursor) {
scope_mask |= peekCursor;
} else if (is_cursor_limbo) {
scope_mask |= (peekCursor | peekLimbo);
} else if (is_equipment) {
scope_mask |= peekEquip;
} else if (is_general) {
scope_mask |= peekGen;
} else if (is_limbo) {
scope_mask |= peekLimbo;
} else if (is_possessions) {
scope_mask |= (peekEquip | peekGen | peekCursor);
} else if (is_shared_bank) {
scope_mask |= peekShBank;
} else if (is_tribute) {
scope_mask |= peekTrib;
} else if (is_trade) {
scope_mask |= peekTrade;
} else if (is_world) {
scope_mask |= peekWorld;
} else {
SendShowInventorySubCommands(c);
return;
}
auto t = c;
if (c->GetTarget() && c->GetTarget()->IsClient()) {
t = c->GetTarget()->CastToClient();
}
const EQ::ItemInstance *inst_main = nullptr;
const EQ::ItemInstance *inst_sub = nullptr;
const EQ::ItemInstance *inst_aug = nullptr;
const EQ::ItemData *item_data = nullptr;
EQ::SayLinkEngine linker;
linker.SetLinkType(EQ::saylink::SayLinkItemInst);
c->Message(
Chat::White,
fmt::format(
"Displaying inventory of {}.",
c->GetTargetDescription(t)
).c_str()
);
auto o = t->GetTradeskillObject();
auto found_items = false;
for (int scope_index = 0, scope_bit = peekEquip; scope_bit < peekOutOfScope; ++scope_index, scope_bit <<= 1) {
if (scope_bit & ~scope_mask) {
continue;
}
if (scope_bit & peekWorld) {
if (!o) {
c->Message(Chat::White, "No world Tradeskill object selected.");
continue;
} else {
c->Message(
Chat::White,
fmt::format(
"[World Object] Database ID: {} Entity ID: {}",
o->GetDBID(),
o->GetID()
).c_str()
);
}
}
for (int16 index_main = scope_range[scope_index][0]; index_main <= scope_range[scope_index][1]; ++index_main) {
if (index_main == EQ::invslot::SLOT_INVALID) {
continue;
}
inst_main = (
(scope_bit & peekWorld) ?
o->GetItem(index_main) :
t->GetInv().GetItem(index_main)
);
if (inst_main) {
found_items = true;
item_data = inst_main->GetItem();
} else {
item_data = nullptr;
}
linker.SetItemInst(inst_main);
if (item_data) {
c->Message(
Chat::White,
fmt::format(
"Slot {} | {} ({}){}",
((scope_bit & peekWorld) ? (EQ::invslot::WORLD_BEGIN + index_main) : index_main),
linker.GenerateLink(),
item_data->ID,
(
inst_main->IsStackable() && inst_main->GetCharges() > 0 ?
fmt::format(
" (Stack of {})",
inst_main->GetCharges()
) :
""
)
).c_str()
);
}
if (inst_main && inst_main->IsClassCommon()) {
for (uint8 augment_index = EQ::invaug::SOCKET_BEGIN; augment_index <= EQ::invaug::SOCKET_END; ++augment_index) {
inst_aug = inst_main->GetItem(augment_index);
if (!inst_aug) { // extant only
continue;
}
item_data = inst_aug->GetItem();
linker.SetItemInst(inst_aug);
c->Message(
Chat::White,
fmt::format(
"Slot {} (Augment Slot {}) | {} ({}){}",
((scope_bit & peekWorld) ? (EQ::invslot::WORLD_BEGIN + index_main) : index_main),
augment_index,
linker.GenerateLink(),
item_data->ID,
(
inst_aug->IsStackable() && inst_aug->GetCharges() > 0 ?
fmt::format(
" (Stack of {})",
inst_aug->GetCharges()
) :
""
)
).c_str()
);
}
}
if (!scope_bag[scope_index] || !(inst_main && inst_main->IsClassBag())) {
continue;
}
for (uint8 sub_index = EQ::invbag::SLOT_BEGIN; sub_index <= EQ::invbag::SLOT_END; ++sub_index) {
inst_sub = inst_main->GetItem(sub_index);
if (!inst_sub) { // extant only
continue;
}
item_data = inst_sub->GetItem();
linker.SetItemInst(inst_sub);
c->Message(
Chat::White,
fmt::format(
"Slot {} Bag Slot {} | {} ({}){}",
(
(scope_bit & peekWorld) ?
INVALID_INDEX :
EQ::InventoryProfile::CalcSlotId(index_main, sub_index)
),
((scope_bit & peekWorld) ? (EQ::invslot::WORLD_BEGIN + index_main) : index_main),
sub_index,
linker.GenerateLink(),
item_data->ID,
(
inst_sub->IsStackable() && inst_sub->GetCharges() > 0 ?
fmt::format(
" (Stack of {})",
inst_sub->GetCharges()
) :
""
)
).c_str()
);
if (inst_sub->IsClassCommon()) {
for (uint8 augment_index = EQ::invaug::SOCKET_BEGIN; augment_index <= EQ::invaug::SOCKET_END; ++augment_index) {
inst_aug = inst_sub->GetItem(augment_index);
if (!inst_aug) { // extant only
continue;
}
item_data = inst_aug->GetItem();
linker.SetItemInst(inst_aug);
c->Message(
Chat::White,
fmt::format(
"Slot {} Bag Slot {} (Augment Slot {}) | {} ({}){}",
(
(scope_bit & peekWorld) ?
INVALID_INDEX :
EQ::InventoryProfile::CalcSlotId(index_main,sub_index)
),
sub_index,
augment_index,
linker.GenerateLink(),
item_data->ID,
(
inst_sub->IsStackable() && inst_sub->GetCharges() > 0 ?
fmt::format(
" (Stack of {})",
inst_sub->GetCharges()
) :
""
)
).c_str()
);
}
}
}
}
if (scope_bit & peekLimbo) {
int limboIndex = 0;
for (auto it = t->GetInv().cursor_cbegin(); (it != t->GetInv().cursor_cend()); ++it, ++limboIndex) {
if (it == t->GetInv().cursor_cbegin()) {
continue;
}
inst_main = *it;
if (inst_main) {
found_items = true;
item_data = inst_main->GetItem();
} else {
item_data = nullptr;
}
linker.SetItemInst(inst_main);
if (item_data) {
c->Message(
Chat::White,
fmt::format(
"Slot {} | {} ({}){}",
(8000 + limboIndex),
item_data->ID,
linker.GenerateLink(),
(
inst_main->IsStackable() && inst_main->GetCharges() > 0 ?
fmt::format(
" (Stack of {})",
inst_main->GetCharges()
) :
""
)
).c_str()
);
}
if (inst_main && inst_main->IsClassCommon()) {
for (uint8 augment_index = EQ::invaug::SOCKET_BEGIN; augment_index <= EQ::invaug::SOCKET_END; ++augment_index) {
inst_aug = inst_main->GetItem(augment_index);
if (!inst_aug) { // extant only
continue;
}
item_data = inst_aug->GetItem();
linker.SetItemInst(inst_aug);
c->Message(
Chat::White,
fmt::format(
"Slot {} (Augment Slot {}) | {} ({}){}",
(8000 + limboIndex),
augment_index,
linker.GenerateLink(),
item_data->ID,
(
inst_aug->IsStackable() && inst_aug->GetCharges() > 0 ?
fmt::format(
" (Stack of {})",
inst_aug->GetCharges()
) :
""
)
).c_str()
);
}
}
if (!scope_bag[scope_index] || !(inst_main && inst_main->IsClassBag())) {
continue;
}
for (uint8 sub_index = EQ::invbag::SLOT_BEGIN; sub_index <= EQ::invbag::SLOT_END; ++sub_index) {
inst_sub = inst_main->GetItem(sub_index);
if (!inst_sub) {
continue;
}
item_data = (inst_sub == nullptr) ? nullptr : inst_sub->GetItem();
linker.SetItemInst(inst_sub);
if (item_data) {
c->Message(
Chat::White,
fmt::format(
"Slot {} Bag Slot {} | {} ({}){}",
(8000 + limboIndex),
sub_index,
linker.GenerateLink(),
item_data->ID,
(
inst_sub->IsStackable() && inst_sub->GetCharges() > 0 ?
fmt::format(
" (Stack of {})",
inst_sub->GetCharges()
) :
""
)
).c_str()
);
}
if (inst_sub->IsClassCommon()) {
for (uint8 augment_index = EQ::invaug::SOCKET_BEGIN;
augment_index <= EQ::invaug::SOCKET_END;
++augment_index) {
inst_aug = inst_sub->GetItem(augment_index);
if (!inst_aug) { // extant only
continue;
}
item_data = inst_aug->GetItem();
linker.SetItemInst(inst_aug);
c->Message(
Chat::White,
fmt::format(
"Slot {} Bag Slot {} (Augment Slot {}) | {} ({}){}",
(8000 + limboIndex),
sub_index,
augment_index,
linker.GenerateLink(),
item_data->ID,
(
inst_sub->IsStackable() && inst_sub->GetCharges() > 0 ?
fmt::format(
" (Stack of {})",
inst_sub->GetCharges()
) :
""
)
).c_str()
);
}
}
}
}
}
}
if (!found_items) {
c->Message(Chat::White, "No items found.");
}
}
void SendShowInventorySubCommands(Client* c) {
c->Message(Chat::White, "Usage: #show inventory equip - Shows items in Equipment slots");
c->Message(Chat::White, "Usage: #show inventory gen - Shows items in General slots");
c->Message(Chat::White, "Usage: #show inventory cursor - Shows items in Cursor slots");
c->Message(Chat::White, "Usage: #show inventory poss - Shows items in Equipment, General, and Cursor slots");
c->Message(Chat::White, "Usage: #show inventory limbo - Shows items in Limbo slots");
c->Message(Chat::White, "Usage: #show inventory curlim - Shows items in Cursor and Limbo slots");
c->Message(Chat::White, "Usage: #show inventory trib - Shows items in Tribute slots");
c->Message(Chat::White, "Usage: #show inventory bank - Shows items in Bank slots");
c->Message(Chat::White, "Usage: #show inventory shbank - Shows items in Shared Bank slots");
c->Message(Chat::White, "Usage: #show inventory allbank - Shows items in Bank and Shared Bank slots");
c->Message(Chat::White, "Usage: #show inventory trade - Shows items in Trade slots");
c->Message(Chat::White, "Usage: #show inventory world - Shows items in World slots");
c->Message(Chat::White, "Usage: #show inventory all - Shows items in all slots");
}
+25
View File
@@ -0,0 +1,25 @@
#include "../../client.h"
#include "../../worldserver.h"
extern WorldServer worldserver;
void ShowIPLookup(Client *c, const Seperator *sep)
{
const uint32 ip_length = strlen(sep->argplus[2]);
auto pack = new ServerPacket(
ServerOP_IPLookup,
sizeof(ServerGenericWorldQuery_Struct) + ip_length + 1
);
auto s = (ServerGenericWorldQuery_Struct *) pack->pBuffer;
strn0cpy(s->from, c->GetName(), sizeof(s->from));
s->admin = c->Admin();
if (ip_length) {
strcpy(s->query, sep->argplus[2]);
}
worldserver.SendPacket(pack);
safe_delete(pack);
}
+22
View File
@@ -0,0 +1,22 @@
#include "../../client.h"
void ShowLineOfSight(Client *c, const Seperator *sep)
{
if (!c->GetTarget() || c->GetTarget() == c) {
c->Message(Chat::White, "You must have a target to use this command.");
return;
}
const auto t = c->GetTarget();
const bool has_los = c->CheckLosFN(t);
c->Message(
Chat::White,
fmt::format(
"You {}have line of sight to {}.",
has_los ? "" : "do not ",
c->GetTargetDescription(t)
).c_str()
);
}
+138
View File
@@ -0,0 +1,138 @@
#include "../../client.h"
#include "../../dialogue_window.h"
void ShowNetwork(Client *c, const Seperator *sep)
{
auto eqsi = c->Connection();
auto manager = eqsi->GetManager();
auto opts = manager->GetOptions();
std::string popup_table;
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Option") +
DialogueWindow::TableCell("Value")
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Max Packet Size") +
DialogueWindow::TableCell(Strings::Commify(opts.daybreak_options.max_packet_size))
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Max Connection Count") +
DialogueWindow::TableCell(Strings::Commify(opts.daybreak_options.max_connection_count))
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Keep Alive Delay") +
DialogueWindow::TableCell(Strings::MillisecondsToTime(opts.daybreak_options.keepalive_delay_ms))
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Resend Delay Factor") +
DialogueWindow::TableCell(
fmt::format(
"{:.2f}",
opts.daybreak_options.resend_delay_factor
)
)
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Resend Delay") +
DialogueWindow::TableCell(Strings::MillisecondsToTime(opts.daybreak_options.resend_delay_ms))
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Resend Delay Minimum") +
DialogueWindow::TableCell(Strings::MillisecondsToTime(opts.daybreak_options.resend_delay_min))
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Resend Delay Maximum") +
DialogueWindow::TableCell(Strings::MillisecondsToTime(opts.daybreak_options.resend_delay_max))
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Connect Delay") +
DialogueWindow::TableCell(Strings::MillisecondsToTime(opts.daybreak_options.connect_delay_ms))
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Connect Stale") +
DialogueWindow::TableCell(Strings::MillisecondsToTime(opts.daybreak_options.connect_stale_ms))
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Stale Connection") +
DialogueWindow::TableCell(Strings::MillisecondsToTime(opts.daybreak_options.stale_connection_ms))
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("CRC Length") +
DialogueWindow::TableCell(Strings::Commify(opts.daybreak_options.crc_length))
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Hold Size") +
DialogueWindow::TableCell(Strings::Commify(opts.daybreak_options.hold_size))
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Hold Length") +
DialogueWindow::TableCell(Strings::MillisecondsToTime(opts.daybreak_options.hold_length_ms))
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Simulated In Packet Loss") +
DialogueWindow::TableCell(std::to_string(opts.daybreak_options.simulated_in_packet_loss))
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Simulated Out Packet Loss") +
DialogueWindow::TableCell(std::to_string(opts.daybreak_options.simulated_out_packet_loss))
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Tic Rate (Hz)") +
DialogueWindow::TableCell(
fmt::format(
"{:.2f}",
opts.daybreak_options.tic_rate_hertz
)
)
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Resend Timeout") +
DialogueWindow::TableCell(Strings::MillisecondsToTime(opts.daybreak_options.resend_timeout))
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Connection Close Time") +
DialogueWindow::TableCell(Strings::MillisecondsToTime(opts.daybreak_options.connection_close_time))
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Encode Passes (1)") +
DialogueWindow::TableCell(Strings::Commify(opts.daybreak_options.encode_passes[0]))
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Encode Passes (2)") +
DialogueWindow::TableCell(Strings::Commify(opts.daybreak_options.encode_passes[1]))
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Port") +
DialogueWindow::TableCell(Strings::Commify(opts.daybreak_options.port))
);
popup_table = DialogueWindow::Table(popup_table);
c->SendPopupToClient(
"Network Information",
popup_table.c_str()
);
}
+297
View File
@@ -0,0 +1,297 @@
#include "../../client.h"
#include "../../dialogue_window.h"
void ShowNetworkStats(Client *c, const Seperator *sep)
{
const auto connection = c->Connection();
const auto opts = connection->GetManager()->GetOptions();
const auto eqs_stats = connection->GetStats();
const auto& stats = eqs_stats.DaybreakStats;
const auto sec_since_stats_reset = std::chrono::duration_cast<std::chrono::duration<double>>(
EQ::Net::Clock::now() - stats.created
).count();
std::string popup_table;
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Sent Bytes") +
DialogueWindow::TableCell(
fmt::format(
"{} ({:.2f} Per Second)",
Strings::Commify(stats.sent_bytes),
stats.sent_bytes / sec_since_stats_reset
)
)
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Received Bytes") +
DialogueWindow::TableCell(
fmt::format(
"{} ({:.2f} Per Second)",
Strings::Commify(stats.recv_bytes),
stats.recv_bytes / sec_since_stats_reset
)
)
);
popup_table += DialogueWindow::Break(2);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Sent Bytes Before Encode") +
DialogueWindow::TableCell(Strings::Commify(stats.bytes_before_encode)) +
DialogueWindow::TableCell("Compression Rate") +
DialogueWindow::TableCell(
fmt::format(
"{:.2f}%%",
static_cast<double>(stats.bytes_before_encode - stats.sent_bytes) /
static_cast<double>(stats.bytes_before_encode) * 100.0
)
)
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Sent Bytes After Encode") +
DialogueWindow::TableCell(Strings::Commify(stats.bytes_after_decode)) +
DialogueWindow::TableCell("Compression Rate") +
DialogueWindow::TableCell(
fmt::format(
"{:.2f}%%",
static_cast<double>(stats.bytes_after_decode - stats.recv_bytes) /
static_cast<double>(stats.bytes_after_decode) * 100.0
)
)
);
popup_table += DialogueWindow::Break(2);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Minimum Ping") +
DialogueWindow::TableCell(Strings::Commify(stats.min_ping))
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Maximum Ping") +
DialogueWindow::TableCell(Strings::Commify(stats.max_ping))
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Last Ping") +
DialogueWindow::TableCell(Strings::Commify(stats.last_ping))
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Average Ping") +
DialogueWindow::TableCell(Strings::Commify(stats.avg_ping))
);
popup_table += DialogueWindow::Break(2);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Real Time Received Packets") +
DialogueWindow::TableCell(
fmt::format(
"{} ({:.2f} Per Second)",
Strings::Commify(stats.recv_packets),
stats.recv_packets / sec_since_stats_reset
)
)
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Real Time Sent Packets") +
DialogueWindow::TableCell(
fmt::format(
"{} ({:.2f} Per Second)",
Strings::Commify(stats.sent_packets),
stats.sent_packets / sec_since_stats_reset
)
)
);
popup_table += DialogueWindow::Break(2);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Sync Received Packets") +
DialogueWindow::TableCell(Strings::Commify(stats.sync_recv_packets))
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Sync Sent Packets") +
DialogueWindow::TableCell(Strings::Commify(stats.sync_sent_packets))
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Sync Remote Received Packets") +
DialogueWindow::TableCell(Strings::Commify(stats.sync_remote_recv_packets))
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Sync Remote Sent Packets") +
DialogueWindow::TableCell(Strings::Commify(stats.sync_remote_sent_packets))
);
popup_table += DialogueWindow::Break(2);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Packet Loss In") +
DialogueWindow::TableCell(
fmt::format(
"{:.2f}%%",
(
100.0 *
(
1.0 -
static_cast<double>(stats.sync_recv_packets) /
static_cast<double>(stats.sync_remote_sent_packets)
)
)
)
)
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Packet Loss Out") +
DialogueWindow::TableCell(
fmt::format(
"{:.2f}%%",
(
100.0 *
(
1.0 -
static_cast<double>(stats.sync_remote_recv_packets) /
static_cast<double>(stats.sync_sent_packets)
)
)
)
)
);
popup_table += DialogueWindow::Break(2);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Resent Packets") +
DialogueWindow::TableCell(
fmt::format(
"{} ({:.2f} Per Second)",
Strings::Commify(stats.resent_packets),
stats.resent_packets / sec_since_stats_reset
)
)
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Resent Fragments") +
DialogueWindow::TableCell(
fmt::format(
"{} ({:.2f} Per Second)",
Strings::Commify(stats.resent_fragments),
stats.resent_fragments / sec_since_stats_reset
)
)
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Resent Non-Fragments") +
DialogueWindow::TableCell(
fmt::format(
"{} ({:.2f} Per Second)",
Strings::Commify(stats.resent_full),
stats.resent_full / sec_since_stats_reset
)
)
);
popup_table += DialogueWindow::Break(2);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Dropped Datarate Packets") +
DialogueWindow::TableCell(
fmt::format(
"{} ({:.2f} Per Second)",
Strings::Commify(stats.dropped_datarate_packets),
stats.dropped_datarate_packets / sec_since_stats_reset
)
)
);
if (opts.daybreak_options.outgoing_data_rate > 0.0) {
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Outgoing Link Saturation") +
DialogueWindow::TableCell(
fmt::format(
"{:.2f}%% ({:.2f}kb Per Second)",
(
100.0 *
(
1.0 -
(
(
opts.daybreak_options.outgoing_data_rate -
stats.datarate_remaining
) /
opts.daybreak_options.outgoing_data_rate
)
)
),
opts.daybreak_options.outgoing_data_rate
)
)
);
}
popup_table += DialogueWindow::Break(2);
std::string sent_rows;
for (int i = 0; i < _maxEmuOpcode; ++i) {
const int count = eqs_stats.SentCount[i];
if (count) {
sent_rows += DialogueWindow::TableRow(
DialogueWindow::TableCell(OpcodeNames[i]) +
DialogueWindow::TableCell(
fmt::format(
"{} ({:.2f} Per Second)",
Strings::Commify(count),
count / sec_since_stats_reset
)
)
);
}
}
std::string recv_rows;
for (int i = 0; i < _maxEmuOpcode; ++i) {
const int count = eqs_stats.RecvCount[i];
if (count) {
recv_rows += DialogueWindow::TableRow(
DialogueWindow::TableCell(OpcodeNames[i]) +
DialogueWindow::TableCell(
fmt::format(
"{} ({:.2f} Per Second)",
Strings::Commify(count),
count / sec_since_stats_reset
)
)
);
}
}
popup_table += DialogueWindow::TableRow(DialogueWindow::TableCell("Sent Packet Types"));
popup_table += sent_rows;
popup_table += DialogueWindow::TableRow(DialogueWindow::TableCell("Received Packet Types"));
popup_table += recv_rows;
popup_table = DialogueWindow::Table(popup_table);
c->SendPopupToClient(
"Network Statistics",
popup_table.c_str()
);
}
+13
View File
@@ -0,0 +1,13 @@
#include "../../client.h"
void ShowNPCGlobalLoot(Client *c, const Seperator *sep)
{
if (!c->GetTarget() || !c->GetTarget()->IsNPC()) {
c->Message(Chat::White, "You must target an NPC to use this command.");
return;
}
const auto t = c->GetTarget()->CastToNPC();
zone->ShowNPCGlobalLoot(c, t);
}
+17
View File
@@ -0,0 +1,17 @@
#include "../../client.h"
void ShowNPCStats(Client *c, const Seperator *sep)
{
if (!c->GetTarget() || !c->GetTarget()->IsNPC()) {
c->Message(Chat::White, "You must target an NPC to use this command.");
return;
}
const auto t = c->GetTarget()->CastToNPC();
// Stats
t->ShowStats(c);
// Loot Data
t->QueryLoot(c);
}
+35
View File
@@ -0,0 +1,35 @@
#include "../../client.h"
void ShowNPCType(Client *c, const Seperator *sep)
{
if (!sep->IsNumber(2)) {
c->Message(Chat::White, "Usage: #show npc_type [NPC ID]");
return;
}
const uint32 npc_id = Strings::ToUnsignedInt(sep->arg[2]);
const auto d = content_db.LoadNPCTypesData(npc_id);
if (!d) {
c->Message(
Chat::White,
fmt::format(
"NPC ID {} was not found.",
npc_id
).c_str()
);
return;
}
auto npc = new NPC(
d,
nullptr,
c->GetPosition(),
GravityBehavior::Water
);
npc->ShowStats(c);
safe_delete(npc);
}
+15
View File
@@ -0,0 +1,15 @@
#include "../../client.h"
void ShowPEQZoneFlags(Client *c, const Seperator *sep)
{
auto t = c;
if (
c->GetTarget() &&
c->GetTarget()->IsClient() &&
c->Admin() >= minStatusToSeeOthersZoneFlags
) {
t = c->GetTarget()->CastToClient();
}
t->SendPEQZoneFlagInfo(c);
}
+69
View File
@@ -0,0 +1,69 @@
#include "../../client.h"
#include "../../common/repositories/petitions_repository.h"
void ShowPetition(Client *c, const Seperator *sep)
{
if (!sep->IsNumber(2)) {
const auto& l = PetitionsRepository::All(database);
uint32 found_count = 0;
for (const auto& e : l) {
c->Message(
Chat::White,
fmt::format(
"Petition {} | Name: {} Text: {}",
e.petid,
e.charname,
e.petitiontext
).c_str()
);
found_count++;
if (found_count == 50) {
break;
}
}
if (found_count == 50) {
c->Message(Chat::White, "50 Petitions found, max reached.");
}
c->Message(
Chat::White,
fmt::format(
"{} Petition{} found.",
found_count,
found_count != 1 ? "s" : ""
).c_str()
);
return;
}
const uint32 petition_id = Strings::ToUnsignedInt(sep->arg[2]);
const auto& l = PetitionsRepository::GetWhere(database, fmt::format("petition_id = {}", petition_id));
if (l.empty()) {
c->Message(
Chat::White,
fmt::format(
"Petition ID {} was not found.",
petition_id
).c_str()
);
return;
}
c->Message(
Chat::White,
fmt::format(
"Petition {} | Name: {} Text: {}",
l[0].petid,
l[0].charname,
l[0].petitiontext
).c_str()
);
}
+79
View File
@@ -0,0 +1,79 @@
#include "../../client.h"
#include "../../common/repositories/petitions_repository.h"
void ShowPetitionInfo(Client *c, const Seperator *sep)
{
if (!sep->IsNumber(2)) {
const auto& l = PetitionsRepository::All(database);
uint32 found_count = 0;
for (const auto& e : l) {
c->Message(
Chat::White,
fmt::format(
"Petition {} | Name: {} Text: {} Account: {} Zone: {} Class: {} Race: {} Level: {}",
e.petid,
e.charname,
e.petitiontext,
e.accountname,
e.zone,
GetClassIDName(static_cast<uint8>(e.charclass)),
GetRaceIDName(static_cast<uint16>(e.charrace)),
e.charlevel
).c_str()
);
found_count++;
if (found_count == 50) {
break;
}
}
if (found_count == 50) {
c->Message(Chat::White, "50 Petitions found, max reached.");
}
c->Message(
Chat::White,
fmt::format(
"{} Petition{} found.",
found_count,
found_count != 1 ? "s" : ""
).c_str()
);
return;
}
const uint32 petition_id = Strings::ToUnsignedInt(sep->arg[2]);
const auto& l = PetitionsRepository::GetWhere(database, fmt::format("petition_id = {}", petition_id));
if (l.empty()) {
c->Message(
Chat::White,
fmt::format(
"Petition ID {} was not found.",
petition_id
).c_str()
);
return;
}
c->Message(
Chat::White,
fmt::format(
"Petition {} | Name: {} Text: {} Account: {} Zone: {} Class: {} Race: {} Level: {}",
l[0].petid,
l[0].charname,
l[0].petitiontext,
l[0].accountname,
l[0].zone,
GetClassIDName(static_cast<uint8>(l[0].charclass)),
GetRaceIDName(static_cast<uint16>(l[0].charrace)),
l[0].charlevel
).c_str()
);
}
+73
View File
@@ -0,0 +1,73 @@
#include "../../client.h"
void ShowProximity(Client *c, const Seperator *sep)
{
if (!c->GetTarget() || !c->GetTarget()->IsNPC()) {
c->Message(Chat::White, "You must target an NPC to use this command.");
return;
}
for (const auto& n : entity_list.GetNPCList()) {
if (
n.second &&
Strings::Contains(n.second->GetName(), "Proximity")
) {
n.second->Depop();
}
}
const auto t = c->GetTarget()->CastToNPC();
std::vector<FindPerson_Point> v;
FindPerson_Point p {};
if (t->IsProximitySet()) {
glm::vec4 position;
position.w = t->GetHeading();
position.x = t->GetProximityMinX();
position.y = t->GetProximityMinY();
position.z = t->GetZ();
position.x = t->GetProximityMinX();
position.y = t->GetProximityMinY();
NPC::SpawnNodeNPC("Proximity", "", position);
position.x = t->GetProximityMinX();
position.y = t->GetProximityMaxY();
NPC::SpawnNodeNPC("Proximity", "", position);
position.x = t->GetProximityMaxX();
position.y = t->GetProximityMinY();
NPC::SpawnNodeNPC("Proximity", "", position);
position.x = t->GetProximityMaxX();
position.y = t->GetProximityMaxY();
NPC::SpawnNodeNPC("Proximity", "", position);
p.x = t->GetProximityMinX();
p.y = t->GetProximityMinY();
p.z = t->GetZ();
v.push_back(p);
p.x = t->GetProximityMinX();
p.y = t->GetProximityMaxY();
v.push_back(p);
p.x = t->GetProximityMaxX();
p.y = t->GetProximityMaxY();
v.push_back(p);
p.x = t->GetProximityMaxX();
p.y = t->GetProximityMinY();
v.push_back(p);
p.x = t->GetProximityMinX();
p.y = t->GetProximityMinY();
v.push_back(p);
}
if (c->ClientVersion() >= EQ::versions::ClientVersion::RoF) {
c->SendPathPacket(v);
}
}
+35
View File
@@ -0,0 +1,35 @@
#include "../../client.h"
#include "../../quest_parser_collection.h"
void ShowQuestErrors(Client *c, const Seperator *sep)
{
std::list<std::string> l;
parse->GetErrors(l);
if (!l.size()) {
c->Message(Chat::White, "There are no Quest errors currently.");
return;
}
c->Message(Chat::White, "Quest errors currently are as follows:");
uint32 error_count = 0;
for (const auto& e : l) {
if (error_count >= RuleI(World, MaximumQuestErrors)) {
c->Message(
Chat::White,
fmt::format(
"Maximum of {} error{} shown.",
RuleI(World, MaximumQuestErrors),
RuleI(World, MaximumQuestErrors) != 1 ? "s" : ""
).c_str()
);
break;
}
c->Message(Chat::White, e.c_str());
error_count++;
}
}
+76
View File
@@ -0,0 +1,76 @@
#include "../../client.h"
void ShowQuestGlobals(Client *c, const Seperator *sep)
{
Mob* t = c;
if (c->GetTarget()) {
t = c->GetTarget();
}
QGlobalCache* char_cache = c->GetQGlobals();
QGlobalCache* npc_cache = t->IsNPC() ? t->CastToNPC()->GetQGlobals() : nullptr;
QGlobalCache* zone_cache = zone->GetQGlobals();
std::list<QGlobal> global_map;
uint32 character_id = c->CharacterID();
uint32 npc_id = t->IsNPC() ? t->CastToNPC()->GetNPCTypeID() : 0;
uint32 zone_id = zone->GetZoneID();
if (npc_cache) {
QGlobalCache::Combine(
global_map,
npc_cache->GetBucket(),
npc_id,
character_id,
zone_id
);
}
if (char_cache) {
QGlobalCache::Combine(
global_map,
char_cache->GetBucket(),
npc_id,
character_id,
zone_id
);
}
if (zone_cache) {
QGlobalCache::Combine(
global_map,
zone_cache->GetBucket(),
npc_id,
character_id,
zone_id
);
}
uint32 global_count = 0;
uint32 global_number = 1;
for (const auto& g : global_map) {
c->Message(
Chat::White,
fmt::format(
"Quest Global {} | Name: {} Value: {}",
global_number,
g.name,
g.value
).c_str()
);
global_count++;
global_number++;
}
c->Message(
Chat::White,
fmt::format(
"{} Quest Global{} found.",
global_count,
global_count != 1 ? "s" : ""
).c_str()
);
}
+134
View File
@@ -0,0 +1,134 @@
#include "../../client.h"
#include "../../command.h"
#include "../../common/repositories/tradeskill_recipe_repository.h"
#include "../../common/repositories/tradeskill_recipe_entries_repository.h"
void ShowRecipe(Client *c, const Seperator *sep)
{
if (!sep->IsNumber(2)) {
c->Message(Chat::White, "Command Syntax: #show recipe [Recipe ID]");
return;
}
const uint16 recipe_id = static_cast<uint16>(Strings::ToUnsignedInt(sep->arg[2]));
const auto& re = TradeskillRecipeEntriesRepository::GetWhere(
database,
fmt::format("recipe_id = {} ORDER BY id ASC", recipe_id)
);
const auto& r = TradeskillRecipeRepository::GetWhere(
database,
fmt::format("id = {}", recipe_id)
);
if (re.empty() || r.empty()) {
c->Message(
Chat::White,
fmt::format(
"Recipe ID {} has no entries or could not be found.",
Strings::Commify(recipe_id)
).c_str()
);
return;
}
c->Message(
Chat::White,
fmt::format(
"Recipe {} | {}",
Strings::Commify(recipe_id),
r[0].name
).c_str()
);
uint32 entry_number = 1;
const bool can_summon_items = c->Admin() >= GetCommandStatus(c, "summonitem");
for (const auto& e : re) {
c->Message(
Chat::White,
fmt::format(
"Entry {}{} | {}{}",
entry_number,
e.iscontainer > 0 ? " (Container)" : "",
(
e.item_id > 1000 ?
database.CreateItemLink(e.item_id) :
EQ::constants::GetObjectTypeName(e.item_id)
),
(
can_summon_items && e.item_id > 1000 ?
fmt::format(
" | {}",
Saylink::Silent(
fmt::format("#si {}", e.item_id),
"Summon"
)
) :
""
)
).c_str()
);
std::vector<std::string> emv;
bool has_message = false;
if (e.componentcount) {
emv.push_back(
fmt::format(
"Component: {}",
e.componentcount
)
);
has_message = true;
}
if (e.failcount) {
emv.push_back(
fmt::format(
"Fail: {}",
e.failcount
)
);
has_message = true;
}
if (e.salvagecount) {
emv.push_back(
fmt::format(
"Salvage: {}",
e.salvagecount
)
);
has_message = true;
}
if (e.successcount) {
emv.push_back(
fmt::format(
"Success: {}",
e.successcount
)
);
has_message = true;
}
if (has_message) {
c->Message(
Chat::White,
fmt::format(
"Entry {} Counts | {}",
entry_number,
Strings::Implode(" | ", emv)
).c_str()
);
}
entry_number++;
}
}
+106
View File
@@ -0,0 +1,106 @@
#include "../../client.h"
#include "../../dialogue_window.h"
#include "../../common/serverinfo.h"
void ShowServerInfo(Client *c, const Seperator *sep)
{
auto os = EQ::GetOS();
auto cpus = EQ::GetCPUs();
const uint32 process_id = EQ::GetPID();
const double rss = EQ::GetRSS() / 1048576.0;
const uint32 uptime = static_cast<uint32>(EQ::GetUptime());
std::string popup_table;
std::string popup_text;
popup_text += DialogueWindow::CenterMessage(
DialogueWindow::ColorMessage("green", "Operating System Information")
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Machine") +
DialogueWindow::TableCell(os.machine)
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("System") +
DialogueWindow::TableCell(os.sysname)
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Release") +
DialogueWindow::TableCell(os.release)
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Uptime") +
DialogueWindow::TableCell(Strings::SecondsToTime(uptime))
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Version") +
DialogueWindow::TableCell(os.version)
);
popup_text += DialogueWindow::Table(popup_table);
popup_table = std::string();
popup_text += DialogueWindow::Break();
popup_text += DialogueWindow::CenterMessage(
DialogueWindow::ColorMessage("green", "CPU Information")
);
for (size_t cpu = 0; cpu < cpus.size(); ++cpu) {
auto &current_cpu = cpus[cpu];
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell(
fmt::format(
"CPU {}",
cpu
)
) +
DialogueWindow::TableCell(
fmt::format(
"{} ({:.2f}GHz)",
current_cpu.model,
current_cpu.speed
)
)
);
}
popup_text += DialogueWindow::Table(popup_table);
popup_table = std::string();
popup_text += DialogueWindow::Break();
popup_text += DialogueWindow::CenterMessage(
DialogueWindow::ColorMessage("green", "CPU Information")
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Process ID") +
DialogueWindow::TableCell(Strings::Commify(process_id))
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("RSS") +
DialogueWindow::TableCell(
fmt::format(
"{:.2f} MB",
rss
)
)
);
popup_text += DialogueWindow::Table(popup_table);
c->SendPopupToClient(
"Server Information",
popup_text.c_str()
);
}
+42
View File
@@ -0,0 +1,42 @@
#include "../../client.h"
#include "../../dialogue_window.h"
void ShowSkills(Client *c, const Seperator *sep)
{
auto t = c;
if (c->GetTarget() && c->GetTarget()->IsClient()) {
t = c->GetTarget()->CastToClient();
}
std::string popup_table;
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("ID") +
DialogueWindow::TableCell("Name") +
DialogueWindow::TableCell("Current") +
DialogueWindow::TableCell("Max") +
DialogueWindow::TableCell("Raw")
);
for (const auto& s : EQ::skills::GetSkillTypeMap()) {
if (t->CanHaveSkill(s.first) && t->MaxSkill(s.first)) {
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell(std::to_string(s.first)) +
DialogueWindow::TableCell(s.second) +
DialogueWindow::TableCell(std::to_string(t->GetSkill(s.first))) +
DialogueWindow::TableCell(std::to_string(t->MaxSkill(s.first))) +
DialogueWindow::TableCell(std::to_string(t->GetRawSkill(s.first)))
);
}
}
popup_table = DialogueWindow::Table(popup_table);
c->SendPopupToClient(
fmt::format(
"Skills for {}",
c->GetTargetDescription(t, TargetDescriptionType::UCSelf)
).c_str(),
popup_table.c_str()
);
}
+147
View File
@@ -0,0 +1,147 @@
#include "../../client.h"
void ShowSpawnStatus(Client *c, const Seperator *sep)
{
const auto arguments = sep->argnum;
if (arguments < 2) {
c->Message(Chat::White, "Usage: #show spawn_status all - Show all spawn statuses for your current zone");
c->Message(Chat::White, "Usage: #show spawn_status disabled - Show all disabled spawn statuses for your current zone");
c->Message(Chat::White, "Usage: #show spawn_status enabled - Show all enabled spawn statuses for your current zone");
c->Message(Chat::White, "Usage: #show spawn_status [Spawn ID] - Show spawn status by ID for your current zone");
return;
}
const bool is_all = !strcasecmp(sep->arg[2], "all");
const bool is_disabled = !strcasecmp(sep->arg[2], "disabled");
const bool is_enabled = !strcasecmp(sep->arg[2], "enabled");
const bool is_search = sep->IsNumber(2);
if (
!is_all &&
!is_disabled &&
!is_enabled &&
!is_search
) {
c->Message(Chat::White, "Usage: #show spawn_status all - Show all spawn statuses for your current zone");
c->Message(Chat::White, "Usage: #show spawn_status disabled - Show all disabled spawn statuses for your current zone");
c->Message(Chat::White, "Usage: #show spawn_status enabled - Show all enabled spawn statuses for your current zone");
c->Message(Chat::White, "Usage: #show spawn_status [Spawn ID] - Show spawn status by ID for your current zone");
return;
}
std::string filter_type;
if (is_disabled) {
filter_type = "Disabled";
} else if (is_enabled) {
filter_type = "Enabled";
}
const uint32 spawn_id = (
is_search ?
Strings::ToUnsignedInt(sep->arg[2]) :
0
);
LinkedListIterator<Spawn2*> iterator(zone->spawn2_list);
iterator.Reset();
uint32 filtered_count = 0;
uint32 spawn_count = 0;
uint32 spawn_number = 1;
while (iterator.MoreElements()) {
const auto& e = iterator.GetData();
const uint32 time_remaining = e->GetTimer().GetRemainingTime();
if (
is_all ||
(
is_disabled &&
time_remaining == UINT32_MAX
) ||
(
is_enabled &&
time_remaining != UINT32_MAX
) ||
(
is_search &&
e->GetID() == spawn_id
)
) {
c->Message(
Chat::White,
fmt::format(
"Spawn {} | ID: {} Coordinates: {:.2f}, {:.2f}, {:.2f}, {:.2f}",
spawn_number,
e->GetID(),
e->GetX(),
e->GetY(),
e->GetZ(),
e->GetHeading()
).c_str()
);
if (time_remaining != UINT32_MAX) {
const uint32 seconds_remaining = (time_remaining / 1000);
c->Message(
Chat::White,
fmt::format(
"Spawn {} | Respawn: {}",
spawn_number,
Strings::SecondsToTime(seconds_remaining)
).c_str()
);
}
filtered_count++;
spawn_number++;
}
spawn_count++;
iterator.Advance();
}
if (!spawn_count) {
c->Message(Chat::White, "No spawns were found.");
return;
}
if (
(is_disabled || is_enabled) &&
!filtered_count
) {
c->Message(
Chat::White,
fmt::format(
"No {} spawns were found.",
filter_type
).c_str()
);
return;
}
if (is_all) {
c->Message(
Chat::White,
fmt::format(
"{} Spawn{} found.",
spawn_count,
spawn_count != 1 ? "s" : ""
).c_str()
);
return;
}
c->Message(
Chat::White,
fmt::format(
"{} of {} spawn{} found.",
filtered_count,
spawn_count,
spawn_count != 1 ? "s" : ""
).c_str()
);
}
+30
View File
@@ -0,0 +1,30 @@
#include "../../client.h"
void ShowSpells(Client *c, const Seperator *sep)
{
auto t = c;
if (c->GetTarget() && c->GetTarget()->IsClient()) {
t = c->GetTarget()->CastToClient();
}
const auto is_disciplines = !strcasecmp(sep->arg[2], "disciplines");
const auto is_spells = !strcasecmp(sep->arg[2], "spells");
if (
!is_disciplines &&
!is_spells
) {
c->Message(Chat::White, "Usages: #show spells disciplines - Show your or your target's learned disciplines");
c->Message(Chat::White, "Usages: #show spells spells - Show your or your target's memorized spells");
return;
}
ShowSpellType show_spell_type;
if (is_disciplines) {
show_spell_type = ShowSpellType::Disciplines;
} else if (is_spells) {
show_spell_type = ShowSpellType::Spells;
}
t->ShowSpells(c, show_spell_type);
}
+13
View File
@@ -0,0 +1,13 @@
#include "../../client.h"
void ShowSpellsList(Client *c, const Seperator *sep)
{
if (!c->GetTarget() || !c->GetTarget()->IsNPC()) {
c->Message(Chat::White, "You must target an NPC to use this command.");
return;
}
const auto t = c->GetTarget()->CastToNPC();
t->AISpellsList(c);
}
+11
View File
@@ -0,0 +1,11 @@
#include "../../client.h"
void ShowStats(Client *c, const Seperator *sep)
{
Mob* t = c;
if (c->GetTarget()) {
t = c->GetTarget();
}
t->ShowStats(c);
}
+52
View File
@@ -0,0 +1,52 @@
#include "../../client.h"
#include "../../dialogue_window.h"
void ShowTimers(Client *c, const Seperator *sep)
{
auto t = c;
if (c->GetTarget() && c->GetTarget()->IsClient()) {
t = c->GetTarget()->CastToClient();
}
std::vector<std::pair<pTimerType, PersistentTimer *>> l;
t->GetPTimers().ToVector(l);
if (l.empty()) {
c->Message(
Chat::White,
fmt::format(
"{} {} no recast timers.",
c->GetTargetDescription(t, TargetDescriptionType::UCYou),
c == t ? "have" : "has"
).c_str()
);
return;
}
std::string popup_table;
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Timer ID") +
DialogueWindow::TableCell("Remaining Time")
);
for (const auto& e : l) {
const uint32 remaining_time = e.second->GetRemainingTime();
if (remaining_time) {
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell(Strings::Commify(e.first)) +
DialogueWindow::TableCell(Strings::SecondsToTime(remaining_time))
);
}
}
popup_table = DialogueWindow::Table(popup_table);
c->SendPopupToClient(
fmt::format(
"Recast Timers for {}",
c->GetTargetDescription(t, TargetDescriptionType::UCSelf)
).c_str(),
popup_table.c_str()
);
}
+6
View File
@@ -0,0 +1,6 @@
#include "../../client.h"
void ShowTraps(Client *c, const Seperator *sep)
{
entity_list.GetTrapInfo(c);
}
+19
View File
@@ -0,0 +1,19 @@
#include "../../client.h"
#include "../../worldserver.h"
extern WorldServer worldserver;
void ShowUptime(Client *c, const Seperator *sep)
{
auto pack = new ServerPacket(ServerOP_Uptime, sizeof(ServerUptime_Struct));
auto s = (ServerUptime_Struct *) pack->pBuffer;
strn0cpy(s->adminname, c->GetName(), sizeof(s->adminname));
if (sep->IsNumber(2) && Strings::ToUnsignedInt(sep->arg[2]) > 0) {
s->zoneserverid = Strings::ToUnsignedInt(sep->arg[2]);
}
worldserver.SendPacket(pack);
safe_delete(pack);
}
+33
View File
@@ -0,0 +1,33 @@
#include "../../client.h"
void ShowVariable(Client *c, const Seperator *sep)
{
const auto arguments = sep->argnum;
if (arguments < 2) {
c->Message(Chat::White, "Usage: #show variable [Variable Name]");
return;
}
const std::string& variable = sep->argplus[2];
std::string value;
if (!database.GetVariable(variable, value)) {
c->Message(
Chat::White,
fmt::format(
"Variable '{}' was not found.",
variable
).c_str()
);
return;
}
c->Message(
Chat::White,
fmt::format(
"Variable {} | {}",
variable,
value
).c_str()
);
}
+35
View File
@@ -0,0 +1,35 @@
#include "../../client.h"
#include "../../dialogue_window.h"
void ShowVersion(Client *c, const Seperator *sep)
{
std::string popup_table;
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Version") +
DialogueWindow::TableCell(CURRENT_VERSION)
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Compiled") +
DialogueWindow::TableCell(
fmt::format(
"{} {}",
COMPILE_DATE,
COMPILE_TIME
)
)
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Last Modified") +
DialogueWindow::TableCell(LAST_MODIFIED)
);
popup_table = DialogueWindow::Table(popup_table);
c->SendPopupToClient(
"Server Version",
popup_table.c_str()
);
}
+25
View File
@@ -0,0 +1,25 @@
#include "../../client.h"
void ShowWaypoints(Client *c, const Seperator *sep)
{
if (!c->GetTarget() || !c->GetTarget()->IsNPC()) {
c->Message(Chat::White, "You must target an NPC to use this command.");
return;
}
auto t = c->GetTarget()->CastToNPC();
if (!t->GetGrid()) {
c->Message(
Chat::White,
fmt::format(
"{} is not a part of any grid.",
c->GetTargetDescription(t)
).c_str()
);
return;
}
t->DisplayWaypointInfo(c);
}
+235
View File
@@ -0,0 +1,235 @@
#include "../../client.h"
void ShowWho(Client *c, const Seperator *sep)
{
const std::string& query = SQL(
SELECT
character_data.name,
character_data.zone_id,
character_data.zone_instance,
COALESCE(
(
SELECT guilds.name FROM guilds WHERE id = (
(
SELECT guild_id FROM guild_members WHERE char_id = character_data.id
)
)
),
""
) AS guild_name,
character_data.level,
character_data.race,
character_data.class,
COALESCE(
(
SELECT account.status FROM account WHERE account.id = character_data.account_id LIMIT 1
),
0
) AS account_status,
COALESCE(
(
SELECT account.name FROM account WHERE account.id = character_data.account_id LIMIT 1
),
0
) AS account_name,
COALESCE(
(
SELECT account_ip.ip FROM account_ip WHERE account_ip.accid = character_data.account_id ORDER BY account_ip.lastused DESC LIMIT 1
),
""
) AS account_ip
FROM
character_data
WHERE
last_login > (UNIX_TIMESTAMP() - 600)
ORDER BY
character_data.name;
);
auto results = database.QueryDatabase(query);
if (!results.Success() || !results.RowCount()) {
return;
}
bool is_filtered = false;
std::string search_criteria;
if (sep->arg[2]) {
search_criteria = Strings::ToLower(sep->arg[2]);
}
uint32 found_count = 0;
c->Message(Chat::Who, "Players in EverQuest:");
c->Message(Chat::Who, "------------------------------");
for (auto row : results) {
const std::string& player_name = row[0];
const uint32 zone_id = Strings::ToUnsignedInt(row[1]);
const std::string& zone_short_name = ZoneName(zone_id);
const std::string& zone_long_name = ZoneLongName(zone_id);
const uint8 zone_instance = Strings::ToUnsignedInt(row[2]);
const std::string& guild_name = row[3];
const uint8 player_level = Strings::ToUnsignedInt(row[4]);
const uint16 player_race = Strings::ToUnsignedInt(row[5]);
const uint8 player_class = Strings::ToUnsignedInt(row[6]);
const uint8 account_status = Strings::ToUnsignedInt(row[7]);
const std::string& account_name = row[8];
const std::string& account_ip = row[9];
const std::string& base_class_name = GetClassIDName(player_class);
const std::string& displayed_race_name = GetRaceIDName(player_race);
if (!search_criteria.empty()) {
is_filtered = true;
const bool found = (
Strings::Contains(Strings::ToLower(player_name), search_criteria) ||
Strings::Contains(Strings::ToLower(zone_short_name), search_criteria) ||
Strings::Contains(Strings::ToLower(displayed_race_name), search_criteria) ||
Strings::Contains(Strings::ToLower(base_class_name), search_criteria) ||
Strings::Contains(Strings::ToLower(guild_name), search_criteria) ||
Strings::Contains(Strings::ToLower(account_name), search_criteria) ||
Strings::Contains(Strings::ToLower(account_ip), search_criteria)
);
if (!found) {
continue;
}
}
std::string displayed_guild_name;
if (!guild_name.empty()) {
displayed_guild_name = Saylink::Silent(
fmt::format(
"#who \"{}\"",
guild_name
),
fmt::format(
"<{}>",
guild_name
)
);
}
const std::string& goto_saylink = Saylink::Silent(
fmt::format(
"#goto {}",
player_name
),
"Goto"
);
const std::string& summon_saylink = Saylink::Silent(
fmt::format(
"#summon {}",
player_name
),
"Summon"
);
const std::string& display_class_name = GetClassIDName(player_class, player_level);
const std::string& class_saylink = Saylink::Silent(
fmt::format(
"#who {}",
base_class_name
),
display_class_name
);
const std::string& race_saylink = Saylink::Silent(
fmt::format(
"#who {}",
displayed_race_name
),
displayed_race_name
);
const std::string& zone_saylink = Saylink::Silent(
fmt::format(
"#who {}",
zone_short_name
),
zone_long_name
);
const std::string& account_saylink = Saylink::Silent(
fmt::format(
"#who {}",
account_name
),
account_name
);
const std::string& account_ip_saylink = Saylink::Silent(
fmt::format(
"#who {}",
account_ip
),
account_ip
);
const std::string& status_level = (
account_status ?
fmt::format(
"* {} * ",
EQ::constants::GetAccountStatusName(account_status)
) :
""
);
const std::string& version_string = (
zone_instance ?
fmt::format(
" ({})",
zone_instance
) :
""
);
c->Message(
Chat::Who,
fmt::format(
"{}[{} {} ({})] {} ({}) ({}) ({}) {} ZONE: {}{} ({} | {})",
status_level,
player_level,
class_saylink,
base_class_name,
player_name,
race_saylink,
account_saylink,
account_ip_saylink,
displayed_guild_name,
zone_saylink,
version_string,
goto_saylink,
summon_saylink
).c_str()
);
found_count++;
}
const std::string& filter_string = is_filtered ? " that match those filters" : "";
const std::string& message = (
found_count ?
fmt::format(
"There {} {} player{} in EverQuest{}.",
found_count != 1 ? "are" : "is",
found_count,
found_count != 1 ? "s" : "",
filter_string
) :
fmt::format(
"There are no players in EverQuest{}.",
filter_string
)
);
c->Message(
Chat::Who,
message.c_str()
);
}
+40
View File
@@ -0,0 +1,40 @@
#include "../../client.h"
#include "../../common/data_verification.h"
void ShowXTargets(Client *c, const Seperator *sep)
{
auto t = c;
if (c->GetTarget() && c->GetTarget()->IsClient()) {
t = c->GetTarget()->CastToClient();
}
const auto arguments = sep->argnum;
if (arguments < 2 || !sep->IsNumber(2)) {
t->ShowXTargets(c);
return;
}
const auto new_max = static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[2]));
if (!EQ::ValueWithin(new_max, 5, XTARGET_HARDCAP)) {
c->Message(
Chat::White,
fmt::format(
"Number of XTargets must be between 5 and {}.",
XTARGET_HARDCAP
).c_str()
);
return;
}
t->SetMaxXTargets(new_max);
c->Message(
Chat::White,
fmt::format(
"Max number of XTargets set to {} for {}.",
new_max,
c->GetTargetDescription(t)
).c_str()
);
}
+276
View File
@@ -0,0 +1,276 @@
#include "../../client.h"
#include "../../dialogue_window.h"
void ShowZoneData(Client *c, const Seperator *sep)
{
std::string popup_table;
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Type") +
DialogueWindow::TableCell(std::to_string(zone->newzone_data.ztype))
);
for (uint8 fog_index = 0; fog_index < 4; fog_index++) {
const uint8 fog_number = (fog_index + 1);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell(
fmt::format(
"Fog {} Colors",
fog_number
)
) +
DialogueWindow::TableCell(
fmt::format(
"{} {} {}",
DialogueWindow::ColorMessage(
"red1",
std::to_string(zone->newzone_data.fog_red[fog_index])
),
DialogueWindow::ColorMessage(
"forest_green",
std::to_string(zone->newzone_data.fog_green[fog_index])
),
DialogueWindow::ColorMessage(
"royal_blue",
std::to_string(zone->newzone_data.fog_blue[fog_index])
)
)
)
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell(
fmt::format(
"Fog {} Clipping",
fog_number
)
) +
DialogueWindow::TableCell(
fmt::format(
"{} to {}",
zone->newzone_data.fog_minclip[fog_index],
zone->newzone_data.fog_maxclip[fog_index]
)
)
);
}
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Fog Density") +
DialogueWindow::TableCell(
fmt::format(
"{:.2f}",
zone->newzone_data.fog_density
)
)
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Gravity") +
DialogueWindow::TableCell(
fmt::format(
"{:.2f}",
zone->newzone_data.gravity
)
)
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Time Type") +
DialogueWindow::TableCell(std::to_string(zone->newzone_data.time_type))
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Time Type") +
DialogueWindow::TableCell(std::to_string(zone->newzone_data.time_type))
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Experience Multiplier") +
DialogueWindow::TableCell(
fmt::format(
"{:.2f}%%",
(zone->newzone_data.zone_exp_multiplier * 100)
)
)
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Safe Coordinates") +
DialogueWindow::TableCell(
fmt::format(
"{:.2f}, {:.2f}, {:.2f}",
zone->newzone_data.safe_x,
zone->newzone_data.safe_y,
zone->newzone_data.safe_z
)
)
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Max Z") +
DialogueWindow::TableCell(
fmt::format(
"{:.2f}",
zone->newzone_data.max_z
)
)
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Underworld Z") +
DialogueWindow::TableCell(
fmt::format(
"{:.2f}",
zone->newzone_data.underworld
)
)
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Clipping Distance") +
DialogueWindow::TableCell(
fmt::format(
"{} to {}",
zone->newzone_data.minclip,
zone->newzone_data.maxclip
)
)
);
// Weather Data
for (uint8 weather_index = 0; weather_index < 4; weather_index++) {
const uint8 weather_number = (weather_index + 1);
if (
zone->newzone_data.rain_chance[weather_index] ||
zone->newzone_data.rain_duration[weather_index]
) {
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell(
fmt::format(
"Rain {}",
weather_number
)
) +
DialogueWindow::TableCell(
fmt::format(
"Chance: {}",
zone->newzone_data.rain_chance[weather_index]
)
) +
DialogueWindow::TableCell(
fmt::format(
"Duration: {}",
zone->newzone_data.rain_duration[weather_index]
)
)
);
}
if (
zone->newzone_data.snow_chance[weather_index] ||
zone->newzone_data.snow_duration[weather_index]
) {
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell(
fmt::format(
"Snow {}",
weather_number
)
) +
DialogueWindow::TableCell(
fmt::format(
"Chance: {}",
zone->newzone_data.snow_chance[weather_index]
)
) +
DialogueWindow::TableCell(
fmt::format(
"Duration: {}",
zone->newzone_data.snow_duration[weather_index]
)
)
);
}
}
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Sky") +
DialogueWindow::TableCell(std::to_string(zone->newzone_data.sky))
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Suspend Buffs") +
DialogueWindow::TableCell(
zone->newzone_data.suspend_buffs ?
DialogueWindow::ColorMessage("forest_green", "Y") :
DialogueWindow::ColorMessage("red1", "N")
)
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Health Regen") +
DialogueWindow::TableCell(
fmt::format(
"{} ({})",
Strings::Commify(zone->newzone_data.fast_regen_hp),
Strings::SecondsToTime(zone->newzone_data.fast_regen_hp)
)
)
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Mana Regen") +
DialogueWindow::TableCell(
fmt::format(
"{} ({})",
Strings::Commify(zone->newzone_data.fast_regen_mana),
Strings::SecondsToTime(zone->newzone_data.fast_regen_mana)
)
)
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Endurance Regen") +
DialogueWindow::TableCell(
fmt::format(
"{} ({})",
Strings::Commify(zone->newzone_data.fast_regen_endurance),
Strings::SecondsToTime(zone->newzone_data.fast_regen_endurance)
)
)
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Maximum Aggro Distance") +
DialogueWindow::TableCell(Strings::Commify(zone->newzone_data.npc_aggro_max_dist))
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Underworld Teleport Index") +
DialogueWindow::TableCell(Strings::Commify(zone->newzone_data.underworld_teleport_index))
);
popup_table += DialogueWindow::TableRow(
DialogueWindow::TableCell("Lava Damage") +
DialogueWindow::TableCell(
fmt::format(
"{} to {}",
Strings::Commify(zone->newzone_data.min_lava_damage),
Strings::Commify(zone->newzone_data.lava_damage)
)
)
);
popup_table = DialogueWindow::Table(popup_table);
c->SendPopupToClient(
fmt::format(
"Zone Data for {}",
zone->GetZoneDescription()
).c_str(),
popup_table.c_str()
);
}
@@ -0,0 +1,6 @@
#include "../../client.h"
void ShowZoneGlobalLoot(Client *c, const Seperator *sep)
{
zone->ShowZoneGlobalLoot(c);
}
+102
View File
@@ -0,0 +1,102 @@
#include "../../client.h"
void ShowZoneLoot(Client *c, const Seperator *sep)
{
if (!sep->IsNumber(2)) {
c->Message(
Chat::White,
"Usage: #show zone_loot [Item ID]"
);
return;
}
const uint32 search_item_id = Strings::ToUnsignedInt(sep->arg[2]);
std::vector<std::pair<NPC *, ItemList>> v;
uint32 loot_count = 0;
uint32 loot_number = 1;
for (auto npc_entity: entity_list.GetNPCList()) {
auto il = npc_entity.second->GetItemList();
v.emplace_back(std::make_pair(npc_entity.second, il));
}
for (const auto &e: v) {
NPC *n = e.first;
const auto &l = e.second;
std::string npc_link;
if (n) {
const uint32 instance_id = zone->GetInstanceID();
const uint32 zone_id = zone->GetZoneID();
const std::string &command_link = Saylink::Silent(
fmt::format(
"#{} {} {} {} {}",
(instance_id != 0 ? "zoneinstance" : "zone"),
(instance_id != 0 ? instance_id : zone_id),
n->GetX(),
n->GetY(),
n->GetZ()
),
"Goto"
);
npc_link = fmt::format(
"NPC: {} (ID {}) [{}]",
n->GetCleanName(),
n->GetID(),
command_link
);
}
for (const auto &i: l) {
if (!search_item_id || i->item_id == search_item_id) {
EQ::SayLinkEngine linker;
linker.SetLinkType(EQ::saylink::SayLinkLootItem);
linker.SetLootData(i);
c->Message(
Chat::White,
fmt::format(
"{}. {} ({}) {}",
loot_number,
linker.GenerateLink(),
Strings::Commify(i->item_id),
npc_link
).c_str()
);
loot_number++;
loot_count++;
}
}
}
if (search_item_id) {
c->Message(
Chat::White,
fmt::format(
"{} ({}) is dropping in {} place{}.",
database.CreateItemLink(search_item_id),
Strings::Commify(search_item_id),
loot_count,
loot_count != 1 ? "s" : ""
).c_str()
);
return;
}
c->Message(
Chat::White,
fmt::format(
"{} Item {} {} dropping.",
loot_count,
loot_count != 1 ? "s" : "",
loot_count != 1 ? "are" : "is"
).c_str()
);
}
+180
View File
@@ -0,0 +1,180 @@
#include "../../client.h"
void ShowZonePoints(Client *c, const Seperator *sep)
{
for (const auto& m : entity_list.GetMobList()) {
Mob* mob = m.second;
if (mob->IsNPC() && mob->GetRace() == RACE_NODE_2254) {
mob->Depop();
}
}
uint32 found_count = 0;
c->Message(Chat::White, "Listing zone points...");
c->SendChatLineBreak();
for (auto &p : zone->virtual_zone_point_list) {
const std::string& zone_long_name = ZoneLongName(p.target_zone_id);
const std::string& saylink = fmt::format(
"#goto {:.0f} {:.0f} {:.0f}",
p.x,
p.y,
p.z
);
c->Message(
Chat::White,
fmt::format(
"Virtual Zone Point [{}] x [{}] y [{}] z [{}] h [{}] width [{}] height [{}] | To [{}] ({}) x [{}] y [{}] z [{}] h [{}]",
Saylink::Silent(saylink, "Goto").c_str(),
p.x,
p.y,
p.z,
p.heading,
p.width,
p.height,
zone_long_name.c_str(),
p.target_zone_id,
p.target_x,
p.target_y,
p.target_z,
p.target_heading
).c_str()
);
const std::string& node_name = fmt::format("ZonePoint To [{}]", zone_long_name);
float half_width = ((float) p.width / 2);
NPC::SpawnZonePointNodeNPC(
node_name, glm::vec4(
p.x + half_width,
p.y + half_width,
p.z,
p.heading
)
);
NPC::SpawnZonePointNodeNPC(
node_name, glm::vec4(
p.x + half_width,
p.y - half_width,
p.z,
p.heading
)
);
NPC::SpawnZonePointNodeNPC(
node_name, glm::vec4(
p.x - half_width,
p.y - half_width,
p.z,
p.heading
)
);
NPC::SpawnZonePointNodeNPC(
node_name, glm::vec4(
p.x - half_width,
p.y + half_width,
p.z,
p.heading
)
);
NPC::SpawnZonePointNodeNPC(
node_name, glm::vec4(
p.x + half_width,
p.y + half_width,
p.z + static_cast<float>(p.height),
p.heading
)
);
NPC::SpawnZonePointNodeNPC(
node_name, glm::vec4(
p.x + half_width,
p.y - half_width,
p.z + static_cast<float>(p.height),
p.heading
)
);
NPC::SpawnZonePointNodeNPC(
node_name, glm::vec4(
p.x - half_width,
p.y - half_width,
p.z + static_cast<float>(p.height),
p.heading
)
);
NPC::SpawnZonePointNodeNPC(
node_name, glm::vec4(
p.x - half_width,
p.y + half_width,
p.z + static_cast<float>(p.height),
p.heading
)
);
found_count++;
}
LinkedListIterator<ZonePoint *> iterator(zone->zone_point_list);
iterator.Reset();
while (iterator.MoreElements()) {
const auto &p = iterator.GetData();
const std::string& zone_long_name = ZoneLongName(p->target_zone_id);
const std::string& node_name = fmt::format("ZonePoint To [{}]", zone_long_name);
NPC::SpawnZonePointNodeNPC(
node_name, glm::vec4(
p->x,
p->y,
p->z,
p->heading
)
);
const std::string& saylink = fmt::format(
"#goto {:.0f} {:.0f} {:.0f}",
p->x,
p->y,
p->z
);
c->Message(
Chat::White,
fmt::format(
"Client Side Zone Point [{}] x [{}] y [{}] z [{}] h [{}] number [{}] | To [{}] ({}) x [{}] y [{}] z [{}] h [{}]",
Saylink::Silent(saylink, "Goto"),
p->x,
p->y,
p->z,
p->heading,
p->number,
zone_long_name,
p->target_zone_id,
p->target_x,
p->target_y,
p->target_z,
p->target_heading
).c_str()
);
iterator.Advance();
found_count++;
}
if (!found_count) {
c->Message(Chat::White, "There were no zone points found.");
}
c->SendChatLineBreak();
}
+16
View File
@@ -0,0 +1,16 @@
#include "../../client.h"
#include "../../worldserver.h"
extern WorldServer worldserver;
void ShowZoneStatus(Client *c, const Seperator *sep)
{
auto pack = new ServerPacket(ServerOP_ZoneStatus, sizeof(ServerZoneStatus_Struct));
auto z = (ServerZoneStatus_Struct *) pack->pBuffer;
z->admin = c->Admin();
strn0cpy(z->name, c->GetName(), sizeof(z->name));
worldserver.SendPacket(pack);
delete pack;
}