[Cleanup] Cleanup classes.cpp/classes.h (#3752)

* [Cleanup] Cleanup classes.cpp/classes.h

# Notes
- Remove unused methods and cleanup logic.

* Update classes.cpp

* Final push.
This commit is contained in:
Alex King
2023-12-13 18:38:45 -05:00
committed by GitHub
parent df83113cea
commit aeeb350068
49 changed files with 1308 additions and 1486 deletions
+37 -37
View File
@@ -1381,7 +1381,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app)
SetClientMaxLevel(client_max_level);
// we know our class now, so we might have to fix our consume timer!
if (class_ == MONK)
if (class_ == Class::Monk)
consume_food_timer.SetTimer(CONSUMPTION_MNK_TIMER);
InitInnates();
@@ -1592,9 +1592,9 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app)
m_pp.spellSlotRefresh[i] = p_timers.GetRemainingTime(pTimerSpellStart + m_pp.mem_spells[i]) * 1000;
/* Ability slot refresh send SK/PAL */
if (m_pp.class_ == SHADOWKNIGHT || m_pp.class_ == PALADIN) {
if (m_pp.class_ == Class::ShadowKnight || m_pp.class_ == Class::Paladin) {
uint32 abilitynum = 0;
if (m_pp.class_ == SHADOWKNIGHT) { abilitynum = pTimerHarmTouch; }
if (m_pp.class_ == Class::ShadowKnight) { abilitynum = pTimerHarmTouch; }
else { abilitynum = pTimerLayHands; }
uint32 remaining = p_timers.GetRemainingTime(abilitynum);
@@ -1935,8 +1935,8 @@ void Client::Handle_OP_AdventureMerchantPurchase(const EQApplicationPacket *app)
Adventure_Purchase_Struct* aps = (Adventure_Purchase_Struct*)app->pBuffer;
uint32 merchantid = 0;
Mob* tmp = entity_list.GetMob(aps->npcid);
if (tmp == 0 || !tmp->IsNPC() || ((tmp->GetClass() != ADVENTURE_MERCHANT) &&
(tmp->GetClass() != DISCORD_MERCHANT) && (tmp->GetClass() != NORRATHS_KEEPERS_MERCHANT) && (tmp->GetClass() != DARK_REIGN_MERCHANT)))
if (tmp == 0 || !tmp->IsNPC() || ((tmp->GetClass() != Class::AdventureMerchant) &&
(tmp->GetClass() != Class::DiscordMerchant) && (tmp->GetClass() != Class::NorrathsKeepersMerchant) && (tmp->GetClass() != Class::DarkReignMerchant)))
return;
//you have to be somewhat close to them to be properly using them
@@ -2121,8 +2121,8 @@ void Client::Handle_OP_AdventureMerchantRequest(const EQApplicationPacket *app)
uint32 merchantid = 0;
Mob* tmp = entity_list.GetMob(eid->entity_id);
if (tmp == 0 || !tmp->IsNPC() || ((tmp->GetClass() != ADVENTURE_MERCHANT) &&
(tmp->GetClass() != DISCORD_MERCHANT) && (tmp->GetClass() != NORRATHS_KEEPERS_MERCHANT) && (tmp->GetClass() != DARK_REIGN_MERCHANT)))
if (tmp == 0 || !tmp->IsNPC() || ((tmp->GetClass() != Class::AdventureMerchant) &&
(tmp->GetClass() != Class::DiscordMerchant) && (tmp->GetClass() != Class::NorrathsKeepersMerchant) && (tmp->GetClass() != Class::DarkReignMerchant)))
return;
if (!tmp->CastToNPC()->IsMerchantOpen()) {
@@ -2197,8 +2197,8 @@ void Client::Handle_OP_AdventureMerchantSell(const EQApplicationPacket *app)
Adventure_Sell_Struct *ams_in = (Adventure_Sell_Struct*)app->pBuffer;
Mob* vendor = entity_list.GetMob(ams_in->npcid);
if (vendor == 0 || !vendor->IsNPC() || ((vendor->GetClass() != ADVENTURE_MERCHANT) &&
(vendor->GetClass() != NORRATHS_KEEPERS_MERCHANT) && (vendor->GetClass() != DARK_REIGN_MERCHANT)))
if (vendor == 0 || !vendor->IsNPC() || ((vendor->GetClass() != Class::AdventureMerchant) &&
(vendor->GetClass() != Class::NorrathsKeepersMerchant) && (vendor->GetClass() != Class::DarkReignMerchant)))
{
Message(Chat::Red, "Vendor was not found.");
return;
@@ -2298,17 +2298,17 @@ void Client::Handle_OP_AdventureMerchantSell(const EQApplicationPacket *app)
switch (vendor->GetClass())
{
case ADVENTURE_MERCHANT:
case Class::AdventureMerchant:
{
UpdateLDoNPoints(6, price);
break;
}
case NORRATHS_KEEPERS_MERCHANT:
case Class::NorrathsKeepersMerchant:
{
SetRadiantCrystals(GetRadiantCrystals() + price);
break;
}
case DARK_REIGN_MERCHANT:
case Class::DarkReignMerchant:
{
SetEbonCrystals(GetEbonCrystals() + price);
break;
@@ -2482,7 +2482,7 @@ void Client::Handle_OP_AltCurrencyMerchantRequest(const EQApplicationPacket *app
return;
}
if (target->GetClass() != ALT_CURRENCY_MERCHANT) {
if (target->GetClass() != Class::AlternateCurrencyMerchant) {
return;
}
@@ -2553,7 +2553,7 @@ void Client::Handle_OP_AltCurrencyPurchase(const EQApplicationPacket *app)
if (DistanceSquared(m_Position, tar->GetPosition())> USE_NPC_RANGE2)
return;
if (tar->GetClass() != ALT_CURRENCY_MERCHANT) {
if (tar->GetClass() != Class::AlternateCurrencyMerchant) {
return;
}
@@ -2722,7 +2722,7 @@ void Client::Handle_OP_AltCurrencySell(const EQApplicationPacket *app)
if (DistanceSquared(m_Position, tar->GetPosition()) > USE_NPC_RANGE2)
return;
if (tar->GetClass() != ALT_CURRENCY_MERCHANT) {
if (tar->GetClass() != Class::AlternateCurrencyMerchant) {
return;
}
@@ -2858,7 +2858,7 @@ void Client::Handle_OP_AltCurrencySellSelection(const EQApplicationPacket *app)
if (DistanceSquared(m_Position, tar->GetPosition()) > USE_NPC_RANGE2)
return;
if (tar->GetClass() != ALT_CURRENCY_MERCHANT) {
if (tar->GetClass() != Class::AlternateCurrencyMerchant) {
return;
}
@@ -2966,7 +2966,7 @@ void Client::Handle_OP_ApplyPoison(const EQApplicationPacket *app)
bool IsPoison = (poison && poison->ItemType == EQ::item::ItemTypePoison);
if (IsPoison && GetClass() == ROGUE) {
if (IsPoison && GetClass() == Class::Rogue) {
// Live always checks for skillup, even when poison is too high
CheckIncreaseSkill(EQ::skills::SkillApplyPoison, nullptr, 10);
@@ -3926,7 +3926,7 @@ void Client::Handle_OP_Begging(const EQApplicationPacket *app)
if (!HasSkill(EQ::skills::SkillBegging) || !GetTarget())
return;
if (GetTarget()->GetClass() == LDON_TREASURE)
if (GetTarget()->GetClass() == Class::LDoNTreasure)
return;
p_timers.Start(pTimerBeggingPickPocket, 8);
@@ -4471,7 +4471,7 @@ void Client::Handle_OP_CastSpell(const EQApplicationPacket *app)
else if (slot == CastingSlot::Ability) {
uint16 spell_to_cast = 0;
if (castspell->spell_id == SPELL_LAY_ON_HANDS && GetClass() == PALADIN) {
if (castspell->spell_id == SPELL_LAY_ON_HANDS && GetClass() == Class::Paladin) {
if (!p_timers.Expired(&database, pTimerLayHands)) {
Message(Chat::Red, "Ability recovery time not yet met.");
InterruptSpell(castspell->spell_id);
@@ -4481,7 +4481,7 @@ void Client::Handle_OP_CastSpell(const EQApplicationPacket *app)
p_timers.Start(pTimerLayHands, LayOnHandsReuseTime);
}
else if ((castspell->spell_id == SPELL_HARM_TOUCH
|| castspell->spell_id == SPELL_HARM_TOUCH2) && GetClass() == SHADOWKNIGHT) {
|| castspell->spell_id == SPELL_HARM_TOUCH2) && GetClass() == Class::ShadowKnight) {
if (!p_timers.Expired(&database, pTimerHarmTouch)) {
Message(Chat::Red, "Ability recovery time not yet met.");
InterruptSpell(castspell->spell_id);
@@ -5122,7 +5122,7 @@ void Client::Handle_OP_Consider(const EQApplicationPacket *app)
}
}
if (t->GetClass() == LDON_TREASURE) {
if (t->GetClass() == Class::LDoNTreasure) {
Message(Chat::Yellow, fmt::format("{}", t->GetCleanName()).c_str());
return;
}
@@ -8626,7 +8626,7 @@ void Client::Handle_OP_Hide(const EQApplicationPacket *app)
hidden = true;
tmHidden = Timer::GetCurrentTime();
}
if (GetClass() == ROGUE) {
if (GetClass() == Class::Rogue) {
auto outapp = new EQApplicationPacket(OP_SimpleMessage, sizeof(SimpleMessage_Struct));
SimpleMessage_Struct *msg = (SimpleMessage_Struct *)outapp->pBuffer;
msg->color = 0x010E;
@@ -9175,7 +9175,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app)
Bards on live can click items while casting spell gems, it stops that song cast and replaces it with item click cast.
Can not click while casting other items.
*/
if (GetClass() == BARD && IsCasting() && casting_spell_slot < CastingSlot::MaxGems)
if (GetClass() == Class::Bard && IsCasting() && casting_spell_slot < CastingSlot::MaxGems)
{
is_casting_bard_song = true;
}
@@ -9341,7 +9341,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app)
if (!IsCastWhileInvisibleSpell(item->Click.Effect)) {
CommonBreakInvisible(); // client can't do this for us :(
}
if (GetClass() == BARD){
if (GetClass() == Class::Bard){
DoBardCastingFromItemClick(is_casting_bard_song, item->CastTime, item->Click.Effect, target_id, CastingSlot::Item, slot_id, item->RecastType, item->RecastDelay);
}
else {
@@ -9413,7 +9413,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app)
if (!IsCastWhileInvisibleSpell(augitem->Click.Effect)) {
CommonBreakInvisible(); // client can't do this for us :(
}
if (GetClass() == BARD) {
if (GetClass() == Class::Bard) {
DoBardCastingFromItemClick(is_casting_bard_song, augitem->CastTime, augitem->Click.Effect, target_id, CastingSlot::Item, slot_id, augitem->RecastType, augitem->RecastDelay);
}
else {
@@ -9549,7 +9549,7 @@ void Client::Handle_OP_LDoNDisarmTraps(const EQApplicationPacket *app)
void Client::Handle_OP_LDoNInspect(const EQApplicationPacket *app)
{
auto* t = GetTarget();
if (t && t->GetClass() == LDON_TREASURE && !t->IsAura()) {
if (t && t->GetClass() == Class::LDoNTreasure && !t->IsAura()) {
if (parse->PlayerHasQuestSub(EVENT_INSPECT)) {
std::vector<std::any> args = { t };
if (parse->EventPlayer(EVENT_INSPECT, this, "", t->GetID(), &args) == 0) {
@@ -9878,7 +9878,7 @@ void Client::Handle_OP_LFPCommand(const EQApplicationPacket *app)
for (unsigned int i = 0; i<MAX_GROUP_MEMBERS; i++) {
LFPMembers[i].Name[0] = '\0';
LFPMembers[i].Class = NO_CLASS;
LFPMembers[i].Class = Class::None;
LFPMembers[i].Level = 0;
LFPMembers[i].Zone = 0;
LFPMembers[i].GuildID = 0xFFFF;
@@ -10219,7 +10219,7 @@ void Client::Handle_OP_MercenaryDataRequest(const EQApplicationPacket *app)
if (DistanceSquared(m_Position, tar->GetPosition()) > USE_NPC_RANGE2)
return;
if (tar->GetClass() != MERCENARY_MASTER) {
if (tar->GetClass() != Class::MercenaryLiaison) {
return;
}
@@ -10594,7 +10594,7 @@ void Client::Handle_OP_OpenGuildTributeMaster(const EQApplicationPacket *app)
//Opens the guild tribute master window
StartTribute_Struct* st = (StartTribute_Struct*)app->pBuffer;
Mob* tribmast = entity_list.GetMob(st->tribute_master_id);
if (tribmast && tribmast->IsNPC() && tribmast->GetClass() == GUILD_TRIBUTE_MASTER
if (tribmast && tribmast->IsNPC() && tribmast->GetClass() == Class::GuildTributeMaster
&& DistanceSquared(m_Position, tribmast->GetPosition()) <= USE_NPC_RANGE2) {
st->response = 1;
QueuePacket(app);
@@ -10625,7 +10625,7 @@ void Client::Handle_OP_OpenTributeMaster(const EQApplicationPacket *app)
//Opens the tribute master window
StartTribute_Struct* st = (StartTribute_Struct*)app->pBuffer;
Mob* tribmast = entity_list.GetMob(st->tribute_master_id);
if (tribmast && tribmast->IsNPC() && tribmast->GetClass() == TRIBUTE_MASTER
if (tribmast && tribmast->IsNPC() && tribmast->GetClass() == Class::TributeMaster
&& DistanceSquared(m_Position, tribmast->GetPosition()) <= USE_NPC_RANGE2) {
st->response = 1;
QueuePacket(app);
@@ -13531,7 +13531,7 @@ void Client::Handle_OP_Shielding(const EQApplicationPacket *app)
return;
}
if (GetClass() != WARRIOR){
if (GetClass() != Class::Warrior){
return;
}
@@ -13587,7 +13587,7 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app)
bool tmpmer_used = false;
Mob* tmp = entity_list.GetMob(mp->npcid);
if (tmp == 0 || !tmp->IsNPC() || tmp->GetClass() != MERCHANT)
if (tmp == 0 || !tmp->IsNPC() || tmp->GetClass() != Class::Merchant)
return;
if (mp->quantity < 1) return;
@@ -13896,7 +13896,7 @@ void Client::Handle_OP_ShopPlayerSell(const EQApplicationPacket *app)
Mob* vendor = entity_list.GetMob(mp->npcid);
if (vendor == 0 || !vendor->IsNPC() || vendor->GetClass() != MERCHANT)
if (vendor == 0 || !vendor->IsNPC() || vendor->GetClass() != Class::Merchant)
return;
//you have to be somewhat close to them to be properly using them
@@ -14122,7 +14122,7 @@ void Client::Handle_OP_ShopRequest(const EQApplicationPacket *app)
int merchantid = 0;
Mob* tmp = entity_list.GetMob(mc->npcid);
if (tmp == 0 || !tmp->IsNPC() || tmp->GetClass() != MERCHANT)
if (tmp == 0 || !tmp->IsNPC() || tmp->GetClass() != Class::Merchant)
return;
//you have to be somewhat close to them to be properly using them
@@ -14229,7 +14229,7 @@ void Client::Handle_OP_Sneak(const EQApplicationPacket *app)
sa_out->parameter = sneaking;
QueuePacket(outapp);
safe_delete(outapp);
if (GetClass() == ROGUE) {
if (GetClass() == Class::Rogue) {
outapp = new EQApplicationPacket(OP_SimpleMessage, 12);
SimpleMessage_Struct *msg = (SimpleMessage_Struct *)outapp->pBuffer;
msg->color = 0x010E;
@@ -15545,7 +15545,7 @@ void Client::Handle_OP_TributeItem(const EQApplicationPacket *app)
tribute_master_id = t->tribute_master_id;
//make sure they are dealing with a valid tribute master
Mob* tribmast = entity_list.GetMob(t->tribute_master_id);
if (!tribmast || !tribmast->IsNPC() || tribmast->GetClass() != TRIBUTE_MASTER)
if (!tribmast || !tribmast->IsNPC() || tribmast->GetClass() != Class::TributeMaster)
return;
if (DistanceSquared(m_Position, tribmast->GetPosition()) > USE_NPC_RANGE2)
return;
@@ -15572,7 +15572,7 @@ void Client::Handle_OP_TributeMoney(const EQApplicationPacket *app)
tribute_master_id = t->tribute_master_id;
//make sure they are dealing with a valid tribute master
Mob* tribmast = entity_list.GetMob(t->tribute_master_id);
if (!tribmast || !tribmast->IsNPC() || tribmast->GetClass() != TRIBUTE_MASTER)
if (!tribmast || !tribmast->IsNPC() || tribmast->GetClass() != Class::TributeMaster)
return;
if (DistanceSquared(m_Position, tribmast->GetPosition()) > USE_NPC_RANGE2)
return;