[Code Cleanup] Remove this-> in code where its implied (#2088)

This commit is contained in:
Chris Miles 2022-05-01 09:22:09 -05:00 committed by GitHub
parent b02008ec53
commit 5b4aeaa457
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
47 changed files with 1033 additions and 1033 deletions

View File

@ -23,18 +23,18 @@
BasePacket::BasePacket(const unsigned char *buf, uint32 len) BasePacket::BasePacket(const unsigned char *buf, uint32 len)
{ {
this->pBuffer=nullptr; pBuffer=nullptr;
this->size=0; size=0;
this->_wpos = 0; _wpos = 0;
this->_rpos = 0; _rpos = 0;
this->timestamp.tv_sec = 0; timestamp.tv_sec = 0;
if (len>0) { if (len>0) {
this->size=len; size=len;
pBuffer= new unsigned char[len]; pBuffer= new unsigned char[len];
if (buf) { if (buf) {
memcpy(this->pBuffer,buf,len); memcpy(pBuffer,buf,len);
} else { } else {
memset(this->pBuffer,0,len); memset(pBuffer,0,len);
} }
} }
} }

View File

@ -214,7 +214,7 @@ EQ::ItemInstance::~ItemInstance()
bool EQ::ItemInstance::IsType(item::ItemClass item_class) const bool EQ::ItemInstance::IsType(item::ItemClass item_class) const
{ {
// IsType(<ItemClassTypes>) does not protect against 'm_item = nullptr' // IsType(<ItemClassTypes>) does not protect against 'm_item = nullptr'
// Check usage type // Check usage type
if ((m_use_type == ItemInstWorldContainer) && (item_class == item::ItemClassBag)) if ((m_use_type == ItemInstWorldContainer) && (item_class == item::ItemClassBag))
return true; return true;
@ -245,7 +245,7 @@ bool EQ::ItemInstance::IsStackable() const
{ {
if (!m_item) if (!m_item)
return false; return false;
return m_item->Stackable; return m_item->Stackable;
} }
@ -253,7 +253,7 @@ bool EQ::ItemInstance::IsCharged() const
{ {
if (!m_item) if (!m_item)
return false; return false;
if (m_item->MaxCharges > 1) if (m_item->MaxCharges > 1)
return true; return true;
else else
@ -381,7 +381,7 @@ EQ::ItemInstance* EQ::ItemInstance::PopItem(uint8 index)
m_contents.erase(index); m_contents.erase(index);
return inst; // Return pointer that needs to be deleted (or otherwise managed) return inst; // Return pointer that needs to be deleted (or otherwise managed)
} }
return nullptr; return nullptr;
} }
@ -476,7 +476,7 @@ uint8 EQ::ItemInstance::GetTotalItemCount() const
{ {
if (!m_item) if (!m_item)
return 0; return 0;
uint8 item_count = 1; uint8 item_count = 1;
if (m_item && !m_item->IsClassBag()) { return item_count; } if (m_item && !m_item->IsClassBag()) { return item_count; }
@ -526,7 +526,7 @@ EQ::ItemInstance* EQ::ItemInstance::GetOrnamentationAug(int32 ornamentationAugty
{ {
continue; continue;
} }
return this->GetAugment(i); return GetAugment(i);
} }
} }
@ -549,7 +549,7 @@ uint32 EQ::ItemInstance::GetOrnamentHeroModel(int32 material_slot) const {
bool EQ::ItemInstance::UpdateOrnamentationInfo() { bool EQ::ItemInstance::UpdateOrnamentationInfo() {
if (!m_item || !m_item->IsClassCommon()) if (!m_item || !m_item->IsClassCommon())
return false; return false;
bool ornamentSet = false; bool ornamentSet = false;
int32 ornamentationAugtype = RuleI(Character, OrnamentationAugmentType); int32 ornamentationAugtype = RuleI(Character, OrnamentationAugmentType);
@ -642,7 +642,7 @@ void EQ::ItemInstance::PutAugment(uint8 slot, const ItemInstance& augment)
{ {
if (!m_item || !m_item->IsClassCommon()) if (!m_item || !m_item->IsClassCommon())
return; return;
PutItem(slot, augment); PutItem(slot, augment);
} }
@ -655,7 +655,7 @@ void EQ::ItemInstance::PutAugment(SharedDatabase *db, uint8 slot, uint32 item_id
if (aug) { if (aug) {
PutAugment(slot, *aug); PutAugment(slot, *aug);
safe_delete(aug); safe_delete(aug);
} }
} }
// Remove augment from item and destroy it // Remove augment from item and destroy it
@ -663,7 +663,7 @@ void EQ::ItemInstance::DeleteAugment(uint8 index)
{ {
if (!m_item || !m_item->IsClassCommon()) if (!m_item || !m_item->IsClassCommon())
return; return;
DeleteItem(index); DeleteItem(index);
} }
@ -672,7 +672,7 @@ EQ::ItemInstance* EQ::ItemInstance::RemoveAugment(uint8 index)
{ {
if (!m_item || !m_item->IsClassCommon()) if (!m_item || !m_item->IsClassCommon())
return nullptr; return nullptr;
return PopItem(index); return PopItem(index);
} }
@ -680,7 +680,7 @@ bool EQ::ItemInstance::IsAugmented()
{ {
if (!m_item || !m_item->IsClassCommon()) if (!m_item || !m_item->IsClassCommon())
return false; return false;
for (int index = invaug::SOCKET_BEGIN; index <= invaug::SOCKET_END; ++index) { for (int index = invaug::SOCKET_BEGIN; index <= invaug::SOCKET_END; ++index) {
if (GetAugmentItemID(index)) if (GetAugmentItemID(index))
return true; return true;
@ -698,7 +698,7 @@ bool EQ::ItemInstance::ContainsAugmentByID(uint32 item_id)
if (!item_id) { if (!item_id) {
return false; return false;
} }
for (uint8 augment_slot = invaug::SOCKET_BEGIN; augment_slot <= invaug::SOCKET_END; ++augment_slot) { for (uint8 augment_slot = invaug::SOCKET_BEGIN; augment_slot <= invaug::SOCKET_END; ++augment_slot) {
if (GetAugmentItemID(augment_slot) == item_id) { if (GetAugmentItemID(augment_slot) == item_id) {
return true; return true;
@ -718,7 +718,7 @@ int EQ::ItemInstance::CountAugmentByID(uint32 item_id)
if (!item_id) { if (!item_id) {
return quantity; return quantity;
} }
for (uint8 augment_slot = invaug::SOCKET_BEGIN; augment_slot <= invaug::SOCKET_END; ++augment_slot) { for (uint8 augment_slot = invaug::SOCKET_BEGIN; augment_slot <= invaug::SOCKET_END; ++augment_slot) {
if (GetAugmentItemID(augment_slot) == item_id) { if (GetAugmentItemID(augment_slot) == item_id) {
quantity++; quantity++;
@ -873,7 +873,7 @@ bool EQ::ItemInstance::IsDroppable(bool recurse) const
return false; return false;
} }
} }
return true; return true;
} }
@ -1745,4 +1745,4 @@ EvolveInfo::EvolveInfo(uint32 first, uint8 max, bool allkills, uint32 L2, uint32
EvolveInfo::~EvolveInfo() { EvolveInfo::~EvolveInfo() {
} }

View File

@ -246,7 +246,7 @@ const std::string &RuleManager::_GetRuleNotes(RuleType type, uint16 index) {
bool RuleManager::LoadRules(Database *database, const char *ruleset_name, bool reload) { bool RuleManager::LoadRules(Database *database, const char *ruleset_name, bool reload) {
int ruleset_id = this->GetRulesetID(database, ruleset_name); int ruleset_id = GetRulesetID(database, ruleset_name);
if (ruleset_id < 0) { if (ruleset_id < 0) {
Log(Logs::Detail, Logs::Rules, "Failed to find ruleset '%s' for load operation. Canceling.", ruleset_name); Log(Logs::Detail, Logs::Rules, "Failed to find ruleset '%s' for load operation. Canceling.", ruleset_name);
return (false); return (false);
@ -309,7 +309,7 @@ bool RuleManager::LoadRules(Database *database, const char *ruleset_name, bool r
} }
void RuleManager::SaveRules(Database *database, const char *ruleset_name) { void RuleManager::SaveRules(Database *database, const char *ruleset_name) {
if (ruleset_name != nullptr) { if (ruleset_name != nullptr) {
//saving to a specific name //saving to a specific name
if (m_activeName != ruleset_name) { if (m_activeName != ruleset_name) {
@ -347,7 +347,7 @@ void RuleManager::_SaveRule(Database *database, RuleType type, uint16 index) {
return; return;
if (type == BoolRule && strcasecmp(_GetRuleName(type, index), "World:UseClientBasedExpansionSettings") == 0) if (type == BoolRule && strcasecmp(_GetRuleName(type, index), "World:UseClientBasedExpansionSettings") == 0)
return; return;
switch (type) { switch (type) {
case IntRule: case IntRule:
sprintf(value_string, "%d", m_RuleIntValues[index]); sprintf(value_string, "%d", m_RuleIntValues[index]);
@ -432,7 +432,7 @@ bool RuleManager::UpdateInjectedRules(Database *db, const char *ruleset_name, bo
// build injected entries // build injected entries
for (const auto &rd_iter : rule_data) { for (const auto &rd_iter : rule_data) {
const auto &dd_iter = std::find(database_data.begin(), database_data.end(), rd_iter.first); const auto &dd_iter = std::find(database_data.begin(), database_data.end(), rd_iter.first);
if (dd_iter == database_data.end()) { if (dd_iter == database_data.end()) {
@ -440,7 +440,7 @@ bool RuleManager::UpdateInjectedRules(Database *db, const char *ruleset_name, bo
std::tuple<int, std::string, std::string, std::string>( std::tuple<int, std::string, std::string, std::string>(
ruleset_id, // `ruleset_id` ruleset_id, // `ruleset_id`
rd_iter.first, // `rule_name` rd_iter.first, // `rule_name`
rd_iter.second.first, // `rule_value` rd_iter.second.first, // `rule_value`
EscapeString(*rd_iter.second.second) // `notes` EscapeString(*rd_iter.second.second) // `notes`
) )
); );
@ -481,7 +481,7 @@ bool RuleManager::UpdateInjectedRules(Database *db, const char *ruleset_name, bo
ruleset_id ruleset_id
); );
} }
return true; return true;
} }
@ -509,7 +509,7 @@ bool RuleManager::UpdateOrphanedRules(Database *db, bool quiet_update)
// build orphaned entries // build orphaned entries
for (auto row : results) { for (auto row : results) {
const auto &rd_iter = std::find(rule_data.begin(), rule_data.end(), row[0]); const auto &rd_iter = std::find(rule_data.begin(), rule_data.end(), row[0]);
if (rd_iter == rule_data.end()) { if (rd_iter == rule_data.end()) {
@ -539,7 +539,7 @@ bool RuleManager::UpdateOrphanedRules(Database *db, bool quiet_update)
LogInfo("[{}] Orphaned Rule(s) Deleted from [All Rulesets] (-1)", orphaned_rule_entries.size()); LogInfo("[{}] Orphaned Rule(s) Deleted from [All Rulesets] (-1)", orphaned_rule_entries.size());
} }
return true; return true;
} }
@ -586,7 +586,7 @@ bool RuleManager::RestoreRuleNotes(Database *db)
if (!db->QueryDatabase(query).Success()) { if (!db->QueryDatabase(query).Success()) {
continue; continue;
} }
++update_count; ++update_count;
} }

View File

@ -12,25 +12,25 @@ extern Database database;
PlayerLookingForGuild::PlayerLookingForGuild(char *Name, char *Comments, uint32 Level, uint32 Class, uint32 AACount, uint32 Timezone, uint32 TimePosted) PlayerLookingForGuild::PlayerLookingForGuild(char *Name, char *Comments, uint32 Level, uint32 Class, uint32 AACount, uint32 Timezone, uint32 TimePosted)
{ {
this->Name = Name; Name = Name;
this->Comments = Comments; Comments = Comments;
this->Level = Level; Level = Level;
this->Class = Class; Class = Class;
this->AACount = AACount; AACount = AACount;
this->TimeZone = Timezone; TimeZone = Timezone;
this->TimePosted = TimePosted; TimePosted = TimePosted;
} }
GuildLookingForPlayers::GuildLookingForPlayers(char *Name, char *Comments, uint32 FromLevel, uint32 ToLevel, uint32 Classes, uint32 AACount, uint32 Timezone, uint32 TimePosted) GuildLookingForPlayers::GuildLookingForPlayers(char *Name, char *Comments, uint32 FromLevel, uint32 ToLevel, uint32 Classes, uint32 AACount, uint32 Timezone, uint32 TimePosted)
{ {
this->Name = Name; Name = Name;
this->Comments = Comments; Comments = Comments;
this->FromLevel = FromLevel; FromLevel = FromLevel;
this->ToLevel = ToLevel; ToLevel = ToLevel;
this->Classes = Classes; Classes = Classes;
this->AACount = AACount; AACount = AACount;
this->TimeZone = Timezone; TimeZone = Timezone;
this->TimePosted = TimePosted; TimePosted = TimePosted;
} }
bool LFGuildManager::LoadDatabase() bool LFGuildManager::LoadDatabase()

View File

@ -31,10 +31,10 @@ Adventure::Adventure(AdventureTemplate *t)
Adventure::Adventure(AdventureTemplate *t, int count, int assassination_count, AdventureStatus status, uint16 instance_id, uint32 time_left) Adventure::Adventure(AdventureTemplate *t, int count, int assassination_count, AdventureStatus status, uint16 instance_id, uint32 time_left)
{ {
adventure_template = t; adventure_template = t;
this->count = count; count = count;
this->assassination_count = assassination_count; assassination_count = assassination_count;
this->status = status; status = status;
this->instance_id = instance_id; instance_id = instance_id;
if(status == AS_Finished) if(status == AS_Finished)
{ {

View File

@ -735,7 +735,7 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) {
} }
if (RuleB(World, EnableIPExemptions) || RuleI(World, MaxClientsPerIP) >= 0) { if (RuleB(World, EnableIPExemptions) || RuleI(World, MaxClientsPerIP) >= 0) {
client_list.GetCLEIP(this->GetIP()); //Check current CLE Entry IPs against incoming connection client_list.GetCLEIP(GetIP()); //Check current CLE Entry IPs against incoming connection
} }
EnterWorld_Struct *ew=(EnterWorld_Struct *)app->pBuffer; EnterWorld_Struct *ew=(EnterWorld_Struct *)app->pBuffer;
@ -996,9 +996,9 @@ bool Client::HandlePacket(const EQApplicationPacket *app) {
} }
// Voidd: Anti-GM Account hack, Checks source ip against valid GM Account IP Addresses // Voidd: Anti-GM Account hack, Checks source ip against valid GM Account IP Addresses
if (RuleB(World, GMAccountIPList) && this->GetAdmin() >= (RuleI(World, MinGMAntiHackStatus))) { if (RuleB(World, GMAccountIPList) && GetAdmin() >= (RuleI(World, MinGMAntiHackStatus))) {
if(!database.CheckGMIPs(long2ip(this->GetIP()).c_str(), this->GetAccountID())) { if(!database.CheckGMIPs(long2ip(GetIP()).c_str(), GetAccountID())) {
LogInfo("GM Account not permited from source address [{}] and accountid [{}]", long2ip(this->GetIP()).c_str(), this->GetAccountID()); LogInfo("GM Account not permited from source address [{}] and accountid [{}]", long2ip(GetIP()).c_str(), GetAccountID());
eqs->Close(); eqs->Close();
} }
} }

View File

@ -133,7 +133,7 @@ void ClientListEntry::SetChar(uint32 iCharID, const char *iCharName)
void ClientListEntry::SetOnline(ZoneServer *iZS, CLE_Status iOnline) void ClientListEntry::SetOnline(ZoneServer *iZS, CLE_Status iOnline)
{ {
if (iZS == this->Server()) { if (iZS == Server()) {
SetOnline(iOnline); SetOnline(iOnline);
} }
} }

View File

@ -467,7 +467,7 @@ void ClientList::SendOnlineGuildMembers(uint32 FromID, uint32 GuildID)
int PacketLength = 8; int PacketLength = 8;
uint32 Count = 0; uint32 Count = 0;
ClientListEntry* from = this->FindCLEByCharacterID(FromID); ClientListEntry* from = FindCLEByCharacterID(FromID);
if(!from) if(!from)
{ {
@ -1125,7 +1125,7 @@ void ClientList::ConsoleSendWhoAll(const char* to, int16 admin, Who_All_Struct*
auto output = fmt::to_string(out); auto output = fmt::to_string(out);
connection->SendEmoteMessageRaw( connection->SendEmoteMessageRaw(
to, to,
0, 0,
AccountStatus::Player, AccountStatus::Player,
Chat::NPCQuestSay, Chat::NPCQuestSay,
output.c_str() output.c_str()
@ -1160,7 +1160,7 @@ void ClientList::ConsoleSendWhoAll(const char* to, int16 admin, Who_All_Struct*
auto output = fmt::to_string(out); auto output = fmt::to_string(out);
connection->SendEmoteMessageRaw( connection->SendEmoteMessageRaw(
to, to,
0, 0,
AccountStatus::Player, AccountStatus::Player,
Chat::NPCQuestSay, Chat::NPCQuestSay,
output.c_str() output.c_str()
@ -1414,7 +1414,7 @@ void ClientList::SendClientVersionSummary(const char *Name)
Chat::White, Chat::White,
fmt::format( fmt::format(
"There {} {} Titanium, {} SoF, {} SoD, {} UF, {} RoF, and {} RoF2 Client{} currently connected for a total of {} Client{} and {} Unique IP{} connected.", "There {} {} Titanium, {} SoF, {} SoD, {} UF, {} RoF, and {} RoF2 Client{} currently connected for a total of {} Client{} and {} Unique IP{} connected.",
(total_clients != 1 ? "are" : "is"), (total_clients != 1 ? "are" : "is"),
client_count[EQ::versions::ClientVersion::Titanium], client_count[EQ::versions::ClientVersion::Titanium],
client_count[EQ::versions::ClientVersion::SoF], client_count[EQ::versions::ClientVersion::SoF],
client_count[EQ::versions::ClientVersion::SoD], client_count[EQ::versions::ClientVersion::SoD],

View File

@ -525,7 +525,7 @@ void Console::ProcessCommand(const char* command) {
if (sep.IsNumber(1) && atoi(sep.arg[1]) > 0) { if (sep.IsNumber(1) && atoi(sep.arg[1]) > 0) {
auto pack = new ServerPacket(ServerOP_Uptime, sizeof(ServerUptime_Struct)); auto pack = new ServerPacket(ServerOP_Uptime, sizeof(ServerUptime_Struct));
ServerUptime_Struct* sus = (ServerUptime_Struct*) pack->pBuffer; ServerUptime_Struct* sus = (ServerUptime_Struct*) pack->pBuffer;
snprintf(sus->adminname, sizeof(sus->adminname), "*%s", this->GetName()); snprintf(sus->adminname, sizeof(sus->adminname), "*%s", GetName());
sus->zoneserverid = atoi(sep.arg[1]); sus->zoneserverid = atoi(sep.arg[1]);
ZoneServer* zs = zoneserver_list.FindByID(sus->zoneserverid); ZoneServer* zs = zoneserver_list.FindByID(sus->zoneserverid);
if (zs) if (zs)
@ -544,9 +544,9 @@ void Console::ProcessCommand(const char* command) {
SendMessage(1, "MD5: %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", md5[0], md5[1], md5[2], md5[3], md5[4], md5[5], md5[6], md5[7], md5[8], md5[9], md5[10], md5[11], md5[12], md5[13], md5[14], md5[15]); SendMessage(1, "MD5: %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", md5[0], md5[1], md5[2], md5[3], md5[4], md5[5], md5[6], md5[7], md5[8], md5[9], md5[10], md5[11], md5[12], md5[13], md5[14], md5[15]);
} }
else if (strcasecmp(sep.arg[0], "whoami") == 0) { else if (strcasecmp(sep.arg[0], "whoami") == 0) {
SendMessage(1, "You are logged in as '%s'", this->AccountName()); SendMessage(1, "You are logged in as '%s'", AccountName());
SendMessage(1, "You are known as '*%s'", this->AccountName()); SendMessage(1, "You are known as '*%s'", AccountName());
SendMessage(1, "AccessLevel: %d", this->Admin()); SendMessage(1, "AccessLevel: %d", Admin());
} }
else if (strcasecmp(sep.arg[0], "echo") == 0) { else if (strcasecmp(sep.arg[0], "echo") == 0) {
if (strcasecmp(sep.arg[1], "on") == 0) if (strcasecmp(sep.arg[1], "on") == 0)
@ -628,15 +628,15 @@ void Console::ProcessCommand(const char* command) {
SendMessage(1, "Character Does Not Exist"); SendMessage(1, "Character Does Not Exist");
} }
} }
else if (strcasecmp(sep.arg[0], "flag") == 0 && this->Admin() >= consoleFlagStatus) { else if (strcasecmp(sep.arg[0], "flag") == 0 && Admin() >= consoleFlagStatus) {
// SCORPIOUS2K - reversed parameter order for flag // SCORPIOUS2K - reversed parameter order for flag
if(sep.arg[2][0]==0 || !sep.IsNumber(1)) if(sep.arg[2][0]==0 || !sep.IsNumber(1))
SendMessage(1, "Usage: flag [status] [accountname]"); SendMessage(1, "Usage: flag [status] [accountname]");
else else
{ {
if (atoi(sep.arg[1]) > this->Admin()) if (atoi(sep.arg[1]) > Admin())
SendMessage(1, "You cannot set people's status to higher than your own"); SendMessage(1, "You cannot set people's status to higher than your own");
else if (atoi(sep.arg[1]) < 0 && this->Admin() < consoleFlagStatus) else if (atoi(sep.arg[1]) < 0 && Admin() < consoleFlagStatus)
SendMessage(1, "You have too low of status to change flags"); SendMessage(1, "You have too low of status to change flags");
else if (!database.SetAccountStatus(sep.arg[2], atoi(sep.arg[1]))) else if (!database.SetAccountStatus(sep.arg[2], atoi(sep.arg[1])))
SendMessage(1, "Unable to flag account!"); SendMessage(1, "Unable to flag account!");
@ -655,7 +655,7 @@ void Console::ProcessCommand(const char* command) {
ServerKickPlayer_Struct* skp = (ServerKickPlayer_Struct*) pack->pBuffer; ServerKickPlayer_Struct* skp = (ServerKickPlayer_Struct*) pack->pBuffer;
strcpy(skp->adminname, tmpname); strcpy(skp->adminname, tmpname);
strcpy(skp->name, sep.arg[1]); strcpy(skp->name, sep.arg[1]);
skp->adminrank = this->Admin(); skp->adminrank = Admin();
zoneserver_list.SendPacket(pack); zoneserver_list.SendPacket(pack);
delete pack; delete pack;
} }

View File

@ -84,7 +84,7 @@ ZoneServer::ZoneServer(std::shared_ptr<EQ::Net::ServertalkServerConnection> conn
} }
}); });
this->console = console; console = console;
} }
ZoneServer::~ZoneServer() { ZoneServer::~ZoneServer() {
@ -1567,7 +1567,7 @@ void ZoneServer::TriggerBootup(uint32 iZoneID, uint32 iInstanceID, const char* a
strcpy(s->adminname, adminname); strcpy(s->adminname, adminname);
if (iZoneID == 0) if (iZoneID == 0)
s->zoneid = this->GetZoneID(); s->zoneid = GetZoneID();
else else
s->zoneid = iZoneID; s->zoneid = iZoneID;

View File

@ -76,7 +76,7 @@ void EntityList::DescribeAggro(Client *towho, NPC *from_who, float d, bool verbo
if(owner) { if(owner) {
faction_id = owner->GetPrimaryFaction(); faction_id = owner->GetPrimaryFaction();
} }
std::string faction_name = ( std::string faction_name = (
faction_id > 0 ? faction_id > 0 ?
content_db.GetFactionName(faction_id) : content_db.GetFactionName(faction_id) :
@ -147,7 +147,7 @@ void EntityList::DescribeAggro(Client *towho, NPC *from_who, float d, bool verbo
} }
} }
void NPC::DescribeAggro(Client *towho, Mob *mob, bool verbose) { void NPC::DescribeAggro(Client *towho, Mob *mob, bool verbose) {
//this logic is duplicated from below, try to keep it up to date. //this logic is duplicated from below, try to keep it up to date.
float aggro_range = GetAggroRange(); float aggro_range = GetAggroRange();
float x_range = std::abs(mob->GetX() - GetX()); float x_range = std::abs(mob->GetX() - GetX());
@ -356,7 +356,7 @@ void NPC::DescribeAggro(Client *towho, Mob *mob, bool verbose) {
mob->GetPrimaryFaction() != GetPrimaryFaction() && mob->GetPrimaryFaction() != GetPrimaryFaction() &&
mob->GetPrimaryFaction() == -4 && mob->GetPrimaryFaction() == -4 &&
!GetOwner() !GetOwner()
) )
) )
) { ) {
towho->Message( towho->Message(
@ -413,7 +413,7 @@ bool Mob::CheckWillAggro(Mob *mob) {
return false; return false;
} }
} }
// We don't want to aggro clients outside of water if we're water only. // We don't want to aggro clients outside of water if we're water only.
if ( if (
mob->IsClient() && mob->IsClient() &&
@ -442,7 +442,7 @@ bool Mob::CheckWillAggro(Mob *mob) {
) { ) {
return false; return false;
} }
if (IsNPC() && mob->IsNPC() && mob->GetSpecialAbility(IMMUNE_AGGRO_NPC)) { if (IsNPC() && mob->IsNPC() && mob->GetSpecialAbility(IMMUNE_AGGRO_NPC)) {
return false; return false;
} }
@ -453,7 +453,7 @@ bool Mob::CheckWillAggro(Mob *mob) {
// Check if it's not a Interactive NPC // Check if it's not a Interactive NPC
// Trumpcard: The 1st 3 checks are low cost calcs to filter out unnessecary distance checks. Leave them at the beginning, they are the most likely occurence. // Trumpcard: The 1st 3 checks are low cost calcs to filter out unnessecary distance checks. Leave them at the beginning, they are the most likely occurence.
// Image: I moved this up by itself above faction and distance checks because if one of these return true, theres no reason to go through the other information // Image: I moved this up by itself above faction and distance checks because if one of these return true, theres no reason to go through the other information
float aggro_range = GetAggroRange(); float aggro_range = GetAggroRange();
float x_range = std::abs(mob->GetX() - GetX()); float x_range = std::abs(mob->GetX() - GetX());
float y_range = std::abs(mob->GetY() - GetY()); float y_range = std::abs(mob->GetY() - GetY());
@ -856,7 +856,7 @@ type', in which case, the answer is yes.
} }
while( reverse++ == 0 ); while( reverse++ == 0 );
LogDebug("Mob::IsAttackAllowed: don't have a rule for this - [{}] vs [{}]\n", this->GetName(), target->GetName()); LogDebug("Mob::IsAttackAllowed: don't have a rule for this - [{}] vs [{}]\n", GetName(), target->GetName());
return false; return false;
} }
@ -881,7 +881,7 @@ bool Mob::IsBeneficialAllowed(Mob *target)
// first figure out if we're pets. we always look at the master's flags. // first figure out if we're pets. we always look at the master's flags.
// no need to compare pets to anything // no need to compare pets to anything
mob1 = this->GetOwnerID() ? this->GetOwner() : this; mob1 = GetOwnerID() ? GetOwner() : this;
mob2 = target->GetOwnerID() ? target->GetOwner() : target; mob2 = target->GetOwnerID() ? target->GetOwner() : target;
// if it's self target or our own pet it's ok // if it's self target or our own pet it's ok
@ -996,7 +996,7 @@ bool Mob::IsBeneficialAllowed(Mob *target)
} }
while( reverse++ == 0 ); while( reverse++ == 0 );
LogDebug("Mob::IsBeneficialAllowed: don't have a rule for this - [{}] to [{}]\n", this->GetName(), target->GetName()); LogDebug("Mob::IsBeneficialAllowed: don't have a rule for this - [{}] to [{}]\n", GetName(), target->GetName());
return false; return false;
} }

View File

@ -149,7 +149,7 @@ EQ::skills::SkillType Mob::AttackAnimation(int Hand, const EQ::ItemInstance* wea
SetDualWieldingSameDelayWeapons(3); SetDualWieldingSameDelayWeapons(3);
} }
} }
//If both weapons have same delay this allows a chance for DW animation //If both weapons have same delay this allows a chance for DW animation
if (GetDualWieldingSameDelayWeapons() && Hand == EQ::invslot::slotPrimary) { if (GetDualWieldingSameDelayWeapons() && Hand == EQ::invslot::slotPrimary) {
@ -1395,7 +1395,7 @@ void Mob::DoAttack(Mob *other, DamageHitInfo &hit, ExtraAttackOptions *opts, boo
FromRiposte = false; FromRiposte = false;
} }
// check to see if we hit.. // check to see if we hit..
if (!FromRiposte && other->AvoidDamage(this, hit)) { if (!FromRiposte && other->AvoidDamage(this, hit)) {
int strike_through = itembonuses.StrikeThrough + spellbonuses.StrikeThrough + aabonuses.StrikeThrough; int strike_through = itembonuses.StrikeThrough + spellbonuses.StrikeThrough + aabonuses.StrikeThrough;
if (strike_through && zone->random.Roll(strike_through)) { if (strike_through && zone->random.Roll(strike_through)) {
@ -1992,7 +1992,7 @@ bool Client::Death(Mob* killerMob, int32 damage, uint16 spell, EQ::skills::Skill
dead_timer.Start(5000, true); dead_timer.Start(5000, true);
m_pp.zone_id = m_pp.binds[0].zone_id; m_pp.zone_id = m_pp.binds[0].zone_id;
m_pp.zoneInstance = m_pp.binds[0].instance_id; m_pp.zoneInstance = m_pp.binds[0].instance_id;
database.MoveCharacterToZone(this->CharacterID(), m_pp.zone_id); database.MoveCharacterToZone(CharacterID(), m_pp.zone_id);
Save(); Save();
GoToDeath(); GoToDeath();
} }
@ -2001,8 +2001,8 @@ bool Client::Death(Mob* killerMob, int32 damage, uint16 spell, EQ::skills::Skill
if (RuleB(QueryServ, PlayerLogDeaths)) { if (RuleB(QueryServ, PlayerLogDeaths)) {
const char * killer_name = ""; const char * killer_name = "";
if (killerMob && killerMob->GetCleanName()) { killer_name = killerMob->GetCleanName(); } if (killerMob && killerMob->GetCleanName()) { killer_name = killerMob->GetCleanName(); }
std::string event_desc = StringFormat("Died in zoneid:%i instid:%i by '%s', spellid:%i, damage:%i", this->GetZoneID(), this->GetInstanceID(), killer_name, spell, damage); std::string event_desc = StringFormat("Died in zoneid:%i instid:%i by '%s', spellid:%i, damage:%i", GetZoneID(), GetInstanceID(), killer_name, spell, damage);
QServ->PlayerLogEvent(Player_Log_Deaths, this->CharacterID(), event_desc); QServ->PlayerLogEvent(Player_Log_Deaths, CharacterID(), event_desc);
} }
parse->EventPlayer(EVENT_DEATH_COMPLETE, this, export_string, 0); parse->EventPlayer(EVENT_DEATH_COMPLETE, this, export_string, 0);
@ -2025,8 +2025,8 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool
//Check that we can attack before we calc heading and face our target //Check that we can attack before we calc heading and face our target
if (!IsAttackAllowed(other)) { if (!IsAttackAllowed(other)) {
if (this->GetOwnerID()) if (GetOwnerID())
this->SayString(NOT_LEGAL_TARGET); SayString(NOT_LEGAL_TARGET);
if (other) { if (other) {
if (other->IsClient()) if (other->IsClient())
other->CastToClient()->RemoveXTarget(this, false); other->CastToClient()->RemoveXTarget(this, false);
@ -2156,7 +2156,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool
} }
uint8 otherlevel = other->GetLevel(); uint8 otherlevel = other->GetLevel();
uint8 mylevel = this->GetLevel(); uint8 mylevel = GetLevel();
otherlevel = otherlevel ? otherlevel : 1; otherlevel = otherlevel ? otherlevel : 1;
mylevel = mylevel ? mylevel : 1; mylevel = mylevel ? mylevel : 1;
@ -2429,7 +2429,7 @@ bool NPC::Death(Mob* killer_mob, int32 damage, uint16 spell, EQ::skills::SkillTy
if (!IsCharmed() && give_exp_client && !RuleB(NPC, EnableMeritBasedFaction)) if (!IsCharmed() && give_exp_client && !RuleB(NPC, EnableMeritBasedFaction))
hate_list.DoFactionHits(GetNPCFactionID()); hate_list.DoFactionHits(GetNPCFactionID());
bool IsLdonTreasure = (this->GetClass() == LDON_TREASURE); bool IsLdonTreasure = (GetClass() == LDON_TREASURE);
if (give_exp_client && !IsCorpse()) { if (give_exp_client && !IsCorpse()) {
Group *kg = entity_list.GetGroupByClient(give_exp_client); Group *kg = entity_list.GetGroupByClient(give_exp_client);
@ -2478,8 +2478,8 @@ bool NPC::Death(Mob* killer_mob, int32 damage, uint16 spell, EQ::skills::SkillTy
(sizeof(QSPlayerLogNPCKillsPlayers_Struct) * PlayerCount)); (sizeof(QSPlayerLogNPCKillsPlayers_Struct) * PlayerCount));
PlayerCount = 0; PlayerCount = 0;
QSPlayerLogNPCKill_Struct* QS = (QSPlayerLogNPCKill_Struct*)pack->pBuffer; QSPlayerLogNPCKill_Struct* QS = (QSPlayerLogNPCKill_Struct*)pack->pBuffer;
QS->s1.NPCID = this->GetNPCTypeID(); QS->s1.NPCID = GetNPCTypeID();
QS->s1.ZoneID = this->GetZoneID(); QS->s1.ZoneID = GetZoneID();
QS->s1.Type = 2; // Raid Fight QS->s1.Type = 2; // Raid Fight
for (int i = 0; i < MAX_RAID_MEMBERS; i++) { for (int i = 0; i < MAX_RAID_MEMBERS; i++) {
if (kr->members[i].member != nullptr && kr->members[i].member->IsClient()) { // If Group Member is Client if (kr->members[i].member != nullptr && kr->members[i].member->IsClient()) { // If Group Member is Client
@ -2525,8 +2525,8 @@ bool NPC::Death(Mob* killer_mob, int32 damage, uint16 spell, EQ::skills::SkillTy
(sizeof(QSPlayerLogNPCKillsPlayers_Struct) * PlayerCount)); (sizeof(QSPlayerLogNPCKillsPlayers_Struct) * PlayerCount));
PlayerCount = 0; PlayerCount = 0;
QSPlayerLogNPCKill_Struct* QS = (QSPlayerLogNPCKill_Struct*)pack->pBuffer; QSPlayerLogNPCKill_Struct* QS = (QSPlayerLogNPCKill_Struct*)pack->pBuffer;
QS->s1.NPCID = this->GetNPCTypeID(); QS->s1.NPCID = GetNPCTypeID();
QS->s1.ZoneID = this->GetZoneID(); QS->s1.ZoneID = GetZoneID();
QS->s1.Type = 1; // Group Fight QS->s1.Type = 1; // Group Fight
for (int i = 0; i < MAX_GROUP_MEMBERS; i++) { for (int i = 0; i < MAX_GROUP_MEMBERS; i++) {
if (kg->members[i] != nullptr && kg->members[i]->IsClient()) { // If Group Member is Client if (kg->members[i] != nullptr && kg->members[i]->IsClient()) { // If Group Member is Client
@ -2567,8 +2567,8 @@ bool NPC::Death(Mob* killer_mob, int32 damage, uint16 spell, EQ::skills::SkillTy
sizeof(QSPlayerLogNPCKill_Struct) + sizeof(QSPlayerLogNPCKill_Struct) +
(sizeof(QSPlayerLogNPCKillsPlayers_Struct) * 1)); (sizeof(QSPlayerLogNPCKillsPlayers_Struct) * 1));
QSPlayerLogNPCKill_Struct* QS = (QSPlayerLogNPCKill_Struct*)pack->pBuffer; QSPlayerLogNPCKill_Struct* QS = (QSPlayerLogNPCKill_Struct*)pack->pBuffer;
QS->s1.NPCID = this->GetNPCTypeID(); QS->s1.NPCID = GetNPCTypeID();
QS->s1.ZoneID = this->GetZoneID(); QS->s1.ZoneID = GetZoneID();
QS->s1.Type = 0; // Solo Fight QS->s1.Type = 0; // Solo Fight
Client *c = give_exp_client; Client *c = give_exp_client;
QS->Chars[0].char_id = c->CharacterID(); QS->Chars[0].char_id = c->CharacterID();
@ -2593,12 +2593,12 @@ bool NPC::Death(Mob* killer_mob, int32 damage, uint16 spell, EQ::skills::SkillTy
killer = killer->GetOwner(); killer = killer->GetOwner();
if (killer->IsClient() && !killer->CastToClient()->GetGM()) if (killer->IsClient() && !killer->CastToClient()->GetGM())
this->CheckTrivialMinMaxLevelDrop(killer); CheckTrivialMinMaxLevelDrop(killer);
} }
entity_list.RemoveFromAutoXTargets(this); entity_list.RemoveFromAutoXTargets(this);
uint16 emoteid = this->GetEmoteID(); uint16 emoteid = GetEmoteID();
auto corpse = new Corpse(this, &itemlist, GetNPCTypeID(), &NPCTypedata, auto corpse = new Corpse(this, &itemlist, GetNPCTypeID(), &NPCTypedata,
level > 54 ? RuleI(NPC, MajorNPCCorpseDecayTimeMS) level > 54 ? RuleI(NPC, MajorNPCCorpseDecayTimeMS)
: RuleI(NPC, MinorNPCCorpseDecayTimeMS)); : RuleI(NPC, MinorNPCCorpseDecayTimeMS));
@ -2610,7 +2610,7 @@ bool NPC::Death(Mob* killer_mob, int32 damage, uint16 spell, EQ::skills::SkillTy
// entity_list.RemoveMobFromCloseLists(this); // entity_list.RemoveMobFromCloseLists(this);
close_mobs.clear(); close_mobs.clear();
this->SetID(0); SetID(0);
ApplyIllusionToCorpse(illusion_spell_id, corpse); ApplyIllusionToCorpse(illusion_spell_id, corpse);
if (killer != 0 && emoteid != 0) if (killer != 0 && emoteid != 0)
@ -2696,9 +2696,9 @@ bool NPC::Death(Mob* killer_mob, int32 damage, uint16 spell, EQ::skills::SkillTy
if (oos) { if (oos) {
mod_npc_killed(oos); mod_npc_killed(oos);
uint16 emoteid = this->GetEmoteID(); uint16 emoteid = GetEmoteID();
if (emoteid != 0) if (emoteid != 0)
this->DoNPCEmote(ONDEATH, emoteid); DoNPCEmote(ONDEATH, emoteid);
if (oos->IsNPC()) { if (oos->IsNPC()) {
parse->EventNPC(EVENT_NPC_SLAY, oos->CastToNPC(), this, "", 0); parse->EventNPC(EVENT_NPC_SLAY, oos->CastToNPC(), this, "", 0);
uint16 emoteid = oos->GetEmoteID(); uint16 emoteid = oos->GetEmoteID();
@ -2770,9 +2770,9 @@ void Mob::AddToHateList(Mob* other, uint32 hate /*= 0*/, int32 damage /*= 0*/, b
bool wasengaged = IsEngaged(); bool wasengaged = IsEngaged();
Mob* owner = other->GetOwner(); Mob* owner = other->GetOwner();
Mob* mypet = this->GetPet(); Mob* mypet = GetPet();
Mob* myowner = this->GetOwner(); Mob* myowner = GetOwner();
Mob* targetmob = this->GetTarget(); Mob* targetmob = GetTarget();
bool on_hatelist = CheckAggro(other); bool on_hatelist = CheckAggro(other);
if (other) { if (other) {
@ -2913,8 +2913,8 @@ void Mob::AddToHateList(Mob* other, uint32 hate /*= 0*/, int32 damage /*= 0*/, b
// owner must get on list, but he's not actually gained any hate yet // owner must get on list, but he's not actually gained any hate yet
if ( if (
!owner->GetSpecialAbility(IMMUNE_AGGRO) && !owner->GetSpecialAbility(IMMUNE_AGGRO) &&
!(this->GetSpecialAbility(IMMUNE_AGGRO_CLIENT) && owner->IsClient()) && !(GetSpecialAbility(IMMUNE_AGGRO_CLIENT) && owner->IsClient()) &&
!(this->GetSpecialAbility(IMMUNE_AGGRO_NPC) && owner->IsNPC()) !(GetSpecialAbility(IMMUNE_AGGRO_NPC) && owner->IsNPC())
) { ) {
if (owner->IsClient() && !CheckAggro(owner)) { if (owner->IsClient() && !CheckAggro(owner)) {
owner->CastToClient()->AddAutoXTarget(this); owner->CastToClient()->AddAutoXTarget(this);
@ -2928,8 +2928,8 @@ void Mob::AddToHateList(Mob* other, uint32 hate /*= 0*/, int32 damage /*= 0*/, b
if ( if (
!mypet->IsFamiliar() && !mypet->IsFamiliar() &&
!mypet->GetSpecialAbility(IMMUNE_AGGRO) && !mypet->GetSpecialAbility(IMMUNE_AGGRO) &&
!(mypet->GetSpecialAbility(IMMUNE_AGGRO_CLIENT) && this->IsClient()) && !(mypet->GetSpecialAbility(IMMUNE_AGGRO_CLIENT) && IsClient()) &&
!(mypet->GetSpecialAbility(IMMUNE_AGGRO_NPC) && this->IsNPC()) !(mypet->GetSpecialAbility(IMMUNE_AGGRO_NPC) && IsNPC())
) { ) {
mypet->hate_list.AddEntToHateList(other, 0, 0, bFrenzy); mypet->hate_list.AddEntToHateList(other, 0, 0, bFrenzy);
} }
@ -2938,8 +2938,8 @@ void Mob::AddToHateList(Mob* other, uint32 hate /*= 0*/, int32 damage /*= 0*/, b
if ( if (
myowner->IsAIControlled() && myowner->IsAIControlled() &&
!myowner->GetSpecialAbility(IMMUNE_AGGRO) && !myowner->GetSpecialAbility(IMMUNE_AGGRO) &&
!(this->GetSpecialAbility(IMMUNE_AGGRO_CLIENT) && myowner->IsClient()) && !(GetSpecialAbility(IMMUNE_AGGRO_CLIENT) && myowner->IsClient()) &&
!(this->GetSpecialAbility(IMMUNE_AGGRO_NPC) && myowner->IsNPC()) !(GetSpecialAbility(IMMUNE_AGGRO_NPC) && myowner->IsNPC())
) { ) {
myowner->hate_list.AddEntToHateList(other, 0, 0, bFrenzy); myowner->hate_list.AddEntToHateList(other, 0, 0, bFrenzy);
} }
@ -2952,7 +2952,7 @@ void Mob::AddToHateList(Mob* other, uint32 hate /*= 0*/, int32 damage /*= 0*/, b
if (!wasengaged) { if (!wasengaged) {
if (IsNPC() && other->IsClient() && other->CastToClient()) if (IsNPC() && other->IsClient() && other->CastToClient())
parse->EventNPC(EVENT_AGGRO, this->CastToNPC(), other, "", 0); parse->EventNPC(EVENT_AGGRO, CastToNPC(), other, "", 0);
AI_Event_Engaged(other, iYellForHelp); AI_Event_Engaged(other, iYellForHelp);
} }
} }
@ -3380,7 +3380,7 @@ int32 Mob::AffectMagicalDamage(int32 damage, uint16 spell_id, const bool iBuffTi
// Reduce damage by the Spell Shielding first so that the runes don't take the raw damage. // Reduce damage by the Spell Shielding first so that the runes don't take the raw damage.
int total_spellshielding = itembonuses.SpellShield + itembonuses.MitigateSpellRune[SBIndex::MITIGATION_RUNE_PERCENT] + aabonuses.MitigateSpellRune[SBIndex::MITIGATION_RUNE_PERCENT]; int total_spellshielding = itembonuses.SpellShield + itembonuses.MitigateSpellRune[SBIndex::MITIGATION_RUNE_PERCENT] + aabonuses.MitigateSpellRune[SBIndex::MITIGATION_RUNE_PERCENT];
damage -= (damage * total_spellshielding / 100); damage -= (damage * total_spellshielding / 100);
//Only mitigate if damage is above the minimium specified. //Only mitigate if damage is above the minimium specified.
if (spellbonuses.SpellThresholdGuard[SBIndex::THRESHOLDGUARD_MITIGATION_PERCENT]) { if (spellbonuses.SpellThresholdGuard[SBIndex::THRESHOLDGUARD_MITIGATION_PERCENT]) {
slot = spellbonuses.SpellThresholdGuard[SBIndex::THRESHOLDGUARD_BUFFSLOT]; slot = spellbonuses.SpellThresholdGuard[SBIndex::THRESHOLDGUARD_BUFFSLOT];
@ -3674,14 +3674,14 @@ void Mob::CommonDamage(Mob* attacker, int &damage, const uint16 spell_id, const
//we used to do a message to the client, but its gone now. //we used to do a message to the client, but its gone now.
// emote goes with every one ... even npcs // emote goes with every one ... even npcs
entity_list.MessageClose(this, true, RuleI(Range, SpellMessages), Chat::Emote, "%s beams a smile at %s", attacker->GetCleanName(), this->GetCleanName()); entity_list.MessageClose(this, true, RuleI(Range, SpellMessages), Chat::Emote, "%s beams a smile at %s", attacker->GetCleanName(), GetCleanName());
} }
// If a client pet is damaged while sitting, stand, fix sit button, // If a client pet is damaged while sitting, stand, fix sit button,
// and remove sitting regen. Removes bug where client clicks sit // and remove sitting regen. Removes bug where client clicks sit
// during battle and gains pet hp-regen and bugs the sit button. // during battle and gains pet hp-regen and bugs the sit button.
if (IsPet()) { if (IsPet()) {
Mob *owner = this->GetOwner(); Mob *owner = GetOwner();
if (owner && owner->IsClient()) { if (owner && owner->IsClient()) {
if (GetPetOrder() == SPO_Sit) { if (GetPetOrder() == SPO_Sit) {
SetPetOrder(SPO_Follow); SetPetOrder(SPO_Follow);
@ -3721,7 +3721,7 @@ void Mob::CommonDamage(Mob* attacker, int &damage, const uint16 spell_id, const
} }
// fix GUI sit button to be unpressed and stop sitting regen // fix GUI sit button to be unpressed and stop sitting regen
this->CastToClient()->SetPetCommandState(PET_BUTTON_SIT, 0); CastToClient()->SetPetCommandState(PET_BUTTON_SIT, 0);
pet->SetAppearance(eaStanding); pet->SetAppearance(eaStanding);
} }
@ -4232,7 +4232,7 @@ void Mob::TryDefensiveProc(Mob *on, uint16 hand) {
int32 aa_spell_id = aabonuses.DefensiveProc[i + SBIndex::COMBAT_PROC_SPELL_ID]; int32 aa_spell_id = aabonuses.DefensiveProc[i + SBIndex::COMBAT_PROC_SPELL_ID];
int32 aa_proc_chance = 100 + aabonuses.DefensiveProc[i + SBIndex::COMBAT_PROC_RATE_MOD]; int32 aa_proc_chance = 100 + aabonuses.DefensiveProc[i + SBIndex::COMBAT_PROC_RATE_MOD];
uint32 aa_proc_reuse_timer = aabonuses.DefensiveProc[i + SBIndex::COMBAT_PROC_REUSE_TIMER]; uint32 aa_proc_reuse_timer = aabonuses.DefensiveProc[i + SBIndex::COMBAT_PROC_REUSE_TIMER];
if (aa_rank_id) { if (aa_rank_id) {
if (!IsProcLimitTimerActive(-aa_rank_id, aa_proc_reuse_timer, ProcType::DEFENSIVE_PROC)) { if (!IsProcLimitTimerActive(-aa_rank_id, aa_proc_reuse_timer, ProcType::DEFENSIVE_PROC)) {
float chance = ProcChance * (static_cast<float>(aa_proc_chance) / 100.0f); float chance = ProcChance * (static_cast<float>(aa_proc_chance) / 100.0f);
@ -4508,7 +4508,7 @@ void Mob::TrySpellProc(const EQ::ItemInstance *inst, const EQ::ItemData *weapon,
aa_proc_reuse_timer = aabonuses.RangedProc[i + SBIndex::COMBAT_PROC_RATE_MOD]; aa_proc_reuse_timer = aabonuses.RangedProc[i + SBIndex::COMBAT_PROC_RATE_MOD];
proc_type = ProcType::RANGED_PROC; proc_type = ProcType::RANGED_PROC;
} }
if (aa_rank_id) { if (aa_rank_id) {
passed_skill_limit_check = PassLimitToSkill(skillinuse, 0, proc_type, aa_rank_id); passed_skill_limit_check = PassLimitToSkill(skillinuse, 0, proc_type, aa_rank_id);
@ -4630,8 +4630,8 @@ void Mob::TryCriticalHit(Mob *defender, DamageHitInfo &hit, ExtraAttackOptions *
} }
#ifdef BOTS #ifdef BOTS
if (this->IsPet() && this->GetOwner() && this->GetOwner()->IsBot()) { if (IsPet() && GetOwner() && GetOwner()->IsBot()) {
this->TryPetCriticalHit(defender, hit); TryPetCriticalHit(defender, hit);
return; return;
} }
#endif // BOTS #endif // BOTS
@ -5180,7 +5180,7 @@ void Mob::TrySkillProc(Mob *on, EQ::skills::SkillType skill, uint16 ReuseTime, b
proc_spell_id = spells[base_spell_id].base_value[i]; proc_spell_id = spells[base_spell_id].base_value[i];
ProcMod = static_cast<float>(spells[base_spell_id].limit_value[i]); ProcMod = static_cast<float>(spells[base_spell_id].limit_value[i]);
} }
else if (spells[base_spell_id].effect_id[i] == SE_LimitToSkill && spells[base_spell_id].base_value[i] <= EQ::skills::HIGHEST_SKILL) { else if (spells[base_spell_id].effect_id[i] == SE_LimitToSkill && spells[base_spell_id].base_value[i] <= EQ::skills::HIGHEST_SKILL) {
if (CanProc && spells[base_spell_id].base_value[i] == skill && IsValidSpell(proc_spell_id)) { if (CanProc && spells[base_spell_id].base_value[i] == skill && IsValidSpell(proc_spell_id)) {
float final_chance = chance * (ProcMod / 100.0f); float final_chance = chance * (ProcMod / 100.0f);
@ -5330,7 +5330,7 @@ float Mob::GetSkillProcChances(uint16 ReuseTime, uint16 hand) {
} }
void Mob::TryCastOnSkillUse(Mob *on, EQ::skills::SkillType skill) { void Mob::TryCastOnSkillUse(Mob *on, EQ::skills::SkillType skill) {
if (!spellbonuses.HasSkillAttackProc[skill] && !itembonuses.HasSkillAttackProc[skill] && !aabonuses.HasSkillAttackProc[skill]) { if (!spellbonuses.HasSkillAttackProc[skill] && !itembonuses.HasSkillAttackProc[skill] && !aabonuses.HasSkillAttackProc[skill]) {
return; return;
} }

View File

@ -127,7 +127,7 @@ void Beacon::AELocationSpell(Mob *caster, uint16 cast_spell_id, int16 resist_adj
caster_id = caster->GetID(); caster_id = caster->GetID();
spell_id = cast_spell_id; spell_id = cast_spell_id;
this->resist_adjust = resist_adjust; resist_adjust = resist_adjust;
spell_iterations = spells[spell_id].aoe_duration / 2500; spell_iterations = spells[spell_id].aoe_duration / 2500;
spell_iterations = spell_iterations < 1 ? 1 : spell_iterations; // at least 1 spell_iterations = spell_iterations < 1 ? 1 : spell_iterations; // at least 1
if (spells[spell_id].aoe_max_targets) { if (spells[spell_id].aoe_max_targets) {

View File

@ -53,7 +53,7 @@ void Mob::CalcBonuses()
/* Fast walking NPC's are prone to disappear into walls/hills /* Fast walking NPC's are prone to disappear into walls/hills
We set this here because NPC's can cast spells to change walkspeed/runspeed We set this here because NPC's can cast spells to change walkspeed/runspeed
*/ */
float get_walk_speed = static_cast<float>(0.025f * this->GetWalkspeed()); float get_walk_speed = static_cast<float>(0.025f * GetWalkspeed());
rooted = FindType(SE_Root); rooted = FindType(SE_Root);
} }
@ -1118,7 +1118,7 @@ void Mob::ApplyAABonuses(const AA::Rank &rank, StatBonuses *newbon)
case SE_Proc_Timer_Modifier: { case SE_Proc_Timer_Modifier: {
/* /*
AA can multiples of this in a single effect, proc should use the timer AA can multiples of this in a single effect, proc should use the timer
that comes after the respective proc spell effect, thus rank.id will be already set that comes after the respective proc spell effect, thus rank.id will be already set
when this is checked. when this is checked.
*/ */
@ -1220,7 +1220,7 @@ void Mob::ApplyAABonuses(const AA::Rank &rank, StatBonuses *newbon)
newbon->SkillAttackProc[i + SBIndex::SKILLATK_PROC_SPELL_ID] = rank.spell; // spell to proc newbon->SkillAttackProc[i + SBIndex::SKILLATK_PROC_SPELL_ID] = rank.spell; // spell to proc
newbon->SkillAttackProc[i + SBIndex::SKILLATK_PROC_CHANCE] = base_value; // Chance base 1000 = 100% proc rate newbon->SkillAttackProc[i + SBIndex::SKILLATK_PROC_CHANCE] = base_value; // Chance base 1000 = 100% proc rate
newbon->SkillAttackProc[i + SBIndex::SKILLATK_PROC_SKILL] = limit_value; // Skill to Proc Offr newbon->SkillAttackProc[i + SBIndex::SKILLATK_PROC_SKILL] = limit_value; // Skill to Proc Offr
if (limit_value < EQ::skills::HIGHEST_SKILL) { if (limit_value < EQ::skills::HIGHEST_SKILL) {
newbon->HasSkillAttackProc[limit_value] = true; //check first before looking for any effects. newbon->HasSkillAttackProc[limit_value] = true; //check first before looking for any effects.
} }
@ -1341,7 +1341,7 @@ void Mob::ApplyAABonuses(const AA::Rank &rank, StatBonuses *newbon)
} }
case SE_MitigateDamageShield: { case SE_MitigateDamageShield: {
//AA that increase mitigation are set to negative. //AA that increase mitigation are set to negative.
if (base_value < 0) { if (base_value < 0) {
base_value = base_value * (-1); base_value = base_value * (-1);
@ -1736,7 +1736,7 @@ void Mob::ApplyAABonuses(const AA::Rank &rank, StatBonuses *newbon)
break; break;
} }
case SE_ExtendedShielding: case SE_ExtendedShielding:
{ {
if (newbon->ExtendedShielding < base_value) { if (newbon->ExtendedShielding < base_value) {
newbon->ExtendedShielding = base_value; newbon->ExtendedShielding = base_value;
@ -1744,7 +1744,7 @@ void Mob::ApplyAABonuses(const AA::Rank &rank, StatBonuses *newbon)
break; break;
} }
case SE_ShieldDuration: case SE_ShieldDuration:
{ {
if (newbon->ShieldDuration < base_value) { if (newbon->ShieldDuration < base_value) {
newbon->ShieldDuration = base_value; newbon->ShieldDuration = base_value;
@ -1762,7 +1762,7 @@ void Mob::ApplyAABonuses(const AA::Rank &rank, StatBonuses *newbon)
newbon->SecondaryForte = base_value; newbon->SecondaryForte = base_value;
} }
break; break;
case SE_ZoneSuspendMinion: case SE_ZoneSuspendMinion:
newbon->ZoneSuspendMinion = base_value; newbon->ZoneSuspendMinion = base_value;
break; break;
@ -3610,7 +3610,7 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses *ne
new_bonus->SkillAttackProc[i + SBIndex::SKILLATK_PROC_SPELL_ID] = max_value; // spell to proc new_bonus->SkillAttackProc[i + SBIndex::SKILLATK_PROC_SPELL_ID] = max_value; // spell to proc
new_bonus->SkillAttackProc[i + SBIndex::SKILLATK_PROC_CHANCE] = effect_value; // Chance base 1000 = 100% proc rate new_bonus->SkillAttackProc[i + SBIndex::SKILLATK_PROC_CHANCE] = effect_value; // Chance base 1000 = 100% proc rate
new_bonus->SkillAttackProc[i + SBIndex::SKILLATK_PROC_SKILL] = limit_value; // Skill to Proc Offr new_bonus->SkillAttackProc[i + SBIndex::SKILLATK_PROC_SKILL] = limit_value; // Skill to Proc Offr
if (limit_value < EQ::skills::HIGHEST_SKILL) { if (limit_value < EQ::skills::HIGHEST_SKILL) {
new_bonus->HasSkillAttackProc[limit_value] = true; //check first before looking for any effects. new_bonus->HasSkillAttackProc[limit_value] = true; //check first before looking for any effects.
} }
@ -3808,7 +3808,7 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses *ne
if (spells[new_bonus->WeaponStance[limit_value]].rank < spells[effect_value].rank) { //If so, check if any new spellids with higher rank exist (live spells for this are ranked). if (spells[new_bonus->WeaponStance[limit_value]].rank < spells[effect_value].rank) { //If so, check if any new spellids with higher rank exist (live spells for this are ranked).
new_bonus->WeaponStance[limit_value] = effect_value; //Overwrite with new effect new_bonus->WeaponStance[limit_value] = effect_value; //Overwrite with new effect
SetWeaponStanceEnabled(true); SetWeaponStanceEnabled(true);
if (WornType) { if (WornType) {
weaponstance.itembonus_enabled = true; weaponstance.itembonus_enabled = true;
} }

View File

@ -31,13 +31,13 @@ extern volatile bool is_zone_loaded;
// This constructor is used during the bot create command // This constructor is used during the bot create command
Bot::Bot(NPCType *npcTypeData, Client* botOwner) : NPC(npcTypeData, nullptr, glm::vec4(), Ground, false), rest_timer(1), ping_timer(1) { Bot::Bot(NPCType *npcTypeData, Client* botOwner) : NPC(npcTypeData, nullptr, glm::vec4(), Ground, false), rest_timer(1), ping_timer(1) {
GiveNPCTypeData(npcTypeData); GiveNPCTypeData(npcTypeData);
if(botOwner) { if(botOwner) {
this->SetBotOwner(botOwner); SetBotOwner(botOwner);
this->_botOwnerCharacterID = botOwner->CharacterID(); _botOwnerCharacterID = botOwner->CharacterID();
} else { } else {
this->SetBotOwner(0); SetBotOwner(0);
this->_botOwnerCharacterID = 0; _botOwnerCharacterID = 0;
} }
m_inv.SetInventoryVersion(EQ::versions::MobVersion::Bot); m_inv.SetInventoryVersion(EQ::versions::MobVersion::Bot);
@ -116,19 +116,19 @@ Bot::Bot(NPCType *npcTypeData, Client* botOwner) : NPC(npcTypeData, nullptr, glm
for (int i = 0; i < MaxTimer; i++) for (int i = 0; i < MaxTimer; i++)
timers[i] = 0; timers[i] = 0;
strcpy(this->name, this->GetCleanName()); strcpy(name, GetCleanName());
memset(&_botInspectMessage, 0, sizeof(InspectMessage_Struct)); memset(&_botInspectMessage, 0, sizeof(InspectMessage_Struct));
} }
// This constructor is used when the bot is loaded out of the database // This constructor is used when the bot is loaded out of the database
Bot::Bot(uint32 botID, uint32 botOwnerCharacterID, uint32 botSpellsID, double totalPlayTime, uint32 lastZoneId, NPCType *npcTypeData) Bot::Bot(uint32 botID, uint32 botOwnerCharacterID, uint32 botSpellsID, double totalPlayTime, uint32 lastZoneId, NPCType *npcTypeData)
: NPC(npcTypeData, nullptr, glm::vec4(), Ground, false), rest_timer(1), ping_timer(1) : NPC(npcTypeData, nullptr, glm::vec4(), Ground, false), rest_timer(1), ping_timer(1)
{ {
GiveNPCTypeData(npcTypeData); GiveNPCTypeData(npcTypeData);
this->_botOwnerCharacterID = botOwnerCharacterID; _botOwnerCharacterID = botOwnerCharacterID;
if(this->_botOwnerCharacterID > 0) if(_botOwnerCharacterID > 0)
this->SetBotOwner(entity_list.GetClientByCharID(this->_botOwnerCharacterID)); SetBotOwner(entity_list.GetClientByCharID(_botOwnerCharacterID));
auto bot_owner = GetBotOwner(); auto bot_owner = GetBotOwner();
@ -201,7 +201,7 @@ Bot::Bot(uint32 botID, uint32 botOwnerCharacterID, uint32 botSpellsID, double to
else else
SetStopMeleeLevel(255); SetStopMeleeLevel(255);
strcpy(this->name, this->GetCleanName()); strcpy(name, GetCleanName());
memset(&_botInspectMessage, 0, sizeof(InspectMessage_Struct)); memset(&_botInspectMessage, 0, sizeof(InspectMessage_Struct));
if (!database.botdb.LoadInspectMessage(GetBotID(), _botInspectMessage) && bot_owner) if (!database.botdb.LoadInspectMessage(GetBotID(), _botInspectMessage) && bot_owner)
@ -209,7 +209,7 @@ Bot::Bot(uint32 botID, uint32 botOwnerCharacterID, uint32 botSpellsID, double to
if (!database.botdb.LoadGuildMembership(GetBotID(), _guildId, _guildRank, _guildName) && bot_owner) if (!database.botdb.LoadGuildMembership(GetBotID(), _guildId, _guildRank, _guildName) && bot_owner)
bot_owner->Message(Chat::Red, "%s for '%s'", BotDatabase::fail::LoadGuildMembership(), GetCleanName()); bot_owner->Message(Chat::Red, "%s for '%s'", BotDatabase::fail::LoadGuildMembership(), GetCleanName());
std::string error_message; std::string error_message;
EquipBot(&error_message); EquipBot(&error_message);
@ -384,7 +384,7 @@ Bot::Bot(uint32 botID, uint32 botOwnerCharacterID, uint32 botSpellsID, double to
} }
} }
} }
else { else {
bot_owner->Message(Chat::Red, "&s for '%s'", BotDatabase::fail::LoadBuffs(), GetCleanName()); bot_owner->Message(Chat::Red, "&s for '%s'", BotDatabase::fail::LoadBuffs(), GetCleanName());
@ -407,7 +407,7 @@ Bot::Bot(uint32 botID, uint32 botOwnerCharacterID, uint32 botSpellsID, double to
GetRace() == DWARF || GetRace() == DWARF ||
GetRace() == TROLL || GetRace() == TROLL ||
GetRace() == OGRE GetRace() == OGRE
) ? ) ?
RuleI(Bots, OldResurrectionSicknessSpell) : RuleI(Bots, OldResurrectionSicknessSpell) :
RuleI(Bots, ResurrectionSicknessSpell) RuleI(Bots, ResurrectionSicknessSpell)
); );
@ -440,12 +440,12 @@ Bot::~Bot() {
} }
void Bot::SetBotID(uint32 botID) { void Bot::SetBotID(uint32 botID) {
this->_botID = botID; _botID = botID;
this->npctype_id = botID; npctype_id = botID;
} }
void Bot::SetBotSpellID(uint32 newSpellID) { void Bot::SetBotSpellID(uint32 newSpellID) {
this->npc_spells_id = newSpellID; npc_spells_id = newSpellID;
} }
void Bot::SetSurname(std::string bot_surname) { void Bot::SetSurname(std::string bot_surname) {
@ -840,7 +840,7 @@ void Bot::GenerateBaseStats()
int32 CorruptionResist = _baseCorrup; int32 CorruptionResist = _baseCorrup;
// pulling fixed values from an auto-increment field is dangerous... // pulling fixed values from an auto-increment field is dangerous...
switch(this->GetClass()) { switch(GetClass()) {
case WARRIOR: case WARRIOR:
BotSpellID = 3001; BotSpellID = 3001;
Strength += 10; Strength += 10;
@ -967,7 +967,7 @@ void Bot::GenerateBaseStats()
float BotSize = GetSize(); float BotSize = GetSize();
switch(this->GetRace()) { switch(GetRace()) {
case HUMAN: // Humans have no race bonus case HUMAN: // Humans have no race bonus
break; break;
case BARBARIAN: case BARBARIAN:
@ -1127,33 +1127,33 @@ void Bot::GenerateBaseStats()
break; break;
} }
this->STR = Strength; STR = Strength;
this->STA = Stamina; STA = Stamina;
this->DEX = Dexterity; DEX = Dexterity;
this->AGI = Agility; AGI = Agility;
this->WIS = Wisdom; WIS = Wisdom;
this->INT = Intelligence; INT = Intelligence;
this->CHA = Charisma; CHA = Charisma;
this->ATK = Attack; ATK = Attack;
this->MR = MagicResist; MR = MagicResist;
this->FR = FireResist; FR = FireResist;
this->DR = DiseaseResist; DR = DiseaseResist;
this->PR = PoisonResist; PR = PoisonResist;
this->CR = ColdResist; CR = ColdResist;
this->PhR = 0; PhR = 0;
this->Corrup = CorruptionResist; Corrup = CorruptionResist;
SetBotSpellID(BotSpellID); SetBotSpellID(BotSpellID);
this->size = BotSize; size = BotSize;
this->pAggroRange = 0; pAggroRange = 0;
this->pAssistRange = 0; pAssistRange = 0;
this->raid_target = false; raid_target = false;
this->deity = 396; deity = 396;
} }
void Bot::GenerateAppearance() { void Bot::GenerateAppearance() {
// Randomize facial appearance // Randomize facial appearance
int iFace = 0; int iFace = 0;
if(this->GetRace() == 2) // Barbarian w/Tatoo if(GetRace() == 2) // Barbarian w/Tatoo
iFace = zone->random.Int(0, 79); iFace = zone->random.Int(0, 79);
else else
iFace = zone->random.Int(0, 7); iFace = zone->random.Int(0, 7);
@ -1161,13 +1161,13 @@ void Bot::GenerateAppearance() {
int iHair = 0; int iHair = 0;
int iBeard = 0; int iBeard = 0;
int iBeardColor = 1; int iBeardColor = 1;
if(this->GetRace() == 522) { if(GetRace() == 522) {
iHair = zone->random.Int(0, 8); iHair = zone->random.Int(0, 8);
iBeard = zone->random.Int(0, 11); iBeard = zone->random.Int(0, 11);
iBeardColor = zone->random.Int(0, 3); iBeardColor = zone->random.Int(0, 3);
} else if(this->GetGender()) { } else if(GetGender()) {
iHair = zone->random.Int(0, 2); iHair = zone->random.Int(0, 2);
if(this->GetRace() == 8) { // Dwarven Females can have a beard if(GetRace() == 8) { // Dwarven Females can have a beard
if(zone->random.Int(1, 100) < 50) if(zone->random.Int(1, 100) < 50)
iFace += 10; iFace += 10;
} }
@ -1178,14 +1178,14 @@ void Bot::GenerateAppearance() {
} }
int iHairColor = 0; int iHairColor = 0;
if(this->GetRace() == 522) if(GetRace() == 522)
iHairColor = zone->random.Int(0, 3); iHairColor = zone->random.Int(0, 3);
else else
iHairColor = zone->random.Int(0, 19); iHairColor = zone->random.Int(0, 19);
uint8 iEyeColor1 = (uint8)zone->random.Int(0, 9); uint8 iEyeColor1 = (uint8)zone->random.Int(0, 9);
uint8 iEyeColor2 = 0; uint8 iEyeColor2 = 0;
if(this->GetRace() == 522) if(GetRace() == 522)
iEyeColor1 = iEyeColor2 = (uint8)zone->random.Int(0, 11); iEyeColor1 = iEyeColor2 = (uint8)zone->random.Int(0, 11);
else if(zone->random.Int(1, 100) > 96) else if(zone->random.Int(1, 100) > 96)
iEyeColor2 = zone->random.Int(0, 9); iEyeColor2 = zone->random.Int(0, 9);
@ -1195,21 +1195,21 @@ void Bot::GenerateAppearance() {
int iHeritage = 0; int iHeritage = 0;
int iTattoo = 0; int iTattoo = 0;
int iDetails = 0; int iDetails = 0;
if(this->GetRace() == 522) { if(GetRace() == 522) {
iHeritage = zone->random.Int(0, 6); iHeritage = zone->random.Int(0, 6);
iTattoo = zone->random.Int(0, 7); iTattoo = zone->random.Int(0, 7);
iDetails = zone->random.Int(0, 7); iDetails = zone->random.Int(0, 7);
} }
this->luclinface = iFace; luclinface = iFace;
this->hairstyle = iHair; hairstyle = iHair;
this->beard = iBeard; beard = iBeard;
this->beardcolor = iBeardColor; beardcolor = iBeardColor;
this->haircolor = iHairColor; haircolor = iHairColor;
this->eyecolor1 = iEyeColor1; eyecolor1 = iEyeColor1;
this->eyecolor2 = iEyeColor2; eyecolor2 = iEyeColor2;
this->drakkin_heritage = iHeritage; drakkin_heritage = iHeritage;
this->drakkin_tattoo = iTattoo; drakkin_tattoo = iTattoo;
this->drakkin_details = iDetails; drakkin_details = iDetails;
} }
int32 Bot::acmod() { int32 Bot::acmod() {
@ -1665,12 +1665,12 @@ int32 Bot::GenerateBaseHitPoints() {
new_base_hp = (5) + (GetLevel() * lm / 10) + (((NormalSTA - Post255) * GetLevel() * lm / 3000)) + ((Post255 * 1) * lm / 6000); new_base_hp = (5) + (GetLevel() * lm / 10) + (((NormalSTA - Post255) * GetLevel() * lm / 3000)) + ((Post255 * 1) * lm / 6000);
} }
this->base_hp = new_base_hp; base_hp = new_base_hp;
return new_base_hp; return new_base_hp;
} }
void Bot::LoadAAs() { void Bot::LoadAAs() {
aa_ranks.clear(); aa_ranks.clear();
int id = 0; int id = 0;
@ -1689,7 +1689,7 @@ void Bot::LoadAAs() {
points = 0; points = 0;
AA::Rank *current = ability->first; AA::Rank *current = ability->first;
if (current->level_req > GetLevel()) { if (current->level_req > GetLevel()) {
++iter; ++iter;
continue; continue;
@ -1730,7 +1730,7 @@ bool Bot::IsValidRaceClassCombo(uint16 bot_race, uint8 bot_class)
bool Bot::IsValidName() bool Bot::IsValidName()
{ {
std::string name = this->GetCleanName(); std::string name = GetCleanName();
return Bot::IsValidName(name); return Bot::IsValidName(name);
} }
@ -1740,7 +1740,7 @@ bool Bot::IsValidName(std::string& name)
return false; return false;
if (!isupper(name[0])) if (!isupper(name[0]))
return false; return false;
for (int i = 1; i < name.length(); ++i) { for (int i = 1; i < name.length(); ++i) {
if ((!RuleB(Bots, AllowCamelCaseNames) && !islower(name[i])) && name[i] != '_') { if ((!RuleB(Bots, AllowCamelCaseNames) && !islower(name[i])) && name[i] != '_') {
return false; return false;
@ -1772,7 +1772,7 @@ bool Bot::Save()
return false; return false;
} }
} }
// All of these continue to process if any fail // All of these continue to process if any fail
if (!database.botdb.SaveBuffs(this)) if (!database.botdb.SaveBuffs(this))
bot_owner->Message(Chat::Red, "%s for '%s'", BotDatabase::fail::SaveBuffs(), GetCleanName()); bot_owner->Message(Chat::Red, "%s for '%s'", BotDatabase::fail::SaveBuffs(), GetCleanName());
@ -1780,10 +1780,10 @@ bool Bot::Save()
bot_owner->Message(Chat::Red, "%s for '%s'", BotDatabase::fail::SaveTimers(), GetCleanName()); bot_owner->Message(Chat::Red, "%s for '%s'", BotDatabase::fail::SaveTimers(), GetCleanName());
if (!database.botdb.SaveStance(this)) if (!database.botdb.SaveStance(this))
bot_owner->Message(Chat::Red, "%s for '%s'", BotDatabase::fail::SaveStance(), GetCleanName()); bot_owner->Message(Chat::Red, "%s for '%s'", BotDatabase::fail::SaveStance(), GetCleanName());
if (!SavePet()) if (!SavePet())
bot_owner->Message(Chat::Red, "Failed to save pet for '%s'", GetCleanName()); bot_owner->Message(Chat::Red, "Failed to save pet for '%s'", GetCleanName());
return true; return true;
} }
@ -1887,7 +1887,7 @@ bool Bot::LoadPet()
} }
} }
} }
std::string error_message; std::string error_message;
uint32 pet_index = 0; uint32 pet_index = 0;
@ -1948,7 +1948,7 @@ bool Bot::SavePet()
{ {
if (!GetPet() || GetPet()->IsFamiliar()) // dead? if (!GetPet() || GetPet()->IsFamiliar()) // dead?
return true; return true;
NPC *pet_inst = GetPet()->CastToNPC(); NPC *pet_inst = GetPet()->CastToNPC();
if (!pet_inst->GetPetSpellID() || !IsValidSpell(pet_inst->GetPetSpellID())) if (!pet_inst->GetPetSpellID() || !IsValidSpell(pet_inst->GetPetSpellID()))
return false; return false;
@ -1964,9 +1964,9 @@ bool Bot::SavePet()
memset(pet_name, 0, 64); memset(pet_name, 0, 64);
memset(pet_buffs, 0, (sizeof(SpellBuff_Struct) * PET_BUFF_COUNT)); memset(pet_buffs, 0, (sizeof(SpellBuff_Struct) * PET_BUFF_COUNT));
memset(pet_items, 0, (sizeof(uint32) * EQ::invslot::EQUIPMENT_COUNT)); memset(pet_items, 0, (sizeof(uint32) * EQ::invslot::EQUIPMENT_COUNT));
pet_inst->GetPetState(pet_buffs, pet_items, pet_name); pet_inst->GetPetState(pet_buffs, pet_items, pet_name);
std::string pet_name_str = pet_name; std::string pet_name_str = pet_name;
safe_delete_array(pet_name); safe_delete_array(pet_name);
@ -1976,7 +1976,7 @@ bool Bot::SavePet()
bot_owner->Message(Chat::Red, "%s for %s's pet", BotDatabase::fail::SavePetStats(), GetCleanName()); bot_owner->Message(Chat::Red, "%s for %s's pet", BotDatabase::fail::SavePetStats(), GetCleanName());
return false; return false;
} }
if (!database.botdb.SavePetBuffs(GetBotID(), pet_buffs)) if (!database.botdb.SavePetBuffs(GetBotID(), pet_buffs))
bot_owner->Message(Chat::Red, "%s for %s's pet", BotDatabase::fail::SavePetBuffs(), GetCleanName()); bot_owner->Message(Chat::Red, "%s for %s's pet", BotDatabase::fail::SavePetBuffs(), GetCleanName());
if (!database.botdb.SavePetItems(GetBotID(), pet_items)) if (!database.botdb.SavePetItems(GetBotID(), pet_items))
@ -1990,7 +1990,7 @@ bool Bot::DeletePet()
auto bot_owner = GetBotOwner(); auto bot_owner = GetBotOwner();
if (!bot_owner) if (!bot_owner)
return false; return false;
std::string error_message; std::string error_message;
if (!database.botdb.DeletePetItems(GetBotID())) { if (!database.botdb.DeletePetItems(GetBotID())) {
@ -2433,7 +2433,7 @@ void Bot::AI_Process()
) { ) {
InterruptSpell(); InterruptSpell();
} }
return; return;
} }
} }
@ -2532,7 +2532,7 @@ void Bot::AI_Process()
SetPullingFlag(); SetPullingFlag();
bot_owner->SetBotPulling(); bot_owner->SetBotPulling();
if (HasPet() && (GetClass() != ENCHANTER || GetPet()->GetPetType() != petAnimation || GetAA(aaAnimationEmpathy) >= 1)) { if (HasPet() && (GetClass() != ENCHANTER || GetPet()->GetPetType() != petAnimation || GetAA(aaAnimationEmpathy) >= 1)) {
GetPet()->WipeHateList(); GetPet()->WipeHateList();
GetPet()->SetTarget(nullptr); GetPet()->SetTarget(nullptr);
m_previous_pet_order = GetPet()->GetPetOrder(); m_previous_pet_order = GetPet()->GetPetOrder();
@ -2547,7 +2547,7 @@ void Bot::AI_Process()
//#pragma region ALT COMBAT (ACQUIRE HATE) //#pragma region ALT COMBAT (ACQUIRE HATE)
else if (bo_alt_combat && m_alt_combat_hate_timer.Check(false)) { // 'Alt Combat' gives some more 'control' options on how bots process aggro else if (bo_alt_combat && m_alt_combat_hate_timer.Check(false)) { // 'Alt Combat' gives some more 'control' options on how bots process aggro
// Empty hate list - let's find some aggro // Empty hate list - let's find some aggro
if (!IsEngaged() && NOT_HOLDING && NOT_PASSIVE && (!bot_owner->GetBotPulling() || NOT_PULLING_BOT)) { if (!IsEngaged() && NOT_HOLDING && NOT_PASSIVE && (!bot_owner->GetBotPulling() || NOT_PULLING_BOT)) {
@ -2745,7 +2745,7 @@ void Bot::AI_Process()
Mob* tar = GetTarget(); // We should have a target..if not, we're awaiting new orders Mob* tar = GetTarget(); // We should have a target..if not, we're awaiting new orders
if (!tar || PASSIVE) { if (!tar || PASSIVE) {
SetTarget(nullptr); SetTarget(nullptr);
WipeHateList(); WipeHateList();
SetAttackFlag(false); SetAttackFlag(false);
@ -3026,7 +3026,7 @@ void Bot::AI_Process()
// We can fight // We can fight
if (atCombatRange) { if (atCombatRange) {
//if (IsMoving() || GetCombatJitterFlag()) { // StopMoving() needs to be called so that the jitter timer can be reset //if (IsMoving() || GetCombatJitterFlag()) { // StopMoving() needs to be called so that the jitter timer can be reset
if (IsMoving()) { if (IsMoving()) {
@ -3373,7 +3373,7 @@ void Bot::AI_Process()
// This is a mob that is fleeing either because it has been feared or is low on hitpoints // This is a mob that is fleeing either because it has been feared or is low on hitpoints
AI_PursueCastCheck(); // This appears to always return true..can't trust for success/fail AI_PursueCastCheck(); // This appears to always return true..can't trust for success/fail
return; return;
} }
} // End not in combat range } // End not in combat range
@ -3393,7 +3393,7 @@ void Bot::AI_Process()
} }
} }
else { // Out-of-combat behavior else { // Out-of-combat behavior
SetAttackFlag(false); SetAttackFlag(false);
SetAttackingFlag(false); SetAttackingFlag(false);
if (!bot_owner->GetBotPulling()) { if (!bot_owner->GetBotPulling()) {
@ -3413,7 +3413,7 @@ void Bot::AI_Process()
m_auto_defend_timer.Start(zone->random.Int(250, 1250)); // random timer to simulate 'awareness' (cuts down on scanning overhead) m_auto_defend_timer.Start(zone->random.Int(250, 1250)); // random timer to simulate 'awareness' (cuts down on scanning overhead)
return; return;
} }
if (m_auto_defend_timer.Check() && bot_owner->GetAggroCount()) { if (m_auto_defend_timer.Check() && bot_owner->GetAggroCount()) {
if (NOT_HOLDING && NOT_PASSIVE) { if (NOT_HOLDING && NOT_PASSIVE) {
@ -3455,7 +3455,7 @@ void Bot::AI_Process()
} }
//#pragma endregion //#pragma endregion
SetTarget(nullptr); SetTarget(nullptr);
if (HasPet() && (GetClass() != ENCHANTER || GetPet()->GetPetType() != petAnimation || GetAA(aaAnimationEmpathy) >= 1)) { if (HasPet() && (GetClass() != ENCHANTER || GetPet()->GetPetType() != petAnimation || GetAA(aaAnimationEmpathy) >= 1)) {
@ -3469,7 +3469,7 @@ void Bot::AI_Process()
} }
//#pragma region OK TO IDLE //#pragma region OK TO IDLE
// Ok to idle // Ok to idle
if ((NOT_GUARDING && fm_distance <= GetFollowDistance()) || (GUARDING && DistanceSquared(GetPosition(), GetGuardPoint()) <= GetFollowDistance())) { if ((NOT_GUARDING && fm_distance <= GetFollowDistance()) || (GUARDING && DistanceSquared(GetPosition(), GetGuardPoint()) <= GetFollowDistance())) {
@ -3566,9 +3566,9 @@ void Bot::AI_Process()
void Bot::PetAIProcess() { void Bot::PetAIProcess() {
if( !HasPet() || !GetPet() || !GetPet()->IsNPC()) if( !HasPet() || !GetPet() || !GetPet()->IsNPC())
return; return;
Mob* BotOwner = this->GetBotOwner(); Mob* BotOwner = GetBotOwner();
NPC* botPet = this->GetPet()->CastToNPC(); NPC* botPet = GetPet()->CastToNPC();
if(!botPet->GetOwner() || !botPet->GetID() || !botPet->GetOwnerID()) { if(!botPet->GetOwner() || !botPet->GetID() || !botPet->GetOwnerID()) {
Kill(); Kill();
return; return;
@ -3799,25 +3799,25 @@ bool Bot::Spawn(Client* botCharacterOwner) {
_lastZoneId = GetZoneID(); _lastZoneId = GetZoneID();
// this change propagates to Bot::FillSpawnStruct() // this change propagates to Bot::FillSpawnStruct()
this->helmtexture = 0; //0xFF; helmtexture = 0; //0xFF;
this->texture = 0; //0xFF; texture = 0; //0xFF;
if(this->Save()) if(Save())
this->GetBotOwner()->CastToClient()->Message(Chat::White, "%s saved.", this->GetCleanName()); GetBotOwner()->CastToClient()->Message(Chat::White, "%s saved.", GetCleanName());
else else
this->GetBotOwner()->CastToClient()->Message(Chat::Red, "%s save failed!", this->GetCleanName()); GetBotOwner()->CastToClient()->Message(Chat::Red, "%s save failed!", GetCleanName());
// Spawn the bot at the bot owner's loc // Spawn the bot at the bot owner's loc
this->m_Position.x = botCharacterOwner->GetX(); m_Position.x = botCharacterOwner->GetX();
this->m_Position.y = botCharacterOwner->GetY(); m_Position.y = botCharacterOwner->GetY();
this->m_Position.z = botCharacterOwner->GetZ(); m_Position.z = botCharacterOwner->GetZ();
// Make the bot look at the bot owner // Make the bot look at the bot owner
FaceTarget(botCharacterOwner); FaceTarget(botCharacterOwner);
UpdateEquipmentLight(); UpdateEquipmentLight();
UpdateActiveLight(); UpdateActiveLight();
this->m_targetable = true; m_targetable = true;
entity_list.AddBot(this, true, true); entity_list.AddBot(this, true, true);
// Load pet // Load pet
LoadPet(); LoadPet();
@ -3832,7 +3832,7 @@ bool Bot::Spawn(Client* botCharacterOwner) {
if(itemID != 0) { if(itemID != 0) {
materialFromSlot = EQ::InventoryProfile::CalcMaterialFromSlot(i); materialFromSlot = EQ::InventoryProfile::CalcMaterialFromSlot(i);
if(materialFromSlot != 0xFF) if(materialFromSlot != 0xFF)
this->SendWearChange(materialFromSlot); SendWearChange(materialFromSlot);
} }
} }
@ -3918,7 +3918,7 @@ void Bot::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) {
const EQ::ItemData* item = nullptr; const EQ::ItemData* item = nullptr;
const EQ::ItemInstance* inst = nullptr; const EQ::ItemInstance* inst = nullptr;
uint32 spawnedbotid = 0; uint32 spawnedbotid = 0;
spawnedbotid = this->GetBotID(); spawnedbotid = GetBotID();
for (int i = EQ::textures::textureBegin; i < EQ::textures::weaponPrimary; i++) { for (int i = EQ::textures::textureBegin; i < EQ::textures::weaponPrimary; i++) {
inst = GetBotItem(i); inst = GetBotItem(i);
if (inst) { if (inst) {
@ -3967,10 +3967,10 @@ Bot* Bot::LoadBot(uint32 botID)
Bot* loaded_bot = nullptr; Bot* loaded_bot = nullptr;
if (!botID) if (!botID)
return loaded_bot; return loaded_bot;
if (!database.botdb.LoadBot(botID, loaded_bot)) // TODO: Consider update to message handler if (!database.botdb.LoadBot(botID, loaded_bot)) // TODO: Consider update to message handler
return loaded_bot; return loaded_bot;
return loaded_bot; return loaded_bot;
} }
@ -3987,7 +3987,7 @@ void Bot::LoadAndSpawnAllZonedBots(Client* botOwner) {
botOwner->Message(Chat::Red, "%s", BotDatabase::fail::LoadGroupedBotsByGroupID()); botOwner->Message(Chat::Red, "%s", BotDatabase::fail::LoadGroupedBotsByGroupID());
return; return;
} }
if(!ActiveBots.empty()) { if(!ActiveBots.empty()) {
for(std::list<uint32>::iterator itr = ActiveBots.begin(); itr != ActiveBots.end(); ++itr) { for(std::list<uint32>::iterator itr = ActiveBots.begin(); itr != ActiveBots.end(); ++itr) {
Bot* activeBot = Bot::LoadBot(*itr); Bot* activeBot = Bot::LoadBot(*itr);
@ -4131,7 +4131,7 @@ void Bot::BotTradeAddItem(uint32 id, const EQ::ItemInstance* inst, int16 charges
m_inv.PutItem(lootSlot, *inst); m_inv.PutItem(lootSlot, *inst);
} }
this->BotAddEquipItem(lootSlot, id); BotAddEquipItem(lootSlot, id);
} }
bool Bot::RemoveBotFromGroup(Bot* bot, Group* group) { bool Bot::RemoveBotFromGroup(Bot* bot, Group* group) {
@ -4216,7 +4216,7 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli
int16 toBotSlot; int16 toBotSlot;
int adjustStackSize; int adjustStackSize;
std::string acceptedItemName; std::string acceptedItemName;
ClientTrade(const ItemInstance* item, int16 from, const char* name = "") : tradeItemInstance(item), fromClientSlot(from), toBotSlot(invslot::SLOT_INVALID), adjustStackSize(0), acceptedItemName(name) { } ClientTrade(const ItemInstance* item, int16 from, const char* name = "") : tradeItemInstance(item), fromClientSlot(from), toBotSlot(invslot::SLOT_INVALID), adjustStackSize(0), acceptedItemName(name) { }
}; };
@ -4226,7 +4226,7 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli
int16 toClientSlot; int16 toClientSlot;
int adjustStackSize; int adjustStackSize;
std::string failedItemName; std::string failedItemName;
ClientReturn(const ItemInstance* item, int16 from, const char* name = "") : returnItemInstance(item), fromBotSlot(from), toClientSlot(invslot::SLOT_INVALID), adjustStackSize(0), failedItemName(name) { } ClientReturn(const ItemInstance* item, int16 from, const char* name = "") : returnItemInstance(item), fromBotSlot(from), toClientSlot(invslot::SLOT_INVALID), adjustStackSize(0), failedItemName(name) { }
}; };
@ -4240,7 +4240,7 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli
}; };
enum { stageStackable = 0, stageEmpty, stageReplaceable }; enum { stageStackable = 0, stageEmpty, stageReplaceable };
if (!client) { if (!client) {
Emote("NO CLIENT"); Emote("NO CLIENT");
return; return;
@ -4331,7 +4331,7 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli
continue; continue;
if (!check_iterator.tradeItemInstance->GetItem()->LoreFlag) if (!check_iterator.tradeItemInstance->GetItem()->LoreFlag)
continue; continue;
if ((trade_iterator.tradeItemInstance->GetItem()->LoreGroup == -1) && (check_iterator.tradeItemInstance->GetItem()->ID == trade_iterator.tradeItemInstance->GetItem()->ID)) { if ((trade_iterator.tradeItemInstance->GetItem()->LoreGroup == -1) && (check_iterator.tradeItemInstance->GetItem()->ID == trade_iterator.tradeItemInstance->GetItem()->ID)) {
// TODO: add logging // TODO: add logging
client->Message(Chat::Red, "Trade hack detected - Trade Canceled."); client->Message(Chat::Red, "Trade hack detected - Trade Canceled.");
@ -4440,7 +4440,7 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli
} }
++trade_iterator; ++trade_iterator;
} }
// out-going return checks for client // out-going return checks for client
for (auto& return_iterator : client_return) { for (auto& return_iterator : client_return) {
auto return_instance = return_iterator.returnItemInstance; auto return_instance = return_iterator.returnItemInstance;
@ -4557,7 +4557,7 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli
client->Message(Chat::Red, "%s (slot: %i, name: '%s')", BotDatabase::fail::SaveItemBySlot(), trade_iterator.toBotSlot, (trade_iterator.tradeItemInstance ? trade_iterator.tradeItemInstance->GetItem()->Name : "nullptr")); client->Message(Chat::Red, "%s (slot: %i, name: '%s')", BotDatabase::fail::SaveItemBySlot(), trade_iterator.toBotSlot, (trade_iterator.tradeItemInstance ? trade_iterator.tradeItemInstance->GetItem()->Name : "nullptr"));
m_inv.PutItem(trade_iterator.toBotSlot, *trade_iterator.tradeItemInstance); m_inv.PutItem(trade_iterator.toBotSlot, *trade_iterator.tradeItemInstance);
this->BotAddEquipItem(trade_iterator.toBotSlot, (trade_iterator.tradeItemInstance ? trade_iterator.tradeItemInstance->GetID() : 0)); BotAddEquipItem(trade_iterator.toBotSlot, (trade_iterator.tradeItemInstance ? trade_iterator.tradeItemInstance->GetID() : 0));
trade_iterator.tradeItemInstance = nullptr; // actual deletion occurs in client delete below trade_iterator.tradeItemInstance = nullptr; // actual deletion occurs in client delete below
client->DeleteItemInInventory(trade_iterator.fromClientSlot, 0, (trade_iterator.fromClientSlot == EQ::invslot::slotCursor)); client->DeleteItemInInventory(trade_iterator.fromClientSlot, 0, (trade_iterator.fromClientSlot == EQ::invslot::slotCursor));
@ -4609,7 +4609,7 @@ bool Bot::Death(Mob *killerMob, int32 damage, uint16 spell_id, EQ::skills::Skill
if(give_exp && give_exp->IsClient()) if(give_exp && give_exp->IsClient())
give_exp_client = give_exp->CastToClient(); give_exp_client = give_exp->CastToClient();
bool IsLdonTreasure = (this->GetClass() == LDON_TREASURE); bool IsLdonTreasure = (GetClass() == LDON_TREASURE);
if(entity_list.GetCorpseByID(GetID())) if(entity_list.GetCorpseByID(GetID()))
entity_list.GetCorpseByID(GetID())->Depop(); entity_list.GetCorpseByID(GetID())->Depop();
@ -4674,7 +4674,7 @@ bool Bot::Death(Mob *killerMob, int32 damage, uint16 spell_id, EQ::skills::Skill
my_owner->CastToClient()->SetBotPulling(false); my_owner->CastToClient()->SetBotPulling(false);
} }
entity_list.RemoveBot(this->GetID()); entity_list.RemoveBot(GetID());
return true; return true;
} }
@ -4725,7 +4725,7 @@ void Bot::AddToHateList(Mob* other, uint32 hate, int32 damage, bool iYellForHelp
Mob::AddToHateList(other, hate, damage, iYellForHelp, bFrenzy, iBuffTic, pet_command); Mob::AddToHateList(other, hate, damage, iYellForHelp, bFrenzy, iBuffTic, pet_command);
} }
bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, bool IsFromSpell, ExtraAttackOptions *opts) { bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, bool IsFromSpell, ExtraAttackOptions *opts) {
if (!other) { if (!other) {
SetTarget(nullptr); SetTarget(nullptr);
LogError("A null Mob object was passed to Bot::Attack for evaluation!"); LogError("A null Mob object was passed to Bot::Attack for evaluation!");
@ -4745,11 +4745,11 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b
SetTarget(other); SetTarget(other);
// takes more to compare a call result, load for a call, load a compare to address and compare, and finally // takes more to compare a call result, load for a call, load a compare to address and compare, and finally
// push a value to an address than to just load for a call and push a value to an address. // push a value to an address than to just load for a call and push a value to an address.
LogCombat("Attacking [{}] with hand [{}] [{}]", other->GetCleanName(), Hand, (FromRiposte ? "(this is a riposte)" : "")); LogCombat("Attacking [{}] with hand [{}] [{}]", other->GetCleanName(), Hand, (FromRiposte ? "(this is a riposte)" : ""));
if ((IsCasting() && (GetClass() != BARD) && !IsFromSpell) || (!IsAttackAllowed(other))) { if ((IsCasting() && (GetClass() != BARD) && !IsFromSpell) || (!IsAttackAllowed(other))) {
if(this->GetOwnerID()) if(GetOwnerID())
entity_list.MessageClose(this, 1, 200, 10, "%s says, '%s is not a legal target master.'", this->GetCleanName(), this->GetTarget()->GetCleanName()); entity_list.MessageClose(this, 1, 200, 10, "%s says, '%s is not a legal target master.'", GetCleanName(), GetTarget()->GetCleanName());
if(other) { if(other) {
RemoveFromHateList(other); RemoveFromHateList(other);
@ -6100,7 +6100,7 @@ void Bot::DoClassAttacks(Mob *target, bool IsRiposte) {
} }
if(ka_time){ if(ka_time){
switch(GetClass()){ switch(GetClass()){
case SHADOWKNIGHT: { case SHADOWKNIGHT: {
CastSpell(SPELL_NPC_HARM_TOUCH, target->GetID()); CastSpell(SPELL_NPC_HARM_TOUCH, target->GetID());
@ -6137,7 +6137,7 @@ void Bot::DoClassAttacks(Mob *target, bool IsRiposte) {
switch (GetClass()) { switch (GetClass()) {
case MONK: { case MONK: {
int reuse = (MonkSpecialAttack(target, EQ::skills::SkillTigerClaw) - 1); int reuse = (MonkSpecialAttack(target, EQ::skills::SkillTigerClaw) - 1);
// Live AA - Technique of Master Wu // Live AA - Technique of Master Wu
int wuchance = itembonuses.DoubleSpecialAttack + spellbonuses.DoubleSpecialAttack + aabonuses.DoubleSpecialAttack; int wuchance = itembonuses.DoubleSpecialAttack + spellbonuses.DoubleSpecialAttack + aabonuses.DoubleSpecialAttack;
@ -6300,7 +6300,7 @@ void Bot::DoClassAttacks(Mob *target, bool IsRiposte) {
skill_to_use == EQ::skills::SkillRoundKick skill_to_use == EQ::skills::SkillRoundKick
) { ) {
reuse = (MonkSpecialAttack(target, skill_to_use) - 1); reuse = (MonkSpecialAttack(target, skill_to_use) - 1);
// Live AA - Technique of Master Wu // Live AA - Technique of Master Wu
int wuchance = itembonuses.DoubleSpecialAttack + spellbonuses.DoubleSpecialAttack + aabonuses.DoubleSpecialAttack; int wuchance = itembonuses.DoubleSpecialAttack + spellbonuses.DoubleSpecialAttack + aabonuses.DoubleSpecialAttack;
@ -6390,7 +6390,7 @@ FACTION_VALUE Bot::GetReverseFactionCon(Mob* iOther) {
Mob* Bot::GetOwnerOrSelf() { Mob* Bot::GetOwnerOrSelf() {
Mob* Result = nullptr; Mob* Result = nullptr;
if(this->GetBotOwner()) if(GetBotOwner())
Result = GetBotOwner(); Result = GetBotOwner();
else else
Result = this; Result = this;
@ -6402,7 +6402,7 @@ Mob* Bot::GetOwner() {
Mob* Result = nullptr; Mob* Result = nullptr;
Result = GetBotOwner(); Result = GetBotOwner();
if(!Result) if(!Result)
this->SetBotOwner(0); SetBotOwner(0);
return Result; return Result;
} }
@ -6506,7 +6506,7 @@ void Bot::ProcessGuildInvite(Client* guildOfficer, Bot* botToGuild) {
guildOfficer->Message(Chat::Red, "%s for '%s'", BotDatabase::fail::SaveGuildMembership(), botToGuild->GetCleanName()); guildOfficer->Message(Chat::Red, "%s for '%s'", BotDatabase::fail::SaveGuildMembership(), botToGuild->GetCleanName());
return; return;
} }
ServerPacket* pack = new ServerPacket(ServerOP_GuildCharRefresh, sizeof(ServerGuildCharRefresh_Struct)); ServerPacket* pack = new ServerPacket(ServerOP_GuildCharRefresh, sizeof(ServerGuildCharRefresh_Struct));
ServerGuildCharRefresh_Struct *s = (ServerGuildCharRefresh_Struct *) pack->pBuffer; ServerGuildCharRefresh_Struct *s = (ServerGuildCharRefresh_Struct *) pack->pBuffer;
s->guild_id = guildOfficer->GuildID(); s->guild_id = guildOfficer->GuildID();
@ -6931,8 +6931,8 @@ int32 Bot::GetActSpellCasttime(uint16 spell_id, int32 casttime) {
} }
int32 Bot::GetActSpellCost(uint16 spell_id, int32 cost) { int32 Bot::GetActSpellCost(uint16 spell_id, int32 cost) {
if(this->itembonuses.Clairvoyance && spells[spell_id].classes[(GetClass()%17) - 1] >= GetLevel() - 5) { if(itembonuses.Clairvoyance && spells[spell_id].classes[(GetClass()%17) - 1] >= GetLevel() - 5) {
int32 mana_back = (this->itembonuses.Clairvoyance * zone->random.Int(1, 100) / 100); int32 mana_back = (itembonuses.Clairvoyance * zone->random.Int(1, 100) / 100);
if(mana_back > cost) if(mana_back > cost)
mana_back = cost; mana_back = cost;
@ -7143,7 +7143,7 @@ bool Bot::CastSpell(uint16 spell_id, uint16 target_id, EQ::spells::CastingSlot s
} }
Result = Mob::CastSpell(spell_id, target_id, slot, cast_time, mana_cost, oSpellWillFinish, item_slot, 0xFFFFFFFF, 0, resist_adjust, aa_id); Result = Mob::CastSpell(spell_id, target_id, slot, cast_time, mana_cost, oSpellWillFinish, item_slot, 0xFFFFFFFF, 0, resist_adjust, aa_id);
} }
return Result; return Result;
} }
@ -8164,7 +8164,7 @@ void Bot::UpdateGroupCastingRoles(const Group* group, bool disband)
{ {
if (!group) if (!group)
return; return;
for (auto iter : group->members) { for (auto iter : group->members) {
if (!iter) if (!iter)
continue; continue;
@ -8201,7 +8201,7 @@ void Bot::UpdateGroupCastingRoles(const Group* group, bool disband)
default: default:
healer = iter; healer = iter;
} }
break; break;
case DRUID: case DRUID:
if (!healer) if (!healer)
@ -8854,14 +8854,14 @@ void Bot::CalcBotStats(bool showtext) {
GetSkill(EQ::skills::SkillBrassInstruments), GetSkill(EQ::skills::SkillPercussionInstruments), GetSkill(EQ::skills::SkillSinging), GetSkill(EQ::skills::SkillStringedInstruments), GetSkill(EQ::skills::SkillWindInstruments)); GetSkill(EQ::skills::SkillBrassInstruments), GetSkill(EQ::skills::SkillPercussionInstruments), GetSkill(EQ::skills::SkillSinging), GetSkill(EQ::skills::SkillStringedInstruments), GetSkill(EQ::skills::SkillWindInstruments));
} }
//if(this->Save()) //if(Save())
// this->GetBotOwner()->CastToClient()->Message(Chat::White, "%s saved.", this->GetCleanName()); // GetBotOwner()->CastToClient()->Message(Chat::White, "%s saved.", GetCleanName());
//else //else
// this->GetBotOwner()->CastToClient()->Message(Chat::Red, "%s save failed!", this->GetCleanName()); // GetBotOwner()->CastToClient()->Message(Chat::Red, "%s save failed!", GetCleanName());
CalcBonuses(); CalcBonuses();
AI_AddNPCSpells(this->GetBotSpellID()); AI_AddNPCSpells(GetBotSpellID());
if(showtext) { if(showtext) {
GetBotOwner()->Message(Chat::Yellow, "%s has been updated.", GetCleanName()); GetBotOwner()->Message(Chat::Yellow, "%s has been updated.", GetCleanName());
@ -9331,8 +9331,8 @@ void EntityList::ScanCloseClientMobs(std::unordered_map<uint16, Mob*>& close_mob
uint8 Bot::GetNumberNeedingHealedInGroup(uint8 hpr, bool includePets) { uint8 Bot::GetNumberNeedingHealedInGroup(uint8 hpr, bool includePets) {
uint8 needHealed = 0; uint8 needHealed = 0;
Group *g = nullptr; Group *g = nullptr;
if(this->HasGroup()) { if(HasGroup()) {
g = this->GetGroup(); g = GetGroup();
if(g) { if(g) {
for(int i = 0; i < MAX_GROUP_MEMBERS; i++) { for(int i = 0; i < MAX_GROUP_MEMBERS; i++) {
if(g->members[i] && !g->members[i]->qglobal) { if(g->members[i] && !g->members[i]->qglobal) {
@ -9497,7 +9497,7 @@ bool Bot::GetNeedsHateRedux(Mob *tar) {
// TODO: Still awaiting bot spell rework.. // TODO: Still awaiting bot spell rework..
if (!tar || !tar->IsEngaged() || !tar->HasTargetReflection() || !tar->GetTarget()->IsNPC()) if (!tar || !tar->IsEngaged() || !tar->HasTargetReflection() || !tar->GetTarget()->IsNPC())
return false; return false;
//if (tar->IsClient()) { //if (tar->IsClient()) {
// switch (tar->GetClass()) { // switch (tar->GetClass()) {
// // TODO: figure out affectable classes.. // // TODO: figure out affectable classes..
@ -9590,7 +9590,7 @@ bool Bot::UseDiscipline(uint32 spell_id, uint32 target) {
if(spells[spell_id].timer_id > 0 && spells[spell_id].timer_id < MAX_DISCIPLINE_TIMERS) if(spells[spell_id].timer_id > 0 && spells[spell_id].timer_id < MAX_DISCIPLINE_TIMERS)
SetDisciplineRecastTimer(spells[spell_id].timer_id, spell.recast_time); SetDisciplineRecastTimer(spells[spell_id].timer_id, spell.recast_time);
} else { } else {
uint32 remaining_time = (GetDisciplineRemainingTime(this, spells[spell_id].timer_id) / 1000); uint32 remaining_time = (GetDisciplineRemainingTime(this, spells[spell_id].timer_id) / 1000);
GetOwner()->Message( GetOwner()->Message(
Chat::White, Chat::White,
fmt::format( fmt::format(
@ -9617,7 +9617,7 @@ bool Bot::CreateHealRotation(uint32 interval_ms, bool fast_heals, bool adaptive_
return false; return false;
if (!IsHealRotationMemberClass(GetClass())) if (!IsHealRotationMemberClass(GetClass()))
return false; return false;
m_member_of_heal_rotation = std::make_shared<HealRotation>(this, interval_ms, fast_heals, adaptive_targeting, casting_override); m_member_of_heal_rotation = std::make_shared<HealRotation>(this, interval_ms, fast_heals, adaptive_targeting, casting_override);
return IsHealRotationMember(); return IsHealRotationMember();
@ -9670,7 +9670,7 @@ bool Bot::UseHealRotationFastHeals()
{ {
if (!IsHealRotationMember()) if (!IsHealRotationMember())
return false; return false;
return m_member_of_heal_rotation->FastHeals(); return m_member_of_heal_rotation->FastHeals();
} }

View File

@ -192,7 +192,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint32 iSpellTypes) {
else { else {
float hpRatioToCast = 0.0f; float hpRatioToCast = 0.0f;
switch(this->GetBotStance()) { switch(GetBotStance()) {
case EQ::constants::stanceEfficient: case EQ::constants::stanceEfficient:
case EQ::constants::stanceAggressive: case EQ::constants::stanceAggressive:
hpRatioToCast = isPrimaryHealer?90.0f:50.0f; hpRatioToCast = isPrimaryHealer?90.0f:50.0f;
@ -258,8 +258,8 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint32 iSpellTypes) {
}*/ }*/
if(botClass != BARD) { if(botClass != BARD) {
if(IsGroupSpell(botSpell.SpellId)){ if(IsGroupSpell(botSpell.SpellId)){
if(this->HasGroup()) { if(HasGroup()) {
Group *g = this->GetGroup(); Group *g = GetGroup();
if(g) { if(g) {
BotGroupSay(this, "Casting %s.", spells[botSpell.SpellId].name); BotGroupSay(this, "Casting %s.", spells[botSpell.SpellId].name);
@ -331,7 +331,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint32 iSpellTypes) {
continue; continue;
// can not cast buffs for your own pet only on another pet that isn't yours // can not cast buffs for your own pet only on another pet that isn't yours
if((spells[selectedBotSpell.SpellId].target_type == ST_Pet) && (tar != this->GetPet())) if((spells[selectedBotSpell.SpellId].target_type == ST_Pet) && (tar != GetPet()))
continue; continue;
// Validate target // Validate target
@ -380,7 +380,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint32 iSpellTypes) {
{ {
float manaRatioToCast = 75.0f; float manaRatioToCast = 75.0f;
switch(this->GetBotStance()) { switch(GetBotStance()) {
case EQ::constants::stanceEfficient: case EQ::constants::stanceEfficient:
manaRatioToCast = 90.0f; manaRatioToCast = 90.0f;
break; break;
@ -399,7 +399,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint32 iSpellTypes) {
} }
//If we're at specified mana % or below, don't rune as enchanter //If we're at specified mana % or below, don't rune as enchanter
if(this->GetManaRatio() <= manaRatioToCast) if(GetManaRatio() <= manaRatioToCast)
break; break;
} }
@ -459,7 +459,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint32 iSpellTypes) {
{ {
float manaRatioToCast = 75.0f; float manaRatioToCast = 75.0f;
switch(this->GetBotStance()) { switch(GetBotStance()) {
case EQ::constants::stanceEfficient: case EQ::constants::stanceEfficient:
manaRatioToCast = 90.0f; manaRatioToCast = 90.0f;
break; break;
@ -480,7 +480,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint32 iSpellTypes) {
} }
//If we're at specified mana % or below, don't nuke as cleric or enchanter //If we're at specified mana % or below, don't nuke as cleric or enchanter
if(this->GetManaRatio() <= manaRatioToCast) if(GetManaRatio() <= manaRatioToCast)
break; break;
} }
@ -622,7 +622,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint32 iSpellTypes) {
break; break;
} }
} }
else if(botClass == BARD) { else if(botClass == BARD) {
if (tar->DontBuffMeBefore() < Timer::GetCurrentTime()) { if (tar->DontBuffMeBefore() < Timer::GetCurrentTime()) {
std::list<BotSpell> inCombatBuffList = GetBotSpellsBySpellType(this, SpellType_InCombatBuff); std::list<BotSpell> inCombatBuffList = GetBotSpellsBySpellType(this, SpellType_InCombatBuff);
@ -644,7 +644,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint32 iSpellTypes) {
continue; continue;
// can not cast buffs for your own pet only on another pet that isn't yours // can not cast buffs for your own pet only on another pet that isn't yours
if((spells[selectedBotSpell.SpellId].target_type == ST_Pet) && (tar != this->GetPet())) if((spells[selectedBotSpell.SpellId].target_type == ST_Pet) && (tar != GetPet()))
continue; continue;
// Validate target // Validate target
@ -929,8 +929,8 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint32 iSpellTypes) {
if(IsGroupSpell(botSpell.SpellId)){ if(IsGroupSpell(botSpell.SpellId)){
Group *g; Group *g;
if(this->HasGroup()) { if(HasGroup()) {
Group *g = this->GetGroup(); Group *g = GetGroup();
if(g) { if(g) {
for( int i = 0; i<MAX_GROUP_MEMBERS; i++) { for( int i = 0; i<MAX_GROUP_MEMBERS; i++) {
@ -1162,7 +1162,7 @@ bool Bot::AI_IdleCastCheck() {
if (AIautocastspell_timer->Check(false)) { if (AIautocastspell_timer->Check(false)) {
#if BotAI_DEBUG_Spells >= 25 #if BotAI_DEBUG_Spells >= 25
LogAI("Bot Non-Engaged autocast check triggered: [{}]", this->GetCleanName()); LogAI("Bot Non-Engaged autocast check triggered: [{}]", GetCleanName());
#endif #endif
AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting. AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting.
@ -1265,7 +1265,7 @@ bool Bot::AI_IdleCastCheck() {
} }
} }
} }
result = true; result = true;
break; break;
} }

View File

@ -390,16 +390,16 @@ Client::~Client() {
if(IsInAGuild()) if(IsInAGuild())
guild_mgr.SendGuildMemberUpdateToWorld(GetName(), GuildID(), 0, time(nullptr)); guild_mgr.SendGuildMemberUpdateToWorld(GetName(), GuildID(), 0, time(nullptr));
Mob* horse = entity_list.GetMob(this->CastToClient()->GetHorseId()); Mob* horse = entity_list.GetMob(CastToClient()->GetHorseId());
if (horse) if (horse)
horse->Depop(); horse->Depop();
Mob* merc = entity_list.GetMob(this->GetMercID()); Mob* merc = entity_list.GetMob(GetMercID());
if (merc) if (merc)
merc->Depop(); merc->Depop();
if(Trader) if(Trader)
database.DeleteTraderItem(this->CharacterID()); database.DeleteTraderItem(CharacterID());
if(Buyer) if(Buyer)
ToggleBuyerMode(false); ToggleBuyerMode(false);
@ -708,7 +708,7 @@ bool Client::Save(uint8 iCommitNow) {
p_timers.Store(&database); p_timers.Store(&database);
database.SaveCharacterTribute(this->CharacterID(), &m_pp); database.SaveCharacterTribute(CharacterID(), &m_pp);
SaveTaskState(); /* Save Character Task */ SaveTaskState(); /* Save Character Task */
LogFood("Client::Save - hunger_level: [{}] thirst_level: [{}]", m_pp.hunger_level, m_pp.thirst_level); LogFood("Client::Save - hunger_level: [{}] thirst_level: [{}]", m_pp.hunger_level, m_pp.thirst_level);
@ -723,7 +723,7 @@ bool Client::Save(uint8 iCommitNow) {
} }
} }
database.SaveCharacterData(this->CharacterID(), this->AccountID(), &m_pp, &m_epp); /* Save Character Data */ database.SaveCharacterData(CharacterID(), AccountID(), &m_pp, &m_epp); /* Save Character Data */
return true; return true;
} }
@ -895,7 +895,7 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s
sem->guilddbid = 0; sem->guilddbid = 0;
strcpy(sem->message, message); strcpy(sem->message, message);
sem->minstatus = this->Admin(); sem->minstatus = Admin();
sem->type = chan_num; sem->type = chan_num;
if(targetname != 0) if(targetname != 0)
strcpy(sem->to, targetname); strcpy(sem->to, targetname);
@ -1234,7 +1234,7 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s
} }
void Client::ChannelMessageSend(const char* from, const char* to, uint8 chan_num, uint8 language, uint8 lang_skill, const char* message, ...) { void Client::ChannelMessageSend(const char* from, const char* to, uint8 chan_num, uint8 language, uint8 lang_skill, const char* message, ...) {
if ((chan_num==11 && !(this->GetGM())) || (chan_num==10 && this->Admin() < AccountStatus::QuestTroupe)) // dont need to send /pr & /petition to everybody if ((chan_num==11 && !(GetGM())) || (chan_num==10 && Admin() < AccountStatus::QuestTroupe)) // dont need to send /pr & /petition to everybody
return; return;
va_list argptr; va_list argptr;
char buffer[4096]; char buffer[4096];
@ -1289,7 +1289,7 @@ void Client::ChannelMessageSend(const char* from, const char* to, uint8 chan_num
QueuePacket(&app); QueuePacket(&app);
bool senderCanTrainSelf = RuleB(Client, SelfLanguageLearning); bool senderCanTrainSelf = RuleB(Client, SelfLanguageLearning);
bool weAreNotSender = strcmp(this->GetCleanName(), cm->sender); bool weAreNotSender = strcmp(GetCleanName(), cm->sender);
if (senderCanTrainSelf || weAreNotSender) { if (senderCanTrainSelf || weAreNotSender) {
if ((chan_num == ChatChannel_Group) && (ListenerSkill < 100)) { // group message in unmastered language, check for skill up if ((chan_num == ChatChannel_Group) && (ListenerSkill < 100)) { // group message in unmastered language, check for skill up
@ -1499,7 +1499,7 @@ void Client::SetSkill(EQ::skills::SkillType skillid, uint16 value) {
return; return;
m_pp.skills[skillid] = value; // We need to be able to #setskill 254 and 255 to reset skills m_pp.skills[skillid] = value; // We need to be able to #setskill 254 and 255 to reset skills
database.SaveCharacterSkill(this->CharacterID(), skillid, value); database.SaveCharacterSkill(CharacterID(), skillid, value);
auto outapp = new EQApplicationPacket(OP_SkillUpdate, sizeof(SkillUpdate_Struct)); auto outapp = new EQApplicationPacket(OP_SkillUpdate, sizeof(SkillUpdate_Struct));
SkillUpdate_Struct* skill = (SkillUpdate_Struct*)outapp->pBuffer; SkillUpdate_Struct* skill = (SkillUpdate_Struct*)outapp->pBuffer;
skill->skillId=skillid; skill->skillId=skillid;
@ -1518,7 +1518,7 @@ void Client::IncreaseLanguageSkill(int skill_id, int value) {
if (m_pp.languages[skill_id] > 100) //Lang skill above max if (m_pp.languages[skill_id] > 100) //Lang skill above max
m_pp.languages[skill_id] = 100; m_pp.languages[skill_id] = 100;
database.SaveCharacterLanguage(this->CharacterID(), skill_id, m_pp.languages[skill_id]); database.SaveCharacterLanguage(CharacterID(), skill_id, m_pp.languages[skill_id]);
auto outapp = new EQApplicationPacket(OP_SkillUpdate, sizeof(SkillUpdate_Struct)); auto outapp = new EQApplicationPacket(OP_SkillUpdate, sizeof(SkillUpdate_Struct));
SkillUpdate_Struct* skill = (SkillUpdate_Struct*)outapp->pBuffer; SkillUpdate_Struct* skill = (SkillUpdate_Struct*)outapp->pBuffer;
@ -1574,22 +1574,22 @@ void Client::UpdateWho(uint8 remove)
auto pack = new ServerPacket(ServerOP_ClientList, sizeof(ServerClientList_Struct)); auto pack = new ServerPacket(ServerOP_ClientList, sizeof(ServerClientList_Struct));
auto *s = (ServerClientList_Struct *) pack->pBuffer; auto *s = (ServerClientList_Struct *) pack->pBuffer;
s->remove = remove; s->remove = remove;
s->wid = this->GetWID(); s->wid = GetWID();
s->IP = this->GetIP(); s->IP = GetIP();
s->charid = this->CharacterID(); s->charid = CharacterID();
strcpy(s->name, this->GetName()); strcpy(s->name, GetName());
s->gm = GetGM(); s->gm = GetGM();
s->Admin = this->Admin(); s->Admin = Admin();
s->AccountID = this->AccountID(); s->AccountID = AccountID();
strcpy(s->AccountName, this->AccountName()); strcpy(s->AccountName, AccountName());
s->LSAccountID = this->LSAccountID(); s->LSAccountID = LSAccountID();
strn0cpy(s->lskey, lskey, sizeof(s->lskey)); strn0cpy(s->lskey, lskey, sizeof(s->lskey));
s->zone = zone->GetZoneID(); s->zone = zone->GetZoneID();
s->instance_id = zone->GetInstanceID(); s->instance_id = zone->GetInstanceID();
s->race = this->GetRace(); s->race = GetRace();
s->class_ = GetClass(); s->class_ = GetClass();
s->level = GetLevel(); s->level = GetLevel();
@ -1625,9 +1625,9 @@ void Client::WhoAll(Who_All_Struct* whom) {
else { else {
auto pack = new ServerPacket(ServerOP_Who, sizeof(ServerWhoAll_Struct)); auto pack = new ServerPacket(ServerOP_Who, sizeof(ServerWhoAll_Struct));
ServerWhoAll_Struct* whoall = (ServerWhoAll_Struct*) pack->pBuffer; ServerWhoAll_Struct* whoall = (ServerWhoAll_Struct*) pack->pBuffer;
whoall->admin = this->Admin(); whoall->admin = Admin();
whoall->fromid=this->GetID(); whoall->fromid=GetID();
strcpy(whoall->from, this->GetName()); strcpy(whoall->from, GetName());
strn0cpy(whoall->whom, whom->whom, 64); strn0cpy(whoall->whom, whom->whom, 64);
whoall->lvllow = whom->lvllow; whoall->lvllow = whom->lvllow;
whoall->lvlhigh = whom->lvlhigh; whoall->lvlhigh = whom->lvlhigh;
@ -1647,7 +1647,7 @@ void Client::FriendsWho(char *FriendsString) {
auto pack = auto pack =
new ServerPacket(ServerOP_FriendsWho, sizeof(ServerFriendsWho_Struct) + strlen(FriendsString)); new ServerPacket(ServerOP_FriendsWho, sizeof(ServerFriendsWho_Struct) + strlen(FriendsString));
ServerFriendsWho_Struct* FriendsWho = (ServerFriendsWho_Struct*) pack->pBuffer; ServerFriendsWho_Struct* FriendsWho = (ServerFriendsWho_Struct*) pack->pBuffer;
FriendsWho->FromID = this->GetID(); FriendsWho->FromID = GetID();
strcpy(FriendsWho->FromName, GetName()); strcpy(FriendsWho->FromName, GetName());
strcpy(FriendsWho->FriendsString, FriendsString); strcpy(FriendsWho->FriendsString, FriendsString);
worldserver.SendPacket(pack); worldserver.SendPacket(pack);
@ -1878,9 +1878,9 @@ void Client::CheckManaEndUpdate() {
safe_delete(outapp); safe_delete(outapp);
/* Let others know when our mana percent has changed */ /* Let others know when our mana percent has changed */
if (this->GetManaPercent() != last_reported_mana_percent) { if (GetManaPercent() != last_reported_mana_percent) {
Group *group = this->GetGroup(); Group *group = GetGroup();
Raid *raid = this->GetRaid(); Raid *raid = GetRaid();
if (raid) { if (raid) {
raid->SendManaPacketFrom(this); raid->SendManaPacketFrom(this);
@ -1899,13 +1899,13 @@ void Client::CheckManaEndUpdate() {
entity_list.QueueClientsByXTarget(this, mana_packet, false, EQ::versions::ClientVersionBitmask::maskSoDAndLater); entity_list.QueueClientsByXTarget(this, mana_packet, false, EQ::versions::ClientVersionBitmask::maskSoDAndLater);
safe_delete(mana_packet); safe_delete(mana_packet);
last_reported_mana_percent = this->GetManaPercent(); last_reported_mana_percent = GetManaPercent();
} }
/* Let others know when our endurance percent has changed */ /* Let others know when our endurance percent has changed */
if (this->GetEndurancePercent() != last_reported_endurance_percent) { if (GetEndurancePercent() != last_reported_endurance_percent) {
Group *group = this->GetGroup(); Group *group = GetGroup();
Raid *raid = this->GetRaid(); Raid *raid = GetRaid();
if (raid) { if (raid) {
raid->SendEndurancePacketFrom(this); raid->SendEndurancePacketFrom(this);
@ -1924,7 +1924,7 @@ void Client::CheckManaEndUpdate() {
entity_list.QueueClientsByXTarget(this, endurance_packet, false, EQ::versions::ClientVersionBitmask::maskSoDAndLater); entity_list.QueueClientsByXTarget(this, endurance_packet, false, EQ::versions::ClientVersionBitmask::maskSoDAndLater);
safe_delete(endurance_packet); safe_delete(endurance_packet);
last_reported_endurance_percent = this->GetEndurancePercent(); last_reported_endurance_percent = GetEndurancePercent();
} }
last_reported_mana = current_mana; last_reported_mana = current_mana;
@ -2350,7 +2350,7 @@ void Client::EVENT_ITEM_ScriptStopReturn(){
char buffer[50]; char buffer[50];
gettimeofday(&read_time, 0); gettimeofday(&read_time, 0);
sprintf(buffer, "%li.%li \n", read_time.tv_sec, read_time.tv_usec); sprintf(buffer, "%li.%li \n", read_time.tv_sec, read_time.tv_usec);
this->SetEntityVariable("Stop_Return", buffer); SetEntityVariable("Stop_Return", buffer);
} }
void Client::AddMoneyToPP(uint32 copper, uint32 silver, uint32 gold, uint32 platinum, bool update_client){ void Client::AddMoneyToPP(uint32 copper, uint32 silver, uint32 gold, uint32 platinum, bool update_client){
@ -2461,7 +2461,7 @@ bool Client::CheckIncreaseSkill(EQ::skills::SkillType skillid, Mob *against_who,
return false; return false;
if (skillid > EQ::skills::HIGHEST_SKILL) if (skillid > EQ::skills::HIGHEST_SKILL)
return false; return false;
int skillval = GetRawSkill(skillid); int skillval = GetRawSkill(skillid);
int maxskill = GetMaxSkillAfterSpecializationRules(skillid, MaxSkill(skillid)); int maxskill = GetMaxSkillAfterSpecializationRules(skillid, MaxSkill(skillid));
std::string export_string = fmt::format( std::string export_string = fmt::format(
"{} {}", "{} {}",
@ -2486,7 +2486,7 @@ bool Client::CheckIncreaseSkill(EQ::skills::SkillType skillid, Mob *against_who,
// Make sure we're not already at skill cap // Make sure we're not already at skill cap
if (skillval < maxskill) if (skillval < maxskill)
{ {
double Chance = 0; double Chance = 0;
if (RuleI(Character, SkillUpMaximumChancePercentage) + chancemodi - RuleI(Character, SkillUpMinimumChancePercentage) <= RuleI(Character, SkillUpMinimumChancePercentage)) { if (RuleI(Character, SkillUpMaximumChancePercentage) + chancemodi - RuleI(Character, SkillUpMinimumChancePercentage) <= RuleI(Character, SkillUpMinimumChancePercentage)) {
Chance = RuleI(Character, SkillUpMinimumChancePercentage); Chance = RuleI(Character, SkillUpMinimumChancePercentage);
} }
@ -2763,12 +2763,12 @@ void Client::LogMerchant(Client* player, Mob* merchant, uint32 quantity, uint32
void Client::Disarm(Client* disarmer, int chance) { void Client::Disarm(Client* disarmer, int chance) {
int16 slot = EQ::invslot::SLOT_INVALID; int16 slot = EQ::invslot::SLOT_INVALID;
const EQ::ItemInstance *inst = this->GetInv().GetItem(EQ::invslot::slotPrimary); const EQ::ItemInstance *inst = GetInv().GetItem(EQ::invslot::slotPrimary);
if (inst && inst->IsWeapon()) { if (inst && inst->IsWeapon()) {
slot = EQ::invslot::slotPrimary; slot = EQ::invslot::slotPrimary;
} }
else { else {
inst = this->GetInv().GetItem(EQ::invslot::slotSecondary); inst = GetInv().GetItem(EQ::invslot::slotSecondary);
if (inst && inst->IsWeapon()) if (inst && inst->IsWeapon())
slot = EQ::invslot::slotSecondary; slot = EQ::invslot::slotSecondary;
} }
@ -2792,14 +2792,14 @@ void Client::Disarm(Client* disarmer, int chance) {
mi->number_in_stack = 0; mi->number_in_stack = 0;
FastQueuePacket(&outapp); // this deletes item from the weapon slot on the client FastQueuePacket(&outapp); // this deletes item from the weapon slot on the client
if (PutItemInInventory(slot_id, *InvItem, true)) if (PutItemInInventory(slot_id, *InvItem, true))
database.SaveInventory(this->CharacterID(), NULL, slot); database.SaveInventory(CharacterID(), NULL, slot);
auto matslot = (slot == EQ::invslot::slotPrimary ? EQ::textures::weaponPrimary : EQ::textures::weaponSecondary); auto matslot = (slot == EQ::invslot::slotPrimary ? EQ::textures::weaponPrimary : EQ::textures::weaponSecondary);
if (matslot != EQ::textures::materialInvalid) if (matslot != EQ::textures::materialInvalid)
SendWearChange(matslot); SendWearChange(matslot);
} }
MessageString(Chat::Skills, DISARMED); MessageString(Chat::Skills, DISARMED);
if (disarmer != this) if (disarmer != this)
disarmer->MessageString(Chat::Skills, DISARM_SUCCESS, this->GetCleanName()); disarmer->MessageString(Chat::Skills, DISARM_SUCCESS, GetCleanName());
if (chance != 1000) if (chance != 1000)
disarmer->CheckIncreaseSkill(EQ::skills::SkillDisarm, nullptr, 4); disarmer->CheckIncreaseSkill(EQ::skills::SkillDisarm, nullptr, 4);
CalcBonuses(); CalcBonuses();
@ -3362,7 +3362,7 @@ void Client::SetTint(int16 in_slot, uint32 color) {
EQ::textures::Tint_Struct new_color; EQ::textures::Tint_Struct new_color;
new_color.Color = color; new_color.Color = color;
SetTint(in_slot, new_color); SetTint(in_slot, new_color);
database.SaveCharacterMaterialColor(this->CharacterID(), in_slot, color); database.SaveCharacterMaterialColor(CharacterID(), in_slot, color);
} }
// Still need to reconcile bracer01 versus bracer02 // Still need to reconcile bracer01 versus bracer02
@ -3372,7 +3372,7 @@ void Client::SetTint(int16 in_slot, EQ::textures::Tint_Struct& color) {
if (matslot != EQ::textures::materialInvalid) if (matslot != EQ::textures::materialInvalid)
{ {
m_pp.item_tint.Slot[matslot].Color = color.Color; m_pp.item_tint.Slot[matslot].Color = color.Color;
database.SaveCharacterMaterialColor(this->CharacterID(), in_slot, color.Color); database.SaveCharacterMaterialColor(CharacterID(), in_slot, color.Color);
} }
} }
@ -3409,7 +3409,7 @@ void Client::SetLanguageSkill(int langid, int value)
value = 100; //Max lang value value = 100; //Max lang value
m_pp.languages[langid] = value; m_pp.languages[langid] = value;
database.SaveCharacterLanguage(this->CharacterID(), langid, value); database.SaveCharacterLanguage(CharacterID(), langid, value);
auto outapp = new EQApplicationPacket(OP_SkillUpdate, sizeof(SkillUpdate_Struct)); auto outapp = new EQApplicationPacket(OP_SkillUpdate, sizeof(SkillUpdate_Struct));
SkillUpdate_Struct* skill = (SkillUpdate_Struct*)outapp->pBuffer; SkillUpdate_Struct* skill = (SkillUpdate_Struct*)outapp->pBuffer;
@ -4704,7 +4704,7 @@ void Client::ClearGroupAAs() {
m_pp.raid_leadership_exp = 0; m_pp.raid_leadership_exp = 0;
Save(); Save();
database.SaveCharacterLeadershipAA(this->CharacterID(), &m_pp); database.SaveCharacterLeadershipAA(CharacterID(), &m_pp);
} }
void Client::UpdateGroupAAs(int32 points, uint32 type) { void Client::UpdateGroupAAs(int32 points, uint32 type) {
@ -5328,7 +5328,7 @@ void Client::SetStartZone(uint32 zoneid, float x, float y, float z, float headin
// setting city to zero allows the player to use /setstartcity to set the city themselves // setting city to zero allows the player to use /setstartcity to set the city themselves
if(zoneid == 0) { if(zoneid == 0) {
m_pp.binds[4].zone_id = 0; m_pp.binds[4].zone_id = 0;
this->Message(Chat::Yellow,"Your starting city has been reset. Use /setstartcity to choose a new one"); Message(Chat::Yellow,"Your starting city has been reset. Use /setstartcity to choose a new one");
return; return;
} }
@ -5425,10 +5425,10 @@ void Client::ShowSkillsWindow()
// Row End // Row End
popup_text += "</tr>"; popup_text += "</tr>";
} }
// Table End // Table End
popup_text += "</table>"; popup_text += "</table>";
SendPopupToClient( SendPopupToClient(
"Skills", "Skills",
popup_text.c_str() popup_text.c_str()
@ -6335,7 +6335,7 @@ void Client::NPCSpawn(NPC *target_npc, const char *identifier, uint32 extra)
this, this,
target_npc->CastToNPC(), target_npc->CastToNPC(),
extra extra
); );
} else if (is_delete || is_remove || is_update) { } else if (is_delete || is_remove || is_update) {
uint8 spawn_update_type = ( uint8 spawn_update_type = (
is_delete ? is_delete ?
@ -6434,7 +6434,7 @@ void Client::ConsentCorpses(std::string consent_name, bool deny)
void Client::Doppelganger(uint16 spell_id, Mob *target, const char *name_override, int pet_count, int pet_duration) void Client::Doppelganger(uint16 spell_id, Mob *target, const char *name_override, int pet_count, int pet_duration)
{ {
if(!target || !IsValidSpell(spell_id) || this->GetID() == target->GetID()) if(!target || !IsValidSpell(spell_id) || GetID() == target->GetID())
return; return;
PetRecord record; PetRecord record;
@ -7144,8 +7144,8 @@ void Client::AddAlternateCurrencyValue(uint32 currency_id, int32 amount, int8 me
if (method == 1){ if (method == 1){
/* QS: PlayerLogAlternateCurrencyTransactions :: Cursor to Item Storage */ /* QS: PlayerLogAlternateCurrencyTransactions :: Cursor to Item Storage */
if (RuleB(QueryServ, PlayerLogAlternateCurrencyTransactions)){ if (RuleB(QueryServ, PlayerLogAlternateCurrencyTransactions)){
std::string event_desc = StringFormat("Added via Quest :: Cursor to Item :: alt_currency_id:%i amount:%i in zoneid:%i instid:%i", currency_id, this->GetZoneID(), this->GetInstanceID()); std::string event_desc = StringFormat("Added via Quest :: Cursor to Item :: alt_currency_id:%i amount:%i in zoneid:%i instid:%i", currency_id, GetZoneID(), GetInstanceID());
QServ->PlayerLogEvent(Player_Log_Alternate_Currency_Transactions, this->CharacterID(), event_desc); QServ->PlayerLogEvent(Player_Log_Alternate_Currency_Transactions, CharacterID(), event_desc);
} }
} }
@ -7483,7 +7483,7 @@ void Client::ProcessXTargetAutoHaters()
std::queue<int> empty_slots; std::queue<int> empty_slots;
for (int i = 0; i < GetMaxXTargets(); ++i) { for (int i = 0; i < GetMaxXTargets(); ++i) {
if (XTargets[i].Type != Auto) if (XTargets[i].Type != Auto)
continue; continue;
if (XTargets[i].ID != 0 && !GetXTargetAutoMgr()->contains_mob(XTargets[i].ID)) { if (XTargets[i].ID != 0 && !GetXTargetAutoMgr()->contains_mob(XTargets[i].ID)) {
XTargets[i].ID = 0; XTargets[i].ID = 0;
@ -7522,7 +7522,7 @@ void Client::ProcessXTargetAutoHaters()
break; break;
} }
} }
m_dirtyautohaters = false; m_dirtyautohaters = false;
SendXTargetUpdates(); SendXTargetUpdates();
} }
@ -8088,7 +8088,7 @@ void Client::UpdatePersonalFaction(int32 char_id, int32 npc_value, int32 faction
bool repair = false; bool repair = false;
bool change = false; bool change = false;
if (this->itembonuses.HeroicCHA) if (itembonuses.HeroicCHA)
{ {
int faction_mod = itembonuses.HeroicCHA / 5; int faction_mod = itembonuses.HeroicCHA / 5;
// If our result isn't truncated, then just do that // If our result isn't truncated, then just do that
@ -8787,16 +8787,16 @@ void Client::QuestReward(Mob* target, const QuestReward_Struct &reward, bool fac
} }
void Client::SendHPUpdateMarquee(){ void Client::SendHPUpdateMarquee(){
if (!this || !this->IsClient() || !this->current_hp || !this->max_hp) if (!this || !IsClient() || !current_hp || !max_hp)
return; return;
/* Health Update Marquee Display: Custom*/ /* Health Update Marquee Display: Custom*/
uint8 health_percentage = (uint8)(this->current_hp * 100 / this->max_hp); uint8 health_percentage = (uint8)(current_hp * 100 / max_hp);
if (health_percentage >= 100) if (health_percentage >= 100)
return; return;
std::string health_update_notification = StringFormat("Health: %u%%", health_percentage); std::string health_update_notification = StringFormat("Health: %u%%", health_percentage);
this->SendMarqueeMessage(Chat::Yellow, 510, 0, 3000, 3000, health_update_notification); SendMarqueeMessage(Chat::Yellow, 510, 0, 3000, 3000, health_update_notification);
} }
uint32 Client::GetMoney(uint8 type, uint8 subtype) { uint32 Client::GetMoney(uint8 type, uint8 subtype) {
@ -9374,15 +9374,15 @@ bool Client::GotoPlayer(std::string player_name)
auto heading = static_cast<float>(atof(row[5])); auto heading = static_cast<float>(atof(row[5]));
if (instance_id > 0 && !database.CheckInstanceExists(instance_id)) { if (instance_id > 0 && !database.CheckInstanceExists(instance_id)) {
this->Message(Chat::Yellow, "Instance no longer exists..."); Message(Chat::Yellow, "Instance no longer exists...");
return false; return false;
} }
if (instance_id > 0) { if (instance_id > 0) {
database.AddClientToInstance(instance_id, this->CharacterID()); database.AddClientToInstance(instance_id, CharacterID());
} }
this->MovePC(zone_id, instance_id, x, y, z, heading); MovePC(zone_id, instance_id, x, y, z, heading);
return true; return true;
} }
@ -10260,7 +10260,7 @@ void Client::SetAnon(uint8 anon_flag) {
m_pp.anon = anon_flag; m_pp.anon = anon_flag;
auto outapp = new EQApplicationPacket(OP_SpawnAppearance, sizeof(SpawnAppearance_Struct)); auto outapp = new EQApplicationPacket(OP_SpawnAppearance, sizeof(SpawnAppearance_Struct));
SpawnAppearance_Struct* spawn_appearance = (SpawnAppearance_Struct*)outapp->pBuffer; SpawnAppearance_Struct* spawn_appearance = (SpawnAppearance_Struct*)outapp->pBuffer;
spawn_appearance->spawn_id = this->GetID(); spawn_appearance->spawn_id = GetID();
spawn_appearance->type = AT_Anon; spawn_appearance->type = AT_Anon;
spawn_appearance->parameter = anon_flag; spawn_appearance->parameter = anon_flag;
entity_list.QueueClients(this, outapp); entity_list.QueueClients(this, outapp);
@ -10273,7 +10273,7 @@ void Client::SetAFK(uint8 afk_flag) {
AFK = afk_flag; AFK = afk_flag;
auto outapp = new EQApplicationPacket(OP_SpawnAppearance, sizeof(SpawnAppearance_Struct)); auto outapp = new EQApplicationPacket(OP_SpawnAppearance, sizeof(SpawnAppearance_Struct));
SpawnAppearance_Struct* spawn_appearance = (SpawnAppearance_Struct*)outapp->pBuffer; SpawnAppearance_Struct* spawn_appearance = (SpawnAppearance_Struct*)outapp->pBuffer;
spawn_appearance->spawn_id = this->GetID(); spawn_appearance->spawn_id = GetID();
spawn_appearance->type = AT_AFK; spawn_appearance->type = AT_AFK;
spawn_appearance->parameter = afk_flag; spawn_appearance->parameter = afk_flag;
entity_list.QueueClients(this, outapp); entity_list.QueueClients(this, outapp);
@ -10393,8 +10393,8 @@ void Client::RemoveItem(uint32 item_id, uint32 quantity)
} }
void Client::SetGMStatus(int newStatus) { void Client::SetGMStatus(int newStatus) {
if (this->Admin() != newStatus) if (Admin() != newStatus)
database.UpdateGMStatus(this->AccountID(), newStatus); database.UpdateGMStatus(AccountID(), newStatus);
} }
void Client::ApplyWeaponsStance() void Client::ApplyWeaponsStance()
@ -10885,7 +10885,7 @@ uint16 Client::LearnDisciplines(uint8 min_level, uint8 max_level)
); );
break; break;
} }
if (HasDisciplineLearned(spell_id)) { if (HasDisciplineLearned(spell_id)) {
continue; continue;
} }
@ -10944,7 +10944,7 @@ uint16 Client::GetClassTrackingDistanceMultiplier(uint16 class_) {
return RuleI(Character, BeastlordTrackingDistanceMultiplier); return RuleI(Character, BeastlordTrackingDistanceMultiplier);
case BERSERKER: case BERSERKER:
return RuleI(Character, BerserkerTrackingDistanceMultiplier); return RuleI(Character, BerserkerTrackingDistanceMultiplier);
default: default:
return 0; return 0;
} }
} }

View File

@ -628,7 +628,7 @@ void Client::CompleteConnect()
} }
else { else {
Group *group = nullptr; Group *group = nullptr;
group = this->GetGroup(); group = GetGroup();
if (group) if (group)
group->SendHPManaEndPacketsTo(this); group->SendHPManaEndPacketsTo(this);
} }
@ -776,8 +776,8 @@ void Client::CompleteConnect()
parse->EventPlayer(EVENT_CONNECT, this, "", 0); parse->EventPlayer(EVENT_CONNECT, this, "", 0);
/* QS: PlayerLogConnectDisconnect */ /* QS: PlayerLogConnectDisconnect */
if (RuleB(QueryServ, PlayerLogConnectDisconnect)) { if (RuleB(QueryServ, PlayerLogConnectDisconnect)) {
std::string event_desc = StringFormat("Connect :: Logged into zoneid:%i instid:%i", this->GetZoneID(), this->GetInstanceID()); std::string event_desc = StringFormat("Connect :: Logged into zoneid:%i instid:%i", GetZoneID(), GetInstanceID());
QServ->PlayerLogEvent(Player_Log_Connect_State, this->CharacterID(), event_desc); QServ->PlayerLogEvent(Player_Log_Connect_State, CharacterID(), event_desc);
} }
/** /**
@ -828,7 +828,7 @@ void Client::CompleteConnect()
if (IsInAGuild()) { if (IsInAGuild()) {
SendGuildRanks(); SendGuildRanks();
guild_mgr.SendGuildMemberUpdateToWorld(GetName(), GuildID(), zone->GetZoneID(), time(nullptr)); guild_mgr.SendGuildMemberUpdateToWorld(GetName(), GuildID(), zone->GetZoneID(), time(nullptr));
guild_mgr.RequestOnlineGuildMembers(this->CharacterID(), this->GuildID()); guild_mgr.RequestOnlineGuildMembers(CharacterID(), GuildID());
} }
SendDynamicZoneUpdates(); SendDynamicZoneUpdates();
@ -1185,7 +1185,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app)
database.LoadCharacterFactionValues(cid, factionvalues); database.LoadCharacterFactionValues(cid, factionvalues);
/* Load Character Account Data: Temp until I move */ /* Load Character Account Data: Temp until I move */
query = StringFormat("SELECT `status`, `name`, `ls_id`, `lsaccount_id`, `gmspeed`, `revoked`, `hideme`, `time_creation` FROM `account` WHERE `id` = %u", this->AccountID()); query = StringFormat("SELECT `status`, `name`, `ls_id`, `lsaccount_id`, `gmspeed`, `revoked`, `hideme`, `time_creation` FROM `account` WHERE `id` = %u", AccountID());
auto results = database.QueryDatabase(query); auto results = database.QueryDatabase(query);
for (auto row = results.begin(); row != results.end(); ++row) { for (auto row = results.begin(); row != results.end(); ++row) {
admin = atoi(row[0]); admin = atoi(row[0]);
@ -1215,7 +1215,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app)
} }
if (RuleB(Character, SharedBankPlat)) if (RuleB(Character, SharedBankPlat))
m_pp.platinum_shared = database.GetSharedPlatinum(this->AccountID()); m_pp.platinum_shared = database.GetSharedPlatinum(AccountID());
database.ClearOldRecastTimestamps(cid); /* Clear out our old recast timestamps to keep the DB clean */ database.ClearOldRecastTimestamps(cid); /* Clear out our old recast timestamps to keep the DB clean */
// set to full support in case they're a gm with items in disabled expansion slots...but, have their gm flag off... // set to full support in case they're a gm with items in disabled expansion slots...but, have their gm flag off...
@ -2535,8 +2535,8 @@ void Client::Handle_OP_AltCurrencyPurchase(const EQApplicationPacket *app)
/* QS: PlayerLogAlternateCurrencyTransactions :: Merchant Purchase */ /* QS: PlayerLogAlternateCurrencyTransactions :: Merchant Purchase */
if (RuleB(QueryServ, PlayerLogAlternateCurrencyTransactions)) { if (RuleB(QueryServ, PlayerLogAlternateCurrencyTransactions)) {
std::string event_desc = StringFormat("Merchant Purchase :: Spent alt_currency_id:%i cost:%i for itemid:%i in zoneid:%i instid:%i", alt_cur_id, cost, item->ID, this->GetZoneID(), this->GetInstanceID()); std::string event_desc = StringFormat("Merchant Purchase :: Spent alt_currency_id:%i cost:%i for itemid:%i in zoneid:%i instid:%i", alt_cur_id, cost, item->ID, GetZoneID(), GetInstanceID());
QServ->PlayerLogEvent(Player_Log_Alternate_Currency_Transactions, this->CharacterID(), event_desc); QServ->PlayerLogEvent(Player_Log_Alternate_Currency_Transactions, CharacterID(), event_desc);
} }
AddAlternateCurrencyValue(alt_cur_id, -((int32)cost)); AddAlternateCurrencyValue(alt_cur_id, -((int32)cost));
@ -2572,8 +2572,8 @@ void Client::Handle_OP_AltCurrencyReclaim(const EQApplicationPacket *app)
/* QS: PlayerLogAlternateCurrencyTransactions :: Item to Currency */ /* QS: PlayerLogAlternateCurrencyTransactions :: Item to Currency */
if (RuleB(QueryServ, PlayerLogAlternateCurrencyTransactions)) { if (RuleB(QueryServ, PlayerLogAlternateCurrencyTransactions)) {
std::string event_desc = StringFormat("Reclaim :: Item to Currency :: alt_currency_id:%i amount:%i to currency tab in zoneid:%i instid:%i", reclaim->currency_id, removed, this->GetZoneID(), this->GetInstanceID()); std::string event_desc = StringFormat("Reclaim :: Item to Currency :: alt_currency_id:%i amount:%i to currency tab in zoneid:%i instid:%i", reclaim->currency_id, removed, GetZoneID(), GetInstanceID());
QServ->PlayerLogEvent(Player_Log_Alternate_Currency_Transactions, this->CharacterID(), event_desc); QServ->PlayerLogEvent(Player_Log_Alternate_Currency_Transactions, CharacterID(), event_desc);
} }
} }
} }
@ -2595,8 +2595,8 @@ void Client::Handle_OP_AltCurrencyReclaim(const EQApplicationPacket *app)
} }
/* QS: PlayerLogAlternateCurrencyTransactions :: Cursor to Item Storage */ /* QS: PlayerLogAlternateCurrencyTransactions :: Cursor to Item Storage */
if (RuleB(QueryServ, PlayerLogAlternateCurrencyTransactions)) { if (RuleB(QueryServ, PlayerLogAlternateCurrencyTransactions)) {
std::string event_desc = StringFormat("Reclaim :: Cursor to Item :: alt_currency_id:%i amount:-%i in zoneid:%i instid:%i", reclaim->currency_id, reclaim->count, this->GetZoneID(), this->GetInstanceID()); std::string event_desc = StringFormat("Reclaim :: Cursor to Item :: alt_currency_id:%i amount:-%i in zoneid:%i instid:%i", reclaim->currency_id, reclaim->count, GetZoneID(), GetInstanceID());
QServ->PlayerLogEvent(Player_Log_Alternate_Currency_Transactions, this->CharacterID(), event_desc); QServ->PlayerLogEvent(Player_Log_Alternate_Currency_Transactions, CharacterID(), event_desc);
} }
} }
} }
@ -2689,8 +2689,8 @@ void Client::Handle_OP_AltCurrencySell(const EQApplicationPacket *app)
/* QS: PlayerLogAlternateCurrencyTransactions :: Sold to Merchant*/ /* QS: PlayerLogAlternateCurrencyTransactions :: Sold to Merchant*/
if (RuleB(QueryServ, PlayerLogAlternateCurrencyTransactions)) { if (RuleB(QueryServ, PlayerLogAlternateCurrencyTransactions)) {
std::string event_desc = StringFormat("Sold to Merchant :: itemid:%u npcid:%u alt_currency_id:%u cost:%u in zoneid:%u instid:%i", item->ID, npc_id, alt_cur_id, cost, this->GetZoneID(), this->GetInstanceID()); std::string event_desc = StringFormat("Sold to Merchant :: itemid:%u npcid:%u alt_currency_id:%u cost:%u in zoneid:%u instid:%i", item->ID, npc_id, alt_cur_id, cost, GetZoneID(), GetInstanceID());
QServ->PlayerLogEvent(Player_Log_Alternate_Currency_Transactions, this->CharacterID(), event_desc); QServ->PlayerLogEvent(Player_Log_Alternate_Currency_Transactions, CharacterID(), event_desc);
} }
FastQueuePacket(&outapp); FastQueuePacket(&outapp);
@ -3560,7 +3560,7 @@ void Client::Handle_OP_BazaarSearch(const EQApplicationPacket *app)
BazaarSearch_Struct* bss = (BazaarSearch_Struct*)app->pBuffer; BazaarSearch_Struct* bss = (BazaarSearch_Struct*)app->pBuffer;
this->SendBazaarResults(bss->TraderID, bss->Class_, bss->Race, bss->ItemStat, bss->Slot, bss->Type, SendBazaarResults(bss->TraderID, bss->Class_, bss->Race, bss->ItemStat, bss->Slot, bss->Type,
bss->Name, bss->MinPrice * 1000, bss->MaxPrice * 1000); bss->Name, bss->MinPrice * 1000, bss->MaxPrice * 1000);
} }
else if (app->size == sizeof(BazaarWelcome_Struct)) { else if (app->size == sizeof(BazaarWelcome_Struct)) {
@ -3628,7 +3628,7 @@ void Client::Handle_OP_Begging(const EQApplicationPacket *app)
if (GetLevel() > GetTarget()->GetLevel()) if (GetLevel() > GetTarget()->GetLevel())
ChanceToAttack = zone->random.Int(0, 15); ChanceToAttack = zone->random.Int(0, 15);
else else
ChanceToAttack = zone->random.Int(((this->GetTarget()->GetLevel() - this->GetLevel()) * 10) - 5, ((this->GetTarget()->GetLevel() - this->GetLevel()) * 10)); ChanceToAttack = zone->random.Int(((GetTarget()->GetLevel() - GetLevel()) * 10) - 5, ((GetTarget()->GetLevel() - GetLevel()) * 10));
if (ChanceToAttack < 0) if (ChanceToAttack < 0)
ChanceToAttack = -ChanceToAttack; ChanceToAttack = -ChanceToAttack;
@ -3675,7 +3675,7 @@ void Client::Handle_OP_Bind_Wound(const EQApplicationPacket *app)
BindWound_Struct* bind_in = (BindWound_Struct*)app->pBuffer; BindWound_Struct* bind_in = (BindWound_Struct*)app->pBuffer;
Mob* bindmob = entity_list.GetMob(bind_in->to); Mob* bindmob = entity_list.GetMob(bind_in->to);
if (!bindmob) { if (!bindmob) {
LogError("Bindwound on non-exsistant mob from [{}]", this->GetName()); LogError("Bindwound on non-exsistant mob from [{}]", GetName());
} }
else { else {
LogDebug("BindWound in: to:\'[{}]\' from=\'[{}]\'", bindmob->GetName(), GetName()); LogDebug("BindWound in: to:\'[{}]\' from=\'[{}]\'", bindmob->GetName(), GetName());
@ -3978,7 +3978,7 @@ void Client::Handle_OP_CastSpell(const EQApplicationPacket *app)
return; return;
} }
if (IsAIControlled()) { if (IsAIControlled()) {
this->MessageString(Chat::Red, NOT_IN_CONTROL); MessageString(Chat::Red, NOT_IN_CONTROL);
//Message(Chat::Red, "You cant cast right now, you arent in control of yourself!"); //Message(Chat::Red, "You cant cast right now, you arent in control of yourself!");
return; return;
} }
@ -4609,8 +4609,8 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) {
/* Visual Debugging */ /* Visual Debugging */
if (RuleB(Character, OPClientUpdateVisualDebug)) { if (RuleB(Character, OPClientUpdateVisualDebug)) {
LogDebug("ClientUpdate: ppu x: [{}] y: [{}] z: [{}] h: [{}]", cx, cy, cz, new_heading); LogDebug("ClientUpdate: ppu x: [{}] y: [{}] z: [{}] h: [{}]", cx, cy, cz, new_heading);
this->SendAppearanceEffect(78, 0, 0, 0, 0); SendAppearanceEffect(78, 0, 0, 0, 0);
this->SendAppearanceEffect(41, 0, 0, 0, 0); SendAppearanceEffect(41, 0, 0, 0, 0);
} }
/* Only feed real time updates when client is moving */ /* Only feed real time updates when client is moving */
@ -4633,8 +4633,8 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) {
/* Always send position updates to group - send when beyond normal ClientPositionUpdate range */ /* Always send position updates to group - send when beyond normal ClientPositionUpdate range */
Group *group = this->GetGroup(); Group *group = GetGroup();
Raid *raid = this->GetRaid(); Raid *raid = GetRaid();
if (raid) { if (raid) {
raid->QueueClients(this, outapp, true, true, (RuleI(Range, ClientPositionUpdates) * -1)); raid->QueueClients(this, outapp, true, true, (RuleI(Range, ClientPositionUpdates) * -1));
@ -4852,7 +4852,7 @@ void Client::Handle_OP_ConsiderCorpse(const EQApplicationPacket *app)
time_string time_string
).c_str() ).c_str()
); );
if (target->IsPlayerCorpse()) { if (target->IsPlayerCorpse()) {
Message( Message(
Chat::NPCQuestSay, Chat::NPCQuestSay,
@ -4956,7 +4956,7 @@ void Client::Handle_OP_ControlBoat(const EQApplicationPacket *app)
if (!boat->IsNPC() || !boat->IsControllableBoat()) if (!boat->IsNPC() || !boat->IsControllableBoat())
{ {
auto hacked_string = fmt::format("OP_Control Boat was sent against {} which is of race {}", boat->GetName(), boat->GetRace()); auto hacked_string = fmt::format("OP_Control Boat was sent against {} which is of race {}", boat->GetName(), boat->GetRace());
database.SetMQDetectionFlag(this->AccountName(), this->GetName(), hacked_string, zone->GetShortName()); database.SetMQDetectionFlag(AccountName(), GetName(), hacked_string, zone->GetShortName());
return; return;
} }
@ -4967,7 +4967,7 @@ void Client::Handle_OP_ControlBoat(const EQApplicationPacket *app)
} }
else { else {
this->MessageString(Chat::Red, IN_USE); MessageString(Chat::Red, IN_USE);
return; return;
} }
} }
@ -5244,7 +5244,7 @@ void Client::Handle_OP_DeleteSpawn(const EQApplicationPacket *app)
entity_list.QueueClients(this, outapp, false); entity_list.QueueClients(this, outapp, false);
safe_delete(outapp); safe_delete(outapp);
hate_list.RemoveEntFromHateList(this->CastToMob()); hate_list.RemoveEntFromHateList(CastToMob());
Disconnect(); Disconnect();
return; return;
@ -5277,7 +5277,7 @@ void Client::Handle_OP_Disarm(const EQApplicationPacket *app) {
if (pmob->GetID() != GetID()) { if (pmob->GetID() != GetID()) {
// Client sent a disarm request with an originator ID not matching their own ID. // Client sent a disarm request with an originator ID not matching their own ID.
auto hack_str = fmt::format("Player {} ({}) sent OP_Disarm with source ID of: {}", GetCleanName(), GetID(), pmob->GetID()); auto hack_str = fmt::format("Player {} ({}) sent OP_Disarm with source ID of: {}", GetCleanName(), GetID(), pmob->GetID());
database.SetMQDetectionFlag(this->account_name, this->name, hack_str, zone->GetShortName()); database.SetMQDetectionFlag(account_name, name, hack_str, zone->GetShortName());
return; return;
} }
// No disarm on corpses // No disarm on corpses
@ -5303,7 +5303,7 @@ void Client::Handle_OP_Disarm(const EQApplicationPacket *app) {
// We can't disarm someone who is feigned. // We can't disarm someone who is feigned.
if (tmob->IsClient() && tmob->CastToClient()->GetFeigned()) if (tmob->IsClient() && tmob->CastToClient()->GetFeigned())
return; return;
if (GetTarget() == tmob && pmob == this->CastToMob() && if (GetTarget() == tmob && pmob == CastToMob() &&
disarm->skill == GetSkill(EQ::skills::SkillDisarm) && IsAttackAllowed(tmob)) { disarm->skill == GetSkill(EQ::skills::SkillDisarm) && IsAttackAllowed(tmob)) {
int p_level = pmob->GetLevel() ? pmob->GetLevel() : 1; int p_level = pmob->GetLevel() ? pmob->GetLevel() : 1;
int t_level = tmob->GetLevel() ? tmob->GetLevel() : 1; int t_level = tmob->GetLevel() ? tmob->GetLevel() : 1;
@ -5352,7 +5352,7 @@ void Client::Handle_OP_DeleteSpell(const EQApplicationPacket *app)
if (m_pp.spell_book[dss->spell_slot] != SPELLBOOK_UNKNOWN) { if (m_pp.spell_book[dss->spell_slot] != SPELLBOOK_UNKNOWN) {
m_pp.spell_book[dss->spell_slot] = SPELLBOOK_UNKNOWN; m_pp.spell_book[dss->spell_slot] = SPELLBOOK_UNKNOWN;
database.DeleteCharacterSpell(this->CharacterID(), m_pp.spell_book[dss->spell_slot], dss->spell_slot); database.DeleteCharacterSpell(CharacterID(), m_pp.spell_book[dss->spell_slot], dss->spell_slot);
dss->success = 1; dss->success = 1;
} }
else else
@ -5881,7 +5881,7 @@ void Client::Handle_OP_FeignDeath(const EQApplicationPacket *app)
if (!HasSkill(EQ::skills::SkillFeignDeath)) { if (!HasSkill(EQ::skills::SkillFeignDeath)) {
return; return;
} }
if (!p_timers.Expired(&database, pTimerFeignDeath, false)) { if (!p_timers.Expired(&database, pTimerFeignDeath, false)) {
Message(Chat::Red, "Ability recovery time not yet met."); Message(Chat::Red, "Ability recovery time not yet met.");
return; return;
@ -6091,9 +6091,9 @@ void Client::Handle_OP_GetGuildsList(const EQApplicationPacket *app)
void Client::Handle_OP_GMBecomeNPC(const EQApplicationPacket *app) void Client::Handle_OP_GMBecomeNPC(const EQApplicationPacket *app)
{ {
if (this->Admin() < minStatusToUseGMCommands) { if (Admin() < minStatusToUseGMCommands) {
Message(Chat::Red, "Your account has been reported for hacking."); Message(Chat::Red, "Your account has been reported for hacking.");
database.SetHackerFlag(this->account_name, this->name, "/becomenpc"); database.SetHackerFlag(account_name, name, "/becomenpc");
return; return;
} }
if (app->size != sizeof(BecomeNPC_Struct)) { if (app->size != sizeof(BecomeNPC_Struct)) {
@ -6122,9 +6122,9 @@ void Client::Handle_OP_GMDelCorpse(const EQApplicationPacket *app)
{ {
if (app->size != sizeof(GMDelCorpse_Struct)) if (app->size != sizeof(GMDelCorpse_Struct))
return; return;
if (this->Admin() < commandEditPlayerCorpses) { if (Admin() < commandEditPlayerCorpses) {
Message(Chat::Red, "Your account has been reported for hacking."); Message(Chat::Red, "Your account has been reported for hacking.");
database.SetHackerFlag(this->account_name, this->name, "/delcorpse"); database.SetHackerFlag(account_name, name, "/delcorpse");
return; return;
} }
GMDelCorpse_Struct* dc = (GMDelCorpse_Struct *)app->pBuffer; GMDelCorpse_Struct* dc = (GMDelCorpse_Struct *)app->pBuffer;
@ -6143,9 +6143,9 @@ void Client::Handle_OP_GMDelCorpse(const EQApplicationPacket *app)
void Client::Handle_OP_GMEmoteZone(const EQApplicationPacket *app) void Client::Handle_OP_GMEmoteZone(const EQApplicationPacket *app)
{ {
if (this->Admin() < minStatusToUseGMCommands) { if (Admin() < minStatusToUseGMCommands) {
Message(Chat::Red, "Your account has been reported for hacking."); Message(Chat::Red, "Your account has been reported for hacking.");
database.SetHackerFlag(this->account_name, this->name, "/emote"); database.SetHackerFlag(account_name, name, "/emote");
return; return;
} }
if (app->size != sizeof(GMEmoteZone_Struct)) { if (app->size != sizeof(GMEmoteZone_Struct)) {
@ -6176,9 +6176,9 @@ void Client::Handle_OP_GMEndTraining(const EQApplicationPacket *app)
void Client::Handle_OP_GMFind(const EQApplicationPacket *app) void Client::Handle_OP_GMFind(const EQApplicationPacket *app)
{ {
if (this->Admin() < minStatusToUseGMCommands) { if (Admin() < minStatusToUseGMCommands) {
Message(Chat::Red, "Your account has been reported for hacking."); Message(Chat::Red, "Your account has been reported for hacking.");
database.SetHackerFlag(this->account_name, this->name, "/find"); database.SetHackerFlag(account_name, name, "/find");
return; return;
} }
if (app->size != sizeof(GMSummon_Struct)) { if (app->size != sizeof(GMSummon_Struct)) {
@ -6214,15 +6214,15 @@ void Client::Handle_OP_GMGoto(const EQApplicationPacket *app)
std::cout << "Wrong size on OP_GMGoto. Got: " << app->size << ", Expected: " << sizeof(GMSummon_Struct) << std::endl; std::cout << "Wrong size on OP_GMGoto. Got: " << app->size << ", Expected: " << sizeof(GMSummon_Struct) << std::endl;
return; return;
} }
if (this->Admin() < minStatusToUseGMCommands) { if (Admin() < minStatusToUseGMCommands) {
Message(Chat::Red, "Your account has been reported for hacking."); Message(Chat::Red, "Your account has been reported for hacking.");
database.SetHackerFlag(this->account_name, this->name, "/goto"); database.SetHackerFlag(account_name, name, "/goto");
return; return;
} }
GMSummon_Struct* gmg = (GMSummon_Struct*)app->pBuffer; GMSummon_Struct* gmg = (GMSummon_Struct*)app->pBuffer;
Mob* gt = entity_list.GetMob(gmg->charname); Mob* gt = entity_list.GetMob(gmg->charname);
if (gt != nullptr) { if (gt != nullptr) {
this->MovePC(zone->GetZoneID(), zone->GetInstanceID(), gt->GetX(), gt->GetY(), gt->GetZ(), gt->GetHeading()); MovePC(zone->GetZoneID(), zone->GetInstanceID(), gt->GetX(), gt->GetY(), gt->GetZ(), gt->GetHeading());
} }
else if (!worldserver.Connected()) else if (!worldserver.Connected())
Message(0, "Error: World server disconnected."); Message(0, "Error: World server disconnected.");
@ -6230,7 +6230,7 @@ void Client::Handle_OP_GMGoto(const EQApplicationPacket *app)
auto pack = new ServerPacket(ServerOP_GMGoto, sizeof(ServerGMGoto_Struct)); auto pack = new ServerPacket(ServerOP_GMGoto, sizeof(ServerGMGoto_Struct));
memset(pack->pBuffer, 0, pack->size); memset(pack->pBuffer, 0, pack->size);
ServerGMGoto_Struct* wsgmg = (ServerGMGoto_Struct*)pack->pBuffer; ServerGMGoto_Struct* wsgmg = (ServerGMGoto_Struct*)pack->pBuffer;
strcpy(wsgmg->myname, this->GetName()); strcpy(wsgmg->myname, GetName());
strcpy(wsgmg->gotoname, gmg->charname); strcpy(wsgmg->gotoname, gmg->charname);
wsgmg->admin = admin; wsgmg->admin = admin;
worldserver.SendPacket(pack); worldserver.SendPacket(pack);
@ -6241,9 +6241,9 @@ void Client::Handle_OP_GMGoto(const EQApplicationPacket *app)
void Client::Handle_OP_GMHideMe(const EQApplicationPacket *app) void Client::Handle_OP_GMHideMe(const EQApplicationPacket *app)
{ {
if (this->Admin() < minStatusToUseGMCommands) { if (Admin() < minStatusToUseGMCommands) {
Message(Chat::Red, "Your account has been reported for hacking."); Message(Chat::Red, "Your account has been reported for hacking.");
database.SetHackerFlag(this->account_name, this->name, "/hideme"); database.SetHackerFlag(account_name, name, "/hideme");
return; return;
} }
if (app->size != sizeof(SpawnAppearance_Struct)) { if (app->size != sizeof(SpawnAppearance_Struct)) {
@ -6261,9 +6261,9 @@ void Client::Handle_OP_GMKick(const EQApplicationPacket *app)
{ {
if (app->size != sizeof(GMKick_Struct)) if (app->size != sizeof(GMKick_Struct))
return; return;
if (this->Admin() < minStatusToKick) { if (Admin() < minStatusToKick) {
Message(Chat::Red, "Your account has been reported for hacking."); Message(Chat::Red, "Your account has been reported for hacking.");
database.SetHackerFlag(this->account_name, this->name, "/kick"); database.SetHackerFlag(account_name, name, "/kick");
return; return;
} }
GMKick_Struct* gmk = (GMKick_Struct *)app->pBuffer; GMKick_Struct* gmk = (GMKick_Struct *)app->pBuffer;
@ -6277,7 +6277,7 @@ void Client::Handle_OP_GMKick(const EQApplicationPacket *app)
ServerKickPlayer_Struct* skp = (ServerKickPlayer_Struct*)pack->pBuffer; ServerKickPlayer_Struct* skp = (ServerKickPlayer_Struct*)pack->pBuffer;
strcpy(skp->adminname, gmk->gmname); strcpy(skp->adminname, gmk->gmname);
strcpy(skp->name, gmk->name); strcpy(skp->name, gmk->name);
skp->adminrank = this->Admin(); skp->adminrank = Admin();
worldserver.SendPacket(pack); worldserver.SendPacket(pack);
safe_delete(pack); safe_delete(pack);
} }
@ -6291,9 +6291,9 @@ void Client::Handle_OP_GMKick(const EQApplicationPacket *app)
void Client::Handle_OP_GMKill(const EQApplicationPacket *app) void Client::Handle_OP_GMKill(const EQApplicationPacket *app)
{ {
if (this->Admin() < minStatusToUseGMCommands) { if (Admin() < minStatusToUseGMCommands) {
Message(Chat::Red, "Your account has been reported for hacking."); Message(Chat::Red, "Your account has been reported for hacking.");
database.SetHackerFlag(this->account_name, this->name, "/kill"); database.SetHackerFlag(account_name, name, "/kill");
return; return;
} }
if (app->size != sizeof(GMKill_Struct)) { if (app->size != sizeof(GMKill_Struct)) {
@ -6319,7 +6319,7 @@ void Client::Handle_OP_GMKill(const EQApplicationPacket *app)
ServerKillPlayer_Struct* skp = (ServerKillPlayer_Struct*)pack->pBuffer; ServerKillPlayer_Struct* skp = (ServerKillPlayer_Struct*)pack->pBuffer;
strcpy(skp->gmname, gmk->gmname); strcpy(skp->gmname, gmk->gmname);
strcpy(skp->target, gmk->name); strcpy(skp->target, gmk->name);
skp->admin = this->Admin(); skp->admin = Admin();
worldserver.SendPacket(pack); worldserver.SendPacket(pack);
safe_delete(pack); safe_delete(pack);
} }
@ -6343,7 +6343,7 @@ void Client::Handle_OP_GMLastName(const EQApplicationPacket *app)
Message(Chat::Red, "/LastName: %s not found", gmln->name); Message(Chat::Red, "/LastName: %s not found", gmln->name);
} }
else { else {
if (this->Admin() < minStatusToUseGMCommands) { if (Admin() < minStatusToUseGMCommands) {
Message(Chat::Red, "Your account has been reported for hacking."); Message(Chat::Red, "Your account has been reported for hacking.");
database.SetHackerFlag(client->account_name, client->name, "/lastname"); database.SetHackerFlag(client->account_name, client->name, "/lastname");
return; return;
@ -6368,9 +6368,9 @@ void Client::Handle_OP_GMNameChange(const EQApplicationPacket *app)
return; return;
} }
const GMName_Struct* gmn = (const GMName_Struct *)app->pBuffer; const GMName_Struct* gmn = (const GMName_Struct *)app->pBuffer;
if (this->Admin() < minStatusToUseGMCommands) { if (Admin() < minStatusToUseGMCommands) {
Message(Chat::Red, "Your account has been reported for hacking."); Message(Chat::Red, "Your account has been reported for hacking.");
database.SetHackerFlag(this->account_name, this->name, "/name"); database.SetHackerFlag(account_name, name, "/name");
return; return;
} }
Client* client = entity_list.GetClientByName(gmn->oldname); Client* client = entity_list.GetClientByName(gmn->oldname);
@ -6486,9 +6486,9 @@ void Client::Handle_OP_GMServers(const EQApplicationPacket *app)
if (!worldserver.Connected()) if (!worldserver.Connected())
Message(0, "Error: World server disconnected"); Message(0, "Error: World server disconnected");
else { else {
auto pack = new ServerPacket(ServerOP_ZoneStatus, strlen(this->GetName()) + 2); auto pack = new ServerPacket(ServerOP_ZoneStatus, strlen(GetName()) + 2);
memset(pack->pBuffer, (uint8)admin, 1); memset(pack->pBuffer, (uint8)admin, 1);
strcpy((char *)&pack->pBuffer[1], this->GetName()); strcpy((char *)&pack->pBuffer[1], GetName());
worldserver.SendPacket(pack); worldserver.SendPacket(pack);
safe_delete(pack); safe_delete(pack);
} }
@ -6511,20 +6511,20 @@ void Client::Handle_OP_GMToggle(const EQApplicationPacket *app)
std::cout << "Wrong size on OP_GMToggle. Got: " << app->size << ", Expected: " << sizeof(GMToggle_Struct) << std::endl; std::cout << "Wrong size on OP_GMToggle. Got: " << app->size << ", Expected: " << sizeof(GMToggle_Struct) << std::endl;
return; return;
} }
if (this->Admin() < minStatusToUseGMCommands) { if (Admin() < minStatusToUseGMCommands) {
Message(Chat::Red, "Your account has been reported for hacking."); Message(Chat::Red, "Your account has been reported for hacking.");
database.SetHackerFlag(this->account_name, this->name, "/toggle"); database.SetHackerFlag(account_name, name, "/toggle");
return; return;
} }
GMToggle_Struct *ts = (GMToggle_Struct *)app->pBuffer; GMToggle_Struct *ts = (GMToggle_Struct *)app->pBuffer;
if (ts->toggle == 0) { if (ts->toggle == 0) {
this->MessageString(Chat::White, TOGGLE_OFF); MessageString(Chat::White, TOGGLE_OFF);
//Message(0, "Turning tells OFF"); //Message(0, "Turning tells OFF");
tellsoff = true; tellsoff = true;
} }
else if (ts->toggle == 1) { else if (ts->toggle == 1) {
//Message(0, "Turning tells ON"); //Message(0, "Turning tells ON");
this->MessageString(Chat::White, TOGGLE_ON); MessageString(Chat::White, TOGGLE_ON);
tellsoff = false; tellsoff = false;
} }
else { else {
@ -6562,9 +6562,9 @@ void Client::Handle_OP_GMZoneRequest(const EQApplicationPacket *app)
std::cout << "Wrong size on OP_GMZoneRequest. Got: " << app->size << ", Expected: " << sizeof(GMZoneRequest_Struct) << std::endl; std::cout << "Wrong size on OP_GMZoneRequest. Got: " << app->size << ", Expected: " << sizeof(GMZoneRequest_Struct) << std::endl;
return; return;
} }
if (this->Admin() < minStatusToBeGM) { if (Admin() < minStatusToBeGM) {
Message(Chat::Red, "Your account has been reported for hacking."); Message(Chat::Red, "Your account has been reported for hacking.");
database.SetHackerFlag(this->account_name, this->name, "/zone"); database.SetHackerFlag(account_name, name, "/zone");
return; return;
} }
@ -6600,7 +6600,7 @@ void Client::Handle_OP_GMZoneRequest(const EQApplicationPacket *app)
auto outapp = new EQApplicationPacket(OP_GMZoneRequest, sizeof(GMZoneRequest_Struct)); auto outapp = new EQApplicationPacket(OP_GMZoneRequest, sizeof(GMZoneRequest_Struct));
GMZoneRequest_Struct* gmzr2 = (GMZoneRequest_Struct*)outapp->pBuffer; GMZoneRequest_Struct* gmzr2 = (GMZoneRequest_Struct*)outapp->pBuffer;
strcpy(gmzr2->charname, this->GetName()); strcpy(gmzr2->charname, GetName());
gmzr2->zone_id = gmzr->zone_id; gmzr2->zone_id = gmzr->zone_id;
gmzr2->x = target_x; gmzr2->x = target_x;
gmzr2->y = target_y; gmzr2->y = target_y;
@ -6621,9 +6621,9 @@ void Client::Handle_OP_GMZoneRequest(const EQApplicationPacket *app)
void Client::Handle_OP_GMZoneRequest2(const EQApplicationPacket *app) void Client::Handle_OP_GMZoneRequest2(const EQApplicationPacket *app)
{ {
if (this->Admin() < minStatusToBeGM) { if (Admin() < minStatusToBeGM) {
Message(Chat::Red, "Your account has been reported for hacking."); Message(Chat::Red, "Your account has been reported for hacking.");
database.SetHackerFlag(this->account_name, this->name, "/zone"); database.SetHackerFlag(account_name, name, "/zone");
return; return;
} }
if (app->size < sizeof(uint32)) { if (app->size < sizeof(uint32)) {
@ -7097,7 +7097,7 @@ void Client::Handle_OP_GroupUpdate(const EQApplicationPacket *app)
case groupActMakeLeader: case groupActMakeLeader:
{ {
Mob* newleader = entity_list.GetClientByName(gu->membername[0]); Mob* newleader = entity_list.GetClientByName(gu->membername[0]);
Group* group = this->GetGroup(); Group* group = GetGroup();
if (newleader && group) { if (newleader && group) {
// the client only sends this if it's the group leader, but check anyway // the client only sends this if it's the group leader, but check anyway
@ -8312,7 +8312,7 @@ void Client::Handle_OP_Illusion(const EQApplicationPacket *app)
if (!GetGM()) if (!GetGM())
{ {
database.SetMQDetectionFlag(this->AccountName(), this->GetName(), "OP_Illusion sent by non Game Master.", zone->GetShortName()); database.SetMQDetectionFlag(AccountName(), GetName(), "OP_Illusion sent by non Game Master.", zone->GetShortName());
return; return;
} }
@ -8366,9 +8366,9 @@ void Client::Handle_OP_InspectAnswer(const EQApplicationPacket *app)
} }
InspectMessage_Struct* newmessage = (InspectMessage_Struct*)insr->text; InspectMessage_Struct* newmessage = (InspectMessage_Struct*)insr->text;
InspectMessage_Struct& playermessage = this->GetInspectMessage(); InspectMessage_Struct& playermessage = GetInspectMessage();
memcpy(&playermessage, newmessage, sizeof(InspectMessage_Struct)); memcpy(&playermessage, newmessage, sizeof(InspectMessage_Struct));
database.SaveCharacterInspectMessage(this->CharacterID(), &playermessage); database.SaveCharacterInspectMessage(CharacterID(), &playermessage);
if (tmp != 0 && tmp->IsClient()) { tmp->CastToClient()->QueuePacket(outapp); } // Send answer to requester if (tmp != 0 && tmp->IsClient()) { tmp->CastToClient()->QueuePacket(outapp); } // Send answer to requester
@ -8384,9 +8384,9 @@ void Client::Handle_OP_InspectMessageUpdate(const EQApplicationPacket *app)
} }
InspectMessage_Struct* newmessage = (InspectMessage_Struct*)app->pBuffer; InspectMessage_Struct* newmessage = (InspectMessage_Struct*)app->pBuffer;
InspectMessage_Struct& playermessage = this->GetInspectMessage(); InspectMessage_Struct& playermessage = GetInspectMessage();
memcpy(&playermessage, newmessage, sizeof(InspectMessage_Struct)); memcpy(&playermessage, newmessage, sizeof(InspectMessage_Struct));
database.SaveCharacterInspectMessage(this->CharacterID(), &playermessage); database.SaveCharacterInspectMessage(CharacterID(), &playermessage);
} }
void Client::Handle_OP_InspectRequest(const EQApplicationPacket *app) void Client::Handle_OP_InspectRequest(const EQApplicationPacket *app)
@ -8776,7 +8776,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app)
if (IsAIControlled()) { if (IsAIControlled()) {
this->MessageString(Chat::Red, NOT_IN_CONTROL); MessageString(Chat::Red, NOT_IN_CONTROL);
return; return;
} }
@ -9187,14 +9187,14 @@ void Client::Handle_OP_LeaveAdventure(const EQApplicationPacket *app)
void Client::Handle_OP_LeaveBoat(const EQApplicationPacket *app) void Client::Handle_OP_LeaveBoat(const EQApplicationPacket *app)
{ {
Mob* boat = entity_list.GetMob(this->controlling_boat_id); // find the mob corresponding to the boat id Mob* boat = entity_list.GetMob(controlling_boat_id); // find the mob corresponding to the boat id
if (boat) { if (boat) {
if ((boat->GetTarget() == this) && boat->GetHateAmount(this) == 0) { // if the client somehow left while still controlling the boat (and the boat isn't attacking them) if ((boat->GetTarget() == this) && boat->GetHateAmount(this) == 0) { // if the client somehow left while still controlling the boat (and the boat isn't attacking them)
boat->SetTarget(nullptr); // fix it to stop later problems boat->SetTarget(nullptr); // fix it to stop later problems
} }
} }
this->controlling_boat_id = 0; controlling_boat_id = 0;
return; return;
} }
@ -9237,7 +9237,7 @@ void Client::Handle_OP_LFGCommand(const EQApplicationPacket *app)
// Issue outgoing packet to notify other clients // Issue outgoing packet to notify other clients
auto outapp = new EQApplicationPacket(OP_LFGAppearance, sizeof(LFG_Appearance_Struct)); auto outapp = new EQApplicationPacket(OP_LFGAppearance, sizeof(LFG_Appearance_Struct));
LFG_Appearance_Struct* lfga = (LFG_Appearance_Struct*)outapp->pBuffer; LFG_Appearance_Struct* lfga = (LFG_Appearance_Struct*)outapp->pBuffer;
lfga->spawn_id = this->GetID(); lfga->spawn_id = GetID();
lfga->lfg = (uint8)LFG; lfga->lfg = (uint8)LFG;
entity_list.QueueClients(this, outapp, true); entity_list.QueueClients(this, outapp, true);
@ -9598,7 +9598,7 @@ void Client::Handle_OP_ManaChange(const EQApplicationPacket *app)
with a length, just the 0 len ones for stopping songs with a length, just the 0 len ones for stopping songs
ManaChange_Struct* p = (ManaChange_Struct*)app->pBuffer; ManaChange_Struct* p = (ManaChange_Struct*)app->pBuffer;
*/ */
else{ else{
printf("OP_ManaChange from client:\n"); printf("OP_ManaChange from client:\n");
DumpPacket(app); DumpPacket(app);
} }
@ -10215,7 +10215,7 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app)
} }
char val1[20] = { 0 }; char val1[20] = { 0 };
PetCommand_Struct* pet = (PetCommand_Struct*)app->pBuffer; PetCommand_Struct* pet = (PetCommand_Struct*)app->pBuffer;
Mob* mypet = this->GetPet(); Mob* mypet = GetPet();
Mob *target = entity_list.GetMob(pet->target); Mob *target = entity_list.GetMob(pet->target);
if (!mypet || pet->command == PET_LEADER) { if (!mypet || pet->command == PET_LEADER) {
@ -10851,7 +10851,7 @@ void Client::Handle_OP_Petition(const EQApplicationPacket *app)
return; return;
if (!worldserver.Connected()) if (!worldserver.Connected())
Message(0, "Error: World server disconnected"); Message(0, "Error: World server disconnected");
/*else if(petition_list.FindPetitionByAccountName(this->AccountName())) /*else if(petition_list.FindPetitionByAccountName(AccountName()))
{ {
Message(0,"You already have a petition in queue, you cannot petition again until this one has been responded to or you have deleted the petition."); Message(0,"You already have a petition in queue, you cannot petition again until this one has been responded to or you have deleted the petition.");
return; return;
@ -10864,13 +10864,13 @@ void Client::Handle_OP_Petition(const EQApplicationPacket *app)
return; return;
} }
auto pet = new Petition(CharacterID()); auto pet = new Petition(CharacterID());
pet->SetAName(this->AccountName()); pet->SetAName(AccountName());
pet->SetClass(this->GetClass()); pet->SetClass(GetClass());
pet->SetLevel(this->GetLevel()); pet->SetLevel(GetLevel());
pet->SetCName(this->GetName()); pet->SetCName(GetName());
pet->SetRace(this->GetRace()); pet->SetRace(GetRace());
pet->SetLastGM(""); pet->SetLastGM("");
pet->SetCName(this->GetName()); pet->SetCName(GetName());
pet->SetPetitionText((char*)app->pBuffer); pet->SetPetitionText((char*)app->pBuffer);
pet->SetZone(zone->GetZoneID()); pet->SetZone(zone->GetZoneID());
pet->SetUrgency(0); pet->SetUrgency(0);
@ -10911,7 +10911,7 @@ void Client::Handle_OP_PetitionCheckIn(const EQApplicationPacket *app)
Petition* pet = petition_list.GetPetitionByID(inpet->petnumber); Petition* pet = petition_list.GetPetitionByID(inpet->petnumber);
//if (inpet->urgency != pet->GetUrgency()) //if (inpet->urgency != pet->GetUrgency())
pet->SetUrgency(inpet->urgency); pet->SetUrgency(inpet->urgency);
pet->SetLastGM(this->GetName()); pet->SetLastGM(GetName());
pet->SetGMText(inpet->gmtext); pet->SetGMText(inpet->gmtext);
pet->SetCheckedOut(false); pet->SetCheckedOut(false);
@ -10935,7 +10935,7 @@ void Client::Handle_OP_PetitionCheckout(const EQApplicationPacket *app)
if (getpet != 0) { if (getpet != 0) {
getpet->AddCheckout(); getpet->AddCheckout();
getpet->SetCheckedOut(true); getpet->SetCheckedOut(true);
getpet->SendPetitionToPlayer(this->CastToClient()); getpet->SendPetitionToPlayer(CastToClient());
petition_list.UpdatePetition(getpet); petition_list.UpdatePetition(getpet);
petition_list.UpdateGMQueue(); petition_list.UpdateGMQueue();
petition_list.UpdateZoneListQueue(); petition_list.UpdateZoneListQueue();
@ -10974,7 +10974,7 @@ void Client::Handle_OP_PetitionDelete(const EQApplicationPacket *app)
void Client::Handle_OP_PetitionQue(const EQApplicationPacket *app) void Client::Handle_OP_PetitionQue(const EQApplicationPacket *app)
{ {
#ifdef _EQDEBUG #ifdef _EQDEBUG
printf("%s looking at petitions..\n", this->GetName()); printf("%s looking at petitions..\n", GetName());
#endif #endif
return; return;
} }
@ -11054,7 +11054,7 @@ void Client::Handle_OP_PickPocket(const EQApplicationPacket *app)
if (!p_timers.Expired(&database, pTimerBeggingPickPocket, false)) if (!p_timers.Expired(&database, pTimerBeggingPickPocket, false))
{ {
Message(Chat::Red, "Ability recovery time not yet met."); Message(Chat::Red, "Ability recovery time not yet met.");
database.SetMQDetectionFlag(this->AccountName(), this->GetName(), "OP_PickPocket was sent again too quickly.", zone->GetShortName()); database.SetMQDetectionFlag(AccountName(), GetName(), "OP_PickPocket was sent again too quickly.", zone->GetShortName());
return; return;
} }
PickPocket_Struct* pick_in = (PickPocket_Struct*)app->pBuffer; PickPocket_Struct* pick_in = (PickPocket_Struct*)app->pBuffer;
@ -11072,7 +11072,7 @@ void Client::Handle_OP_PickPocket(const EQApplicationPacket *app)
pick_out->myskill = GetSkill(EQ::skills::SkillPickPockets); pick_out->myskill = GetSkill(EQ::skills::SkillPickPockets);
pick_out->type = 0; pick_out->type = 0;
//if we do not send this packet the client will lock up and require the player to relog. //if we do not send this packet the client will lock up and require the player to relog.
if (victim == this) { if (victim == this) {
Message(0, "You catch yourself red-handed."); Message(0, "You catch yourself red-handed.");
} }
@ -11081,7 +11081,7 @@ void Client::Handle_OP_PickPocket(const EQApplicationPacket *app)
} }
else if (Distance(GetPosition(), victim->GetPosition()) > 20) { else if (Distance(GetPosition(), victim->GetPosition()) > 20) {
Message(Chat::Red, "Attempt to pickpocket out of range detected."); Message(Chat::Red, "Attempt to pickpocket out of range detected.");
database.SetMQDetectionFlag(this->AccountName(), this->GetName(), "OP_PickPocket was sent from outside combat range.", zone->GetShortName()); database.SetMQDetectionFlag(AccountName(), GetName(), "OP_PickPocket was sent from outside combat range.", zone->GetShortName());
} }
else if (victim->IsNPC()) { else if (victim->IsNPC()) {
safe_delete(outapp); safe_delete(outapp);
@ -11178,7 +11178,7 @@ void Client::Handle_OP_PotionBelt(const EQApplicationPacket *app)
m_pp.potionbelt.Items[mptbs->SlotNumber].ID = BaseItem->ID; m_pp.potionbelt.Items[mptbs->SlotNumber].ID = BaseItem->ID;
m_pp.potionbelt.Items[mptbs->SlotNumber].Icon = BaseItem->Icon; m_pp.potionbelt.Items[mptbs->SlotNumber].Icon = BaseItem->Icon;
strn0cpy(m_pp.potionbelt.Items[mptbs->SlotNumber].Name, BaseItem->Name, sizeof(BaseItem->Name)); strn0cpy(m_pp.potionbelt.Items[mptbs->SlotNumber].Name, BaseItem->Name, sizeof(BaseItem->Name));
database.SaveCharacterPotionBelt(this->CharacterID(), mptbs->SlotNumber, m_pp.potionbelt.Items[mptbs->SlotNumber].ID, m_pp.potionbelt.Items[mptbs->SlotNumber].Icon); database.SaveCharacterPotionBelt(CharacterID(), mptbs->SlotNumber, m_pp.potionbelt.Items[mptbs->SlotNumber].ID, m_pp.potionbelt.Items[mptbs->SlotNumber].Icon);
} }
} }
else { else {
@ -11225,7 +11225,7 @@ void Client::Handle_OP_PurchaseLeadershipAA(const EQApplicationPacket *app)
m_pp.raid_leadership_points -= cost; m_pp.raid_leadership_points -= cost;
m_pp.leader_abilities.ranks[aaid]++; m_pp.leader_abilities.ranks[aaid]++;
database.SaveCharacterLeadershipAA(this->CharacterID(), &m_pp); database.SaveCharacterLeadershipAA(CharacterID(), &m_pp);
} }
else { else {
//it is a group ability. //it is a group ability.
@ -11238,7 +11238,7 @@ void Client::Handle_OP_PurchaseLeadershipAA(const EQApplicationPacket *app)
m_pp.group_leadership_points -= cost; m_pp.group_leadership_points -= cost;
m_pp.leader_abilities.ranks[aaid]++; m_pp.leader_abilities.ranks[aaid]++;
database.SaveCharacterLeadershipAA(this->CharacterID(), &m_pp); database.SaveCharacterLeadershipAA(CharacterID(), &m_pp);
} }
//success, send them an update //success, send them an update
@ -13443,7 +13443,7 @@ void Client::Handle_OP_ShopRequest(const EQApplicationPacket *app)
return; return;
} }
if (tmp->IsEngaged()) { if (tmp->IsEngaged()) {
this->MessageString(Chat::White, MERCHANT_BUSY); MessageString(Chat::White, MERCHANT_BUSY);
action = 0; action = 0;
} }
if (GetFeigned() || IsInvisible()) if (GetFeigned() || IsInvisible())
@ -13565,7 +13565,7 @@ void Client::Handle_OP_SpawnAppearance(const EQApplicationPacket *app)
if (ClientVersion() < EQ::versions::ClientVersion::SoF) if (ClientVersion() < EQ::versions::ClientVersion::SoF)
{ {
auto hack_str = fmt::format("Player sent OP_SpawnAppearance with AT_Invis: {}", sa->parameter); auto hack_str = fmt::format("Player sent OP_SpawnAppearance with AT_Invis: {}", sa->parameter);
database.SetMQDetectionFlag(this->account_name, this->name, hack_str, zone->GetShortName()); database.SetMQDetectionFlag(account_name, name, hack_str, zone->GetShortName());
} }
} }
return; return;
@ -13665,7 +13665,7 @@ void Client::Handle_OP_SpawnAppearance(const EQApplicationPacket *app)
if (!HasSkill(EQ::skills::SkillSneak)) if (!HasSkill(EQ::skills::SkillSneak))
{ {
auto hack_str = fmt::format("Player sent OP_SpawnAppearance with AT_Sneak: {}", sa->parameter); auto hack_str = fmt::format("Player sent OP_SpawnAppearance with AT_Sneak: {}", sa->parameter);
database.SetMQDetectionFlag(this->account_name, this->name, hack_str, zone->GetShortName()); database.SetMQDetectionFlag(account_name, name, hack_str, zone->GetShortName());
} }
return; return;
} }
@ -13675,7 +13675,7 @@ void Client::Handle_OP_SpawnAppearance(const EQApplicationPacket *app)
else if (sa->type == AT_Size) else if (sa->type == AT_Size)
{ {
auto hack_str = fmt::format("Player sent OP_SpawnAppearance with AT_Size: {}", sa->parameter); auto hack_str = fmt::format("Player sent OP_SpawnAppearance with AT_Size: {}", sa->parameter);
database.SetMQDetectionFlag(this->account_name, this->name, hack_str, zone->GetShortName()); database.SetMQDetectionFlag(account_name, name, hack_str, zone->GetShortName());
} }
else if (sa->type == AT_Light) // client emitting light (lightstone, shiny shield) else if (sa->type == AT_Light) // client emitting light (lightstone, shiny shield)
{ {
@ -13842,11 +13842,11 @@ void Client::Handle_OP_SwapSpell(const EQApplicationPacket *app)
m_pp.spell_book[swapspell->to_slot] = swapspelltemp; m_pp.spell_book[swapspell->to_slot] = swapspelltemp;
/* Save Spell Swaps */ /* Save Spell Swaps */
if (!database.SaveCharacterSpell(this->CharacterID(), m_pp.spell_book[swapspell->from_slot], swapspell->from_slot)) { if (!database.SaveCharacterSpell(CharacterID(), m_pp.spell_book[swapspell->from_slot], swapspell->from_slot)) {
database.DeleteCharacterSpell(this->CharacterID(), m_pp.spell_book[swapspell->from_slot], swapspell->from_slot); database.DeleteCharacterSpell(CharacterID(), m_pp.spell_book[swapspell->from_slot], swapspell->from_slot);
} }
if (!database.SaveCharacterSpell(this->CharacterID(), swapspelltemp, swapspell->to_slot)) { if (!database.SaveCharacterSpell(CharacterID(), swapspelltemp, swapspell->to_slot)) {
database.DeleteCharacterSpell(this->CharacterID(), swapspelltemp, swapspell->to_slot); database.DeleteCharacterSpell(CharacterID(), swapspelltemp, swapspell->to_slot);
} }
QueuePacket(app); QueuePacket(app);
@ -14109,7 +14109,7 @@ void Client::Handle_OP_Taunt(const EQApplicationPacket *app)
std::cout << "Wrong size on OP_Taunt. Got: " << app->size << ", Expected: " << sizeof(ClientTarget_Struct) << std::endl; std::cout << "Wrong size on OP_Taunt. Got: " << app->size << ", Expected: " << sizeof(ClientTarget_Struct) << std::endl;
return; return;
} }
if (!HasSkill(EQ::skills::SkillTaunt)) { if (!HasSkill(EQ::skills::SkillTaunt)) {
return; return;
} }
@ -14206,7 +14206,7 @@ void Client::Handle_OP_TradeAcceptClick(const EQApplicationPacket *app)
if (CheckTradeLoreConflict(other) || other->CheckTradeLoreConflict(this)) { if (CheckTradeLoreConflict(other) || other->CheckTradeLoreConflict(this)) {
MessageString(Chat::Red, TRADE_CANCEL_LORE); MessageString(Chat::Red, TRADE_CANCEL_LORE);
other->MessageString(Chat::Red, TRADE_CANCEL_LORE); other->MessageString(Chat::Red, TRADE_CANCEL_LORE);
this->FinishTrade(this); FinishTrade(this);
other->FinishTrade(other); other->FinishTrade(other);
other->trade->Reset(); other->trade->Reset();
trade->Reset(); trade->Reset();
@ -14214,7 +14214,7 @@ void Client::Handle_OP_TradeAcceptClick(const EQApplicationPacket *app)
else if (CheckTradeNonDroppable()) { else if (CheckTradeNonDroppable()) {
MessageString(Chat::Red, TRADE_HAS_BEEN_CANCELLED); MessageString(Chat::Red, TRADE_HAS_BEEN_CANCELLED);
other->MessageString(Chat::Red, TRADE_HAS_BEEN_CANCELLED); other->MessageString(Chat::Red, TRADE_HAS_BEEN_CANCELLED);
this->FinishTrade(this); FinishTrade(this);
other->FinishTrade(other); other->FinishTrade(other);
other->trade->Reset(); other->trade->Reset();
trade->Reset(); trade->Reset();
@ -14224,7 +14224,7 @@ void Client::Handle_OP_TradeAcceptClick(const EQApplicationPacket *app)
else if (other->CheckTradeNonDroppable()) { else if (other->CheckTradeNonDroppable()) {
MessageString(Chat::Red, TRADE_HAS_BEEN_CANCELLED); MessageString(Chat::Red, TRADE_HAS_BEEN_CANCELLED);
other->MessageString(Chat::Red, TRADE_HAS_BEEN_CANCELLED); other->MessageString(Chat::Red, TRADE_HAS_BEEN_CANCELLED);
this->FinishTrade(this); FinishTrade(this);
other->FinishTrade(other); other->FinishTrade(other);
other->trade->Reset(); other->trade->Reset();
trade->Reset(); trade->Reset();
@ -14244,7 +14244,7 @@ void Client::Handle_OP_TradeAcceptClick(const EQApplicationPacket *app)
memset(&event_entry, 0, sizeof(QSPlayerLogTrade_Struct)); memset(&event_entry, 0, sizeof(QSPlayerLogTrade_Struct));
// Perform actual trade // Perform actual trade
this->FinishTrade(other, true, &event_entry, &event_details); FinishTrade(other, true, &event_entry, &event_details);
other->FinishTrade(this, false, &event_entry, &event_details); other->FinishTrade(this, false, &event_entry, &event_details);
event_entry._detail_count = event_details.size(); event_entry._detail_count = event_details.size();
@ -14275,7 +14275,7 @@ void Client::Handle_OP_TradeAcceptClick(const EQApplicationPacket *app)
// end QS code // end QS code
} }
else { else {
this->FinishTrade(other); FinishTrade(other);
other->FinishTrade(this); other->FinishTrade(this);
} }
@ -14285,7 +14285,7 @@ void Client::Handle_OP_TradeAcceptClick(const EQApplicationPacket *app)
// All done // All done
auto outapp = new EQApplicationPacket(OP_FinishTrade, 0); auto outapp = new EQApplicationPacket(OP_FinishTrade, 0);
other->QueuePacket(outapp); other->QueuePacket(outapp);
this->FastQueuePacket(&outapp); FastQueuePacket(&outapp);
} }
} }
// Trading with a Mob object that is not a Client. // Trading with a Mob object that is not a Client.
@ -14462,7 +14462,7 @@ void Client::Handle_OP_Trader(const EQApplicationPacket *app)
for (uint32 i = 0; i < max_items; i++) { for (uint32 i = 0; i < max_items; i++) {
if (database.GetItem(gis->Items[i])) { if (database.GetItem(gis->Items[i])) {
database.SaveTraderItem(this->CharacterID(), gis->Items[i], gis->SerialNumber[i], database.SaveTraderItem(CharacterID(), gis->Items[i], gis->SerialNumber[i],
gis->Charges[i], ints->ItemCost[i], i); gis->Charges[i], ints->ItemCost[i], i);
auto inst = FindTraderItemBySerialNumber(gis->SerialNumber[i]); auto inst = FindTraderItemBySerialNumber(gis->SerialNumber[i]);
@ -14477,7 +14477,7 @@ void Client::Handle_OP_Trader(const EQApplicationPacket *app)
} }
safe_delete(gis); safe_delete(gis);
this->Trader_StartTrader(); Trader_StartTrader();
// This refreshes the Trader window to display the End Trader button // This refreshes the Trader window to display the End Trader button
if (ClientVersion() >= EQ::versions::ClientVersion::RoF) if (ClientVersion() >= EQ::versions::ClientVersion::RoF)
@ -14671,7 +14671,7 @@ void Client::Handle_OP_TraderShop(const EQApplicationPacket *app)
if (outtcs->Approval) { if (outtcs->Approval) {
this->BulkSendTraderInventory(Trader->CharacterID()); BulkSendTraderInventory(Trader->CharacterID());
Trader->Trader_CustomerBrowsing(this); Trader->Trader_CustomerBrowsing(this);
TraderID = tcs->TraderID; TraderID = tcs->TraderID;
LogTrading("Client::Handle_OP_TraderShop: Trader Inventory Sent"); LogTrading("Client::Handle_OP_TraderShop: Trader Inventory Sent");

View File

@ -202,7 +202,7 @@ bool Client::Process() {
if (heroforge_wearchange_timer.Check()) { if (heroforge_wearchange_timer.Check()) {
/* /*
This addresses bug where on zone in heroforge models would not be sent to other clients when this was This addresses bug where on zone in heroforge models would not be sent to other clients when this was
in Client::CompleteConnect(). Sending after a small 250 ms delay after that function resolves the issue. in Client::CompleteConnect(). Sending after a small 250 ms delay after that function resolves the issue.
Unclear the underlying reason for this, if a better solution can be found then can move this back. Unclear the underlying reason for this, if a better solution can be found then can move this back.
*/ */
if (queue_wearchange_slot >= 0) { //Resend slot from Client::SwapItem if heroforge item is swapped. if (queue_wearchange_slot >= 0) { //Resend slot from Client::SwapItem if heroforge item is swapped.
@ -542,7 +542,7 @@ bool Client::Process() {
if (client_state == DISCONNECTED) { if (client_state == DISCONNECTED) {
OnDisconnect(true); OnDisconnect(true);
std::cout << "Client disconnected (cs=d): " << GetName() << std::endl; std::cout << "Client disconnected (cs=d): " << GetName() << std::endl;
database.SetMQDetectionFlag(this->AccountName(), GetName(), "/MQInstantCamp: Possible instant camp disconnect.", zone->GetShortName()); database.SetMQDetectionFlag(AccountName(), GetName(), "/MQInstantCamp: Possible instant camp disconnect.", zone->GetShortName());
return false; return false;
} }
@ -696,8 +696,8 @@ void Client::OnDisconnect(bool hard_disconnect) {
/* QS: PlayerLogConnectDisconnect */ /* QS: PlayerLogConnectDisconnect */
if (RuleB(QueryServ, PlayerLogConnectDisconnect)){ if (RuleB(QueryServ, PlayerLogConnectDisconnect)){
std::string event_desc = StringFormat("Disconnect :: in zoneid:%i instid:%i", this->GetZoneID(), this->GetInstanceID()); std::string event_desc = StringFormat("Disconnect :: in zoneid:%i instid:%i", GetZoneID(), GetInstanceID());
QServ->PlayerLogEvent(Player_Log_Connect_State, this->CharacterID(), event_desc); QServ->PlayerLogEvent(Player_Log_Connect_State, CharacterID(), event_desc);
} }
} }
@ -953,9 +953,9 @@ void Client::BulkSendMerchantInventory(int merchant_id, int npcid) {
sprintf(handy_id, "%i", greet_id); sprintf(handy_id, "%i", greet_id);
if (greet_id != MERCHANT_GREETING) if (greet_id != MERCHANT_GREETING)
MessageString(Chat::NPCQuestSay, GENERIC_STRINGID_SAY, merch->GetCleanName(), handy_id, this->GetName(), handyitem->Name); MessageString(Chat::NPCQuestSay, GENERIC_STRINGID_SAY, merch->GetCleanName(), handy_id, GetName(), handyitem->Name);
else else
MessageString(Chat::NPCQuestSay, GENERIC_STRINGID_SAY, merch->GetCleanName(), handy_id, this->GetName()); MessageString(Chat::NPCQuestSay, GENERIC_STRINGID_SAY, merch->GetCleanName(), handy_id, GetName());
} }
// safe_delete_array(cpi); // safe_delete_array(cpi);
@ -1001,7 +1001,7 @@ void Client::OPRezzAnswer(uint32 Action, uint32 SpellID, uint16 ZoneID, uint16 I
// corpse is in has shutdown since the rez spell was cast. // corpse is in has shutdown since the rez spell was cast.
database.MarkCorpseAsRezzed(PendingRezzDBID); database.MarkCorpseAsRezzed(PendingRezzDBID);
LogSpells("Player [{}] got a [{}] Rezz, spellid [{}] in zone[{}], instance id [{}]", LogSpells("Player [{}] got a [{}] Rezz, spellid [{}] in zone[{}], instance id [{}]",
this->name, (uint16)spells[SpellID].base_value[0], name, (uint16)spells[SpellID].base_value[0],
SpellID, ZoneID, InstanceID); SpellID, ZoneID, InstanceID);
BuffFadeNonPersistDeath(); BuffFadeNonPersistDeath();
@ -1017,7 +1017,7 @@ void Client::OPRezzAnswer(uint32 Action, uint32 SpellID, uint16 ZoneID, uint16 I
GetRace() == DWARF || GetRace() == DWARF ||
GetRace() == TROLL || GetRace() == TROLL ||
GetRace() == OGRE GetRace() == OGRE
) ? ) ?
RuleI(Character, OldResurrectionSicknessSpellID) : RuleI(Character, OldResurrectionSicknessSpellID) :
RuleI(Character, ResurrectionSicknessSpellID) RuleI(Character, ResurrectionSicknessSpellID)
); );
@ -1049,7 +1049,7 @@ void Client::OPTGB(const EQApplicationPacket *app)
{ {
if(!app) return; if(!app) return;
if(!app->pBuffer) return; if(!app->pBuffer) return;
if(!RuleB(Character, EnableTGB)) if(!RuleB(Character, EnableTGB))
{ {
return; return;
@ -1451,12 +1451,12 @@ void Client::OPMoveCoin(const EQApplicationPacket* app)
} }
else{ else{
if (to_bucket == &m_pp.platinum_shared || from_bucket == &m_pp.platinum_shared){ if (to_bucket == &m_pp.platinum_shared || from_bucket == &m_pp.platinum_shared){
this->SendPopupToClient( SendPopupToClient(
"Shared Bank Warning", "Shared Bank Warning",
"<c \"#F62217\">::: WARNING! :::<br>" "<c \"#F62217\">::: WARNING! :::<br>"
"SHARED BANK IS DISABLED AND YOUR PLATINUM WILL BE DESTROYED IF YOU PUT IT HERE!</c>" "SHARED BANK IS DISABLED AND YOUR PLATINUM WILL BE DESTROYED IF YOU PUT IT HERE!</c>"
); );
this->Message(Chat::Red, "::: WARNING! ::: SHARED BANK IS DISABLED AND YOUR PLATINUM WILL BE DESTROYED IF YOU PUT IT HERE!"); Message(Chat::Red, "::: WARNING! ::: SHARED BANK IS DISABLED AND YOUR PLATINUM WILL BE DESTROYED IF YOU PUT IT HERE!");
} }
} }
} }
@ -1759,10 +1759,10 @@ void Client::OPGMSummon(const EQApplicationPacket *app)
if(st) if(st)
{ {
Message(0, "Local: Summoning %s to %f, %f, %f", gms->charname, gms->x, gms->y, gms->z); Message(0, "Local: Summoning %s to %f, %f, %f", gms->charname, gms->x, gms->y, gms->z);
if (st->IsClient() && (st->CastToClient()->GetAnon() != 1 || this->Admin() >= st->CastToClient()->Admin())) if (st->IsClient() && (st->CastToClient()->GetAnon() != 1 || Admin() >= st->CastToClient()->Admin()))
st->CastToClient()->MovePC(zone->GetZoneID(), zone->GetInstanceID(), (float)gms->x, (float)gms->y, (float)gms->z, this->GetHeading(), true); st->CastToClient()->MovePC(zone->GetZoneID(), zone->GetInstanceID(), (float)gms->x, (float)gms->y, (float)gms->z, GetHeading(), true);
else else
st->GMMove(this->GetX(), this->GetY(), this->GetZ(),this->GetHeading()); st->GMMove(GetX(), GetY(), GetZ(),GetHeading());
} }
else else
{ {
@ -1775,8 +1775,8 @@ void Client::OPGMSummon(const EQApplicationPacket *app)
{ {
auto pack = new ServerPacket(ServerOP_ZonePlayer, sizeof(ServerZonePlayer_Struct)); auto pack = new ServerPacket(ServerOP_ZonePlayer, sizeof(ServerZonePlayer_Struct));
ServerZonePlayer_Struct* szp = (ServerZonePlayer_Struct*) pack->pBuffer; ServerZonePlayer_Struct* szp = (ServerZonePlayer_Struct*) pack->pBuffer;
strcpy(szp->adminname, this->GetName()); strcpy(szp->adminname, GetName());
szp->adminrank = this->Admin(); szp->adminrank = Admin();
strcpy(szp->name, gms->charname); strcpy(szp->name, gms->charname);
strcpy(szp->zone, zone->GetShortName()); strcpy(szp->zone, zone->GetShortName());
szp->x_pos = (float)gms->x; szp->x_pos = (float)gms->x;

View File

@ -201,7 +201,7 @@ Corpse::Corpse(NPC* in_npc, ItemList* in_itemlist, uint32 in_npctypeid, const NP
for (int i = 0; i < MAX_LOOTERS; i++){ for (int i = 0; i < MAX_LOOTERS; i++){
allowed_looters[i] = 0; allowed_looters[i] = 0;
} }
this->rez_experience = 0; rez_experience = 0;
UpdateEquipmentLight(); UpdateEquipmentLight();
UpdateActiveLight(); UpdateActiveLight();
@ -529,10 +529,10 @@ false),
strcpy(corpse_name, in_charname); strcpy(corpse_name, in_charname);
strcpy(name, in_charname); strcpy(name, in_charname);
this->copper = in_copper; copper = in_copper;
this->silver = in_silver; silver = in_silver;
this->gold = in_gold; gold = in_gold;
this->platinum = in_plat; platinum = in_plat;
rez_experience = in_rezexp; rez_experience = in_rezexp;
@ -584,25 +584,25 @@ bool Corpse::Save() {
if (!is_corpse_changed) if (!is_corpse_changed)
return true; return true;
uint32 tmp = this->CountItems(); uint32 tmp = CountItems();
uint32 tmpsize = sizeof(PlayerCorpse_Struct) + (tmp * sizeof(player_lootitem::ServerLootItem_Struct)); uint32 tmpsize = sizeof(PlayerCorpse_Struct) + (tmp * sizeof(player_lootitem::ServerLootItem_Struct));
PlayerCorpse_Struct* dbpc = (PlayerCorpse_Struct*) new uchar[tmpsize]; PlayerCorpse_Struct* dbpc = (PlayerCorpse_Struct*) new uchar[tmpsize];
memset(dbpc, 0, tmpsize); memset(dbpc, 0, tmpsize);
dbpc->itemcount = tmp; dbpc->itemcount = tmp;
dbpc->size = this->size; dbpc->size = size;
dbpc->locked = is_locked; dbpc->locked = is_locked;
dbpc->copper = this->copper; dbpc->copper = copper;
dbpc->silver = this->silver; dbpc->silver = silver;
dbpc->gold = this->gold; dbpc->gold = gold;
dbpc->plat = this->platinum; dbpc->plat = platinum;
dbpc->race = this->race; dbpc->race = race;
dbpc->class_ = class_; dbpc->class_ = class_;
dbpc->gender = gender; dbpc->gender = gender;
dbpc->deity = deity; dbpc->deity = deity;
dbpc->level = level; dbpc->level = level;
dbpc->texture = this->texture; dbpc->texture = texture;
dbpc->helmtexture = this->helmtexture; dbpc->helmtexture = helmtexture;
dbpc->exp = rez_experience; dbpc->exp = rez_experience;
memcpy(&dbpc->item_tint.Slot, &item_tint.Slot, sizeof(dbpc->item_tint)); memcpy(&dbpc->item_tint.Slot, &item_tint.Slot, sizeof(dbpc->item_tint));
@ -831,18 +831,18 @@ void Corpse::RemoveItemByID(uint32 item_id, int quantity) {
} }
void Corpse::SetCash(uint32 in_copper, uint32 in_silver, uint32 in_gold, uint32 in_platinum) { void Corpse::SetCash(uint32 in_copper, uint32 in_silver, uint32 in_gold, uint32 in_platinum) {
this->copper = in_copper; copper = in_copper;
this->silver = in_silver; silver = in_silver;
this->gold = in_gold; gold = in_gold;
this->platinum = in_platinum; platinum = in_platinum;
is_corpse_changed = true; is_corpse_changed = true;
} }
void Corpse::RemoveCash() { void Corpse::RemoveCash() {
this->copper = 0; copper = 0;
this->silver = 0; silver = 0;
this->gold = 0; gold = 0;
this->platinum = 0; platinum = 0;
is_corpse_changed = true; is_corpse_changed = true;
} }
@ -892,10 +892,10 @@ bool Corpse::Process() {
Save(); Save();
player_corpse_depop = true; player_corpse_depop = true;
corpse_db_id = 0; corpse_db_id = 0;
LogDebug("Tagged [{}] player corpse has buried", this->GetName()); LogDebug("Tagged [{}] player corpse has buried", GetName());
} }
else { else {
LogError("Unable to bury [{}] player corpse", this->GetName()); LogError("Unable to bury [{}] player corpse", GetName());
return true; return true;
} }
} }
@ -1302,7 +1302,7 @@ void Corpse::LootItem(Client *client, const EQApplicationPacket *app)
} }
} }
} }
if (parse->EventPlayer(EVENT_LOOT, client, export_string, 0, &args) != 0) { if (parse->EventPlayer(EVENT_LOOT, client, export_string, 0, &args) != 0) {
prevent_loot = true; prevent_loot = true;
} }
@ -1323,14 +1323,14 @@ void Corpse::LootItem(Client *client, const EQApplicationPacket *app)
if (parse->EventItem(EVENT_LOOT, client, inst, this, export_string, 0) != 0) { if (parse->EventItem(EVENT_LOOT, client, inst, this, export_string, 0) != 0) {
prevent_loot = true; prevent_loot = true;
} }
if (prevent_loot) { if (prevent_loot) {
lootitem->auto_loot = -1; lootitem->auto_loot = -1;
client->QueuePacket(app); client->QueuePacket(app);
safe_delete(inst); safe_delete(inst);
return; return;
} }
// safe to ACK now // safe to ACK now
client->QueuePacket(app); client->QueuePacket(app);
@ -1366,7 +1366,7 @@ void Corpse::LootItem(Client *client, const EQApplicationPacket *app)
if (item_data) { if (item_data) {
/* Delete needs to be before RemoveItem because its deletes the pointer for /* Delete needs to be before RemoveItem because its deletes the pointer for
* item_data/bag_item_data */ * item_data/bag_item_data */
database.DeleteItemOffCharacterCorpse(this->corpse_db_id, item_data->equip_slot, database.DeleteItemOffCharacterCorpse(corpse_db_id, item_data->equip_slot,
item_data->item_id); item_data->item_id);
/* Delete Item Instance */ /* Delete Item Instance */
RemoveItem(item_data->lootslot); RemoveItem(item_data->lootslot);
@ -1378,7 +1378,7 @@ void Corpse::LootItem(Client *client, const EQApplicationPacket *app)
if (bag_item_data[i]) { if (bag_item_data[i]) {
/* Delete needs to be before RemoveItem because its deletes the pointer for /* Delete needs to be before RemoveItem because its deletes the pointer for
* item_data/bag_item_data */ * item_data/bag_item_data */
database.DeleteItemOffCharacterCorpse(this->corpse_db_id, database.DeleteItemOffCharacterCorpse(corpse_db_id,
bag_item_data[i]->equip_slot, bag_item_data[i]->equip_slot,
bag_item_data[i]->item_id); bag_item_data[i]->item_id);
/* Delete Item Instance */ /* Delete Item Instance */
@ -1438,8 +1438,8 @@ void Corpse::EndLoot(Client* client, const EQApplicationPacket* app) {
client->QueuePacket(outapp); client->QueuePacket(outapp);
safe_delete(outapp); safe_delete(outapp);
this->being_looted_by = 0xFFFFFFFF; being_looted_by = 0xFFFFFFFF;
if (this->IsEmpty()) if (IsEmpty())
Delete(); Delete();
else else
Save(); Save();
@ -1547,7 +1547,7 @@ bool Corpse::HasItem(uint32 item_id) {
if (loot_item->item_id == item_id) { if (loot_item->item_id == item_id) {
return true; return true;
} }
} }
return false; return false;
} }
@ -1599,7 +1599,7 @@ uint16 Corpse::GetFirstSlotByItemID(uint32 item_id) {
bool Corpse::Summon(Client* client, bool spell, bool CheckDistance) { bool Corpse::Summon(Client* client, bool spell, bool CheckDistance) {
uint32 dist2 = 10000; // pow(100, 2); uint32 dist2 = 10000; // pow(100, 2);
if (!spell) { if (!spell) {
if (this->GetCharID() == client->CharacterID()) { if (GetCharID() == client->CharacterID()) {
if (IsLocked() && client->Admin() < AccountStatus::GMAdmin) { if (IsLocked() && client->Admin() < AccountStatus::GMAdmin) {
client->Message(Chat::Red, "That corpse is locked by a GM."); client->Message(Chat::Red, "That corpse is locked by a GM.");
return false; return false;
@ -1668,12 +1668,12 @@ bool Corpse::Summon(Client* client, bool spell, bool CheckDistance) {
void Corpse::CompleteResurrection(){ void Corpse::CompleteResurrection(){
rez_experience = 0; rez_experience = 0;
is_corpse_changed = true; is_corpse_changed = true;
this->Save(); Save();
} }
void Corpse::Spawn() { void Corpse::Spawn() {
auto app = new EQApplicationPacket; auto app = new EQApplicationPacket;
this->CreateSpawnPacket(app, this); CreateSpawnPacket(app, this);
entity_list.QueueClients(this, app); entity_list.QueueClients(this, app);
safe_delete(app); safe_delete(app);
} }
@ -1833,7 +1833,7 @@ std::vector<int> Corpse::GetLootList() {
if (std::find(corpse_items.begin(), corpse_items.end(), loot_item->item_id) != corpse_items.end()) { if (std::find(corpse_items.begin(), corpse_items.end(), loot_item->item_id) != corpse_items.end()) {
continue; continue;
} }
corpse_items.push_back(loot_item->item_id); corpse_items.push_back(loot_item->item_id);
} }
return corpse_items; return corpse_items;

View File

@ -85,25 +85,25 @@ Doors::Doors(const char *model, const glm::vec4 &position, uint8 open_type, uint
strn0cpy(door_name, model, 32); strn0cpy(door_name, model, 32);
strn0cpy(destination_zone_name, "NONE", 32); strn0cpy(destination_zone_name, "NONE", 32);
this->database_id = (uint32) content_db.GetDoorsCountPlusOne(zone->GetShortName(), zone->GetInstanceVersion()); database_id = (uint32) content_db.GetDoorsCountPlusOne(zone->GetShortName(), zone->GetInstanceVersion());
this->door_id = (uint8) content_db.GetDoorsDBCountPlusOne(zone->GetShortName(), zone->GetInstanceVersion()); door_id = (uint8) content_db.GetDoorsDBCountPlusOne(zone->GetShortName(), zone->GetInstanceVersion());
this->open_type = open_type; open_type = open_type;
this->size = size; size = size;
this->incline = 0; incline = 0;
this->guild_id = 0; guild_id = 0;
this->lockpick = 0; lockpick = 0;
this->key_item_id = 0; key_item_id = 0;
this->no_key_ring = 0; no_key_ring = 0;
this->trigger_door = 0; trigger_door = 0;
this->trigger_type = 0; trigger_type = 0;
this->triggered = false; triggered = false;
this->door_param = 0; door_param = 0;
this->invert_state = 0; invert_state = 0;
this->is_ldon_door = 0; is_ldon_door = 0;
this->client_version_mask = 4294967295u; client_version_mask = 4294967295u;
this->disable_timer = 0; disable_timer = 0;
this->destination_instance_id = 0; destination_instance_id = 0;
SetOpenState(false); SetOpenState(false);
close_timer.Disable(); close_timer.Disable();
@ -137,30 +137,30 @@ void Doors::HandleClick(Client* sender, uint8 trigger) {
Log(Logs::Detail, Logs::Doors, Log(Logs::Detail, Logs::Doors,
"%s clicked door %s (dbid %d, eqid %d) at %s", "%s clicked door %s (dbid %d, eqid %d) at %s",
sender->GetName(), sender->GetName(),
this->door_name, door_name,
this->database_id, database_id,
this->door_id, door_id,
to_string(m_Position).c_str() to_string(m_Position).c_str()
); );
Log(Logs::Detail, Logs::Doors, Log(Logs::Detail, Logs::Doors,
"incline %d, open_type %d, lockpick %d, key %d, nokeyring %d, trigger %d type %d, param %d", "incline %d, open_type %d, lockpick %d, key %d, nokeyring %d, trigger %d type %d, param %d",
this->incline, incline,
this->open_type, open_type,
this->lockpick, lockpick,
this->key_item_id, key_item_id,
this->no_key_ring, no_key_ring,
this->trigger_door, trigger_door,
this->trigger_type, trigger_type,
this->door_param door_param
); );
Log(Logs::Detail, Logs::Doors, Log(Logs::Detail, Logs::Doors,
"disable_timer '%s',size %d, invert %d, dest: %s %s", "disable_timer '%s',size %d, invert %d, dest: %s %s",
(this->disable_timer ? "true" : "false"), (disable_timer ? "true" : "false"),
this->size, size,
this->invert_state, invert_state,
this->destination_zone_name, destination_zone_name,
to_string(m_Destination).c_str() to_string(m_Destination).c_str()
); );
@ -168,7 +168,7 @@ void Doors::HandleClick(Client* sender, uint8 trigger) {
auto *move_door_packet = (MoveDoor_Struct *) outapp->pBuffer; auto *move_door_packet = (MoveDoor_Struct *) outapp->pBuffer;
move_door_packet->doorid = door_id; move_door_packet->doorid = door_id;
if (this->IsLDoNDoor()) { if (IsLDoNDoor()) {
if (sender) { if (sender) {
if (RuleI(Adventure, ItemIDToEnablePorts) != 0) { if (RuleI(Adventure, ItemIDToEnablePorts) != 0) {
if (!sender->KeyRingCheck(RuleI(Adventure, ItemIDToEnablePorts))) { if (!sender->KeyRingCheck(RuleI(Adventure, ItemIDToEnablePorts))) {
@ -197,7 +197,7 @@ void Doors::HandleClick(Client* sender, uint8 trigger) {
strcpy(adventure_door_click->player, sender->GetName()); strcpy(adventure_door_click->player, sender->GetName());
adventure_door_click->zone_id = zone->GetZoneID(); adventure_door_click->zone_id = zone->GetZoneID();
adventure_door_click->id = this->GetDoorDBID(); adventure_door_click->id = GetDoorDBID();
worldserver.SendPacket(pack); worldserver.SendPacket(pack);
safe_delete(pack); safe_delete(pack);
@ -234,13 +234,13 @@ void Doors::HandleClick(Client* sender, uint8 trigger) {
/** /**
* Object is not triggered * Object is not triggered
*/ */
if (this->GetTriggerType() == 255) { if (GetTriggerType() == 255) {
/** /**
* Door is only triggered by an object * Door is only triggered by an object
*/ */
if (trigger == 1) { if (trigger == 1) {
if (!this->IsDoorOpen() || (open_type == 58)) { if (!IsDoorOpen() || (open_type == 58)) {
move_door_packet->action = static_cast<uint8>(invert_state == 0 ? OPEN_DOOR : OPEN_INVDOOR); move_door_packet->action = static_cast<uint8>(invert_state == 0 ? OPEN_DOOR : OPEN_INVDOOR);
} else { } else {
move_door_packet->action = static_cast<uint8>(invert_state == 0 ? CLOSE_DOOR : CLOSE_INVDOOR); move_door_packet->action = static_cast<uint8>(invert_state == 0 ? CLOSE_DOOR : CLOSE_INVDOOR);
@ -256,12 +256,12 @@ void Doors::HandleClick(Client* sender, uint8 trigger) {
* *
* Door is not locked * Door is not locked
*/ */
bool is_guild_door = (this->GetGuildID() > 0) && (this->GetGuildID() == sender->GuildID()); bool is_guild_door = (GetGuildID() > 0) && (GetGuildID() == sender->GuildID());
bool is_door_not_locked = ((required_key_item == 0) && (this->GetLockpick() == 0) && (this->GetGuildID() == 0)); bool is_door_not_locked = ((required_key_item == 0) && (GetLockpick() == 0) && (GetGuildID() == 0));
bool is_door_open_and_open_able = (this->IsDoorOpen() && (open_type == 58)); bool is_door_open_and_open_able = (IsDoorOpen() && (open_type == 58));
if (is_door_not_locked || is_door_open_and_open_able || is_guild_door) { if (is_door_not_locked || is_door_open_and_open_able || is_guild_door) {
if (!this->IsDoorOpen() || (this->GetOpenType() == 58)) { if (!IsDoorOpen() || (GetOpenType() == 58)) {
move_door_packet->action = static_cast<uint8>(invert_state == 0 ? OPEN_DOOR : OPEN_INVDOOR); move_door_packet->action = static_cast<uint8>(invert_state == 0 ? OPEN_DOOR : OPEN_INVDOOR);
} else { } else {
move_door_packet->action = static_cast<uint8>(invert_state == 0 ? CLOSE_DOOR : CLOSE_INVDOOR); move_door_packet->action = static_cast<uint8>(invert_state == 0 ? CLOSE_DOOR : CLOSE_INVDOOR);
@ -271,7 +271,7 @@ void Doors::HandleClick(Client* sender, uint8 trigger) {
/** /**
* Guild Doors * Guild Doors
*/ */
if ((this->GetGuildID() > 0) && !sender->GetGM()) { if ((GetGuildID() > 0) && !sender->GetGM()) {
std::string guild_name; std::string guild_name;
char door_message[240]; char door_message[240];
@ -407,7 +407,7 @@ void Doors::HandleClick(Client* sender, uint8 trigger) {
if (!IsDoorOpen() || (open_type == 58)) { if (!IsDoorOpen() || (open_type == 58)) {
if (!disable_timer) if (!disable_timer)
close_timer.Start(); close_timer.Start();
if(strncmp(destination_zone_name, "NONE", strlen("NONE")) == 0) if(strncmp(destination_zone_name, "NONE", strlen("NONE")) == 0)
SetOpenState(true); SetOpenState(true);
} else { } else {
@ -515,7 +515,7 @@ void Doors::HandleClick(Client* sender, uint8 trigger) {
} else { } else {
sender->MovePC( sender->MovePC(
ZoneID(destination_zone_name), ZoneID(destination_zone_name),
static_cast<uint32>(this->destination_instance_id), static_cast<uint32>(destination_instance_id),
m_Destination.x, m_Destination.x,
m_Destination.y, m_Destination.y,
m_Destination.z, m_Destination.z,

View File

@ -196,7 +196,7 @@ int32 Mob::GetActDoTDamage(uint16 spell_id, int32 value, Mob* target, bool from_
if (target == nullptr) if (target == nullptr)
return value; return value;
if (IsNPC()) { if (IsNPC()) {
value += value * CastToNPC()->GetSpellFocusDMG() / 100; value += value * CastToNPC()->GetSpellFocusDMG() / 100;
} }
@ -226,7 +226,7 @@ int32 Mob::GetActDoTDamage(uint16 spell_id, int32 value, Mob* target, bool from_
GetFocusEffect(focusFcDamageAmt, spell_id, nullptr, from_buff_tic) + GetFocusEffect(focusFcDamageAmt, spell_id, nullptr, from_buff_tic) +
GetFocusEffect(focusFcDamageAmt2, spell_id, nullptr, from_buff_tic) + GetFocusEffect(focusFcDamageAmt2, spell_id, nullptr, from_buff_tic) +
GetFocusEffect(focusFcAmplifyAmt, spell_id, nullptr, from_buff_tic); GetFocusEffect(focusFcAmplifyAmt, spell_id, nullptr, from_buff_tic);
if (RuleB(Spells, DOTsScaleWithSpellDmg)) { if (RuleB(Spells, DOTsScaleWithSpellDmg)) {
if (RuleB(Spells, IgnoreSpellDmgLvlRestriction) && !spells[spell_id].no_heal_damage_item_mod && itembonuses.SpellDmg) { if (RuleB(Spells, IgnoreSpellDmgLvlRestriction) && !spells[spell_id].no_heal_damage_item_mod && itembonuses.SpellDmg) {
extra_dmg += GetExtraSpellAmt(spell_id, itembonuses.SpellDmg, base_value)*ratio/100; extra_dmg += GetExtraSpellAmt(spell_id, itembonuses.SpellDmg, base_value)*ratio/100;
@ -257,7 +257,7 @@ int32 Mob::GetActDoTDamage(uint16 spell_id, int32 value, Mob* target, bool from_
GetFocusEffect(focusFcDamageAmt, spell_id, nullptr, from_buff_tic) + GetFocusEffect(focusFcDamageAmt, spell_id, nullptr, from_buff_tic) +
GetFocusEffect(focusFcDamageAmt2, spell_id, nullptr, from_buff_tic) + GetFocusEffect(focusFcDamageAmt2, spell_id, nullptr, from_buff_tic) +
GetFocusEffect(focusFcAmplifyAmt, spell_id, nullptr, from_buff_tic); GetFocusEffect(focusFcAmplifyAmt, spell_id, nullptr, from_buff_tic);
if (RuleB(Spells, DOTsScaleWithSpellDmg)) { if (RuleB(Spells, DOTsScaleWithSpellDmg)) {
if (RuleB(Spells, IgnoreSpellDmgLvlRestriction) && !spells[spell_id].no_heal_damage_item_mod && itembonuses.SpellDmg) { if (RuleB(Spells, IgnoreSpellDmgLvlRestriction) && !spells[spell_id].no_heal_damage_item_mod && itembonuses.SpellDmg) {
extra_dmg += GetExtraSpellAmt(spell_id, itembonuses.SpellDmg, base_value); extra_dmg += GetExtraSpellAmt(spell_id, itembonuses.SpellDmg, base_value);
@ -422,7 +422,7 @@ int32 Mob::GetActSpellHealing(uint16 spell_id, int32 value, Mob* target, bool fr
extra_heal += GetExtraSpellAmt(spell_id, itembonuses.HealAmt, base_value); extra_heal += GetExtraSpellAmt(spell_id, itembonuses.HealAmt, base_value);
} }
} }
if (extra_heal) { if (extra_heal) {
int duration = CalcBuffDuration(this, target, spell_id); int duration = CalcBuffDuration(this, target, spell_id);
if (duration > 0) { if (duration > 0) {
@ -602,7 +602,7 @@ bool Client::TrainDiscipline(uint32 itemid) {
return(false); return(false);
} else if(m_pp.disciplines.values[r] == 0) { } else if(m_pp.disciplines.values[r] == 0) {
m_pp.disciplines.values[r] = spell_id; m_pp.disciplines.values[r] = spell_id;
database.SaveCharacterDisc(this->CharacterID(), r, spell_id); database.SaveCharacterDisc(CharacterID(), r, spell_id);
SendDisciplineUpdate(); SendDisciplineUpdate();
Message(0, "You have learned a new discipline!"); Message(0, "You have learned a new discipline!");
return(true); return(true);
@ -702,7 +702,7 @@ void Client::TrainDiscBySpellID(int32 spell_id)
for(i = 0; i < MAX_PP_DISCIPLINES; i++) { for(i = 0; i < MAX_PP_DISCIPLINES; i++) {
if(m_pp.disciplines.values[i] == 0) { if(m_pp.disciplines.values[i] == 0) {
m_pp.disciplines.values[i] = spell_id; m_pp.disciplines.values[i] = spell_id;
database.SaveCharacterDisc(this->CharacterID(), i, spell_id); database.SaveCharacterDisc(CharacterID(), i, spell_id);
SendDisciplineUpdate(); SendDisciplineUpdate();
Message(Chat::Yellow, "You have learned a new combat ability!"); Message(Chat::Yellow, "You have learned a new combat ability!");
return; return;
@ -733,9 +733,9 @@ void Client::SendDisciplineUpdate() {
bool Client::UseDiscipline(uint32 spell_id, uint32 target) { bool Client::UseDiscipline(uint32 spell_id, uint32 target) {
// Dont let client waste a reuse timer if they can't use the disc // Dont let client waste a reuse timer if they can't use the disc
if ((IsStunned() && !IgnoreCastingRestriction(spell_id))|| if ((IsStunned() && !IgnoreCastingRestriction(spell_id))||
IsFeared() || IsFeared() ||
(IsMezzed() && !IgnoreCastingRestriction(spell_id)) || (IsMezzed() && !IgnoreCastingRestriction(spell_id)) ||
IsAmnesiad() || IsAmnesiad() ||
IsPet()) IsPet())
{ {
if (IsAmnesiad()) { if (IsAmnesiad()) {

View File

@ -328,7 +328,7 @@ void Client::CalculateStandardAAExp(uint32 &add_aaxp, uint8 conlevel, bool resex
} }
if (RuleB(Character, EnableCharacterEXPMods)) { if (RuleB(Character, EnableCharacterEXPMods)) {
add_aaxp *= GetAAEXPModifier(this->GetZoneID()); add_aaxp *= GetAAEXPModifier(GetZoneID());
} }
add_aaxp = (uint32)(RuleR(Character, AAExpMultiplier) * add_aaxp * aatotalmod); add_aaxp = (uint32)(RuleR(Character, AAExpMultiplier) * add_aaxp * aatotalmod);
@ -491,7 +491,7 @@ void Client::CalculateExp(uint32 in_add_exp, uint32 &add_exp, uint32 &add_aaxp,
} }
if (RuleB(Character, EnableCharacterEXPMods)) { if (RuleB(Character, EnableCharacterEXPMods)) {
add_exp *= GetEXPModifier(this->GetZoneID()); add_exp *= GetEXPModifier(GetZoneID());
} }
add_exp = GetEXP() + add_exp; add_exp = GetEXP() + add_exp;
@ -499,7 +499,7 @@ void Client::CalculateExp(uint32 in_add_exp, uint32 &add_exp, uint32 &add_aaxp,
void Client::AddEXP(uint32 in_add_exp, uint8 conlevel, bool resexp) { void Client::AddEXP(uint32 in_add_exp, uint8 conlevel, bool resexp) {
this->EVENT_ITEM_ScriptStopReturn(); EVENT_ITEM_ScriptStopReturn();
uint32 exp = 0; uint32 exp = 0;
uint32 aaexp = 0; uint32 aaexp = 0;
@ -552,7 +552,7 @@ void Client::AddEXP(uint32 in_add_exp, uint8 conlevel, bool resexp) {
} }
void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) { void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) {
LogDebug("Attempting to Set Exp for [{}] (XP: [{}], AAXP: [{}], Rez: [{}])", this->GetCleanName(), set_exp, set_aaxp, isrezzexp ? "true" : "false"); LogDebug("Attempting to Set Exp for [{}] (XP: [{}], AAXP: [{}], Rez: [{}])", GetCleanName(), set_exp, set_aaxp, isrezzexp ? "true" : "false");
auto max_AAXP = GetRequiredAAExperience(); auto max_AAXP = GetRequiredAAExperience();
if (max_AAXP == 0 || GetEXPForLevel(GetLevel()) == 0xFFFFFFFF) { if (max_AAXP == 0 || GetEXPForLevel(GetLevel()) == 0xFFFFFFFF) {
@ -671,7 +671,7 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) {
//figure out how many AA points we get from the exp were setting //figure out how many AA points we get from the exp were setting
m_pp.aapoints = set_aaxp / max_AAXP; m_pp.aapoints = set_aaxp / max_AAXP;
LogDebug("Calculating additional AA Points from AAXP for [{}]: [{}] / [{}] = [{}] points", this->GetCleanName(), set_aaxp, max_AAXP, (float)set_aaxp / (float)max_AAXP); LogDebug("Calculating additional AA Points from AAXP for [{}]: [{}] / [{}] = [{}] points", GetCleanName(), set_aaxp, max_AAXP, (float)set_aaxp / (float)max_AAXP);
//get remainder exp points, set in PP below //get remainder exp points, set in PP below
set_aaxp = set_aaxp - (max_AAXP * m_pp.aapoints); set_aaxp = set_aaxp - (max_AAXP * m_pp.aapoints);
@ -691,7 +691,7 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) {
MessageString(Chat::Experience, GAIN_SINGLE_AA_MULTI_AA, ConvertArray(m_pp.aapoints, val1)); //You have gained an ability point! You now have %1 ability points. MessageString(Chat::Experience, GAIN_SINGLE_AA_MULTI_AA, ConvertArray(m_pp.aapoints, val1)); //You have gained an ability point! You now have %1 ability points.
else else
MessageString(Chat::Experience, GAIN_MULTI_AA_MULTI_AA, ConvertArray(gained, val1), ConvertArray(m_pp.aapoints, val2)); //You have gained %1 ability point(s)! You now have %2 ability point(s). MessageString(Chat::Experience, GAIN_MULTI_AA_MULTI_AA, ConvertArray(gained, val1), ConvertArray(m_pp.aapoints, val2)); //You have gained %1 ability point(s)! You now have %2 ability point(s).
if (RuleB(AA, SoundForAAEarned)) { if (RuleB(AA, SoundForAAEarned)) {
SendSound(); SendSound();
} }
@ -699,7 +699,7 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) {
/* QS: PlayerLogAARate */ /* QS: PlayerLogAARate */
if (RuleB(QueryServ, PlayerLogAARate)){ if (RuleB(QueryServ, PlayerLogAARate)){
int add_points = (m_pp.aapoints - last_unspentAA); int add_points = (m_pp.aapoints - last_unspentAA);
std::string query = StringFormat("INSERT INTO `qs_player_aa_rate_hourly` (char_id, aa_count, hour_time) VALUES (%i, %i, UNIX_TIMESTAMP() - MOD(UNIX_TIMESTAMP(), 3600)) ON DUPLICATE KEY UPDATE `aa_count` = `aa_count` + %i", this->CharacterID(), add_points, add_points); std::string query = StringFormat("INSERT INTO `qs_player_aa_rate_hourly` (char_id, aa_count, hour_time) VALUES (%i, %i, UNIX_TIMESTAMP() - MOD(UNIX_TIMESTAMP(), 3600)) ON DUPLICATE KEY UPDATE `aa_count` = `aa_count` + %i", CharacterID(), add_points, add_points);
QServ->SendQuery(query.c_str()); QServ->SendQuery(query.c_str());
} }
@ -819,7 +819,7 @@ void Client::SetLevel(uint8 set_level, bool command)
level = set_level; level = set_level;
if(IsRaidGrouped()) { if(IsRaidGrouped()) {
Raid *r = this->GetRaid(); Raid *r = GetRaid();
if(r){ if(r){
r->UpdateLevel(GetName(), set_level); r->UpdateLevel(GetName(), set_level);
} }
@ -836,15 +836,15 @@ void Client::SetLevel(uint8 set_level, bool command)
parse->EventPlayer(EVENT_LEVEL_UP, this, "", 0); parse->EventPlayer(EVENT_LEVEL_UP, this, "", 0);
/* QS: PlayerLogLevels */ /* QS: PlayerLogLevels */
if (RuleB(QueryServ, PlayerLogLevels)){ if (RuleB(QueryServ, PlayerLogLevels)){
std::string event_desc = StringFormat("Leveled UP :: to Level:%i from Level:%i in zoneid:%i instid:%i", set_level, m_pp.level, this->GetZoneID(), this->GetInstanceID()); std::string event_desc = StringFormat("Leveled UP :: to Level:%i from Level:%i in zoneid:%i instid:%i", set_level, m_pp.level, GetZoneID(), GetInstanceID());
QServ->PlayerLogEvent(Player_Log_Levels, this->CharacterID(), event_desc); QServ->PlayerLogEvent(Player_Log_Levels, CharacterID(), event_desc);
} }
} }
else if (set_level < m_pp.level){ else if (set_level < m_pp.level){
/* QS: PlayerLogLevels */ /* QS: PlayerLogLevels */
if (RuleB(QueryServ, PlayerLogLevels)){ if (RuleB(QueryServ, PlayerLogLevels)){
std::string event_desc = StringFormat("Leveled DOWN :: to Level:%i from Level:%i in zoneid:%i instid:%i", set_level, m_pp.level, this->GetZoneID(), this->GetInstanceID()); std::string event_desc = StringFormat("Leveled DOWN :: to Level:%i from Level:%i in zoneid:%i instid:%i", set_level, m_pp.level, GetZoneID(), GetInstanceID());
QServ->PlayerLogEvent(Player_Log_Levels, this->CharacterID(), event_desc); QServ->PlayerLogEvent(Player_Log_Levels, CharacterID(), event_desc);
} }
} }
@ -860,7 +860,7 @@ void Client::SetLevel(uint8 set_level, bool command)
} }
QueuePacket(outapp); QueuePacket(outapp);
safe_delete(outapp); safe_delete(outapp);
this->SendAppearancePacket(AT_WhoLevel, set_level); // who level change SendAppearancePacket(AT_WhoLevel, set_level); // who level change
LogInfo("Setting Level for [{}] to [{}]", GetName(), set_level); LogInfo("Setting Level for [{}] to [{}]", GetName(), set_level);
@ -1150,13 +1150,13 @@ void Client::SendLeadershipEXPUpdate() {
uint32 Client::GetCharMaxLevelFromQGlobal() { uint32 Client::GetCharMaxLevelFromQGlobal() {
QGlobalCache *char_c = nullptr; QGlobalCache *char_c = nullptr;
char_c = this->GetQGlobals(); char_c = GetQGlobals();
std::list<QGlobal> globalMap; std::list<QGlobal> globalMap;
uint32 ntype = 0; uint32 ntype = 0;
if(char_c) { if(char_c) {
QGlobalCache::Combine(globalMap, char_c->GetBucket(), ntype, this->CharacterID(), zone->GetZoneID()); QGlobalCache::Combine(globalMap, char_c->GetBucket(), ntype, CharacterID(), zone->GetZoneID());
} }
auto iter = globalMap.begin(); auto iter = globalMap.begin();
@ -1174,7 +1174,7 @@ uint32 Client::GetCharMaxLevelFromQGlobal() {
uint32 Client::GetCharMaxLevelFromBucket() uint32 Client::GetCharMaxLevelFromBucket()
{ {
uint32 char_id = this->CharacterID(); uint32 char_id = CharacterID();
std::string query = StringFormat("SELECT value FROM data_buckets WHERE `key` = '%i-CharMaxLevel'", char_id); std::string query = StringFormat("SELECT value FROM data_buckets WHERE `key` = '%i-CharMaxLevel'", char_id);
auto results = database.QueryDatabase(query); auto results = database.QueryDatabase(query);
if (!results.Success()) { if (!results.Success()) {

View File

@ -22,6 +22,6 @@ void Client::Undye()
SendWearChange(cur_slot); SendWearChange(cur_slot);
} }
database.DeleteCharacterDye(this->CharacterID()); database.DeleteCharacterDye(CharacterID());
} }

View File

@ -295,7 +295,7 @@ bool Group::AddMember(Mob* newmember, const char *NewMemberName, uint32 Characte
members[i]->CastToClient()->QueuePacket(outapp); members[i]->CastToClient()->QueuePacket(outapp);
//put new member into existing group members' list(s) //put new member into existing group members' list(s)
strcpy(members[i]->CastToClient()->GetPP().groupMembers[this->GroupCount()-1], NewMemberName); strcpy(members[i]->CastToClient()->GetPP().groupMembers[GroupCount()-1], NewMemberName);
} }
//put existing group member(s) into the new member's list //put existing group member(s) into the new member's list
@ -586,7 +586,7 @@ void Group::SendGroupJoinOOZ(Mob* NewMember) {
{ {
return; return;
} }
if (!NewMember->HasGroup()) if (!NewMember->HasGroup())
{ {
return; return;
@ -686,7 +686,7 @@ bool Group::DelMember(Mob* oldmember, bool ignoresender)
{ {
for(uint32 nl = 0; nl < MAX_GROUP_MEMBERS; nl++) for(uint32 nl = 0; nl < MAX_GROUP_MEMBERS; nl++)
{ {
if(members[nl]) if(members[nl])
{ {
if (members[nl]->IsClient()) if (members[nl]->IsClient())
{ {
@ -696,7 +696,7 @@ bool Group::DelMember(Mob* oldmember, bool ignoresender)
} }
} }
} }
if (!GetLeaderName()) if (!GetLeaderName())
{ {
DisbandGroup(); DisbandGroup();
@ -741,14 +741,14 @@ bool Group::DelMember(Mob* oldmember, bool ignoresender)
if(oldmember->IsClient()) if(oldmember->IsClient())
oldmember->CastToClient()->QueuePacket(outapp); oldmember->CastToClient()->QueuePacket(outapp);
} }
safe_delete(outapp); safe_delete(outapp);
if(oldmember->IsClient()) if(oldmember->IsClient())
{ {
database.SetGroupID(oldmember->GetCleanName(), 0, oldmember->CastToClient()->CharacterID(), false); database.SetGroupID(oldmember->GetCleanName(), 0, oldmember->CastToClient()->CharacterID(), false);
} }
if(oldmember->IsMerc()) if(oldmember->IsMerc())
{ {
Client* owner = oldmember->CastToMerc()->GetMercOwner(); Client* owner = oldmember->CastToMerc()->GetMercOwner();
@ -940,7 +940,7 @@ void Group::DisbandGroup(bool joinraid) {
if (!joinraid) if (!joinraid)
members[i]->CastToClient()->LeaveGroupXTargets(this); members[i]->CastToClient()->LeaveGroupXTargets(this);
} }
if (members[i]->IsMerc()) if (members[i]->IsMerc())
{ {
Client* owner = members[i]->CastToMerc()->GetMercOwner(); Client* owner = members[i]->CastToMerc()->GetMercOwner();
@ -1217,7 +1217,7 @@ void Group::GroupMessageString(Mob* sender, uint32 type, uint32 string_id, const
if(members[i] == sender) if(members[i] == sender)
continue; continue;
if(!members[i]->IsClient()) if(!members[i]->IsClient())
continue; continue;
@ -1236,7 +1236,7 @@ void Client::LeaveGroup() {
{ {
MemberCount -= 1; MemberCount -= 1;
} }
if(MemberCount < 3) if(MemberCount < 3)
{ {
g->DisbandGroup(); g->DisbandGroup();
@ -2420,7 +2420,7 @@ bool Group::AmIPuller(const char *mob_name)
{ {
if (!mob_name) if (!mob_name)
return false; return false;
return !((bool)PullerName.compare(mob_name)); return !((bool)PullerName.compare(mob_name));
} }

View File

@ -124,11 +124,11 @@ void Client::SendGuildRanks()
auto outapp = new EQApplicationPacket(OP_GuildUpdateURLAndChannel, auto outapp = new EQApplicationPacket(OP_GuildUpdateURLAndChannel,
sizeof(GuildUpdateRanks_Struct)); sizeof(GuildUpdateRanks_Struct));
GuildUpdateRanks_Struct *guuacs = (GuildUpdateRanks_Struct*) outapp->pBuffer; GuildUpdateRanks_Struct *guuacs = (GuildUpdateRanks_Struct*) outapp->pBuffer;
//guuacs->Unknown0008 = this->GuildID(); //guuacs->Unknown0008 = GuildID();
strncpy(guuacs->Unknown0012, this->GetCleanName(), 64); strncpy(guuacs->Unknown0012, GetCleanName(), 64);
guuacs->Action = 5; guuacs->Action = 5;
guuacs->RankID = j; guuacs->RankID = j;
guuacs->GuildID = this->GuildID(); guuacs->GuildID = GuildID();
guuacs->PermissionID = i; guuacs->PermissionID = i;
guuacs->PermissionVal = 1; guuacs->PermissionVal = 1;
guuacs->Unknown0089[0] = 0x2c; guuacs->Unknown0089[0] = 0x2c;

View File

@ -199,7 +199,7 @@ void ZoneGuildManager::ListGuilds(Client *c) const {
m_guilds.size() != 1 ? "s" : "" m_guilds.size() != 1 ? "s" : ""
).c_str() ).c_str()
); );
for (const auto& guild : m_guilds) { for (const auto& guild : m_guilds) {
auto leader_name = database.GetCharNameByID(guild.second->leader_char_id); auto leader_name = database.GetCharNameByID(guild.second->leader_char_id);
c->Message( c->Message(
@ -242,7 +242,7 @@ void ZoneGuildManager::DescribeGuild(Client *c, uint32 guild_id) const {
const GuildInfo *info = res->second; const GuildInfo *info = res->second;
auto leader_name = database.GetCharNameByID(info->leader_char_id); auto leader_name = database.GetCharNameByID(info->leader_char_id);
std::string popup_text = "<table>"; std::string popup_text = "<table>";
popup_text += fmt::format( popup_text += fmt::format(
"<tr><td>Name</td><td>{}</td><td>Guild ID</td><td>{}</td></tr>", "<tr><td>Name</td><td>{}</td><td>Guild ID</td><td>{}</td></tr>",
@ -1481,8 +1481,8 @@ GuildApproval::GuildApproval(const char* guildname, Client* owner,uint32 id)
uint8 tmp = atoi(founders.c_str()); uint8 tmp = atoi(founders.c_str());
deletion_timer = new Timer(1800000); deletion_timer = new Timer(1800000);
strcpy(guild,guildname); strcpy(guild,guildname);
this->owner = owner; owner = owner;
this->refid = id; refid = id;
if(owner) if(owner)
owner->Message(Chat::White,"You can now start getting your guild approved, tell your %i members to #guildapprove %i, you have 30 minutes to create your guild.",tmp,GetID()); owner->Message(Chat::White,"You can now start getting your guild approved, tell your %i members to #guildapprove %i, you have 30 minutes to create your guild.",tmp,GetID());
for(int i=0;i<tmp;i++) for(int i=0;i<tmp;i++)

View File

@ -178,7 +178,7 @@ bool Client::CheckLoreConflict(const EQ::ItemData* item)
} }
bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, uint32 aug6, bool attuned, uint16 to_slot, uint32 ornament_icon, uint32 ornament_idfile, uint32 ornament_hero_model) { bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, uint32 aug6, bool attuned, uint16 to_slot, uint32 ornament_icon, uint32 ornament_idfile, uint32 ornament_hero_model) {
this->EVENT_ITEM_ScriptStopReturn(); EVENT_ITEM_ScriptStopReturn();
// TODO: update calling methods and script apis to handle a failure return // TODO: update calling methods and script apis to handle a failure return
@ -246,10 +246,10 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
// check to make sure we are a GM if the item is GM-only // check to make sure we are a GM if the item is GM-only
/* /*
else if(item->MinStatus && ((this->Admin() < item->MinStatus) || (this->Admin() < RuleI(GM, MinStatusToSummonItem)))) { else if(item->MinStatus && ((Admin() < item->MinStatus) || (Admin() < RuleI(GM, MinStatusToSummonItem)))) {
Message(Chat::Red, "You are not a GM or do not have the status to summon this item."); Message(Chat::Red, "You are not a GM or do not have the status to summon this item.");
LogInventory("Player [{}] on account [{}] attempted to create a GM-only item with a status of [{}].\n"Item [{}], Aug1: [{}], Aug2: [{}], Aug3: [{}], Aug4: [{}], Aug5: [{}], Aug6: [{}], MinStatus: [{}])\n", LogInventory("Player [{}] on account [{}] attempted to create a GM-only item with a status of [{}].\n"Item [{}], Aug1: [{}], Aug2: [{}], Aug3: [{}], Aug4: [{}], Aug5: [{}], Aug6: [{}], MinStatus: [{}])\n",
GetName(), account_name, this->Admin(), item->ID, aug1, aug2, aug3, aug4, aug5, aug6, item->MinStatus); GetName(), account_name, Admin(), item->ID, aug1, aug2, aug3, aug4, aug5, aug6, item->MinStatus);
return false; return false;
} }
@ -341,10 +341,10 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
// check to make sure we are a GM if the augment is GM-only // check to make sure we are a GM if the augment is GM-only
/* /*
else if(augtest->MinStatus && ((this->Admin() < augtest->MinStatus) || (this->Admin() < RuleI(GM, MinStatusToSummonItem)))) { else if(augtest->MinStatus && ((Admin() < augtest->MinStatus) || (Admin() < RuleI(GM, MinStatusToSummonItem)))) {
Message(Chat::Red, "You are not a GM or do not have the status to summon this augment."); Message(Chat::Red, "You are not a GM or do not have the status to summon this augment.");
LogInventory("Player [{}] on account [{}] attempted to create a GM-only augment (Aug[{}]) with a status of [{}].\n(Item: [{}], Aug1: [{}], Aug2: [{}], Aug3: [{}], Aug4: [{}], Aug5: [{}], MinStatus: [{}])\n", LogInventory("Player [{}] on account [{}] attempted to create a GM-only augment (Aug[{}]) with a status of [{}].\n(Item: [{}], Aug1: [{}], Aug2: [{}], Aug3: [{}], Aug4: [{}], Aug5: [{}], MinStatus: [{}])\n",
GetName(), account_name, augment_slot, this->Admin(), item->ID, aug1, aug2, aug3, aug4, aug5, aug6, item->MinStatus); GetName(), account_name, augment_slot, Admin(), item->ID, aug1, aug2, aug3, aug4, aug5, aug6, item->MinStatus);
return false; return false;
} }
@ -840,7 +840,7 @@ void Client::DropItem(int16 slot_id, bool recurse)
} }
invalid_drop = nullptr; invalid_drop = nullptr;
database.SetHackerFlag(this->AccountName(), this->GetCleanName(), "Tried to drop an item on the ground that was nodrop!"); database.SetHackerFlag(AccountName(), GetCleanName(), "Tried to drop an item on the ground that was nodrop!");
GetInv().DeleteItem(slot_id); GetInv().DeleteItem(slot_id);
return; return;
} }
@ -914,12 +914,12 @@ void Client::DropItemQS(EQ::ItemInstance* inst, bool pickup) {
std::list<void*> event_details; std::list<void*> event_details;
memset(&qs_audit, 0, sizeof(QSPlayerDropItem_Struct)); memset(&qs_audit, 0, sizeof(QSPlayerDropItem_Struct));
qs_audit.char_id = this->character_id; qs_audit.char_id = character_id;
qs_audit.pickup = pickup; qs_audit.pickup = pickup;
qs_audit.zone_id = this->GetZoneID(); qs_audit.zone_id = GetZoneID();
qs_audit.x = (int) this->GetX(); qs_audit.x = (int) GetX();
qs_audit.y = (int) this->GetY(); qs_audit.y = (int) GetY();
qs_audit.z = (int) this->GetZ(); qs_audit.z = (int) GetZ();
if (inst) { if (inst) {
auto detail = new QSDropItems_Struct; auto detail = new QSDropItems_Struct;
@ -1248,10 +1248,10 @@ bool Client::PutItemInInventory(int16 slot_id, const EQ::ItemInstance& inst, boo
if (slot_id == EQ::invslot::slotCursor) { if (slot_id == EQ::invslot::slotCursor) {
auto s = m_inv.cursor_cbegin(), e = m_inv.cursor_cend(); auto s = m_inv.cursor_cbegin(), e = m_inv.cursor_cend();
return database.SaveCursor(this->CharacterID(), s, e); return database.SaveCursor(CharacterID(), s, e);
} }
else { else {
return database.SaveInventory(this->CharacterID(), &inst, slot_id); return database.SaveInventory(CharacterID(), &inst, slot_id);
} }
CalcBonuses(); CalcBonuses();
@ -1267,11 +1267,11 @@ void Client::PutLootInInventory(int16 slot_id, const EQ::ItemInstance &inst, Ser
if (slot_id == EQ::invslot::slotCursor) { if (slot_id == EQ::invslot::slotCursor) {
m_inv.PushCursor(inst); m_inv.PushCursor(inst);
auto s = m_inv.cursor_cbegin(), e = m_inv.cursor_cend(); auto s = m_inv.cursor_cbegin(), e = m_inv.cursor_cend();
database.SaveCursor(this->CharacterID(), s, e); database.SaveCursor(CharacterID(), s, e);
} }
else { else {
m_inv.PutItem(slot_id, inst); m_inv.PutItem(slot_id, inst);
database.SaveInventory(this->CharacterID(), &inst, slot_id); database.SaveInventory(CharacterID(), &inst, slot_id);
} }
// Subordinate items in cursor buffer must be sent via ItemPacketSummonItem or we just overwrite the visible cursor and desync the client // Subordinate items in cursor buffer must be sent via ItemPacketSummonItem or we just overwrite the visible cursor and desync the client
@ -1463,10 +1463,10 @@ void Client::MoveItemCharges(EQ::ItemInstance &from, int16 to_slot, uint8 type)
SendLootItemInPacket(tmp_inst, to_slot); SendLootItemInPacket(tmp_inst, to_slot);
if (to_slot == EQ::invslot::slotCursor) { if (to_slot == EQ::invslot::slotCursor) {
auto s = m_inv.cursor_cbegin(), e = m_inv.cursor_cend(); auto s = m_inv.cursor_cbegin(), e = m_inv.cursor_cend();
database.SaveCursor(this->CharacterID(), s, e); database.SaveCursor(CharacterID(), s, e);
} }
else { else {
database.SaveInventory(this->CharacterID(), tmp_inst, to_slot); database.SaveInventory(CharacterID(), tmp_inst, to_slot);
} }
} }
} }
@ -1705,12 +1705,12 @@ packet with the item number in it, but I cant seem to find it right now
safe_delete(outapp); safe_delete(outapp);
if (send_to_all==false) if (send_to_all==false)
return; return;
const char* charname = this->GetName(); const char* charname = GetName();
outapp = new EQApplicationPacket(OP_ItemLinkText,strlen(itemlink)+14+strlen(charname)); outapp = new EQApplicationPacket(OP_ItemLinkText,strlen(itemlink)+14+strlen(charname));
char buffer3[150] = {0}; char buffer3[150] = {0};
sprintf(buffer3,"%c%c%c%c%c%c%c%c%c%c%c%c%6s%c%s",0x00,0x00,0x00,0x00,0xD2,0x01,0x00,0x00,0x00,0x00,0x00,0x00,charname,0x00,itemlink); sprintf(buffer3,"%c%c%c%c%c%c%c%c%c%c%c%c%6s%c%s",0x00,0x00,0x00,0x00,0xD2,0x01,0x00,0x00,0x00,0x00,0x00,0x00,charname,0x00,itemlink);
memcpy(outapp->pBuffer,buffer3,outapp->size); memcpy(outapp->pBuffer,buffer3,outapp->size);
entity_list.QueueCloseClients(this->CastToMob(),outapp,true,200,0,false); entity_list.QueueCloseClients(CastToMob(),outapp,true,200,0,false);
safe_delete(outapp); safe_delete(outapp);
} }
@ -1905,8 +1905,8 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
(dstbagid && dstbag->GetItem()->BagType == EQ::item::BagTypeTradersSatchel) || (dstbagid && dstbag->GetItem()->BagType == EQ::item::BagTypeTradersSatchel) ||
(srcitemid && src_inst->GetItem()->BagType == EQ::item::BagTypeTradersSatchel) || (srcitemid && src_inst->GetItem()->BagType == EQ::item::BagTypeTradersSatchel) ||
(dstitemid && dst_inst->GetItem()->BagType == EQ::item::BagTypeTradersSatchel)) { (dstitemid && dst_inst->GetItem()->BagType == EQ::item::BagTypeTradersSatchel)) {
this->Trader_EndTrader(); Trader_EndTrader();
this->Message(Chat::Red,"You cannot move your Trader Satchels, or items inside them, while Trading."); Message(Chat::Red,"You cannot move your Trader Satchels, or items inside them, while Trading.");
} }
} }
@ -2223,7 +2223,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
dst_inst->IsStackable() ? dst_inst->GetCharges() : 1, dst_inst->IsStackable() ? dst_inst->GetCharges() : 1,
src_slot_id src_slot_id
); );
parse->EventPlayer(EVENT_EQUIP_ITEM_CLIENT, this, export_string, dst_inst->GetItem()->ID); parse->EventPlayer(EVENT_EQUIP_ITEM_CLIENT, this, export_string, dst_inst->GetItem()->ID);
} }
} }
@ -2495,11 +2495,11 @@ void Client::DyeArmor(EQ::TintProfile* dye){
if (slot != INVALID_INDEX){ if (slot != INVALID_INDEX){
DeleteItemInInventory(slot,1,true); DeleteItemInInventory(slot,1,true);
uint8 slot2=SlotConvert(i); uint8 slot2=SlotConvert(i);
EQ::ItemInstance* inst = this->m_inv.GetItem(slot2); EQ::ItemInstance* inst = m_inv.GetItem(slot2);
if(inst){ if(inst){
uint32 armor_color = ((uint32)dye->Slot[i].Red << 16) | ((uint32)dye->Slot[i].Green << 8) | ((uint32)dye->Slot[i].Blue); uint32 armor_color = ((uint32)dye->Slot[i].Red << 16) | ((uint32)dye->Slot[i].Green << 8) | ((uint32)dye->Slot[i].Blue);
inst->SetColor(armor_color); inst->SetColor(armor_color);
database.SaveCharacterMaterialColor(this->CharacterID(), i, armor_color); database.SaveCharacterMaterialColor(CharacterID(), i, armor_color);
database.SaveInventory(CharacterID(),inst,slot2); database.SaveInventory(CharacterID(),inst,slot2);
if(dye->Slot[i].UseTint) if(dye->Slot[i].UseTint)
m_pp.item_tint.Slot[i].UseTint = 0xFF; m_pp.item_tint.Slot[i].UseTint = 0xFF;
@ -2525,11 +2525,11 @@ void Client::DyeArmor(EQ::TintProfile* dye){
void Client::DyeArmorBySlot(uint8 slot, uint8 red, uint8 green, uint8 blue, uint8 use_tint) { void Client::DyeArmorBySlot(uint8 slot, uint8 red, uint8 green, uint8 blue, uint8 use_tint) {
uint8 item_slot = SlotConvert(slot); uint8 item_slot = SlotConvert(slot);
EQ::ItemInstance* item_instance = this->m_inv.GetItem(item_slot); EQ::ItemInstance* item_instance = m_inv.GetItem(item_slot);
if (item_instance) { if (item_instance) {
uint32 armor_color = ((uint32)red << 16) | ((uint32)green << 8) | ((uint32)blue); uint32 armor_color = ((uint32)red << 16) | ((uint32)green << 8) | ((uint32)blue);
item_instance->SetColor(armor_color); item_instance->SetColor(armor_color);
database.SaveCharacterMaterialColor(this->CharacterID(), slot, armor_color); database.SaveCharacterMaterialColor(CharacterID(), slot, armor_color);
database.SaveInventory(CharacterID(), item_instance, item_slot); database.SaveInventory(CharacterID(), item_instance, item_slot);
m_pp.item_tint.Slot[slot].UseTint = (use_tint ? 0xFF : 0x00); m_pp.item_tint.Slot[slot].UseTint = (use_tint ? 0xFF : 0x00);
} }
@ -2836,7 +2836,7 @@ void Client::DisenchantSummonedBags(bool client_update)
local.clear(); local.clear();
auto s = m_inv.cursor_cbegin(), e = m_inv.cursor_cend(); auto s = m_inv.cursor_cbegin(), e = m_inv.cursor_cend();
database.SaveCursor(this->CharacterID(), s, e); database.SaveCursor(CharacterID(), s, e);
} }
else { else {
safe_delete(new_inst); // deletes disenchanted bag if not used safe_delete(new_inst); // deletes disenchanted bag if not used
@ -2944,7 +2944,7 @@ void Client::RemoveNoRent(bool client_update)
local.clear(); local.clear();
auto s = m_inv.cursor_cbegin(), e = m_inv.cursor_cend(); auto s = m_inv.cursor_cbegin(), e = m_inv.cursor_cend();
database.SaveCursor(this->CharacterID(), s, e); database.SaveCursor(CharacterID(), s, e);
} }
} }
@ -3075,7 +3075,7 @@ void Client::RemoveDuplicateLore(bool client_update)
local_2.clear(); local_2.clear();
auto s = m_inv.cursor_cbegin(), e = m_inv.cursor_cend(); auto s = m_inv.cursor_cbegin(), e = m_inv.cursor_cend();
database.SaveCursor(this->CharacterID(), s, e); database.SaveCursor(CharacterID(), s, e);
} }
} }
@ -3274,7 +3274,7 @@ void Client::CreateBandolier(const EQApplicationPacket *app)
const EQ::ItemData *BaseItem = nullptr; const EQ::ItemData *BaseItem = nullptr;
int16 WeaponSlot = 0; int16 WeaponSlot = 0;
database.DeleteCharacterBandolier(this->CharacterID(), bs->Number); database.DeleteCharacterBandolier(CharacterID(), bs->Number);
for(int BandolierSlot = bandolierPrimary; BandolierSlot <= bandolierAmmo; BandolierSlot++) { for(int BandolierSlot = bandolierPrimary; BandolierSlot <= bandolierAmmo; BandolierSlot++) {
WeaponSlot = BandolierSlotToWeaponSlot(BandolierSlot); WeaponSlot = BandolierSlotToWeaponSlot(BandolierSlot);
@ -3284,7 +3284,7 @@ void Client::CreateBandolier(const EQApplicationPacket *app)
LogInventory("Char: [{}] adding item [{}] to slot [{}]", GetName(),BaseItem->Name, WeaponSlot); LogInventory("Char: [{}] adding item [{}] to slot [{}]", GetName(),BaseItem->Name, WeaponSlot);
m_pp.bandoliers[bs->Number].Items[BandolierSlot].ID = BaseItem->ID; m_pp.bandoliers[bs->Number].Items[BandolierSlot].ID = BaseItem->ID;
m_pp.bandoliers[bs->Number].Items[BandolierSlot].Icon = BaseItem->Icon; m_pp.bandoliers[bs->Number].Items[BandolierSlot].Icon = BaseItem->Icon;
database.SaveCharacterBandolier(this->CharacterID(), bs->Number, BandolierSlot, m_pp.bandoliers[bs->Number].Items[BandolierSlot].ID, m_pp.bandoliers[bs->Number].Items[BandolierSlot].Icon, bs->Name); database.SaveCharacterBandolier(CharacterID(), bs->Number, BandolierSlot, m_pp.bandoliers[bs->Number].Items[BandolierSlot].ID, m_pp.bandoliers[bs->Number].Items[BandolierSlot].Icon, bs->Name);
} }
else { else {
LogInventory("Char: [{}] no item in slot [{}]", GetName(), WeaponSlot); LogInventory("Char: [{}] no item in slot [{}]", GetName(), WeaponSlot);
@ -3303,7 +3303,7 @@ void Client::RemoveBandolier(const EQApplicationPacket *app)
m_pp.bandoliers[bds->Number].Items[i].ID = 0; m_pp.bandoliers[bds->Number].Items[i].ID = 0;
m_pp.bandoliers[bds->Number].Items[i].Icon = 0; m_pp.bandoliers[bds->Number].Items[i].Icon = 0;
} }
database.DeleteCharacterBandolier(this->CharacterID(), bds->Number); database.DeleteCharacterBandolier(CharacterID(), bds->Number);
} }
void Client::SetBandolier(const EQApplicationPacket *app) void Client::SetBandolier(const EQApplicationPacket *app)

View File

@ -91,7 +91,7 @@ Merc::Merc(const NPCType* d, float x, float y, float z, float heading)
Merc::~Merc() { Merc::~Merc() {
AI_Stop(); AI_Stop();
//entity_list.RemoveMerc(this->GetID()); //entity_list.RemoveMerc(GetID());
UninitializeBuffSlots(); UninitializeBuffSlots();
} }
@ -132,7 +132,7 @@ float Merc::GetDefaultSize() {
float MercSize = GetSize(); float MercSize = GetSize();
switch(this->GetRace()) switch(GetRace())
{ {
case 1: // Humans case 1: // Humans
MercSize = 6.0; MercSize = 6.0;
@ -946,7 +946,7 @@ int32 Merc::CalcManaRegen()
{ {
BuffFadeBySitModifier(); BuffFadeBySitModifier();
if (HasSkill(EQ::skills::SkillMeditate)) { if (HasSkill(EQ::skills::SkillMeditate)) {
this->_medding = true; _medding = true;
regen = ((GetSkill(EQ::skills::SkillMeditate) / 10) + mana_regen); regen = ((GetSkill(EQ::skills::SkillMeditate) / 10) + mana_regen);
regen += spellbonuses.ManaRegen + itembonuses.ManaRegen; regen += spellbonuses.ManaRegen + itembonuses.ManaRegen;
} }
@ -954,7 +954,7 @@ int32 Merc::CalcManaRegen()
regen = mana_regen + spellbonuses.ManaRegen + itembonuses.ManaRegen; regen = mana_regen + spellbonuses.ManaRegen + itembonuses.ManaRegen;
} }
else { else {
this->_medding = false; _medding = false;
regen = mana_regen + spellbonuses.ManaRegen + itembonuses.ManaRegen; regen = mana_regen + spellbonuses.ManaRegen + itembonuses.ManaRegen;
} }
@ -1636,13 +1636,13 @@ void Merc::AI_Process() {
// TODO: Do mercs berserk? Find this out on live... // TODO: Do mercs berserk? Find this out on live...
//if (GetClass() == WARRIOR || GetClass() == BERSERKER) { //if (GetClass() == WARRIOR || GetClass() == BERSERKER) {
// if(GetHP() > 0 && !berserk && this->GetHPRatio() < 30) { // if(GetHP() > 0 && !berserk && GetHPRatio() < 30) {
// entity_list.MessageCloseString(this, false, 200, 0, BERSERK_START, GetName()); // entity_list.MessageCloseString(this, false, 200, 0, BERSERK_START, GetName());
// this->berserk = true; // berserk = true;
// } // }
// if (berserk && this->GetHPRatio() > 30) { // if (berserk && GetHPRatio() > 30) {
// entity_list.MessageCloseString(this, false, 200, 0, BERSERK_END, GetName()); // entity_list.MessageCloseString(this, false, 200, 0, BERSERK_END, GetName());
// this->berserk = false; // berserk = false;
// } // }
//} //}
@ -1862,7 +1862,7 @@ bool Merc::AI_IdleCastCheck() {
if (AIautocastspell_timer->Check(false)) { if (AIautocastspell_timer->Check(false)) {
#if MercAI_DEBUG_Spells >= 25 #if MercAI_DEBUG_Spells >= 25
LogAI("Merc Non-Engaged autocast check triggered: [{}]", this->GetCleanName()); LogAI("Merc Non-Engaged autocast check triggered: [{}]", GetCleanName());
#endif #endif
AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting. AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting.
@ -2184,14 +2184,14 @@ bool Merc::AICastSpell(int8 iChance, uint32 iSpellTypes) {
} }
if(spells[selectedMercSpell.spellid].target_type == ST_Self) { if(spells[selectedMercSpell.spellid].target_type == ST_Self) {
if( !this->IsImmuneToSpell(selectedMercSpell.spellid, this) if( !IsImmuneToSpell(selectedMercSpell.spellid, this)
&& (this->CanBuffStack(selectedMercSpell.spellid, mercLevel, true) >= 0)) { && (CanBuffStack(selectedMercSpell.spellid, mercLevel, true) >= 0)) {
if( this->GetArchetype() == ARCHETYPE_MELEE && IsEffectInSpell(selectedMercSpell.spellid, SE_IncreaseSpellHaste)) { if( GetArchetype() == ARCHETYPE_MELEE && IsEffectInSpell(selectedMercSpell.spellid, SE_IncreaseSpellHaste)) {
continue; continue;
} }
uint32 TempDontBuffMeBeforeTime = this->DontBuffMeBefore(); uint32 TempDontBuffMeBeforeTime = DontBuffMeBefore();
if(selectedMercSpell.spellid > 0) { if(selectedMercSpell.spellid > 0) {
if(isDiscipline) { if(isDiscipline) {
@ -2200,8 +2200,8 @@ bool Merc::AICastSpell(int8 iChance, uint32 iSpellTypes) {
else { else {
castedSpell = AIDoSpellCast(selectedMercSpell.spellid, this, -1, &TempDontBuffMeBeforeTime); castedSpell = AIDoSpellCast(selectedMercSpell.spellid, this, -1, &TempDontBuffMeBeforeTime);
if(TempDontBuffMeBeforeTime != this->DontBuffMeBefore()) if(TempDontBuffMeBeforeTime != DontBuffMeBefore())
this->SetDontBuffMeBefore(TempDontBuffMeBeforeTime); SetDontBuffMeBefore(TempDontBuffMeBeforeTime);
} }
} }
} }
@ -2388,8 +2388,8 @@ bool Merc::AICastSpell(int8 iChance, uint32 iSpellTypes) {
if(castedSpell) { if(castedSpell) {
if(IsGroupSpell(selectedMercSpell.spellid)){ if(IsGroupSpell(selectedMercSpell.spellid)){
if(this->HasGroup()) { if(HasGroup()) {
Group *g = this->GetGroup(); Group *g = GetGroup();
if(g) { if(g) {
for( int i = 0; i<MAX_GROUP_MEMBERS; i++) { for( int i = 0; i<MAX_GROUP_MEMBERS; i++) {
@ -2682,8 +2682,8 @@ int32 Merc::GetFocusEffect(focusType type, uint16 spell_id, bool from_buff_tic)
for (int i = 0; i < MAX_PP_AA_ARRAY; i++) for (int i = 0; i < MAX_PP_AA_ARRAY; i++)
{ {
aa_AA = this->aa[i]->AA; aa_AA = aa[i]->AA;
aa_value = this->aa[i]->value; aa_value = aa[i]->value;
if (aa_AA < 1 || aa_value < 1) if (aa_AA < 1 || aa_value < 1)
continue; continue;
@ -2711,9 +2711,9 @@ int32 Merc::GetFocusEffect(focusType type, uint16 spell_id, bool from_buff_tic)
int32 Merc::GetActSpellCost(uint16 spell_id, int32 cost) int32 Merc::GetActSpellCost(uint16 spell_id, int32 cost)
{ {
// Formula = Unknown exact, based off a random percent chance up to mana cost(after focuses) of the cast spell // Formula = Unknown exact, based off a random percent chance up to mana cost(after focuses) of the cast spell
if(this->itembonuses.Clairvoyance && spells[spell_id].classes[(GetClass()%17) - 1] >= GetLevel() - 5) if(itembonuses.Clairvoyance && spells[spell_id].classes[(GetClass()%17) - 1] >= GetLevel() - 5)
{ {
int16 mana_back = this->itembonuses.Clairvoyance * zone->random.Int(1, 100) / 100; int16 mana_back = itembonuses.Clairvoyance * zone->random.Int(1, 100) / 100;
// Doesnt generate mana, so best case is a free spell // Doesnt generate mana, so best case is a free spell
if(mana_back > cost) if(mana_back > cost)
mana_back = cost; mana_back = cost;
@ -4240,7 +4240,7 @@ bool Merc::CheckConfidence() {
if(DistanceSquared(m_Position, mob->GetPosition()) > AggroRange) continue; if(DistanceSquared(m_Position, mob->GetPosition()) > AggroRange) continue;
CurrentCon = this->GetLevelCon(mob->GetLevel()); CurrentCon = GetLevelCon(mob->GetLevel());
switch(CurrentCon) { switch(CurrentCon) {
@ -4513,7 +4513,7 @@ void Merc::SetTarget(Mob* mob) {
Mob* Merc::GetOwnerOrSelf() { Mob* Merc::GetOwnerOrSelf() {
Mob* Result = nullptr; Mob* Result = nullptr;
if(this->GetMercOwner()) if(GetMercOwner())
Result = GetMercOwner(); Result = GetMercOwner();
else else
Result = this; Result = this;
@ -4565,7 +4565,7 @@ Mob* Merc::GetOwner() {
Result = entity_list.GetMob(GetOwnerID()); Result = entity_list.GetMob(GetOwnerID());
if(!Result) { if(!Result) {
this->SetOwnerID(0); SetOwnerID(0);
} }
return Result->CastToMob(); return Result->CastToMob();
@ -5052,7 +5052,7 @@ void Merc::UpdateMercAppearance() {
if(itemID != 0) { if(itemID != 0) {
materialFromSlot = EQ::InventoryProfile::CalcMaterialFromSlot(i); materialFromSlot = EQ::InventoryProfile::CalcMaterialFromSlot(i);
if (materialFromSlot != EQ::textures::materialInvalid) if (materialFromSlot != EQ::textures::materialInvalid)
this->SendWearChange(materialFromSlot); SendWearChange(materialFromSlot);
} }
} }
@ -5790,7 +5790,7 @@ void Merc::Depop() {
RemoveMercFromGroup(this, GetGroup()); RemoveMercFromGroup(this, GetGroup());
} }
entity_list.RemoveMerc(this->GetID()); entity_list.RemoveMerc(GetID());
if(HasPet()) if(HasPet())
{ {
@ -6064,9 +6064,9 @@ void Client::SetMerc(Merc* newmerc) {
{ {
SetMercID(newmerc->GetID()); SetMercID(newmerc->GetID());
//Client* oldowner = entity_list.GetClientByID(newmerc->GetOwnerID()); //Client* oldowner = entity_list.GetClientByID(newmerc->GetOwnerID());
newmerc->SetOwnerID(this->GetID()); newmerc->SetOwnerID(GetID());
newmerc->SetMercCharacterID(this->CharacterID()); newmerc->SetMercCharacterID(CharacterID());
newmerc->SetClientVersion((uint8)this->ClientVersion()); newmerc->SetClientVersion((uint8)ClientVersion());
GetMercInfo().mercid = newmerc->GetMercID(); GetMercInfo().mercid = newmerc->GetMercID();
GetMercInfo().MercTemplateID = newmerc->GetMercTemplateID(); GetMercInfo().MercTemplateID = newmerc->GetMercTemplateID();
GetMercInfo().myTemplate = zone->GetMercTemplate(GetMercInfo().MercTemplateID); GetMercInfo().myTemplate = zone->GetMercTemplate(GetMercInfo().MercTemplateID);

View File

@ -603,7 +603,7 @@ void Mob::CalcInvisibleLevel()
SetInvisible(Invisibility::Invisible, true); SetInvisible(Invisibility::Invisible, true);
return; return;
} }
if (is_invisible && !invisible) { if (is_invisible && !invisible) {
SetInvisible(invisible, true); SetInvisible(invisible, true);
return; return;
@ -624,7 +624,7 @@ void Mob::SetInvisible(uint8 state, bool set_on_bonus_calc)
} }
else { else {
/* /*
if your setting invisible from a script, or escape/fading memories effect then if your setting invisible from a script, or escape/fading memories effect then
we use the internal invis variable which allows invisible without a buff on mob. we use the internal invis variable which allows invisible without a buff on mob.
*/ */
if (!set_on_bonus_calc) { if (!set_on_bonus_calc) {
@ -644,10 +644,10 @@ void Mob::SetInvisible(uint8 state, bool set_on_bonus_calc)
} }
} }
void Mob::ZeroInvisibleVars(uint8 invisible_type) void Mob::ZeroInvisibleVars(uint8 invisible_type)
{ {
switch (invisible_type) { switch (invisible_type) {
case T_INVISIBLE: case T_INVISIBLE:
invisible = 0; invisible = 0;
nobuff_invisible = 0; nobuff_invisible = 0;
@ -1410,7 +1410,7 @@ void Mob::CreateDespawnPacket(EQApplicationPacket* app, bool Decay)
void Mob::CreateHPPacket(EQApplicationPacket* app) void Mob::CreateHPPacket(EQApplicationPacket* app)
{ {
this->IsFullHP=(current_hp>=max_hp); IsFullHP=(current_hp>=max_hp);
app->SetOpcode(OP_MobHealth); app->SetOpcode(OP_MobHealth);
app->size = sizeof(SpawnHPUpdate_Struct2); app->size = sizeof(SpawnHPUpdate_Struct2);
app->pBuffer = new uchar[app->size]; app->pBuffer = new uchar[app->size];
@ -1669,9 +1669,9 @@ void Mob::MakeSpawnUpdate(PlayerPositionUpdateServer_Struct* spu) {
spu->delta_z = FloatToEQ13(m_Delta.z); spu->delta_z = FloatToEQ13(m_Delta.z);
spu->heading = FloatToEQ12(m_Position.w); spu->heading = FloatToEQ12(m_Position.w);
#ifdef BOTS #ifdef BOTS
if (this->IsClient() || this->IsBot()) if (IsClient() || IsBot())
#else #else
if (this->IsClient()) if (IsClient())
#endif #endif
spu->animation = animation; spu->animation = animation;
else else
@ -1791,13 +1791,13 @@ void Mob::ShowStats(Client* client)
target_name, target_name,
( (
!target_last_name.empty() ? !target_last_name.empty() ?
fmt::format(" ({})", target_last_name) : fmt::format(" ({})", target_last_name) :
"" ""
), ),
target->GetLevel() target->GetLevel()
).c_str() ).c_str()
); );
// Race / Class / Gender // Race / Class / Gender
client->Message( client->Message(
Chat::White, Chat::White,
@ -1879,7 +1879,7 @@ void Mob::ShowStats(Client* client)
target->GetHairColor() target->GetHairColor()
).c_str() ).c_str()
); );
// Beard // Beard
client->Message( client->Message(
Chat::White, Chat::White,
@ -1912,7 +1912,7 @@ void Mob::ShowStats(Client* client)
target->GetHelmTexture() target->GetHelmTexture()
).c_str() ).c_str()
); );
if ( if (
target->GetArmTexture() || target->GetArmTexture() ||
target->GetBracerTexture() || target->GetBracerTexture() ||
@ -1928,7 +1928,7 @@ void Mob::ShowStats(Client* client)
).c_str() ).c_str()
); );
} }
if ( if (
target->GetFeetTexture() || target->GetFeetTexture() ||
target->GetLegTexture() target->GetLegTexture()
@ -2152,7 +2152,7 @@ void Mob::ShowStats(Client* client)
target->GetINT() target->GetINT()
).c_str() ).c_str()
); );
client->Message( client->Message(
Chat::White, Chat::White,
fmt::format( fmt::format(
@ -2182,7 +2182,7 @@ void Mob::ShowStats(Client* client)
target->GetCharmedAvoidance() target->GetCharmedAvoidance()
).c_str() ).c_str()
); );
client->Message( client->Message(
Chat::White, Chat::White,
fmt::format( fmt::format(
@ -2324,7 +2324,7 @@ void Mob::ShowStats(Client* client)
(target->GetProximityMaxX() - target->GetProximityMinX()) (target->GetProximityMaxX() - target->GetProximityMinX())
).c_str() ).c_str()
); );
client->Message( client->Message(
Chat::White, Chat::White,
fmt::format( fmt::format(
@ -2334,7 +2334,7 @@ void Mob::ShowStats(Client* client)
(target->GetProximityMaxY() - target->GetProximityMinY()) (target->GetProximityMaxY() - target->GetProximityMinY())
).c_str() ).c_str()
); );
client->Message( client->Message(
Chat::White, Chat::White,
fmt::format( fmt::format(
@ -2383,7 +2383,7 @@ void Mob::DoAnim(const int animnum, int type, bool ackreq, eqFilterType filter)
void Mob::ShowBuffs(Client* client) { void Mob::ShowBuffs(Client* client) {
if(SPDAT_RECORDS <= 0) if(SPDAT_RECORDS <= 0)
return; return;
client->Message(Chat::White, "Buffs on: %s", this->GetName()); client->Message(Chat::White, "Buffs on: %s", GetName());
uint32 i; uint32 i;
uint32 buff_count = GetMaxTotalSlots(); uint32 buff_count = GetMaxTotalSlots();
for (i=0; i < buff_count; i++) { for (i=0; i < buff_count; i++) {
@ -2417,7 +2417,7 @@ void Mob::ShowBuffList(Client* client) {
if(SPDAT_RECORDS <= 0) if(SPDAT_RECORDS <= 0)
return; return;
client->Message(Chat::White, "Buffs on: %s", this->GetCleanName()); client->Message(Chat::White, "Buffs on: %s", GetCleanName());
uint32 i; uint32 i;
uint32 buff_count = GetMaxTotalSlots(); uint32 buff_count = GetMaxTotalSlots();
for (i = 0; i < buff_count; i++) { for (i = 0; i < buff_count; i++) {
@ -2885,15 +2885,15 @@ void Mob::SendAppearancePacket(uint32 type, uint32 value, bool WholeZone, bool i
return; return;
auto outapp = new EQApplicationPacket(OP_SpawnAppearance, sizeof(SpawnAppearance_Struct)); auto outapp = new EQApplicationPacket(OP_SpawnAppearance, sizeof(SpawnAppearance_Struct));
SpawnAppearance_Struct* appearance = (SpawnAppearance_Struct*)outapp->pBuffer; SpawnAppearance_Struct* appearance = (SpawnAppearance_Struct*)outapp->pBuffer;
appearance->spawn_id = this->GetID(); appearance->spawn_id = GetID();
appearance->type = type; appearance->type = type;
appearance->parameter = value; appearance->parameter = value;
if (WholeZone) if (WholeZone)
entity_list.QueueClients(this, outapp, iIgnoreSelf); entity_list.QueueClients(this, outapp, iIgnoreSelf);
else if(specific_target != nullptr) else if(specific_target != nullptr)
specific_target->QueuePacket(outapp, false, Client::CLIENT_CONNECTED); specific_target->QueuePacket(outapp, false, Client::CLIENT_CONNECTED);
else if (this->IsClient()) else if (IsClient())
this->CastToClient()->QueuePacket(outapp, false, Client::CLIENT_CONNECTED); CastToClient()->QueuePacket(outapp, false, Client::CLIENT_CONNECTED);
safe_delete(outapp); safe_delete(outapp);
} }
@ -2932,11 +2932,11 @@ void Mob::SendStunAppearance()
safe_delete(outapp); safe_delete(outapp);
} }
void Mob::SendAppearanceEffect(uint32 parm1, uint32 parm2, uint32 parm3, uint32 parm4, uint32 parm5, Client *specific_target, void Mob::SendAppearanceEffect(uint32 parm1, uint32 parm2, uint32 parm3, uint32 parm4, uint32 parm5, Client *specific_target,
uint32 value1slot, uint32 value1ground, uint32 value2slot, uint32 value2ground, uint32 value3slot, uint32 value3ground, uint32 value1slot, uint32 value1ground, uint32 value2slot, uint32 value2ground, uint32 value3slot, uint32 value3ground,
uint32 value4slot, uint32 value4ground, uint32 value5slot, uint32 value5ground){ uint32 value4slot, uint32 value4ground, uint32 value5slot, uint32 value5ground){
auto outapp = new EQApplicationPacket(OP_LevelAppearance, sizeof(LevelAppearance_Struct)); auto outapp = new EQApplicationPacket(OP_LevelAppearance, sizeof(LevelAppearance_Struct));
/* Location of the effect from value#slot, this is removed upon mob death/despawn. /* Location of the effect from value#slot, this is removed upon mob death/despawn.
0 = pelvis1 0 = pelvis1
1 = pelvis2 1 = pelvis2
@ -3014,7 +3014,7 @@ void Mob::SendAppearanceEffect(uint32 parm1, uint32 parm2, uint32 parm3, uint32
safe_delete(outapp); safe_delete(outapp);
} }
void Mob::SetAppearenceEffects(int32 slot, int32 value) void Mob::SetAppearenceEffects(int32 slot, int32 value)
{ {
for (int i = 0; i < MAX_APPEARANCE_EFFECTS; i++) { for (int i = 0; i < MAX_APPEARANCE_EFFECTS; i++) {
if (!appearance_effects_id[i]) { if (!appearance_effects_id[i]) {
@ -3032,7 +3032,7 @@ void Mob::GetAppearenceEffects()
Message(Chat::Red, "No Appearance Effects exist on this mob"); Message(Chat::Red, "No Appearance Effects exist on this mob");
return; return;
} }
for (int i = 0; i < MAX_APPEARANCE_EFFECTS; i++) { for (int i = 0; i < MAX_APPEARANCE_EFFECTS; i++) {
Message(Chat::Red, "ID: %i :: App Effect ID %i :: Slot %i", i, appearance_effects_id[i], appearance_effects_slot[i]); Message(Chat::Red, "ID: %i :: App Effect ID %i :: Slot %i", i, appearance_effects_id[i], appearance_effects_slot[i]);
} }
@ -3250,12 +3250,12 @@ void Mob::ChangeSize(float in_size = 0, bool bNoRestriction) {
// Size Code // Size Code
if (!bNoRestriction) if (!bNoRestriction)
{ {
if (this->IsClient() || this->petid != 0) if (IsClient() || petid != 0)
if (in_size < 3.0) if (in_size < 3.0)
in_size = 3.0; in_size = 3.0;
if (this->IsClient() || this->petid != 0) if (IsClient() || petid != 0)
if (in_size > 15.0) if (in_size > 15.0)
in_size = 15.0; in_size = 15.0;
} }
@ -3274,12 +3274,12 @@ void Mob::ChangeSize(float in_size = 0, bool bNoRestriction) {
Mob* Mob::GetOwnerOrSelf() { Mob* Mob::GetOwnerOrSelf() {
if (!GetOwnerID()) if (!GetOwnerID())
return this; return this;
Mob* owner = entity_list.GetMob(this->GetOwnerID()); Mob* owner = entity_list.GetMob(GetOwnerID());
if (!owner) { if (!owner) {
SetOwnerID(0); SetOwnerID(0);
return(this); return(this);
} }
if (owner->GetPetID() == this->GetID()) { if (owner->GetPetID() == GetID()) {
return owner; return owner;
} }
if(IsNPC() && CastToNPC()->GetSwarmInfo()){ if(IsNPC() && CastToNPC()->GetSwarmInfo()){
@ -3290,8 +3290,8 @@ Mob* Mob::GetOwnerOrSelf() {
} }
Mob* Mob::GetOwner() { Mob* Mob::GetOwner() {
Mob* owner = entity_list.GetMob(this->GetOwnerID()); Mob* owner = entity_list.GetMob(GetOwnerID());
if (owner && owner->GetPetID() == this->GetID()) { if (owner && owner->GetPetID() == GetID()) {
return owner; return owner;
} }
@ -3656,7 +3656,7 @@ bool Mob::HateSummon() {
if(summon_level == 1) { if(summon_level == 1) {
entity_list.MessageClose(this, true, 500, Chat::Say, "%s says 'You will not evade me, %s!' ", GetCleanName(), target->GetCleanName() ); entity_list.MessageClose(this, true, 500, Chat::Say, "%s says 'You will not evade me, %s!' ", GetCleanName(), target->GetCleanName() );
float summoner_zoff = this->GetZOffset(); float summoner_zoff = GetZOffset();
float summoned_zoff = target->GetZOffset(); float summoned_zoff = target->GetZOffset();
auto new_pos = m_Position; auto new_pos = m_Position;
new_pos.z -= (summoner_zoff - summoned_zoff); new_pos.z -= (summoner_zoff - summoned_zoff);
@ -4041,7 +4041,7 @@ void Mob::ExecWeaponProc(const EQ::ItemInstance *inst, uint16 spell_id, Mob *on,
if(!IsValidSpell(spell_id)) { // Check for a valid spell otherwise it will crash through the function if(!IsValidSpell(spell_id)) { // Check for a valid spell otherwise it will crash through the function
if(IsClient()){ if(IsClient()){
Message(0, "Invalid spell proc %u", spell_id); Message(0, "Invalid spell proc %u", spell_id);
LogSpells("Player [{}], Weapon Procced invalid spell [{}]", this->GetName(), spell_id); LogSpells("Player [{}], Weapon Procced invalid spell [{}]", GetName(), spell_id);
} }
return; return;
} }
@ -4364,7 +4364,7 @@ bool Mob::EntityVariableExists(const char *id)
void Mob::SetFlyMode(GravityBehavior flymode) void Mob::SetFlyMode(GravityBehavior flymode)
{ {
this->flymode = flymode; flymode = flymode;
} }
void Mob::Teleport(const glm::vec3 &pos) void Mob::Teleport(const glm::vec3 &pos)
@ -4593,7 +4593,7 @@ int32 Mob::GetVulnerability(Mob *caster, uint32 spell_id, uint32 ticsremaining,
fc_spell_vulnerability_mod = GetFocusEffect(focusSpellVulnerability, spell_id, caster, from_buff_tic); fc_spell_vulnerability_mod = GetFocusEffect(focusSpellVulnerability, spell_id, caster, from_buff_tic);
fc_spell_damage_pct_incomingPC_mod = GetFocusEffect(focusFcSpellDamagePctIncomingPC, spell_id, caster, from_buff_tic); fc_spell_damage_pct_incomingPC_mod = GetFocusEffect(focusFcSpellDamagePctIncomingPC, spell_id, caster, from_buff_tic);
total_mod = fc_spell_vulnerability_mod + fc_spell_damage_pct_incomingPC_mod; total_mod = fc_spell_vulnerability_mod + fc_spell_damage_pct_incomingPC_mod;
//Don't let focus derived mods reduce past 99% mitigation. Quest related can, and for custom functionality if negative will give a healing affect instead of damage. //Don't let focus derived mods reduce past 99% mitigation. Quest related can, and for custom functionality if negative will give a healing affect instead of damage.
@ -4708,7 +4708,7 @@ void Mob::SetBottomRampageList()
if (mob->IsNPC() && mob->CheckAggro(this)) { if (mob->IsNPC() && mob->CheckAggro(this)) {
for (int i = 0; i < mob->RampageArray.size(); i++) { for (int i = 0; i < mob->RampageArray.size(); i++) {
// Find this mob in the rampage list // Find this mob in the rampage list
if (this->GetID() == mob->RampageArray[i]) { if (GetID() == mob->RampageArray[i]) {
//Move to bottom of Rampage List //Move to bottom of Rampage List
auto it = mob->RampageArray.begin() + i; auto it = mob->RampageArray.begin() + i;
std::rotate(it, it + 1, mob->RampageArray.end()); std::rotate(it, it + 1, mob->RampageArray.end());
@ -4735,7 +4735,7 @@ void Mob::SetTopRampageList()
if (mob->IsNPC() && mob->CheckAggro(this)) { if (mob->IsNPC() && mob->CheckAggro(this)) {
for (int i = 0; i < mob->RampageArray.size(); i++) { for (int i = 0; i < mob->RampageArray.size(); i++) {
// Find this mob in the rampage list // Find this mob in the rampage list
if (this->GetID() == mob->RampageArray[i]) { if (GetID() == mob->RampageArray[i]) {
//Move to Top of Rampage List //Move to Top of Rampage List
auto it = mob->RampageArray.begin() + i; auto it = mob->RampageArray.begin() + i;
std::rotate(it, it + 1, mob->RampageArray.end()); std::rotate(it, it + 1, mob->RampageArray.end());
@ -4836,20 +4836,20 @@ std::string Mob::GetGlobal(const char *varname) {
int qgCharid = 0; int qgCharid = 0;
int qgNpcid = 0; int qgNpcid = 0;
if (this->IsNPC()) if (IsNPC())
qgNpcid = this->GetNPCTypeID(); qgNpcid = GetNPCTypeID();
if (this->IsClient()) if (IsClient())
qgCharid = this->CastToClient()->CharacterID(); qgCharid = CastToClient()->CharacterID();
QGlobalCache *qglobals = nullptr; QGlobalCache *qglobals = nullptr;
std::list<QGlobal> globalMap; std::list<QGlobal> globalMap;
if (this->IsClient()) if (IsClient())
qglobals = this->CastToClient()->GetQGlobals(); qglobals = CastToClient()->GetQGlobals();
if (this->IsNPC()) if (IsNPC())
qglobals = this->CastToNPC()->GetQGlobals(); qglobals = CastToNPC()->GetQGlobals();
if(qglobals) if(qglobals)
QGlobalCache::Combine(globalMap, qglobals->GetBucket(), qgNpcid, qgCharid, zone->GetZoneID()); QGlobalCache::Combine(globalMap, qglobals->GetBucket(), qgNpcid, qgCharid, zone->GetZoneID());
@ -4871,18 +4871,18 @@ void Mob::SetGlobal(const char *varname, const char *newvalue, int options, cons
int qgCharid = 0; int qgCharid = 0;
int qgNpcid = 0; int qgNpcid = 0;
if (this->IsNPC()) if (IsNPC())
{ {
qgNpcid = this->GetNPCTypeID(); qgNpcid = GetNPCTypeID();
} }
else if (other && other->IsNPC()) else if (other && other->IsNPC())
{ {
qgNpcid = other->GetNPCTypeID(); qgNpcid = other->GetNPCTypeID();
} }
if (this->IsClient()) if (IsClient())
{ {
qgCharid = this->CastToClient()->CharacterID(); qgCharid = CastToClient()->CharacterID();
} }
else if (other && other->IsClient()) else if (other && other->IsClient())
{ {
@ -4922,11 +4922,11 @@ void Mob::DelGlobal(const char *varname) {
int qgCharid=0; int qgCharid=0;
int qgNpcid=0; int qgNpcid=0;
if (this->IsNPC()) if (IsNPC())
qgNpcid = this->GetNPCTypeID(); qgNpcid = GetNPCTypeID();
if (this->IsClient()) if (IsClient())
qgCharid = this->CastToClient()->CharacterID(); qgCharid = CastToClient()->CharacterID();
else else
qgCharid = -qgNpcid; // make char id negative npc id as a fudge qgCharid = -qgNpcid; // make char id negative npc id as a fudge
@ -5344,7 +5344,7 @@ int16 Mob::GetMeleeDmgPositionMod(Mob* defender)
int16 Mob::GetSkillReuseTime(uint16 skill) int16 Mob::GetSkillReuseTime(uint16 skill)
{ {
int skill_reduction = this->itembonuses.SkillReuseTime[skill] + this->spellbonuses.SkillReuseTime[skill] + this->aabonuses.SkillReuseTime[skill]; int skill_reduction = itembonuses.SkillReuseTime[skill] + spellbonuses.SkillReuseTime[skill] + aabonuses.SkillReuseTime[skill];
return skill_reduction; return skill_reduction;
} }
@ -5445,7 +5445,7 @@ void Mob::DoGravityEffect()
if(casterId) if(casterId)
caster = entity_list.GetMob(casterId); caster = entity_list.GetMob(casterId);
if(!caster || casterId == this->GetID()) if(!caster || casterId == GetID())
continue; continue;
caster_x = caster->GetX(); caster_x = caster->GetX();
@ -5505,9 +5505,9 @@ void Mob::DoGravityEffect()
} }
if(IsClient()) if(IsClient())
this->CastToClient()->MovePC(zone->GetZoneID(), zone->GetInstanceID(), cur_x, cur_y, new_ground, GetHeading()); CastToClient()->MovePC(zone->GetZoneID(), zone->GetInstanceID(), cur_x, cur_y, new_ground, GetHeading());
else else
this->GMMove(cur_x, cur_y, new_ground, GetHeading()); GMMove(cur_x, cur_y, new_ground, GetHeading());
} }
} }
@ -5890,7 +5890,7 @@ FACTION_VALUE Mob::GetSpecialFactionCon(Mob* iOther) {
return FACTION_INDIFFERENTLY; return FACTION_INDIFFERENTLY;
iOther = iOther->GetOwnerOrSelf(); iOther = iOther->GetOwnerOrSelf();
Mob* self = this->GetOwnerOrSelf(); Mob* self = GetOwnerOrSelf();
bool selfAIcontrolled = self->IsAIControlled(); bool selfAIcontrolled = self->IsAIControlled();
bool iOtherAIControlled = iOther->IsAIControlled(); bool iOtherAIControlled = iOther->IsAIControlled();
@ -6190,7 +6190,7 @@ uint8 Mob::GetSeeInvisibleLevelFromNPCStat(uint16 in_see_invis)
if (in_see_invis == 1) { if (in_see_invis == 1) {
return 1; return 1;
} }
//random chance to apply standard level 1 see invs //random chance to apply standard level 1 see invs
if (in_see_invis > 1 && in_see_invis < 100) { if (in_see_invis > 1 && in_see_invis < 100) {
if (zone->random.Int(0, 99) < in_see_invis) { if (zone->random.Int(0, 99) < in_see_invis) {
@ -6550,7 +6550,7 @@ bool Mob::ShieldAbility(uint32 target_id, int shielder_max_distance, int shield_
if (shield_target->CalculateDistance(GetX(), GetY(), GetZ()) > static_cast<float>(shielder_max_distance)) { if (shield_target->CalculateDistance(GetX(), GetY(), GetZ()) > static_cast<float>(shielder_max_distance)) {
MessageString(Chat::Blue, TARGET_TOO_FAR); MessageString(Chat::Blue, TARGET_TOO_FAR);
return false; return false;
} }
entity_list.MessageCloseString(this, false, 100, 0, START_SHIELDING, GetCleanName(), shield_target->GetCleanName()); entity_list.MessageCloseString(this, false, 100, 0, START_SHIELDING, GetCleanName(), shield_target->GetCleanName());
@ -6617,7 +6617,7 @@ void Mob::ShieldAbilityClearVariables()
} }
void Mob::SetFeigned(bool in_feigned) { void Mob::SetFeigned(bool in_feigned) {
if (in_feigned) { if (in_feigned) {
if (IsClient()) { if (IsClient()) {
if (RuleB(Character, FeignKillsPet)){ if (RuleB(Character, FeignKillsPet)){

View File

@ -355,7 +355,7 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint32 iSpellTypes, bool bInnates
break; break;
} }
default: { default: {
std::cout << "Error: Unknown spell type in AICastSpell. caster:" << this->GetName() << " type:" << AIspells[i].type << " slot:" << i << std::endl; std::cout << "Error: Unknown spell type in AICastSpell. caster:" << GetName() << " type:" << AIspells[i].type << " slot:" << i << std::endl;
break; break;
} }
} }
@ -531,12 +531,12 @@ void NPC::AI_Stop() {
void Client::AI_Stop() { void Client::AI_Stop() {
Mob::AI_Stop(); Mob::AI_Stop();
this->MessageString(Chat::Red,PLAYER_REGAIN); MessageString(Chat::Red,PLAYER_REGAIN);
auto app = new EQApplicationPacket(OP_Charm, sizeof(Charm_Struct)); auto app = new EQApplicationPacket(OP_Charm, sizeof(Charm_Struct));
Charm_Struct *ps = (Charm_Struct*)app->pBuffer; Charm_Struct *ps = (Charm_Struct*)app->pBuffer;
ps->owner_id = 0; ps->owner_id = 0;
ps->pet_id = this->GetID(); ps->pet_id = GetID();
ps->command = 0; ps->command = 0;
entity_list.QueueClients(this, app); entity_list.QueueClients(this, app);
safe_delete(app); safe_delete(app);
@ -842,7 +842,7 @@ void Client::AI_Process()
std::set<uint32>::iterator remembered_feigned_mobid; std::set<uint32>::iterator remembered_feigned_mobid;
remembered_feigned_mobid = feign_memory_list.begin(); remembered_feigned_mobid = feign_memory_list.begin();
while (remembered_feigned_mobid != feign_memory_list.end()) { while (remembered_feigned_mobid != feign_memory_list.end()) {
Mob* remembered_mob = entity_list.GetMob(*remembered_feigned_mobid); Mob* remembered_mob = entity_list.GetMob(*remembered_feigned_mobid);
if (remembered_mob == nullptr || remembered_mob->IsCorpse()) { if (remembered_mob == nullptr || remembered_mob->IsCorpse()) {
//they are gone now... //they are gone now...
@ -1019,7 +1019,7 @@ void Mob::AI_Process() {
* Make sure we're opening a door within height relevance and not platforms * Make sure we're opening a door within height relevance and not platforms
* above or below * above or below
*/ */
if (std::abs(this->m_Position.z - door->GetPosition().z) > 10) { if (std::abs(m_Position.z - door->GetPosition().z) > 10) {
continue; continue;
} }
@ -1411,8 +1411,8 @@ void Mob::AI_Process() {
continue; continue;
} }
if (this->CheckWillAggro(mob)) { if (CheckWillAggro(mob)) {
this->AddToHateList(mob); AddToHateList(mob);
} }
} }
@ -1538,13 +1538,13 @@ void Mob::AI_Process() {
{ {
// dont move till a bit after you last fought // dont move till a bit after you last fought
if (time_until_can_move < Timer::GetCurrentTime()) { if (time_until_can_move < Timer::GetCurrentTime()) {
if (this->IsClient()) { if (IsClient()) {
/** /**
* LD timer expired, drop out of world * LD timer expired, drop out of world
*/ */
if (this->CastToClient()->IsLD()) { if (CastToClient()->IsLD()) {
this->CastToClient()->Disconnect(); CastToClient()->Disconnect();
} }
return; return;
@ -1603,7 +1603,7 @@ void NPC::AI_DoMovement() {
Log( Log(
Logs::Detail, Logs::Detail,
Logs::NPCRoamBox, "(%s) Timer calc | random_timer [%i] roambox_move_delay [%i] move_min [%i] move_max [%i]", Logs::NPCRoamBox, "(%s) Timer calc | random_timer [%i] roambox_move_delay [%i] move_min [%i] move_max [%i]",
this->GetCleanName(), GetCleanName(),
random_timer, random_timer,
roambox_move_delay, roambox_move_delay,
(int) GetRoamboxMinDelay(), (int) GetRoamboxMinDelay(),
@ -1641,7 +1641,7 @@ void NPC::AI_DoMovement() {
* If mob was not spawned in water, let's not randomly roam them into water * If mob was not spawned in water, let's not randomly roam them into water
* if the roam box was sloppily configured * if the roam box was sloppily configured
*/ */
if (!this->GetWasSpawnedInWater()) { if (!GetWasSpawnedInWater()) {
roambox_destination_z = GetGroundZ(roambox_destination_x, roambox_destination_y); roambox_destination_z = GetGroundZ(roambox_destination_x, roambox_destination_y);
if (zone->HasMap() && zone->HasWaterMap()) { if (zone->HasMap() && zone->HasWaterMap()) {
auto position = glm::vec3( auto position = glm::vec3(
@ -1661,7 +1661,7 @@ void NPC::AI_DoMovement() {
if (zone->watermap->InLiquid(position)) { if (zone->watermap->InLiquid(position)) {
Log(Logs::Detail, Log(Logs::Detail,
Logs::NPCRoamBox, "%s | My destination is in water and I don't belong there!", Logs::NPCRoamBox, "%s | My destination is in water and I don't belong there!",
this->GetCleanName()); GetCleanName());
return; return;
} }
@ -1705,7 +1705,7 @@ void NPC::AI_DoMovement() {
Log( Log(
Logs::Detail, Logs::Detail,
Logs::NPCRoamBox, "(%s) We don't have a path route... exiting...", Logs::NPCRoamBox, "(%s) We don't have a path route... exiting...",
this->GetCleanName() GetCleanName()
); );
return; return;
} }
@ -1714,7 +1714,7 @@ void NPC::AI_DoMovement() {
Logs::General, Logs::General,
Logs::NPCRoamBox, Logs::NPCRoamBox,
"NPC (%s) distance [%.0f] X (min/max) [%.0f / %.0f] Y (min/max) [%.0f / %.0f] | Dest x/y/z [%.0f / %.0f / %.0f]", "NPC (%s) distance [%.0f] X (min/max) [%.0f / %.0f] Y (min/max) [%.0f / %.0f] | Dest x/y/z [%.0f / %.0f / %.0f]",
this->GetCleanName(), GetCleanName(),
roambox_distance, roambox_distance,
roambox_min_x, roambox_min_x,
roambox_max_x, roambox_max_x,
@ -1854,7 +1854,7 @@ void NPC::AI_DoMovement() {
} }
void NPC::AI_SetupNextWaypoint() { void NPC::AI_SetupNextWaypoint() {
int32 spawn_id = this->GetSpawnPointID(); int32 spawn_id = GetSpawnPointID();
LinkedListIterator<Spawn2*> iterator(zone->spawn2_list); LinkedListIterator<Spawn2*> iterator(zone->spawn2_list);
iterator.Reset(); iterator.Reset();
Spawn2 *found_spawn = nullptr; Spawn2 *found_spawn = nullptr;
@ -1982,7 +1982,7 @@ void Mob::AI_Event_NoLongerEngaged() {
SetAssistAggro(false); SetAssistAggro(false);
if(CastToNPC()->GetCombatEvent() && GetHP() > 0) if(CastToNPC()->GetCombatEvent() && GetHP() > 0)
{ {
if(entity_list.GetNPCByID(this->GetID())) if(entity_list.GetNPCByID(GetID()))
{ {
uint16 emoteid = CastToNPC()->GetEmoteID(); uint16 emoteid = CastToNPC()->GetEmoteID();
parse->EventNPC(EVENT_COMBAT, CastToNPC(), nullptr, "0", 0); parse->EventNPC(EVENT_COMBAT, CastToNPC(), nullptr, "0", 0);
@ -2075,7 +2075,7 @@ bool NPC::AI_IdleCastCheck() {
//last duration it was set to... try to put up a more reasonable timer... //last duration it was set to... try to put up a more reasonable timer...
AIautocastspell_timer->Start(RandomTimer(AISpellVar.idle_no_sp_recast_min, AISpellVar.idle_no_sp_recast_max), false); AIautocastspell_timer->Start(RandomTimer(AISpellVar.idle_no_sp_recast_min, AISpellVar.idle_no_sp_recast_max), false);
LogSpells("Triggering AI_IdleCastCheck :: Mob [{}] - Min : [{}] Max : [{}]", this->GetCleanName(), AISpellVar.idle_no_sp_recast_min, AISpellVar.idle_no_sp_recast_max); LogSpells("Triggering AI_IdleCastCheck :: Mob [{}] - Min : [{}] Max : [{}]", GetCleanName(), AISpellVar.idle_no_sp_recast_min, AISpellVar.idle_no_sp_recast_max);
} //else, spell casting finishing will reset the timer. } //else, spell casting finishing will reset the timer.
} //else, spell casting finishing will reset the timer. } //else, spell casting finishing will reset the timer.
@ -2533,7 +2533,7 @@ bool NPC::AI_AddNPCSpells(uint32 iDBSpellsID) {
} }
DBnpcspells_Struct* parentlist = content_db.GetNPCSpells(spell_list->parent_list); DBnpcspells_Struct* parentlist = content_db.GetNPCSpells(spell_list->parent_list);
#if MobAI_DEBUG_Spells >= 10 #if MobAI_DEBUG_Spells >= 10
std::string debug_msg = StringFormat("Loading NPCSpells onto %s: dbspellsid=%u, level=%u", this->GetName(), iDBSpellsID, this->GetLevel()); std::string debug_msg = StringFormat("Loading NPCSpells onto %s: dbspellsid=%u, level=%u", GetName(), iDBSpellsID, GetLevel());
if (spell_list) { if (spell_list) {
debug_msg.append(StringFormat(" (found, %u), parentlist=%u", spell_list->entries.size(), spell_list->parent_list)); debug_msg.append(StringFormat(" (found, %u), parentlist=%u", spell_list->entries.size(), spell_list->parent_list));
if (spell_list->parent_list) { if (spell_list->parent_list) {
@ -2708,7 +2708,7 @@ bool NPC::AI_AddNPCSpellsEffects(uint32 iDBSpellsEffectsID) {
uint32 i; uint32 i;
#if MobAI_DEBUG_Spells >= 10 #if MobAI_DEBUG_Spells >= 10
std::string debug_msg = StringFormat("Loading NPCSpellsEffects onto %s: dbspellseffectid=%u", this->GetName(), iDBSpellsEffectsID); std::string debug_msg = StringFormat("Loading NPCSpellsEffects onto %s: dbspellseffectid=%u", GetName(), iDBSpellsEffectsID);
if (spell_effects_list) { if (spell_effects_list) {
debug_msg.append(StringFormat(" (found, %u), parentlist=%u", spell_effects_list->numentries, spell_effects_list->parent_list)); debug_msg.append(StringFormat(" (found, %u), parentlist=%u", spell_effects_list->numentries, spell_effects_list->parent_list));
if (spell_effects_list->parent_list) { if (spell_effects_list->parent_list) {

View File

@ -45,7 +45,7 @@ void Mob::SetMobTextureProfile(uint8 material_slot, uint16 texture, uint32 color
{ {
Log(Logs::Detail, Logs::MobAppearance, Log(Logs::Detail, Logs::MobAppearance,
"Mob::SetMobTextureProfile [%s] material_slot: %u texture: %u color: %u hero_forge_model: %u", "Mob::SetMobTextureProfile [%s] material_slot: %u texture: %u color: %u hero_forge_model: %u",
this->GetCleanName(), GetCleanName(),
material_slot, material_slot,
texture, texture,
color, color,
@ -214,7 +214,7 @@ int32 Mob::GetEquipmentMaterial(uint8 material_slot) const
Log(Logs::Detail, Logs::MobAppearance, Log(Logs::Detail, Logs::MobAppearance,
"Mob::GetEquipmentMaterial [%s] material_slot: %u texture_profile_material: %i", "Mob::GetEquipmentMaterial [%s] material_slot: %u texture_profile_material: %i",
this->clean_name, clean_name,
material_slot, material_slot,
texture_profile_material texture_profile_material
); );
@ -235,7 +235,7 @@ int32 Mob::GetEquipmentMaterial(uint8 material_slot) const
material_slot == EQ::textures::weaponSecondary; material_slot == EQ::textures::weaponSecondary;
if (is_primary_or_secondary_weapon) { if (is_primary_or_secondary_weapon) {
if (this->IsClient()) { if (IsClient()) {
int16 inventory_slot = EQ::InventoryProfile::CalcSlotFromMaterial(material_slot); int16 inventory_slot = EQ::InventoryProfile::CalcSlotFromMaterial(material_slot);
if (inventory_slot == INVALID_INDEX) { if (inventory_slot == INVALID_INDEX) {
@ -408,7 +408,7 @@ void Mob::SendWearChange(uint8 material_slot, Client *one_client)
auto *wear_change = (WearChange_Struct *) packet->pBuffer; auto *wear_change = (WearChange_Struct *) packet->pBuffer;
Log(Logs::Detail, Logs::MobAppearance, "Mob::SendWearChange [%s]", Log(Logs::Detail, Logs::MobAppearance, "Mob::SendWearChange [%s]",
this->GetCleanName() GetCleanName()
); );
wear_change->spawn_id = GetID(); wear_change->spawn_id = GetID();
@ -467,14 +467,14 @@ void Mob::SendTextureWC(
auto outapp = new EQApplicationPacket(OP_WearChange, sizeof(WearChange_Struct)); auto outapp = new EQApplicationPacket(OP_WearChange, sizeof(WearChange_Struct));
auto *wear_change = (WearChange_Struct *) outapp->pBuffer; auto *wear_change = (WearChange_Struct *) outapp->pBuffer;
if (this->IsClient()) { if (IsClient()) {
wear_change->color.Color = GetEquipmentColor(slot); wear_change->color.Color = GetEquipmentColor(slot);
} }
else { else {
wear_change->color.Color = this->GetArmorTint(slot); wear_change->color.Color = GetArmorTint(slot);
} }
wear_change->spawn_id = this->GetID(); wear_change->spawn_id = GetID();
wear_change->material = texture; wear_change->material = texture;
wear_change->wear_slot_id = slot; wear_change->wear_slot_id = slot;
wear_change->unknown06 = unknown06; wear_change->unknown06 = unknown06;
@ -506,7 +506,7 @@ void Mob::SetSlotTint(uint8 material_slot, uint8 red_tint, uint8 green_tint, uin
auto outapp = new EQApplicationPacket(OP_WearChange, sizeof(WearChange_Struct)); auto outapp = new EQApplicationPacket(OP_WearChange, sizeof(WearChange_Struct));
auto *wc = (WearChange_Struct *) outapp->pBuffer; auto *wc = (WearChange_Struct *) outapp->pBuffer;
wc->spawn_id = this->GetID(); wc->spawn_id = GetID();
wc->material = GetEquipmentMaterial(material_slot); wc->material = GetEquipmentMaterial(material_slot);
wc->hero_forge_model = GetHerosForgeModel(material_slot); wc->hero_forge_model = GetHerosForgeModel(material_slot);
wc->color.Color = color; wc->color.Color = color;
@ -539,7 +539,7 @@ void Mob::WearChange(uint8 material_slot, uint16 texture, uint32 color, uint32 h
auto outapp = new EQApplicationPacket(OP_WearChange, sizeof(WearChange_Struct)); auto outapp = new EQApplicationPacket(OP_WearChange, sizeof(WearChange_Struct));
auto *wear_change = (WearChange_Struct *) outapp->pBuffer; auto *wear_change = (WearChange_Struct *) outapp->pBuffer;
wear_change->spawn_id = this->GetID(); wear_change->spawn_id = GetID();
wear_change->material = texture; wear_change->material = texture;
wear_change->hero_forge_model = hero_forge_model; wear_change->hero_forge_model = hero_forge_model;
wear_change->color.Color = color; wear_change->color.Color = color;

View File

@ -638,11 +638,11 @@ void Mob::DisplayInfo(Mob *mob)
return; return;
} }
if (this->IsClient()) { if (IsClient()) {
std::string window_text = "<c \"#FFFF66\">*Drag window open vertically to see all</c><br>"; std::string window_text = "<c \"#FFFF66\">*Drag window open vertically to see all</c><br>";
Client *client = this->CastToClient(); Client *client = CastToClient();
if (!client->IsDevToolsEnabled()) { if (!client->IsDevToolsEnabled()) {
return; return;

View File

@ -825,20 +825,20 @@ bool NPC::Process()
{ {
if (p_depop) if (p_depop)
{ {
Mob* owner = entity_list.GetMob(this->ownerid); Mob* owner = entity_list.GetMob(ownerid);
if (owner != 0) if (owner != 0)
{ {
//if(GetBodyType() != BT_SwarmPet) //if(GetBodyType() != BT_SwarmPet)
// owner->SetPetID(0); // owner->SetPetID(0);
this->ownerid = 0; ownerid = 0;
this->petid = 0; petid = 0;
} }
return false; return false;
} }
if (IsStunned() && stunned_timer.Check()) { if (IsStunned() && stunned_timer.Check()) {
Mob::UnStun(); Mob::UnStun();
this->spun_timer.Disable(); spun_timer.Disable();
} }
SpellProcess(); SpellProcess();
@ -969,7 +969,7 @@ bool NPC::Process()
/** /**
* Send HP updates when engaged * Send HP updates when engaged
*/ */
if (send_hp_update_timer.Check(false) && this->IsEngaged()) { if (send_hp_update_timer.Check(false) && IsEngaged()) {
SendHPUpdate(); SendHPUpdate();
} }
@ -1081,9 +1081,9 @@ void NPC::UpdateEquipmentLight()
} }
void NPC::Depop(bool StartSpawnTimer) { void NPC::Depop(bool StartSpawnTimer) {
uint16 emoteid = this->GetEmoteID(); uint16 emoteid = GetEmoteID();
if(emoteid != 0) if(emoteid != 0)
this->DoNPCEmote(ONDESPAWN,emoteid); DoNPCEmote(ONDESPAWN,emoteid);
p_depop = true; p_depop = true;
if (respawn2) if (respawn2)
{ {
@ -1107,7 +1107,7 @@ bool NPC::DatabaseCastAccepted(int spell_id) {
} }
case SE_CurrentHPOnce: case SE_CurrentHPOnce:
case SE_CurrentHP: { case SE_CurrentHP: {
if(this->GetHPRatio() < 100 && spells[spell_id].buff_duration == 0) if(GetHPRatio() < 100 && spells[spell_id].buff_duration == 0)
return true; return true;
else else
return false; return false;
@ -1115,7 +1115,7 @@ bool NPC::DatabaseCastAccepted(int spell_id) {
} }
case SE_HealOverTime: { case SE_HealOverTime: {
if(this->GetHPRatio() < 100) if(GetHPRatio() < 100)
return true; return true;
else else
return false; return false;
@ -1140,7 +1140,7 @@ bool NPC::DatabaseCastAccepted(int spell_id) {
break; break;
} }
default: default:
if(spells[spell_id].good_effect == 1 && !(spells[spell_id].buff_duration == 0 && this->GetHPRatio() == 100) && !IsEngaged()) if(spells[spell_id].good_effect == 1 && !(spells[spell_id].buff_duration == 0 && GetHPRatio() == 100) && !IsEngaged())
return true; return true;
return false; return false;
} }
@ -1762,7 +1762,7 @@ int32 NPC::GetEquipmentMaterial(uint8 material_slot) const
int32 texture_profile_material = GetTextureProfileMaterial(material_slot); int32 texture_profile_material = GetTextureProfileMaterial(material_slot);
Log(Logs::Detail, Logs::MobAppearance, "NPC::GetEquipmentMaterial [%s] material_slot: %u", Log(Logs::Detail, Logs::MobAppearance, "NPC::GetEquipmentMaterial [%s] material_slot: %u",
this->clean_name, clean_name,
material_slot material_slot
); );
@ -1983,7 +1983,7 @@ void NPC::Disarm(Client* client, int chance) {
CalcBonuses(); CalcBonuses();
if (inst) { if (inst) {
// create a ground item // create a ground item
Object* object = new Object(inst, this->GetX(), this->GetY(), this->GetZ(), 0.0f, 300000); Object* object = new Object(inst, GetX(), GetY(), GetZ(), 0.0f, 300000);
entity_list.AddObject(object, true); entity_list.AddObject(object, true);
object->StartDecay(); object->StartDecay();
safe_delete(inst); safe_delete(inst);
@ -1997,7 +1997,7 @@ void NPC::Disarm(Client* client, int chance) {
SendWearChange(matslot); SendWearChange(matslot);
if ((CastToMob()->GetBodyType() == BT_Humanoid || CastToMob()->GetBodyType() == BT_Summoned) && eslot == EQ::invslot::slotPrimary) if ((CastToMob()->GetBodyType() == BT_Humanoid || CastToMob()->GetBodyType() == BT_Summoned) && eslot == EQ::invslot::slotPrimary)
Say("Ahh! My weapon!"); Say("Ahh! My weapon!");
client->MessageString(Chat::Skills, DISARM_SUCCESS, this->GetCleanName()); client->MessageString(Chat::Skills, DISARM_SUCCESS, GetCleanName());
if (chance != 1000) if (chance != 1000)
client->CheckIncreaseSkill(EQ::skills::SkillDisarm, nullptr, 4); client->CheckIncreaseSkill(EQ::skills::SkillDisarm, nullptr, 4);
return; return;
@ -2151,11 +2151,11 @@ void Mob::NPCSpecialAttacks(const char* parse, int permtag, bool reset, bool rem
parse++; parse++;
} }
if(permtag == 1 && this->GetNPCTypeID() > 0) if(permtag == 1 && GetNPCTypeID() > 0)
{ {
if(content_db.SetSpecialAttkFlag(this->GetNPCTypeID(), orig_parse)) if(content_db.SetSpecialAttkFlag(GetNPCTypeID(), orig_parse))
{ {
LogInfo("NPCTypeID: [{}] flagged to [{}] for Special Attacks.\n",this->GetNPCTypeID(),orig_parse); LogInfo("NPCTypeID: [{}] flagged to [{}] for Special Attacks.\n",GetNPCTypeID(),orig_parse);
} }
} }
} }
@ -2392,9 +2392,9 @@ void NPC::PetOnSpawn(NewSpawn_Struct* ns)
if (tmp_lastname.size() < sizeof(ns->spawn.lastName)) if (tmp_lastname.size() < sizeof(ns->spawn.lastName))
strn0cpy(ns->spawn.lastName, tmp_lastname.c_str(), sizeof(ns->spawn.lastName)); strn0cpy(ns->spawn.lastName, tmp_lastname.c_str(), sizeof(ns->spawn.lastName));
} }
else else
{ {
if (entity_list.GetNPCByID(GetOwnerID())) if (entity_list.GetNPCByID(GetOwnerID()))
{ {
SetPetOwnerNPC(true); SetPetOwnerNPC(true);
} }
@ -3026,13 +3026,13 @@ void NPC::DoNPCEmote(uint8 event_, uint16 emoteid)
if(emoteid == nes->emoteid) if(emoteid == nes->emoteid)
{ {
if(nes->type == 1) if(nes->type == 1)
this->Emote("%s",nes->text); Emote("%s",nes->text);
else if(nes->type == 2) else if(nes->type == 2)
this->Shout("%s",nes->text); Shout("%s",nes->text);
else if(nes->type == 3) else if(nes->type == 3)
entity_list.MessageCloseString(this, true, 200, 10, GENERIC_STRING, nes->text); entity_list.MessageCloseString(this, true, 200, 10, GENERIC_STRING, nes->text);
else else
this->Say("%s",nes->text); Say("%s",nes->text);
} }
} }
@ -3578,7 +3578,7 @@ void NPC::AIYellForHelp(Mob *sender, Mob *attacker)
LogAIYellForHelpDetail( LogAIYellForHelpDetail(
"NPC [{}] is assisting [{}] against target [{}]", "NPC [{}] is assisting [{}] against target [{}]",
mob->GetCleanName(), mob->GetCleanName(),
this->GetCleanName(), GetCleanName(),
attacker->GetCleanName() attacker->GetCleanName()
); );
} }
@ -3666,7 +3666,7 @@ std::vector<int> NPC::GetLootList() {
if (std::find(npc_items.begin(), npc_items.end(), loot_item->item_id) != npc_items.end()) { if (std::find(npc_items.begin(), npc_items.end(), loot_item->item_id) != npc_items.end()) {
continue; continue;
} }
npc_items.push_back(loot_item->item_id); npc_items.push_back(loot_item->item_id);
} }
return npc_items; return npc_items;

View File

@ -276,7 +276,7 @@ void Object::SetID(uint16 set_id)
Entity::SetID(set_id); Entity::SetID(set_id);
// Store new id as drop_id // Store new id as drop_id
m_data.drop_id = (uint32)this->GetID(); m_data.drop_id = (uint32)GetID();
} }
// Reset state of object back to zero // Reset state of object back to zero
@ -365,7 +365,7 @@ void Object::Close() {
last_user = user; last_user = user;
// put any remaining items from the world container back into the player's inventory to avoid item loss // put any remaining items from the world container back into the player's inventory to avoid item loss
// if they close the container without removing all items // if they close the container without removing all items
EQ::ItemInstance* container = this->m_inst; EQ::ItemInstance* container = m_inst;
if(container != nullptr) if(container != nullptr)
{ {
for (uint8 i = EQ::invbag::SLOT_BEGIN; i <= EQ::invbag::SLOT_END; i++) for (uint8 i = EQ::invbag::SLOT_BEGIN; i <= EQ::invbag::SLOT_END; i++)
@ -512,7 +512,7 @@ bool Object::HandleClick(Client* sender, const ClickObject_Struct* click_object)
std::string export_string = fmt::format("{}", item->ID); std::string export_string = fmt::format("{}", item->ID);
std::vector<EQ::Any> args; std::vector<EQ::Any> args;
args.push_back(m_inst); args.push_back(m_inst);
if(parse->EventPlayer(EVENT_PLAYER_PICKUP, sender, export_string, this->GetID(), &args)) if(parse->EventPlayer(EVENT_PLAYER_PICKUP, sender, export_string, GetID(), &args))
{ {
auto outapp = new EQApplicationPacket(OP_ClickObject, sizeof(ClickObject_Struct)); auto outapp = new EQApplicationPacket(OP_ClickObject, sizeof(ClickObject_Struct));
memcpy(outapp->pBuffer, click_object, sizeof(ClickObject_Struct)); memcpy(outapp->pBuffer, click_object, sizeof(ClickObject_Struct));
@ -555,7 +555,7 @@ bool Object::HandleClick(Client* sender, const ClickObject_Struct* click_object)
// Remove object // Remove object
content_db.DeleteObject(m_id); content_db.DeleteObject(m_id);
if(!m_ground_spawn) if(!m_ground_spawn)
entity_list.RemoveEntity(this->GetID()); entity_list.RemoveEntity(GetID());
} else { } else {
// Tradeskill item // Tradeskill item
auto outapp = new EQApplicationPacket(OP_ClickObjectAction, sizeof(ClickObjectAction_Struct)); auto outapp = new EQApplicationPacket(OP_ClickObjectAction, sizeof(ClickObjectAction_Struct));
@ -751,64 +751,64 @@ void ZoneDatabase::DeleteObject(uint32 id)
uint32 Object::GetDBID() uint32 Object::GetDBID()
{ {
return this->m_id; return m_id;
} }
uint32 Object::GetType() uint32 Object::GetType()
{ {
return this->m_type; return m_type;
} }
void Object::SetType(uint32 type) void Object::SetType(uint32 type)
{ {
this->m_type = type; m_type = type;
this->m_data.object_type = type; m_data.object_type = type;
} }
uint32 Object::GetIcon() uint32 Object::GetIcon()
{ {
return this->m_icon; return m_icon;
} }
float Object::GetX() float Object::GetX()
{ {
return this->m_data.x; return m_data.x;
} }
float Object::GetY() float Object::GetY()
{ {
return this->m_data.y; return m_data.y;
} }
float Object::GetZ() float Object::GetZ()
{ {
return this->m_data.z; return m_data.z;
} }
float Object::GetHeadingData() float Object::GetHeadingData()
{ {
return this->m_data.heading; return m_data.heading;
} }
float Object::GetTiltX() float Object::GetTiltX()
{ {
return this->m_data.tilt_x; return m_data.tilt_x;
} }
float Object::GetTiltY() float Object::GetTiltY()
{ {
return this->m_data.tilt_y; return m_data.tilt_y;
} }
void Object::SetX(float pos) void Object::SetX(float pos)
{ {
this->m_data.x = pos; m_data.x = pos;
auto app = new EQApplicationPacket(); auto app = new EQApplicationPacket();
auto app2 = new EQApplicationPacket(); auto app2 = new EQApplicationPacket();
this->CreateDeSpawnPacket(app); CreateDeSpawnPacket(app);
this->CreateSpawnPacket(app2); CreateSpawnPacket(app2);
entity_list.QueueClients(0, app); entity_list.QueueClients(0, app);
entity_list.QueueClients(0, app2); entity_list.QueueClients(0, app2);
safe_delete(app); safe_delete(app);
@ -817,12 +817,12 @@ void Object::SetX(float pos)
void Object::SetY(float pos) void Object::SetY(float pos)
{ {
this->m_data.y = pos; m_data.y = pos;
auto app = new EQApplicationPacket(); auto app = new EQApplicationPacket();
auto app2 = new EQApplicationPacket(); auto app2 = new EQApplicationPacket();
this->CreateDeSpawnPacket(app); CreateDeSpawnPacket(app);
this->CreateSpawnPacket(app2); CreateSpawnPacket(app2);
entity_list.QueueClients(0, app); entity_list.QueueClients(0, app);
entity_list.QueueClients(0, app2); entity_list.QueueClients(0, app2);
safe_delete(app); safe_delete(app);
@ -831,12 +831,12 @@ void Object::SetY(float pos)
void Object::SetTiltX(float pos) void Object::SetTiltX(float pos)
{ {
this->m_data.tilt_x = pos; m_data.tilt_x = pos;
auto app = new EQApplicationPacket(); auto app = new EQApplicationPacket();
auto app2 = new EQApplicationPacket(); auto app2 = new EQApplicationPacket();
this->CreateDeSpawnPacket(app); CreateDeSpawnPacket(app);
this->CreateSpawnPacket(app2); CreateSpawnPacket(app2);
entity_list.QueueClients(0, app); entity_list.QueueClients(0, app);
entity_list.QueueClients(0, app2); entity_list.QueueClients(0, app2);
safe_delete(app); safe_delete(app);
@ -845,12 +845,12 @@ void Object::SetTiltX(float pos)
void Object::SetTiltY(float pos) void Object::SetTiltY(float pos)
{ {
this->m_data.tilt_y = pos; m_data.tilt_y = pos;
auto app = new EQApplicationPacket(); auto app = new EQApplicationPacket();
auto app2 = new EQApplicationPacket(); auto app2 = new EQApplicationPacket();
this->CreateDeSpawnPacket(app); CreateDeSpawnPacket(app);
this->CreateSpawnPacket(app2); CreateSpawnPacket(app2);
entity_list.QueueClients(0, app); entity_list.QueueClients(0, app);
entity_list.QueueClients(0, app2); entity_list.QueueClients(0, app2);
safe_delete(app); safe_delete(app);
@ -865,18 +865,18 @@ void Object::SetDisplayName(const char *in_name)
void Object::Depop() void Object::Depop()
{ {
auto app = new EQApplicationPacket(); auto app = new EQApplicationPacket();
this->CreateDeSpawnPacket(app); CreateDeSpawnPacket(app);
entity_list.QueueClients(0, app); entity_list.QueueClients(0, app);
safe_delete(app); safe_delete(app);
entity_list.RemoveObject(this->GetID()); entity_list.RemoveObject(GetID());
} }
void Object::Repop() void Object::Repop()
{ {
auto app = new EQApplicationPacket(); auto app = new EQApplicationPacket();
auto app2 = new EQApplicationPacket(); auto app2 = new EQApplicationPacket();
this->CreateDeSpawnPacket(app); CreateDeSpawnPacket(app);
this->CreateSpawnPacket(app2); CreateSpawnPacket(app2);
entity_list.QueueClients(0, app); entity_list.QueueClients(0, app);
entity_list.QueueClients(0, app2); entity_list.QueueClients(0, app2);
safe_delete(app); safe_delete(app);
@ -887,12 +887,12 @@ void Object::Repop()
void Object::SetZ(float pos) void Object::SetZ(float pos)
{ {
this->m_data.z = pos; m_data.z = pos;
auto app = new EQApplicationPacket(); auto app = new EQApplicationPacket();
auto app2 = new EQApplicationPacket(); auto app2 = new EQApplicationPacket();
this->CreateDeSpawnPacket(app); CreateDeSpawnPacket(app);
this->CreateSpawnPacket(app2); CreateSpawnPacket(app2);
entity_list.QueueClients(0, app); entity_list.QueueClients(0, app);
entity_list.QueueClients(0, app2); entity_list.QueueClients(0, app2);
safe_delete(app); safe_delete(app);
@ -904,8 +904,8 @@ void Object::SetModelName(const char* modelname)
strn0cpy(m_data.object_name, modelname, sizeof(m_data.object_name)); // 32 is the max for chars in object_name, this should be safe strn0cpy(m_data.object_name, modelname, sizeof(m_data.object_name)); // 32 is the max for chars in object_name, this should be safe
auto app = new EQApplicationPacket(); auto app = new EQApplicationPacket();
auto app2 = new EQApplicationPacket(); auto app2 = new EQApplicationPacket();
this->CreateDeSpawnPacket(app); CreateDeSpawnPacket(app);
this->CreateSpawnPacket(app2); CreateSpawnPacket(app2);
entity_list.QueueClients(0, app); entity_list.QueueClients(0, app);
entity_list.QueueClients(0, app2); entity_list.QueueClients(0, app2);
safe_delete(app); safe_delete(app);
@ -917,8 +917,8 @@ void Object::SetSize(float size)
m_data.size = size; m_data.size = size;
auto app = new EQApplicationPacket(); auto app = new EQApplicationPacket();
auto app2 = new EQApplicationPacket(); auto app2 = new EQApplicationPacket();
this->CreateDeSpawnPacket(app); CreateDeSpawnPacket(app);
this->CreateSpawnPacket(app2); CreateSpawnPacket(app2);
entity_list.QueueClients(0, app); entity_list.QueueClients(0, app);
entity_list.QueueClients(0, app2); entity_list.QueueClients(0, app2);
safe_delete(app); safe_delete(app);
@ -930,8 +930,8 @@ void Object::SetSolidType(uint16 solidtype)
m_data.solidtype = solidtype; m_data.solidtype = solidtype;
auto app = new EQApplicationPacket(); auto app = new EQApplicationPacket();
auto app2 = new EQApplicationPacket(); auto app2 = new EQApplicationPacket();
this->CreateDeSpawnPacket(app); CreateDeSpawnPacket(app);
this->CreateSpawnPacket(app2); CreateSpawnPacket(app2);
entity_list.QueueClients(0, app); entity_list.QueueClients(0, app);
entity_list.QueueClients(0, app2); entity_list.QueueClients(0, app2);
safe_delete(app); safe_delete(app);
@ -950,22 +950,22 @@ uint16 Object::GetSolidType()
const char* Object::GetModelName() const char* Object::GetModelName()
{ {
return this->m_data.object_name; return m_data.object_name;
} }
void Object::SetIcon(uint32 icon) void Object::SetIcon(uint32 icon)
{ {
this->m_icon = icon; m_icon = icon;
} }
uint32 Object::GetItemID() uint32 Object::GetItemID()
{ {
if (this->m_inst == 0) if (m_inst == 0)
{ {
return 0; return 0;
} }
const EQ::ItemData* item = this->m_inst->GetItem(); const EQ::ItemData* item = m_inst->GetItem();
if (item == 0) if (item == 0)
{ {
@ -977,11 +977,11 @@ uint32 Object::GetItemID()
void Object::SetItemID(uint32 itemid) void Object::SetItemID(uint32 itemid)
{ {
safe_delete(this->m_inst); safe_delete(m_inst);
if (itemid) if (itemid)
{ {
this->m_inst = database.CreateItem(itemid); m_inst = database.CreateItem(itemid);
} }
} }
@ -989,7 +989,7 @@ void Object::GetObjectData(Object_Struct* Data)
{ {
if (Data) if (Data)
{ {
memcpy(Data, &this->m_data, sizeof(this->m_data)); memcpy(Data, &m_data, sizeof(m_data));
} }
} }
@ -997,7 +997,7 @@ void Object::SetObjectData(Object_Struct* Data)
{ {
if (Data) if (Data)
{ {
memcpy(&this->m_data, Data, sizeof(this->m_data)); memcpy(&m_data, Data, sizeof(m_data));
} }
} }
@ -1005,29 +1005,29 @@ void Object::GetLocation(float* x, float* y, float* z)
{ {
if (x) if (x)
{ {
*x = this->m_data.x; *x = m_data.x;
} }
if (y) if (y)
{ {
*y = this->m_data.y; *y = m_data.y;
} }
if (z) if (z)
{ {
*z = this->m_data.z; *z = m_data.z;
} }
} }
void Object::SetLocation(float x, float y, float z) void Object::SetLocation(float x, float y, float z)
{ {
this->m_data.x = x; m_data.x = x;
this->m_data.y = y; m_data.y = y;
this->m_data.z = z; m_data.z = z;
auto app = new EQApplicationPacket(); auto app = new EQApplicationPacket();
auto app2 = new EQApplicationPacket(); auto app2 = new EQApplicationPacket();
this->CreateDeSpawnPacket(app); CreateDeSpawnPacket(app);
this->CreateSpawnPacket(app2); CreateSpawnPacket(app2);
entity_list.QueueClients(0, app); entity_list.QueueClients(0, app);
entity_list.QueueClients(0, app2); entity_list.QueueClients(0, app2);
safe_delete(app); safe_delete(app);
@ -1038,17 +1038,17 @@ void Object::GetHeading(float* heading)
{ {
if (heading) if (heading)
{ {
*heading = this->m_data.heading; *heading = m_data.heading;
} }
} }
void Object::SetHeading(float heading) void Object::SetHeading(float heading)
{ {
this->m_data.heading = heading; m_data.heading = heading;
auto app = new EQApplicationPacket(); auto app = new EQApplicationPacket();
auto app2 = new EQApplicationPacket(); auto app2 = new EQApplicationPacket();
this->CreateDeSpawnPacket(app); CreateDeSpawnPacket(app);
this->CreateSpawnPacket(app2); CreateSpawnPacket(app2);
entity_list.QueueClients(0, app); entity_list.QueueClients(0, app);
entity_list.QueueClients(0, app2); entity_list.QueueClients(0, app2);
safe_delete(app); safe_delete(app);

View File

@ -46,23 +46,23 @@ extern WorldServer worldserver;
void Petition::SendPetitionToPlayer(Client* clientto) { void Petition::SendPetitionToPlayer(Client* clientto) {
auto outapp = new EQApplicationPacket(OP_PetitionCheckout, sizeof(Petition_Struct)); auto outapp = new EQApplicationPacket(OP_PetitionCheckout, sizeof(Petition_Struct));
Petition_Struct* pet = (Petition_Struct*) outapp->pBuffer; Petition_Struct* pet = (Petition_Struct*) outapp->pBuffer;
strcpy(pet->accountid,this->GetAccountName()); strcpy(pet->accountid,GetAccountName());
strcpy(pet->lastgm,this->GetLastGM()); strcpy(pet->lastgm,GetLastGM());
strcpy(pet->charname,this->GetCharName()); strcpy(pet->charname,GetCharName());
pet->petnumber = this->petid; pet->petnumber = petid;
pet->charclass = this->GetCharClass(); pet->charclass = GetCharClass();
pet->charlevel = this->GetCharLevel(); pet->charlevel = GetCharLevel();
pet->charrace = this->GetCharRace(); pet->charrace = GetCharRace();
pet->zone = this->GetZone(); pet->zone = GetZone();
//strcpy(pet->zone,this->GetZone()); //strcpy(pet->zone,GetZone());
strcpy(pet->petitiontext,this->GetPetitionText()); strcpy(pet->petitiontext,GetPetitionText());
pet->checkouts = this->GetCheckouts(); pet->checkouts = GetCheckouts();
pet->unavail = this->GetUnavails(); pet->unavail = GetUnavails();
pet->senttime = this->GetSentTime(); pet->senttime = GetSentTime();
//memset(pet->unknown5, 0, sizeof(pet->unknown5)); //memset(pet->unknown5, 0, sizeof(pet->unknown5));
//pet->unknown5[3] = 0x1f; //pet->unknown5[3] = 0x1f;
pet->urgency = this->GetUrgency(); pet->urgency = GetUrgency();
strcpy(pet->gmtext, this->GetGMText()); strcpy(pet->gmtext, GetGMText());
clientto->QueuePacket(outapp); clientto->QueuePacket(outapp);
safe_delete(outapp); safe_delete(outapp);
return; return;
@ -85,7 +85,7 @@ Petition::Petition(uint32 id)
memset(petitiontext, 0, sizeof(petitiontext)); memset(petitiontext, 0, sizeof(petitiontext));
memset(gmtext, 0, sizeof(gmtext)); memset(gmtext, 0, sizeof(gmtext));
//memset(this->zone, 0, sizeof(this->zone)); //memset(zone, 0, sizeof(zone));
zone = 1; zone = 1;
} }
Petition* PetitionList::GetPetitionByID(uint32 id_in) { Petition* PetitionList::GetPetitionByID(uint32 id_in) {

View File

@ -194,12 +194,12 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower,
int16 act_power = 0; // The actual pet power we'll use. int16 act_power = 0; // The actual pet power we'll use.
if (petpower == -1) { if (petpower == -1) {
if (this->IsClient()) { if (IsClient()) {
act_power = CastToClient()->GetFocusEffect(focusPetPower, spell_id);//Client only act_power = CastToClient()->GetFocusEffect(focusPetPower, spell_id);//Client only
act_power = CastToClient()->mod_pet_power(act_power, spell_id); act_power = CastToClient()->mod_pet_power(act_power, spell_id);
} }
#ifdef BOTS #ifdef BOTS
else if (this->IsBot()) else if (IsBot())
act_power = CastToBot()->GetBotFocusEffect(focusPetPower, spell_id); act_power = CastToBot()->GetBotFocusEffect(focusPetPower, spell_id);
#endif #endif
} }
@ -231,9 +231,9 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower,
memcpy(npc_type, base, sizeof(NPCType)); memcpy(npc_type, base, sizeof(NPCType));
// If pet power is set to -1 in the DB, use stat scaling // If pet power is set to -1 in the DB, use stat scaling
if ((this->IsClient() if ((IsClient()
#ifdef BOTS #ifdef BOTS
|| this->IsBot() || IsBot()
#endif #endif
) && record.petpower == -1) ) && record.petpower == -1)
{ {
@ -276,15 +276,15 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower,
EntityList::RemoveNumbers(npc_type->name); EntityList::RemoveNumbers(npc_type->name);
entity_list.MakeNameUnique(npc_type->name); entity_list.MakeNameUnique(npc_type->name);
} else if (record.petnaming == 0) { } else if (record.petnaming == 0) {
strcpy(npc_type->name, this->GetCleanName()); strcpy(npc_type->name, GetCleanName());
npc_type->name[25] = '\0'; npc_type->name[25] = '\0';
strcat(npc_type->name, "`s_pet"); strcat(npc_type->name, "`s_pet");
} else if (record.petnaming == 1) { } else if (record.petnaming == 1) {
strcpy(npc_type->name, this->GetName()); strcpy(npc_type->name, GetName());
npc_type->name[19] = '\0'; npc_type->name[19] = '\0';
strcat(npc_type->name, "`s_familiar"); strcat(npc_type->name, "`s_familiar");
} else if (record.petnaming == 2) { } else if (record.petnaming == 2) {
strcpy(npc_type->name, this->GetName()); strcpy(npc_type->name, GetName());
npc_type->name[21] = 0; npc_type->name[21] = 0;
strcat(npc_type->name, "`s_Warder"); strcat(npc_type->name, "`s_Warder");
} else if (record.petnaming == 4) { } else if (record.petnaming == 4) {
@ -292,11 +292,11 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower,
} else if (record.petnaming == 3 && IsClient()) { } else if (record.petnaming == 3 && IsClient()) {
GetRandPetName(npc_type->name); GetRandPetName(npc_type->name);
} else if (record.petnaming == 5 && IsClient()) { } else if (record.petnaming == 5 && IsClient()) {
strcpy(npc_type->name, this->GetName()); strcpy(npc_type->name, GetName());
npc_type->name[24] = '\0'; npc_type->name[24] = '\0';
strcat(npc_type->name, "`s_ward"); strcat(npc_type->name, "`s_ward");
} else { } else {
strcpy(npc_type->name, this->GetCleanName()); strcpy(npc_type->name, GetCleanName());
npc_type->name[25] = '\0'; npc_type->name[25] = '\0';
strcat(npc_type->name, "`s_pet"); strcat(npc_type->name, "`s_pet");
} }
@ -404,7 +404,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower,
activiate_pet = true; activiate_pet = true;
} }
} }
if (activiate_pet){ if (activiate_pet){
npc->AddToHateList(m_target, 1); npc->AddToHateList(m_target, 1);
npc->SetPetTargetLockID(m_target->GetID()); npc->SetPetTargetLockID(m_target->GetID());
@ -465,7 +465,7 @@ Pet::Pet(NPCType *type_data, Mob *owner, PetType type, uint16 spell_id, int16 po
// Familiar and animation pets don't get taunt until an AA. // Familiar and animation pets don't get taunt until an AA.
if (owner && owner->IsClient()) { if (owner && owner->IsClient()) {
if (!(owner->CastToClient()->ClientVersionBit() & EQ::versions::maskUFAndLater)) { if (!(owner->CastToClient()->ClientVersionBit() & EQ::versions::maskUFAndLater)) {
if ((typeofpet != petFamiliar && typeofpet != petAnimation) || if ((typeofpet != petFamiliar && typeofpet != petAnimation) ||
aabonuses.PetCommands[PET_TAUNT]) { aabonuses.PetCommands[PET_TAUNT]) {
taunting=true; taunting=true;
} }
@ -541,7 +541,7 @@ void Mob::SetPet(Mob* newpet) {
Mob* oldowner = entity_list.GetMob(newpet->GetOwnerID()); Mob* oldowner = entity_list.GetMob(newpet->GetOwnerID());
if (oldowner) if (oldowner)
oldowner->SetPetID(0); oldowner->SetPetID(0);
newpet->SetOwnerID(this->GetID()); newpet->SetOwnerID(GetID());
} }
} }
@ -743,7 +743,7 @@ bool Pet::CheckSpellLevelRestriction(uint16 spell_id)
return true; return true;
} }
BeastlordPetData::PetStruct ZoneDatabase::GetBeastlordPetData(uint16 race_id) { BeastlordPetData::PetStruct ZoneDatabase::GetBeastlordPetData(uint16 race_id) {
BeastlordPetData::PetStruct beastlord_pet_data; BeastlordPetData::PetStruct beastlord_pet_data;
std::string query = fmt::format( std::string query = fmt::format(
SQL( SQL(

View File

@ -996,7 +996,7 @@ void Raid::SendRaidAddAll(const char *who)
ram->_class = members[x]._class; ram->_class = members[x]._class;
ram->level = members[x].level; ram->level = members[x].level;
ram->isGroupLeader = members[x].IsGroupLeader; ram->isGroupLeader = members[x].IsGroupLeader;
this->QueuePacket(outapp); QueuePacket(outapp);
safe_delete(outapp); safe_delete(outapp);
return; return;
} }
@ -1555,7 +1555,7 @@ void Raid::SendHPManaEndPacketsTo(Client *client)
if(!client) if(!client)
return; return;
uint32 group_id = this->GetGroup(client); uint32 group_id = GetGroup(client);
EQApplicationPacket hp_packet; EQApplicationPacket hp_packet;
EQApplicationPacket outapp(OP_MobManaUpdate, sizeof(MobManaUpdate_Struct)); EQApplicationPacket outapp(OP_MobManaUpdate, sizeof(MobManaUpdate_Struct));
@ -1595,7 +1595,7 @@ void Raid::SendHPManaEndPacketsFrom(Mob *mob)
uint32 group_id = 0; uint32 group_id = 0;
if(mob->IsClient()) if(mob->IsClient())
group_id = this->GetGroup(mob->CastToClient()); group_id = GetGroup(mob->CastToClient());
EQApplicationPacket hpapp; EQApplicationPacket hpapp;
EQApplicationPacket outapp(OP_MobManaUpdate, sizeof(MobManaUpdate_Struct)); EQApplicationPacket outapp(OP_MobManaUpdate, sizeof(MobManaUpdate_Struct));
@ -1631,7 +1631,7 @@ void Raid::SendManaPacketFrom(Mob *mob)
uint32 group_id = 0; uint32 group_id = 0;
if (mob->IsClient()) if (mob->IsClient())
group_id = this->GetGroup(mob->CastToClient()); group_id = GetGroup(mob->CastToClient());
EQApplicationPacket outapp(OP_MobManaUpdate, sizeof(MobManaUpdate_Struct)); EQApplicationPacket outapp(OP_MobManaUpdate, sizeof(MobManaUpdate_Struct));
@ -1658,7 +1658,7 @@ void Raid::SendEndurancePacketFrom(Mob *mob)
uint32 group_id = 0; uint32 group_id = 0;
if (mob->IsClient()) if (mob->IsClient())
group_id = this->GetGroup(mob->CastToClient()); group_id = GetGroup(mob->CastToClient());
EQApplicationPacket outapp(OP_MobManaUpdate, sizeof(MobManaUpdate_Struct)); EQApplicationPacket outapp(OP_MobManaUpdate, sizeof(MobManaUpdate_Struct));
@ -1778,7 +1778,7 @@ void Raid::SetDirtyAutoHaters()
void Raid::QueueClients(Mob *sender, const EQApplicationPacket *app, bool ack_required /*= true*/, bool ignore_sender /*= true*/, float distance /*= 0*/, bool group_only /*= true*/) { void Raid::QueueClients(Mob *sender, const EQApplicationPacket *app, bool ack_required /*= true*/, bool ignore_sender /*= true*/, float distance /*= 0*/, bool group_only /*= true*/) {
if (sender && sender->IsClient()) { if (sender && sender->IsClient()) {
uint32 group_id = this->GetGroup(sender->CastToClient()); uint32 group_id = GetGroup(sender->CastToClient());
/* If this is a group only packet and we're not in a group -- return */ /* If this is a group only packet and we're not in a group -- return */
if (!group_id == 0xFFFFFFFF && group_only) if (!group_id == 0xFFFFFFFF && group_only)

View File

@ -295,7 +295,7 @@ void Client::OPCombatAbility(const CombatAbility_Struct *ca_atk)
int32 dmg = 0; int32 dmg = 0;
int32 skill_reduction = this->GetSkillReuseTime(ca_atk->m_skill); int32 skill_reduction = GetSkillReuseTime(ca_atk->m_skill);
// not sure what the '100' indicates..if ->m_atk is not used as 'slot' reference, then change SlotRange above back to '11' // not sure what the '100' indicates..if ->m_atk is not used as 'slot' reference, then change SlotRange above back to '11'
if (ca_atk->m_atk == 100 && if (ca_atk->m_atk == 100 &&
@ -816,7 +816,7 @@ void Mob::DoArcheryAttackDmg(Mob *other, const EQ::ItemInstance *RangeWeapon, co
if (!RangeWeapon && !Ammo && range_id && ammo_id) { if (!RangeWeapon && !Ammo && range_id && ammo_id) {
if (IsClient()) { if (IsClient()) {
_RangeWeapon = CastToClient()->m_inv[EQ::invslot::slotRange]; _RangeWeapon = CastToClient()->m_inv[EQ::invslot::slotRange];
if (_RangeWeapon && _RangeWeapon->GetItem() && if (_RangeWeapon && _RangeWeapon->GetItem() &&
_RangeWeapon->GetItem()->ID == range_id) _RangeWeapon->GetItem()->ID == range_id)
RangeWeapon = _RangeWeapon; RangeWeapon = _RangeWeapon;
@ -1304,7 +1304,7 @@ void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51
int ammo_slot = EQ::invslot::slotRange; int ammo_slot = EQ::invslot::slotRange;
const EQ::ItemInstance* RangeWeapon = m_inv[EQ::invslot::slotRange]; const EQ::ItemInstance* RangeWeapon = m_inv[EQ::invslot::slotRange];
if (!RangeWeapon || !RangeWeapon->IsClassCommon()) { if (!RangeWeapon || !RangeWeapon->IsClassCommon()) {
LogCombat("Ranged attack canceled. Missing or invalid ranged weapon ([{}]) in slot [{}]", GetItemIDAt(EQ::invslot::slotRange), EQ::invslot::slotRange); LogCombat("Ranged attack canceled. Missing or invalid ranged weapon ([{}]) in slot [{}]", GetItemIDAt(EQ::invslot::slotRange), EQ::invslot::slotRange);
Message(0, "Error: Rangeweapon: GetItem(%i)==0, you have nothing to throw!", GetItemIDAt(EQ::invslot::slotRange)); Message(0, "Error: Rangeweapon: GetItem(%i)==0, you have nothing to throw!", GetItemIDAt(EQ::invslot::slotRange));
@ -1661,7 +1661,7 @@ void NPC::DoClassAttacks(Mob *target) {
//general stuff, for all classes.... //general stuff, for all classes....
//only gets used when their primary ability get used too //only gets used when their primary ability get used too
if (taunting && HasOwner() && target->IsNPC() && target->GetBodyType() != BT_Undead && taunt_time) { if (taunting && HasOwner() && target->IsNPC() && target->GetBodyType() != BT_Undead && taunt_time) {
this->GetOwner()->MessageString(Chat::PetResponse, PET_TAUNTING); GetOwner()->MessageString(Chat::PetResponse, PET_TAUNTING);
Taunt(target->CastToNPC(), false); Taunt(target->CastToNPC(), false);
} }

View File

@ -771,7 +771,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
auto app = new EQApplicationPacket(OP_Charm, sizeof(Charm_Struct)); auto app = new EQApplicationPacket(OP_Charm, sizeof(Charm_Struct));
Charm_Struct *ps = (Charm_Struct*)app->pBuffer; Charm_Struct *ps = (Charm_Struct*)app->pBuffer;
ps->owner_id = caster->GetID(); ps->owner_id = caster->GetID();
ps->pet_id = this->GetID(); ps->pet_id = GetID();
ps->command = 1; ps->command = 1;
entity_list.QueueClients(this, app); entity_list.QueueClients(this, app);
safe_delete(app); safe_delete(app);
@ -1104,7 +1104,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
caster->MessageString(Chat::SpellFailure, SPELL_NO_EFFECT, spells[spell_id].name); caster->MessageString(Chat::SpellFailure, SPELL_NO_EFFECT, spells[spell_id].name);
break; break;
} }
int chance = spells[spell_id].base_value[i]; int chance = spells[spell_id].base_value[i];
int buff_count = GetMaxTotalSlots(); int buff_count = GetMaxTotalSlots();
for(int slot = 0; slot < buff_count; slot++) { for(int slot = 0; slot < buff_count; slot++) {
@ -1701,10 +1701,10 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
// can only summon corpses of clients // can only summon corpses of clients
if(!IsNPC()) { if(!IsNPC()) {
Client* TargetClient = nullptr; Client* TargetClient = nullptr;
if(this->GetTarget()) if(GetTarget())
TargetClient = this->GetTarget()->CastToClient(); TargetClient = GetTarget()->CastToClient();
else else
TargetClient = this->CastToClient(); TargetClient = CastToClient();
// We now have a valid target for this spell. Either the caster himself or a targetted player. Lets see if the target is in the group. // We now have a valid target for this spell. Either the caster himself or a targetted player. Lets see if the target is in the group.
Group* group = entity_list.GetGroupByClient(TargetClient); Group* group = entity_list.GetGroupByClient(TargetClient);
@ -1728,7 +1728,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
} }
} }
} else { } else {
if(TargetClient != this->CastToClient()) { if(TargetClient != CastToClient()) {
Message(Chat::Red, "Your target must be a group member for this spell."); Message(Chat::Red, "Your target must be a group member for this spell.");
break; break;
} }
@ -1742,7 +1742,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
Corpse *corpse = entity_list.GetCorpseByOwner(TargetClient); Corpse *corpse = entity_list.GetCorpseByOwner(TargetClient);
if(corpse) { if(corpse) {
if(TargetClient == this->CastToClient()) if(TargetClient == CastToClient())
MessageString(Chat::LightBlue, SUMMONING_CORPSE, TargetClient->CastToMob()->GetCleanName()); MessageString(Chat::LightBlue, SUMMONING_CORPSE, TargetClient->CastToMob()->GetCleanName());
else else
MessageString(Chat::LightBlue, SUMMONING_CORPSE_OTHER, TargetClient->CastToMob()->GetCleanName()); MessageString(Chat::LightBlue, SUMMONING_CORPSE_OTHER, TargetClient->CastToMob()->GetCleanName());
@ -1772,7 +1772,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
case SE_SummonCorpseZone: case SE_SummonCorpseZone:
{ {
if (IsClient()) { if (IsClient()) {
Client* client_target = this->CastToClient(); Client* client_target = CastToClient();
if (client_target->IsGrouped()) { if (client_target->IsGrouped()) {
Group* group = client_target->GetGroup(); Group* group = client_target->GetGroup();
if (!group->IsGroupMember(caster)) { if (!group->IsGroupMember(caster)) {
@ -2744,7 +2744,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
case SE_Taunt: case SE_Taunt:
{ {
if (caster && IsNPC()){ if (caster && IsNPC()){
caster->Taunt(this->CastToNPC(), false, spell.base_value[i], true, spell.limit_value[i]); caster->Taunt(CastToNPC(), false, spell.base_value[i], true, spell.limit_value[i]);
} }
break; break;
} }
@ -3362,14 +3362,14 @@ int Mob::CalcSpellEffectValue(uint16 spell_id, int effect_id, int caster_level,
/* /*
Calculate base effects modifier for casters who are not bards. Calculate base effects modifier for casters who are not bards.
*/ */
//This is checked from Mob::SpellEffects and applied to instant spells and runes. //This is checked from Mob::SpellEffects and applied to instant spells and runes.
if (caster && caster->GetClass() != BARD && caster->HasBaseEffectFocus()) { if (caster && caster->GetClass() != BARD && caster->HasBaseEffectFocus()) {
oval = effect_value; oval = effect_value;
int mod = caster->GetFocusEffect(focusFcBaseEffects, spell_id); int mod = caster->GetFocusEffect(focusFcBaseEffects, spell_id);
effect_value += effect_value * mod / 100; effect_value += effect_value * mod / 100;
LogSpells("Instant Effect value [{}] altered with base effects modifier of [{}] to yeild [{}]", LogSpells("Instant Effect value [{}] altered with base effects modifier of [{}] to yeild [{}]",
oval, mod, effect_value); oval, mod, effect_value);
} }
@ -3385,7 +3385,7 @@ int Mob::CalcSpellEffectValue(uint16 spell_id, int effect_id, int caster_level,
oval, instrument_mod, effect_value); oval, instrument_mod, effect_value);
} }
} }
effect_value = mod_effect_value(effect_value, spell_id, spells[spell_id].effect_id[effect_id], caster, caster_id); effect_value = mod_effect_value(effect_value, spell_id, spells[spell_id].effect_id[effect_id], caster, caster_id);
return effect_value; return effect_value;
@ -3786,7 +3786,7 @@ void Mob::DoBuffTic(const Buffs_Struct &buff, int slot, Mob *caster)
// doing it every time up here, since most buff effects dont need it // doing it every time up here, since most buff effects dont need it
switch (effect) { switch (effect) {
case SE_CurrentHP: { case SE_CurrentHP: {
if (spells[buff.spellid].limit_value[i] && !PassCastRestriction(spells[buff.spellid].limit_value[i])) { if (spells[buff.spellid].limit_value[i] && !PassCastRestriction(spells[buff.spellid].limit_value[i])) {
break; break;
} }
@ -4157,7 +4157,7 @@ void Mob::BuffFadeBySlot(int slot, bool iRecalcBonuses)
{ {
if(IsClient()) if(IsClient())
{ {
/*Mob* horse = entity_list.GetMob(this->CastToClient()->GetHorseId()); /*Mob* horse = entity_list.GetMob(CastToClient()->GetHorseId());
if (horse) horse->Depop(); if (horse) horse->Depop();
CastToClient()->SetHasMount(false);*/ CastToClient()->SetHasMount(false);*/
CastToClient()->SetHorseId(0); CastToClient()->SetHorseId(0);
@ -4249,7 +4249,7 @@ void Mob::BuffFadeBySlot(int slot, bool iRecalcBonuses)
case SE_Mez: case SE_Mez:
{ {
SendAppearancePacket(AT_Anim, ANIM_STAND); // unfreeze SendAppearancePacket(AT_Anim, ANIM_STAND); // unfreeze
this->mezzed = false; mezzed = false;
break; break;
} }
@ -4302,7 +4302,7 @@ void Mob::BuffFadeBySlot(int slot, bool iRecalcBonuses)
uint32 buff_count = GetMaxTotalSlots(); uint32 buff_count = GetMaxTotalSlots();
for (unsigned int j = 0; j < buff_count; j++) { for (unsigned int j = 0; j < buff_count; j++) {
if (IsValidSpell(GetBuffs()[j].spellid )) { if (IsValidSpell(GetBuffs()[j].spellid )) {
auto spell = spells[this->GetBuffs()[j].spellid]; auto spell = spells[GetBuffs()[j].spellid];
if (spell.good_effect == 0 && IsEffectInSpell(spell.id, SE_CurrentHP)) { if (spell.good_effect == 0 && IsEffectInSpell(spell.id, SE_CurrentHP)) {
BuffFadeBySpellID(spell.id); BuffFadeBySpellID(spell.id);
} }
@ -4354,7 +4354,7 @@ void Mob::BuffFadeBySlot(int slot, bool iRecalcBonuses)
if(IsClient()) if(IsClient())
{ {
InterruptSpell(); InterruptSpell();
if (this->CastToClient()->IsLD()) if (CastToClient()->IsLD())
CastToClient()->AI_Start(CLIENT_LD_TIMEOUT); CastToClient()->AI_Start(CLIENT_LD_TIMEOUT);
else else
{ {
@ -4437,7 +4437,7 @@ void Mob::BuffFadeBySlot(int slot, bool iRecalcBonuses)
if (IsClient()) if (IsClient())
{ {
NPC* tmp_eye_of_zomm = entity_list.GetNPCByID(CastToClient()->GetControlledMobId()); NPC* tmp_eye_of_zomm = entity_list.GetNPCByID(CastToClient()->GetControlledMobId());
//On live there is about a 6 second delay before it despawns once new one spawns. //On live there is about a 6 second delay before it despawns once new one spawns.
if (tmp_eye_of_zomm) { if (tmp_eye_of_zomm) {
tmp_eye_of_zomm->GetSwarmInfo()->duration->Disable(); tmp_eye_of_zomm->GetSwarmInfo()->duration->Disable();
tmp_eye_of_zomm->GetSwarmInfo()->duration->Start(6000); tmp_eye_of_zomm->GetSwarmInfo()->duration->Start(6000);
@ -5312,11 +5312,11 @@ int32 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo
uint32 Caston_spell_id = 0; uint32 Caston_spell_id = 0;
int index_id = -1; int index_id = -1;
uint32 focus_reuse_time = 0; //If this is set and all limits pass, start timer at end of script. uint32 focus_reuse_time = 0; //If this is set and all limits pass, start timer at end of script.
bool is_from_item_click = false; bool is_from_item_click = false;
bool try_apply_to_item_click = false; bool try_apply_to_item_click = false;
bool has_item_limit_check = false; bool has_item_limit_check = false;
if (casting_spell_inventory_slot && casting_spell_inventory_slot != -1) { if (casting_spell_inventory_slot && casting_spell_inventory_slot != -1) {
is_from_item_click = true; is_from_item_click = true;
} }
@ -5341,7 +5341,7 @@ int32 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo
for (int i = 0; i < EFFECT_COUNT; i++) { for (int i = 0; i < EFFECT_COUNT; i++) {
switch (focus_spell.effect_id[i]) { switch (focus_spell.effect_id[i]) {
case SE_Blank: case SE_Blank:
break; break;
@ -6048,7 +6048,7 @@ int32 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo
return 0; return 0;
} }
} }
/* /*
For item click cast/recast focus modifiers. Only use if SPA 415 exists. For item click cast/recast focus modifiers. Only use if SPA 415 exists.
This is an item click but does not have SPA 415 limiter. Fail here. This is an item click but does not have SPA 415 limiter. Fail here.
@ -6787,8 +6787,8 @@ void Mob::CheckNumHitsRemaining(NumHit type, int32 buff_slot, uint16 spell_id)
} else if (IsClient()) { // still have numhits and client, update } else if (IsClient()) { // still have numhits and client, update
CastToClient()->SendBuffNumHitPacket(buffs[buff_slot], buff_slot); CastToClient()->SendBuffNumHitPacket(buffs[buff_slot], buff_slot);
} }
} }
} }
else { else {
for (int d = 0; d < buff_max; d++) { for (int d = 0; d < buff_max; d++) {
if (IsValidSpell(buffs[d].spellid) && buffs[d].hit_number > 0 && if (IsValidSpell(buffs[d].spellid) && buffs[d].hit_number > 0 &&
@ -9625,7 +9625,7 @@ bool Mob::HarmonySpellLevelCheck(int32 spell_id, Mob *target)
} }
bool Mob::PassCharmTargetRestriction(Mob *target) { bool Mob::PassCharmTargetRestriction(Mob *target) {
//Level restriction check should not go here. //Level restriction check should not go here.
if (!target) { if (!target) {
return false; return false;
@ -9680,7 +9680,7 @@ bool Mob::PassLimitToSkill(EQ::skills::SkillType skill, int32 spell_id, int proc
match_proc_type = true; match_proc_type = true;
} }
if (match_proc_type && spells[spell_id].effect_id[i] == SE_LimitToSkill && spells[spell_id].base_value[i] <= EQ::skills::HIGHEST_SKILL) { if (match_proc_type && spells[spell_id].effect_id[i] == SE_LimitToSkill && spells[spell_id].base_value[i] <= EQ::skills::HIGHEST_SKILL) {
has_limit_check = true; has_limit_check = true;
if (spells[spell_id].base_value[i] == skill) { if (spells[spell_id].base_value[i] == skill) {
return true; return true;
@ -9921,7 +9921,7 @@ void Mob::SpreadVirusEffect(int32 spell_id, uint32 caster_id, int32 buff_tics_re
bool Mob::IsFocusProcLimitTimerActive(int32 focus_spell_id) { bool Mob::IsFocusProcLimitTimerActive(int32 focus_spell_id) {
/* /*
Used with SPA 511 SE_Ff_FocusTimerMin to limit how often a focus effect can be applied. Used with SPA 511 SE_Ff_FocusTimerMin to limit how often a focus effect can be applied.
Ie. Can only have a spell trigger once every 15 seconds, or to be more creative can only Ie. Can only have a spell trigger once every 15 seconds, or to be more creative can only
have the fire spells received a very high special focused once every 30 seconds. have the fire spells received a very high special focused once every 30 seconds.
Note, this stores timers for both spell, item and AA related focuses For AA the focus_spell_id Note, this stores timers for both spell, item and AA related focuses For AA the focus_spell_id
@ -9975,7 +9975,7 @@ bool Mob::IsProcLimitTimerActive(int32 base_spell_id, uint32 proc_reuse_time, in
} }
for (int i = 0; i < MAX_PROC_LIMIT_TIMERS; i++) { for (int i = 0; i < MAX_PROC_LIMIT_TIMERS; i++) {
if (proc_type == ProcType::MELEE_PROC) { if (proc_type == ProcType::MELEE_PROC) {
if (spell_proclimit_spellid[i] == base_spell_id) { if (spell_proclimit_spellid[i] == base_spell_id) {
if (spell_proclimit_timer[i].Enabled()) { if (spell_proclimit_timer[i].Enabled()) {
@ -10258,7 +10258,7 @@ void Mob::SetBuffDuration(int32 spell_id, int32 duration) {
int buff_count = GetMaxTotalSlots(); int buff_count = GetMaxTotalSlots();
for (int slot = 0; slot < buff_count; slot++) { for (int slot = 0; slot < buff_count; slot++) {
if (!adjust_all_buffs) { if (!adjust_all_buffs) {
if (buffs[slot].spellid != SPELL_UNKNOWN && buffs[slot].spellid == spell_id) { if (buffs[slot].spellid != SPELL_UNKNOWN && buffs[slot].spellid == spell_id) {
SpellOnTarget(buffs[slot].spellid, this, 0, false, 0, false, -1, duration, true); SpellOnTarget(buffs[slot].spellid, this, 0, false, 0, false, -1, duration, true);
@ -10285,7 +10285,7 @@ void Mob::ApplySpellBuff(int32 spell_id, int32 duration)
if (!spells[spell_id].buff_duration) { if (!spells[spell_id].buff_duration) {
return; return;
} }
if (duration < -1) { if (duration < -1) {
duration = PERMANENT_BUFF_DURATION; duration = PERMANENT_BUFF_DURATION;
} }
@ -10302,7 +10302,7 @@ int Mob::GetBuffStatValueBySpell(int32 spell_id, const char* stat_identifier)
if (!stat_identifier) { if (!stat_identifier) {
return 0; return 0;
} }
std::string id = str_tolower(stat_identifier); std::string id = str_tolower(stat_identifier);
int buff_count = GetMaxTotalSlots(); int buff_count = GetMaxTotalSlots();
@ -10314,7 +10314,7 @@ int Mob::GetBuffStatValueBySpell(int32 spell_id, const char* stat_identifier)
return 0; return 0;
} }
int Mob::GetBuffStatValueBySlot(uint8 slot, const char* stat_identifier) int Mob::GetBuffStatValueBySlot(uint8 slot, const char* stat_identifier)
{ {
if (slot > GetMaxTotalSlots()) { if (slot > GetMaxTotalSlots()) {
return 0; return 0;

View File

@ -373,7 +373,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, CastingSlot slot,
else if (cast_time && IsClient() && slot == CastingSlot::Item && item_slot != 0xFFFFFFFF) { else if (cast_time && IsClient() && slot == CastingSlot::Item && item_slot != 0xFFFFFFFF) {
orgcasttime = cast_time; orgcasttime = cast_time;
if (cast_time) { if (cast_time) {
cast_time = GetActSpellCasttime(spell_id, cast_time); cast_time = GetActSpellCasttime(spell_id, cast_time);
} }
} }
else { else {
@ -421,7 +421,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, CastingSlot slot,
//clients produce messages... npcs should not for this case //clients produce messages... npcs should not for this case
MessageString(Chat::Red, INSUFFICIENT_MANA); MessageString(Chat::Red, INSUFFICIENT_MANA);
InterruptSpell(); InterruptSpell();
} }
else { else {
InterruptSpell(0, 0, 0); //the 0 args should cause no messages InterruptSpell(0, 0, 0); //the 0 args should cause no messages
} }
@ -533,7 +533,7 @@ bool Mob::DoCastingChecksOnCaster(int32 spell_id, CastingSlot slot) {
return false; return false;
} }
/* /*
Can not cast if spell Can not cast if spell
*/ */
if ((IsSilenced() && !IsDiscipline(spell_id))) { if ((IsSilenced() && !IsDiscipline(spell_id))) {
MessageString(Chat::Red, SILENCED_STRING); MessageString(Chat::Red, SILENCED_STRING);
@ -851,7 +851,7 @@ bool Mob::DoCastingChecksOnTarget(bool check_on_casting, int32 spell_id, Mob *sp
return false; return false;
} }
/* /*
Various charm related target restrictions Various charm related target restrictions
*/ */
if (IsEffectInSpell(spell_id, SE_Charm) && !PassCharmTargetRestriction(spell_target)) { if (IsEffectInSpell(spell_id, SE_Charm) && !PassCharmTargetRestriction(spell_target)) {
LogSpells("Spell casting canceled [{}] : can not use charm on this target.", spell_id); LogSpells("Spell casting canceled [{}] : can not use charm on this target.", spell_id);
@ -867,7 +867,7 @@ bool Mob::DoCastingChecksOnTarget(bool check_on_casting, int32 spell_id, Mob *sp
if (spell_target->IsGrouped()) { if (spell_target->IsGrouped()) {
Group *target_group = spell_target->GetGroup(); Group *target_group = spell_target->GetGroup();
Group *my_group = GetGroup(); Group *my_group = GetGroup();
if (target_group && if (target_group &&
my_group && my_group &&
(target_group->GetID() == my_group->GetID())) { (target_group->GetID() == my_group->GetID())) {
cast_failed = false; cast_failed = false;
@ -878,7 +878,7 @@ bool Mob::DoCastingChecksOnTarget(bool check_on_casting, int32 spell_id, Mob *sp
Raid *my_raid = GetRaid(); Raid *my_raid = GetRaid();
if (target_raid && if (target_raid &&
my_raid && my_raid &&
(target_raid->GetGroup(spell_target->CastToClient()) == my_raid->GetGroup(this->CastToClient()))) { (target_raid->GetGroup(spell_target->CastToClient()) == my_raid->GetGroup(CastToClient()))) {
cast_failed = false; cast_failed = false;
} }
} }
@ -961,7 +961,7 @@ void Client::CheckSongSkillIncrease(uint16 spell_id){
CheckIncreaseSkill(EQ::skills::SkillSinging, nullptr, -15); CheckIncreaseSkill(EQ::skills::SkillSinging, nullptr, -15);
break; break;
case EQ::skills::SkillPercussionInstruments: case EQ::skills::SkillPercussionInstruments:
if(this->itembonuses.percussionMod > 0) { if(itembonuses.percussionMod > 0) {
if (GetRawSkill(EQ::skills::SkillPercussionInstruments) > 0) // no skill increases if not trained in the instrument if (GetRawSkill(EQ::skills::SkillPercussionInstruments) > 0) // no skill increases if not trained in the instrument
CheckIncreaseSkill(EQ::skills::SkillPercussionInstruments, nullptr, -15); CheckIncreaseSkill(EQ::skills::SkillPercussionInstruments, nullptr, -15);
else else
@ -971,7 +971,7 @@ void Client::CheckSongSkillIncrease(uint16 spell_id){
CheckIncreaseSkill(EQ::skills::SkillSinging, nullptr, -15); CheckIncreaseSkill(EQ::skills::SkillSinging, nullptr, -15);
break; break;
case EQ::skills::SkillStringedInstruments: case EQ::skills::SkillStringedInstruments:
if(this->itembonuses.stringedMod > 0) { if(itembonuses.stringedMod > 0) {
if (GetRawSkill(EQ::skills::SkillStringedInstruments) > 0) if (GetRawSkill(EQ::skills::SkillStringedInstruments) > 0)
CheckIncreaseSkill(EQ::skills::SkillStringedInstruments, nullptr, -15); CheckIncreaseSkill(EQ::skills::SkillStringedInstruments, nullptr, -15);
else else
@ -981,7 +981,7 @@ void Client::CheckSongSkillIncrease(uint16 spell_id){
CheckIncreaseSkill(EQ::skills::SkillSinging, nullptr, -15); CheckIncreaseSkill(EQ::skills::SkillSinging, nullptr, -15);
break; break;
case EQ::skills::SkillWindInstruments: case EQ::skills::SkillWindInstruments:
if(this->itembonuses.windMod > 0) { if(itembonuses.windMod > 0) {
if (GetRawSkill(EQ::skills::SkillWindInstruments) > 0) if (GetRawSkill(EQ::skills::SkillWindInstruments) > 0)
CheckIncreaseSkill(EQ::skills::SkillWindInstruments, nullptr, -15); CheckIncreaseSkill(EQ::skills::SkillWindInstruments, nullptr, -15);
else else
@ -991,7 +991,7 @@ void Client::CheckSongSkillIncrease(uint16 spell_id){
CheckIncreaseSkill(EQ::skills::SkillSinging, nullptr, -15); CheckIncreaseSkill(EQ::skills::SkillSinging, nullptr, -15);
break; break;
case EQ::skills::SkillBrassInstruments: case EQ::skills::SkillBrassInstruments:
if(this->itembonuses.brassMod > 0) { if(itembonuses.brassMod > 0) {
if (GetRawSkill(EQ::skills::SkillBrassInstruments) > 0) if (GetRawSkill(EQ::skills::SkillBrassInstruments) > 0)
CheckIncreaseSkill(EQ::skills::SkillBrassInstruments, nullptr, -15); CheckIncreaseSkill(EQ::skills::SkillBrassInstruments, nullptr, -15);
else else
@ -1359,7 +1359,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, CastingSlot slo
if (IsPulsingBardSong(spell_id)) { if (IsPulsingBardSong(spell_id)) {
bardsong = spell_id; bardsong = spell_id;
bardsong_slot = slot; bardsong_slot = slot;
if (spell_target) { if (spell_target) {
bardsong_target_id = spell_target->GetID(); bardsong_target_id = spell_target->GetID();
} }
@ -1466,7 +1466,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, CastingSlot slo
RuleI(Range, SpellMessages), RuleI(Range, SpellMessages),
Chat::Spells, Chat::Spells,
OTHER_REGAIN_CAST, OTHER_REGAIN_CAST,
this->GetCleanName()); GetCleanName());
} }
} }
@ -1485,7 +1485,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, CastingSlot slo
} else { } else {
if(reg_focus > 0) if(reg_focus > 0)
LogSpells("Spell [{}]: Reagent focus item failed to prevent reagent consumption ([{}] chance)", spell_id, reg_focus); LogSpells("Spell [{}]: Reagent focus item failed to prevent reagent consumption ([{}] chance)", spell_id, reg_focus);
Client *c = this->CastToClient(); Client *c = CastToClient();
int component, component_count, inv_slot_id; int component, component_count, inv_slot_id;
bool missingreags = false; bool missingreags = false;
for(int t_count = 0; t_count < 4; t_count++) { for(int t_count = 0; t_count < 4; t_count++) {
@ -1643,7 +1643,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, CastingSlot slo
if(IsClient()) { if(IsClient()) {
TrySympatheticProc(target, spell_id); TrySympatheticProc(target, spell_id);
} }
TryTwincast(this, target, spell_id); TryTwincast(this, target, spell_id);
TryTriggerOnCastFocusEffect(focusTriggerOnCast, spell_id); TryTriggerOnCastFocusEffect(focusTriggerOnCast, spell_id);
@ -1700,7 +1700,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, CastingSlot slo
if (spells[spell_id].timer_id > 0 && slot < CastingSlot::MaxGems) { if (spells[spell_id].timer_id > 0 && slot < CastingSlot::MaxGems) {
c->SetLinkedSpellReuseTimer(spells[spell_id].timer_id, (spells[spell_id].recast_time / 1000) - (casting_spell_recast_adjust / 1000)); c->SetLinkedSpellReuseTimer(spells[spell_id].timer_id, (spells[spell_id].recast_time / 1000) - (casting_spell_recast_adjust / 1000));
} }
c->MemorizeSpell(static_cast<uint32>(slot), spell_id, memSpellSpellbar, casting_spell_recast_adjust); c->MemorizeSpell(static_cast<uint32>(slot), spell_id, memSpellSpellbar, casting_spell_recast_adjust);
// this tells the client that casting may happen again // this tells the client that casting may happen again
@ -2197,7 +2197,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce
if(!spell_target_tot) if(!spell_target_tot)
return false; return false;
//Verfied from live - Target's Target needs to be in combat range to recieve the effect //Verfied from live - Target's Target needs to be in combat range to recieve the effect
if (!this->CombatRange(spell_target)) if (!CombatRange(spell_target))
return false; return false;
spell_target = spell_target_tot; spell_target = spell_target_tot;
@ -2312,7 +2312,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, CastingSlot slot, ui
LogSpells("Spell [{}]: target type [{}], target [{}], AE center [{}]", spell_id, CastAction, spell_target?spell_target->GetName():"NONE", ae_center?ae_center->GetName():"NONE"); LogSpells("Spell [{}]: target type [{}], target [{}], AE center [{}]", spell_id, CastAction, spell_target?spell_target->GetName():"NONE", ae_center?ae_center->GetName():"NONE");
// if a spell has the AEDuration flag, it becomes an AE on target // if a spell has the AEDuration flag, it becomes an AE on target
// spell that's recast every 2500 msec for AEDuration msec. // spell that's recast every 2500 msec for AEDuration msec.
if(IsAEDurationSpell(spell_id)) { if(IsAEDurationSpell(spell_id)) {
// the spells are AE target, but we aim them on a beacon // the spells are AE target, but we aim them on a beacon
glm::vec4 beacon_loc; glm::vec4 beacon_loc;
@ -2421,7 +2421,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, CastingSlot slot, ui
#ifdef BOTS #ifdef BOTS
if(IsBot()) { if(IsBot()) {
bool StopLogic = false; bool StopLogic = false;
if(!this->CastToBot()->DoFinishedSpellSingleTarget(spell_id, spell_target, slot, StopLogic)) if(!CastToBot()->DoFinishedSpellSingleTarget(spell_id, spell_target, slot, StopLogic))
return false; return false;
if(StopLogic) if(StopLogic)
break; break;
@ -2490,7 +2490,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, CastingSlot slot, ui
#ifdef BOTS #ifdef BOTS
if(IsBot()) { if(IsBot()) {
bool StopLogic = false; bool StopLogic = false;
if(!this->CastToBot()->DoFinishedSpellGroupTarget(spell_id, spell_target, slot, StopLogic)) if(!CastToBot()->DoFinishedSpellGroupTarget(spell_id, spell_target, slot, StopLogic))
return false; return false;
if(StopLogic) if(StopLogic)
break; break;
@ -2681,16 +2681,16 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, CastingSlot slot, ui
} }
recast = std::max(recast, 0); recast = std::max(recast, 0);
} }
LogSpells("Spell [{}]: Setting long reuse timer to [{}] s (orig [{}])", spell_id, recast, spells[spell_id].recast_time); LogSpells("Spell [{}]: Setting long reuse timer to [{}] s (orig [{}])", spell_id, recast, spells[spell_id].recast_time);
if (recast > 0) { if (recast > 0) {
CastToClient()->GetPTimers().Start(pTimerSpellStart + spell_id, recast); CastToClient()->GetPTimers().Start(pTimerSpellStart + spell_id, recast);
} }
} }
} }
/* /*
Set Recast Timer on item clicks, including augmenets. Set Recast Timer on item clicks, including augmenets.
*/ */
if(IsClient() && (slot == CastingSlot::Item || slot == CastingSlot::PotionBelt)){ if(IsClient() && (slot == CastingSlot::Item || slot == CastingSlot::PotionBelt)){
CastToClient()->SetItemRecastTimer(spell_id, inventory_slot); CastToClient()->SetItemRecastTimer(spell_id, inventory_slot);
@ -2746,7 +2746,7 @@ bool Mob::ApplyBardPulse(int32 spell_id, Mob *spell_target, CastingSlot slot) {
return true; return true;
} }
/* /*
Fear will stop pulsing. Fear will stop pulsing.
*/ */
if (IsFeared()) { if (IsFeared()) {
return false; return false;
@ -2907,7 +2907,7 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2,
} }
if (spellid1 == spellid2 ) { if (spellid1 == spellid2 ) {
if (spellid1 == SPELL_EYE_OF_ZOMM && spellid2 == SPELL_EYE_OF_ZOMM) {//only the original Eye of Zomm spell will not take hold if affect is already on you, other versions client fades the buff as soon as cast. if (spellid1 == SPELL_EYE_OF_ZOMM && spellid2 == SPELL_EYE_OF_ZOMM) {//only the original Eye of Zomm spell will not take hold if affect is already on you, other versions client fades the buff as soon as cast.
MessageString(Chat::Red, SPELL_NO_HOLD); MessageString(Chat::Red, SPELL_NO_HOLD);
return -1; return -1;
@ -3269,7 +3269,7 @@ int Mob::AddBuff(Mob *caster, uint16 spell_id, int duration, int32 level_overrid
LogSpells("Buff [{}] failed to add because its duration came back as 0", spell_id); LogSpells("Buff [{}] failed to add because its duration came back as 0", spell_id);
return -2; // no duration? this isn't a buff return -2; // no duration? this isn't a buff
} }
LogSpells("Trying to add buff [{}] cast by [{}] (cast level [{}]) with duration [{}]", LogSpells("Trying to add buff [{}] cast by [{}] (cast level [{}]) with duration [{}]",
spell_id, caster?caster->GetName():"UNKNOWN", caster_level, duration); spell_id, caster?caster->GetName():"UNKNOWN", caster_level, duration);
@ -3293,7 +3293,7 @@ int Mob::AddBuff(Mob *caster, uint16 spell_id, int duration, int32 level_overrid
LogSpells("Adding buff [{}] failed: stacking prevented by spell [{}] in slot [{}] with caster level [{}]", LogSpells("Adding buff [{}] failed: stacking prevented by spell [{}] in slot [{}] with caster level [{}]",
spell_id, curbuf.spellid, buffslot, curbuf.casterlevel); spell_id, curbuf.spellid, buffslot, curbuf.casterlevel);
if (caster && caster->IsClient() && RuleB(Client, UseLiveBlockedMessage)) { if (caster && caster->IsClient() && RuleB(Client, UseLiveBlockedMessage)) {
caster->Message(Chat::Red, "Your %s did not take hold on %s. (Blocked by %s.)", spells[spell_id].name, this->GetName(), spells[curbuf.spellid].name); caster->Message(Chat::Red, "Your %s did not take hold on %s. (Blocked by %s.)", spells[spell_id].name, GetName(), spells[curbuf.spellid].name);
} }
return -1; return -1;
} }
@ -3732,7 +3732,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob *spelltar, int reflect_effectivenes
const uint32 cnWTF = 0xFFFFFFFF + 1; //this should be zero unless on 64bit? forced uint64? const uint32 cnWTF = 0xFFFFFFFF + 1; //this should be zero unless on 64bit? forced uint64?
//Caster client pointers //Caster client pointers
pClient = this->CastToClient(); pClient = CastToClient();
pRaid = entity_list.GetRaidByClient(pClient); pRaid = entity_list.GetRaidByClient(pClient);
pBasicGroup = entity_list.GetGroupByMob(this); pBasicGroup = entity_list.GetGroupByMob(this);
if(pRaid) if(pRaid)
@ -4172,8 +4172,8 @@ void Corpse::CastRezz(uint16 spellid, Mob* Caster)
auto outapp = new EQApplicationPacket(OP_RezzRequest, sizeof(Resurrect_Struct)); auto outapp = new EQApplicationPacket(OP_RezzRequest, sizeof(Resurrect_Struct));
Resurrect_Struct* rezz = (Resurrect_Struct*) outapp->pBuffer; Resurrect_Struct* rezz = (Resurrect_Struct*) outapp->pBuffer;
// Why are we truncating these names to 30 characters ? // Why are we truncating these names to 30 characters ?
memcpy(rezz->your_name,this->corpse_name,30); memcpy(rezz->your_name,corpse_name,30);
memcpy(rezz->corpse_name,this->name,30); memcpy(rezz->corpse_name,name,30);
memcpy(rezz->rezzer_name,Caster->GetName(),30); memcpy(rezz->rezzer_name,Caster->GetName(),30);
rezz->zone_id = zone->GetZoneID(); rezz->zone_id = zone->GetZoneID();
rezz->instance_id = zone->GetInstanceID(); rezz->instance_id = zone->GetInstanceID();
@ -5027,7 +5027,7 @@ int16 Mob::CalcResistChanceBonus()
int16 Mob::CalcFearResistChance() int16 Mob::CalcFearResistChance()
{ {
int resistchance = spellbonuses.ResistFearChance + itembonuses.ResistFearChance; int resistchance = spellbonuses.ResistFearChance + itembonuses.ResistFearChance;
if(this->IsClient()) { if(IsClient()) {
resistchance += aabonuses.ResistFearChance; resistchance += aabonuses.ResistFearChance;
if(aabonuses.Fearless == true) if(aabonuses.Fearless == true)
resistchance = 100; resistchance = 100;
@ -5384,7 +5384,7 @@ void Client::ScribeSpell(uint16 spell_id, int slot, bool update_client, bool def
// defer save if we're bulk saving elsewhere // defer save if we're bulk saving elsewhere
if (!defer_save) { if (!defer_save) {
database.SaveCharacterSpell(this->CharacterID(), spell_id, slot); database.SaveCharacterSpell(CharacterID(), spell_id, slot);
} }
LogSpells("Spell [{}] scribed into spell book slot [{}]", spell_id, slot); LogSpells("Spell [{}] scribed into spell book slot [{}]", spell_id, slot);
@ -5448,7 +5448,7 @@ void Client::UntrainDisc(int slot, bool update_client, bool defer_save)
m_pp.disciplines.values[slot] = 0; m_pp.disciplines.values[slot] = 0;
if (!defer_save) { if (!defer_save) {
database.DeleteCharacterDisc(this->CharacterID(), slot); database.DeleteCharacterDisc(CharacterID(), slot);
} }
if (update_client) { if (update_client) {
@ -6155,7 +6155,7 @@ void Client::SendSpellAnim(uint16 targetid, uint16 spell_id)
EQApplicationPacket app(OP_Action, sizeof(Action_Struct)); EQApplicationPacket app(OP_Action, sizeof(Action_Struct));
Action_Struct* a = (Action_Struct*)app.pBuffer; Action_Struct* a = (Action_Struct*)app.pBuffer;
a->target = targetid; a->target = targetid;
a->source = this->GetID(); a->source = GetID();
a->type = 231; a->type = 231;
a->spell = spell_id; a->spell = spell_id;
a->hit_heading = GetHeading(); a->hit_heading = GetHeading();
@ -6187,7 +6187,7 @@ void Client::SendItemRecastTimer(int32 recast_type, uint32 recast_delay)
void Client::SetItemRecastTimer(int32 spell_id, uint32 inventory_slot) void Client::SetItemRecastTimer(int32 spell_id, uint32 inventory_slot)
{ {
EQ::ItemInstance *item = CastToClient()->GetInv().GetItem(inventory_slot); EQ::ItemInstance *item = CastToClient()->GetInv().GetItem(inventory_slot);
int recast_delay = 0; int recast_delay = 0;
int recast_type = 0; int recast_type = 0;
bool from_augment = false; bool from_augment = false;
@ -6513,7 +6513,7 @@ void Client::ResetCastbarCooldownBySlot(int slot) {
m_pp.spellSlotRefresh[i] = 1; m_pp.spellSlotRefresh[i] = 1;
GetPTimers().Clear(&database, (pTimerSpellStart + m_pp.mem_spells[i])); GetPTimers().Clear(&database, (pTimerSpellStart + m_pp.mem_spells[i]));
if (!IsLinkedSpellReuseTimerReady(spells[m_pp.mem_spells[i]].timer_id)) { if (!IsLinkedSpellReuseTimerReady(spells[m_pp.mem_spells[i]].timer_id)) {
GetPTimers().Clear(&database, (pTimerLinkedSpellReuseStart + spells[m_pp.mem_spells[i]].timer_id)); GetPTimers().Clear(&database, (pTimerLinkedSpellReuseStart + spells[m_pp.mem_spells[i]].timer_id));
} }
if (spells[m_pp.mem_spells[i]].timer_id > 0 && spells[m_pp.mem_spells[i]].timer_id < MAX_DISCIPLINE_TIMERS) { if (spells[m_pp.mem_spells[i]].timer_id > 0 && spells[m_pp.mem_spells[i]].timer_id < MAX_DISCIPLINE_TIMERS) {
SetLinkedSpellReuseTimer(spells[m_pp.mem_spells[i]].timer_id, 0); SetLinkedSpellReuseTimer(spells[m_pp.mem_spells[i]].timer_id, 0);
@ -6527,7 +6527,7 @@ void Client::ResetCastbarCooldownBySlot(int slot) {
GetPTimers().Clear(&database, (pTimerSpellStart + m_pp.mem_spells[slot])); GetPTimers().Clear(&database, (pTimerSpellStart + m_pp.mem_spells[slot]));
if (!IsLinkedSpellReuseTimerReady(spells[m_pp.mem_spells[slot]].timer_id)) { if (!IsLinkedSpellReuseTimerReady(spells[m_pp.mem_spells[slot]].timer_id)) {
GetPTimers().Clear(&database, (pTimerLinkedSpellReuseStart + spells[m_pp.mem_spells[slot]].timer_id)); GetPTimers().Clear(&database, (pTimerLinkedSpellReuseStart + spells[m_pp.mem_spells[slot]].timer_id));
} }
if (spells[m_pp.mem_spells[slot]].timer_id > 0 && spells[m_pp.mem_spells[slot]].timer_id < MAX_DISCIPLINE_TIMERS) { if (spells[m_pp.mem_spells[slot]].timer_id > 0 && spells[m_pp.mem_spells[slot]].timer_id < MAX_DISCIPLINE_TIMERS) {
SetLinkedSpellReuseTimer(spells[m_pp.mem_spells[slot]].timer_id, 0); SetLinkedSpellReuseTimer(spells[m_pp.mem_spells[slot]].timer_id, 0);
@ -6543,7 +6543,7 @@ void Client::ResetAllCastbarCooldowns() {
m_pp.spellSlotRefresh[i] = 1; m_pp.spellSlotRefresh[i] = 1;
GetPTimers().Clear(&database, (pTimerSpellStart + m_pp.mem_spells[i])); GetPTimers().Clear(&database, (pTimerSpellStart + m_pp.mem_spells[i]));
if (!IsLinkedSpellReuseTimerReady(spells[m_pp.mem_spells[i]].timer_id)) { if (!IsLinkedSpellReuseTimerReady(spells[m_pp.mem_spells[i]].timer_id)) {
GetPTimers().Clear(&database, (pTimerLinkedSpellReuseStart + spells[m_pp.mem_spells[i]].timer_id)); GetPTimers().Clear(&database, (pTimerLinkedSpellReuseStart + spells[m_pp.mem_spells[i]].timer_id));
} }
if (spells[m_pp.mem_spells[i]].timer_id > 0 && spells[m_pp.mem_spells[i]].timer_id < MAX_DISCIPLINE_TIMERS) { if (spells[m_pp.mem_spells[i]].timer_id > 0 && spells[m_pp.mem_spells[i]].timer_id < MAX_DISCIPLINE_TIMERS) {
SetLinkedSpellReuseTimer(spells[m_pp.mem_spells[i]].timer_id, 0); SetLinkedSpellReuseTimer(spells[m_pp.mem_spells[i]].timer_id, 0);
@ -6559,7 +6559,7 @@ void Client::ResetCastbarCooldownBySpellID(uint32 spell_id) {
m_pp.spellSlotRefresh[i] = 1; m_pp.spellSlotRefresh[i] = 1;
GetPTimers().Clear(&database, (pTimerSpellStart + m_pp.mem_spells[i])); GetPTimers().Clear(&database, (pTimerSpellStart + m_pp.mem_spells[i]));
if (!IsLinkedSpellReuseTimerReady(spells[m_pp.mem_spells[i]].timer_id)) { if (!IsLinkedSpellReuseTimerReady(spells[m_pp.mem_spells[i]].timer_id)) {
GetPTimers().Clear(&database, (pTimerLinkedSpellReuseStart + spells[m_pp.mem_spells[i]].timer_id)); GetPTimers().Clear(&database, (pTimerLinkedSpellReuseStart + spells[m_pp.mem_spells[i]].timer_id));
} }
if (spells[m_pp.mem_spells[i]].timer_id > 0 && spells[m_pp.mem_spells[i]].timer_id < MAX_DISCIPLINE_TIMERS) { if (spells[m_pp.mem_spells[i]].timer_id > 0 && spells[m_pp.mem_spells[i]].timer_id < MAX_DISCIPLINE_TIMERS) {
SetLinkedSpellReuseTimer(spells[m_pp.mem_spells[i]].timer_id, 0); SetLinkedSpellReuseTimer(spells[m_pp.mem_spells[i]].timer_id, 0);
@ -6571,7 +6571,7 @@ void Client::ResetCastbarCooldownBySpellID(uint32 spell_id) {
} }
bool Mob::IsActiveBardSong(int32 spell_id) { bool Mob::IsActiveBardSong(int32 spell_id) {
if (spell_id == bardsong) { if (spell_id == bardsong) {
return true; return true;
} }

View File

@ -59,7 +59,7 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme
inst = user_inv.GetItem(in_augment->container_slot); inst = user_inv.GetItem(in_augment->container_slot);
if (inst) { if (inst) {
const EQ::ItemData* item = inst->GetItem(); const EQ::ItemData* item = inst->GetItem();
if (item && inst->IsType(EQ::item::ItemClassBag) && item->BagType == EQ::item::BagTypeAugmentationSealer) { // We have found an appropriate inventory augmentation sealer if (item && inst->IsType(EQ::item::ItemClassBag) && item->BagType == EQ::item::BagTypeAugmentationSealer) { // We have found an appropriate inventory augmentation sealer
container = inst; container = inst;
// Verify that no more than two items are in container to guarantee no inadvertant wipes. // Verify that no more than two items are in container to guarantee no inadvertant wipes.
@ -105,11 +105,11 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme
user->Message(Chat::Red, "Error: There must be 1 augmentable item in the sealer."); user->Message(Chat::Red, "Error: There must be 1 augmentable item in the sealer.");
return; return;
} }
} else { // This happens if the augment button is clicked more than once quickly while augmenting } else { // This happens if the augment button is clicked more than once quickly while augmenting
if (!container->GetItem(0)) { if (!container->GetItem(0)) {
user->Message(Chat::Red, "Error: No item in the first slot of sealer."); user->Message(Chat::Red, "Error: No item in the first slot of sealer.");
} }
if (!container->GetItem(1)) { if (!container->GetItem(1)) {
user->Message(Chat::Red, "Error: No item in the second slot of sealer."); user->Message(Chat::Red, "Error: No item in the second slot of sealer.");
} }
@ -204,7 +204,7 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme
user->DeleteItemInInventory(EQ::InventoryProfile::CalcSlotId(in_augment->container_slot, i), 0, true); user->DeleteItemInInventory(EQ::InventoryProfile::CalcSlotId(in_augment->container_slot, i), 0, true);
} }
} }
container->Clear(); // Explicitly mark container as cleared. container->Clear(); // Explicitly mark container as cleared.
} }
} }
@ -763,7 +763,7 @@ void Client::SendTradeskillSearchResults(
uint32 comp_count = (uint32) atoi(row[3]); uint32 comp_count = (uint32) atoi(row[3]);
uint32 tradeskill = (uint16) atoi(row[4]); uint32 tradeskill = (uint16) atoi(row[4]);
uint32 must_learn = (uint16) atoi(row[5]); uint32 must_learn = (uint16) atoi(row[5]);
// Skip the recipes that exceed the threshold in skill difference // Skip the recipes that exceed the threshold in skill difference
// Recipes that have either been made before or were // Recipes that have either been made before or were
@ -787,7 +787,7 @@ void Client::SendTradeskillSearchResults(
//Skip recipes that must be learned //Skip recipes that must be learned
if ((must_learn & 0xf) && !character_learned_recipe.recipe_id) { if ((must_learn & 0xf) && !character_learned_recipe.recipe_id) {
continue; continue;
} }
@ -1070,8 +1070,8 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) {
spec->tradeskill, spec->tradeskill,
spec->trivial, spec->trivial,
chance, chance,
this->GetZoneID(), GetZoneID(),
this->GetInstanceID() GetInstanceID()
).c_str() ).c_str()
); );
} }
@ -1079,8 +1079,8 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) {
/* QS: Player_Log_Trade_Skill_Events */ /* QS: Player_Log_Trade_Skill_Events */
if (RuleB(QueryServ, PlayerLogTradeSkillEvents)) { if (RuleB(QueryServ, PlayerLogTradeSkillEvents)) {
std::string event_desc = StringFormat("Success :: fashioned recipe_id:%i tskillid:%i trivial:%i chance:%4.2f in zoneid:%i instid:%i", spec->recipe_id, spec->tradeskill, spec->trivial, chance, this->GetZoneID(), this->GetInstanceID()); std::string event_desc = StringFormat("Success :: fashioned recipe_id:%i tskillid:%i trivial:%i chance:%4.2f in zoneid:%i instid:%i", spec->recipe_id, spec->tradeskill, spec->trivial, chance, GetZoneID(), GetInstanceID());
QServ->PlayerLogEvent(Player_Log_Trade_Skill_Events, this->CharacterID(), event_desc); QServ->PlayerLogEvent(Player_Log_Trade_Skill_Events, CharacterID(), event_desc);
} }
if (RuleB(TaskSystem, EnableTaskSystem)) { if (RuleB(TaskSystem, EnableTaskSystem)) {
@ -1101,16 +1101,16 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) {
MessageString(Chat::Emote,TRADESKILL_FAILED); MessageString(Chat::Emote,TRADESKILL_FAILED);
LogTradeskills("Tradeskill failed"); LogTradeskills("Tradeskill failed");
if (this->GetGroup()) if (GetGroup())
{ {
entity_list.MessageGroup(this, true, Chat::Skills,"%s was unsuccessful in %s tradeskill attempt.",GetName(),this->GetGender() == 0 ? "his" : this->GetGender() == 1 ? "her" : "its"); entity_list.MessageGroup(this, true, Chat::Skills,"%s was unsuccessful in %s tradeskill attempt.",GetName(),GetGender() == 0 ? "his" : GetGender() == 1 ? "her" : "its");
} }
/* QS: Player_Log_Trade_Skill_Events */ /* QS: Player_Log_Trade_Skill_Events */
if (RuleB(QueryServ, PlayerLogTradeSkillEvents)){ if (RuleB(QueryServ, PlayerLogTradeSkillEvents)){
std::string event_desc = StringFormat("Failed :: recipe_id:%i tskillid:%i trivial:%i chance:%4.2f in zoneid:%i instid:%i", spec->recipe_id, spec->tradeskill, spec->trivial, chance, this->GetZoneID(), this->GetInstanceID()); std::string event_desc = StringFormat("Failed :: recipe_id:%i tskillid:%i trivial:%i chance:%4.2f in zoneid:%i instid:%i", spec->recipe_id, spec->tradeskill, spec->trivial, chance, GetZoneID(), GetInstanceID());
QServ->PlayerLogEvent(Player_Log_Trade_Skill_Events, this->CharacterID(), event_desc); QServ->PlayerLogEvent(Player_Log_Trade_Skill_Events, CharacterID(), event_desc);
} }
itr = spec->onfail.begin(); itr = spec->onfail.begin();
@ -1536,7 +1536,7 @@ bool ZoneDatabase::GetTradeRecipe(
"FROM tradeskill_recipe_entries " "FROM tradeskill_recipe_entries "
"WHERE salvagecount > 0 AND recipe_id = %u", recipe_id "WHERE salvagecount > 0 AND recipe_id = %u", recipe_id
); );
results = QueryDatabase(query); results = QueryDatabase(query);
if (results.Success()) { if (results.Success()) {
for (auto row = results.begin(); row != results.end(); ++row) { for (auto row = results.begin(); row != results.end(); ++row) {

View File

@ -163,7 +163,7 @@ void Trade::SendItemData(const EQ::ItemInstance* inst, int16 dest_slot_id)
{ {
if (inst == nullptr) if (inst == nullptr)
return; return;
// @merth: This needs to be redone with new item classes // @merth: This needs to be redone with new item classes
Mob* mob = With(); Mob* mob = With();
if (!mob->IsClient()) if (!mob->IsClient())
@ -249,7 +249,7 @@ void Trade::LogTrade()
bool comma = false; bool comma = false;
// Log items offered by owner // Log items offered by owner
cash = this->cp + this->sp + this->gp + this->pp; cash = cp + sp + gp + pp;
if ((cash>0) || (item_count>0)) { if ((cash>0) || (item_count>0)) {
sprintf(logtext, "%s gave %s ", trader->GetName(), with->GetName()); sprintf(logtext, "%s gave %s ", trader->GetName(), with->GetName());
@ -302,7 +302,7 @@ void Trade::DumpTrade()
{ {
Mob* with = With(); Mob* with = With();
LogTrading("Dumping trade data: [{}] in TradeState [{}] with [{}]", LogTrading("Dumping trade data: [{}] in TradeState [{}] with [{}]",
this->owner->GetName(), state, ((with==nullptr)?"(null)":with->GetName())); owner->GetName(), state, ((with==nullptr)?"(null)":with->GetName()));
if (!owner->IsClient()) if (!owner->IsClient())
return; return;
@ -465,7 +465,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st
if(other) { if(other) {
LogTrading("Finishing trade with client [{}]", other->GetName()); LogTrading("Finishing trade with client [{}]", other->GetName());
this->AddMoneyToPP(other->trade->cp, other->trade->sp, other->trade->gp, other->trade->pp, true); AddMoneyToPP(other->trade->cp, other->trade->sp, other->trade->gp, other->trade->pp, true);
// step 0: pre-processing // step 0: pre-processing
// QS code // QS code
@ -474,20 +474,20 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st
qs_log = true; qs_log = true;
if (finalizer) { if (finalizer) {
qs_audit->char2_id = this->character_id; qs_audit->char2_id = character_id;
qs_audit->char2_money.platinum = this->trade->pp; qs_audit->char2_money.platinum = trade->pp;
qs_audit->char2_money.gold = this->trade->gp; qs_audit->char2_money.gold = trade->gp;
qs_audit->char2_money.silver = this->trade->sp; qs_audit->char2_money.silver = trade->sp;
qs_audit->char2_money.copper = this->trade->cp; qs_audit->char2_money.copper = trade->cp;
} }
else { else {
qs_audit->char1_id = this->character_id; qs_audit->char1_id = character_id;
qs_audit->char1_money.platinum = this->trade->pp; qs_audit->char1_money.platinum = trade->pp;
qs_audit->char1_money.gold = this->trade->gp; qs_audit->char1_money.gold = trade->gp;
qs_audit->char1_money.silver = this->trade->sp; qs_audit->char1_money.silver = trade->sp;
qs_audit->char1_money.copper = this->trade->cp; qs_audit->char1_money.copper = trade->cp;
} }
} }
@ -508,7 +508,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st
if (qs_log) { if (qs_log) {
auto detail = new QSTradeItems_Struct; auto detail = new QSTradeItems_Struct;
detail->from_id = this->character_id; detail->from_id = character_id;
detail->from_slot = trade_slot; detail->from_slot = trade_slot;
detail->to_id = other->CharacterID(); detail->to_id = other->CharacterID();
detail->to_slot = free_slot; detail->to_slot = free_slot;
@ -533,7 +533,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st
if (bag_inst) { if (bag_inst) {
detail = new QSTradeItems_Struct; detail = new QSTradeItems_Struct;
detail->from_id = this->character_id; detail->from_id = character_id;
detail->from_slot = EQ::InventoryProfile::CalcSlotId(trade_slot, sub_slot); detail->from_slot = EQ::InventoryProfile::CalcSlotId(trade_slot, sub_slot);
detail->to_id = other->CharacterID(); detail->to_id = other->CharacterID();
detail->to_slot = EQ::InventoryProfile::CalcSlotId(free_slot, sub_slot); detail->to_slot = EQ::InventoryProfile::CalcSlotId(free_slot, sub_slot);
@ -618,7 +618,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st
if (qs_log) { if (qs_log) {
auto detail = new QSTradeItems_Struct; auto detail = new QSTradeItems_Struct;
detail->from_id = this->character_id; detail->from_id = character_id;
detail->from_slot = trade_slot; detail->from_slot = trade_slot;
detail->to_id = other->CharacterID(); detail->to_id = other->CharacterID();
detail->to_slot = partial_slot; detail->to_slot = partial_slot;
@ -686,9 +686,9 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st
if (qs_log) { if (qs_log) {
auto detail = new QSTradeItems_Struct; auto detail = new QSTradeItems_Struct;
detail->from_id = this->character_id; detail->from_id = character_id;
detail->from_slot = trade_slot; detail->from_slot = trade_slot;
detail->to_id = this->character_id; detail->to_id = character_id;
detail->to_slot = bias_slot; detail->to_slot = bias_slot;
detail->item_id = inst->GetID(); detail->item_id = inst->GetID();
detail->charges = (old_charges - inst->GetCharges()); detail->charges = (old_charges - inst->GetCharges());
@ -726,7 +726,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st
if (qs_log) { if (qs_log) {
auto detail = new QSTradeItems_Struct; auto detail = new QSTradeItems_Struct;
detail->from_id = this->character_id; detail->from_id = character_id;
detail->from_slot = trade_slot; detail->from_slot = trade_slot;
detail->to_id = other->CharacterID(); detail->to_id = other->CharacterID();
detail->to_slot = free_slot; detail->to_slot = free_slot;
@ -752,7 +752,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st
if (bag_inst) { if (bag_inst) {
detail = new QSTradeItems_Struct; detail = new QSTradeItems_Struct;
detail->from_id = this->character_id; detail->from_id = character_id;
detail->from_slot = trade_slot; detail->from_slot = trade_slot;
detail->to_id = other->CharacterID(); detail->to_id = other->CharacterID();
detail->to_slot = free_slot; detail->to_slot = free_slot;
@ -890,11 +890,11 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st
const EQ::ItemData* item = inst->GetItem(); const EQ::ItemData* item = inst->GetItem();
if(item && quest_npc == false) { if(item && quest_npc == false) {
bool isPetAndCanHaveNoDrop = (RuleB(Pets, CanTakeNoDrop) && bool isPetAndCanHaveNoDrop = (RuleB(Pets, CanTakeNoDrop) &&
_CLIENTPET(tradingWith) && _CLIENTPET(tradingWith) &&
tradingWith->GetPetType()<=petOther); tradingWith->GetPetType()<=petOther);
// if it was not a NO DROP or Attuned item (or if a GM is trading), let the NPC have it // if it was not a NO DROP or Attuned item (or if a GM is trading), let the NPC have it
if(GetGM() || (inst->IsAttuned() == false && if(GetGM() || (inst->IsAttuned() == false &&
(item->NoDrop != 0 || isPetAndCanHaveNoDrop))) { (item->NoDrop != 0 || isPetAndCanHaveNoDrop))) {
// pets need to look inside bags and try to equip items found there // pets need to look inside bags and try to equip items found there
if (item->IsClassBag() && item->BagSlots > 0) { if (item->IsClassBag() && item->BagSlots > 0) {
@ -947,7 +947,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st
if(!tradingWith->IsMoving()) if(!tradingWith->IsMoving())
tradingWith->FaceTarget(this); tradingWith->FaceTarget(this);
this->EVENT_ITEM_ScriptStopReturn(); EVENT_ITEM_ScriptStopReturn();
} }
} }
@ -965,7 +965,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st
parse->AddVar(temp1, temp2); parse->AddVar(temp1, temp2);
snprintf(temp1, 100, "platinum.%d", tradingWith->GetNPCTypeID()); snprintf(temp1, 100, "platinum.%d", tradingWith->GetNPCTypeID());
snprintf(temp2, 100, "%u", trade->pp); snprintf(temp2, 100, "%u", trade->pp);
parse->AddVar(temp1, temp2); parse->AddVar(temp1, temp2);
if(tradingWith->GetAppearance() != eaDead) { if(tradingWith->GetAppearance() != eaDead) {
tradingWith->FaceTarget(this); tradingWith->FaceTarget(this);
@ -1031,7 +1031,7 @@ void Client::Trader_ShowItems(){
auto outapp = new EQApplicationPacket(OP_Trader, sizeof(Trader_Struct)); auto outapp = new EQApplicationPacket(OP_Trader, sizeof(Trader_Struct));
Trader_Struct* outints = (Trader_Struct*)outapp->pBuffer; Trader_Struct* outints = (Trader_Struct*)outapp->pBuffer;
Trader_Struct* TraderItems = database.LoadTraderItem(this->CharacterID()); Trader_Struct* TraderItems = database.LoadTraderItem(CharacterID());
for(int i = 0; i < 80; i++){ for(int i = 0; i < 80; i++){
outints->ItemCost[i] = TraderItems->ItemCost[i]; outints->ItemCost[i] = TraderItems->ItemCost[i];
@ -1091,7 +1091,7 @@ void Client::Trader_StartTrader() {
sis->Code = BazaarTrader_StartTraderMode; sis->Code = BazaarTrader_StartTraderMode;
sis->TraderID = this->GetID(); sis->TraderID = GetID();
QueuePacket(outapp); QueuePacket(outapp);
@ -1106,7 +1106,7 @@ void Client::Trader_StartTrader() {
bts->Code = 1; bts->Code = 1;
bts->ID = this->GetID(); bts->ID = GetID();
strn0cpy(bts->Name, GetName(), sizeof(bts->Name)); strn0cpy(bts->Name, GetName(), sizeof(bts->Name));
@ -1155,7 +1155,7 @@ void Client::Trader_EndTrader() {
} }
} }
database.DeleteTraderItem(this->CharacterID()); database.DeleteTraderItem(CharacterID());
// Notify other clients we are no longer in trader mode. // Notify other clients we are no longer in trader mode.
// //
@ -1165,7 +1165,7 @@ void Client::Trader_EndTrader() {
bts->Code = 0; bts->Code = 0;
bts->ID = this->GetID(); bts->ID = GetID();
strn0cpy(bts->Name, GetName(), sizeof(bts->Name)); strn0cpy(bts->Name, GetName(), sizeof(bts->Name));
@ -1188,7 +1188,7 @@ void Client::Trader_EndTrader() {
WithCustomer(0); WithCustomer(0);
this->Trader = false; Trader = false;
} }
void Client::SendTraderItem(uint32 ItemID, uint16 Quantity) { void Client::SendTraderItem(uint32 ItemID, uint16 Quantity) {
@ -1269,12 +1269,12 @@ uint32 Client::FindTraderItemSerialNumber(int32 ItemID) {
EQ::ItemInstance* item = nullptr; EQ::ItemInstance* item = nullptr;
uint16 SlotID = 0; uint16 SlotID = 0;
for (int i = EQ::invslot::GENERAL_BEGIN; i <= EQ::invslot::GENERAL_END; i++){ for (int i = EQ::invslot::GENERAL_BEGIN; i <= EQ::invslot::GENERAL_END; i++){
item = this->GetInv().GetItem(i); item = GetInv().GetItem(i);
if (item && item->GetItem()->BagType == EQ::item::BagTypeTradersSatchel){ if (item && item->GetItem()->BagType == EQ::item::BagTypeTradersSatchel){
for (int x = EQ::invbag::SLOT_BEGIN; x <= EQ::invbag::SLOT_END; x++) { for (int x = EQ::invbag::SLOT_BEGIN; x <= EQ::invbag::SLOT_END; x++) {
// we already have the parent bag and a contents iterator..why not just iterate the bag!?? // we already have the parent bag and a contents iterator..why not just iterate the bag!??
SlotID = EQ::InventoryProfile::CalcSlotId(i, x); SlotID = EQ::InventoryProfile::CalcSlotId(i, x);
item = this->GetInv().GetItem(SlotID); item = GetInv().GetItem(SlotID);
if (item) { if (item) {
if (item->GetID() == ItemID) if (item->GetID() == ItemID)
return item->GetSerialNumber(); return item->GetSerialNumber();
@ -1292,12 +1292,12 @@ EQ::ItemInstance* Client::FindTraderItemBySerialNumber(int32 SerialNumber){
EQ::ItemInstance* item = nullptr; EQ::ItemInstance* item = nullptr;
uint16 SlotID = 0; uint16 SlotID = 0;
for (int i = EQ::invslot::GENERAL_BEGIN; i <= EQ::invslot::GENERAL_END; i++){ for (int i = EQ::invslot::GENERAL_BEGIN; i <= EQ::invslot::GENERAL_END; i++){
item = this->GetInv().GetItem(i); item = GetInv().GetItem(i);
if (item && item->GetItem()->BagType == EQ::item::BagTypeTradersSatchel){ if (item && item->GetItem()->BagType == EQ::item::BagTypeTradersSatchel){
for (int x = EQ::invbag::SLOT_BEGIN; x <= EQ::invbag::SLOT_END; x++) { for (int x = EQ::invbag::SLOT_BEGIN; x <= EQ::invbag::SLOT_END; x++) {
// we already have the parent bag and a contents iterator..why not just iterate the bag!?? // we already have the parent bag and a contents iterator..why not just iterate the bag!??
SlotID = EQ::InventoryProfile::CalcSlotId(i, x); SlotID = EQ::InventoryProfile::CalcSlotId(i, x);
item = this->GetInv().GetItem(SlotID); item = GetInv().GetItem(SlotID);
if(item) { if(item) {
if(item->GetSerialNumber() == SerialNumber) if(item->GetSerialNumber() == SerialNumber)
return item; return item;
@ -1325,7 +1325,7 @@ GetItems_Struct* Client::GetTraderItems(){
for (int i = EQ::invslot::GENERAL_BEGIN; i <= EQ::invslot::GENERAL_END; i++) { for (int i = EQ::invslot::GENERAL_BEGIN; i <= EQ::invslot::GENERAL_END; i++) {
if (ndx >= 80) if (ndx >= 80)
break; break;
item = this->GetInv().GetItem(i); item = GetInv().GetItem(i);
if (item && item->GetItem()->BagType == EQ::item::BagTypeTradersSatchel){ if (item && item->GetItem()->BagType == EQ::item::BagTypeTradersSatchel){
for (int x = EQ::invbag::SLOT_BEGIN; x <= EQ::invbag::SLOT_END; x++) { for (int x = EQ::invbag::SLOT_BEGIN; x <= EQ::invbag::SLOT_END; x++) {
if (ndx >= 80) if (ndx >= 80)
@ -1333,7 +1333,7 @@ GetItems_Struct* Client::GetTraderItems(){
SlotID = EQ::InventoryProfile::CalcSlotId(i, x); SlotID = EQ::InventoryProfile::CalcSlotId(i, x);
item = this->GetInv().GetItem(SlotID); item = GetInv().GetItem(SlotID);
if(item){ if(item){
gis->Items[ndx] = item->GetItem()->ID; gis->Items[ndx] = item->GetItem()->ID;
@ -1352,12 +1352,12 @@ uint16 Client::FindTraderItem(int32 SerialNumber, uint16 Quantity){
const EQ::ItemInstance* item= nullptr; const EQ::ItemInstance* item= nullptr;
uint16 SlotID = 0; uint16 SlotID = 0;
for (int i = EQ::invslot::GENERAL_BEGIN; i <= EQ::invslot::GENERAL_END; i++) { for (int i = EQ::invslot::GENERAL_BEGIN; i <= EQ::invslot::GENERAL_END; i++) {
item = this->GetInv().GetItem(i); item = GetInv().GetItem(i);
if (item && item->GetItem()->BagType == EQ::item::BagTypeTradersSatchel){ if (item && item->GetItem()->BagType == EQ::item::BagTypeTradersSatchel){
for (int x = EQ::invbag::SLOT_BEGIN; x <= EQ::invbag::SLOT_END; x++){ for (int x = EQ::invbag::SLOT_BEGIN; x <= EQ::invbag::SLOT_END; x++){
SlotID = EQ::InventoryProfile::CalcSlotId(i, x); SlotID = EQ::InventoryProfile::CalcSlotId(i, x);
item = this->GetInv().GetItem(SlotID); item = GetInv().GetItem(SlotID);
if (item && item->GetSerialNumber() == SerialNumber && if (item && item->GetSerialNumber() == SerialNumber &&
(item->GetCharges() >= Quantity || (item->GetCharges() <= 0 && Quantity == 1))) (item->GetCharges() >= Quantity || (item->GetCharges() <= 0 && Quantity == 1)))
@ -1368,7 +1368,7 @@ uint16 Client::FindTraderItem(int32 SerialNumber, uint16 Quantity){
} }
} }
LogTrading("Could NOT find a match for Item: [{}] with a quantity of: [{}] on Trader: [{}]\n", LogTrading("Could NOT find a match for Item: [{}] with a quantity of: [{}] on Trader: [{}]\n",
SerialNumber , Quantity, this->GetName()); SerialNumber , Quantity, GetName());
return 0; return 0;
} }
@ -1382,7 +1382,7 @@ void Client::NukeTraderItem(uint16 Slot,int16 Charges,int16 Quantity,Client* Cus
if(Quantity < Charges) if(Quantity < Charges)
{ {
Customer->SendSingleTraderItem(this->CharacterID(), SerialNumber); Customer->SendSingleTraderItem(CharacterID(), SerialNumber);
m_inv.DeleteItem(Slot, Quantity); m_inv.DeleteItem(Slot, Quantity);
} }
else else
@ -1432,7 +1432,7 @@ void Client::NukeTraderItem(uint16 Slot,int16 Charges,int16 Quantity,Client* Cus
for(int i = 0; i < Quantity; i++) { for(int i = 0; i < Quantity; i++) {
this->QueuePacket(outapp2); QueuePacket(outapp2);
} }
safe_delete(outapp2); safe_delete(outapp2);
@ -1458,18 +1458,18 @@ void Client::FindAndNukeTraderItem(int32 SerialNumber, int16 Quantity, Client* C
int16 Charges=0; int16 Charges=0;
uint16 SlotID = FindTraderItem(SerialNumber, Quantity); uint16 SlotID = FindTraderItem(SerialNumber, Quantity);
if(SlotID > 0) { if(SlotID > 0) {
item = this->GetInv().GetItem(SlotID); item = GetInv().GetItem(SlotID);
if (!item) if (!item)
{ {
LogTrading("Could not find Item: [{}] on Trader: [{}]", SerialNumber, Quantity, this->GetName()); LogTrading("Could not find Item: [{}] on Trader: [{}]", SerialNumber, Quantity, GetName());
return; return;
} }
Charges = this->GetInv().GetItem(SlotID)->GetCharges(); Charges = GetInv().GetItem(SlotID)->GetCharges();
Stackable = item->IsStackable(); Stackable = item->IsStackable();
@ -1480,9 +1480,9 @@ void Client::FindAndNukeTraderItem(int32 SerialNumber, int16 Quantity, Client* C
if (Charges <= Quantity || (Charges <= 0 && Quantity==1) || !Stackable) if (Charges <= Quantity || (Charges <= 0 && Quantity==1) || !Stackable)
{ {
this->DeleteItemInInventory(SlotID, Quantity); DeleteItemInInventory(SlotID, Quantity);
TraderCharges_Struct* TraderItems = database.LoadTraderItemWithCharges(this->CharacterID()); TraderCharges_Struct* TraderItems = database.LoadTraderItemWithCharges(CharacterID());
uint8 Count = 0; uint8 Count = 0;
@ -1492,7 +1492,7 @@ void Client::FindAndNukeTraderItem(int32 SerialNumber, int16 Quantity, Client* C
if(TestSlot && TraderItems->SerialNumber[i] == SerialNumber) if(TestSlot && TraderItems->SerialNumber[i] == SerialNumber)
{ {
database.DeleteTraderItem(this->CharacterID(),i); database.DeleteTraderItem(CharacterID(),i);
NukeTraderItem(SlotID, Charges, Quantity, Customer, TraderSlot, TraderItems->SerialNumber[i], TraderItems->ItemID[i]); NukeTraderItem(SlotID, Charges, Quantity, Customer, TraderSlot, TraderItems->SerialNumber[i], TraderItems->ItemID[i]);
TestSlot=false; TestSlot=false;
} }
@ -1510,7 +1510,7 @@ void Client::FindAndNukeTraderItem(int32 SerialNumber, int16 Quantity, Client* C
} }
else else
{ {
database.UpdateTraderItemCharges(this->CharacterID(), item->GetSerialNumber(), Charges-Quantity); database.UpdateTraderItemCharges(CharacterID(), item->GetSerialNumber(), Charges-Quantity);
NukeTraderItem(SlotID, Charges, Quantity, Customer, TraderSlot, item->GetSerialNumber(), item->GetID()); NukeTraderItem(SlotID, Charges, Quantity, Customer, TraderSlot, item->GetSerialNumber(), item->GetID());
@ -1519,7 +1519,7 @@ void Client::FindAndNukeTraderItem(int32 SerialNumber, int16 Quantity, Client* C
} }
} }
LogTrading("Could NOT find a match for Item: [{}] with a quantity of: [{}] on Trader: [{}]\n",SerialNumber, LogTrading("Could NOT find a match for Item: [{}] with a quantity of: [{}] on Trader: [{}]\n",SerialNumber,
Quantity,this->GetName()); Quantity,GetName());
} }
void Client::ReturnTraderReq(const EQApplicationPacket* app, int16 TraderItemCharges, uint32 itemid){ void Client::ReturnTraderReq(const EQApplicationPacket* app, int16 TraderItemCharges, uint32 itemid){
@ -1553,7 +1553,7 @@ void Client::ReturnTraderReq(const EQApplicationPacket* app, int16 TraderItemCha
outtbs->Quantity = TraderItemCharges; outtbs->Quantity = TraderItemCharges;
// This should probably be trader ID, not customer ID as it is below. // This should probably be trader ID, not customer ID as it is below.
outtbs->TraderID = this->GetID(); outtbs->TraderID = GetID();
outtbs->AlreadySold = 0; outtbs->AlreadySold = 0;
QueuePacket(outapp); QueuePacket(outapp);
@ -1702,7 +1702,7 @@ void Client::BuyTraderItem(TraderBuy_Struct* tbs, Client* Trader, const EQApplic
ReturnTraderReq(app, outtbs->Quantity, ItemID); ReturnTraderReq(app, outtbs->Quantity, ItemID);
outtbs->TraderID = this->GetID(); outtbs->TraderID = GetID();
outtbs->Action = BazaarBuyItem; outtbs->Action = BazaarBuyItem;
strn0cpy(outtbs->ItemName, BuyItem->GetItem()->Name, 64); strn0cpy(outtbs->ItemName, BuyItem->GetItem()->Name, 64);
@ -1998,7 +1998,7 @@ void Client::SendBazaarResults(
brds->Unknown008 = 0xFFFFFFFF; brds->Unknown008 = 0xFFFFFFFF;
brds->Unknown012 = 0xFFFFFFFF; brds->Unknown012 = 0xFFFFFFFF;
brds->Unknown016 = 0xFFFFFFFF; brds->Unknown016 = 0xFFFFFFFF;
this->QueuePacket(outapp2); QueuePacket(outapp2);
safe_delete(outapp2); safe_delete(outapp2);
return; return;
} }
@ -2067,7 +2067,7 @@ void Client::SendBazaarResults(
memcpy(outapp->pBuffer, buffer, Size); memcpy(outapp->pBuffer, buffer, Size);
this->QueuePacket(outapp); QueuePacket(outapp);
safe_delete(outapp); safe_delete(outapp);
safe_delete_array(buffer); safe_delete_array(buffer);
@ -2082,7 +2082,7 @@ void Client::SendBazaarResults(
brds->Unknown012 = 0xFFFFFFFF; brds->Unknown012 = 0xFFFFFFFF;
brds->Unknown016 = 0xFFFFFFFF; brds->Unknown016 = 0xFFFFFFFF;
this->QueuePacket(outapp2); QueuePacket(outapp2);
safe_delete(outapp2); safe_delete(outapp2);
} }

View File

@ -116,7 +116,7 @@ void Mob::TuneGetStats(Mob* defender, Mob *attacker)
Message(0, "[#Tune] Total Offense: %i ", TuneGetOffense(defender, attacker)); Message(0, "[#Tune] Total Offense: %i ", TuneGetOffense(defender, attacker));
Message(0, "[#Tune] Chance to hit: %.0f pct", round(hit_chance)); Message(0, "[#Tune] Chance to hit: %.0f pct", round(hit_chance));
Message(0, "[#Tune] Total Accuracy: %i ", TuneGetAccuracy( defender,attacker)); Message(0, "[#Tune] Total Accuracy: %i ", TuneGetAccuracy( defender,attacker));
if (attacker->IsNPC()) if (attacker->IsNPC())
{ {
Message(0, "[#Tune] NPC STAT ATK: %i ", static_cast<int>(attacker->CastToNPC()->GetNPCStat("atk"))); Message(0, "[#Tune] NPC STAT ATK: %i ", static_cast<int>(attacker->CastToNPC()->GetNPCStat("atk")));
@ -843,7 +843,7 @@ int Mob::TuneNPCAttack(Mob* other, bool no_avoid, bool no_hit_chance, int hit_ch
OffHandAtk(false); OffHandAtk(false);
uint8 otherlevel = other->GetLevel(); uint8 otherlevel = other->GetLevel();
uint8 mylevel = this->GetLevel(); uint8 mylevel = GetLevel();
otherlevel = otherlevel ? otherlevel : 1; otherlevel = otherlevel ? otherlevel : 1;
mylevel = mylevel ? mylevel : 1; mylevel = mylevel ? mylevel : 1;

View File

@ -97,10 +97,10 @@ void NPC::DisplayWaypointInfo(Client *client) {
GetID(), GetID(),
GetSpawnGroupId(), GetSpawnGroupId(),
GetSpawnPointID() GetSpawnPointID()
).c_str() ).c_str()
); );
for (const auto& current_waypoint : Waypoints) { for (const auto& current_waypoint : Waypoints) {
client->Message( client->Message(
Chat::White, Chat::White,
@ -118,7 +118,7 @@ void NPC::DisplayWaypointInfo(Client *client) {
"{} ({})", "{} ({})",
ConvertSecondsToTime(current_waypoint.pause), ConvertSecondsToTime(current_waypoint.pause),
current_waypoint.pause current_waypoint.pause
) : ) :
"" ""
) )
).c_str() ).c_str()
@ -237,7 +237,7 @@ void NPC::MoveTo(const glm::vec4 &position, bool saveguardspot)
} //hack to make IsGuarding simpler } //hack to make IsGuarding simpler
if (m_GuardPoint.w == -1) if (m_GuardPoint.w == -1)
m_GuardPoint.w = this->CalculateHeadingToTarget(position.x, position.y); m_GuardPoint.w = CalculateHeadingToTarget(position.x, position.y);
LogAI("Setting guard position to [{}]", to_string(static_cast<glm::vec3>(m_GuardPoint)).c_str()); LogAI("Setting guard position to [{}]", to_string(static_cast<glm::vec3>(m_GuardPoint)).c_str());
} }
@ -632,7 +632,7 @@ void NPC::AssignWaypoints(int32 grid_id, int start_wp)
if (grid_id < 0) { if (grid_id < 0) {
// Allow setting negative grid values for pausing pathing // Allow setting negative grid values for pausing pathing
this->CastToNPC()->SetGrid(grid_id); CastToNPC()->SetGrid(grid_id);
return; return;
} }
@ -767,9 +767,9 @@ float Mob::GetFixedZ(const glm::vec3 &destination, int32 z_find_offset) {
/* /*
* Any more than 5 in the offset makes NPC's hop/snap to ceiling in small corridors * Any more than 5 in the offset makes NPC's hop/snap to ceiling in small corridors
*/ */
new_z = this->FindDestGroundZ(destination, z_find_offset); new_z = FindDestGroundZ(destination, z_find_offset);
if (new_z != BEST_Z_INVALID) { if (new_z != BEST_Z_INVALID) {
new_z += this->GetZOffset(); new_z += GetZOffset();
if (new_z < -2000) { if (new_z < -2000) {
new_z = m_Position.z; new_z = m_Position.z;
@ -779,7 +779,7 @@ float Mob::GetFixedZ(const glm::vec3 &destination, int32 z_find_offset) {
auto duration = timer.elapsed(); auto duration = timer.elapsed();
LogFixZ("Mob::GetFixedZ() ([{}]) returned [{}] at [{}], [{}], [{}] - Took [{}]", LogFixZ("Mob::GetFixedZ() ([{}]) returned [{}] at [{}], [{}], [{}] - Took [{}]",
this->GetCleanName(), GetCleanName(),
new_z, new_z,
destination.x, destination.x,
destination.y, destination.y,
@ -811,17 +811,17 @@ void Mob::FixZ(int32 z_find_offset /*= 5*/, bool fix_client_z /*= false*/) {
if ((new_z > -2000) && new_z != BEST_Z_INVALID) { if ((new_z > -2000) && new_z != BEST_Z_INVALID) {
if (RuleB(Map, MobZVisualDebug)) { if (RuleB(Map, MobZVisualDebug)) {
this->SendAppearanceEffect(78, 0, 0, 0, 0); SendAppearanceEffect(78, 0, 0, 0, 0);
} }
m_Position.z = new_z; m_Position.z = new_z;
} }
else { else {
if (RuleB(Map, MobZVisualDebug)) { if (RuleB(Map, MobZVisualDebug)) {
this->SendAppearanceEffect(103, 0, 0, 0, 0); SendAppearanceEffect(103, 0, 0, 0, 0);
} }
LogFixZ("[{}] is failing to find Z [{}]", this->GetCleanName(), std::abs(m_Position.z - new_z)); LogFixZ("[{}] is failing to find Z [{}]", GetCleanName(), std::abs(m_Position.z - new_z));
} }
} }

View File

@ -1560,7 +1560,7 @@ bool Zone::Process() {
if(Weather_Timer->Check()) if(Weather_Timer->Check())
{ {
Weather_Timer->Disable(); Weather_Timer->Disable();
this->ChangeWeather(); ChangeWeather();
} }
if(qGlobals) if(qGlobals)
@ -1690,7 +1690,7 @@ void Zone::ChangeWeather()
else else
{ {
LogDebug("The weather for zone: [{}] has changed. Old weather was = [{}]. New weather is = [{}] The next check will be in [{}] seconds. Rain chance: [{}], Rain duration: [{}], Snow chance [{}], Snow duration: [{}]", zone->GetShortName(), tmpOldWeather, zone_weather,Weather_Timer->GetRemainingTime()/1000,rainchance,rainduration,snowchance,snowduration); LogDebug("The weather for zone: [{}] has changed. Old weather was = [{}]. New weather is = [{}] The next check will be in [{}] seconds. Rain chance: [{}], Rain duration: [{}], Snow chance [{}], Snow duration: [{}]", zone->GetShortName(), tmpOldWeather, zone_weather,Weather_Timer->GetRemainingTime()/1000,rainchance,rainduration,snowchance,snowduration);
this->weatherSend(); weatherSend();
if (zone->weather_intensity == 0) if (zone->weather_intensity == 0)
{ {
zone->zone_weather = 0; zone->zone_weather = 0;

View File

@ -442,15 +442,15 @@ void Client::DoZoneSuccess(ZoneChange_Struct *zc, uint16 zone_id, uint32 instanc
/* QS: PlayerLogZone */ /* QS: PlayerLogZone */
if (RuleB(QueryServ, PlayerLogZone)){ if (RuleB(QueryServ, PlayerLogZone)){
std::string event_desc = StringFormat("Zoning :: zoneid:%u instid:%u x:%4.2f y:%4.2f z:%4.2f h:%4.2f zonemode:%d from zoneid:%u instid:%i", zone_id, instance_id, dest_x, dest_y, dest_z, dest_h, zone_mode, this->GetZoneID(), this->GetInstanceID()); std::string event_desc = StringFormat("Zoning :: zoneid:%u instid:%u x:%4.2f y:%4.2f z:%4.2f h:%4.2f zonemode:%d from zoneid:%u instid:%i", zone_id, instance_id, dest_x, dest_y, dest_z, dest_h, zone_mode, GetZoneID(), GetInstanceID());
QServ->PlayerLogEvent(Player_Log_Zoning, this->CharacterID(), event_desc); QServ->PlayerLogEvent(Player_Log_Zoning, CharacterID(), event_desc);
} }
/* Dont clear aggro until the zone is successful */ /* Dont clear aggro until the zone is successful */
entity_list.RemoveFromHateLists(this); entity_list.RemoveFromHateLists(this);
if(this->GetPet()) if(GetPet())
entity_list.RemoveFromHateLists(this->GetPet()); entity_list.RemoveFromHateLists(GetPet());
if (GetPendingExpeditionInviteID() != 0) if (GetPendingExpeditionInviteID() != 0)
{ {
@ -810,9 +810,9 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z
// 76 is orignial Plane of Hate // 76 is orignial Plane of Hate
// WildcardX 27 January 2008. Tested this for 6.2 and Titanium clients. // WildcardX 27 January 2008. Tested this for 6.2 and Titanium clients.
if(this->GetZoneID() == 1) if(GetZoneID() == 1)
gmg->zone_id = 2; gmg->zone_id = 2;
else if(this->GetZoneID() == 2) else if(GetZoneID() == 2)
gmg->zone_id = 1; gmg->zone_id = 1;
else else
gmg->zone_id = 1; gmg->zone_id = 1;
@ -886,9 +886,9 @@ void Client::GoToSafeCoords(uint16 zone_id, uint16 instance_id) {
void Mob::Gate(uint8 bind_number) { void Mob::Gate(uint8 bind_number) {
GoToBind(bind_number); GoToBind(bind_number);
if (RuleB(NPC, NPCHealOnGate) && this->IsNPC() && this->GetHPRatio() <= RuleR(NPC, NPCHealOnGateAmount)) { if (RuleB(NPC, NPCHealOnGate) && IsNPC() && GetHPRatio() <= RuleR(NPC, NPCHealOnGateAmount)) {
auto HealAmount = (RuleR(NPC, NPCHealOnGateAmount) / 100); auto HealAmount = (RuleR(NPC, NPCHealOnGateAmount) / 100);
SetHP(int(this->GetMaxHP() * HealAmount)); SetHP(int(GetMaxHP() * HealAmount));
} }
} }
@ -920,7 +920,7 @@ void Client::SetBindPoint(int bind_number, int to_zone, int to_instance, const g
m_pp.binds[bind_number].y = location.y; m_pp.binds[bind_number].y = location.y;
m_pp.binds[bind_number].z = location.z; m_pp.binds[bind_number].z = location.z;
} }
database.SaveCharacterBindPoint(this->CharacterID(), m_pp.binds[bind_number], bind_number); database.SaveCharacterBindPoint(CharacterID(), m_pp.binds[bind_number], bind_number);
} }
void Client::SetBindPoint2(int bind_number, int to_zone, int to_instance, const glm::vec4 &location) void Client::SetBindPoint2(int bind_number, int to_zone, int to_instance, const glm::vec4 &location)
@ -943,7 +943,7 @@ void Client::SetBindPoint2(int bind_number, int to_zone, int to_instance, const
m_pp.binds[bind_number].z = location.z; m_pp.binds[bind_number].z = location.z;
m_pp.binds[bind_number].heading = location.w; m_pp.binds[bind_number].heading = location.w;
} }
database.SaveCharacterBindPoint(this->CharacterID(), m_pp.binds[bind_number], bind_number); database.SaveCharacterBindPoint(CharacterID(), m_pp.binds[bind_number], bind_number);
} }
void Client::GoToBind(uint8 bind_number) { void Client::GoToBind(uint8 bind_number) {