mirror of
https://github.com/EQEmu/Server.git
synced 2026-03-02 06:02:25 +00:00
[Cleanup] Cleanup Bug Category Code (#4367)
* [Cleanup] Cleanup Bug Category-based Code * Command * Cleanup * Cleanup * Cleanup
This commit is contained in:
parent
caa647dc6b
commit
0f0676824c
@ -59,68 +59,25 @@ int16 EQ::invtype::GetInvTypeSize(int16 inv_type) {
|
|||||||
return local_array[inv_type];
|
return local_array[inv_type];
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* EQ::bug::CategoryIDToCategoryName(CategoryID category_id) {
|
uint32 Bug::GetID(const std::string& category_name)
|
||||||
switch (category_id) {
|
{
|
||||||
case catVideo:
|
for (const auto& e : bug_category_names) {
|
||||||
return "Video";
|
if (e.second == category_name) {
|
||||||
case catAudio:
|
return e.first;
|
||||||
return "Audio";
|
}
|
||||||
case catPathing:
|
|
||||||
return "Pathing";
|
|
||||||
case catQuest:
|
|
||||||
return "Quest";
|
|
||||||
case catTradeskills:
|
|
||||||
return "Tradeskills";
|
|
||||||
case catSpellStacking:
|
|
||||||
return "Spell stacking";
|
|
||||||
case catDoorsPortals:
|
|
||||||
return "Doors/Portals";
|
|
||||||
case catItems:
|
|
||||||
return "Items";
|
|
||||||
case catNPC:
|
|
||||||
return "NPC";
|
|
||||||
case catDialogs:
|
|
||||||
return "Dialogs";
|
|
||||||
case catLoNTCG:
|
|
||||||
return "LoN - TCG";
|
|
||||||
case catMercenaries:
|
|
||||||
return "Mercenaries";
|
|
||||||
case catOther:
|
|
||||||
default:
|
|
||||||
return "Other";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return Bug::Category::Other;
|
||||||
}
|
}
|
||||||
|
|
||||||
EQ::bug::CategoryID EQ::bug::CategoryNameToCategoryID(const char* category_name) {
|
std::string Bug::GetName(uint32 category_id)
|
||||||
if (!category_name)
|
{
|
||||||
return catOther;
|
return IsValid(category_id) ? bug_category_names[category_id] : "UNKNOWN BUG CATEGORY";
|
||||||
|
}
|
||||||
|
|
||||||
if (!strcmp(category_name, "Video"))
|
bool Bug::IsValid(uint32 category_id)
|
||||||
return catVideo;
|
{
|
||||||
if (!strcmp(category_name, "Audio"))
|
return bug_category_names.find(category_id) != bug_category_names.end();
|
||||||
return catAudio;
|
|
||||||
if (!strcmp(category_name, "Pathing"))
|
|
||||||
return catPathing;
|
|
||||||
if (!strcmp(category_name, "Quest"))
|
|
||||||
return catQuest;
|
|
||||||
if (!strcmp(category_name, "Tradeskills"))
|
|
||||||
return catTradeskills;
|
|
||||||
if (!strcmp(category_name, "Spell stacking"))
|
|
||||||
return catSpellStacking;
|
|
||||||
if (!strcmp(category_name, "Doors/Portals"))
|
|
||||||
return catDoorsPortals;
|
|
||||||
if (!strcmp(category_name, "Items"))
|
|
||||||
return catItems;
|
|
||||||
if (!strcmp(category_name, "NPC"))
|
|
||||||
return catNPC;
|
|
||||||
if (!strcmp(category_name, "Dialogs"))
|
|
||||||
return catDialogs;
|
|
||||||
if (!strcmp(category_name, "LoN - TCG"))
|
|
||||||
return catLoNTCG;
|
|
||||||
if (!strcmp(category_name, "Mercenaries"))
|
|
||||||
return catMercenaries;
|
|
||||||
|
|
||||||
return catOther;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *EQ::constants::GetStanceName(StanceType stance_type) {
|
const char *EQ::constants::GetStanceName(StanceType stance_type) {
|
||||||
|
|||||||
@ -461,37 +461,6 @@ namespace EQ
|
|||||||
|
|
||||||
} // namespace spells
|
} // namespace spells
|
||||||
|
|
||||||
namespace bug {
|
|
||||||
enum CategoryID : uint32 {
|
|
||||||
catOther = 0,
|
|
||||||
catVideo,
|
|
||||||
catAudio,
|
|
||||||
catPathing,
|
|
||||||
catQuest,
|
|
||||||
catTradeskills,
|
|
||||||
catSpellStacking,
|
|
||||||
catDoorsPortals,
|
|
||||||
catItems,
|
|
||||||
catNPC,
|
|
||||||
catDialogs,
|
|
||||||
catLoNTCG,
|
|
||||||
catMercenaries
|
|
||||||
};
|
|
||||||
|
|
||||||
enum OptionalInfoFlag : uint32 {
|
|
||||||
infoNoOptionalInfo = 0x0,
|
|
||||||
infoCanDuplicate = 0x1,
|
|
||||||
infoCrashBug = 0x2,
|
|
||||||
infoTargetInfo = 0x4,
|
|
||||||
infoCharacterFlags = 0x8,
|
|
||||||
infoUnknownValue = 0xFFFFFFF0
|
|
||||||
};
|
|
||||||
|
|
||||||
const char* CategoryIDToCategoryName(CategoryID category_id);
|
|
||||||
CategoryID CategoryNameToCategoryID(const char* category_name);
|
|
||||||
|
|
||||||
} // namespace bug
|
|
||||||
|
|
||||||
enum WaypointStatus : int {
|
enum WaypointStatus : int {
|
||||||
RoamBoxPauseInProgress = -3,
|
RoamBoxPauseInProgress = -3,
|
||||||
QuestControlNoGrid = -2,
|
QuestControlNoGrid = -2,
|
||||||
@ -761,4 +730,51 @@ namespace HeroicBonusBucket
|
|||||||
const std::string DexEnduranceRegen = "HDEX-EnduranceRegen";
|
const std::string DexEnduranceRegen = "HDEX-EnduranceRegen";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace Bug {
|
||||||
|
namespace Category {
|
||||||
|
constexpr uint32 Other = 0;
|
||||||
|
constexpr uint32 Video = 1;
|
||||||
|
constexpr uint32 Audio = 2;
|
||||||
|
constexpr uint32 Pathing = 3;
|
||||||
|
constexpr uint32 Quest = 4;
|
||||||
|
constexpr uint32 Tradeskills = 5;
|
||||||
|
constexpr uint32 SpellStacking = 6;
|
||||||
|
constexpr uint32 DoorsPortals = 7;
|
||||||
|
constexpr uint32 Items = 8;
|
||||||
|
constexpr uint32 NPC = 9;
|
||||||
|
constexpr uint32 Dialogs = 10;
|
||||||
|
constexpr uint32 LoNTCG = 11;
|
||||||
|
constexpr uint32 Mercenaries = 12;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace InformationFlag {
|
||||||
|
constexpr uint32 None = 0;
|
||||||
|
constexpr uint32 Repeatable = 1;
|
||||||
|
constexpr uint32 Crash = 2;
|
||||||
|
constexpr uint32 TargetInfo = 4;
|
||||||
|
constexpr uint32 CharacterFlags = 8;
|
||||||
|
constexpr uint32 Unknown = 4294967280;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32 GetID(const std::string& category_name);
|
||||||
|
std::string GetName(uint32 category_id);
|
||||||
|
bool IsValid(uint32 category_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
static std::map<uint32, std::string> bug_category_names = {
|
||||||
|
{ Bug::Category::Other, "Other" },
|
||||||
|
{ Bug::Category::Video, "Video" },
|
||||||
|
{ Bug::Category::Audio, "Audio" },
|
||||||
|
{ Bug::Category::Pathing, "Pathing" },
|
||||||
|
{ Bug::Category::Quest, "Quest" },
|
||||||
|
{ Bug::Category::Tradeskills, "Tradeskills" },
|
||||||
|
{ Bug::Category::SpellStacking, "Spell Stacking" },
|
||||||
|
{ Bug::Category::DoorsPortals, "Doors and Portals" },
|
||||||
|
{ Bug::Category::Items, "Items" },
|
||||||
|
{ Bug::Category::NPC, "NPC" },
|
||||||
|
{ Bug::Category::Dialogs, "Dialogs" },
|
||||||
|
{ Bug::Category::LoNTCG, "LoN - TCG" },
|
||||||
|
{ Bug::Category::Mercenaries, "Mercenaries" }
|
||||||
|
};
|
||||||
|
|
||||||
#endif /*COMMON_EMU_CONSTANTS_H*/
|
#endif /*COMMON_EMU_CONSTANTS_H*/
|
||||||
|
|||||||
@ -2349,7 +2349,7 @@ namespace SoF
|
|||||||
DECODE_LENGTH_EXACT(structs::BugReport_Struct);
|
DECODE_LENGTH_EXACT(structs::BugReport_Struct);
|
||||||
SETUP_DIRECT_DECODE(BugReport_Struct, structs::BugReport_Struct);
|
SETUP_DIRECT_DECODE(BugReport_Struct, structs::BugReport_Struct);
|
||||||
|
|
||||||
emu->category_id = EQ::bug::CategoryNameToCategoryID(eq->category_name);
|
emu->category_id = Bug::GetID(eq->category_name);
|
||||||
memcpy(emu->category_name, eq, sizeof(structs::BugReport_Struct));
|
memcpy(emu->category_name, eq, sizeof(structs::BugReport_Struct));
|
||||||
|
|
||||||
FINISH_DIRECT_DECODE();
|
FINISH_DIRECT_DECODE();
|
||||||
|
|||||||
@ -806,7 +806,7 @@ namespace Titanium
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AppearanceType::GuildShow: {
|
case AppearanceType::GuildShow: {
|
||||||
FAIL_ENCODE();
|
FAIL_ENCODE();
|
||||||
@ -2567,7 +2567,7 @@ namespace Titanium
|
|||||||
DECODE_LENGTH_EXACT(structs::BugReport_Struct);
|
DECODE_LENGTH_EXACT(structs::BugReport_Struct);
|
||||||
SETUP_DIRECT_DECODE(BugReport_Struct, structs::BugReport_Struct);
|
SETUP_DIRECT_DECODE(BugReport_Struct, structs::BugReport_Struct);
|
||||||
|
|
||||||
emu->category_id = EQ::bug::CategoryNameToCategoryID(eq->category_name);
|
emu->category_id = Bug::GetID(eq->category_name);
|
||||||
memcpy(emu->category_name, eq, sizeof(structs::BugReport_Struct));
|
memcpy(emu->category_name, eq, sizeof(structs::BugReport_Struct));
|
||||||
|
|
||||||
FINISH_DIRECT_DECODE();
|
FINISH_DIRECT_DECODE();
|
||||||
|
|||||||
@ -49,6 +49,7 @@ public:
|
|||||||
// these are the base definitions for command_subsettings and can be over-ridden by the database
|
// these are the base definitions for command_subsettings and can be over-ridden by the database
|
||||||
std::vector<CommandSubsettingsRepository::CommandSubsettings> static_records = {
|
std::vector<CommandSubsettingsRepository::CommandSubsettings> static_records = {
|
||||||
{.parent_command = "find", .sub_command = "aa", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "findaa"},
|
{.parent_command = "find", .sub_command = "aa", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "findaa"},
|
||||||
|
{.parent_command = "find", .sub_command = "bug_category", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "findbugcategory"},
|
||||||
{.parent_command = "find", .sub_command = "character", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "findcharacter"},
|
{.parent_command = "find", .sub_command = "character", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "findcharacter"},
|
||||||
{.parent_command = "find", .sub_command = "class", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "findclass"},
|
{.parent_command = "find", .sub_command = "class", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "findclass"},
|
||||||
{.parent_command = "find", .sub_command = "currency", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "findcurrency"},
|
{.parent_command = "find", .sub_command = "currency", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "findcurrency"},
|
||||||
|
|||||||
@ -11786,11 +11786,11 @@ void Client::RegisterBug(BugReport_Struct* r) {
|
|||||||
b.target_id = r->target_id;
|
b.target_id = r->target_id;
|
||||||
b.target_name = r->target_name;
|
b.target_name = r->target_name;
|
||||||
b.optional_info_mask = r->optional_info_mask;
|
b.optional_info_mask = r->optional_info_mask;
|
||||||
b._can_duplicate = ((r->optional_info_mask & EQ::bug::infoCanDuplicate) != 0 ? 1 : 0);
|
b._can_duplicate = ((r->optional_info_mask & Bug::InformationFlag::Repeatable) != 0 ? 1 : 0);
|
||||||
b._crash_bug = ((r->optional_info_mask & EQ::bug::infoCrashBug) != 0 ? 1 : 0);
|
b._crash_bug = ((r->optional_info_mask & Bug::InformationFlag::Crash) != 0 ? 1 : 0);
|
||||||
b._target_info = ((r->optional_info_mask & EQ::bug::infoTargetInfo) != 0 ? 1 : 0);
|
b._target_info = ((r->optional_info_mask & Bug::InformationFlag::TargetInfo) != 0 ? 1 : 0);
|
||||||
b._character_flags = ((r->optional_info_mask & EQ::bug::infoCharacterFlags) != 0 ? 1 : 0);
|
b._character_flags = ((r->optional_info_mask & Bug::InformationFlag::CharacterFlags) != 0 ? 1 : 0);
|
||||||
b._unknown_value = ((r->optional_info_mask & EQ::bug::infoUnknownValue) != 0 ? 1 : 0);
|
b._unknown_value = ((r->optional_info_mask & Bug::InformationFlag::Unknown) != 0 ? 1 : 0);
|
||||||
b.bug_report = r->bug_report;
|
b.bug_report = r->bug_report;
|
||||||
b.system_info = r->system_info;
|
b.system_info = r->system_info;
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
#include "../client.h"
|
#include "../client.h"
|
||||||
#include "find/aa.cpp"
|
#include "find/aa.cpp"
|
||||||
|
#include "find/bug_category.cpp"
|
||||||
#include "find/character.cpp"
|
#include "find/character.cpp"
|
||||||
#include "find/class.cpp"
|
#include "find/class.cpp"
|
||||||
#include "find/currency.cpp"
|
#include "find/currency.cpp"
|
||||||
@ -31,6 +32,7 @@ void command_find(Client *c, const Seperator *sep)
|
|||||||
|
|
||||||
std::vector<Cmd> commands = {
|
std::vector<Cmd> commands = {
|
||||||
Cmd{.cmd = "aa", .u = "aa [Search Criteria]", .fn = FindAA, .a = {"#findaa"}},
|
Cmd{.cmd = "aa", .u = "aa [Search Criteria]", .fn = FindAA, .a = {"#findaa"}},
|
||||||
|
Cmd{.cmd = "bug_category", .u = "bug_category [Search Criteria]", .fn = FindBugCategory, .a = {"#findbugcategory"}},
|
||||||
Cmd{.cmd = "character", .u = "character [Search Criteria]", .fn = FindCharacter, .a = {"#findcharacter"}},
|
Cmd{.cmd = "character", .u = "character [Search Criteria]", .fn = FindCharacter, .a = {"#findcharacter"}},
|
||||||
Cmd{.cmd = "class", .u = "class [Search Criteria]", .fn = FindClass, .a = {"#findclass"}},
|
Cmd{.cmd = "class", .u = "class [Search Criteria]", .fn = FindClass, .a = {"#findclass"}},
|
||||||
Cmd{.cmd = "currency", .u = "currency [Search Criteria]", .fn = FindCurrency, .a = {"#findcurrency"}},
|
Cmd{.cmd = "currency", .u = "currency [Search Criteria]", .fn = FindCurrency, .a = {"#findcurrency"}},
|
||||||
|
|||||||
63
zone/gm_commands/find/bug_category.cpp
Normal file
63
zone/gm_commands/find/bug_category.cpp
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
#include "../../client.h"
|
||||||
|
|
||||||
|
void FindBugCategory(Client *c, const Seperator *sep)
|
||||||
|
{
|
||||||
|
if (sep->IsNumber(2)) {
|
||||||
|
const uint32 category_id = Strings::ToUnsignedInt(sep->arg[2]);
|
||||||
|
const std::string& category_name = Bug::GetName(category_id);
|
||||||
|
if (Strings::EqualFold(category_name, "UNKNOWN BUG CATEGORY")) {
|
||||||
|
c->Message(
|
||||||
|
Chat::White,
|
||||||
|
fmt::format(
|
||||||
|
"Bug Category ID {} does not exist.",
|
||||||
|
category_id
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
c->Message(
|
||||||
|
Chat::White,
|
||||||
|
fmt::format(
|
||||||
|
"Bug Category {} | {}",
|
||||||
|
category_id,
|
||||||
|
category_name
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::string& search_criteria = Strings::ToLower(sep->argplus[2]);
|
||||||
|
|
||||||
|
uint32 found_count = 0;
|
||||||
|
|
||||||
|
for (const auto& e : bug_category_names) {
|
||||||
|
const std::string& bug_category_name_lower = Strings::ToLower(e.second);
|
||||||
|
if (!Strings::Contains(bug_category_name_lower, search_criteria)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
c->Message(
|
||||||
|
Chat::White,
|
||||||
|
fmt::format(
|
||||||
|
"Bug Category {} | {}",
|
||||||
|
e.first,
|
||||||
|
e.second
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
|
|
||||||
|
found_count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
c->Message(
|
||||||
|
Chat::White,
|
||||||
|
fmt::format(
|
||||||
|
"{} Bug Categor{} found matching '{}'.",
|
||||||
|
found_count,
|
||||||
|
found_count != 1 ? "ies" : "y",
|
||||||
|
sep->argplus[2]
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user