Merge fix

This commit is contained in:
KimLS
2019-09-17 20:56:22 -07:00
231 changed files with 18003 additions and 13896 deletions
-4
View File
@@ -250,10 +250,6 @@ SET(zone_headers
zonedb.h
zonedump.h)
IF(EQEMU_DEPOP_INVALIDATES_CACHE)
ADD_DEFINITIONS(-DDEPOP_INVALIDATES_NPC_TYPES_CACHE)
ENDIF(EQEMU_DEPOP_INVALIDATES_CACHE)
ADD_EXECUTABLE(zone ${zone_sources} ${zone_headers})
INSTALL(TARGETS zone RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
+19 -19
View File
@@ -57,7 +57,7 @@ void Mob::TemporaryPets(uint16 spell_id, Mob *targ, const char *name_override, u
PetRecord record;
if (!database.GetPoweredPetEntry(spells[spell_id].teleport_zone, act_power, &record))
{
Log(Logs::General, Logs::Error, "Unknown swarm pet spell id: %d, check pets table", spell_id);
LogError("Unknown swarm pet spell id: {}, check pets table", spell_id);
Message(Chat::Red, "Unable to find data for pet %s", spells[spell_id].teleport_zone);
return;
}
@@ -84,7 +84,7 @@ void Mob::TemporaryPets(uint16 spell_id, Mob *targ, const char *name_override, u
const NPCType *npc_type = database.LoadNPCTypesData(pet.npc_id);
if (npc_type == nullptr) {
//log write
Log(Logs::General, Logs::Error, "Unknown npc type for swarm pet spell id: %d", spell_id);
LogError("Unknown npc type for swarm pet spell id: [{}]", spell_id);
Message(0, "Unable to find pet!");
return;
}
@@ -183,7 +183,7 @@ void Mob::TypesTemporaryPets(uint32 typesid, Mob *targ, const char *name_overrid
const NPCType *npc_type = database.LoadNPCTypesData(typesid);
if(npc_type == nullptr) {
//log write
Log(Logs::General, Logs::Error, "Unknown npc type for swarm pet type id: %d", typesid);
LogError("Unknown npc type for swarm pet type id: [{}]", typesid);
Message(0,"Unable to find pet!");
return;
}
@@ -1562,17 +1562,17 @@ bool Mob::CanPurchaseAlternateAdvancementRank(AA::Rank *rank, bool check_price,
}
void Zone::LoadAlternateAdvancement() {
Log(Logs::General, Logs::Status, "Loading Alternate Advancement Data...");
LogInfo("Loading Alternate Advancement Data");
if(!database.LoadAlternateAdvancementAbilities(aa_abilities,
aa_ranks))
{
aa_abilities.clear();
aa_ranks.clear();
Log(Logs::General, Logs::Status, "Failed to load Alternate Advancement Data");
LogInfo("Failed to load Alternate Advancement Data");
return;
}
Log(Logs::General, Logs::Status, "Processing Alternate Advancement Data...");
LogInfo("Processing Alternate Advancement Data");
for(const auto &ability : aa_abilities) {
ability.second->first = GetAlternateAdvancementRank(ability.second->first_rank_id);
@@ -1623,13 +1623,13 @@ void Zone::LoadAlternateAdvancement() {
}
}
Log(Logs::General, Logs::Status, "Loaded Alternate Advancement Data");
LogInfo("Loaded Alternate Advancement Data");
}
bool ZoneDatabase::LoadAlternateAdvancementAbilities(std::unordered_map<int, std::unique_ptr<AA::Ability>> &abilities,
std::unordered_map<int, std::unique_ptr<AA::Rank>> &ranks)
{
Log(Logs::General, Logs::Status, "Loading Alternate Advancement Abilities...");
LogInfo("Loading Alternate Advancement Abilities");
abilities.clear();
std::string query = "SELECT id, name, category, classes, races, deities, drakkin_heritage, status, type, charges, "
"grant_only, first_rank_id FROM aa_ability WHERE enabled = 1";
@@ -1655,13 +1655,13 @@ bool ZoneDatabase::LoadAlternateAdvancementAbilities(std::unordered_map<int, std
abilities[ability->id] = std::unique_ptr<AA::Ability>(ability);
}
} else {
Log(Logs::General, Logs::Error, "Failed to load Alternate Advancement Abilities");
LogError("Failed to load Alternate Advancement Abilities");
return false;
}
Log(Logs::General, Logs::Status, "Loaded %d Alternate Advancement Abilities", (int)abilities.size());
LogInfo("Loaded [{}] Alternate Advancement Abilities", (int)abilities.size());
Log(Logs::General, Logs::Status, "Loading Alternate Advancement Ability Ranks...");
LogInfo("Loading Alternate Advancement Ability Ranks");
ranks.clear();
query = "SELECT id, upper_hotkey_sid, lower_hotkey_sid, title_sid, desc_sid, cost, level_req, spell, spell_type, recast_time, "
"next_id, expansion FROM aa_ranks";
@@ -1690,13 +1690,13 @@ bool ZoneDatabase::LoadAlternateAdvancementAbilities(std::unordered_map<int, std
ranks[rank->id] = std::unique_ptr<AA::Rank>(rank);
}
} else {
Log(Logs::General, Logs::Error, "Failed to load Alternate Advancement Ability Ranks");
LogError("Failed to load Alternate Advancement Ability Ranks");
return false;
}
Log(Logs::General, Logs::Status, "Loaded %d Alternate Advancement Ability Ranks", (int)ranks.size());
LogInfo("Loaded [{}] Alternate Advancement Ability Ranks", (int)ranks.size());
Log(Logs::General, Logs::Status, "Loading Alternate Advancement Ability Rank Effects...");
LogInfo("Loading Alternate Advancement Ability Rank Effects");
query = "SELECT rank_id, slot, effect_id, base1, base2 FROM aa_rank_effects";
results = QueryDatabase(query);
if(results.Success()) {
@@ -1717,13 +1717,13 @@ bool ZoneDatabase::LoadAlternateAdvancementAbilities(std::unordered_map<int, std
}
}
} else {
Log(Logs::General, Logs::Error, "Failed to load Alternate Advancement Ability Rank Effects");
LogError("Failed to load Alternate Advancement Ability Rank Effects");
return false;
}
Log(Logs::General, Logs::Status, "Loaded Alternate Advancement Ability Rank Effects");
LogInfo("Loaded Alternate Advancement Ability Rank Effects");
Log(Logs::General, Logs::Status, "Loading Alternate Advancement Ability Rank Prereqs...");
LogInfo("Loading Alternate Advancement Ability Rank Prereqs");
query = "SELECT rank_id, aa_id, points FROM aa_rank_prereqs";
results = QueryDatabase(query);
if(results.Success()) {
@@ -1742,11 +1742,11 @@ bool ZoneDatabase::LoadAlternateAdvancementAbilities(std::unordered_map<int, std
}
}
} else {
Log(Logs::General, Logs::Error, "Failed to load Alternate Advancement Ability Rank Prereqs");
LogError("Failed to load Alternate Advancement Ability Rank Prereqs");
return false;
}
Log(Logs::General, Logs::Status, "Loaded Alternate Advancement Ability Rank Prereqs");
LogInfo("Loaded Alternate Advancement Ability Rank Prereqs");
return true;
}
+14 -16
View File
@@ -294,9 +294,7 @@ bool Mob::CheckWillAggro(Mob *mob) {
// Don't aggro new clients if we are already engaged unless PROX_AGGRO is set
if (IsEngaged() && (!GetSpecialAbility(PROX_AGGRO) || (GetSpecialAbility(PROX_AGGRO) && !CombatRange(mob)))) {
Log(Logs::Moderate, Logs::Aggro,
"%s is in combat, and does not have prox_aggro, or does and is out of combat range with %s",
GetName(), mob->GetName());
LogAggro("[{}] is in combat, and does not have prox_aggro, or does and is out of combat range with [{}]", GetName(), mob->GetName());
return false;
}
@@ -356,7 +354,7 @@ bool Mob::CheckWillAggro(Mob *mob) {
{
//FatherNiwtit: make sure we can see them. last since it is very expensive
if(CheckLosFN(mob)) {
Log(Logs::Detail, Logs::Aggro, "Check aggro for %s target %s.", GetName(), mob->GetName());
LogAggro("Check aggro for [{}] target [{}]", GetName(), mob->GetName());
return( mod_will_aggro(mob, this) );
}
}
@@ -388,18 +386,18 @@ bool Mob::CheckWillAggro(Mob *mob) {
{
//FatherNiwtit: make sure we can see them. last since it is very expensive
if(CheckLosFN(mob)) {
Log(Logs::Detail, Logs::Aggro, "Check aggro for %s target %s.", GetName(), mob->GetName());
LogAggro("Check aggro for [{}] target [{}]", GetName(), mob->GetName());
return( mod_will_aggro(mob, this) );
}
}
}
Log(Logs::Detail, Logs::Aggro, "Is In zone?:%d\n", mob->InZone());
Log(Logs::Detail, Logs::Aggro, "Dist^2: %f\n", dist2);
Log(Logs::Detail, Logs::Aggro, "Range^2: %f\n", iAggroRange2);
Log(Logs::Detail, Logs::Aggro, "Faction: %d\n", fv);
Log(Logs::Detail, Logs::Aggro, "Int: %d\n", GetINT());
Log(Logs::Detail, Logs::Aggro, "Con: %d\n", GetLevelCon(mob->GetLevel()));
LogAggro("Is In zone?:[{}]\n", mob->InZone());
LogAggro("Dist^2: [{}]\n", dist2);
LogAggro("Range^2: [{}]\n", iAggroRange2);
LogAggro("Faction: [{}]\n", fv);
LogAggro("Int: [{}]\n", GetINT());
LogAggro("Con: [{}]\n", GetLevelCon(mob->GetLevel()));
return(false);
}
@@ -519,7 +517,7 @@ void EntityList::AIYellForHelp(Mob* sender, Mob* attacker) {
//Father Nitwit: make sure we can see them.
if(mob->CheckLosFN(sender)) {
#if (EQDEBUG>=5)
Log(Logs::General, Logs::None, "AIYellForHelp(\"%s\",\"%s\") %s attacking %s Dist %f Z %f",
LogDebug("AIYellForHelp(\"[{}]\",\"[{}]\") [{}] attacking [{}] Dist [{}] Z [{}]",
sender->GetName(), attacker->GetName(), mob->GetName(),
attacker->GetName(), DistanceSquared(mob->GetPosition(),
sender->GetPosition()), std::abs(sender->GetZ()+mob->GetZ()));
@@ -750,7 +748,7 @@ type', in which case, the answer is yes.
}
while( reverse++ == 0 );
Log(Logs::General, Logs::None, "Mob::IsAttackAllowed: don't have a rule for this - %s vs %s\n", this->GetName(), target->GetName());
LogDebug("Mob::IsAttackAllowed: don't have a rule for this - [{}] vs [{}]\n", this->GetName(), target->GetName());
return false;
}
@@ -890,7 +888,7 @@ bool Mob::IsBeneficialAllowed(Mob *target)
}
while( reverse++ == 0 );
Log(Logs::General, Logs::None, "Mob::IsBeneficialAllowed: don't have a rule for this - %s to %s\n", this->GetName(), target->GetName());
LogDebug("Mob::IsBeneficialAllowed: don't have a rule for this - [{}] to [{}]\n", this->GetName(), target->GetName());
return false;
}
@@ -1011,7 +1009,7 @@ bool Mob::CheckLosFN(float posX, float posY, float posZ, float mobSize) {
oloc.z = posZ + (mobSize==0.0?LOS_DEFAULT_HEIGHT:mobSize)/2 * SEE_POSITION;
#if LOSDEBUG>=5
Log(Logs::General, Logs::None, "LOS from (%.2f, %.2f, %.2f) to (%.2f, %.2f, %.2f) sizes: (%.2f, %.2f)", myloc.x, myloc.y, myloc.z, oloc.x, oloc.y, oloc.z, GetSize(), mobSize);
LogDebug("LOS from ([{}], [{}], [{}]) to ([{}], [{}], [{}]) sizes: ([{}], [{}])", myloc.x, myloc.y, myloc.z, oloc.x, oloc.y, oloc.z, GetSize(), mobSize);
#endif
return zone->zonemap->CheckLoS(myloc, oloc);
}
@@ -1033,7 +1031,7 @@ bool Mob::CheckLosFN(glm::vec3 posWatcher, float sizeWatcher, glm::vec3 posTarge
posTarget.z += (sizeTarget == 0.0f ? LOS_DEFAULT_HEIGHT : sizeTarget) / 2 * SEE_POSITION;
#if LOSDEBUG>=5
Log(Logs::General, Logs::None, "LOS from (%.2f, %.2f, %.2f) to (%.2f, %.2f, %.2f) sizes: (%.2f, %.2f) [static]", posWatcher.x, posWatcher.y, posWatcher.z, posTarget.x, posTarget.y, posTarget.z, sizeWatcher, sizeTarget);
LogDebug("LOS from ([{}], [{}], [{}]) to ([{}], [{}], [{}]) sizes: ([{}], [{}]) [static]", posWatcher.x, posWatcher.y, posWatcher.z, posTarget.x, posTarget.y, posTarget.z, sizeWatcher, sizeTarget);
#endif
return zone->zonemap->CheckLoS(posWatcher, posTarget);
}
+22 -5
View File
@@ -34,13 +34,25 @@
extern Zone *zone;
EQ::Net::WebsocketLoginStatus
CheckLogin(EQ::Net::WebsocketServerConnection *connection, const std::string &username, const std::string &password)
/**
* @param connection
* @param username
* @param password
* @return
*/
EQ::Net::WebsocketLoginStatus CheckLogin(
EQ::Net::WebsocketServerConnection *connection,
const std::string &username,
const std::string &password
)
{
EQ::Net::WebsocketLoginStatus ret;
ret.logged_in = false;
ret.account_id = database.CheckLogin(username.c_str(), password.c_str());
std::string prefix = "eqemu";
ret.account_id = database.CheckLogin(username.c_str(), password.c_str(), prefix.c_str());
if (ret.account_id == 0) {
return ret;
@@ -54,6 +66,11 @@ CheckLogin(EQ::Net::WebsocketServerConnection *connection, const std::string &us
return ret;
}
/**
* @param connection
* @param params
* @return
*/
Json::Value ApiGetPacketStatistics(EQ::Net::WebsocketServerConnection *connection, Json::Value params)
{
if (zone->GetZoneID() == 0) {
@@ -803,7 +820,7 @@ Json::Value ApiGetZoneAttributes(EQ::Net::WebsocketServerConnection *connection,
row["mobs_aggro_count"] = zone->MobsAggroCount();
row["save_zone_cfg"] = zone->SaveZoneCFG();
row["short_name"] = zone->GetShortName();
row["total_blocked_spells"] = zone->GetTotalBlockedSpells();
row["total_blocked_spells"] = zone->GetZoneTotalBlockedSpells();
row["zone_id"] = zone->GetZoneID();
row["zone_type"] = zone->GetZoneType();
@@ -847,7 +864,7 @@ Json::Value ApiSetLoggingLevel(EQ::Net::WebsocketServerConnection *connection, J
response["status"] = "Category doesn't exist";
Log(Logs::General, Logs::Status, "Logging category is %i and level is %i",
LogInfo("Logging category is [{}] and level is [{}]",
logging_category,
logging_level
);
+67 -94
View File
@@ -393,7 +393,7 @@ bool Mob::AvoidDamage(Mob *other, DamageHitInfo &hit)
if (hit.hand != EQEmu::invslot::slotRange && (CanThisClassRiposte() || IsEnraged()) && InFront && !ImmuneRipo) {
if (IsEnraged()) {
hit.damage_done = DMG_RIPOSTED;
Log(Logs::Detail, Logs::Combat, "I am enraged, riposting frontal attack.");
LogCombat("I am enraged, riposting frontal attack");
return true;
}
if (IsClient())
@@ -850,10 +850,10 @@ int Mob::ACSum()
auto over_cap = ac - softcap;
ac = softcap + (over_cap * returns);
}
Log(Logs::Detail, Logs::Combat, "ACSum ac %d softcap %d returns %f", ac, softcap, returns);
LogCombat("ACSum ac [{}] softcap [{}] returns [{}]", ac, softcap, returns);
}
else {
Log(Logs::Detail, Logs::Combat, "ACSum ac %d", ac);
LogCombat("ACSum ac [{}]", ac);
}
return ac;
}
@@ -1313,7 +1313,7 @@ void Mob::DoAttack(Mob *other, DamageHitInfo &hit, ExtraAttackOptions *opts)
{
if (!other)
return;
Log(Logs::Detail, Logs::Combat, "%s::DoAttack vs %s base %d min %d offense %d tohit %d skill %d", GetName(),
LogCombat("[{}]::DoAttack vs [{}] base [{}] min [{}] offense [{}] tohit [{}] skill [{}]", GetName(),
other->GetName(), hit.base_damage, hit.min_damage, hit.offense, hit.tohit, hit.skill);
// check to see if we hit..
@@ -1330,7 +1330,7 @@ void Mob::DoAttack(Mob *other, DamageHitInfo &hit, ExtraAttackOptions *opts)
//if (IsDead())
return;
}
Log(Logs::Detail, Logs::Combat, "Avoided/strikethrough damage with code %d", hit.damage_done);
LogCombat("Avoided/strikethrough damage with code [{}]", hit.damage_done);
}
if (hit.damage_done >= 0) {
@@ -1354,10 +1354,10 @@ void Mob::DoAttack(Mob *other, DamageHitInfo &hit, ExtraAttackOptions *opts)
ApplyDamageTable(hit);
CommonOutgoingHitSuccess(other, hit, opts);
}
Log(Logs::Detail, Logs::Combat, "Final damage after all reductions: %d", hit.damage_done);
LogCombat("Final damage after all reductions: [{}]", hit.damage_done);
}
else {
Log(Logs::Detail, Logs::Combat, "Attack missed. Damage set to 0.");
LogCombat("Attack missed. Damage set to 0");
hit.damage_done = 0;
}
}
@@ -1370,14 +1370,14 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b
{
if (!other) {
SetTarget(nullptr);
Log(Logs::General, Logs::Error, "A null Mob object was passed to Client::Attack() for evaluation!");
LogError("A null Mob object was passed to Client::Attack() for evaluation!");
return false;
}
if (!GetTarget())
SetTarget(other);
Log(Logs::Detail, Logs::Combat, "Attacking %s with hand %d %s", other ? other->GetName() : "(nullptr)", Hand, bRiposte ? "(this is a riposte)" : "");
LogCombat("Attacking [{}] with hand [{}] [{}]", other ? other->GetName() : "(nullptr)", Hand, bRiposte ? "(this is a riposte)" : "");
//SetAttackTimer();
if (
@@ -1387,13 +1387,13 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b
|| (GetHP() < 0)
|| (!IsAttackAllowed(other))
) {
Log(Logs::Detail, Logs::Combat, "Attack canceled, invalid circumstances.");
LogCombat("Attack cancelled, invalid circumstances");
return false; // Only bards can attack while casting
}
if (DivineAura() && !GetGM()) {//cant attack while invulnerable unless your a gm
Log(Logs::Detail, Logs::Combat, "Attack canceled, Divine Aura is in effect.");
MessageString(Chat::DefaultText, DIVINE_AURA_NO_ATK); //You can't attack while invulnerable!
LogCombat("Attack cancelled, Divine Aura is in effect");
MessageString(Chat::DefaultText, DIVINE_AURA_NO_ATK); //You can't attack while invulnerable
return false;
}
@@ -1412,20 +1412,20 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b
if (weapon != nullptr) {
if (!weapon->IsWeapon()) {
Log(Logs::Detail, Logs::Combat, "Attack canceled, Item %s (%d) is not a weapon.", weapon->GetItem()->Name, weapon->GetID());
LogCombat("Attack cancelled, Item [{}] ([{}]) is not a weapon", weapon->GetItem()->Name, weapon->GetID());
return(false);
}
Log(Logs::Detail, Logs::Combat, "Attacking with weapon: %s (%d)", weapon->GetItem()->Name, weapon->GetID());
LogCombat("Attacking with weapon: [{}] ([{}])", weapon->GetItem()->Name, weapon->GetID());
}
else {
Log(Logs::Detail, Logs::Combat, "Attacking without a weapon.");
LogCombat("Attacking without a weapon");
}
DamageHitInfo my_hit;
// calculate attack_skill and skillinuse depending on hand and weapon
// also send Packet to near clients
my_hit.skill = AttackAnimation(Hand, weapon);
Log(Logs::Detail, Logs::Combat, "Attacking with %s in slot %d using skill %d", weapon ? weapon->GetItem()->Name : "Fist", Hand, my_hit.skill);
LogCombat("Attacking with [{}] in slot [{}] using skill [{}]", weapon ? weapon->GetItem()->Name : "Fist", Hand, my_hit.skill);
// Now figure out damage
my_hit.damage_done = 1;
@@ -1493,7 +1493,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b
// damage = mod_client_damage(damage, skillinuse, Hand, weapon, other);
Log(Logs::Detail, Logs::Combat, "Damage calculated: base %d min damage %d skill %d", my_hit.base_damage, my_hit.min_damage, my_hit.skill);
LogCombat("Damage calculated: base [{}] min damage [{}] skill [{}]", my_hit.base_damage, my_hit.min_damage, my_hit.skill);
int hit_chance_bonus = 0;
my_hit.offense = offense(my_hit.skill); // we need this a few times
@@ -1629,7 +1629,7 @@ bool Client::Death(Mob* killerMob, int32 damage, uint16 spell, EQEmu::skills::Sk
}
int exploss = 0;
Log(Logs::Detail, Logs::Combat, "Fatal blow dealt by %s with %d damage, spell %d, skill %d", killerMob ? killerMob->GetName() : "Unknown", damage, spell, attack_skill);
LogCombat("Fatal blow dealt by [{}] with [{}] damage, spell [{}], skill [{}]", killerMob ? killerMob->GetName() : "Unknown", damage, spell, attack_skill);
/*
#1: Send death packet to everyone
@@ -1902,7 +1902,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool
{
if (!other) {
SetTarget(nullptr);
Log(Logs::General, Logs::Error, "A null Mob object was passed to NPC::Attack() for evaluation!");
LogError("A null Mob object was passed to NPC::Attack() for evaluation!");
return false;
}
@@ -1920,7 +1920,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool
if (other->IsClient())
other->CastToClient()->RemoveXTarget(this, false);
RemoveFromHateList(other);
Log(Logs::Detail, Logs::Combat, "I am not allowed to attack %s", other->GetName());
LogCombat("I am not allowed to attack [{}]", other->GetName());
}
return false;
}
@@ -1950,10 +1950,10 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool
//We dont factor much from the weapon into the attack.
//Just the skill type so it doesn't look silly using punching animations and stuff while wielding weapons
if (weapon) {
Log(Logs::Detail, Logs::Combat, "Attacking with weapon: %s (%d) (too bad im not using it for much)", weapon->Name, weapon->ID);
LogCombat("Attacking with weapon: [{}] ([{}]) (too bad im not using it for much)", weapon->Name, weapon->ID);
if (Hand == EQEmu::invslot::slotSecondary && weapon->ItemType == EQEmu::item::ItemTypeShield) {
Log(Logs::Detail, Logs::Combat, "Attack with shield canceled.");
if (Hand == EQEmu::invslot::slotSecondary && !weapon->IsType1HWeapon()) {
LogCombat("Attack with non-weapon cancelled");
return false;
}
@@ -2055,7 +2055,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool
other->AddToHateList(this, hate);
Log(Logs::Detail, Logs::Combat, "Final damage against %s: %d", other->GetName(), my_hit.damage_done);
LogCombat("Final damage against [{}]: [{}]", other->GetName(), my_hit.damage_done);
if (other->IsClient() && IsPet() && GetOwner()->IsClient()) {
//pets do half damage to clients in pvp
@@ -2112,7 +2112,7 @@ void NPC::Damage(Mob* other, int32 damage, uint16 spell_id, EQEmu::skills::Skill
//handle EVENT_ATTACK. Resets after we have not been attacked for 12 seconds
if (attacked_timer.Check())
{
Log(Logs::Detail, Logs::Combat, "Triggering EVENT_ATTACK due to attack by %s", other ? other->GetName() : "nullptr");
LogCombat("Triggering EVENT_ATTACK due to attack by [{}]", other ? other->GetName() : "nullptr");
parse->EventNPC(EVENT_ATTACK, this, other, "", 0);
}
attacked_timer.Start(CombatEventTimer_expire);
@@ -2150,7 +2150,7 @@ void NPC::Damage(Mob* other, int32 damage, uint16 spell_id, EQEmu::skills::Skill
bool NPC::Death(Mob* killer_mob, int32 damage, uint16 spell, EQEmu::skills::SkillType attack_skill)
{
Log(Logs::Detail, Logs::Combat, "Fatal blow dealt by %s with %d damage, spell %d, skill %d",
LogCombat("Fatal blow dealt by [{}] with [{}] damage, spell [{}], skill [{}]",
((killer_mob) ? (killer_mob->GetName()) : ("[nullptr]")), damage, spell, attack_skill);
Mob *oos = nullptr;
@@ -2798,7 +2798,7 @@ void Mob::DamageShield(Mob* attacker, bool spell_ds) {
if (DS == 0 && rev_ds == 0)
return;
Log(Logs::Detail, Logs::Combat, "Applying Damage Shield of value %d to %s", DS, attacker->GetName());
LogCombat("Applying Damage Shield of value [{}] to [{}]", DS, attacker->GetName());
//invert DS... spells yield negative values for a true damage shield
if (DS < 0) {
@@ -2844,7 +2844,7 @@ void Mob::DamageShield(Mob* attacker, bool spell_ds) {
rev_ds_spell_id = spellbonuses.ReverseDamageShieldSpellID;
if (rev_ds < 0) {
Log(Logs::Detail, Logs::Combat, "Applying Reverse Damage Shield of value %d to %s", rev_ds, attacker->GetName());
LogCombat("Applying Reverse Damage Shield of value [{}] to [{}]", rev_ds, attacker->GetName());
attacker->Damage(this, -rev_ds, rev_ds_spell_id, EQEmu::skills::SkillAbjuration/*hackish*/, false); //"this" (us) will get the hate, etc. not sure how this works on Live, but it'll works for now, and tanks will love us for this
//do we need to send a damage packet here also?
}
@@ -3054,16 +3054,14 @@ int32 Mob::ReduceDamage(int32 damage)
int damage_to_reduce = damage * spellbonuses.MeleeThresholdGuard[0] / 100;
if (damage_to_reduce >= buffs[slot].melee_rune)
{
Log(Logs::Detail, Logs::Spells, "Mob::ReduceDamage SE_MeleeThresholdGuard %d damage negated, %d"
" damage remaining, fading buff.", damage_to_reduce, buffs[slot].melee_rune);
LogSpells("Mob::ReduceDamage SE_MeleeThresholdGuard [{}] damage negated, [{}] damage remaining, fading buff", damage_to_reduce, buffs[slot].melee_rune);
damage -= buffs[slot].melee_rune;
if (!TryFadeEffect(slot))
BuffFadeBySlot(slot);
}
else
{
Log(Logs::Detail, Logs::Spells, "Mob::ReduceDamage SE_MeleeThresholdGuard %d damage negated, %d"
" damage remaining.", damage_to_reduce, buffs[slot].melee_rune);
LogSpells("Mob::ReduceDamage SE_MeleeThresholdGuard [{}] damage negated, [{}] damage remaining", damage_to_reduce, buffs[slot].melee_rune);
buffs[slot].melee_rune = (buffs[slot].melee_rune - damage_to_reduce);
damage -= damage_to_reduce;
}
@@ -3081,16 +3079,14 @@ int32 Mob::ReduceDamage(int32 damage)
if (spellbonuses.MitigateMeleeRune[3] && (damage_to_reduce >= buffs[slot].melee_rune))
{
Log(Logs::Detail, Logs::Spells, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d"
" damage remaining, fading buff.", damage_to_reduce, buffs[slot].melee_rune);
LogSpells("Mob::ReduceDamage SE_MitigateMeleeDamage [{}] damage negated, [{}] damage remaining, fading buff", damage_to_reduce, buffs[slot].melee_rune);
damage -= buffs[slot].melee_rune;
if (!TryFadeEffect(slot))
BuffFadeBySlot(slot);
}
else
{
Log(Logs::Detail, Logs::Spells, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d"
" damage remaining.", damage_to_reduce, buffs[slot].melee_rune);
LogSpells("Mob::ReduceDamage SE_MitigateMeleeDamage [{}] damage negated, [{}] damage remaining", damage_to_reduce, buffs[slot].melee_rune);
if (spellbonuses.MitigateMeleeRune[3])
buffs[slot].melee_rune = (buffs[slot].melee_rune - damage_to_reduce);
@@ -3207,16 +3203,14 @@ int32 Mob::AffectMagicalDamage(int32 damage, uint16 spell_id, const bool iBuffTi
if (spellbonuses.MitigateSpellRune[3] && (damage_to_reduce >= buffs[slot].magic_rune))
{
Log(Logs::Detail, Logs::Spells, "Mob::ReduceDamage SE_MitigateSpellDamage %d damage negated, %d"
" damage remaining, fading buff.", damage_to_reduce, buffs[slot].magic_rune);
LogSpells("Mob::ReduceDamage SE_MitigateSpellDamage [{}] damage negated, [{}] damage remaining, fading buff", damage_to_reduce, buffs[slot].magic_rune);
damage -= buffs[slot].magic_rune;
if (!TryFadeEffect(slot))
BuffFadeBySlot(slot);
}
else
{
Log(Logs::Detail, Logs::Spells, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d"
" damage remaining.", damage_to_reduce, buffs[slot].magic_rune);
LogSpells("Mob::ReduceDamage SE_MitigateMeleeDamage [{}] damage negated, [{}] damage remaining", damage_to_reduce, buffs[slot].magic_rune);
if (spellbonuses.MitigateSpellRune[3])
buffs[slot].magic_rune = (buffs[slot].magic_rune - damage_to_reduce);
@@ -3371,13 +3365,13 @@ void Mob::CommonDamage(Mob* attacker, int &damage, const uint16 spell_id, const
ignore_invul = spell_id == 982 || spells[spell_id].cast_not_standing; // cazic touch
if (!ignore_invul && (GetInvul() || DivineAura())) {
Log(Logs::Detail, Logs::Combat, "Avoiding %d damage due to invulnerability.", damage);
LogCombat("Avoiding [{}] damage due to invulnerability", damage);
damage = DMG_INVULNERABLE;
}
// this should actually happen MUCH sooner, need to investigate though -- good enough for now
if ((skill_used == EQEmu::skills::SkillArchery || skill_used == EQEmu::skills::SkillThrowing) && GetSpecialAbility(IMMUNE_RANGED_ATTACKS)) {
Log(Logs::Detail, Logs::Combat, "Avoiding %d damage due to IMMUNE_RANGED_ATTACKS.", damage);
LogCombat("Avoiding [{}] damage due to IMMUNE_RANGED_ATTACKS", damage);
damage = DMG_INVULNERABLE;
}
@@ -3421,7 +3415,7 @@ void Mob::CommonDamage(Mob* attacker, int &damage, const uint16 spell_id, const
int healed = damage;
healed = attacker->GetActSpellHealing(spell_id, healed);
Log(Logs::Detail, Logs::Combat, "Applying lifetap heal of %d to %s", healed, attacker->GetName());
LogCombat("Applying lifetap heal of [{}] to [{}]", healed, attacker->GetName());
attacker->HealDamage(healed);
//we used to do a message to the client, but its gone now.
@@ -3437,7 +3431,7 @@ void Mob::CommonDamage(Mob* attacker, int &damage, const uint16 spell_id, const
if (pet && !pet->IsFamiliar() && !pet->GetSpecialAbility(IMMUNE_AGGRO) && !pet->IsEngaged() && attacker && attacker != this && !attacker->IsCorpse() && !pet->IsGHeld() && !attacker->IsTrap())
{
if (!pet->IsHeld()) {
Log(Logs::Detail, Logs::Aggro, "Sending pet %s into battle due to attack.", pet->GetName());
LogAggro("Sending pet [{}] into battle due to attack", pet->GetName());
pet->AddToHateList(attacker, 1, 0, true, false, false, spell_id);
pet->SetTarget(attacker);
MessageString(Chat::NPCQuestSay, PET_ATTACKING, pet->GetCleanName(), attacker->GetCleanName());
@@ -3447,7 +3441,7 @@ void Mob::CommonDamage(Mob* attacker, int &damage, const uint16 spell_id, const
//see if any runes want to reduce this damage
if (spell_id == SPELL_UNKNOWN) {
damage = ReduceDamage(damage);
Log(Logs::Detail, Logs::Combat, "Melee Damage reduced to %d", damage);
LogCombat("Melee Damage reduced to [{}]", damage);
damage = ReduceAllDamage(damage);
TryTriggerThreshHold(damage, SE_TriggerMeleeThreshold, attacker);
@@ -3507,7 +3501,7 @@ void Mob::CommonDamage(Mob* attacker, int &damage, const uint16 spell_id, const
//fade mez if we are mezzed
if (IsMezzed() && attacker) {
Log(Logs::Detail, Logs::Combat, "Breaking mez due to attack.");
LogCombat("Breaking mez due to attack");
entity_list.MessageCloseString(
this, /* Sender */
true, /* Skip Sender */
@@ -3594,7 +3588,7 @@ void Mob::CommonDamage(Mob* attacker, int &damage, const uint16 spell_id, const
//increment chances of interrupting
if (IsCasting()) { //shouldnt interrupt on regular spell damage
attacked_count++;
Log(Logs::Detail, Logs::Combat, "Melee attack while casting. Attack count %d", attacked_count);
LogCombat("Melee attack while casting. Attack count [{}]", attacked_count);
}
}
@@ -3863,7 +3857,7 @@ float Mob::GetProcChances(float ProcBonus, uint16 hand)
ProcChance += ProcChance * ProcBonus / 100.0f;
}
Log(Logs::Detail, Logs::Combat, "Proc chance %.2f (%.2f from bonuses)", ProcChance, ProcBonus);
LogCombat("Proc chance [{}] ([{}] from bonuses)", ProcChance, ProcBonus);
return ProcChance;
}
@@ -3882,7 +3876,7 @@ float Mob::GetDefensiveProcChances(float &ProcBonus, float &ProcChance, uint16 h
ProcBonus += static_cast<float>(myagi) * RuleR(Combat, DefProcPerMinAgiContrib) / 100.0f;
ProcChance = ProcChance + (ProcChance * ProcBonus);
Log(Logs::Detail, Logs::Combat, "Defensive Proc chance %.2f (%.2f from bonuses)", ProcChance, ProcBonus);
LogCombat("Defensive Proc chance [{}] ([{}] from bonuses)", ProcChance, ProcBonus);
return ProcChance;
}
@@ -3891,7 +3885,7 @@ void Mob::TryDefensiveProc(Mob *on, uint16 hand) {
if (!on) {
SetTarget(nullptr);
Log(Logs::General, Logs::Error, "A null Mob object was passed to Mob::TryDefensiveProc for evaluation!");
LogError("A null Mob object was passed to Mob::TryDefensiveProc for evaluation!");
return;
}
@@ -3931,17 +3925,17 @@ void Mob::TryDefensiveProc(Mob *on, uint16 hand) {
void Mob::TryWeaponProc(const EQEmu::ItemInstance* weapon_g, Mob *on, uint16 hand) {
if (!on) {
SetTarget(nullptr);
Log(Logs::General, Logs::Error, "A null Mob object was passed to Mob::TryWeaponProc for evaluation!");
LogError("A null Mob object was passed to Mob::TryWeaponProc for evaluation!");
return;
}
if (!IsAttackAllowed(on)) {
Log(Logs::Detail, Logs::Combat, "Preventing procing off of unattackable things.");
LogCombat("Preventing procing off of unattackable things");
return;
}
if (DivineAura()) {
Log(Logs::Detail, Logs::Combat, "Procs canceled, Divine Aura is in effect.");
LogCombat("Procs cancelled, Divine Aura is in effect");
return;
}
@@ -3988,8 +3982,7 @@ void Mob::TryWeaponProc(const EQEmu::ItemInstance *inst, const EQEmu::ItemData *
static_cast<float>(weapon->ProcRate)) / 100.0f;
if (zone->random.Roll(WPC)) { // 255 dex = 0.084 chance of proc. No idea what this number should be really.
if (weapon->Proc.Level2 > ourlevel) {
Log(Logs::Detail, Logs::Combat,
"Tried to proc (%s), but our level (%d) is lower than required (%d)",
LogCombat("Tried to proc ([{}]), but our level ([{}]) is lower than required ([{}])",
weapon->Name, ourlevel, weapon->Proc.Level2);
if (IsPet()) {
Mob *own = GetOwner();
@@ -4001,9 +3994,7 @@ void Mob::TryWeaponProc(const EQEmu::ItemInstance *inst, const EQEmu::ItemData *
}
}
else {
Log(Logs::Detail, Logs::Combat,
"Attacking weapon (%s) successfully procing spell %d (%.2f percent chance)",
weapon->Name, weapon->Proc.Effect, WPC * 100);
LogCombat("Attacking weapon ([{}]) successfully procing spell [{}] ([{}] percent chance)", weapon->Name, weapon->Proc.Effect, WPC * 100);
ExecWeaponProc(inst, weapon->Proc.Effect, on);
proced = true;
}
@@ -4083,15 +4074,11 @@ void Mob::TrySpellProc(const EQEmu::ItemInstance *inst, const EQEmu::ItemData *w
// Perma procs (AAs)
if (PermaProcs[i].spellID != SPELL_UNKNOWN) {
if (zone->random.Roll(PermaProcs[i].chance)) { // TODO: Do these get spell bonus?
Log(Logs::Detail, Logs::Combat,
"Permanent proc %d procing spell %d (%d percent chance)",
i, PermaProcs[i].spellID, PermaProcs[i].chance);
LogCombat("Permanent proc [{}] procing spell [{}] ([{}] percent chance)", i, PermaProcs[i].spellID, PermaProcs[i].chance);
ExecWeaponProc(nullptr, PermaProcs[i].spellID, on);
}
else {
Log(Logs::Detail, Logs::Combat,
"Permanent proc %d failed to proc %d (%d percent chance)",
i, PermaProcs[i].spellID, PermaProcs[i].chance);
LogCombat("Permanent proc [{}] failed to proc [{}] ([{}] percent chance)", i, PermaProcs[i].spellID, PermaProcs[i].chance);
}
}
@@ -4099,18 +4086,14 @@ void Mob::TrySpellProc(const EQEmu::ItemInstance *inst, const EQEmu::ItemData *w
if (SpellProcs[i].spellID != SPELL_UNKNOWN) {
float chance = ProcChance * (static_cast<float>(SpellProcs[i].chance) / 100.0f);
if (zone->random.Roll(chance)) {
Log(Logs::Detail, Logs::Combat,
"Spell proc %d procing spell %d (%.2f percent chance)",
i, SpellProcs[i].spellID, chance);
LogCombat("Spell proc [{}] procing spell [{}] ([{}] percent chance)", i, SpellProcs[i].spellID, chance);
SendBeginCast(SpellProcs[i].spellID, 0);
ExecWeaponProc(nullptr, SpellProcs[i].spellID, on, SpellProcs[i].level_override);
CheckNumHitsRemaining(NumHit::OffensiveSpellProcs, 0,
SpellProcs[i].base_spellID);
}
else {
Log(Logs::Detail, Logs::Combat,
"Spell proc %d failed to proc %d (%.2f percent chance)",
i, SpellProcs[i].spellID, chance);
LogCombat("Spell proc [{}] failed to proc [{}] ([{}] percent chance)", i, SpellProcs[i].spellID, chance);
}
}
}
@@ -4119,17 +4102,13 @@ void Mob::TrySpellProc(const EQEmu::ItemInstance *inst, const EQEmu::ItemData *w
if (RangedProcs[i].spellID != SPELL_UNKNOWN) {
float chance = ProcChance * (static_cast<float>(RangedProcs[i].chance) / 100.0f);
if (zone->random.Roll(chance)) {
Log(Logs::Detail, Logs::Combat,
"Ranged proc %d procing spell %d (%.2f percent chance)",
i, RangedProcs[i].spellID, chance);
LogCombat("Ranged proc [{}] procing spell [{}] ([{}] percent chance)", i, RangedProcs[i].spellID, chance);
ExecWeaponProc(nullptr, RangedProcs[i].spellID, on);
CheckNumHitsRemaining(NumHit::OffensiveSpellProcs, 0,
RangedProcs[i].base_spellID);
}
else {
Log(Logs::Detail, Logs::Combat,
"Ranged proc %d failed to proc %d (%.2f percent chance)",
i, RangedProcs[i].spellID, chance);
LogCombat("Ranged proc [{}] failed to proc [{}] ([{}] percent chance)", i, RangedProcs[i].spellID, chance);
}
}
}
@@ -4324,9 +4303,7 @@ void Mob::TryCriticalHit(Mob *defender, DamageHitInfo &hit, ExtraAttackOptions *
}
hit.damage_done = hit.damage_done * crit_mod / 100;
Log(Logs::Detail, Logs::Combat,
"Crit success roll %d dex chance %d og dmg %d crit_mod %d new dmg %d", roll, dex_bonus,
og_damage, crit_mod, hit.damage_done);
LogCombat("Crit success roll [{}] dex chance [{}] og dmg [{}] crit_mod [{}] new dmg [{}]", roll, dex_bonus, og_damage, crit_mod, hit.damage_done);
// step 3: check deadly strike
if (GetClass() == ROGUE && hit.skill == EQEmu::skills::SkillThrowing) {
@@ -4367,7 +4344,7 @@ void Mob::TryCriticalHit(Mob *defender, DamageHitInfo &hit, ExtraAttackOptions *
if (IsBerserk() || berserk) {
hit.damage_done += og_damage * 119 / 100;
Log(Logs::Detail, Logs::Combat, "Crip damage %d", hit.damage_done);
LogCombat("Crip damage [{}]", hit.damage_done);
entity_list.FilteredMessageCloseString(
this, /* Sender */
@@ -4447,7 +4424,7 @@ bool Mob::TryFinishingBlow(Mob *defender, int &damage)
void Mob::DoRiposte(Mob *defender)
{
Log(Logs::Detail, Logs::Combat, "Preforming a riposte");
LogCombat("Preforming a riposte");
if (!defender)
return;
@@ -4467,8 +4444,7 @@ void Mob::DoRiposte(Mob *defender)
defender->itembonuses.DoubleRiposte;
if (DoubleRipChance && zone->random.Roll(DoubleRipChance)) {
Log(Logs::Detail, Logs::Combat,
"Preforming a double riposted from SE_DoubleRiposte (%d percent chance)", DoubleRipChance);
LogCombat("Preforming a double riposted from SE_DoubleRiposte ([{}] percent chance)", DoubleRipChance);
defender->Attack(this, EQEmu::invslot::slotPrimary, true);
if (HasDied())
return;
@@ -4479,9 +4455,7 @@ void Mob::DoRiposte(Mob *defender)
// Live AA - Double Riposte
if (DoubleRipChance && zone->random.Roll(DoubleRipChance)) {
Log(Logs::Detail, Logs::Combat,
"Preforming a double riposted from SE_GiveDoubleRiposte base1 == 0 (%d percent chance)",
DoubleRipChance);
LogCombat("Preforming a double riposted from SE_GiveDoubleRiposte base1 == 0 ([{}] percent chance)", DoubleRipChance);
defender->Attack(this, EQEmu::invslot::slotPrimary, true);
if (HasDied())
return;
@@ -4493,8 +4467,7 @@ void Mob::DoRiposte(Mob *defender)
DoubleRipChance = defender->aabonuses.GiveDoubleRiposte[1];
if (DoubleRipChance && zone->random.Roll(DoubleRipChance)) {
Log(Logs::Detail, Logs::Combat, "Preforming a return SPECIAL ATTACK (%d percent chance)",
DoubleRipChance);
LogCombat("Preforming a return SPECIAL ATTACK ([{}] percent chance)", DoubleRipChance);
if (defender->GetClass() == MONK)
defender->MonkSpecialAttack(this, defender->aabonuses.GiveDoubleRiposte[2]);
@@ -4717,7 +4690,7 @@ void Mob::TrySkillProc(Mob *on, uint16 skill, uint16 ReuseTime, bool Success, ui
if (!on) {
SetTarget(nullptr);
Log(Logs::General, Logs::Error, "A null Mob object was passed to Mob::TrySkillProc for evaluation!");
LogError("A null Mob object was passed to Mob::TrySkillProc for evaluation!");
return;
}
@@ -4948,13 +4921,13 @@ bool Mob::TryRootFadeByDamage(int buffslot, Mob* attacker) {
if (!TryFadeEffect(spellbonuses.Root[1])) {
BuffFadeBySlot(spellbonuses.Root[1]);
Log(Logs::Detail, Logs::Combat, "Spell broke root! BreakChance percent chance");
LogCombat("Spell broke root! BreakChance percent chance");
return true;
}
}
}
Log(Logs::Detail, Logs::Combat, "Spell did not break root. BreakChance percent chance");
LogCombat("Spell did not break root. BreakChance percent chance");
return false;
}
@@ -5130,19 +5103,19 @@ void Mob::CommonBreakInvisibleFromCombat()
{
//break invis when you attack
if (invisible) {
Log(Logs::Detail, Logs::Combat, "Removing invisibility due to melee attack.");
LogCombat("Removing invisibility due to melee attack");
BuffFadeByEffect(SE_Invisibility);
BuffFadeByEffect(SE_Invisibility2);
invisible = false;
}
if (invisible_undead) {
Log(Logs::Detail, Logs::Combat, "Removing invisibility vs. undead due to melee attack.");
LogCombat("Removing invisibility vs. undead due to melee attack");
BuffFadeByEffect(SE_InvisVsUndead);
BuffFadeByEffect(SE_InvisVsUndead2);
invisible_undead = false;
}
if (invisible_animals) {
Log(Logs::Detail, Logs::Combat, "Removing invisibility vs. animals due to melee attack.");
LogCombat("Removing invisibility vs. animals due to melee attack");
BuffFadeByEffect(SE_InvisVsAnimals);
invisible_animals = false;
}
+3 -5
View File
@@ -711,13 +711,13 @@ void Mob::MakeAura(uint16 spell_id)
AuraRecord record;
if (!database.GetAuraEntry(spell_id, record)) {
Message(Chat::Red, "Unable to find data for aura %s", spells[spell_id].name);
Log(Logs::General, Logs::Error, "Unable to find data for aura %d, check auras table.", spell_id);
LogError("Unable to find data for aura [{}], check auras table", spell_id);
return;
}
if (!IsValidSpell(record.spell_id)) {
Message(Chat::Red, "Casted spell (%d) is not valid for aura %s", record.spell_id, spells[spell_id].name);
Log(Logs::General, Logs::Error, "Casted spell (%d) is not valid for aura %d, check auras table.",
LogError("Casted spell ([{}]) is not valid for aura [{}], check auras table",
record.spell_id, spell_id);
return;
}
@@ -745,9 +745,7 @@ void Mob::MakeAura(uint16 spell_id)
const auto base = database.LoadNPCTypesData(record.npc_type);
if (base == nullptr) {
Message(Chat::Red, "Unable to load NPC data for aura %s", spells[spell_id].teleport_zone);
Log(Logs::General, Logs::Error,
"Unable to load NPC data for aura %s (NPC ID %d), check auras and npc_types tables.",
spells[spell_id].teleport_zone, record.npc_type);
LogError("Unable to load NPC data for aura [{}] (NPC ID [{}]), check auras and npc_types tables", spells[spell_id].teleport_zone, record.npc_type);
return;
}
+19 -5
View File
@@ -663,7 +663,7 @@ void Mob::ApplyAABonuses(const AA::Rank &rank, StatBonuses *newbon)
effect == SE_StackingCommand_Overwrite)
continue;
Log(Logs::Detail, Logs::AA, "Applying Effect %d from AA %u in slot %d (base1: %d, base2: %d) on %s",
LogAA("Applying Effect [{}] from AA [{}] in slot [{}] (base1: [{}], base2: [{}]) on [{}]",
effect, rank.id, slot, base1, base2, GetCleanName());
uint8 focus = IsFocusEffect(0, 0, true, effect);
@@ -1205,8 +1205,12 @@ void Mob::ApplyAABonuses(const AA::Rank &rank, StatBonuses *newbon)
break;
}
case SE_CastingLevel2:
case SE_CastingLevel: {
newbon->adjusted_casting_skill += base1;
break;
}
case SE_CastingLevel2: {
newbon->effective_casting_level += base1;
break;
}
@@ -1533,7 +1537,7 @@ void Mob::ApplyAABonuses(const AA::Rank &rank, StatBonuses *newbon)
break;
default:
Log(Logs::Detail, Logs::AA, "SPA %d not accounted for in AA %s (%d)", effect, rank.base_ability->name.c_str(), rank.id);
LogAA("SPA [{}] not accounted for in AA [{}] ([{}])", effect, rank.base_ability->name.c_str(), rank.id);
break;
}
@@ -1914,8 +1918,13 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses *ne
break;
}
case SE_CastingLevel2:
case SE_CastingLevel: // Brilliance of Ro
{
new_bonus->adjusted_casting_skill += effect_value;
break;
}
case SE_CastingLevel2:
{
new_bonus->effective_casting_level += effect_value;
break;
@@ -3850,8 +3859,13 @@ void Mob::NegateSpellsBonuses(uint16 spell_id)
aabonuses.Corrup = effect_value;
break;
case SE_CastingLevel2:
case SE_CastingLevel: // Brilliance of Ro
spellbonuses.adjusted_casting_skill = effect_value;
aabonuses.adjusted_casting_skill = effect_value;
itembonuses.adjusted_casting_skill = effect_value;
break;
case SE_CastingLevel2:
spellbonuses.effective_casting_level = effect_value;
aabonuses.effective_casting_level = effect_value;
itembonuses.effective_casting_level = effect_value;
+60 -45
View File
@@ -255,6 +255,18 @@ void Bot::SetBotSpellID(uint32 newSpellID) {
this->npc_spells_id = newSpellID;
}
void Bot::SetSurname(std::string bot_surname) {
_surname = bot_surname.substr(0, 31);
}
void Bot::SetTitle(std::string bot_title) {
_title = bot_title.substr(0, 31);
}
void Bot::SetSuffix(std::string bot_suffix) {
_suffix = bot_suffix.substr(0, 31);
}
uint32 Bot::GetBotArcheryRange() {
const EQEmu::ItemInstance *range_inst = GetBotItem(EQEmu::invslot::slotRange);
const EQEmu::ItemInstance *ammo_inst = GetBotItem(EQEmu::invslot::slotAmmo);
@@ -1312,7 +1324,7 @@ int32 Bot::acmod() {
else
return (65 + ((agility - 300) / 21));
#if EQDEBUG >= 11
Log(Logs::General, Logs::Error, "Error in Bot::acmod(): Agility: %i, Level: %i",agility,level);
LogError("Error in Bot::acmod(): Agility: [{}], Level: [{}]",agility,level);
#endif
return 0;
}
@@ -2069,7 +2081,7 @@ void Bot::BotRangedAttack(Mob* other) {
//make sure the attack and ranged timers are up
//if the ranged timer is disabled, then they have no ranged weapon and shouldent be attacking anyhow
if((attack_timer.Enabled() && !attack_timer.Check(false)) || (ranged_timer.Enabled() && !ranged_timer.Check())) {
Log(Logs::Detail, Logs::Combat, "Bot Archery attack canceled. Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime());
LogCombat("Bot Archery attack canceled. Timer not up. Attack [{}], ranged [{}]", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime());
Message(0, "Error: Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime());
return;
}
@@ -2087,7 +2099,7 @@ void Bot::BotRangedAttack(Mob* other) {
if(!RangeWeapon || !Ammo)
return;
Log(Logs::Detail, Logs::Combat, "Shooting %s with bow %s (%d) and arrow %s (%d)", other->GetCleanName(), RangeWeapon->Name, RangeWeapon->ID, Ammo->Name, Ammo->ID);
LogCombat("Shooting [{}] with bow [{}] ([{}]) and arrow [{}] ([{}])", other->GetCleanName(), RangeWeapon->Name, RangeWeapon->ID, Ammo->Name, Ammo->ID);
if(!IsAttackAllowed(other) || IsCasting() || DivineAura() || IsStunned() || IsMezzed() || (GetAppearance() == eaDead))
return;
@@ -2097,21 +2109,21 @@ void Bot::BotRangedAttack(Mob* other) {
//break invis when you attack
if(invisible) {
Log(Logs::Detail, Logs::Combat, "Removing invisibility due to melee attack.");
LogCombat("Removing invisibility due to melee attack");
BuffFadeByEffect(SE_Invisibility);
BuffFadeByEffect(SE_Invisibility2);
invisible = false;
}
if(invisible_undead) {
Log(Logs::Detail, Logs::Combat, "Removing invisibility vs. undead due to melee attack.");
LogCombat("Removing invisibility vs. undead due to melee attack");
BuffFadeByEffect(SE_InvisVsUndead);
BuffFadeByEffect(SE_InvisVsUndead2);
invisible_undead = false;
}
if(invisible_animals) {
Log(Logs::Detail, Logs::Combat, "Removing invisibility vs. animals due to melee attack.");
LogCombat("Removing invisibility vs. animals due to melee attack");
BuffFadeByEffect(SE_InvisVsAnimals);
invisible_animals = false;
}
@@ -2351,7 +2363,7 @@ void Bot::AI_Process() {
Mob* delete_me = HealRotationTarget();
if (AIHealRotation(HealRotationTarget(), UseHealRotationFastHeals())) {
#if (EQDEBUG >= 12)
Log(Logs::General, Logs::Error, "Bot::AI_Process() - Casting succeeded (m: %s, t: %s) : AdvHR(true)", GetCleanName(), ((delete_me) ? (delete_me->GetCleanName()) : ("nullptr")));
LogError("Bot::AI_Process() - Casting succeeded (m: [{}], t: [{}]) : AdvHR(true)", GetCleanName(), ((delete_me) ? (delete_me->GetCleanName()) : ("nullptr")));
#endif
m_member_of_heal_rotation->SetMemberIsCasting(this);
m_member_of_heal_rotation->UpdateTargetHealingStats(HealRotationTarget());
@@ -2359,7 +2371,7 @@ void Bot::AI_Process() {
}
else {
#if (EQDEBUG >= 12)
Log(Logs::General, Logs::Error, "Bot::AI_Process() - Casting failed (m: %s, t: %s) : AdvHR(false)", GetCleanName(), ((delete_me) ? (delete_me->GetCleanName()) : ("nullptr")));
LogError("Bot::AI_Process() - Casting failed (m: [{}], t: [{}]) : AdvHR(false)", GetCleanName(), ((delete_me) ? (delete_me->GetCleanName()) : ("nullptr")));
#endif
m_member_of_heal_rotation->SetMemberIsCasting(this, false);
AdvanceHealRotation(false);
@@ -2872,7 +2884,7 @@ void Bot::AI_Process() {
else { // To far away to fight (GetTarget() validity can be iffy below this point - including outer scopes)
if (AI_movement_timer->Check() && (!spellend_timer.Enabled() || GetClass() == BARD)) { // Pursue processing
if (GetTarget() && !IsRooted()) {
Log(Logs::Detail, Logs::AI, "Pursuing %s while engaged.", GetTarget()->GetCleanName());
LogAI("Pursuing [{}] while engaged", GetTarget()->GetCleanName());
Goal = GetTarget()->GetPosition();
@@ -3177,7 +3189,7 @@ void Bot::PetAIProcess() {
else if (botPet->GetTarget() && botPet->GetAIMovementTimer()->Check()) {
botPet->SetRunAnimSpeed(0);
if(!botPet->IsRooted()) {
Log(Logs::Detail, Logs::AI, "Pursuing %s while engaged.", botPet->GetTarget()->GetCleanName());
LogAI("Pursuing [{}] while engaged", botPet->GetTarget()->GetCleanName());
botPet->RunTo(botPet->GetTarget()->GetX(), botPet->GetTarget()->GetY(), botPet->GetTarget()->GetZ());
return;
} else {
@@ -3260,7 +3272,7 @@ bool Bot::Spawn(Client* botCharacterOwner) {
else
this->GetBotOwner()->CastToClient()->Message(Chat::Red, "%s save failed!", this->GetCleanName());
// Spawn the bot at the bow owner's loc
// Spawn the bot at the bot owner's loc
this->m_Position.x = botCharacterOwner->GetX();
this->m_Position.y = botCharacterOwner->GetY();
this->m_Position.z = botCharacterOwner->GetZ();
@@ -3365,6 +3377,9 @@ void Bot::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) {
ns->spawn.helm = helmtexture; //(GetShowHelm() ? helmtexture : 0); //0xFF;
ns->spawn.equip_chest2 = texture; //0xFF;
ns->spawn.show_name = true;
strcpy(ns->spawn.lastName, GetSurname().c_str());
strcpy(ns->spawn.title, GetTitle().c_str());
strcpy(ns->spawn.suffix, GetSuffix().c_str());
const EQEmu::ItemData* item = nullptr;
const EQEmu::ItemInstance* inst = nullptr;
uint32 spawnedbotid = 0;
@@ -3499,7 +3514,7 @@ void Bot::LevelBotWithClient(Client* client, uint8 level, bool sendlvlapp) {
Bot* bot = *biter;
if(bot && (bot->GetLevel() != client->GetLevel())) {
bot->SetPetChooser(false); // not sure what this does, but was in bot 'update' code
bot->CalcBotStats(client->GetBotOptionStatsUpdate());
bot->CalcBotStats(client->GetBotOption(Client::booStatsUpdate));
if(sendlvlapp)
bot->SendLevelAppearance();
// modified from Client::SetLevel()
@@ -4178,7 +4193,7 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli
client->Message(Chat::Lime, "Trade with '%s' resulted in %i accepted item%s, %i returned item%s.", GetCleanName(), accepted_count, ((accepted_count == 1) ? "" : "s"), returned_count, ((returned_count == 1) ? "" : "s"));
if (accepted_count)
CalcBotStats(client->GetBotOptionStatsUpdate());
CalcBotStats(client->GetBotOption(Client::booStatsUpdate));
}
bool Bot::Death(Mob *killerMob, int32 damage, uint16 spell_id, EQEmu::skills::SkillType attack_skill) {
@@ -4188,7 +4203,7 @@ bool Bot::Death(Mob *killerMob, int32 damage, uint16 spell_id, EQEmu::skills::Sk
Save();
Mob *my_owner = GetBotOwner();
if (my_owner && my_owner->IsClient() && my_owner->CastToClient()->GetBotOptionDeathMarquee()) {
if (my_owner && my_owner->IsClient() && my_owner->CastToClient()->GetBotOption(Client::booDeathMarquee)) {
if (killerMob)
my_owner->CastToClient()->SendMarqueeMessage(Chat::Yellow, 510, 0, 1000, 3000, StringFormat("%s has been slain by %s", GetCleanName(), killerMob->GetCleanName()));
else
@@ -4271,7 +4286,7 @@ void Bot::Damage(Mob *from, int32 damage, uint16 spell_id, EQEmu::skills::SkillT
//handle EVENT_ATTACK. Resets after we have not been attacked for 12 seconds
if(attacked_timer.Check()) {
Log(Logs::Detail, Logs::Combat, "Triggering EVENT_ATTACK due to attack by %s", from->GetName());
LogCombat("Triggering EVENT_ATTACK due to attack by [{}]", from->GetName());
parse->EventNPC(EVENT_ATTACK, this, from, "", 0);
}
@@ -4279,7 +4294,7 @@ void Bot::Damage(Mob *from, int32 damage, uint16 spell_id, EQEmu::skills::SkillT
// if spell is lifetap add hp to the caster
if (spell_id != SPELL_UNKNOWN && IsLifetapSpell(spell_id)) {
int healed = GetActSpellHealing(spell_id, damage);
Log(Logs::Detail, Logs::Combat, "Applying lifetap heal of %d to %s", healed, GetCleanName());
LogCombat("Applying lifetap heal of [{}] to [{}]", healed, GetCleanName());
HealDamage(healed);
entity_list.MessageClose(this, true, 300, Chat::Spells, "%s beams a smile at %s", GetCleanName(), from->GetCleanName() );
}
@@ -4315,13 +4330,13 @@ void Bot::AddToHateList(Mob* other, uint32 hate, int32 damage, bool iYellForHelp
bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, bool IsFromSpell, ExtraAttackOptions *opts) {
if (!other) {
SetTarget(nullptr);
Log(Logs::General, Logs::Error, "A null Mob object was passed to Bot::Attack for evaluation!");
LogError("A null Mob object was passed to Bot::Attack for evaluation!");
return false;
}
if ((GetHP() <= 0) || (GetAppearance() == eaDead)) {
SetTarget(nullptr);
Log(Logs::Detail, Logs::Combat, "Attempted to attack %s while unconscious or, otherwise, appearing dead", other->GetCleanName());
LogCombat("Attempted to attack [{}] while unconscious or, otherwise, appearing dead", other->GetCleanName());
return false;
}
@@ -4333,20 +4348,20 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b
// 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.
Log(Logs::Detail, Logs::Combat, "Attacking %s with hand %d %s", 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(this->GetOwnerID())
entity_list.MessageClose(this, 1, 200, 10, "%s says, '%s is not a legal target master.'", this->GetCleanName(), this->GetTarget()->GetCleanName());
if(other) {
RemoveFromHateList(other);
Log(Logs::Detail, Logs::Combat, "I am not allowed to attack %s", other->GetCleanName());
LogCombat("I am not allowed to attack [{}]", other->GetCleanName());
}
return false;
}
if(DivineAura()) {//cant attack while invulnerable
Log(Logs::Detail, Logs::Combat, "Attack canceled, Divine Aura is in effect.");
LogCombat("Attack canceled, Divine Aura is in effect");
return false;
}
@@ -4364,19 +4379,19 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b
if(weapon != nullptr) {
if (!weapon->IsWeapon()) {
Log(Logs::Detail, Logs::Combat, "Attack canceled, Item %s (%d) is not a weapon.", weapon->GetItem()->Name, weapon->GetID());
LogCombat("Attack canceled, Item [{}] ([{}]) is not a weapon", weapon->GetItem()->Name, weapon->GetID());
return false;
}
Log(Logs::Detail, Logs::Combat, "Attacking with weapon: %s (%d)", weapon->GetItem()->Name, weapon->GetID());
LogCombat("Attacking with weapon: [{}] ([{}])", weapon->GetItem()->Name, weapon->GetID());
}
else
Log(Logs::Detail, Logs::Combat, "Attacking without a weapon.");
LogCombat("Attacking without a weapon");
// calculate attack_skill and skillinuse depending on hand and weapon
// also send Packet to near clients
DamageHitInfo my_hit;
my_hit.skill = AttackAnimation(Hand, weapon);
Log(Logs::Detail, Logs::Combat, "Attacking with %s in slot %d using skill %d", weapon?weapon->GetItem()->Name:"Fist", Hand, my_hit.skill);
LogCombat("Attacking with [{}] in slot [{}] using skill [{}]", weapon?weapon->GetItem()->Name:"Fist", Hand, my_hit.skill);
// Now figure out damage
my_hit.damage_done = 1;
@@ -4424,7 +4439,7 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b
}
}
Log(Logs::Detail, Logs::Combat, "Damage calculated: base %d min damage %d skill %d", my_hit.base_damage, my_hit.min_damage, my_hit.skill);
LogCombat("Damage calculated: base [{}] min damage [{}] skill [{}]", my_hit.base_damage, my_hit.min_damage, my_hit.skill);
int hit_chance_bonus = 0;
my_hit.offense = offense(my_hit.skill);
@@ -4442,7 +4457,7 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b
DoAttack(other, my_hit, opts);
Log(Logs::Detail, Logs::Combat, "Final damage after all reductions: %d", my_hit.damage_done);
LogCombat("Final damage after all reductions: [{}]", my_hit.damage_done);
} else {
my_hit.damage_done = DMG_INVULNERABLE;
}
@@ -5054,7 +5069,7 @@ int32 Bot::CalcBotFocusEffect(BotfocusType bottype, uint16 focus_id, uint16 spel
return 0;
break;
default:
Log(Logs::General, Logs::Normal, "CalcFocusEffect: unknown limit spelltype %d", focus_spell.base[i]);
LogInfo("CalcFocusEffect: unknown limit spelltype [{}]", focus_spell.base[i]);
}
break;
@@ -5268,7 +5283,7 @@ int32 Bot::CalcBotFocusEffect(BotfocusType bottype, uint16 focus_id, uint16 spel
break;
}
default:
Log(Logs::General, Logs::Spells, "CalcFocusEffect: unknown effectid %d", focus_spell.effectid[i]);
LogSpells("CalcFocusEffect: unknown effectid [{}]", focus_spell.effectid[i]);
break;
}
}
@@ -5308,7 +5323,7 @@ float Bot::GetProcChances(float ProcBonus, uint16 hand) {
ProcChance += (ProcChance * ProcBonus / 100.0f);
}
Log(Logs::Detail, Logs::Combat, "Proc chance %.2f (%.2f from bonuses)", ProcChance, ProcBonus);
LogCombat("Proc chance [{}] ([{}] from bonuses)", ProcChance, ProcBonus);
return ProcChance;
}
@@ -5362,13 +5377,13 @@ bool Bot::TryFinishingBlow(Mob *defender, int &damage)
int fb_damage = aabonuses.FinishingBlow[1];
int levelreq = aabonuses.FinishingBlowLvl[0];
if (defender->GetLevel() <= levelreq && (chance >= zone->random.Int(1, 1000))) {
Log(Logs::Detail, Logs::Combat, "Landed a finishing blow: levelreq at %d, other level %d",
LogCombat("Landed a finishing blow: levelreq at [{}], other level [{}]",
levelreq, defender->GetLevel());
entity_list.MessageCloseString(this, false, 200, Chat::MeleeCrit, FINISHING_BLOW, GetName());
damage = fb_damage;
return true;
} else {
Log(Logs::Detail, Logs::Combat, "FAILED a finishing blow: levelreq at %d, other level %d",
LogCombat("failed a finishing blow: levelreq at [{}], other level [{}]",
levelreq, defender->GetLevel());
return false;
}
@@ -5377,14 +5392,14 @@ bool Bot::TryFinishingBlow(Mob *defender, int &damage)
}
void Bot::DoRiposte(Mob* defender) {
Log(Logs::Detail, Logs::Combat, "Preforming a riposte");
LogCombat("Preforming a riposte");
if (!defender)
return;
defender->Attack(this, EQEmu::invslot::slotPrimary, true);
int32 DoubleRipChance = (defender->GetAABonuses().GiveDoubleRiposte[0] + defender->GetSpellBonuses().GiveDoubleRiposte[0] + defender->GetItemBonuses().GiveDoubleRiposte[0]);
if(DoubleRipChance && (DoubleRipChance >= zone->random.Int(0, 100))) {
Log(Logs::Detail, Logs::Combat, "Preforming a double riposte (%d percent chance)", DoubleRipChance);
LogCombat("Preforming a double riposte ([{}] percent chance)", DoubleRipChance);
defender->Attack(this, EQEmu::invslot::slotPrimary, true);
}
@@ -6007,7 +6022,7 @@ int32 Bot::CalcMaxMana() {
break;
}
default: {
Log(Logs::General, Logs::None, "Invalid Class '%c' in CalcMaxMana", GetCasterClass());
LogDebug("Invalid Class [{}] in CalcMaxMana", GetCasterClass());
max_mana = 0;
break;
}
@@ -6435,14 +6450,14 @@ bool Bot::CastSpell(uint16 spell_id, uint16 target_id, EQEmu::spells::CastingSlo
uint32* oSpellWillFinish, uint32 item_slot, int16 *resist_adjust, uint32 aa_id) {
bool Result = false;
if(zone && !zone->IsSpellBlocked(spell_id, glm::vec3(GetPosition()))) {
Log(Logs::Detail, Logs::Spells, "CastSpell called for spell %s (%d) on entity %d, slot %d, time %d, mana %d, from item slot %d", spells[spell_id].name, spell_id, target_id, slot, cast_time, mana_cost, (item_slot==0xFFFFFFFF)?999:item_slot);
// LogSpells("CastSpell called for spell [{}] ([{}]) on entity [{}], slot [{}], time [{}], mana [{}], from item slot [{}]", spells[spell_id].name, spell_id, target_id, slot, cast_time, mana_cost, (item_slot==0xFFFFFFFF)?999:item_slot);
if(casting_spell_id == spell_id)
ZeroCastingVars();
if(GetClass() != BARD) {
if(!IsValidSpell(spell_id) || casting_spell_id || delaytimer || spellend_timer.Enabled() || IsStunned() || IsFeared() || IsMezzed() || (IsSilenced() && !IsDiscipline(spell_id)) || (IsAmnesiad() && IsDiscipline(spell_id))) {
Log(Logs::Detail, Logs::Spells, "Spell casting canceled: not able to cast now. Valid? %d, casting %d, waiting? %d, spellend? %d, stunned? %d, feared? %d, mezed? %d, silenced? %d", IsValidSpell(spell_id), casting_spell_id, delaytimer, spellend_timer.Enabled(), IsStunned(), IsFeared(), IsMezzed(), IsSilenced() );
LogSpells("Spell casting canceled: not able to cast now. Valid? [{}], casting [{}], waiting? [{}], spellend? [{}], stunned? [{}], feared? [{}], mezed? [{}], silenced? [{}]", IsValidSpell(spell_id), casting_spell_id, delaytimer, spellend_timer.Enabled(), IsStunned(), IsFeared(), IsMezzed(), IsSilenced() );
if(IsSilenced() && !IsDiscipline(spell_id))
MessageString(Chat::Red, SILENCED_STRING);
@@ -6466,7 +6481,7 @@ bool Bot::CastSpell(uint16 spell_id, uint16 target_id, EQEmu::spells::CastingSlo
}
if(DivineAura()) {
Log(Logs::Detail, Logs::Spells, "Spell casting canceled: cannot cast while Divine Aura is in effect.");
LogSpells("Spell casting canceled: cannot cast while Divine Aura is in effect");
InterruptSpell(173, 0x121, false);
return false;
}
@@ -6476,13 +6491,13 @@ bool Bot::CastSpell(uint16 spell_id, uint16 target_id, EQEmu::spells::CastingSlo
InterruptSpell(fizzle_msg, 0x121, spell_id);
uint32 use_mana = ((spells[spell_id].mana) / 4);
Log(Logs::Detail, Logs::Spells, "Spell casting canceled: fizzled. %d mana has been consumed", use_mana);
LogSpells("Spell casting canceled: fizzled. [{}] mana has been consumed", use_mana);
SetMana(GetMana() - use_mana);
return false;
}
if (HasActiveSong()) {
Log(Logs::Detail, Logs::Spells, "Casting a new spell/song while singing a song. Killing old song %d.", bardsong);
LogSpells("Casting a new spell/song while singing a song. Killing old song [{}]", bardsong);
bardsong = 0;
bardsong_target_id = 0;
bardsong_slot = EQEmu::spells::CastingSlot::Gem1;
@@ -6596,19 +6611,19 @@ bool Bot::IsImmuneToSpell(uint16 spell_id, Mob *caster) {
if(caster->IsBot()) {
if(spells[spell_id].targettype == ST_Undead) {
if((GetBodyType() != BT_SummonedUndead) && (GetBodyType() != BT_Undead) && (GetBodyType() != BT_Vampire)) {
Log(Logs::Detail, Logs::Spells, "Bot's target is not an undead.");
LogSpells("Bot's target is not an undead");
return true;
}
}
if(spells[spell_id].targettype == ST_Summoned) {
if((GetBodyType() != BT_SummonedUndead) && (GetBodyType() != BT_Summoned) && (GetBodyType() != BT_Summoned2) && (GetBodyType() != BT_Summoned3)) {
Log(Logs::Detail, Logs::Spells, "Bot's target is not a summoned creature.");
LogSpells("Bot's target is not a summoned creature");
return true;
}
}
}
Log(Logs::Detail, Logs::Spells, "No bot immunities to spell %d found.", spell_id);
LogSpells("No bot immunities to spell [{}] found", spell_id);
}
}
@@ -6759,7 +6774,7 @@ bool Bot::DoFinishedSpellSingleTarget(uint16 spell_id, Mob* spellTarget, EQEmu::
if((spelltypeequal || spelltypetargetequal) || spelltypeclassequal || slotequal) {
if(((spells[thespell].effectid[0] == 0) && (spells[thespell].base[0] < 0)) &&
(spellTarget->GetHP() < ((spells[thespell].base[0] * (-1)) + 100))) {
Log(Logs::General, Logs::Spells, "Bot::DoFinishedSpellSingleTarget - GroupBuffing failure");
LogSpells("Bot::DoFinishedSpellSingleTarget - GroupBuffing failure");
return false;
}
@@ -8223,7 +8238,7 @@ bool Bot::CheckLoreConflict(const EQEmu::ItemData* item) {
bool EntityList::Bot_AICheckCloseBeneficialSpells(Bot* caster, uint8 iChance, float iRange, uint32 iSpellTypes) {
if((iSpellTypes & SPELL_TYPES_DETRIMENTAL) != 0) {
Log(Logs::General, Logs::Error, "Error: detrimental spells requested from AICheckCloseBeneficialSpells!!");
LogError("Error: detrimental spells requested from AICheckCloseBeneficialSpells!!");
return false;
}
+9 -1
View File
@@ -270,7 +270,12 @@ public:
bool GetNeedsHateRedux(Mob *tar);
bool HasOrMayGetAggro();
void SetDefaultBotStance();
void SetSurname(std::string bot_surname);
void SetTitle(std::string bot_title);
void SetSuffix(std::string bot_suffix);
std::string GetSurname() { return _surname; }
std::string GetTitle() { return _title; }
std::string GetSuffix() { return _suffix; }
inline virtual int32 GetMaxStat();
inline virtual int32 GetMaxResist();
inline virtual int32 GetMaxSTR();
@@ -650,6 +655,9 @@ private:
uint32 _guildId;
uint8 _guildRank;
std::string _guildName;
std::string _surname;
std::string _title;
std::string _suffix;
uint32 _lastZoneId;
bool _rangerAutoWeaponSelect;
BotRoleType _botRole;
+373 -86
View File
@@ -454,7 +454,7 @@ public:
if (target_type == BCEnum::TT_Self && (entry_prototype->BCST() != BCEnum::SpT_Stance && entry_prototype->BCST() != BCEnum::SpT_SummonCorpse)) {
#ifdef BCSTSPELLDUMP
Log(Logs::General, Logs::Error, "DELETING entry_prototype (primary clause) - name: %s, target_type: %s, BCST: %s",
LogError("DELETING entry_prototype (primary clause) - name: [{}], target_type: [{}], BCST: [{}]",
spells[spell_id].name, BCEnum::TargetTypeEnumToString(target_type).c_str(), BCEnum::SpellTypeEnumToString(entry_prototype->BCST()).c_str());
#endif
safe_delete(entry_prototype);
@@ -462,7 +462,7 @@ public:
}
if (entry_prototype->BCST() == BCEnum::SpT_Stance && target_type != BCEnum::TT_Self) {
#ifdef BCSTSPELLDUMP
Log(Logs::General, Logs::Error, "DELETING entry_prototype (secondary clause) - name: %s, BCST: %s, target_type: %s",
LogError("DELETING entry_prototype (secondary clause) - name: [{}], BCST: [{}], target_type: [{}]",
spells[spell_id].name, BCEnum::SpellTypeEnumToString(entry_prototype->BCST()).c_str(), BCEnum::TargetTypeEnumToString(target_type).c_str());
#endif
safe_delete(entry_prototype);
@@ -1061,7 +1061,7 @@ private:
std::string query = "SELECT `short_name`, `long_name` FROM `zone` WHERE '' NOT IN (`short_name`, `long_name`)";
auto results = database.QueryDatabase(query);
if (!results.Success()) {
Log(Logs::General, Logs::Error, "load_teleport_zone_names() - Error in zone names query: %s", results.ErrorMessage().c_str());
LogError("load_teleport_zone_names() - Error in zone names query: [{}]", results.ErrorMessage().c_str());
return;
}
@@ -1088,14 +1088,14 @@ private:
}
static void status_report() {
Log(Logs::General, Logs::Commands, "load_bot_command_spells(): - 'RuleI(Bots, CommandSpellRank)' set to %i.", RuleI(Bots, CommandSpellRank));
LogCommands("load_bot_command_spells(): - 'RuleI(Bots, CommandSpellRank)' set to [{}]", RuleI(Bots, CommandSpellRank));
if (bot_command_spells.empty()) {
Log(Logs::General, Logs::Error, "load_bot_command_spells() - 'bot_command_spells' is empty.");
LogError("load_bot_command_spells() - 'bot_command_spells' is empty");
return;
}
for (int i = BCEnum::SpellTypeFirst; i <= BCEnum::SpellTypeLast; ++i)
Log(Logs::General, Logs::Commands, "load_bot_command_spells(): - '%s' returned %u spell entries.",
LogCommands("load_bot_command_spells(): - [{}] returned [{}] spell entries",
BCEnum::SpellTypeEnumToString(static_cast<BCEnum::SpType>(i)).c_str(), bot_command_spells[static_cast<BCEnum::SpType>(i)].size());
}
@@ -1351,10 +1351,13 @@ int bot_command_init(void)
bot_command_add("botspawn", "Spawns a created bot", 0, bot_subcommand_bot_spawn) ||
bot_command_add("botstance", "Changes the stance of a bot", 0, bot_subcommand_bot_stance) ||
bot_command_add("botstopmeleelevel", "Sets the level a caster or spell-casting fighter bot will stop melee combat", 0, bot_subcommand_bot_stop_melee_level) ||
bot_command_add("botsuffix", "Sets a bots suffix", 0, bot_subcommand_bot_suffix) ||
bot_command_add("botsummon", "Summons bot(s) to your location", 0, bot_subcommand_bot_summon) ||
bot_command_add("botsurname", "Sets a bots surname (last name)", 0, bot_subcommand_bot_surname) ||
bot_command_add("bottattoo", "Changes the Drakkin tattoo of a bot", 0, bot_subcommand_bot_tattoo) ||
bot_command_add("bottogglearcher", "Toggles a archer bot between melee and ranged weapon use", 0, bot_subcommand_bot_toggle_archer) ||
bot_command_add("bottogglehelm", "Toggles the helm visibility of a bot between shown and hidden", 0, bot_subcommand_bot_toggle_helm) ||
bot_command_add("bottitle", "Sets a bots title", 0, bot_subcommand_bot_title) ||
bot_command_add("botupdate", "Updates a bot to reflect any level changes that you have experienced", 0, bot_subcommand_bot_update) ||
bot_command_add("botwoad", "Changes the Barbarian woad of a bot", 0, bot_subcommand_bot_woad) ||
bot_command_add("charm", "Attempts to have a bot charm your target", 0, bot_command_charm) ||
@@ -1426,35 +1429,93 @@ int bot_command_init(void)
std::map<std::string, std::pair<uint8, std::vector<std::string>>> bot_command_settings;
database.botdb.LoadBotCommandSettings(bot_command_settings);
std::vector<std::pair<std::string, uint8>> injected_bot_command_settings;
std::vector<std::string> orphaned_bot_command_settings;
for (auto bcs_iter : bot_command_settings) {
auto bcl_iter = bot_command_list.find(bcs_iter.first);
if (bcl_iter == bot_command_list.end()) {
orphaned_bot_command_settings.push_back(bcs_iter.first);
LogInfo(
"Bot Command [{}] no longer exists... Deleting orphaned entry from `bot_command_settings` table",
bcs_iter.first.c_str()
);
}
}
if (orphaned_bot_command_settings.size()) {
if (!database.botdb.UpdateOrphanedBotCommandSettings(orphaned_bot_command_settings)) {
LogInfo("Failed to process 'Orphaned Bot Commands' update operation.");
}
}
auto working_bcl = bot_command_list;
for (auto working_bcl_iter : working_bcl) {
auto bot_command_settings_iter = bot_command_settings.find(working_bcl_iter.first);
if (bot_command_settings_iter == bot_command_settings.end()) {
if (working_bcl_iter.second->access == 0)
Log(Logs::General, Logs::Commands, "bot_command_init(): Warning: Bot Command '%s' defaulting to access level 0!", working_bcl_iter.first.c_str());
auto bcs_iter = bot_command_settings.find(working_bcl_iter.first);
if (bcs_iter == bot_command_settings.end()) {
injected_bot_command_settings.push_back(std::pair<std::string, uint8>(working_bcl_iter.first, working_bcl_iter.second->access));
LogInfo(
"New Bot Command [{}] found... Adding to `bot_command_settings` table with access [{}]",
working_bcl_iter.first.c_str(),
working_bcl_iter.second->access
);
if (working_bcl_iter.second->access == 0) {
LogCommands(
"bot_command_init(): Warning: Bot Command [{}] defaulting to access level 0!",
working_bcl_iter.first.c_str()
);
}
continue;
}
working_bcl_iter.second->access = bot_command_settings_iter->second.first;
Log(Logs::General, Logs::Commands, "bot_command_init(): - Bot Command '%s' set to access level %d.", working_bcl_iter.first.c_str(), bot_command_settings_iter->second.first);
if (bot_command_settings_iter->second.second.empty())
working_bcl_iter.second->access = bcs_iter->second.first;
LogCommands(
"bot_command_init(): - Bot Command [{}] set to access level [{}]",
working_bcl_iter.first.c_str(),
bcs_iter->second.first
);
if (bcs_iter->second.second.empty()) {
continue;
}
for (auto alias_iter : bot_command_settings_iter->second.second) {
if (alias_iter.empty())
for (auto alias_iter : bcs_iter->second.second) {
if (alias_iter.empty()) {
continue;
}
if (bot_command_list.find(alias_iter) != bot_command_list.end()) {
Log(Logs::General, Logs::Commands, "bot_command_init(): Warning: Alias '%s' already exists as a bot command - skipping!", alias_iter.c_str());
LogCommands(
"bot_command_init(): Warning: Alias [{}] already exists as a bot command - skipping!",
alias_iter.c_str()
);
continue;
}
bot_command_list[alias_iter] = working_bcl_iter.second;
bot_command_aliases[alias_iter] = working_bcl_iter.first;
Log(Logs::General, Logs::Commands, "bot_command_init(): - Alias '%s' added to bot command '%s'.", alias_iter.c_str(), bot_command_aliases[alias_iter].c_str());
LogCommands(
"bot_command_init(): - Alias [{}] added to bot command [{}]",
alias_iter.c_str(),
bot_command_aliases[alias_iter].c_str()
);
}
}
if (injected_bot_command_settings.size()) {
if (!database.botdb.UpdateInjectedBotCommandSettings(injected_bot_command_settings)) {
LogInfo("Failed to process 'Injected Bot Commands' update operation.");
}
}
bot_command_dispatch = bot_command_real_dispatch;
BCSpells::Load();
@@ -1497,21 +1558,21 @@ void bot_command_deinit(void)
int bot_command_add(std::string bot_command_name, const char *desc, int access, BotCmdFuncPtr function)
{
if (bot_command_name.empty()) {
Log(Logs::General, Logs::Error, "bot_command_add() - Bot command added with empty name string - check bot_command.cpp.");
LogError("bot_command_add() - Bot command added with empty name string - check bot_command.cpp");
return -1;
}
if (function == nullptr) {
Log(Logs::General, Logs::Error, "bot_command_add() - Bot command '%s' added without a valid function pointer - check bot_command.cpp.", bot_command_name.c_str());
LogError("bot_command_add() - Bot command [{}] added without a valid function pointer - check bot_command.cpp", bot_command_name.c_str());
return -1;
}
if (bot_command_list.count(bot_command_name) != 0) {
Log(Logs::General, Logs::Error, "bot_command_add() - Bot command '%s' is a duplicate bot command name - check bot_command.cpp.", bot_command_name.c_str());
LogError("bot_command_add() - Bot command [{}] is a duplicate bot command name - check bot_command.cpp", bot_command_name.c_str());
return -1;
}
for (auto iter : bot_command_list) {
if (iter.second->function != function)
continue;
Log(Logs::General, Logs::Error, "bot_command_add() - Bot command '%s' equates to an alias of '%s' - check bot_command.cpp.", bot_command_name.c_str(), iter.first.c_str());
LogError("bot_command_add() - Bot command [{}] equates to an alias of [{}] - check bot_command.cpp", bot_command_name.c_str(), iter.first.c_str());
return -1;
}
@@ -1566,11 +1627,11 @@ int bot_command_real_dispatch(Client *c, const char *message)
}
if(cur->access >= COMMANDS_LOGGING_MIN_STATUS) {
Log(Logs::General, Logs::Commands, "%s (%s) used bot command: %s (target=%s)", c->GetName(), c->AccountName(), message, c->GetTarget()?c->GetTarget()->GetName():"NONE");
LogCommands("[{}] ([{}]) used bot command: [{}] (target=[{}])", c->GetName(), c->AccountName(), message, c->GetTarget()?c->GetTarget()->GetName():"NONE");
}
if(cur->function == nullptr) {
Log(Logs::General, Logs::Error, "Bot command '%s' has a null function\n", cstr.c_str());
LogError("Bot command [{}] has a null function\n", cstr.c_str());
return(-1);
} else {
//dispatch C++ bot command
@@ -3443,63 +3504,180 @@ void bot_command_movement_speed(Client *c, const Seperator *sep)
void bot_command_owner_option(Client *c, const Seperator *sep)
{
if (helper_is_help_or_usage(sep->arg[1])) {
c->Message(m_usage, "usage: %s [deathmarquee | statsupdate] (argument: enable | disable | null (toggles))", sep->arg[0]);
c->Message(m_usage, "usage: %s [spawnmessage] [argument: say | tell | silent | class | default]", sep->arg[0]);
c->Message(m_usage, "usage: %s [option] [argument | null]", sep->arg[0]);
std::string window_title = "Bot Owner Options";
std::string window_text =
"<table>"
"<tr>"
"<td><c \"#FFFFFF\">Option</td>"
"<td>Argument</td>"
"<td>Notes</td>"
"</tr>"
"<tr>"
"<td><c \"#FFFFFF\">deathmarquee</td>"
"<td><c \"#00FF00\">enable</td>"
"<td></td>"
"</tr>"
"<tr>"
"<td></td>"
"<td><c \"#00FF00\">disable</td>"
"<td></td>"
"</tr>"
"<tr>"
"<td></td>"
"<td><c \"#00FFFF\">null</td>"
"<td><c \"#AAAAAA\">(toggles)</td>"
"</tr>"
"<tr>"
"<td><c \"#FFFFFF\">statsupdate</td>"
"<td><c \"#00FF00\">enable</td>"
"<td></td>"
"</tr>"
"<tr>"
"<td></td>"
"<td><c \"#00FF00\">disable</td>"
"<td></td>"
"</tr>"
"<tr>"
"<td></td>"
"<td><c \"#00FFFF\">null</td>"
"<td><c \"#AAAAAA\">(toggles)</td>"
"</tr>"
"<tr>"
"<td><c \"#FFFFFF\">spawnmessage</td>"
"<td><c \"#00FF00\">say</td>"
"<td></td>"
"</tr>"
"<tr>"
"<td></td>"
"<td><c \"#00FF00\">tell</td>"
"<td></td>"
"</tr>"
"<tr>"
"<td></td>"
"<td><c \"#00FF00\">silent</td>"
"<td></td>"
"</tr>"
"<tr>"
"<td></td>"
"<td><c \"#00FF00\">class</td>"
"<td></td>"
"</tr>"
"<tr>"
"<td></td>"
"<td><c \"#00FF00\">default</td>"
"<td></td>"
"</tr>"
"</table>";
c->SendPopupToClient(window_title.c_str(), window_text.c_str());
return;
}
std::string owner_option = sep->arg[1];
std::string argument = sep->arg[2];
std::string owner_option(sep->arg[1]);
std::string argument(sep->arg[2]);
if (!owner_option.compare("deathmarquee")) {
if (!argument.compare("enable"))
c->SetBotOptionDeathMarquee(true);
else if (!argument.compare("disable"))
c->SetBotOptionDeathMarquee(false);
else
c->SetBotOptionDeathMarquee(!c->GetBotOptionDeathMarquee());
database.botdb.SaveOwnerOptionDeathMarquee(c->CharacterID(), c->GetBotOptionDeathMarquee());
c->Message(m_action, "Bot 'death marquee' is now %s.", (c->GetBotOptionDeathMarquee() == true ? "enabled" : "disabled"));
}
else if (!owner_option.compare("statsupdate")) {
if (!argument.compare("enable"))
c->SetBotOptionStatsUpdate(true);
else if (!argument.compare("disable"))
c->SetBotOptionStatsUpdate(false);
else
c->SetBotOptionStatsUpdate(!c->GetBotOptionStatsUpdate());
database.botdb.SaveOwnerOptionStatsUpdate(c->CharacterID(), c->GetBotOptionStatsUpdate());
c->Message(m_action, "Bot 'stats update' is now %s.", (c->GetBotOptionStatsUpdate() == true ? "enabled" : "disabled"));
}
else if (!owner_option.compare("spawnmessage")) {
if (!argument.compare("say")) {
c->SetBotOptionSpawnMessageSay();
if (!argument.compare("enable")) {
c->SetBotOption(Client::booDeathMarquee, true);
}
else if (!argument.compare("tell")) {
c->SetBotOptionSpawnMessageTell();
}
else if (!argument.compare("silent")) {
c->SetBotOptionSpawnMessageSilent();
}
else if (!argument.compare("class")) {
c->SetBotOptionSpawnMessageClassSpecific(true);
}
else if (!argument.compare("default")) {
c->SetBotOptionSpawnMessageClassSpecific(false);
else if (!argument.compare("disable")) {
c->SetBotOption(Client::booDeathMarquee, false);
}
else {
c->SetBotOption(Client::booDeathMarquee, !c->GetBotOption(Client::booDeathMarquee));
}
database.botdb.SaveOwnerOption(c->CharacterID(), Client::booDeathMarquee, c->GetBotOption(Client::booDeathMarquee));
c->Message(m_action, "Bot 'death marquee' is now %s.", (c->GetBotOption(Client::booDeathMarquee) == true ? "enabled" : "disabled"));
}
else if (!owner_option.compare("statsupdate")) {
if (!argument.compare("enable")) {
c->SetBotOption(Client::booStatsUpdate, true);
}
else if (!argument.compare("disable")) {
c->SetBotOption(Client::booStatsUpdate, false);
}
else {
c->SetBotOption(Client::booStatsUpdate, !c->GetBotOption(Client::booStatsUpdate));
}
database.botdb.SaveOwnerOption(c->CharacterID(), Client::booStatsUpdate, c->GetBotOption(Client::booStatsUpdate));
c->Message(m_action, "Bot 'stats update' is now %s.", (c->GetBotOption(Client::booStatsUpdate) == true ? "enabled" : "disabled"));
}
else if (!owner_option.compare("spawnmessage")) {
Client::BotOwnerOption boo = Client::_booCount;
if (!argument.compare("say")) {
boo = Client::booSpawnMessageSay;
c->SetBotOption(Client::booSpawnMessageSay, true);
c->SetBotOption(Client::booSpawnMessageTell, false);
}
else if (!argument.compare("tell")) {
boo = Client::booSpawnMessageSay;
c->SetBotOption(Client::booSpawnMessageSay, false);
c->SetBotOption(Client::booSpawnMessageTell, true);
}
else if (!argument.compare("silent")) {
boo = Client::booSpawnMessageSay;
c->SetBotOption(Client::booSpawnMessageSay, false);
c->SetBotOption(Client::booSpawnMessageTell, false);
}
else if (!argument.compare("class")) {
boo = Client::booSpawnMessageClassSpecific;
c->SetBotOption(Client::booSpawnMessageClassSpecific, true);
}
else if (!argument.compare("default")) {
boo = Client::booSpawnMessageClassSpecific;
c->SetBotOption(Client::booSpawnMessageClassSpecific, false);
}
else {
c->Message(m_fail, "Owner option '%s' argument '%s' is not recognized.", owner_option.c_str(), argument.c_str());
return;
}
database.botdb.SaveOwnerOptionSpawnMessage(
c->CharacterID(),
c->GetBotOptionSpawnMessageSay(),
c->GetBotOptionSpawnMessageTell(),
c->GetBotOptionSpawnMessageClassSpecific()
);
if (boo == Client::booSpawnMessageSay) {
database.botdb.SaveOwnerOption(
c->CharacterID(),
std::pair<size_t, size_t>(
Client::booSpawnMessageSay,
Client::booSpawnMessageTell
),
std::pair<bool, bool>(
c->GetBotOption(Client::booSpawnMessageSay),
c->GetBotOption(Client::booSpawnMessageTell)
)
);
}
else if (boo == Client::booSpawnMessageClassSpecific) {
database.botdb.SaveOwnerOption(
c->CharacterID(),
Client::booSpawnMessageClassSpecific,
c->GetBotOption(Client::booSpawnMessageClassSpecific)
);
}
else {
c->Message(m_action, "Bot 'spawn message' is now ERROR.");
return;
}
c->Message(m_action, "Bot 'spawn message' is now %s.", argument.c_str());
}
else {
@@ -4254,7 +4432,7 @@ void bot_subcommand_bot_clone(Client *c, const Seperator *sep)
}
if (!my_bot->GetBotID()) {
c->Message(m_unknown, "An unknown error has occured - BotName: %s, BotID: %u", my_bot->GetCleanName(), my_bot->GetBotID());
Log(Logs::General, Logs::Commands, "bot_command_clone(): - Error: Active bot reported invalid ID (BotName: %s, BotID: %u, OwnerName: %s, OwnerID: %u, AcctName: %s, AcctID: %u)",
LogCommands("bot_command_clone(): - Error: Active bot reported invalid ID (BotName: [{}], BotID: [{}], OwnerName: [{}], OwnerID: [{}], AcctName: [{}], AcctID: [{}])",
my_bot->GetCleanName(), my_bot->GetBotID(), c->GetCleanName(), c->CharacterID(), c->AccountName(), c->AccountID());
return;
}
@@ -4408,7 +4586,7 @@ void bot_subcommand_bot_create(Client *c, const Seperator *sep)
return;
}
std::string bot_name = sep->arg[1];
bot_name = ucfirst(bot_name);
if (sep->arg[2][0] == '\0' || !sep->IsNumber(2)) {
c->Message(m_fail, "Invalid Class!");
return;
@@ -4936,17 +5114,22 @@ void bot_subcommand_bot_list(Client *c, const Seperator *sep)
if (helper_command_alias_fail(c, "bot_subcommand_bot_list", sep->arg[0], "botlist"))
return;
if (helper_is_help_or_usage(sep->arg[1])) {
c->Message(m_usage, "usage: %s ([class] [value]) ([race] [value]) ([name] [partial-full])", sep->arg[0]);
c->Message(m_usage, "usage: %s (account) ([class] [value]) ([race] [value]) ([name] [partial-full])", sep->arg[0]);
c->Message(m_note, "note: filter criteria is orderless and optional");
return;
}
bool Account = false;
int seps = 1;
uint32 filter_value[FilterCount];
int name_criteria_arg = 0;
memset(&filter_value, 0, sizeof(uint32) * FilterCount);
int filter_mask = 0;
for (int i = 1; i < (FilterCount * 2); i += 2) {
if (strcasecmp(sep->arg[1], "account") == 0) {
Account = true;
seps = 2;
}
for (int i = seps; i < (FilterCount * 2); i += 2) {
if (sep->arg[i][0] == '\0')
break;
@@ -4971,7 +5154,7 @@ void bot_subcommand_bot_list(Client *c, const Seperator *sep)
}
std::list<BotsAvailableList> bots_list;
if (!database.botdb.LoadBotsList(c->CharacterID(), bots_list)) {
if (!database.botdb.LoadBotsList(c->CharacterID(), bots_list, Account)) {
c->Message(m_fail, "%s", BotDatabase::fail::LoadBotsList());
return;
}
@@ -4981,6 +5164,7 @@ void bot_subcommand_bot_list(Client *c, const Seperator *sep)
}
int bot_count = 0;
int bots_owned = 0;
for (auto bots_iter : bots_list) {
if (filter_mask) {
if ((filter_mask & MaskClass) && filter_value[FilterClass] != bots_iter.Class)
@@ -4996,23 +5180,26 @@ void bot_subcommand_bot_list(Client *c, const Seperator *sep)
continue;
}
}
c->Message(m_message, "%s is a level %u %s %s %s",
bots_iter.Name,
Bot * botCheckNotOnline = entity_list.GetBotByBotName(bots_iter.Name);
std::string botspawn_saylink = StringFormat("^botspawn %s", bots_iter.Name);
c->Message(Chat::White, "%s is a level %u %s %s %s who is owned by %s",
((c->CharacterID() == bots_iter.Owner_ID) && (!botCheckNotOnline) ? (EQEmu::SayLinkEngine::GenerateQuestSaylink(botspawn_saylink, false, bots_iter.Name).c_str()) : (bots_iter.Name)),
bots_iter.Level,
Bot::RaceIdToString(bots_iter.Race).c_str(),
((bots_iter.Gender == FEMALE) ? ("Female") : ((bots_iter.Gender == MALE) ? ("Male") : ("Neuter"))),
Bot::ClassIdToString(bots_iter.Class).c_str()
Bot::ClassIdToString(bots_iter.Class).c_str(),
bots_iter.Owner
);
if (c->CharacterID() == bots_iter.Owner_ID) { ++bots_owned; }
++bot_count;
}
if (!bot_count) {
c->Message(m_fail, "You have no bots meeting this criteria");
c->Message(Chat::Red, "You have no bots meeting this criteria");
}
else {
c->Message(m_action, "%i of %i bot%s shown", bot_count, bots_list.size(), ((bot_count != 1) ? ("s") : ("")));
c->Message(m_message, "Your limit is %i bot%s", RuleI(Bots, CreationLimit), ((RuleI(Bots, CreationLimit) != 1) ? ("s") : ("")));
c->Message(Chat::Yellow, "%i of %i bot%s shown.", bot_count, bots_list.size(), ((bot_count != 1) ? ("s") : ("")));
c->Message(Chat::Yellow, "%i of %i bot%s are owned by you. (You may spawn any available by clicking name)", bots_owned, bot_count, ((bot_count != 1) ? ("s") : ("")));
c->Message(Chat::White, "Your limit is %i bot%s", RuleI(Bots, CreationLimit), ((RuleI(Bots, CreationLimit) != 1) ? ("s") : ("")));
}
}
@@ -5058,6 +5245,103 @@ void bot_subcommand_bot_out_of_combat(Client *c, const Seperator *sep)
}
}
void bot_subcommand_bot_surname(Client *c, const Seperator *sep)
{
if (sep->arg[1][0] == '\0' || sep->IsNumber(1)) {
c->Message(Chat::Red, "You must specify a [surname] to use this command (use _ to define spaces or -remove to clear.)");
return;
}
auto my_bot = ActionableBots::AsTarget_ByBot(c);
if (!my_bot) {
c->Message(Chat::Red, "You must <target> a bot that you own to use this command");
return;
}
if (strlen(sep->arg[1]) > 31) {
c->Message(Chat::Red, "Surname must be 31 characters or less.");
return;
}
std::string bot_surname = sep->arg[1];
bot_surname = (bot_surname == "-remove") ? "" : bot_surname;
std::replace(bot_surname.begin(), bot_surname.end(), '_', ' ');
my_bot->SetSurname(bot_surname);
if (!database.botdb.SaveBot(my_bot)) {
c->Message(Chat::Red, BotDatabase::fail::SaveBot());
return;
}
else {
auto outapp = new EQApplicationPacket(OP_GMLastName, sizeof(GMLastName_Struct));
GMLastName_Struct * gmn = (GMLastName_Struct*)outapp->pBuffer;
strcpy(gmn->name, my_bot->GetCleanName());
strcpy(gmn->gmname, my_bot->GetCleanName());
strcpy(gmn->lastname, my_bot->GetSurname().c_str());
gmn->unknown[0] = 1;
gmn->unknown[1] = 1;
gmn->unknown[2] = 1;
gmn->unknown[3] = 1;
entity_list.QueueClients(my_bot->CastToClient(), outapp);
safe_delete(outapp);
c->Message(Chat::Yellow, "Bot Surname Saved.");
}
}
void bot_subcommand_bot_title(Client *c, const Seperator *sep)
{
if (sep->arg[1][0] == '\0' || sep->IsNumber(1)) {
c->Message(Chat::Red, "You must specify a [title] to use this command. (use _ to define spaces or -remove to clear.)");
return;
}
auto my_bot = ActionableBots::AsTarget_ByBot(c);
if (!my_bot) {
c->Message(Chat::Red, "You must <target> a bot that you own to use this command");
return;
}
if (strlen(sep->arg[1]) > 31) {
c->Message(Chat::Red, "Title must be 31 characters or less.");
return;
}
std::string bot_title = sep->arg[1];
bot_title = (bot_title == "-remove") ? "" : bot_title;
std::replace(bot_title.begin(), bot_title.end(), '_', ' ');
my_bot->SetTitle(bot_title);
if (!database.botdb.SaveBot(my_bot)) {
c->Message(Chat::Red, BotDatabase::fail::SaveBot());
return;
}
else {
my_bot->CastToClient()->SetAATitle(my_bot->GetTitle().c_str());
c->Message(Chat::Yellow, "Bot Title Saved.");
}
}
void bot_subcommand_bot_suffix(Client *c, const Seperator *sep)
{
if (sep->arg[1][0] == '\0' || sep->IsNumber(1)) {
c->Message(Chat::Red, "You must specify a [suffix] to use this command. (use _ to define spaces or -remove to clear.)");
return;
}
auto my_bot = ActionableBots::AsTarget_ByBot(c);
if (!my_bot) {
c->Message(Chat::Red, "You must <target> a bot that you own to use this command");
return;
}
if (strlen(sep->arg[1]) > 31) {
c->Message(Chat::Red, "Suffix must be 31 characters or less.");
return;
}
std::string bot_suffix = sep->arg[1];
bot_suffix = (bot_suffix == "-remove") ? "" : bot_suffix;
std::replace(bot_suffix.begin(), bot_suffix.end(), '_', ' ');
my_bot->SetSuffix(bot_suffix);
if (!database.botdb.SaveBot(my_bot)) {
c->Message(Chat::Red, BotDatabase::fail::SaveBot());
return;
}
else {
my_bot->CastToClient()->SetTitleSuffix(my_bot->GetSuffix().c_str());
c->Message(Chat::Yellow, "Bot Suffix Saved.");
}
}
void bot_subcommand_bot_report(Client *c, const Seperator *sep)
{
if (helper_command_alias_fail(c, "bot_subcommand_bot_report", sep->arg[0], "botreport"))
@@ -5221,13 +5505,16 @@ void bot_subcommand_bot_spawn(Client *c, const Seperator *sep)
};
uint8 message_index = 0;
if (c->GetBotOptionSpawnMessageClassSpecific())
if (c->GetBotOption(Client::booSpawnMessageClassSpecific)) {
message_index = VALIDATECLASSID(my_bot->GetClass());
}
if (c->GetBotOptionSpawnMessageSay())
if (c->GetBotOption(Client::booSpawnMessageSay)) {
Bot::BotGroupSay(my_bot, "%s", bot_spawn_message[message_index]);
else if (c->GetBotOptionSpawnMessageTell())
}
else if (c->GetBotOption(Client::booSpawnMessageTell)) {
c->Message(Chat::Tell, "%s tells you, \"%s\"", my_bot->GetCleanName(), bot_spawn_message[message_index]);
}
}
void bot_subcommand_bot_stance(Client *c, const Seperator *sep)
@@ -5607,7 +5894,7 @@ void bot_subcommand_bot_update(Client *c, const Seperator *sep)
continue;
bot_iter->SetPetChooser(false);
bot_iter->CalcBotStats(c->GetBotOptionStatsUpdate());
bot_iter->CalcBotStats(c->GetBotOption(Client::booStatsUpdate));
bot_iter->SendAppearancePacket(AT_WhoLevel, bot_iter->GetLevel(), true, true);
++bot_count;
}
@@ -7396,7 +7683,7 @@ void bot_subcommand_inventory_remove(Client *c, const Seperator *sep)
}
my_bot->BotRemoveEquipItem(slotId);
my_bot->CalcBotStats(c->GetBotOptionStatsUpdate());
my_bot->CalcBotStats(c->GetBotOption(Client::booStatsUpdate));
}
switch (slotId) {
+3
View File
@@ -614,8 +614,11 @@ void bot_subcommand_bot_report(Client *c, const Seperator *sep);
void bot_subcommand_bot_spawn(Client *c, const Seperator *sep);
void bot_subcommand_bot_stance(Client *c, const Seperator *sep);
void bot_subcommand_bot_stop_melee_level(Client *c, const Seperator *sep);
void bot_subcommand_bot_suffix(Client *c, const Seperator *sep);
void bot_subcommand_bot_summon(Client *c, const Seperator *sep);
void bot_subcommand_bot_surname(Client *c, const Seperator *sep);
void bot_subcommand_bot_tattoo(Client *c, const Seperator *sep);
void bot_subcommand_bot_title(Client *c, const Seperator *sep);
void bot_subcommand_bot_toggle_archer(Client *c, const Seperator *sep);
void bot_subcommand_bot_toggle_helm(Client *c, const Seperator *sep);
void bot_subcommand_bot_update(Client *c, const Seperator *sep);
+158 -105
View File
@@ -27,6 +27,8 @@
#include "bot.h"
#include "client.h"
#include <fmt/format.h>
bool BotDatabase::LoadBotCommandSettings(std::map<std::string, std::pair<uint8, std::vector<std::string>>> &bot_command_settings)
{
@@ -52,6 +54,58 @@ bool BotDatabase::LoadBotCommandSettings(std::map<std::string, std::pair<uint8,
return true;
}
bool BotDatabase::UpdateInjectedBotCommandSettings(const std::vector<std::pair<std::string, uint8>> &injected)
{
if (injected.size()) {
query = fmt::format(
"REPLACE INTO `bot_command_settings`(`bot_command`, `access`) VALUES {}",
implode(
",",
std::pair<char, char>('(', ')'),
join_pair(",", std::pair<char, char>('\'', '\''), injected)
)
);
if (!database.QueryDatabase(query).Success()) {
return false;
}
Log(Logs::General,
Logs::Status,
"%u New Bot Command%s Added",
injected.size(),
(injected.size() == 1 ? "" : "s")
);
}
return true;
}
bool BotDatabase::UpdateOrphanedBotCommandSettings(const std::vector<std::string> &orphaned)
{
if (orphaned.size()) {
query = fmt::format(
"DELETE FROM `bot_command_settings` WHERE `bot_command` IN ({})",
implode(",", std::pair<char, char>('\'', '\''), orphaned)
);
if (!database.QueryDatabase(query).Success()) {
return false;
}
Log(Logs::General,
Logs::Status,
"%u Orphaned Bot Command%s Deleted",
orphaned.size(),
(orphaned.size() == 1 ? "" : "s")
);
}
return true;
}
bool BotDatabase::LoadBotSpellCastingChances()
{
query =
@@ -163,12 +217,19 @@ bool BotDatabase::LoadQuestableSpawnCount(const uint32 owner_id, int& spawn_coun
return true;
}
bool BotDatabase::LoadBotsList(const uint32 owner_id, std::list<BotsAvailableList>& bots_list)
bool BotDatabase::LoadBotsList(const uint32 owner_id, std::list<BotsAvailableList>& bots_list, bool ByAccount)
{
if (!owner_id)
return false;
query = StringFormat("SELECT `bot_id`, `name`, `class`, `level`, `race`, `gender` FROM `bot_data` WHERE `owner_id` = '%u'", owner_id);
if (ByAccount == true)
query = StringFormat("SELECT bot_id, bd.`name`, bd.class, bd.`level`, bd.race, bd.gender, cd.`name` as owner, bd.owner_id, cd.account_id, cd.id"
" FROM bot_data as bd inner join character_data as cd on bd.owner_id = cd.id"
" WHERE cd.account_id = (select account_id from bot_data bd inner join character_data as cd on bd.owner_id = cd.id where bd.owner_id = '%u' LIMIT 1)"
" ORDER BY bd.owner_id", owner_id);
else
query = StringFormat("SELECT `bot_id`, `name`, `class`, `level`, `race`, `gender`, 'You' as owner, owner_id FROM `bot_data` WHERE `owner_id` = '%u'", owner_id);
auto results = database.QueryDatabase(query);
if (!results.Success())
return false;
@@ -186,12 +247,17 @@ bool BotDatabase::LoadBotsList(const uint32 owner_id, std::list<BotsAvailableLis
bot_name = bot_name.substr(0, 63);
if (!bot_name.empty())
strcpy(bot_entry.Name, bot_name.c_str());
memset(&bot_entry.Owner, 0, sizeof(bot_entry.Owner));
std::string bot_owner = row[6];
if (bot_owner.size() > 63)
bot_owner = bot_owner.substr(0, 63);
if (!bot_owner.empty())
strcpy(bot_entry.Owner, bot_owner.c_str());
bot_entry.Class = atoi(row[2]);
bot_entry.Level = atoi(row[3]);
bot_entry.Race = atoi(row[4]);
bot_entry.Gender = atoi(row[5]);
bot_entry.Owner_ID = atoi(row[7]);
bots_list.push_back(bot_entry);
}
@@ -266,8 +332,8 @@ bool BotDatabase::LoadBot(const uint32 bot_id, Bot*& loaded_bot)
" `spells_id`,"
" `name`,"
" `last_name`,"
" `title`," /* planned use[4] */
" `suffix`," /* planned use[5] */
" `title`,"
" `suffix`,"
" `zone_id`,"
" `gender`,"
" `race`,"
@@ -364,7 +430,9 @@ bool BotDatabase::LoadBot(const uint32 bot_id, Bot*& loaded_bot)
loaded_bot = new Bot(bot_id, atoi(row[0]), atoi(row[1]), atof(row[14]), atoi(row[6]), tempNPCStruct);
if (loaded_bot) {
loaded_bot->SetShowHelm((atoi(row[43]) > 0 ? true : false));
loaded_bot->SetSurname(row[3]);//maintaining outside mob::lastname to cater to spaces
loaded_bot->SetTitle(row[4]);
loaded_bot->SetSuffix(row[5]);
uint32 bfd = atoi(row[44]);
if (bfd < 1)
bfd = 1;
@@ -573,12 +641,14 @@ bool BotDatabase::SaveBot(Bot* bot_inst)
" `corruption` = '%i',"
" `show_helm` = '%i',"
" `follow_distance` = '%i',"
" `stop_melee_level` = '%u'"
" `stop_melee_level` = '%u',"
" `title` = '%s',"
" `suffix` = '%s'"
" WHERE `bot_id` = '%u'",
bot_inst->GetBotOwnerCharacterID(),
bot_inst->GetBotSpellID(),
bot_inst->GetCleanName(),
bot_inst->GetLastName(),
bot_inst->GetSurname().c_str(),
bot_inst->GetLastZoneID(),
bot_inst->GetBaseGender(),
bot_inst->GetBaseRace(),
@@ -616,6 +686,8 @@ bool BotDatabase::SaveBot(Bot* bot_inst)
((bot_inst->GetShowHelm()) ? (1) : (0)),
bot_inst->GetFollowDistance(),
bot_inst->GetStopMeleeLevel(),
bot_inst->GetTitle().c_str(),
bot_inst->GetSuffix().c_str(),
bot_inst->GetBotID()
);
auto results = database.QueryDatabase(query);
@@ -1121,7 +1193,7 @@ bool BotDatabase::LoadItems(const uint32 bot_id, EQEmu::InventoryProfile& invent
(uint32)atoul(row[14])
);
if (!item_inst) {
Log(Logs::General, Logs::Error, "Warning: bot_id '%i' has an invalid item_id '%i' in inventory slot '%i'", bot_id, item_id, slot_id);
LogError("Warning: bot_id [{}] has an invalid item_id [{}] in inventory slot [{}]", bot_id, item_id, slot_id);
continue;
}
@@ -1174,7 +1246,7 @@ bool BotDatabase::LoadItems(const uint32 bot_id, EQEmu::InventoryProfile& invent
item_inst->SetOrnamentHeroModel((uint32)atoul(row[8]));
if (inventory_inst.PutItem(slot_id, *item_inst) == INVALID_INDEX)
Log(Logs::General, Logs::Error, "Warning: Invalid slot_id for item in inventory: bot_id = '%i', item_id = '%i', slot_id = '%i'", bot_id, item_id, slot_id);
LogError("Warning: Invalid slot_id for item in inventory: bot_id = [{}], item_id = [{}], slot_id = [{}]", bot_id, item_id, slot_id);
safe_delete(item_inst);
}
@@ -2153,111 +2225,92 @@ bool BotDatabase::SaveStopMeleeLevel(const uint32 owner_id, const uint32 bot_id,
bool BotDatabase::LoadOwnerOptions(Client *owner)
{
if (!owner || !owner->CharacterID())
return false;
query = StringFormat(
"SELECT `death_marquee`, `stats_update`, `spawn_message_enabled`, `spawn_message_type` FROM `bot_owner_options`"
" WHERE `owner_id` = '%u'",
owner->CharacterID()
);
auto results = database.QueryDatabase(query);
if (!results.Success())
return false;
if (!results.RowCount()) {
query = StringFormat("REPLACE INTO `bot_owner_options` (`owner_id`) VALUES ('%u')", owner->CharacterID());
results = database.QueryDatabase(query);
if (!owner || !owner->CharacterID()) {
return false;
}
auto row = results.begin();
owner->SetBotOptionDeathMarquee((atoi(row[0]) != 0));
owner->SetBotOptionStatsUpdate((atoi(row[1]) != 0));
switch (atoi(row[2])) {
case 2:
owner->SetBotOptionSpawnMessageSay();
break;
case 1:
owner->SetBotOptionSpawnMessageTell();
break;
query = fmt::format("SELECT `option_type`, `option_value` FROM `bot_owner_options` WHERE `owner_id` = '{}'", owner->CharacterID());
auto results = database.QueryDatabase(query);
if (!results.Success()) {
return false;
}
for (auto row : results) {
owner->SetBotOption(static_cast<Client::BotOwnerOption>(atoul(row[0])), (atoul(row[1]) != 0));
}
return true;
}
bool BotDatabase::SaveOwnerOption(const uint32 owner_id, size_t type, const bool flag)
{
if (!owner_id) {
return false;
}
switch (static_cast<Client::BotOwnerOption>(type)) {
case Client::booDeathMarquee:
case Client::booStatsUpdate:
case Client::booSpawnMessageClassSpecific: {
query = fmt::format(
"REPLACE INTO `bot_owner_options`(`owner_id`, `option_type`, `option_value`) VALUES ('{}', '{}', '{}')",
owner_id,
type,
(flag == true ? 1 : 0)
);
auto results = database.QueryDatabase(query);
if (!results.Success()) {
return false;
}
return true;
}
default:
owner->SetBotOptionSpawnMessageSilent();
break;
return false;
}
owner->SetBotOptionSpawnMessageClassSpecific((atoi(row[3]) != 0));
return true;
}
bool BotDatabase::SaveOwnerOptionDeathMarquee(const uint32 owner_id, const bool flag)
bool BotDatabase::SaveOwnerOption(const uint32 owner_id, const std::pair<size_t, size_t> type, const std::pair<bool, bool> flag)
{
if (!owner_id)
if (!owner_id) {
return false;
}
query = StringFormat(
"UPDATE `bot_owner_options`"
" SET `death_marquee` = '%u'"
" WHERE `owner_id` = '%u'",
(flag == true ? 1 : 0),
owner_id
);
auto results = database.QueryDatabase(query);
if (!results.Success())
switch (static_cast<Client::BotOwnerOption>(type.first)) {
case Client::booSpawnMessageSay:
case Client::booSpawnMessageTell: {
switch (static_cast<Client::BotOwnerOption>(type.second)) {
case Client::booSpawnMessageSay:
case Client::booSpawnMessageTell: {
query = fmt::format(
"REPLACE INTO `bot_owner_options`(`owner_id`, `option_type`, `option_value`) VALUES ('{}', '{}', '{}'), ('{}', '{}', '{}')",
owner_id,
type.first,
(flag.first == true ? 1 : 0),
owner_id,
type.second,
(flag.second == true ? 1 : 0)
);
auto results = database.QueryDatabase(query);
if (!results.Success()) {
return false;
}
return true;
}
default:
return false;
}
}
default:
return false;
return true;
}
bool BotDatabase::SaveOwnerOptionStatsUpdate(const uint32 owner_id, const bool flag)
{
if (!owner_id)
return false;
query = StringFormat(
"UPDATE `bot_owner_options`"
" SET `stats_update` = '%u'"
" WHERE `owner_id` = '%u'",
(flag == true ? 1 : 0),
owner_id
);
auto results = database.QueryDatabase(query);
if (!results.Success())
return false;
return true;
}
bool BotDatabase::SaveOwnerOptionSpawnMessage(const uint32 owner_id, const bool say, const bool tell, const bool class_specific)
{
if (!owner_id)
return false;
uint8 enabled_value = 0;
if (say)
enabled_value = 2;
else if (tell)
enabled_value = 1;
uint8 type_value = 0;
if (class_specific)
type_value = 1;
query = StringFormat(
"UPDATE `bot_owner_options`"
" SET"
" `spawn_message_enabled` = '%u',"
" `spawn_message_type` = '%u'"
" WHERE `owner_id` = '%u'",
enabled_value,
type_value,
owner_id
);
auto results = database.QueryDatabase(query);
if (!results.Success())
return false;
return true;
}
}
+6 -5
View File
@@ -43,6 +43,8 @@ class BotDatabase
{
public:
bool LoadBotCommandSettings(std::map<std::string, std::pair<uint8, std::vector<std::string>>> &bot_command_settings);
bool UpdateInjectedBotCommandSettings(const std::vector<std::pair<std::string, uint8>> &injected);
bool UpdateOrphanedBotCommandSettings(const std::vector<std::string> &orphaned);
bool LoadBotSpellCastingChances();
@@ -50,7 +52,7 @@ public:
bool QueryNameAvailablity(const std::string& bot_name, bool& available_flag);
bool QueryBotCount(const uint32 owner_id, uint32& bot_count);
bool LoadQuestableSpawnCount(const uint32 owner_id, int& spawn_count);
bool LoadBotsList(const uint32 owner_id, std::list<BotsAvailableList>& bots_list);
bool LoadBotsList(const uint32 owner_id, std::list<BotsAvailableList>& bots_list, bool ByAccount = false);
bool LoadOwnerID(const std::string& bot_name, uint32& owner_id);
bool LoadOwnerID(const uint32 bot_id, uint32& owner_id);
@@ -139,10 +141,9 @@ public:
bool SaveStopMeleeLevel(const uint32 owner_id, const uint32 bot_id, const uint8 sml_value);
bool LoadOwnerOptions(Client *owner);
bool SaveOwnerOptionDeathMarquee(const uint32 owner_id, const bool flag);
bool SaveOwnerOptionStatsUpdate(const uint32 owner_id, const bool flag);
bool SaveOwnerOptionSpawnMessage(const uint32 owner_id, const bool say, const bool tell, const bool class_specific);
bool SaveOwnerOption(const uint32 owner_id, size_t type, const bool flag);
bool SaveOwnerOption(const uint32 owner_id, const std::pair<size_t, size_t> type, const std::pair<bool, bool> flag);
/* Bot bot-group functions */
bool QueryBotGroupExistence(const std::string& botgroup_name, bool& extant_flag);
+2
View File
@@ -32,6 +32,8 @@ struct BotsAvailableList {
uint8 Level;
uint16 Race;
uint8 Gender;
char Owner[64];
uint32 Owner_ID;
};
struct BotGroup {
+5 -5
View File
@@ -1134,7 +1134,7 @@ bool Bot::AI_PursueCastCheck() {
AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting.
Log(Logs::Detail, Logs::AI, "Bot Engaged (pursuing) autocast check triggered. Trying to cast offensive spells.");
LogAI("Bot Engaged (pursuing) autocast check triggered. Trying to cast offensive spells");
if(!AICastSpell(GetTarget(), 100, SpellType_Snare)) {
if(!AICastSpell(GetTarget(), 100, SpellType_Lifetap)) {
@@ -1162,7 +1162,7 @@ bool Bot::AI_IdleCastCheck() {
if (AIautocastspell_timer->Check(false)) {
#if BotAI_DEBUG_Spells >= 25
Log(Logs::Detail, Logs::AI, "Bot Non-Engaged autocast check triggered: %s", this->GetCleanName());
LogAI("Bot Non-Engaged autocast check triggered: [{}]", this->GetCleanName());
#endif
AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting.
@@ -1310,7 +1310,7 @@ bool Bot::AI_EngagedCastCheck() {
EQEmu::constants::StanceType botStance = GetBotStance();
bool mayGetAggro = HasOrMayGetAggro();
Log(Logs::Detail, Logs::AI, "Engaged autocast check triggered (BOTS). Trying to cast healing spells then maybe offensive spells.");
LogAI("Engaged autocast check triggered (BOTS). Trying to cast healing spells then maybe offensive spells");
if(botClass == CLERIC) {
if(!AICastSpell(GetTarget(), GetChanceToCastBySpellType(SpellType_Escape), SpellType_Escape)) {
@@ -1560,11 +1560,11 @@ bool Bot::AIHealRotation(Mob* tar, bool useFastHeals) {
}
#if BotAI_DEBUG_Spells >= 10
Log(Logs::Detail, Logs::AI, "Bot::AIHealRotation: heal spellid = %u, fastheals = %c, casterlevel = %u",
LogAI("Bot::AIHealRotation: heal spellid = [{}], fastheals = [{}], casterlevel = [{}]",
botSpell.SpellId, ((useFastHeals) ? ('T') : ('F')), GetLevel());
#endif
#if BotAI_DEBUG_Spells >= 25
Log(Logs::Detail, Logs::AI, "Bot::AIHealRotation: target = %s, current_time = %u, donthealmebefore = %u", tar->GetCleanName(), Timer::GetCurrentTime(), tar->DontHealMeBefore());
LogAI("Bot::AIHealRotation: target = [{}], current_time = [{}], donthealmebefore = [{}]", tar->GetCleanName(), Timer::GetCurrentTime(), tar->DontHealMeBefore());
#endif
// If there is still no spell id, then there isn't going to be one so we are done
+58 -36
View File
@@ -347,7 +347,11 @@ Client::Client(EQStreamInterface* ieqs)
dev_tools_window_enabled = true;
#ifdef BOTS
bot_owner_options = DefaultBotOwnerOptions;
bot_owner_options[booDeathMarquee] = false;
bot_owner_options[booStatsUpdate] = false;
bot_owner_options[booSpawnMessageSay] = false;
bot_owner_options[booSpawnMessageTell] = true;
bot_owner_options[booSpawnMessageClassSpecific] = true;
#endif
AI_Init();
@@ -377,7 +381,7 @@ Client::~Client() {
ToggleBuyerMode(false);
if(conn_state != ClientConnectFinished) {
Log(Logs::General, Logs::None, "Client '%s' was destroyed before reaching the connected state:", GetName());
LogDebug("Client [{}] was destroyed before reaching the connected state:", GetName());
ReportConnectingState();
}
@@ -538,31 +542,31 @@ void Client::SendLogoutPackets() {
void Client::ReportConnectingState() {
switch(conn_state) {
case NoPacketsReceived: //havent gotten anything
Log(Logs::General, Logs::None, "Client has not sent us an initial zone entry packet.");
LogDebug("Client has not sent us an initial zone entry packet");
break;
case ReceivedZoneEntry: //got the first packet, loading up PP
Log(Logs::General, Logs::None, "Client sent initial zone packet, but we never got their player info from the database.");
LogDebug("Client sent initial zone packet, but we never got their player info from the database");
break;
case PlayerProfileLoaded: //our DB work is done, sending it
Log(Logs::General, Logs::None, "We were sending the player profile, tributes, tasks, spawns, time and weather, but never finished.");
LogDebug("We were sending the player profile, tributes, tasks, spawns, time and weather, but never finished");
break;
case ZoneInfoSent: //includes PP, tributes, tasks, spawns, time and weather
Log(Logs::General, Logs::None, "We successfully sent player info and spawns, waiting for client to request new zone.");
LogDebug("We successfully sent player info and spawns, waiting for client to request new zone");
break;
case NewZoneRequested: //received and sent new zone request
Log(Logs::General, Logs::None, "We received client's new zone request, waiting for client spawn request.");
LogDebug("We received client's new zone request, waiting for client spawn request");
break;
case ClientSpawnRequested: //client sent ReqClientSpawn
Log(Logs::General, Logs::None, "We received the client spawn request, and were sending objects, doors, zone points and some other stuff, but never finished.");
LogDebug("We received the client spawn request, and were sending objects, doors, zone points and some other stuff, but never finished");
break;
case ZoneContentsSent: //objects, doors, zone points
Log(Logs::General, Logs::None, "The rest of the zone contents were successfully sent, waiting for client ready notification.");
LogDebug("The rest of the zone contents were successfully sent, waiting for client ready notification");
break;
case ClientReadyReceived: //client told us its ready, send them a bunch of crap like guild MOTD, etc
Log(Logs::General, Logs::None, "We received client ready notification, but never finished Client::CompleteConnect");
LogDebug("We received client ready notification, but never finished Client::CompleteConnect");
break;
case ClientConnectFinished: //client finally moved to finished state, were done here
Log(Logs::General, Logs::None, "Client is successfully connected.");
LogDebug("Client is successfully connected");
break;
};
}
@@ -692,7 +696,7 @@ bool Client::Save(uint8 iCommitNow) {
database.SaveCharacterTribute(this->CharacterID(), &m_pp);
SaveTaskState(); /* Save Character Task */
Log(Logs::General, Logs::Food, "Client::Save - hunger_level: %i thirst_level: %i", m_pp.hunger_level, m_pp.thirst_level);
LogFood("Client::Save - hunger_level: [{}] thirst_level: [{}]", m_pp.hunger_level, m_pp.thirst_level);
// perform snapshot before SaveCharacterData() so that m_epp will contain the updated time
if (RuleB(Character, ActiveInvSnapshots) && time(nullptr) >= GetNextInvSnapshotTime()) {
@@ -766,7 +770,7 @@ bool Client::SendAllPackets() {
if(eqs)
eqs->FastQueuePacket((EQApplicationPacket **)&cp->app, cp->ack_req);
clientpackets.pop_front();
Log(Logs::Moderate, Logs::Client_Server_Packet, "Transmitting a packet");
Log(Logs::Moderate, Logs::PacketClientServer, "Transmitting a packet");
}
return true;
}
@@ -814,7 +818,7 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s
char message[4096];
strn0cpy(message, orig_message, sizeof(message));
Log(Logs::Detail, Logs::Zone_Server, "Client::ChannelMessageReceived() Channel:%i message:'%s'", chan_num, message);
LogDebug("Client::ChannelMessageReceived() Channel:[{}] message:[{}]", chan_num, message);
if (targetname == nullptr) {
targetname = (!GetTarget()) ? "" : GetTarget()->GetName();
@@ -1636,7 +1640,7 @@ void Client::UpdateAdmin(bool iFromDB) {
if(m_pp.gm)
{
Log(Logs::Moderate, Logs::Zone_Server, "%s - %s is a GM", __FUNCTION__ , GetName());
LogInfo("[{}] - [{}] is a GM", __FUNCTION__ , GetName());
// no need for this, having it set in pp you already start as gm
// and it's also set in your spawn packet so other people see it too
// SendAppearancePacket(AT_GM, 1, false);
@@ -2067,7 +2071,7 @@ void Client::ReadBook(BookRequest_Struct *book) {
if (booktxt2[0] != '\0') {
#if EQDEBUG >= 6
Log(Logs::General, Logs::Normal, "Client::ReadBook() textfile:%s Text:%s", txtfile, booktxt2.c_str());
LogInfo("Client::ReadBook() textfile:[{}] Text:[{}]", txtfile, booktxt2.c_str());
#endif
auto outapp = new EQApplicationPacket(OP_ReadBook, length + sizeof(BookText_Struct));
@@ -2287,7 +2291,7 @@ void Client::AddMoneyToPP(uint64 copper, bool updateclient){
SaveCurrency();
Log(Logs::General, Logs::None, "Client::AddMoneyToPP() %s should have: plat:%i gold:%i silver:%i copper:%i", GetName(), m_pp.platinum, m_pp.gold, m_pp.silver, m_pp.copper);
LogDebug("Client::AddMoneyToPP() [{}] should have: plat:[{}] gold:[{}] silver:[{}] copper:[{}]", GetName(), m_pp.platinum, m_pp.gold, m_pp.silver, m_pp.copper);
}
void Client::EVENT_ITEM_ScriptStopReturn(){
@@ -2327,7 +2331,7 @@ void Client::AddMoneyToPP(uint32 copper, uint32 silver, uint32 gold, uint32 plat
SaveCurrency();
#if (EQDEBUG>=5)
Log(Logs::General, Logs::None, "Client::AddMoneyToPP() %s should have: plat:%i gold:%i silver:%i copper:%i",
LogDebug("Client::AddMoneyToPP() [{}] should have: plat:[{}] gold:[{}] silver:[{}] copper:[{}]",
GetName(), m_pp.platinum, m_pp.gold, m_pp.silver, m_pp.copper);
#endif
}
@@ -2419,13 +2423,13 @@ bool Client::CheckIncreaseSkill(EQEmu::skills::SkillType skillid, Mob *against_w
if(zone->random.Real(0, 99) < Chance)
{
SetSkill(skillid, GetRawSkill(skillid) + 1);
Log(Logs::Detail, Logs::Skills, "Skill %d at value %d successfully gain with %d%%chance (mod %d)", skillid, skillval, Chance, chancemodi);
LogSkills("Skill [{}] at value [{}] successfully gain with [{}]% chance (mod [{}])", skillid, skillval, Chance, chancemodi);
return true;
} else {
Log(Logs::Detail, Logs::Skills, "Skill %d at value %d failed to gain with %d%%chance (mod %d)", skillid, skillval, Chance, chancemodi);
LogSkills("Skill [{}] at value [{}] failed to gain with [{}]% chance (mod [{}])", skillid, skillval, Chance, chancemodi);
}
} else {
Log(Logs::Detail, Logs::Skills, "Skill %d at value %d cannot increase due to maxmum %d", skillid, skillval, maxskill);
LogSkills("Skill [{}] at value [{}] cannot increase due to maxmum [{}]", skillid, skillval, maxskill);
}
return false;
}
@@ -2446,10 +2450,10 @@ void Client::CheckLanguageSkillIncrease(uint8 langid, uint8 TeacherSkill) {
if(zone->random.Real(0,100) < Chance) { // if they make the roll
IncreaseLanguageSkill(langid); // increase the language skill by 1
Log(Logs::Detail, Logs::Skills, "Language %d at value %d successfully gain with %.4f%%chance", langid, LangSkill, Chance);
LogSkills("Language [{}] at value [{}] successfully gain with [{}] % chance", langid, LangSkill, Chance);
}
else
Log(Logs::Detail, Logs::Skills, "Language %d at value %d failed to gain with %.4f%%chance", langid, LangSkill, Chance);
LogSkills("Language [{}] at value [{}] failed to gain with [{}] % chance", langid, LangSkill, Chance);
}
}
@@ -2558,7 +2562,7 @@ uint16 Client::GetMaxSkillAfterSpecializationRules(EQEmu::skills::SkillType skil
Save();
Log(Logs::General, Logs::Normal, "Reset %s's caster specialization skills to 1. "
LogInfo("Reset [{}]'s caster specialization skills to 1"
"Too many specializations skills were above 50.", GetCleanName());
}
@@ -2590,7 +2594,7 @@ void Client::SetPVP(bool toggle, bool message) {
void Client::Kick(const std::string &reason) {
client_state = CLIENT_KICKED;
Log(Logs::General, Logs::Client_Login, "Client [%s] kicked, reason [%s]", GetCleanName(), reason.c_str());
LogClientLogin("Client [{}] kicked, reason [{}]", GetCleanName(), reason.c_str());
}
void Client::WorldKick() {
@@ -4915,14 +4919,14 @@ void Client::HandleLDoNOpen(NPC *target)
{
if(target->GetClass() != LDON_TREASURE)
{
Log(Logs::General, Logs::None, "%s tried to open %s but %s was not a treasure chest.",
LogDebug("[{}] tried to open [{}] but [{}] was not a treasure chest",
GetName(), target->GetName(), target->GetName());
return;
}
if(DistanceSquaredNoZ(m_Position, target->GetPosition()) > RuleI(Adventure, LDoNTrapDistanceUse))
{
Log(Logs::General, Logs::None, "%s tried to open %s but %s was out of range",
LogDebug("[{}] tried to open [{}] but [{}] was out of range",
GetName(), target->GetName(), target->GetName());
Message(Chat::Red, "Treasure chest out of range.");
return;
@@ -6234,7 +6238,7 @@ void Client::Doppelganger(uint16 spell_id, Mob *target, const char *name_overrid
PetRecord record;
if(!database.GetPetEntry(spells[spell_id].teleport_zone, &record))
{
Log(Logs::General, Logs::Error, "Unknown doppelganger spell id: %d, check pets table", spell_id);
LogError("Unknown doppelganger spell id: [{}], check pets table", spell_id);
Message(Chat::Red, "Unable to find data for pet %s", spells[spell_id].teleport_zone);
return;
}
@@ -6248,7 +6252,7 @@ void Client::Doppelganger(uint16 spell_id, Mob *target, const char *name_overrid
const NPCType *npc_type = database.LoadNPCTypesData(pet.npc_id);
if(npc_type == nullptr) {
Log(Logs::General, Logs::Error, "Unknown npc type for doppelganger spell id: %d", spell_id);
LogError("Unknown npc type for doppelganger spell id: [{}]", spell_id);
Message(0,"Unable to find pet!");
return;
}
@@ -8359,15 +8363,14 @@ void Client::Consume(const EQEmu::ItemData *item, uint8 type, int16 slot, bool a
m_pp.hunger_level += increase;
Log(Logs::General, Logs::Food, "Consuming food, points added to hunger_level: %i - current_hunger: %i",
increase, m_pp.hunger_level);
LogFood("Consuming food, points added to hunger_level: [{}] - current_hunger: [{}]", increase, m_pp.hunger_level);
DeleteItemInInventory(slot, 1, false);
if (!auto_consume) // no message if the client consumed for us
entity_list.MessageCloseString(this, true, 50, 0, EATING_MESSAGE, GetName(), item->Name);
Log(Logs::General, Logs::Food, "Eating from slot: %i", (int)slot);
LogFood("Eating from slot: [{}]", (int)slot);
} else {
increase = mod_drink_value(item, increase);
@@ -8379,13 +8382,12 @@ void Client::Consume(const EQEmu::ItemData *item, uint8 type, int16 slot, bool a
DeleteItemInInventory(slot, 1, false);
Log(Logs::General, Logs::Food, "Consuming drink, points added to thirst_level: %i current_thirst: %i",
increase, m_pp.thirst_level);
LogFood("Consuming drink, points added to thirst_level: [{}] current_thirst: [{}]", increase, m_pp.thirst_level);
if (!auto_consume) // no message if the client consumed for us
entity_list.MessageCloseString(this, true, 50, 0, DRINKING_MESSAGE, GetName(), item->Name);
Log(Logs::General, Logs::Food, "Drinking from slot: %i", (int)slot);
LogFood("Drinking from slot: [{}]", (int)slot);
}
}
@@ -9134,4 +9136,24 @@ glm::vec4 &Client::GetLastPositionBeforeBulkUpdate()
void Client::SetLastPositionBeforeBulkUpdate(glm::vec4 in_last_position_before_bulk_update)
{
Client::last_position_before_bulk_update = in_last_position_before_bulk_update;
}
}
#ifdef BOTS
bool Client::GetBotOption(BotOwnerOption boo) const {
if (boo < _booCount) {
return bot_owner_options[boo];
}
return false;
}
void Client::SetBotOption(BotOwnerOption boo, bool flag) {
if (boo < _booCount) {
bot_owner_options[boo] = flag;
}
}
#endif
+16 -28
View File
@@ -1399,6 +1399,7 @@ private:
uint32 WID;
uint32 account_id;
char account_name[30];
char loginserver[64];
uint32 lsaccountid;
char lskey[30];
int16 admin;
@@ -1626,39 +1627,26 @@ private:
int client_max_level;
#ifdef BOTS
struct BotOwnerOptions {
bool death_marquee;
bool stats_update;
bool spawn_message_say;
bool spawn_message_tell;
bool spawn_message_class_specific;
};
BotOwnerOptions bot_owner_options;
const BotOwnerOptions DefaultBotOwnerOptions = {
false, // death_marquee
false, // stats_update
false, // spawn_message_say
true, // spawn_message_tell
true // spawn_message_class_specific
};
public:
void SetBotOptionDeathMarquee(bool flag) { bot_owner_options.death_marquee = flag; }
void SetBotOptionStatsUpdate(bool flag) { bot_owner_options.stats_update = flag; }
void SetBotOptionSpawnMessageSay() { bot_owner_options.spawn_message_say = true; bot_owner_options.spawn_message_tell = false; }
void SetBotOptionSpawnMessageTell() { bot_owner_options.spawn_message_say = false; bot_owner_options.spawn_message_tell = true; }
void SetBotOptionSpawnMessageSilent() { bot_owner_options.spawn_message_say = false; bot_owner_options.spawn_message_tell = false; }
void SetBotOptionSpawnMessageClassSpecific(bool flag) { bot_owner_options.spawn_message_class_specific = flag; }
enum BotOwnerOption : size_t {
booDeathMarquee,
booStatsUpdate,
booSpawnMessageSay,
booSpawnMessageTell,
booSpawnMessageClassSpecific,
_booCount
};
bool GetBotOptionDeathMarquee() const { return bot_owner_options.death_marquee; }
bool GetBotOptionStatsUpdate() const { return bot_owner_options.stats_update; }
bool GetBotOptionSpawnMessageSay() const { return bot_owner_options.spawn_message_say; }
bool GetBotOptionSpawnMessageTell() const { return bot_owner_options.spawn_message_tell; }
bool GetBotOptionSpawnMessageClassSpecific() const { return bot_owner_options.spawn_message_class_specific; }
bool GetBotOption(BotOwnerOption boo) const;
void SetBotOption(BotOwnerOption boo, bool flag = true);
private:
bool bot_owner_options[_booCount];
private:
#endif
};
+7 -6
View File
@@ -576,7 +576,7 @@ int32 Client::CalcMaxMana()
break;
}
default: {
Log(Logs::Detail, Logs::Spells, "Invalid Class '%c' in CalcMaxMana", GetCasterClass());
LogSpells("Invalid Class [{}] in CalcMaxMana", GetCasterClass());
max_mana = 0;
break;
}
@@ -594,7 +594,7 @@ int32 Client::CalcMaxMana()
current_mana = curMana_cap;
}
}
Log(Logs::Detail, Logs::Spells, "Client::CalcMaxMana() called for %s - returning %d", GetName(), max_mana);
LogSpells("Client::CalcMaxMana() called for [{}] - returning [{}]", GetName(), max_mana);
return max_mana;
}
@@ -678,13 +678,13 @@ int32 Client::CalcBaseMana()
break;
}
default: {
Log(Logs::General, Logs::None, "Invalid Class '%c' in CalcMaxMana", GetCasterClass());
LogDebug("Invalid Class [{}] in CalcMaxMana", GetCasterClass());
max_m = 0;
break;
}
}
#if EQDEBUG >= 11
Log(Logs::General, Logs::None, "Client::CalcBaseMana() called for %s - returning %d", GetName(), max_m);
LogDebug("Client::CalcBaseMana() called for [{}] - returning [{}]", GetName(), max_m);
#endif
return max_m;
}
@@ -1597,8 +1597,9 @@ uint32 Mob::GetInstrumentMod(uint16 spell_id) const
effectmod = 10;
if (!nocap && effectmod > effectmodcap) // if the cap is calculated to be 0 using new rules, no cap.
effectmod = effectmodcap;
Log(Logs::Detail, Logs::Spells, "%s::GetInstrumentMod() spell=%d mod=%d modcap=%d\n", GetName(), spell_id,
effectmod, effectmodcap);
LogSpells("[{}]::GetInstrumentMod() spell=[{}] mod=[{}] modcap=[{}]\n", GetName(), spell_id, effectmod, effectmodcap);
return effectmod;
}
+320 -361
View File
File diff suppressed because it is too large Load Diff
+23 -27
View File
@@ -241,12 +241,12 @@ bool Client::Process() {
if (RuleB(Character, ActiveInvSnapshots) && time(nullptr) >= GetNextInvSnapshotTime()) {
if (database.SaveCharacterInvSnapshot(CharacterID())) {
SetNextInvSnapshot(RuleI(Character, InvSnapshotMinIntervalM));
Log(Logs::Moderate, Logs::Inventory, "Successful inventory snapshot taken of %s - setting next interval for %i minute%s.",
LogInventory("Successful inventory snapshot taken of [{}] - setting next interval for [{}] minute[{}]",
GetName(), RuleI(Character, InvSnapshotMinIntervalM), (RuleI(Character, InvSnapshotMinIntervalM) == 1 ? "" : "s"));
}
else {
SetNextInvSnapshot(RuleI(Character, InvSnapshotMinRetryM));
Log(Logs::Moderate, Logs::Inventory, "Failed to take inventory snapshot of %s - retrying in %i minute%s.",
LogInventory("Failed to take inventory snapshot of [{}] - retrying in [{}] minute[{}]",
GetName(), RuleI(Character, InvSnapshotMinRetryM), (RuleI(Character, InvSnapshotMinRetryM) == 1 ? "" : "s"));
}
}
@@ -559,11 +559,10 @@ bool Client::Process() {
if (client_state != CLIENT_LINKDEAD && !eqs->CheckState(ESTABLISHED)) {
OnDisconnect(true);
Log(Logs::General, Logs::Zone_Server, "Client linkdead: %s", name);
LogInfo("Client linkdead: {}", name);
if (GetGM()) {
if (GetMerc())
{
if (Admin() > 100) {
if (GetMerc()) {
GetMerc()->Save();
GetMerc()->Depop();
}
@@ -608,7 +607,7 @@ bool Client::Process() {
npc_scan_count++;
}
Log(Logs::General, Logs::Aggro, "Checking Reverse Aggro (client->npc) scanned_npcs (%i)", npc_scan_count);
LogAggro("Checking Reverse Aggro (client->npc) scanned_npcs ([{}])", npc_scan_count);
}
if (client_state != CLIENT_LINKDEAD && (client_state == CLIENT_ERROR || client_state == DISCONNECTED || client_state == CLIENT_KICKED || !eqs->CheckState(ESTABLISHED)))
@@ -710,7 +709,7 @@ void Client::OnDisconnect(bool hard_disconnect) {
Mob *Other = trade->With();
if(Other)
{
Log(Logs::Detail, Logs::Trading, "Client disconnected during a trade. Returning their items.");
LogTrading("Client disconnected during a trade. Returning their items");
FinishTrade(this);
if(Other->IsClient())
@@ -742,7 +741,7 @@ void Client::BulkSendInventoryItems()
if(inst) {
bool is_arrow = (inst->GetItem()->ItemType == EQEmu::item::ItemTypeArrow) ? true : false;
int16 free_slot_id = m_inv.FindFreeSlot(inst->IsClassBag(), true, inst->GetItem()->Size, is_arrow);
Log(Logs::Detail, Logs::Inventory, "Incomplete Trade Transaction: Moving %s from slot %i to %i", inst->GetItem()->Name, slot_id, free_slot_id);
LogInventory("Incomplete Trade Transaction: Moving [{}] from slot [{}] to [{}]", inst->GetItem()->Name, slot_id, free_slot_id);
PutItemInInventory(free_slot_id, *inst, false);
database.SaveInventory(character_id, nullptr, slot_id);
safe_delete(inst);
@@ -771,7 +770,7 @@ void Client::BulkSendInventoryItems()
inst->Serialize(ob, slot_id);
if (ob.tellp() == last_pos)
Log(Logs::General, Logs::Inventory, "Serialization failed on item slot %d during BulkSendInventoryItems. Item skipped.", slot_id);
LogInventory("Serialization failed on item slot [{}] during BulkSendInventoryItems. Item skipped", slot_id);
last_pos = ob.tellp();
}
@@ -785,7 +784,7 @@ void Client::BulkSendInventoryItems()
inst->Serialize(ob, slot_id);
if (ob.tellp() == last_pos)
Log(Logs::General, Logs::Inventory, "Serialization failed on item slot %d during BulkSendInventoryItems. Item skipped.", slot_id);
LogInventory("Serialization failed on item slot [{}] during BulkSendInventoryItems. Item skipped", slot_id);
last_pos = ob.tellp();
}
@@ -799,7 +798,7 @@ void Client::BulkSendInventoryItems()
inst->Serialize(ob, slot_id);
if (ob.tellp() == last_pos)
Log(Logs::General, Logs::Inventory, "Serialization failed on item slot %d during BulkSendInventoryItems. Item skipped.", slot_id);
LogInventory("Serialization failed on item slot [{}] during BulkSendInventoryItems. Item skipped", slot_id);
last_pos = ob.tellp();
}
@@ -887,7 +886,7 @@ void Client::BulkSendMerchantInventory(int merchant_id, int npcid) {
// Account for merchant lists with gaps.
if (ml.slot >= i) {
if (ml.slot > i)
Log(Logs::General, Logs::None, "(WARNING) Merchantlist contains gap at slot %d. Merchant: %d, NPC: %d", i, merchant_id, npcid);
LogDebug("(WARNING) Merchantlist contains gap at slot [{}]. Merchant: [{}], NPC: [{}]", i, merchant_id, npcid);
i = ml.slot + 1;
}
}
@@ -977,7 +976,7 @@ uint8 Client::WithCustomer(uint16 NewCustomer){
Client* c = entity_list.GetClientByID(CustomerID);
if(!c) {
Log(Logs::Detail, Logs::Trading, "Previous customer has gone away.");
LogTrading("Previous customer has gone away");
CustomerID = NewCustomer;
return 1;
}
@@ -989,7 +988,7 @@ void Client::OPRezzAnswer(uint32 Action, uint32 SpellID, uint16 ZoneID, uint16 I
{
if(PendingRezzXP < 0) {
// pendingrezexp is set to -1 if we are not expecting an OP_RezzAnswer
Log(Logs::Detail, Logs::Spells, "Unexpected OP_RezzAnswer. Ignoring it.");
LogSpells("Unexpected OP_RezzAnswer. Ignoring it");
Message(Chat::Red, "You have already been resurrected.\n");
return;
}
@@ -999,7 +998,7 @@ void Client::OPRezzAnswer(uint32 Action, uint32 SpellID, uint16 ZoneID, uint16 I
// Mark the corpse as rezzed in the database, just in case the corpse has buried, or the zone the
// corpse is in has shutdown since the rez spell was cast.
database.MarkCorpseAsRezzed(PendingRezzDBID);
Log(Logs::Detail, Logs::Spells, "Player %s got a %i Rezz, spellid %i in zone%i, instance id %i",
LogSpells("Player [{}] got a [{}] Rezz, spellid [{}] in zone[{}], instance id [{}]",
this->name, (uint16)spells[SpellID].base[0],
SpellID, ZoneID, InstanceID);
@@ -1053,7 +1052,7 @@ void Client::OPMemorizeSpell(const EQApplicationPacket* app)
{
if(app->size != sizeof(MemorizeSpell_Struct))
{
Log(Logs::General, Logs::Error, "Wrong size on OP_MemorizeSpell. Got: %i, Expected: %i", app->size, sizeof(MemorizeSpell_Struct));
LogError("Wrong size on OP_MemorizeSpell. Got: [{}], Expected: [{}]", app->size, sizeof(MemorizeSpell_Struct));
DumpPacket(app);
return;
}
@@ -1612,12 +1611,12 @@ void Client::OPGMTrainSkill(const EQApplicationPacket *app)
EQEmu::skills::SkillType skill = (EQEmu::skills::SkillType)gmskill->skill_id;
if(!CanHaveSkill(skill)) {
Log(Logs::Detail, Logs::Skills, "Tried to train skill %d, which is not allowed.", skill);
LogSkills("Tried to train skill [{}], which is not allowed", skill);
return;
}
if(MaxSkill(skill) == 0) {
Log(Logs::Detail, Logs::Skills, "Tried to train skill %d, but training is not allowed at this level.", skill);
LogSkills("Tried to train skill [{}], but training is not allowed at this level", skill);
return;
}
@@ -1802,8 +1801,7 @@ void Client::DoStaminaHungerUpdate()
auto outapp = new EQApplicationPacket(OP_Stamina, sizeof(Stamina_Struct));
Stamina_Struct *sta = (Stamina_Struct *)outapp->pBuffer;
Log(Logs::General, Logs::Food, "Client::DoStaminaHungerUpdate() hunger_level: %i thirst_level: %i before loss",
m_pp.hunger_level, m_pp.thirst_level);
LogFood("Client::DoStaminaHungerUpdate() hunger_level: [{}] thirst_level: [{}] before loss", m_pp.hunger_level, m_pp.thirst_level);
if (zone->GetZoneID() != 151 && !GetGM()) {
int loss = RuleI(Character, FoodLossPerUpdate);
@@ -1824,9 +1822,7 @@ void Client::DoStaminaHungerUpdate()
sta->water = 6000;
}
Log(Logs::General, Logs::Food,
"Client::DoStaminaHungerUpdate() Current hunger_level: %i = (%i minutes left) thirst_level: %i = (%i "
"minutes left) - after loss",
LogFood("Client::DoStaminaHungerUpdate() Current hunger_level: [{}] = ([{}] minutes left) thirst_level: [{}] = ([{}] minutes left) - after loss",
m_pp.hunger_level, m_pp.hunger_level, m_pp.thirst_level, m_pp.thirst_level);
FastQueuePacket(&outapp);
@@ -2005,7 +2001,7 @@ void Client::HandleRespawnFromHover(uint32 Option)
{
if (PendingRezzXP < 0 || PendingRezzSpellID == 0)
{
Log(Logs::Detail, Logs::Spells, "Unexpected Rezz from hover request.");
LogSpells("Unexpected Rezz from hover request");
return;
}
SetHP(GetMaxHP() / 5);
@@ -2039,10 +2035,10 @@ void Client::HandleRespawnFromHover(uint32 Option)
if (corpse && corpse->IsCorpse())
{
Log(Logs::Detail, Logs::Spells, "Hover Rez in zone %s for corpse %s",
LogSpells("Hover Rez in zone [{}] for corpse [{}]",
zone->GetShortName(), PendingRezzCorpseName.c_str());
Log(Logs::Detail, Logs::Spells, "Found corpse. Marking corpse as rezzed.");
LogSpells("Found corpse. Marking corpse as rezzed");
corpse->IsRezzed(true);
corpse->CompleteResurrection();
+215 -69
View File
@@ -182,6 +182,7 @@ int command_init(void)
command_add("crashtest", "- Crash the zoneserver", 255, command_crashtest) ||
command_add("cvs", "- Summary of client versions currently online.", 200, command_cvs) ||
command_add("damage", "[amount] - Damage your target", 100, command_damage) ||
command_add("databuckets", "View|Delete [key] [limit]- View data buckets, limit 50 default or Delete databucket by key", 80, command_databuckets) ||
command_add("date", "[yyyy] [mm] [dd] [HH] [MM] - Set EQ time", 90, command_date) ||
command_add("dbspawn2", "[spawngroup] [respawn] [variance] - Spawn an NPC from a predefined row in the spawn2 table", 100, command_dbspawn2) ||
command_add("delacct", "[accountname] - Delete an account", 150, command_delacct) ||
@@ -453,33 +454,90 @@ int command_init(void)
std::map<std::string, std::pair<uint8, std::vector<std::string>>> command_settings;
database.GetCommandSettings(command_settings);
std::map<std::string, CommandRecord *> working_cl = commandlist;
for (auto iter_cl = working_cl.begin(); iter_cl != working_cl.end(); ++iter_cl) {
auto iter_cs = command_settings.find(iter_cl->first);
if (iter_cs == command_settings.end()) {
if (iter_cl->second->access == 0)
Log(Logs::General, Logs::Commands, "command_init(): Warning: Command '%s' defaulting to access level 0!", iter_cl->first.c_str());
std::vector<std::pair<std::string, uint8>> injected_command_settings;
std::vector<std::string> orphaned_command_settings;
for (auto cs_iter : command_settings) {
auto cl_iter = commandlist.find(cs_iter.first);
if (cl_iter == commandlist.end()) {
orphaned_command_settings.push_back(cs_iter.first);
LogInfo(
"Command [{}] no longer exists... Deleting orphaned entry from `command_settings` table...",
cs_iter.first.c_str()
);
}
}
if (orphaned_command_settings.size()) {
if (!database.UpdateOrphanedCommandSettings(orphaned_command_settings)) {
LogInfo("Failed to process 'Orphaned Commands' update operation.");
}
}
auto working_cl = commandlist;
for (auto working_cl_iter : working_cl) {
auto cs_iter = command_settings.find(working_cl_iter.first);
if (cs_iter == command_settings.end()) {
injected_command_settings.push_back(std::pair<std::string, uint8>(working_cl_iter.first, working_cl_iter.second->access));
LogInfo(
"New Command [{}] found... Adding to `command_settings` table with access [{}]...",
working_cl_iter.first.c_str(),
working_cl_iter.second->access
);
if (working_cl_iter.second->access == 0) {
LogCommands(
"command_init(): Warning: Command [{}] defaulting to access level 0!",
working_cl_iter.first.c_str()
);
}
continue;
}
iter_cl->second->access = iter_cs->second.first;
Log(Logs::General, Logs::Commands, "command_init(): - Command '%s' set to access level %d.", iter_cl->first.c_str(), iter_cs->second.first);
if (iter_cs->second.second.empty())
working_cl_iter.second->access = cs_iter->second.first;
LogCommands(
"command_init(): - Command [{}] set to access level [{}]",
working_cl_iter.first.c_str(),
cs_iter->second.first
);
if (cs_iter->second.second.empty()) {
continue;
}
for (auto iter_aka = iter_cs->second.second.begin(); iter_aka != iter_cs->second.second.end();
++iter_aka) {
if (iter_aka->empty())
continue;
if (commandlist.find(*iter_aka) != commandlist.end()) {
Log(Logs::General, Logs::Commands, "command_init(): Warning: Alias '%s' already exists as a command - skipping!", iter_aka->c_str());
for (auto alias_iter : cs_iter->second.second) {
if (alias_iter.empty()) {
continue;
}
commandlist[*iter_aka] = iter_cl->second;
commandaliases[*iter_aka] = iter_cl->first;
if (commandlist.find(alias_iter) != commandlist.end()) {
LogCommands(
"command_init(): Warning: Alias [{}] already exists as a command - skipping!",
alias_iter.c_str()
);
continue;
}
Log(Logs::General, Logs::Commands, "command_init(): - Alias '%s' added to command '%s'.", iter_aka->c_str(), commandaliases[*iter_aka].c_str());
commandlist[alias_iter] = working_cl_iter.second;
commandaliases[alias_iter] = working_cl_iter.first;
LogCommands(
"command_init(): - Alias [{}] added to command [{}]",
alias_iter.c_str(),
commandaliases[alias_iter].c_str()
);
}
}
if (injected_command_settings.size()) {
if (!database.UpdateInjectedCommandSettings(injected_command_settings)) {
LogInfo("Failed to process 'Injected Commands' update operation.");
}
}
@@ -519,21 +577,21 @@ void command_deinit(void)
int command_add(std::string command_name, const char *desc, int access, CmdFuncPtr function)
{
if (command_name.empty()) {
Log(Logs::General, Logs::Error, "command_add() - Command added with empty name string - check command.cpp.");
LogError("command_add() - Command added with empty name string - check command.cpp");
return -1;
}
if (function == nullptr) {
Log(Logs::General, Logs::Error, "command_add() - Command '%s' added without a valid function pointer - check command.cpp.", command_name.c_str());
LogError("command_add() - Command [{}] added without a valid function pointer - check command.cpp", command_name.c_str());
return -1;
}
if (commandlist.count(command_name) != 0) {
Log(Logs::General, Logs::Error, "command_add() - Command '%s' is a duplicate command name - check command.cpp.", command_name.c_str());
LogError("command_add() - Command [{}] is a duplicate command name - check command.cpp", command_name.c_str());
return -1;
}
for (auto iter = commandlist.begin(); iter != commandlist.end(); ++iter) {
if (iter->second->function != function)
continue;
Log(Logs::General, Logs::Error, "command_add() - Command '%s' equates to an alias of '%s' - check command.cpp.", command_name.c_str(), iter->first.c_str());
LogError("command_add() - Command [{}] equates to an alias of [{}] - check command.cpp", command_name.c_str(), iter->first.c_str());
return -1;
}
@@ -587,11 +645,11 @@ int command_realdispatch(Client *c, const char *message)
}
if(cur->access >= COMMANDS_LOGGING_MIN_STATUS) {
Log(Logs::General, Logs::Commands, "%s (%s) used command: %s (target=%s)", c->GetName(), c->AccountName(), message, c->GetTarget()?c->GetTarget()->GetName():"NONE");
LogCommands("[{}] ([{}]) used command: [{}] (target=[{}])", c->GetName(), c->AccountName(), message, c->GetTarget()?c->GetTarget()->GetName():"NONE");
}
if(cur->function == nullptr) {
Log(Logs::General, Logs::Error, "Command '%s' has a null function\n", cstr.c_str());
LogError("Command [{}] has a null function\n", cstr.c_str());
return(-1);
} else {
//dispatch C++ command
@@ -1376,7 +1434,7 @@ void command_viewpetition(Client *c, const Seperator *sep)
if (!results.Success())
return;
Log(Logs::General, Logs::Normal, "View petition request from %s, petition number: %i", c->GetName(), atoi(sep->argplus[1]) );
LogInfo("View petition request from [{}], petition number: [{}]", c->GetName(), atoi(sep->argplus[1]) );
if (results.RowCount() == 0) {
c->Message(Chat::Red,"There was an error in your request: ID not found! Please check the Id and try again.");
@@ -1401,7 +1459,7 @@ void command_petitioninfo(Client *c, const Seperator *sep)
if (!results.Success())
return;
Log(Logs::General, Logs::Normal, "Petition information request from %s, petition number:", c->GetName(), atoi(sep->argplus[1]) );
LogInfo("Petition information request from [{}], petition number:", c->GetName(), atoi(sep->argplus[1]) );
if (results.RowCount() == 0) {
c->Message(Chat::Red,"There was an error in your request: ID not found! Please check the Id and try again.");
@@ -1427,7 +1485,7 @@ void command_delpetition(Client *c, const Seperator *sep)
if (!results.Success())
return;
Log(Logs::General, Logs::Normal, "Delete petition request from %s, petition number:", c->GetName(), atoi(sep->argplus[1]) );
LogInfo("Delete petition request from [{}], petition number:", c->GetName(), atoi(sep->argplus[1]) );
}
@@ -1913,7 +1971,7 @@ void command_permaclass(Client *c, const Seperator *sep)
c->Message(Chat::White,"Target is not a client.");
else {
c->Message(Chat::White, "Setting %s's class...Sending to char select.", t->GetName());
Log(Logs::General, Logs::Normal, "Class change request from %s for %s, requested class:%i", c->GetName(), t->GetName(), atoi(sep->arg[1]) );
LogInfo("Class change request from [{}] for [{}], requested class:[{}]", c->GetName(), t->GetName(), atoi(sep->arg[1]) );
t->SetBaseClass(atoi(sep->arg[1]));
t->Save();
t->Kick("Class was changed.");
@@ -1935,7 +1993,7 @@ void command_permarace(Client *c, const Seperator *sep)
c->Message(Chat::White,"Target is not a client.");
else {
c->Message(Chat::White, "Setting %s's race - zone to take effect", t->GetName());
Log(Logs::General, Logs::Normal, "Permanant race change request from %s for %s, requested race:%i", c->GetName(), t->GetName(), atoi(sep->arg[1]) );
LogInfo("Permanant race change request from [{}] for [{}], requested race:[{}]", c->GetName(), t->GetName(), atoi(sep->arg[1]) );
uint32 tmp = Mob::GetDefaultGender(atoi(sep->arg[1]), t->GetBaseGender());
t->SetBaseRace(atoi(sep->arg[1]));
t->SetBaseGender(tmp);
@@ -1959,7 +2017,7 @@ void command_permagender(Client *c, const Seperator *sep)
c->Message(Chat::White,"Target is not a client.");
else {
c->Message(Chat::White, "Setting %s's gender - zone to take effect", t->GetName());
Log(Logs::General, Logs::Normal, "Permanant gender change request from %s for %s, requested gender:%i", c->GetName(), t->GetName(), atoi(sep->arg[1]) );
LogInfo("Permanant gender change request from [{}] for [{}], requested gender:[{}]", c->GetName(), t->GetName(), atoi(sep->arg[1]) );
t->SetBaseGender(atoi(sep->arg[1]));
t->Save();
t->SendIllusionPacket(atoi(sep->arg[1]));
@@ -2298,7 +2356,7 @@ void command_dbspawn2(Client *c, const Seperator *sep)
{
if (sep->IsNumber(1) && sep->IsNumber(2) && sep->IsNumber(3)) {
Log(Logs::General, Logs::Normal, "Spawning database spawn");
LogInfo("Spawning database spawn");
uint16 cond = 0;
int16 cond_min = 0;
if(sep->IsNumber(4)) {
@@ -2320,13 +2378,18 @@ void command_shutdown(Client *c, const Seperator *sep)
void command_delacct(Client *c, const Seperator *sep)
{
if(sep->arg[1][0] == 0)
if (sep->arg[1][0] == 0)
c->Message(Chat::White, "Format: #delacct accountname");
else
if (database.DeleteAccount(sep->arg[1]))
else {
std::string user;
std::string loginserver;
ParseAccountString(sep->arg[1], user, loginserver);
if (database.DeleteAccount(user.c_str(), loginserver.c_str()))
c->Message(Chat::White, "The account was deleted.");
else
c->Message(Chat::White, "Unable to delete account.");
}
}
void command_setpass(Client *c, const Seperator *sep)
@@ -2334,8 +2397,12 @@ void command_setpass(Client *c, const Seperator *sep)
if(sep->argnum != 2)
c->Message(Chat::White, "Format: #setpass accountname password");
else {
std::string user;
std::string loginserver;
ParseAccountString(sep->arg[1], user, loginserver);
int16 tmpstatus = 0;
uint32 tmpid = database.GetAccountIDByName(sep->arg[1], &tmpstatus);
uint32 tmpid = database.GetAccountIDByName(user.c_str(), loginserver.c_str(), &tmpstatus);
if (!tmpid)
c->Message(Chat::White, "Error: Account not found");
else if (tmpstatus > c->Admin())
@@ -2356,7 +2423,7 @@ void command_setlsinfo(Client *c, const Seperator *sep)
ServerLSAccountUpdate_Struct* s = (ServerLSAccountUpdate_Struct *) pack->pBuffer;
s->useraccountid = c->LSAccountID();
strn0cpy(s->useraccount, c->AccountName(), 30);
strn0cpy(s->useremail, sep->arg[1], 100);
strn0cpy(s->user_email, sep->arg[1], 100);
strn0cpy(s->userpassword, sep->arg[2], 50);
worldserver.SendPacket(pack);
c->Message(Chat::White, "Login Server update packet sent.");
@@ -2698,7 +2765,7 @@ void command_setlanguage(Client *c, const Seperator *sep)
}
else
{
Log(Logs::General, Logs::Normal, "Set language request from %s, target:%s lang_id:%i value:%i", c->GetName(), c->GetTarget()->GetName(), atoi(sep->arg[1]), atoi(sep->arg[2]) );
LogInfo("Set language request from [{}], target:[{}] lang_id:[{}] value:[{}]", c->GetName(), c->GetTarget()->GetName(), atoi(sep->arg[1]), atoi(sep->arg[2]) );
uint8 langid = (uint8)atoi(sep->arg[1]);
uint8 value = (uint8)atoi(sep->arg[2]);
c->GetTarget()->CastToClient()->SetLanguageSkill( langid, value );
@@ -2723,7 +2790,7 @@ void command_setskill(Client *c, const Seperator *sep)
c->Message(Chat::White, " x = 0 to %d", HIGHEST_CAN_SET_SKILL);
}
else {
Log(Logs::General, Logs::Normal, "Set skill request from %s, target:%s skill_id:%i value:%i", c->GetName(), c->GetTarget()->GetName(), atoi(sep->arg[1]), atoi(sep->arg[2]) );
LogInfo("Set skill request from [{}], target:[{}] skill_id:[{}] value:[{}]", c->GetName(), c->GetTarget()->GetName(), atoi(sep->arg[1]), atoi(sep->arg[2]) );
int skill_num = atoi(sep->arg[1]);
uint16 skill_value = atoi(sep->arg[2]);
if (skill_num <= EQEmu::skills::HIGHEST_SKILL)
@@ -2743,7 +2810,7 @@ void command_setskillall(Client *c, const Seperator *sep)
}
else {
if (c->Admin() >= commandSetSkillsOther || c->GetTarget()==c || c->GetTarget()==0) {
Log(Logs::General, Logs::Normal, "Set ALL skill request from %s, target:%s", c->GetName(), c->GetTarget()->GetName());
LogInfo("Set ALL skill request from [{}], target:[{}]", c->GetName(), c->GetTarget()->GetName());
uint16 level = atoi(sep->arg[1]);
for (EQEmu::skills::SkillType skill_num = EQEmu::skills::Skill1HBlunt; skill_num <= EQEmu::skills::HIGHEST_SKILL; skill_num = (EQEmu::skills::SkillType)(skill_num + 1)) {
c->GetTarget()->CastToClient()->SetSkill(skill_num, level);
@@ -4141,7 +4208,7 @@ void command_listpetition(Client *c, const Seperator *sep)
if (!results.Success())
return;
Log(Logs::General, Logs::Normal, "Petition list requested by %s", c->GetName());
LogInfo("Petition list requested by [{}]", c->GetName());
if (results.RowCount() == 0)
return;
@@ -4875,7 +4942,7 @@ void command_lastname(Client *c, const Seperator *sep)
if(c->GetTarget() && c->GetTarget()->IsClient())
t=c->GetTarget()->CastToClient();
Log(Logs::General, Logs::Normal, "#lastname request from %s for %s", c->GetName(), t->GetName());
LogInfo("#lastname request from [{}] for [{}]", c->GetName(), t->GetName());
if(strlen(sep->arg[1]) <= 70)
t->ChangeLastName(sep->arg[1]);
@@ -5701,7 +5768,7 @@ void command_iteminfo(Client *c, const Seperator *sep)
}
auto item = inst->GetItem();
if (!item) {
Log(Logs::General, Logs::Inventory, "(%s) Command #iteminfo processed an item with no data pointer");
LogInventory("([{}]) Command #iteminfo processed an item with no data pointer");
c->Message(Chat::Red, "Error: This item has no data reference");
return;
}
@@ -5773,8 +5840,8 @@ void command_flag(Client *c, const Seperator *sep)
c->Message(Chat::White, "Usage: #flag [status] [acctname]");
else if (c->Admin() < commandChangeFlags) {
//this check makes banning players by less than this level
//impossible, but i'll leave it in anyways
//this check makes banning players by less than this level
//impossible, but i'll leave it in anyways
c->Message(Chat::White, "You may only refresh your own flag, doing so now.");
c->UpdateAdmin();
}
@@ -5787,11 +5854,15 @@ void command_flag(Client *c, const Seperator *sep)
c->Message(Chat::White, "Unable to set GM Flag.");
else {
c->Message(Chat::White, "Set GM Flag on account.");
auto pack = new ServerPacket(ServerOP_FlagUpdate, 6);
*((uint32*) pack->pBuffer) = database.GetAccountIDByName(sep->argplus[2]);
*((int16*) &pack->pBuffer[4]) = atoi(sep->arg[1]);
worldserver.SendPacket(pack);
delete pack;
std::string user;
std::string loginserver;
ParseAccountString(sep->argplus[2], user, loginserver);
ServerPacket pack(ServerOP_FlagUpdate, 6);
*((uint32*) pack.pBuffer) = database.GetAccountIDByName(user.c_str(), loginserver.c_str());
*((int16*) &pack.pBuffer[4]) = atoi(sep->arg[1]);
worldserver.SendPacket(&pack);
}
}
}
@@ -5806,7 +5877,7 @@ void command_time(Client *c, const Seperator *sep)
}
c->Message(Chat::Red, "Setting world time to %s:%i (Timezone: 0)...", sep->arg[1], minutes);
zone->SetTime(atoi(sep->arg[1])+1, minutes);
Log(Logs::General, Logs::Zone_Server, "%s :: Setting world time to %s:%i (Timezone: 0)...", c->GetCleanName(), sep->arg[1], minutes);
LogInfo("{} :: Setting world time to {}:{} (Timezone: 0)...", c->GetCleanName(), sep->arg[1], minutes);
}
else {
c->Message(Chat::Red, "To set the Time: #time HH [MM]");
@@ -5821,7 +5892,7 @@ void command_time(Client *c, const Seperator *sep)
zone->zone_time.getEQTimeZoneMin()
);
c->Message(Chat::Red, "It is now %s.", timeMessage);
Log(Logs::General, Logs::Zone_Server, "Current Time is: %s", timeMessage);
LogInfo("Current Time is: {}", timeMessage);
}
}
@@ -5955,12 +6026,9 @@ void command_guild(Client *c, const Seperator *sep)
}
if(guild_id == GUILD_NONE) {
Log(Logs::Detail, Logs::Guilds, "%s: Removing %s (%d) from guild with GM command.", c->GetName(),
sep->arg[2], charid);
LogGuilds("[{}]: Removing [{}] ([{}]) from guild with GM command", c->GetName(), sep->arg[2], charid);
} else {
Log(Logs::Detail, Logs::Guilds, "%s: Putting %s (%d) into guild %s (%d) with GM command.", c->GetName(),
sep->arg[2], charid,
guild_mgr.GetGuildName(guild_id), guild_id);
LogGuilds("[{}]: Putting [{}] ([{}]) into guild [{}] ([{}]) with GM command", c->GetName(), sep->arg[2], charid, guild_mgr.GetGuildName(guild_id), guild_id);
}
if(!guild_mgr.SetGuild(charid, guild_id, GUILD_MEMBER)) {
@@ -6007,8 +6075,7 @@ void command_guild(Client *c, const Seperator *sep)
return;
}
Log(Logs::Detail, Logs::Guilds, "%s: Setting %s (%d)'s guild rank to %d with GM command.", c->GetName(),
sep->arg[2], charid, rank);
LogGuilds("[{}]: Setting [{}] ([{}])'s guild rank to [{}] with GM command", c->GetName(), sep->arg[2], charid, rank);
if(!guild_mgr.SetGuildRank(charid, rank))
c->Message(Chat::Red, "Error while setting rank %d on '%s'.", rank, sep->arg[2]);
@@ -6049,7 +6116,7 @@ void command_guild(Client *c, const Seperator *sep)
uint32 id = guild_mgr.CreateGuild(sep->argplus[3], leader);
Log(Logs::Detail, Logs::Guilds, "%s: Creating guild %s with leader %d with GM command. It was given id %lu.", c->GetName(),
LogGuilds("[{}]: Creating guild [{}] with leader [{}] with GM command. It was given id [{}]", c->GetName(),
sep->argplus[3], leader, (unsigned long)id);
if (id == GUILD_NONE)
@@ -6088,7 +6155,7 @@ void command_guild(Client *c, const Seperator *sep)
}
}
Log(Logs::Detail, Logs::Guilds, "%s: Deleting guild %s (%d) with GM command.", c->GetName(),
LogGuilds("[{}]: Deleting guild [{}] ([{}]) with GM command", c->GetName(),
guild_mgr.GetGuildName(id), id);
if (!guild_mgr.DeleteGuild(id))
@@ -6122,7 +6189,7 @@ void command_guild(Client *c, const Seperator *sep)
}
}
Log(Logs::Detail, Logs::Guilds, "%s: Renaming guild %s (%d) to '%s' with GM command.", c->GetName(),
LogGuilds("[{}]: Renaming guild [{}] ([{}]) to [{}] with GM command", c->GetName(),
guild_mgr.GetGuildName(id), id, sep->argplus[3]);
if (!guild_mgr.RenameGuild(id, sep->argplus[3]))
@@ -6173,7 +6240,7 @@ void command_guild(Client *c, const Seperator *sep)
}
}
Log(Logs::Detail, Logs::Guilds, "%s: Setting leader of guild %s (%d) to %d with GM command.", c->GetName(),
LogGuilds("[{}]: Setting leader of guild [{}] ([{}]) to [{}] with GM command", c->GetName(),
guild_mgr.GetGuildName(id), id, leader);
if(!guild_mgr.SetGuildLeader(id, leader))
@@ -6628,7 +6695,7 @@ void command_scribespells(Client *c, const Seperator *sep)
t->Message(Chat::White, "Scribing spells to spellbook.");
if(t != c)
c->Message(Chat::White, "Scribing spells for %s.", t->GetName());
Log(Logs::General, Logs::Normal, "Scribe spells request for %s from %s, levels: %u -> %u", t->GetName(), c->GetName(), min_level, max_level);
LogInfo("Scribe spells request for [{}] from [{}], levels: [{}] -> [{}]", t->GetName(), c->GetName(), min_level, max_level);
int book_slot = t->GetNextAvailableSpellBookSlot();
int spell_id = 0;
@@ -6722,7 +6789,7 @@ void command_scribespell(Client *c, const Seperator *sep) {
if(t != c)
c->Message(Chat::White, "Scribing spell: %s (%i) for %s.", spells[spell_id].name, spell_id, t->GetName());
Log(Logs::General, Logs::Normal, "Scribe spell: %s (%i) request for %s from %s.", spells[spell_id].name, spell_id, t->GetName(), c->GetName());
LogInfo("Scribe spell: [{}] ([{}]) request for [{}] from [{}]", spells[spell_id].name, spell_id, t->GetName(), c->GetName());
if (spells[spell_id].classes[WARRIOR] != 0 && spells[spell_id].skill != 52 && spells[spell_id].classes[t->GetPP().class_ - 1] > 0 && !IsDiscipline(spell_id)) {
book_slot = t->GetNextAvailableSpellBookSlot();
@@ -6769,7 +6836,7 @@ void command_unscribespell(Client *c, const Seperator *sep) {
if(t != c)
c->Message(Chat::White, "Unscribing spell: %s (%i) for %s.", spells[spell_id].name, spell_id, t->GetName());
Log(Logs::General, Logs::Normal, "Unscribe spell: %s (%i) request for %s from %s.", spells[spell_id].name, spell_id, t->GetName(), c->GetName());
LogInfo("Unscribe spell: [{}] ([{}]) request for [{}] from [{}]", spells[spell_id].name, spell_id, t->GetName(), c->GetName());
}
else {
t->Message(Chat::Red, "Unable to unscribe spell: %s (%i) from your spellbook. This spell is not scribed.", spells[spell_id].name, spell_id);
@@ -8510,7 +8577,7 @@ void command_ucs(Client *c, const Seperator *sep)
if (!c)
return;
Log(Logs::Detail, Logs::UCS_Server, "Character %s attempting ucs reconnect while ucs server is %savailable",
LogInfo("Character [{}] attempting ucs reconnect while ucs server is [{}] available",
c->GetName(), (zone->IsUCSServerAvailable() ? "" : "un"));
if (zone->IsUCSServerAvailable()) {
@@ -9255,7 +9322,7 @@ void command_traindisc(Client *c, const Seperator *sep)
t->Message(Chat::White, "Training disciplines");
if(t != c)
c->Message(Chat::White, "Training disciplines for %s.", t->GetName());
Log(Logs::General, Logs::Normal, "Train disciplines request for %s from %s, levels: %u -> %u", t->GetName(), c->GetName(), min_level, max_level);
LogInfo("Train disciplines request for [{}] from [{}], levels: [{}] -> [{}]", t->GetName(), c->GetName(), min_level, max_level);
int spell_id = 0;
int count = 0;
@@ -12201,7 +12268,7 @@ void command_logtest(Client *c, const Seperator *sep){
uint32 i = 0;
t = std::clock();
for (i = 0; i < atoi(sep->arg[1]); i++){
Log(Logs::General, Logs::Debug, "[%u] Test #2... Took %f seconds", i, ((float)(std::clock() - t)) / CLOCKS_PER_SEC);
LogDebug("[[{}]] Test #2 Took [{}] seconds", i, ((float)(std::clock() - t)) / CLOCKS_PER_SEC);
}
}
@@ -12299,7 +12366,7 @@ void command_mysqltest(Client *c, const Seperator *sep)
auto results = database.QueryDatabase(query);
}
}
Log(Logs::General, Logs::Debug, "MySQL Test... Took %f seconds", ((float)(std::clock() - t)) / CLOCKS_PER_SEC);
LogDebug("MySQL Test Took [{}] seconds", ((float)(std::clock() - t)) / CLOCKS_PER_SEC);
}
void command_resetaa_timer(Client *c, const Seperator *sep) {
@@ -12574,6 +12641,85 @@ void command_scale(Client *c, const Seperator *sep)
}
}
void command_databuckets(Client *c, const Seperator *sep)
{
if (sep->arg[1][0] == 0) {
c->Message(Chat::Yellow, "Usage: #databuckets view (partial key)|(limit) OR #databuckets delete (key)");
return;
}
if (strcasecmp(sep->arg[1], "view") == 0) {
std::string key_filter;
uint8 limit = 50;
for (int i = 2; i < 4; i++) {
if (sep->arg[i][0] == '\0')
break;
if (strcasecmp(sep->arg[i], "limit") == 0) {
limit = (uint8)atoi(sep->arg[i + 1]);
continue;
}
}
if (sep->arg[2]) {
key_filter = str_tolower(sep->arg[2]);
}
std::string query = "SELECT `id`, `key`, `value`, `expires` FROM data_buckets";
if (!key_filter.empty()) query += StringFormat(" WHERE `key` LIKE '%%%s%%'", key_filter.c_str());
query += StringFormat(" LIMIT %u", limit);
auto results = database.QueryDatabase(query);
if (!results.Success())
return;
if (results.RowCount() == 0) {
c->Message(Chat::Yellow, "No data_buckets found");
return;
}
int _ctr = 0;
// put in window for easier readability in case want command line for something else
std::string window_title = "Data Buckets";
std::string window_text =
"<table>"
"<tr>"
"<td>ID</td>"
"<td>Expires</td>"
"<td>Key</td>"
"<td>Value</td>"
"</tr>";
for (auto row = results.begin(); row != results.end(); ++row) {
auto id = static_cast<uint32>(atoi(row[0]));
std::string key = row[1];
std::string value = row[2];
std::string expires = row[3];
window_text.append(StringFormat(
"<tr>"
"<td>%u</td>"
"<td>%s</td>"
"<td>%s</td>"
"<td>%s</td>"
"</tr>",
id,
expires.c_str(),
key.c_str(),
value.c_str()
));
_ctr++;
std::string del_saylink = StringFormat("#databuckets delete %s", key.c_str());
c->Message(Chat::White, "%s : %s",
EQEmu::SayLinkEngine::GenerateQuestSaylink(del_saylink, false, "Delete").c_str(), key.c_str(), " Value: ", value.c_str());
}
window_text.append("</table>");
c->SendPopupToClient(window_title.c_str(), window_text.c_str());
std::string response = _ctr > 0 ? StringFormat("Found %i matching data buckets", _ctr).c_str() : "No Databuckets found.";
c->Message(Chat::Yellow, response.c_str());
}
else if (strcasecmp(sep->arg[1], "delete") == 0)
{
if (DataBucket::DeleteData(sep->argplus[2]))
c->Message(Chat::Yellow, "data bucket %s deleted.", sep->argplus[2]);
else
c->Message(Chat::Red, "An error occurred deleting data bucket %s", sep->argplus[2]);
return;
}
}
void command_who(Client *c, const Seperator *sep)
{
std::string query =
+1
View File
@@ -77,6 +77,7 @@ void command_crashtest(Client *c, const Seperator *sep);
void command_cvs(Client *c, const Seperator *sep);
void command_d1(Client *c, const Seperator *sep);
void command_damage(Client *c, const Seperator *sep);
void command_databuckets(Client *c, const Seperator *sep);
void command_date(Client *c, const Seperator *sep);
void command_dbspawn2(Client *c, const Seperator *sep);
void command_delacct(Client *c, const Seperator *sep);
+1
View File
@@ -388,6 +388,7 @@ struct StatBonuses {
int32 skillmod[EQEmu::skills::HIGHEST_SKILL + 1];
int32 skillmodmax[EQEmu::skills::HIGHEST_SKILL + 1];
int effective_casting_level;
int adjusted_casting_skill; // SPA 112 for fizzles
int reflect_chance; // chance to reflect incoming spell
uint32 singingMod;
uint32 Amplification; // stacks with singingMod
+8 -8
View File
@@ -803,7 +803,7 @@ bool Corpse::Process() {
spc->zone_id = zone->graveyard_zoneid();
worldserver.SendPacket(pack);
safe_delete(pack);
Log(Logs::General, Logs::None, "Moved %s player corpse to the designated graveyard in zone %s.", this->GetName(), database.GetZoneName(zone->graveyard_zoneid()));
LogDebug("Moved [{}] player corpse to the designated graveyard in zone [{}]", this->GetName(), database.GetZoneName(zone->graveyard_zoneid()));
corpse_db_id = 0;
}
@@ -833,10 +833,10 @@ bool Corpse::Process() {
Save();
player_corpse_depop = true;
corpse_db_id = 0;
Log(Logs::General, Logs::None, "Tagged %s player corpse has buried.", this->GetName());
LogDebug("Tagged [{}] player corpse has buried", this->GetName());
}
else {
Log(Logs::General, Logs::Error, "Unable to bury %s player corpse.", this->GetName());
LogError("Unable to bury [{}] player corpse", this->GetName());
return true;
}
}
@@ -943,7 +943,7 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a
}
Log(Logs::Moderate, Logs::Inventory, "MakeLootRequestPackets() LootRequestType %u for %s", loot_request_type, client->GetName());
LogInventory("MakeLootRequestPackets() LootRequestType [{}] for [{}]", (int) loot_request_type, client->GetName());
if (loot_request_type == LootRequestType::Forbidden) {
SendLootReqErrorPacket(client, LootResponse::NotAtThisTime);
@@ -1027,13 +1027,13 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a
if (pkitem->RecastDelay)
pkinst->SetRecastTimestamp(timestamps.count(pkitem->RecastType) ? timestamps.at(pkitem->RecastType) : 0);
Log(Logs::Detail, Logs::Inventory, "MakeLootRequestPackets() Slot %u, Item '%s'", EQEmu::invslot::CORPSE_BEGIN, pkitem->Name);
LogInventory("MakeLootRequestPackets() Slot [{}], Item [{}]", EQEmu::invslot::CORPSE_BEGIN, pkitem->Name);
client->SendItemPacket(EQEmu::invslot::CORPSE_BEGIN, pkinst, ItemPacketLoot);
safe_delete(pkinst);
}
else {
Log(Logs::General, Logs::Inventory, "MakeLootRequestPackets() PlayerKillItem %i not found", pkitemid);
LogInventory("MakeLootRequestPackets() PlayerKillItem [{}] not found", pkitemid);
client->Message(Chat::Red, "PlayerKillItem (id: %i) could not be found!", pkitemid);
}
@@ -1083,7 +1083,7 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a
if (item->RecastDelay)
inst->SetRecastTimestamp(timestamps.count(item->RecastType) ? timestamps.at(item->RecastType) : 0);
Log(Logs::Moderate, Logs::Inventory, "MakeLootRequestPackets() Slot %i, Item '%s'", loot_slot, item->Name);
LogInventory("MakeLootRequestPackets() Slot [{}], Item [{}]", loot_slot, item->Name);
client->SendItemPacket(loot_slot, inst, ItemPacketLoot);
safe_delete(inst);
@@ -1107,7 +1107,7 @@ void Corpse::LootItem(Client *client, const EQApplicationPacket *app)
auto lootitem = (LootingItem_Struct *)app->pBuffer;
Log(Logs::Moderate, Logs::Inventory, "LootItem() LootRequestType %u, Slot %u for %s", loot_request_type, lootitem->slot_id, client->GetName());
LogInventory("LootItem() LootRequestType [{}], Slot [{}] for [{}]", (int) loot_request_type, lootitem->slot_id, client->GetName());
if (loot_request_type < LootRequestType::GMAllowed) { // LootRequestType::Forbidden and LootRequestType::GMPeek
client->QueuePacket(app);
+2 -2
View File
@@ -325,7 +325,7 @@ void Doors::HandleClick(Client* sender, uint8 trigger) {
float player_pick_lock_skill = sender->GetSkill(EQEmu::skills::SkillPickLock);
sender->CheckIncreaseSkill(EQEmu::skills::SkillPickLock, nullptr, 1);
Log(Logs::General, Logs::Skills, "Client has lockpicks: skill=%f", player_pick_lock_skill);
LogSkills("Client has lockpicks: skill=[{}]", player_pick_lock_skill);
if (GetLockpick() <= player_pick_lock_skill) {
if (!IsDoorOpen()) {
@@ -679,7 +679,7 @@ int32 ZoneDatabase::GetDoorsDBCountPlusOne(const char *zone_name, int16 version)
}
bool ZoneDatabase::LoadDoors(int32 door_count, Door *into, const char *zone_name, int16 version) {
Log(Logs::General, Logs::Status, "Loading Doors from database...");
LogInfo("Loading Doors from database");
std::string query = StringFormat(
" SELECT "
+1 -1
View File
@@ -435,7 +435,7 @@ bool Client::TrainDiscipline(uint32 itemid) {
const EQEmu::ItemData *item = database.GetItem(itemid);
if(item == nullptr) {
Message(Chat::Red, "Unable to find the tome you turned in!");
Log(Logs::General, Logs::Error, "Unable to find turned in tome id %lu\n", (unsigned long)itemid);
LogError("Unable to find turned in tome id [{}]\n", (unsigned long)itemid);
return(false);
}
+1 -1
View File
@@ -145,7 +145,7 @@ void PerlembParser::ReloadQuests() {
perl = nullptr;
}
Log(Logs::General, Logs::Status, "Error re-initializing perlembed: %s", e.what());
LogInfo("Error re-initializing perlembed: [{}]", e.what());
throw e.what();
}
+26 -48
View File
@@ -226,8 +226,7 @@ XS(XS__spawn);
XS(XS__spawn) {
dXSARGS;
if (items != 6)
Perl_croak(aTHX_
"Usage: quest::spawn(int npc_type_id, int grid_id, int int_unused, float x, float y, float z)");
Perl_croak(aTHX_ "Usage: quest::spawn(int npc_type_id, int grid_id, int int_unused, float x, float y, float z)");
uint16 RETVAL;
dXSTARG;
@@ -249,8 +248,7 @@ XS(XS__spawn2);
XS(XS__spawn2) {
dXSARGS;
if (items != 7)
Perl_croak(aTHX_
"Usage: quest::spawn2(int npc_type_id, int grid_id, int int_unused, float x, float y, float z, float heading)");
Perl_croak(aTHX_ "Usage: quest::spawn2(int npc_type_id, int grid_id, int int_unused, float x, float y, float z, float heading)");
uint16 RETVAL;
dXSTARG;
@@ -272,8 +270,7 @@ XS(XS__unique_spawn);
XS(XS__unique_spawn) {
dXSARGS;
if (items != 6 && items != 7)
Perl_croak(aTHX_
"Usage: quest::unique_spawn(int npc_type_id, int grid_id, int int_unused, float x, float y, float z, [float heading])");
Perl_croak(aTHX_ "Usage: quest::unique_spawn(int npc_type_id, int grid_id, int int_unused, float x, float y, float z, [float heading])");
uint16 RETVAL;
dXSTARG;
@@ -1315,8 +1312,7 @@ XS(XS__targlobal);
XS(XS__targlobal) {
dXSARGS;
if (items != 6)
Perl_croak(aTHX_
"Usage: quest::targlobal(stirng key, string value, string duration, int npc_id, int chararacter_id, int zone_id)");
Perl_croak(aTHX_ "Usage: quest::targlobal(stirng key, string value, string duration, int npc_id, int chararacter_id, int zone_id)");
char *key = (char *) SvPV_nolen(ST(0));
char *str_value = (char *) SvPV_nolen(ST(1));
@@ -1411,8 +1407,7 @@ XS(XS__moveto);
XS(XS__moveto) {
dXSARGS;
if (items != 3 && items != 4 && items != 5)
Perl_croak(aTHX_
"Usage: quest::moveto(float x, float y, float z, [float heading], [bool save_guard_location])");
Perl_croak(aTHX_ "Usage: quest::moveto(float x, float y, float z, [float heading], [bool save_guard_location])");
float x = (float) SvNV(ST(0));
float y = (float) SvNV(ST(1));
@@ -1561,8 +1556,7 @@ XS(XS__set_proximity);
XS(XS__set_proximity) {
dXSARGS;
if (items != 4 && items != 6 && items != 7)
Perl_croak(aTHX_
"Usage: quest::set_proximity(float min_x, float max_x, float min_y, float max_y, [float min_z], [float max_z], [say])");
Perl_croak(aTHX_ "Usage: quest::set_proximity(float min_x, float max_x, float min_y, float max_y, [float min_z], [float max_z], [say])");
float min_x = (float) SvNV(ST(0));
float max_x = (float) SvNV(ST(1));
@@ -1643,8 +1637,7 @@ XS(XS__spawn_condition);
XS(XS__spawn_condition) {
dXSARGS;
if (items < 3 || items > 4)
Perl_croak(aTHX_
"Usage: quest::spawn_condition(string zone_short, [int instance_id], uint16 condition_id, int16 value)");
Perl_croak(aTHX_ "Usage: quest::spawn_condition(string zone_short, [int instance_id], uint16 condition_id, int16 value)");
if (items == 3) {
char *zone_short = (char *) SvPV_nolen(ST(0));
@@ -1701,8 +1694,7 @@ XS(XS__toggle_spawn_event);
XS(XS__toggle_spawn_event) {
dXSARGS;
if (items != 4)
Perl_croak(aTHX_
"Usage: quest::toggle_spawn_event(uint32 event_id, [bool is_enabled = false], [bool is_strict = false], [bool reset_base = false])");
Perl_croak(aTHX_ "Usage: quest::toggle_spawn_event(uint32 event_id, [bool is_enabled = false], [bool is_strict = false], [bool reset_base = false])");
uint32 event_id = (int) SvIV(ST(0));
bool is_enabled = ((int) SvIV(ST(1))) == 0 ? false : true;
@@ -1763,8 +1755,7 @@ XS(XS__summonburiedplayercorpse);
XS(XS__summonburiedplayercorpse) {
dXSARGS;
if (items != 5)
Perl_croak(aTHX_
"Usage: quest::summonburiedplayercorpse(uint32 char_id, float dest_x, float dest_y, float dest_z, float dest_heading)");
Perl_croak(aTHX_ "Usage: quest::summonburiedplayercorpse(uint32 char_id, float dest_x, float dest_y, float dest_z, float dest_heading)");
bool RETVAL;
uint32 char_id = (int) SvIV(ST(0));
@@ -1781,8 +1772,7 @@ XS(XS__summonallplayercorpses);
XS(XS__summonallplayercorpses) {
dXSARGS;
if (items != 5)
Perl_croak(aTHX_
"Usage: quest::summonallplayercorpses(int char_id, float dest_x, float dest_y, float dest_z, float dest_heading)");
Perl_croak(aTHX_ "Usage: quest::summonallplayercorpses(int char_id, float dest_x, float dest_y, float dest_z, float dest_heading)");
bool RETVAL;
uint32 char_id = (int) SvIV(ST(0));
@@ -2038,8 +2028,7 @@ XS(XS__playerfeature);
XS(XS__playerfeature) {
dXSARGS;
if (items != 2)
Perl_croak(aTHX_
"Usage: quest::playerfeature(string feature [race|gender|texture|helm|haircolor|beardcolor|eyecolor1|eyecolor2|hair|face|beard|heritage|tatoo|details|size], int setting)");
Perl_croak(aTHX_ "Usage: quest::playerfeature(string feature [race|gender|texture|helm|haircolor|beardcolor|eyecolor1|eyecolor2|hair|face|beard|heritage|tatoo|details|size], int setting)");
char *str_value = (char *) SvPV_nolen(ST(0));
int int_value = (int) SvIV(ST(1));
@@ -2053,8 +2042,7 @@ XS(XS__npcfeature);
XS(XS__npcfeature) {
dXSARGS;
if (items != 2)
Perl_croak(aTHX_
"Usage: quest::npcfeature(string feature [race|gender|texture|helm|haircolor|beardcolor|eyecolor1|eyecolor2|hair|face|beard|heritage|tatoo|details|size], int value)");
Perl_croak(aTHX_ "Usage: quest::npcfeature(string feature [race|gender|texture|helm|haircolor|beardcolor|eyecolor1|eyecolor2|hair|face|beard|heritage|tatoo|details|size], int value)");
char *str_value = (char *) SvPV_nolen(ST(0));
int int_value = (int) SvIV(ST(1));
@@ -2281,8 +2269,7 @@ XS(XS__updatetaskactivity) {
}
quest_manager.updatetaskactivity(task_id, activity_id, count, ignore_quest_update);
} else {
Perl_croak(aTHX_
"Usage: quest::updatetaskactivity(int task_id, int activity_id, [int count], [bool ignore_quest_update = false])");
Perl_croak(aTHX_ "Usage: quest::updatetaskactivity(int task_id, int activity_id, [int count], [bool ignore_quest_update = false])");
}
XSRETURN_EMPTY;
@@ -2570,8 +2557,7 @@ XS(XS__popup) {
int duration = 0;
if ((items < 2) || (items > 5))
Perl_croak(aTHX_
"Usage: quest::popup(string window_title, string message, int popup_id, int buttons, int duration)");
Perl_croak(aTHX_ "Usage: quest::popup(string window_title, string message, int popup_id, int buttons, int duration)");
if (items >= 3)
popup_id = (int) SvIV(ST(2));
@@ -2652,8 +2638,7 @@ XS(XS__CreateGroundObject);
XS(XS__CreateGroundObject) {
dXSARGS;
if (items != 5 && items != 6)
Perl_croak(aTHX_
"Usage: quest::creategroundobject(int item_id, float x, float y, float z, float heading, [uint32 decay_time-ms = 300000])");
Perl_croak(aTHX_ "Usage: quest::creategroundobject(int item_id, float x, float y, float z, float heading, [uint32 decay_time-ms = 300000])");
int item_id = (int) SvIV(ST(0));
float x = (float) SvNV(ST(1));
@@ -2676,8 +2661,7 @@ XS(XS__CreateGroundObjectFromModel);
XS(XS__CreateGroundObjectFromModel) {
dXSARGS;
if (items < 5 || items > 7)
Perl_croak(aTHX_
"Usage: quest::creategroundobjectfrommodel(string model_name, float x, float y, float z, float heading, [int object_type], [uint32 decay_time-ms = 300000])");
Perl_croak(aTHX_ "Usage: quest::creategroundobjectfrommodel(string model_name, float x, float y, float z, float heading, [int object_type], [uint32 decay_time-ms = 300000])");
char *modelname = (char *) SvPV_nolen(ST(0));
float x = (float) SvNV(ST(1));
@@ -2702,8 +2686,7 @@ XS(XS__CreateDoor);
XS(XS__CreateDoor) {
dXSARGS;
if (items < 5 || items > 7)
Perl_croak(aTHX_
"Usage: quest::createdoor(string model_name, float x, float y, float z, float heading, [int object_type = 58], [int size = 100])");
Perl_croak(aTHX_ "Usage: quest::createdoor(string model_name, float x, float y, float z, float heading, [int object_type = 58], [int size = 100])");
char *modelname = (char *) SvPV_nolen(ST(0));
float x = (float) SvNV(ST(1));
@@ -3032,8 +3015,7 @@ XS(XS__MovePCInstance);
XS(XS__MovePCInstance) {
dXSARGS;
if (items != 5 && items != 6)
Perl_croak(aTHX_
"Usage: quest::MovePCInstance(int zone_id, int instance_id, float x, float y, float z, [float heading])");
Perl_croak(aTHX_ "Usage: quest::MovePCInstance(int zone_id, int instance_id, float x, float y, float z, [float heading])");
int zone_id = (int) SvIV(ST(0));
int instanceid = (int) SvIV(ST(1));
@@ -3286,8 +3268,7 @@ XS(XS__wearchange);
XS(XS__wearchange) {
dXSARGS;
if (items < 2)
Perl_croak(aTHX_
"Usage: quest::wearchange(uint8 slot, uint16 texture_id, [uint32 hero_forge_model_id = 0], [uint32 elite_material_id = 0])");
Perl_croak(aTHX_ "Usage: quest::wearchange(uint8 slot, uint16 texture_id, [uint32 hero_forge_model_id = 0], [uint32 elite_material_id = 0])");
uint8 slot = (int) SvUV(ST(0));
uint16 texture_id = (int) SvUV(ST(1));
@@ -3535,8 +3516,7 @@ XS(XS__crosszonesetentityvariablebynpctypeid) {
dXSARGS;
if (items != 3)
Perl_croak(aTHX_
"Usage: quest::crosszonesetentityvariablebynpctypeid(int npc_type_id, string key, string value)");
Perl_croak(aTHX_ "Usage: quest::crosszonesetentityvariablebynpctypeid(int npc_type_id, string key, string value)");
if (items == 3) {
uint32 npc_type_id = (uint32) SvIV(ST(0));
@@ -3553,8 +3533,7 @@ XS(XS__crosszonesetentityvariablebyclientname) {
dXSARGS;
if (items != 3)
Perl_croak(aTHX_
"Usage: quest::crosszonesetentityvariablebyclientname(string client_name, string key, string value)");
Perl_croak(aTHX_ "Usage: quest::crosszonesetentityvariablebyclientname(string client_name, string key, string value)");
if (items == 3) {
const char *client_name = (const char *) SvPV_nolen(ST(0));
@@ -3586,8 +3565,7 @@ XS(XS__worldwidemarquee);
XS(XS__worldwidemarquee) {
dXSARGS;
if (items != 6)
Perl_croak(aTHX_
"Usage: quest::worldwidemarquee(uint32 color_id, uint32 priority, uint32 fade_in, uint32 fade_out, uint32 duration, string message)");
Perl_croak(aTHX_ "Usage: quest::worldwidemarquee(uint32 color_id, uint32 priority, uint32 fade_in, uint32 fade_out, uint32 duration, string message)");
if (items == 6) {
uint32 color_id = (uint32) SvIV(ST(0));
@@ -3618,11 +3596,11 @@ XS(XS__debug) {
return;
if (debug_level == Logs::General) {
Log(Logs::General, Logs::QuestDebug, log_message);
Log(Logs::General, Logs::QuestDebug, log_message.c_str());
} else if (debug_level == Logs::Moderate) {
Log(Logs::Moderate, Logs::QuestDebug, log_message);
Log(Logs::Moderate, Logs::QuestDebug, log_message.c_str());
} else if (debug_level == Logs::Detail) {
Log(Logs::Detail, Logs::QuestDebug, log_message);
Log(Logs::Detail, Logs::QuestDebug, log_message.c_str());
}
}
XSRETURN_EMPTY;
@@ -3747,7 +3725,7 @@ EXTERN_C XS(boot_quest) {
file[255] = '\0';
if (items != 1)
Log(Logs::General, Logs::Error, "boot_quest does not take any arguments.");
LogError("boot_quest does not take any arguments");
char buf[128]; //shouldent have any function names longer than this.
+5 -5
View File
@@ -140,12 +140,12 @@ void Embperl::DoInit() {
catch(const char *err)
{
//remember... lasterr() is no good if we crap out here, in construction
Log(Logs::General, Logs::Quests, "perl error: %s", err);
LogQuests("perl error: [{}]", err);
throw "failed to install eval_file hook";
}
#ifdef EMBPERL_IO_CAPTURE
Log(Logs::General, Logs::Quests, "Tying perl output to eqemu logs");
LogQuests("Tying perl output to eqemu logs");
//make a tieable class to capture IO and pass it into EQEMuLog
eval_pv(
"package EQEmuIO; "
@@ -170,7 +170,7 @@ void Embperl::DoInit() {
,FALSE
);
Log(Logs::General, Logs::Quests, "Loading perlemb plugins.");
LogQuests("Loading perlemb plugins");
try
{
std::string perl_command;
@@ -179,7 +179,7 @@ void Embperl::DoInit() {
}
catch(const char *err)
{
Log(Logs::General, Logs::Quests, "Warning - %s: %s", Config->PluginPlFile.c_str(), err);
LogQuests("Warning - [{}]: [{}]", Config->PluginPlFile.c_str(), err);
}
try
{
@@ -197,7 +197,7 @@ void Embperl::DoInit() {
}
catch(const char *err)
{
Log(Logs::General, Logs::Quests, "Perl warning: %s", err);
LogQuests("Perl warning: [{}]", err);
}
#endif //EMBPERL_PLUGIN
in_use = false;
+1 -1
View File
@@ -68,7 +68,7 @@ EXTERN_C XS(boot_qc)
file[255] = '\0';
if(items != 1)
Log(Logs::General, Logs::Error, "boot_qc does not take any arguments.");
LogError("boot_qc does not take any arguments");
char buf[128]; //shouldent have any function names longer than this.
+11 -13
View File
@@ -76,12 +76,12 @@ Entity::~Entity()
Client *Entity::CastToClient()
{
if (this == 0x00) {
Log(Logs::General, Logs::Error, "CastToClient error (nullptr)");
LogError("CastToClient error (nullptr)");
return 0;
}
#ifdef _EQDEBUG
if (!IsClient()) {
Log(Logs::General, Logs::Error, "CastToClient error (not client)");
LogError("CastToClient error (not client)");
return 0;
}
#endif
@@ -93,7 +93,7 @@ NPC *Entity::CastToNPC()
{
#ifdef _EQDEBUG
if (!IsNPC()) {
Log(Logs::General, Logs::Error, "CastToNPC error (Not NPC)");
LogError("CastToNPC error (Not NPC)");
return 0;
}
#endif
@@ -377,7 +377,7 @@ void EntityList::CheckGroupList (const char *fname, const int fline)
{
if (*it == nullptr)
{
Log(Logs::General, Logs::Error, "nullptr group, %s:%i", fname, fline);
LogError("nullptr group, [{}]:[{}]", fname, fline);
}
}
}
@@ -535,17 +535,17 @@ void EntityList::MobProcess()
#ifdef _WINDOWS
struct in_addr in;
in.s_addr = mob->CastToClient()->GetIP();
Log(Logs::General, Logs::Zone_Server, "Dropping client: Process=false, ip=%s port=%u", inet_ntoa(in), mob->CastToClient()->GetPort());
LogInfo("Dropping client: Process=false, ip=[{}] port=[{}]", inet_ntoa(in), mob->CastToClient()->GetPort());
#endif
zone->StartShutdownTimer();
Group *g = GetGroupByMob(mob);
if(g) {
Log(Logs::General, Logs::Error, "About to delete a client still in a group.");
LogError("About to delete a client still in a group");
g->DelMember(mob);
}
Raid *r = entity_list.GetRaidByClient(mob->CastToClient());
if(r) {
Log(Logs::General, Logs::Error, "About to delete a client still in a raid.");
LogError("About to delete a client still in a raid");
r->MemberZoned(mob->CastToClient());
}
entity_list.RemoveClient(id);
@@ -592,8 +592,7 @@ void EntityList::AddGroup(Group *group)
uint32 gid = worldserver.NextGroupID();
if (gid == 0) {
Log(Logs::General, Logs::Error,
"Unable to get new group ID from world server. group is going to be broken.");
LogError("Unable to get new group ID from world server. group is going to be broken");
return;
}
@@ -621,8 +620,7 @@ void EntityList::AddRaid(Raid *raid)
uint32 gid = worldserver.NextGroupID();
if (gid == 0) {
Log(Logs::General, Logs::Error,
"Unable to get new group ID from world server. group is going to be broken.");
LogError("Unable to get new group ID from world server. group is going to be broken");
return;
}
@@ -817,7 +815,7 @@ void EntityList::CheckSpawnQueue()
auto it = npc_list.find(ns->spawn.spawnId);
if (it == npc_list.end()) {
// We must of despawned, hope that's the reason!
Log(Logs::General, Logs::Error, "Error in EntityList::CheckSpawnQueue: Unable to find NPC for spawnId '%u'", ns->spawn.spawnId);
LogError("Error in EntityList::CheckSpawnQueue: Unable to find NPC for spawnId [{}]", ns->spawn.spawnId);
}
else {
NPC *pnpc = it->second;
@@ -2877,7 +2875,7 @@ char *EntityList::MakeNameUnique(char *name)
return name;
}
}
Log(Logs::General, Logs::Error, "Fatal error in EntityList::MakeNameUnique: Unable to find unique name for '%s'", name);
LogError("Fatal error in EntityList::MakeNameUnique: Unable to find unique name for [{}]", name);
char tmp[64] = "!";
strn0cpy(&tmp[1], name, sizeof(tmp) - 1);
strcpy(name, tmp);
+14 -13
View File
@@ -46,7 +46,7 @@ static uint32 ScaleAAXPBasedOnCurrentAATotal(int earnedAA, uint32 add_aaxp)
// Are we within the scaling window?
if (earnedAA >= aaLimit || earnedAA < aaMinimum)
{
Log(Logs::Detail, Logs::None, "Not within AA scaling window.");
LogDebug("Not within AA scaling window");
// At or past the limit. We're done.
return add_aaxp;
@@ -524,7 +524,7 @@ void Client::AddEXP(uint32 in_add_exp, uint8 conlevel, bool resexp) {
}
void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) {
Log(Logs::Detail, Logs::None, "Attempting to Set Exp for %s (XP: %u, AAXP: %u, Rez: %s)", this->GetCleanName(), set_exp, set_aaxp, isrezzexp ? "true" : "false");
LogDebug("Attempting to Set Exp for [{}] (XP: [{}], AAXP: [{}], Rez: [{}])", this->GetCleanName(), set_exp, set_aaxp, isrezzexp ? "true" : "false");
auto max_AAXP = GetRequiredAAExperience();
if (max_AAXP == 0 || GetEXPForLevel(GetLevel()) == 0xFFFFFFFF) {
@@ -643,7 +643,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
m_pp.aapoints = set_aaxp / max_AAXP;
Log(Logs::Detail, Logs::None, "Calculating additional AA Points from AAXP for %s: %u / %u = %.1f points", this->GetCleanName(), set_aaxp, max_AAXP, (float)set_aaxp / (float)max_AAXP);
LogDebug("Calculating additional AA Points from AAXP for [{}]: [{}] / [{}] = [{}] points", this->GetCleanName(), set_aaxp, max_AAXP, (float)set_aaxp / (float)max_AAXP);
//get remainder exp points, set in PP below
set_aaxp = set_aaxp - (max_AAXP * m_pp.aapoints);
@@ -765,7 +765,7 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) {
void Client::SetLevel(uint8 set_level, bool command)
{
if (GetEXPForLevel(set_level) == 0xFFFFFFFF) {
Log(Logs::General, Logs::Error, "Client::SetLevel() GetEXPForLevel(%i) = 0xFFFFFFFF", set_level);
LogError("Client::SetLevel() GetEXPForLevel([{}]) = 0xFFFFFFFF", set_level);
return;
}
@@ -823,7 +823,7 @@ void Client::SetLevel(uint8 set_level, bool command)
safe_delete(outapp);
this->SendAppearancePacket(AT_WhoLevel, set_level); // who level change
Log(Logs::General, Logs::Normal, "Setting Level for %s to %i", GetName(), set_level);
LogInfo("Setting Level for [{}] to [{}]", GetName(), set_level);
CalcBonuses();
@@ -1131,15 +1131,16 @@ uint32 Client::GetCharMaxLevelFromQGlobal() {
return 0;
}
uint32 Client::GetCharMaxLevelFromBucket() {
uint32 char_id = this->CharacterID();
std::string query = StringFormat("SELECT value FROM data_buckets WHERE `key` = '%i-CharMaxLevel'", char_id);
auto results = database.QueryDatabase(query);
uint32 Client::GetCharMaxLevelFromBucket()
{
uint32 char_id = this->CharacterID();
std::string query = StringFormat("SELECT value FROM data_buckets WHERE `key` = '%i-CharMaxLevel'", char_id);
auto results = database.QueryDatabase(query);
if (!results.Success()) {
Log(Logs::General, Logs::Error, "Data bucket for CharMaxLevel for char ID %i failed.", char_id);
return 0;
}
LogError("Data bucket for CharMaxLevel for char ID [{}] failed", char_id);
return 0;
}
if (results.RowCount() > 0) {
auto row = results.begin();
return atoi(row[0]);
+11 -11
View File
@@ -62,17 +62,17 @@ uint32 ZoneDatabase::GetZoneForage(uint32 ZoneID, uint8 skill) {
return 0;
}
uint8 index = 0;
for (auto row = results.begin(); row != results.end(); ++row, ++index) {
if (index >= FORAGE_ITEM_LIMIT)
break;
item[index] = atoi(row[0]);
chance[index] = atoi(row[1]) + chancepool;
Log(Logs::General, Logs::Error, "Possible Forage: %d with a %d chance", item[index], chance[index]);
chancepool = chance[index];
}
uint8 index = 0;
for (auto row = results.begin(); row != results.end(); ++row, ++index) {
if (index >= FORAGE_ITEM_LIMIT) {
break;
}
item[index] = atoi(row[0]);
chance[index] = atoi(row[1]) + chancepool;
LogError("Possible Forage: [{}] with a [{}] chance", item[index], chance[index]);
chancepool = chance[index];
}
if(chancepool == 0 || index < 1)
return 0;
@@ -413,7 +413,7 @@ void Client::ForageItem(bool guarantee) {
const EQEmu::ItemData* food_item = database.GetItem(foragedfood);
if(!food_item) {
Log(Logs::General, Logs::Error, "nullptr returned from database.GetItem in ClientForageItem");
LogError("nullptr returned from database.GetItem in ClientForageItem");
return;
}
+26 -21
View File
@@ -835,7 +835,7 @@ void Group::CastGroupSpell(Mob* caster, uint16 spell_id) {
caster->SpellOnTarget(spell_id, members[z]->GetPet());
#endif
} else
Log(Logs::Detail, Logs::Spells, "Group spell: %s is out of range %f at distance %f from %s", members[z]->GetName(), range, distance, caster->GetName());
LogSpells("Group spell: [{}] is out of range [{}] at distance [{}] from [{}]", members[z]->GetName(), range, distance, caster->GetName());
}
}
@@ -874,7 +874,7 @@ void Group::GroupBardPulse(Mob* caster, uint16 spell_id) {
members[z]->GetPet()->BardPulse(spell_id, caster);
#endif
} else
Log(Logs::Detail, Logs::Spells, "Group bard pulse: %s is out of range %f at distance %f from %s", members[z]->GetName(), range, distance, caster->GetName());
LogSpells("Group bard pulse: [{}] is out of range [{}] at distance [{}] from [{}]", members[z]->GetName(), range, distance, caster->GetName());
}
}
}
@@ -1177,10 +1177,15 @@ bool Group::LearnMembers() {
if (!results.Success())
return false;
if (results.RowCount() == 0) {
Log(Logs::General, Logs::Error, "Error getting group members for group %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str());
return false;
}
if (results.RowCount() == 0) {
LogError(
"Error getting group members for group [{}]: [{}]",
(unsigned long) GetID(),
results.ErrorMessage().c_str()
);
return false;
}
int memberIndex = 0;
for(auto row = results.begin(); row != results.end(); ++row) {
@@ -1207,7 +1212,7 @@ void Group::VerifyGroup() {
for (i = 0; i < MAX_GROUP_MEMBERS; i++) {
if (membername[i][0] == '\0') {
#if EQDEBUG >= 7
Log(Logs::General, Logs::None, "Group %lu: Verify %d: Empty.\n", (unsigned long)GetID(), i);
LogDebug("Group [{}]: Verify [{}]: Empty.\n", (unsigned long)GetID(), i);
#endif
members[i] = nullptr;
continue;
@@ -1216,7 +1221,7 @@ void Group::VerifyGroup() {
Mob *them = entity_list.GetMob(membername[i]);
if(them == nullptr && members[i] != nullptr) { //they aren't in zone
#if EQDEBUG >= 6
Log(Logs::General, Logs::None, "Member of group %lu named '%s' has disappeared!!", (unsigned long)GetID(), membername[i]);
LogDebug("Member of group [{}] named [{}] has disappeared!!", (unsigned long)GetID(), membername[i]);
#endif
membername[i][0] = '\0';
members[i] = nullptr;
@@ -1225,13 +1230,13 @@ void Group::VerifyGroup() {
if(them != nullptr && members[i] != them) { //our pointer is out of date... not so good.
#if EQDEBUG >= 5
Log(Logs::General, Logs::None, "Member of group %lu named '%s' had an out of date pointer!!", (unsigned long)GetID(), membername[i]);
LogDebug("Member of group [{}] named [{}] had an out of date pointer!!", (unsigned long)GetID(), membername[i]);
#endif
members[i] = them;
continue;
}
#if EQDEBUG >= 8
Log(Logs::General, Logs::None, "Member of group %lu named '%s' is valid.", (unsigned long)GetID(), membername[i]);
LogDebug("Member of group [{}] named [{}] is valid", (unsigned long)GetID(), membername[i]);
#endif
}
}
@@ -1566,7 +1571,7 @@ void Group::DelegateMainTank(const char *NewMainTankName, uint8 toggle)
MainTankName.c_str(), GetID());
auto results = database.QueryDatabase(query);
if (!results.Success())
Log(Logs::General, Logs::Error, "Unable to set group main tank: %s\n", results.ErrorMessage().c_str());
LogError("Unable to set group main tank: [{}]\n", results.ErrorMessage().c_str());
}
}
@@ -1612,7 +1617,7 @@ void Group::DelegateMainAssist(const char *NewMainAssistName, uint8 toggle)
MainAssistName.c_str(), GetID());
auto results = database.QueryDatabase(query);
if (!results.Success())
Log(Logs::General, Logs::Error, "Unable to set group main assist: %s\n", results.ErrorMessage().c_str());
LogError("Unable to set group main assist: [{}]\n", results.ErrorMessage().c_str());
}
}
@@ -1659,7 +1664,7 @@ void Group::DelegatePuller(const char *NewPullerName, uint8 toggle)
PullerName.c_str(), GetID());
auto results = database.QueryDatabase(query);
if (!results.Success())
Log(Logs::General, Logs::Error, "Unable to set group main puller: %s\n", results.ErrorMessage().c_str());
LogError("Unable to set group main puller: [{}]\n", results.ErrorMessage().c_str());
}
@@ -1810,7 +1815,7 @@ void Group::UnDelegateMainTank(const char *OldMainTankName, uint8 toggle)
std::string query = StringFormat("UPDATE group_leaders SET maintank = '' WHERE gid = %i LIMIT 1", GetID());
auto results = database.QueryDatabase(query);
if (!results.Success())
Log(Logs::General, Logs::Error, "Unable to clear group main tank: %s\n", results.ErrorMessage().c_str());
LogError("Unable to clear group main tank: [{}]\n", results.ErrorMessage().c_str());
if(!toggle) {
for(uint32 i = 0; i < MAX_GROUP_MEMBERS; ++i) {
@@ -1859,7 +1864,7 @@ void Group::UnDelegateMainAssist(const char *OldMainAssistName, uint8 toggle)
std::string query = StringFormat("UPDATE group_leaders SET assist = '' WHERE gid = %i LIMIT 1", GetID());
auto results = database.QueryDatabase(query);
if (!results.Success())
Log(Logs::General, Logs::Error, "Unable to clear group main assist: %s\n", results.ErrorMessage().c_str());
LogError("Unable to clear group main assist: [{}]\n", results.ErrorMessage().c_str());
if(!toggle)
{
@@ -1887,7 +1892,7 @@ void Group::UnDelegatePuller(const char *OldPullerName, uint8 toggle)
std::string query = StringFormat("UPDATE group_leaders SET puller = '' WHERE gid = %i LIMIT 1", GetID());
auto results = database.QueryDatabase(query);
if (!results.Success())
Log(Logs::General, Logs::Error, "Unable to clear group main puller: %s\n", results.ErrorMessage().c_str());
LogError("Unable to clear group main puller: [{}]\n", results.ErrorMessage().c_str());
if(!toggle) {
for(uint32 i = 0; i < MAX_GROUP_MEMBERS; ++i) {
@@ -1970,7 +1975,7 @@ void Group::SetGroupMentor(int percent, char *name)
mentoree_name.c_str(), mentor_percent, GetID());
auto results = database.QueryDatabase(query);
if (!results.Success())
Log(Logs::General, Logs::Error, "Unable to set group mentor: %s\n", results.ErrorMessage().c_str());
LogError("Unable to set group mentor: [{}]\n", results.ErrorMessage().c_str());
}
void Group::ClearGroupMentor()
@@ -1981,7 +1986,7 @@ void Group::ClearGroupMentor()
std::string query = StringFormat("UPDATE group_leaders SET mentoree = '', mentor_percent = 0 WHERE gid = %i LIMIT 1", GetID());
auto results = database.QueryDatabase(query);
if (!results.Success())
Log(Logs::General, Logs::Error, "Unable to clear group mentor: %s\n", results.ErrorMessage().c_str());
LogError("Unable to clear group mentor: [{}]\n", results.ErrorMessage().c_str());
}
void Group::NotifyAssistTarget(Client *c)
@@ -2051,7 +2056,7 @@ void Group::DelegateMarkNPC(const char *NewNPCMarkerName)
NewNPCMarkerName, GetID());
auto results = database.QueryDatabase(query);
if (!results.Success())
Log(Logs::General, Logs::Error, "Unable to set group mark npc: %s\n", results.ErrorMessage().c_str());
LogError("Unable to set group mark npc: [{}]\n", results.ErrorMessage().c_str());
}
void Group::NotifyMarkNPC(Client *c)
@@ -2132,7 +2137,7 @@ void Group::UnDelegateMarkNPC(const char *OldNPCMarkerName)
std::string query = StringFormat("UPDATE group_leaders SET marknpc = '' WHERE gid = %i LIMIT 1", GetID());
auto results = database.QueryDatabase(query);
if (!results.Success())
Log(Logs::General, Logs::Error, "Unable to clear group marknpc: %s\n", results.ErrorMessage().c_str());
LogError("Unable to clear group marknpc: [{}]\n", results.ErrorMessage().c_str());
}
@@ -2149,7 +2154,7 @@ void Group::SaveGroupLeaderAA()
safe_delete_array(queryBuffer);
auto results = database.QueryDatabase(query);
if (!results.Success())
Log(Logs::General, Logs::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str());
LogError("Unable to store LeadershipAA: [{}]\n", results.ErrorMessage().c_str());
}
+8 -8
View File
@@ -56,7 +56,7 @@ void Client::SendGuildMOTD(bool GetGuildMOTDReply) {
}
Log(Logs::Detail, Logs::Guilds, "Sending OP_GuildMOTD of length %d", outapp->size);
LogGuilds("Sending OP_GuildMOTD of length [{}]", outapp->size);
FastQueuePacket(&outapp);
}
@@ -147,10 +147,10 @@ void Client::SendGuildSpawnAppearance() {
if (!IsInAGuild()) {
// clear guildtag
SendAppearancePacket(AT_GuildID, GUILD_NONE);
Log(Logs::Detail, Logs::Guilds, "Sending spawn appearance for no guild tag.");
LogGuilds("Sending spawn appearance for no guild tag");
} else {
uint8 rank = guild_mgr.GetDisplayedRank(GuildID(), GuildRank(), CharacterID());
Log(Logs::Detail, Logs::Guilds, "Sending spawn appearance for guild %d at rank %d", GuildID(), rank);
LogGuilds("Sending spawn appearance for guild [{}] at rank [{}]", GuildID(), rank);
SendAppearancePacket(AT_GuildID, GuildID());
if (ClientVersion() >= EQEmu::versions::ClientVersion::RoF)
{
@@ -174,11 +174,11 @@ void Client::SendGuildList() {
//ask the guild manager to build us a nice guild list packet
outapp->pBuffer = guild_mgr.MakeGuildList(/*GetName()*/"", outapp->size);
if(outapp->pBuffer == nullptr) {
Log(Logs::Detail, Logs::Guilds, "Unable to make guild list!");
LogGuilds("Unable to make guild list!");
return;
}
Log(Logs::Detail, Logs::Guilds, "Sending OP_ZoneGuildList of length %d", outapp->size);
LogGuilds("Sending OP_ZoneGuildList of length [{}]", outapp->size);
FastQueuePacket(&outapp);
}
@@ -195,7 +195,7 @@ void Client::SendGuildMembers() {
outapp->pBuffer = data;
data = nullptr;
Log(Logs::Detail, Logs::Guilds, "Sending OP_GuildMemberList of length %d", outapp->size);
LogGuilds("Sending OP_GuildMemberList of length [{}]", outapp->size);
FastQueuePacket(&outapp);
@@ -227,7 +227,7 @@ void Client::RefreshGuildInfo()
CharGuildInfo info;
if(!guild_mgr.GetCharInfo(CharacterID(), info)) {
Log(Logs::Detail, Logs::Guilds, "Unable to obtain guild char info for %s (%d)", GetName(), CharacterID());
LogGuilds("Unable to obtain guild char info for [{}] ([{}])", GetName(), CharacterID());
return;
}
@@ -341,7 +341,7 @@ void Client::SendGuildJoin(GuildJoin_Struct* gj){
outgj->rank = gj->rank;
outgj->zoneid = gj->zoneid;
Log(Logs::Detail, Logs::Guilds, "Sending OP_GuildManageAdd for join of length %d", outapp->size);
LogGuilds("Sending OP_GuildManageAdd for join of length [{}]", outapp->size);
FastQueuePacket(&outapp);
+18 -19
View File
@@ -32,7 +32,7 @@ extern WorldServer worldserver;
extern volatile bool is_zone_loaded;
void ZoneGuildManager::SendGuildRefresh(uint32 guild_id, bool name, bool motd, bool rank, bool relation) {
Log(Logs::Detail, Logs::Guilds, "Sending guild refresh for %d to world, changes: name=%d, motd=%d, rank=d, relation=%d", guild_id, name, motd, rank, relation);
LogGuilds("Sending guild refresh for [{}] to world, changes: name=[{}], motd=[{}], rank=d, relation=[{}]", guild_id, name, motd, rank, relation);
auto pack = new ServerPacket(ServerOP_RefreshGuild, sizeof(ServerGuildRefresh_Struct));
ServerGuildRefresh_Struct *s = (ServerGuildRefresh_Struct *) pack->pBuffer;
s->guild_id = guild_id;
@@ -46,7 +46,7 @@ void ZoneGuildManager::SendGuildRefresh(uint32 guild_id, bool name, bool motd, b
void ZoneGuildManager::SendCharRefresh(uint32 old_guild_id, uint32 guild_id, uint32 charid) {
if(guild_id == 0) {
Log(Logs::Detail, Logs::Guilds, "Guild lookup for char %d when sending char refresh.", charid);
LogGuilds("Guild lookup for char [{}] when sending char refresh", charid);
CharGuildInfo gci;
if(!GetCharInfo(charid, gci)) {
@@ -56,7 +56,7 @@ void ZoneGuildManager::SendCharRefresh(uint32 old_guild_id, uint32 guild_id, uin
}
}
Log(Logs::Detail, Logs::Guilds, "Sending char refresh for %d from guild %d to world", charid, guild_id);
LogGuilds("Sending char refresh for [{}] from guild [{}] to world", charid, guild_id);
auto pack = new ServerPacket(ServerOP_GuildCharRefresh, sizeof(ServerGuildCharRefresh_Struct));
ServerGuildCharRefresh_Struct *s = (ServerGuildCharRefresh_Struct *) pack->pBuffer;
@@ -89,7 +89,7 @@ void ZoneGuildManager::SendRankUpdate(uint32 CharID)
}
void ZoneGuildManager::SendGuildDelete(uint32 guild_id) {
Log(Logs::Detail, Logs::Guilds, "Sending guild delete for guild %d to world", guild_id);
LogGuilds("Sending guild delete for guild [{}] to world", guild_id);
auto pack = new ServerPacket(ServerOP_DeleteGuild, sizeof(ServerGuildID_Struct));
ServerGuildID_Struct *s = (ServerGuildID_Struct *) pack->pBuffer;
s->guild_id = guild_id;
@@ -261,12 +261,12 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) {
switch(pack->opcode) {
case ServerOP_RefreshGuild: {
if(pack->size != sizeof(ServerGuildRefresh_Struct)) {
Log(Logs::General, Logs::Error, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildRefresh_Struct));
LogError("Received ServerOP_RefreshGuild of incorrect size [{}], expected [{}]", pack->size, sizeof(ServerGuildRefresh_Struct));
return;
}
ServerGuildRefresh_Struct *s = (ServerGuildRefresh_Struct *) pack->pBuffer;
Log(Logs::Detail, Logs::Guilds, "Received guild refresh from world for %d, changes: name=%d, motd=%d, rank=%d, relation=%d", s->guild_id, s->name_change, s->motd_change, s->rank_change, s->relation_change);
LogGuilds("Received guild refresh from world for [{}], changes: name=[{}], motd=[{}], rank=[{}], relation=[{}]", s->guild_id, s->name_change, s->motd_change, s->rank_change, s->relation_change);
//reload all the guild details from the database.
RefreshGuild(s->guild_id);
@@ -295,12 +295,12 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) {
case ServerOP_GuildCharRefresh: {
if(pack->size != sizeof(ServerGuildCharRefresh_Struct)) {
Log(Logs::General, Logs::Error, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildCharRefresh_Struct));
LogError("Received ServerOP_RefreshGuild of incorrect size [{}], expected [{}]", pack->size, sizeof(ServerGuildCharRefresh_Struct));
return;
}
ServerGuildCharRefresh_Struct *s = (ServerGuildCharRefresh_Struct *) pack->pBuffer;
Log(Logs::Detail, Logs::Guilds, "Received guild member refresh from world for char %d from guild %d", s->char_id, s->guild_id);
LogGuilds("Received guild member refresh from world for char [{}] from guild [{}]", s->char_id, s->guild_id);
Client *c = entity_list.GetClientByCharID(s->char_id);
@@ -338,7 +338,7 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) {
{
if(pack->size != sizeof(ServerGuildRankUpdate_Struct))
{
Log(Logs::General, Logs::Error, "Received ServerOP_RankUpdate of incorrect size %d, expected %d",
LogError("Received ServerOP_RankUpdate of incorrect size [{}], expected [{}]",
pack->size, sizeof(ServerGuildRankUpdate_Struct));
return;
@@ -364,12 +364,12 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) {
case ServerOP_DeleteGuild: {
if(pack->size != sizeof(ServerGuildID_Struct)) {
Log(Logs::General, Logs::Error, "Received ServerOP_DeleteGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildID_Struct));
LogError("Received ServerOP_DeleteGuild of incorrect size [{}], expected [{}]", pack->size, sizeof(ServerGuildID_Struct));
return;
}
ServerGuildID_Struct *s = (ServerGuildID_Struct *) pack->pBuffer;
Log(Logs::Detail, Logs::Guilds, "Received guild delete from world for guild %d", s->guild_id);
LogGuilds("Received guild delete from world for guild [{}]", s->guild_id);
//clear all the guild tags.
entity_list.RefreshAllGuildInfo(s->guild_id);
@@ -417,23 +417,22 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) {
if (!c || !c->IsInAGuild())
{
Log(Logs::Detail, Logs::Guilds,"Invalid Client or not in guild. ID=%i", FromID);
LogGuilds("Invalid Client or not in guild. ID=[{}]", FromID);
break;
}
Log(Logs::Detail, Logs::Guilds,"Processing ServerOP_OnlineGuildMembersResponse");
LogGuilds("Processing ServerOP_OnlineGuildMembersResponse");
auto outapp = new EQApplicationPacket(OP_GuildMemberUpdate, sizeof(GuildMemberUpdate_Struct));
GuildMemberUpdate_Struct *gmus = (GuildMemberUpdate_Struct*)outapp->pBuffer;
char Name[64];
gmus->LastSeen = time(nullptr);
gmus->InstanceID = 0;
gmus->GuildID = c->GuildID();
for (int i=0;i<Count;i++)
{
for (int i = 0; i < Count; i++) {
// Just make the packet once and swap out name/zone and send
VARSTRUCT_DECODE_STRING(Name, Buffer);
strn0cpy(gmus->MemberName, Name, sizeof(gmus->MemberName));
gmus->ZoneID = VARSTRUCT_DECODE_TYPE(uint32, Buffer);
Log(Logs::Detail, Logs::Guilds,"Sending OP_GuildMemberUpdate to %i. Name=%s ZoneID=%i",FromID,Name,gmus->ZoneID);
LogGuilds("Sending OP_GuildMemberUpdate to [{}]. Name=[{}] ZoneID=[{}]", FromID, Name, gmus->ZoneID);
c->QueuePacket(outapp);
}
safe_delete(outapp);
@@ -683,7 +682,7 @@ void GuildBankManager::SendGuildBank(Client *c)
if(Iterator == Banks.end())
{
Log(Logs::General, Logs::Error, "Unable to find guild bank for guild ID %i", c->GuildID());
LogError("Unable to find guild bank for guild ID [{}]", c->GuildID());
return;
}
@@ -856,7 +855,7 @@ bool GuildBankManager::AddItem(uint32 GuildID, uint8 Area, uint32 ItemID, int32
if(Iterator == Banks.end())
{
Log(Logs::General, Logs::Error, "Unable to find guild bank for guild ID %i", GuildID);
LogError("Unable to find guild bank for guild ID [{}]", GuildID);
return false;
}
@@ -902,7 +901,7 @@ bool GuildBankManager::AddItem(uint32 GuildID, uint8 Area, uint32 ItemID, int32
if(Slot < 0)
{
Log(Logs::General, Logs::Error, "No space to add item to the guild bank.");
LogError("No space to add item to the guild bank");
return false;
}
+26 -26
View File
@@ -170,7 +170,7 @@ bool HealRotation::ClearMemberPool()
m_active_heal_target = false;
if (!ClearTargetPool())
Log(Logs::General, Logs::Error, "HealRotation::ClearTargetPool() failed to clear m_target_pool (size: %u)", m_target_pool.size());
LogError("HealRotation::ClearTargetPool() failed to clear m_target_pool (size: [{}])", m_target_pool.size());
auto clear_list = const_cast<const std::list<Bot*>&>(m_member_pool);
for (auto member_iter : clear_list)
@@ -871,42 +871,42 @@ void HealRotation::bias_targets()
m_casting_target_poke = true;
#if (EQDEBUG >= 12)
Log(Logs::General, Logs::Error, "HealRotation::bias_targets() - *** Post-processing state ***");
Log(Logs::General, Logs::Error, "HealRotation Settings:");
Log(Logs::General, Logs::Error, "HealRotation::m_interval_ms = %u", m_interval_ms);
Log(Logs::General, Logs::Error, "HealRotation::m_next_cast_time_ms = %u (current_time: %u, time_diff: %i)", m_next_cast_time_ms, Timer::GetCurrentTime(), ((int32)Timer::GetCurrentTime() - (int32)m_next_cast_time_ms));
Log(Logs::General, Logs::Error, "HealRotation::m_next_poke_time_ms = %u (current_time: %u, time_diff: %i)", m_next_poke_time_ms, Timer::GetCurrentTime(), ((int32)Timer::GetCurrentTime() - (int32)m_next_poke_time_ms));
Log(Logs::General, Logs::Error, "HealRotation::m_fast_heals = %s", ((m_fast_heals) ? ("true") : ("false")));
Log(Logs::General, Logs::Error, "HealRotation::m_adaptive_targeting = %s", ((m_adaptive_targeting) ? ("true") : ("false")));
Log(Logs::General, Logs::Error, "HealRotation::m_casting_override = %s", ((m_casting_override) ? ("true") : ("false")));
Log(Logs::General, Logs::Error, "HealRotation::m_casting_target_poke = %s", ((m_casting_target_poke) ? ("true") : ("false")));
Log(Logs::General, Logs::Error, "HealRotation::m_active_heal_target = %s", ((m_active_heal_target) ? ("true") : ("false")));
Log(Logs::General, Logs::Error, "HealRotation::m_is_active = %s", ((m_is_active) ? ("true") : ("false")));
Log(Logs::General, Logs::Error, "HealRotation::m_member_list.size() = %i", m_member_pool.size());
Log(Logs::General, Logs::Error, "HealRotation::m_cycle_list.size() = %i", m_cycle_pool.size());
Log(Logs::General, Logs::Error, "HealRotation::m_target_list.size() = %i", m_target_pool.size());
if (m_member_pool.size()) { Log(Logs::General, Logs::Error, "(std::shared_ptr<HealRotation>::use_count() = %i", m_member_pool.front()->MemberOfHealRotation()->use_count()); }
else { Log(Logs::General, Logs::Error, "(std::shared_ptr<HealRotation>::use_count() = unknown (0)"); }
Log(Logs::General, Logs::Error, "HealRotation Members:");
LogError("HealRotation::bias_targets() - *** Post-processing state ***");
LogError("HealRotation Settings:");
LogError("HealRotation::m_interval_ms = [{}]", m_interval_ms);
LogError("HealRotation::m_next_cast_time_ms = [{}] (current_time: [{}], time_diff: [{}])", m_next_cast_time_ms, Timer::GetCurrentTime(), ((int32)Timer::GetCurrentTime() - (int32)m_next_cast_time_ms));
LogError("HealRotation::m_next_poke_time_ms = [{}] (current_time: [{}], time_diff: [{}])", m_next_poke_time_ms, Timer::GetCurrentTime(), ((int32)Timer::GetCurrentTime() - (int32)m_next_poke_time_ms));
LogError("HealRotation::m_fast_heals = [{}]", ((m_fast_heals) ? ("true") : ("false")));
LogError("HealRotation::m_adaptive_targeting = [{}]", ((m_adaptive_targeting) ? ("true") : ("false")));
LogError("HealRotation::m_casting_override = [{}]", ((m_casting_override) ? ("true") : ("false")));
LogError("HealRotation::m_casting_target_poke = [{}]", ((m_casting_target_poke) ? ("true") : ("false")));
LogError("HealRotation::m_active_heal_target = [{}]", ((m_active_heal_target) ? ("true") : ("false")));
LogError("HealRotation::m_is_active = [{}]", ((m_is_active) ? ("true") : ("false")));
LogError("HealRotation::m_member_list.size() = [{}]", m_member_pool.size());
LogError("HealRotation::m_cycle_list.size() = [{}]", m_cycle_pool.size());
LogError("HealRotation::m_target_list.size() = [{}]", m_target_pool.size());
if (m_member_pool.size()) { LogError("(std::shared_ptr<HealRotation>::use_count() = [{}]", m_member_pool.front()->MemberOfHealRotation()->use_count()); }
else { LogError("(std::shared_ptr<HealRotation>::use_count() = unknown (0)"); }
LogError("HealRotation Members:");
int member_index = 0;
for (auto mlist_iter : m_member_pool) {
if (!mlist_iter) { continue; }
Log(Logs::General, Logs::Error, "(%i) %s (hrcast: %c)", (++member_index), mlist_iter->GetCleanName(), ((mlist_iter->AmICastingForHealRotation())?('T'):('F')));
LogError("([{}]) [{}] (hrcast: [{}])", (++member_index), mlist_iter->GetCleanName(), ((mlist_iter->AmICastingForHealRotation())?('T'):('F')));
}
if (!member_index) { Log(Logs::General, Logs::Error, "(0) None"); }
Log(Logs::General, Logs::Error, "HealRotation Cycle:");
if (!member_index) { LogError("(0) None"); }
LogError("HealRotation Cycle:");
int cycle_index = 0;
for (auto clist_iter : m_cycle_pool) {
if (!clist_iter) { continue; }
Log(Logs::General, Logs::Error, "(%i) %s", (++cycle_index), clist_iter->GetCleanName());
LogError("([{}]) [{}]", (++cycle_index), clist_iter->GetCleanName());
}
if (!cycle_index) { Log(Logs::General, Logs::Error, "(0) None"); }
Log(Logs::General, Logs::Error, "HealRotation Targets: (sort type: %u)", sort_type);
if (!cycle_index) { LogError("(0) None"); }
LogError("HealRotation Targets: (sort type: [{}])", sort_type);
int target_index = 0;
for (auto tlist_iter : m_target_pool) {
if (!tlist_iter) { continue; }
Log(Logs::General, Logs::Error, "(%i) %s (hp: %3.1f%%, at: %u, dontheal: %c, crit(base): %c(%c), safe(base): %c(%c), hcnt(ext): %u(%u), hfreq(ext): %f(%f))",
LogError("([{}]) [{}] (hp: [{}], at: [{}], dontheal: [{}], crit(base): [{}]([{}]), safe(base): [{}]([{}]), hcnt(ext): [{}]([{}]), hfreq(ext): [{}]([{}]))",
(++target_index), tlist_iter->GetCleanName(),
tlist_iter->GetHPRatio(),
ClassArmorType(tlist_iter->GetClass()),
@@ -920,7 +920,7 @@ void HealRotation::bias_targets()
tlist_iter->HealRotationHealFrequency(),
tlist_iter->HealRotationExtendedHealFrequency());
}
if (!target_index) { Log(Logs::General, Logs::Error, "(0) None (hp: 0.0\%, at: 0, dontheal: F, crit(base): F(F), safe(base): F(F), hcnt(ext): 0(0), hfreq(ext): 0.0(0.0))"); }
if (!target_index) { LogError("(0) None (hp: 0.0\%, at: 0, dontheal: F, crit(base): F(F), safe(base): F(F), hcnt(ext): 0(0), hfreq(ext): 0.0(0.0))"); }
#endif
}
+3 -3
View File
@@ -79,8 +79,8 @@ const NPCType *Horse::BuildHorseType(uint16 spell_id) {
}
if (results.RowCount() != 1) {
Log(Logs::General, Logs::Error, "No Database entry for mount: %s, check the horses table", fileName);
return nullptr;
LogError("No Database entry for mount: [{}], check the horses table", fileName);
return nullptr;
}
auto row = results.begin();
@@ -122,7 +122,7 @@ void Client::SummonHorse(uint16 spell_id) {
return;
}
if(!Horse::IsHorseSpell(spell_id)) {
Log(Logs::General, Logs::Error, "%s tried to summon an unknown horse, spell id %d", GetName(), spell_id);
LogError("[{}] tried to summon an unknown horse, spell id [{}]", GetName(), spell_id);
return;
}
+103 -105
View File
@@ -186,7 +186,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
// make sure the item exists
if(item == nullptr) {
Message(Chat::Red, "Item %u does not exist.", item_id);
Log(Logs::Detail, Logs::Inventory, "Player %s on account %s attempted to create an item with an invalid id.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n",
LogInventory("Player [{}] on account [{}] attempted to create an item with an invalid id.\n(Item: [{}], Aug1: [{}], Aug2: [{}], Aug3: [{}], Aug4: [{}], Aug5: [{}], Aug6: [{}])\n",
GetName(), account_name, item_id, aug1, aug2, aug3, aug4, aug5, aug6);
return false;
@@ -201,7 +201,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
// check to make sure we are augmenting an augmentable item
else if (((!item->IsClassCommon()) || (item->AugType > 0)) && (aug1 | aug2 | aug3 | aug4 | aug5 | aug6)) {
Message(Chat::Red, "You can not augment an augment or a non-common class item.");
Log(Logs::Detail, Logs::Inventory, "Player %s on account %s attempted to augment an augment or a non-common class item.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug5: %u)\n",
LogInventory("Player [{}] on account [{}] attempted to augment an augment or a non-common class item.\n(Item: [{}], Aug1: [{}], Aug2: [{}], Aug3: [{}], Aug4: [{}], Aug5: [{}], Aug5: [{}])\n",
GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5, aug6);
return false;
@@ -215,7 +215,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
/*
else if(item->MinStatus && ((this->Admin() < item->MinStatus) || (this->Admin() < RuleI(GM, MinStatusToSummonItem)))) {
Message(Chat::Red, "You are not a GM or do not have the status to summon this item.");
Log(Logs::Detail, Logs::Inventory, "Player %s on account %s attempted to create a GM-only item with a status of %i.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u, MinStatus: %u)\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);
return false;
@@ -238,7 +238,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
if(augtest == nullptr) {
if(augments[iter]) {
Message(Chat::Red, "Augment %u (Aug%i) does not exist.", augments[iter], iter + 1);
Log(Logs::Detail, Logs::Inventory, "Player %s on account %s attempted to create an augment (Aug%i) with an invalid id.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n",
LogInventory("Player [{}] on account [{}] attempted to create an augment (Aug[{}]) with an invalid id.\n(Item: [{}], Aug1: [{}], Aug2: [{}], Aug3: [{}], Aug4: [{}], Aug5: [{}], Aug6: [{}])\n",
GetName(), account_name, (iter + 1), item->ID, aug1, aug2, aug3, aug4, aug5, aug6);
return false;
@@ -255,7 +255,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
// check that augment is an actual augment
else if(augtest->AugType == 0) {
Message(Chat::Red, "%s (%u) (Aug%i) is not an actual augment.", augtest->Name, augtest->ID, iter + 1);
Log(Logs::Detail, Logs::Inventory, "Player %s on account %s attempted to use a non-augment item (Aug%i) as an augment.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n",
LogInventory("Player [{}] on account [{}] attempted to use a non-augment item (Aug[{}]) as an augment.\n(Item: [{}], Aug1: [{}], Aug2: [{}], Aug3: [{}], Aug4: [{}], Aug5: [{}], Aug6: [{}])\n",
GetName(), account_name, item->ID, (iter + 1), aug1, aug2, aug3, aug4, aug5, aug6);
return false;
@@ -267,7 +267,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
/*
else if(augtest->MinStatus && ((this->Admin() < augtest->MinStatus) || (this->Admin() < RuleI(GM, MinStatusToSummonItem)))) {
Message(Chat::Red, "You are not a GM or do not have the status to summon this augment.");
Log(Logs::Detail, Logs::Inventory, "Player %s on account %s attempted to create a GM-only augment (Aug%i) with a status of %i.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, MinStatus: %u)\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, (iter + 1), this->Admin(), item->ID, aug1, aug2, aug3, aug4, aug5, aug6, item->MinStatus);
return false;
@@ -278,7 +278,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
if(enforcewear) {
if ((item->AugSlotType[iter] == EQEmu::item::AugTypeNone) || !(((uint32)1 << (item->AugSlotType[iter] - 1)) & augtest->AugType)) {
Message(Chat::Red, "Augment %u (Aug%i) is not acceptable wear on Item %u.", augments[iter], iter + 1, item->ID);
Log(Logs::Detail, Logs::Inventory, "Player %s on account %s attempted to augment an item with an unacceptable augment type (Aug%i).\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n",
LogInventory("Player [{}] on account [{}] attempted to augment an item with an unacceptable augment type (Aug[{}]).\n(Item: [{}], Aug1: [{}], Aug2: [{}], Aug3: [{}], Aug4: [{}], Aug5: [{}], Aug6: [{}])\n",
GetName(), account_name, (iter + 1), item->ID, aug1, aug2, aug3, aug4, aug5, aug6);
return false;
@@ -286,7 +286,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
if(item->AugSlotVisible[iter] == 0) {
Message(Chat::Red, "Item %u has not evolved enough to accept Augment %u (Aug%i).", item->ID, augments[iter], iter + 1);
Log(Logs::Detail, Logs::Inventory, "Player %s on account %s attempted to augment an unevolved item with augment type (Aug%i).\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n",
LogInventory("Player [{}] on account [{}] attempted to augment an unevolved item with augment type (Aug[{}]).\n(Item: [{}], Aug1: [{}], Aug2: [{}], Aug3: [{}], Aug4: [{}], Aug5: [{}], Aug6: [{}])\n",
GetName(), account_name, (iter + 1), item->ID, aug1, aug2, aug3, aug4, aug5, aug6);
return false;
@@ -463,7 +463,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
if(restrictfail) {
Message(Chat::Red, "Augment %u (Aug%i) is restricted from wear on Item %u.", augments[iter], (iter + 1), item->ID);
Log(Logs::Detail, Logs::Inventory, "Player %s on account %s attempted to augment an item with a restricted augment (Aug%i).\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n",
LogInventory("Player [{}] on account [{}] attempted to augment an item with a restricted augment (Aug[{}]).\n(Item: [{}], Aug1: [{}], Aug2: [{}], Aug3: [{}], Aug4: [{}], Aug5: [{}], Aug6: [{}])\n",
GetName(), account_name, (iter + 1), item->ID, aug1, aug2, aug3, aug4, aug5, aug6);
return false;
@@ -474,7 +474,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
// check for class usability
if(item->Classes && !(classes &= augtest->Classes)) {
Message(Chat::Red, "Augment %u (Aug%i) will result in an item not usable by any class.", augments[iter], (iter + 1));
Log(Logs::Detail, Logs::Inventory, "Player %s on account %s attempted to create an item unusable by any class.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n",
LogInventory("Player [{}] on account [{}] attempted to create an item unusable by any class.\n(Item: [{}], Aug1: [{}], Aug2: [{}], Aug3: [{}], Aug4: [{}], Aug5: [{}], Aug6: [{}])\n",
GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5, aug6);
return false;
@@ -483,7 +483,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
// check for race usability
if(item->Races && !(races &= augtest->Races)) {
Message(Chat::Red, "Augment %u (Aug%i) will result in an item not usable by any race.", augments[iter], (iter + 1));
Log(Logs::Detail, Logs::Inventory, "Player %s on account %s attempted to create an item unusable by any race.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n",
LogInventory("Player [{}] on account [{}] attempted to create an item unusable by any race.\n(Item: [{}], Aug1: [{}], Aug2: [{}], Aug3: [{}], Aug4: [{}], Aug5: [{}], Aug6: [{}])\n",
GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5, aug6);
return false;
@@ -492,7 +492,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
// check for slot usability
if(item->Slots && !(slots &= augtest->Slots)) {
Message(Chat::Red, "Augment %u (Aug%i) will result in an item not usable in any slot.", augments[iter], (iter + 1));
Log(Logs::Detail, Logs::Inventory, "Player %s on account %s attempted to create an item unusable in any slot.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n",
LogInventory("Player [{}] on account [{}] attempted to create an item unusable in any slot.\n(Item: [{}], Aug1: [{}], Aug2: [{}], Aug3: [{}], Aug4: [{}], Aug5: [{}], Aug6: [{}])\n",
GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5, aug6);
return false;
@@ -519,7 +519,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
if(inst == nullptr) {
Message(Chat::Red, "An unknown server error has occurred and your item was not created.");
// this goes to logfile since this is a major error
Log(Logs::General, Logs::Error, "Player %s on account %s encountered an unknown item creation error.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n",
LogError("Player [{}] on account [{}] encountered an unknown item creation error.\n(Item: [{}], Aug1: [{}], Aug2: [{}], Aug3: [{}], Aug4: [{}], Aug5: [{}], Aug6: [{}])\n",
GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5, aug6);
return false;
@@ -545,7 +545,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
if(!(slots & ((uint32)1 << slottest))) {
Message(0, "This item is not equipable at slot %u - moving to cursor.", to_slot);
Log(Logs::Detail, Logs::Inventory, "Player %s on account %s attempted to equip an item unusable in slot %u - moved to cursor.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n",
LogInventory("Player [{}] on account [{}] attempted to equip an item unusable in slot [{}] - moved to cursor.\n(Item: [{}], Aug1: [{}], Aug2: [{}], Aug3: [{}], Aug4: [{}], Aug5: [{}], Aug6: [{}])\n",
GetName(), account_name, to_slot, item->ID, aug1, aug2, aug3, aug4, aug5, aug6);
to_slot = EQEmu::invslot::slotCursor;
@@ -582,7 +582,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
// Drop item from inventory to ground (generally only dropped from SLOT_CURSOR)
void Client::DropItem(int16 slot_id, bool recurse)
{
Log(Logs::General, Logs::Inventory, "'%s' (char_id: %u) Attempting to drop item from slot %i on the ground",
LogInventory("[{}] (char_id: [{}]) Attempting to drop item from slot [{}] on the ground",
GetCleanName(), CharacterID(), slot_id);
if(GetInv().CheckNoDrop(slot_id, recurse) && RuleI(World, FVNoDropFlag) == 0 ||
@@ -590,20 +590,20 @@ void Client::DropItem(int16 slot_id, bool recurse)
{
auto invalid_drop = m_inv.GetItem(slot_id);
if (!invalid_drop) {
Log(Logs::General, Logs::Inventory, "Error in InventoryProfile::CheckNoDrop() - returned 'true' for empty slot");
LogInventory("Error in InventoryProfile::CheckNoDrop() - returned 'true' for empty slot");
}
else {
if (LogSys.log_settings[Logs::Inventory].is_category_enabled) {
Log(Logs::General, Logs::Inventory, "DropItem() Hack detected - full item parse:");
Log(Logs::General, Logs::Inventory, "depth: 0, Item: '%s' (id: %u), IsDroppable: %s",
LogInventory("DropItem() Hack detected - full item parse:");
LogInventory("depth: 0, Item: [{}] (id: [{}]), IsDroppable: [{}]",
(invalid_drop->GetItem() ? invalid_drop->GetItem()->Name : "null data"), invalid_drop->GetID(), (invalid_drop->IsDroppable(false) ? "true" : "false"));
for (auto iter1 : *invalid_drop->GetContents()) { // depth 1
Log(Logs::General, Logs::Inventory, "-depth: 1, Item: '%s' (id: %u), IsDroppable: %s",
LogInventory("-depth: 1, Item: [{}] (id: [{}]), IsDroppable: [{}]",
(iter1.second->GetItem() ? iter1.second->GetItem()->Name : "null data"), iter1.second->GetID(), (iter1.second->IsDroppable(false) ? "true" : "false"));
for (auto iter2 : *iter1.second->GetContents()) { // depth 2
Log(Logs::General, Logs::Inventory, "--depth: 2, Item: '%s' (id: %u), IsDroppable: %s",
LogInventory("--depth: 2, Item: [{}] (id: [{}]), IsDroppable: [{}]",
(iter2.second->GetItem() ? iter2.second->GetItem()->Name : "null data"), iter2.second->GetID(), (iter2.second->IsDroppable(false) ? "true" : "false"));
}
}
@@ -620,38 +620,38 @@ void Client::DropItem(int16 slot_id, bool recurse)
EQEmu::ItemInstance *inst = m_inv.PopItem(slot_id);
if(inst) {
if (LogSys.log_settings[Logs::Inventory].is_category_enabled) {
Log(Logs::General, Logs::Inventory, "DropItem() Processing - full item parse:");
Log(Logs::General, Logs::Inventory, "depth: 0, Item: '%s' (id: %u), IsDroppable: %s",
LogInventory("DropItem() Processing - full item parse:");
LogInventory("depth: 0, Item: [{}] (id: [{}]), IsDroppable: [{}]",
(inst->GetItem() ? inst->GetItem()->Name : "null data"), inst->GetID(), (inst->IsDroppable(false) ? "true" : "false"));
if (!inst->IsDroppable(false))
Log(Logs::General, Logs::Error, "Non-droppable item being processed for drop by '%s'", GetCleanName());
LogError("Non-droppable item being processed for drop by [{}]", GetCleanName());
for (auto iter1 : *inst->GetContents()) { // depth 1
Log(Logs::General, Logs::Inventory, "-depth: 1, Item: '%s' (id: %u), IsDroppable: %s",
LogInventory("-depth: 1, Item: [{}] (id: [{}]), IsDroppable: [{}]",
(iter1.second->GetItem() ? iter1.second->GetItem()->Name : "null data"), iter1.second->GetID(), (iter1.second->IsDroppable(false) ? "true" : "false"));
if (!iter1.second->IsDroppable(false))
Log(Logs::General, Logs::Error, "Non-droppable item being processed for drop by '%s'", GetCleanName());
LogError("Non-droppable item being processed for drop by [{}]", GetCleanName());
for (auto iter2 : *iter1.second->GetContents()) { // depth 2
Log(Logs::General, Logs::Inventory, "--depth: 2, Item: '%s' (id: %u), IsDroppable: %s",
LogInventory("--depth: 2, Item: [{}] (id: [{}]), IsDroppable: [{}]",
(iter2.second->GetItem() ? iter2.second->GetItem()->Name : "null data"), iter2.second->GetID(), (iter2.second->IsDroppable(false) ? "true" : "false"));
if (!iter2.second->IsDroppable(false))
Log(Logs::General, Logs::Error, "Non-droppable item being processed for drop by '%s'", GetCleanName());
LogError("Non-droppable item being processed for drop by [{}]", GetCleanName());
}
}
}
int i = parse->EventItem(EVENT_DROP_ITEM, this, inst, nullptr, "", slot_id);
if(i != 0) {
Log(Logs::General, Logs::Inventory, "Item drop handled by [EVENT_DROP_ITEM]");
LogInventory("Item drop handled by [EVENT_DROP_ITEM]");
safe_delete(inst);
}
} else {
// Item doesn't exist in inventory!
Log(Logs::General, Logs::Inventory, "DropItem() - No item found in slot %i", slot_id);
LogInventory("DropItem() - No item found in slot [{}]", slot_id);
Message(Chat::Red, "Error: Item not found in slot %i", slot_id);
return;
}
@@ -673,7 +673,7 @@ void Client::DropItem(int16 slot_id, bool recurse)
entity_list.AddObject(object, true);
object->StartDecay();
Log(Logs::General, Logs::Inventory, "Item drop handled ut assolet");
LogInventory("Item drop handled ut assolet");
DropItemQS(inst, false);
safe_delete(inst);
@@ -851,7 +851,7 @@ void Client::SendCursorBuffer()
}
if (!lore_pass) {
Log(Logs::General, Logs::Inventory, "(%s) Duplicate lore items are not allowed - destroying item %s(id:%u) on cursor",
LogInventory("([{}]) Duplicate lore items are not allowed - destroying item [{}](id:[{}]) on cursor",
GetName(), test_item->Name, test_item->ID);
MessageString(Chat::Loot, 290);
parse->EventItem(EVENT_DESTROY_ITEM, this, test_inst, nullptr, "", 0);
@@ -866,7 +866,7 @@ void Client::SendCursorBuffer()
// Remove item from inventory
void Client::DeleteItemInInventory(int16 slot_id, int8 quantity, bool client_update, bool update_db) {
#if (EQDEBUG >= 5)
Log(Logs::General, Logs::None, "DeleteItemInInventory(%i, %i, %s)", slot_id, quantity, (client_update) ? "true":"false");
LogDebug("DeleteItemInInventory([{}], [{}], [{}])", slot_id, quantity, (client_update) ? "true":"false");
#endif
// Added 'IsSlotValid(slot_id)' check to both segments of client packet processing.
@@ -986,7 +986,7 @@ void Client::DeleteItemInInventory(int16 slot_id, int8 quantity, bool client_upd
bool Client::PushItemOnCursor(const EQEmu::ItemInstance& inst, bool client_update)
{
Log(Logs::Detail, Logs::Inventory, "Putting item %s (%d) on the cursor", inst.GetItem()->Name, inst.GetItem()->ID);
LogInventory("Putting item [{}] ([{}]) on the cursor", inst.GetItem()->Name, inst.GetItem()->ID);
m_inv.PushCursor(inst);
if (client_update) {
@@ -1002,7 +1002,7 @@ bool Client::PushItemOnCursor(const EQEmu::ItemInstance& inst, bool client_updat
// (Also saves changes back to the database: this may be optimized in the future)
// client_update: Sends packet to client
bool Client::PutItemInInventory(int16 slot_id, const EQEmu::ItemInstance& inst, bool client_update) {
Log(Logs::Detail, Logs::Inventory, "Putting item %s (%d) into slot %d", inst.GetItem()->Name, inst.GetItem()->ID, slot_id);
LogInventory("Putting item [{}] ([{}]) into slot [{}]", inst.GetItem()->Name, inst.GetItem()->ID, slot_id);
if (slot_id == EQEmu::invslot::slotCursor) { // don't trust macros before conditional statements...
return PushItemOnCursor(inst, client_update);
@@ -1031,7 +1031,7 @@ bool Client::PutItemInInventory(int16 slot_id, const EQEmu::ItemInstance& inst,
void Client::PutLootInInventory(int16 slot_id, const EQEmu::ItemInstance &inst, ServerLootItem_Struct** bag_item_data)
{
Log(Logs::Detail, Logs::Inventory, "Putting loot item %s (%d) into slot %d", inst.GetItem()->Name, inst.GetItem()->ID, slot_id);
LogInventory("Putting loot item [{}] ([{}]) into slot [{}]", inst.GetItem()->Name, inst.GetItem()->ID, slot_id);
bool cursor_empty = m_inv.CursorEmpty();
@@ -1075,8 +1075,7 @@ void Client::PutLootInInventory(int16 slot_id, const EQEmu::ItemInstance &inst,
// Dump bag contents to cursor in the event that owning bag is not the first cursor item
// (This assumes that the data passed is correctly associated..no safety checks are implemented)
if (slot_id == EQEmu::invslot::slotCursor && !cursor_empty) {
Log(Logs::Detail, Logs::Inventory,
"Putting bag loot item %s (%d) into slot %d (non-empty cursor override)",
LogInventory("Putting bag loot item [{}] ([{}]) into slot [{}] (non-empty cursor override)",
inst.GetItem()->Name, inst.GetItem()->ID, EQEmu::invslot::slotCursor);
PutLootInInventory(EQEmu::invslot::slotCursor, *bagitem);
@@ -1084,8 +1083,7 @@ void Client::PutLootInInventory(int16 slot_id, const EQEmu::ItemInstance &inst,
else {
auto bag_slot = EQEmu::InventoryProfile::CalcSlotId(slot_id, index);
Log(Logs::Detail, Logs::Inventory,
"Putting bag loot item %s (%d) into slot %d (bag slot %d)",
LogInventory("Putting bag loot item [{}] ([{}]) into slot [{}] (bag slot [{}])",
inst.GetItem()->Name, inst.GetItem()->ID, bag_slot, index);
PutLootInInventory(bag_slot, *bagitem);
@@ -1521,7 +1519,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
// SoF+ sends a Unix timestamp (should be int32) for src and dst slots every 10 minutes for some reason.
if(src_slot_check < 2147483647)
Message(Chat::Red, "Warning: Invalid slot move from slot %u to slot %u with %u charges!", src_slot_check, dst_slot_check, stack_count_check);
Log(Logs::Detail, Logs::Inventory, "Invalid slot move from slot %u to slot %u with %u charges!", src_slot_check, dst_slot_check, stack_count_check);
LogInventory("Invalid slot move from slot [{}] to slot [{}] with [{}] charges!", src_slot_check, dst_slot_check, stack_count_check);
return false;
}
@@ -1529,7 +1527,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
// SoF+ sends a Unix timestamp (should be int32) for src and dst slots every 10 minutes for some reason.
if(src_slot_check < 2147483647)
Message(Chat::Red, "Warning: Invalid slot move from slot %u to slot %u with %u charges!", src_slot_check, dst_slot_check, stack_count_check);
Log(Logs::Detail, Logs::Inventory, "Invalid slot move from slot %u to slot %u with %u charges!", src_slot_check, dst_slot_check, stack_count_check);
LogInventory("Invalid slot move from slot [{}] to slot [{}] with [{}] charges!", src_slot_check, dst_slot_check, stack_count_check);
return false;
}
@@ -1553,7 +1551,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
}
if (!lore_pass) {
Log(Logs::General, Logs::Inventory, "(%s) Duplicate lore items are not allowed - destroying item %s(id:%u) on cursor",
LogInventory("([{}]) Duplicate lore items are not allowed - destroying item [{}](id:[{}]) on cursor",
GetName(), test_item->Name, test_item->ID);
MessageString(Chat::Loot, 290);
parse->EventItem(EVENT_DESTROY_ITEM, this, test_inst, nullptr, "", 0);
@@ -1565,7 +1563,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
if (move_in->to_slot == (uint32)INVALID_INDEX) {
if (move_in->from_slot == (uint32)EQEmu::invslot::slotCursor) {
Log(Logs::Detail, Logs::Inventory, "Client destroyed item from cursor slot %d", move_in->from_slot);
LogInventory("Client destroyed item from cursor slot [{}]", move_in->from_slot);
if(RuleB(QueryServ, PlayerLogMoves)) { QSSwapItemAuditor(move_in); } // QS Audit
EQEmu::ItemInstance *inst = m_inv.GetItem(EQEmu::invslot::slotCursor);
@@ -1579,7 +1577,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
return true; // Item destroyed by client
}
else {
Log(Logs::Detail, Logs::Inventory, "Deleted item from slot %d as a result of an inventory container tradeskill combine.", move_in->from_slot);
LogInventory("Deleted item from slot [{}] as a result of an inventory container tradeskill combine", move_in->from_slot);
if(RuleB(QueryServ, PlayerLogMoves)) { QSSwapItemAuditor(move_in); } // QS Audit
DeleteItemInInventory(move_in->from_slot);
return true; // Item deletion
@@ -1619,7 +1617,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
EQEmu::ItemInstance* src_inst = m_inv.GetItem(src_slot_id);
EQEmu::ItemInstance* dst_inst = m_inv.GetItem(dst_slot_id);
if (src_inst){
Log(Logs::Detail, Logs::Inventory, "Src slot %d has item %s (%d) with %d charges in it.", src_slot_id, src_inst->GetItem()->Name, src_inst->GetItem()->ID, src_inst->GetCharges());
LogInventory("Src slot [{}] has item [{}] ([{}]) with [{}] charges in it", src_slot_id, src_inst->GetItem()->Name, src_inst->GetItem()->ID, src_inst->GetCharges());
srcitemid = src_inst->GetItem()->ID;
//SetTint(dst_slot_id,src_inst->GetColor());
if (src_inst->GetCharges() > 0 && (src_inst->GetCharges() < (int16)move_in->number_in_stack || move_in->number_in_stack > src_inst->GetItem()->StackSize))
@@ -1629,7 +1627,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
}
}
if (dst_inst) {
Log(Logs::Detail, Logs::Inventory, "Dest slot %d has item %s (%d) with %d charges in it.", dst_slot_id, dst_inst->GetItem()->Name, dst_inst->GetItem()->ID, dst_inst->GetCharges());
LogInventory("Dest slot [{}] has item [{}] ([{}]) with [{}] charges in it", dst_slot_id, dst_inst->GetItem()->Name, dst_inst->GetItem()->ID, dst_inst->GetCharges());
dstitemid = dst_inst->GetItem()->ID;
}
if (Trader && srcitemid>0){
@@ -1664,7 +1662,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
move_in->from_slot = dst_slot_check;
move_in->to_slot = src_slot_check;
move_in->number_in_stack = dst_inst->GetCharges();
if(!SwapItem(move_in)) { Log(Logs::Detail, Logs::Inventory, "Recursive SwapItem call failed due to non-existent destination item (charid: %i, fromslot: %i, toslot: %i)", CharacterID(), src_slot_id, dst_slot_id); }
if(!SwapItem(move_in)) { LogInventory("Recursive SwapItem call failed due to non-existent destination item (charid: [{}], fromslot: [{}], toslot: [{}])", CharacterID(), src_slot_id, dst_slot_id); }
}
return false;
@@ -1672,7 +1670,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
//verify shared bank transactions in the database
if (src_inst && src_slot_id >= EQEmu::invslot::SHARED_BANK_BEGIN && src_slot_id <= EQEmu::invbag::SHARED_BANK_BAGS_END) {
if(!database.VerifyInventory(account_id, src_slot_id, src_inst)) {
Log(Logs::General, Logs::Error, "Player %s on account %s was found exploiting the shared bank.\n", GetName(), account_name);
LogError("Player [{}] on account [{}] was found exploiting the shared bank.\n", GetName(), account_name);
DeleteItemInInventory(dst_slot_id,0,true);
return(false);
}
@@ -1687,7 +1685,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
}
if (dst_inst && dst_slot_id >= EQEmu::invslot::SHARED_BANK_BEGIN && dst_slot_id <= EQEmu::invbag::SHARED_BANK_BAGS_END) {
if(!database.VerifyInventory(account_id, dst_slot_id, dst_inst)) {
Log(Logs::General, Logs::Error, "Player %s on account %s was found exploting the shared bank.\n", GetName(), account_name);
LogError("Player [{}] on account [{}] was found exploting the shared bank.\n", GetName(), account_name);
DeleteItemInInventory(src_slot_id,0,true);
return(false);
}
@@ -1724,7 +1722,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
ndh_item_data.append(StringFormat(", nodrop=%s(%u)", (ndh_item->NoDrop == 0 ? "true" : "false"), ndh_item->NoDrop));
}
}
Log(Logs::General, Logs::Error, "WorldKick() of Player %s(id:%u, acct:%u) due to 'NoDrop Hack' detection >> SlotID:%i, ItemData:'%s'",
LogError("WorldKick() of Player [{}](id:[{}], acct:[{}]) due to 'NoDrop Hack' detection >> SlotID:[{}], ItemData:[{}]",
GetName(), CharacterID(), AccountID(), src_slot_id, ndh_item_data.c_str());
ndh_inst = nullptr;
@@ -1826,7 +1824,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
return false;
}
if (with) {
Log(Logs::Detail, Logs::Inventory, "Trade item move from slot %d to slot %d (trade with %s)", src_slot_id, dst_slot_id, with->GetName());
LogInventory("Trade item move from slot [{}] to slot [{}] (trade with [{}])", src_slot_id, dst_slot_id, with->GetName());
// Fill Trade list with items from cursor
if (!m_inv[EQEmu::invslot::slotCursor]) {
Message(Chat::Red, "Error: Cursor item not located on server!");
@@ -1859,18 +1857,18 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
if (move_in->number_in_stack > 0) {
// Determine if charged items can stack
if(src_inst && !src_inst->IsStackable()) {
Log(Logs::Detail, Logs::Inventory, "Move from %d to %d with stack size %d. %s is not a stackable item. (charname: %s)", src_slot_id, dst_slot_id, move_in->number_in_stack, src_inst->GetItem()->Name, GetName());
LogInventory("Move from [{}] to [{}] with stack size [{}]. [{}] is not a stackable item. (charname: [{}])", src_slot_id, dst_slot_id, move_in->number_in_stack, src_inst->GetItem()->Name, GetName());
return false;
}
if (dst_inst) {
if(src_inst->GetID() != dst_inst->GetID()) {
Log(Logs::Detail, Logs::Inventory, "Move from %d to %d with stack size %d. Incompatible item types: %d != %d", src_slot_id, dst_slot_id, move_in->number_in_stack, src_inst->GetID(), dst_inst->GetID());
LogInventory("Move from [{}] to [{}] with stack size [{}]. Incompatible item types: [{}] != [{}]", src_slot_id, dst_slot_id, move_in->number_in_stack, src_inst->GetID(), dst_inst->GetID());
return(false);
}
if(dst_inst->GetCharges() < dst_inst->GetItem()->StackSize) {
//we have a chance of stacking.
Log(Logs::Detail, Logs::Inventory, "Move from %d to %d with stack size %d. dest has %d/%d charges", src_slot_id, dst_slot_id, move_in->number_in_stack, dst_inst->GetCharges(), dst_inst->GetItem()->StackSize);
LogInventory("Move from [{}] to [{}] with stack size [{}]. dest has [{}]/[{}] charges", src_slot_id, dst_slot_id, move_in->number_in_stack, dst_inst->GetCharges(), dst_inst->GetItem()->StackSize);
// Charges can be emptied into dst
uint16 usedcharges = dst_inst->GetItem()->StackSize - dst_inst->GetCharges();
if (usedcharges > move_in->number_in_stack)
@@ -1882,15 +1880,15 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
// Depleted all charges?
if (src_inst->GetCharges() < 1)
{
Log(Logs::Detail, Logs::Inventory, "Dest (%d) now has %d charges, source (%d) was entirely consumed. (%d moved)", dst_slot_id, dst_inst->GetCharges(), src_slot_id, usedcharges);
LogInventory("Dest ([{}]) now has [{}] charges, source ([{}]) was entirely consumed. ([{}] moved)", dst_slot_id, dst_inst->GetCharges(), src_slot_id, usedcharges);
database.SaveInventory(CharacterID(),nullptr,src_slot_id);
m_inv.DeleteItem(src_slot_id);
all_to_stack = true;
} else {
Log(Logs::Detail, Logs::Inventory, "Dest (%d) now has %d charges, source (%d) has %d (%d moved)", dst_slot_id, dst_inst->GetCharges(), src_slot_id, src_inst->GetCharges(), usedcharges);
LogInventory("Dest ([{}]) now has [{}] charges, source ([{}]) has [{}] ([{}] moved)", dst_slot_id, dst_inst->GetCharges(), src_slot_id, src_inst->GetCharges(), usedcharges);
}
} else {
Log(Logs::Detail, Logs::Inventory, "Move from %d to %d with stack size %d. Exceeds dest maximum stack size: %d/%d", src_slot_id, dst_slot_id, move_in->number_in_stack, (src_inst->GetCharges()+dst_inst->GetCharges()), dst_inst->GetItem()->StackSize);
LogInventory("Move from [{}] to [{}] with stack size [{}]. Exceeds dest maximum stack size: [{}]/[{}]", src_slot_id, dst_slot_id, move_in->number_in_stack, (src_inst->GetCharges()+dst_inst->GetCharges()), dst_inst->GetItem()->StackSize);
return false;
}
}
@@ -1900,12 +1898,12 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
// Move entire stack
EQEmu::InventoryProfile::SwapItemFailState fail_state = EQEmu::InventoryProfile::swapInvalid;
if (!m_inv.SwapItem(src_slot_id, dst_slot_id, fail_state)) { return false; }
Log(Logs::Detail, Logs::Inventory, "Move entire stack from %d to %d with stack size %d. Dest empty.", src_slot_id, dst_slot_id, move_in->number_in_stack);
LogInventory("Move entire stack from [{}] to [{}] with stack size [{}]. Dest empty", src_slot_id, dst_slot_id, move_in->number_in_stack);
}
else {
// Split into two
src_inst->SetCharges(src_inst->GetCharges() - move_in->number_in_stack);
Log(Logs::Detail, Logs::Inventory, "Split stack of %s (%d) from slot %d to %d with stack size %d. Src keeps %d.", src_inst->GetItem()->Name, src_inst->GetItem()->ID, src_slot_id, dst_slot_id, move_in->number_in_stack, src_inst->GetCharges());
LogInventory("Split stack of [{}] ([{}]) from slot [{}] to [{}] with stack size [{}]. Src keeps [{}]", src_inst->GetItem()->Name, src_inst->GetItem()->ID, src_slot_id, dst_slot_id, move_in->number_in_stack, src_inst->GetCharges());
EQEmu::ItemInstance* inst = database.CreateItem(src_inst->GetItem(), move_in->number_in_stack);
m_inv.PutItem(dst_slot_id, *inst);
safe_delete(inst);
@@ -1944,7 +1942,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
return false;
}
Log(Logs::Detail, Logs::Inventory, "Moving entire item from slot %d to slot %d", src_slot_id, dst_slot_id);
LogInventory("Moving entire item from slot [{}] to slot [{}]", src_slot_id, dst_slot_id);
if (src_slot_id <= EQEmu::invslot::EQUIPMENT_END) {
if(src_inst) {
@@ -2007,7 +2005,7 @@ void Client::SwapItemResync(MoveItem_Struct* move_slots) {
// resync the 'from' and 'to' slots on an as-needed basis
// Not as effective as the full process, but less intrusive to gameplay
Log(Logs::Detail, Logs::Inventory, "Inventory desyncronization. (charname: %s, source: %i, destination: %i)", GetName(), move_slots->from_slot, move_slots->to_slot);
LogInventory("Inventory desyncronization. (charname: [{}], source: [{}], destination: [{}])", GetName(), move_slots->from_slot, move_slots->to_slot);
Message(Chat::Yellow, "Inventory Desyncronization detected: Resending slot data...");
if (move_slots->from_slot >= EQEmu::invslot::EQUIPMENT_BEGIN && move_slots->from_slot <= EQEmu::invbag::CURSOR_BAG_END) {
@@ -2459,7 +2457,7 @@ static bool CopyBagContents(EQEmu::ItemInstance* new_bag, const EQEmu::ItemInsta
for (auto bag_slot = 0; bag_slot < old_bag->GetItem()->BagSlots; ++bag_slot) {
if (!old_bag->GetItem(bag_slot)) { continue; }
if (old_bag->GetItem(bag_slot)->GetItem()->Size > new_bag->GetItem()->BagSize) {
Log(Logs::General, Logs::Inventory, "Copy Bag Contents: Failure due to %s is larger than size capacity of %s (%i > %i)",
LogInventory("Copy Bag Contents: Failure due to [{}] is larger than size capacity of [{}] ([{}] > [{}])",
old_bag->GetItem(bag_slot)->GetItem()->Name, new_bag->GetItem()->Name, old_bag->GetItem(bag_slot)->GetItem()->Size, new_bag->GetItem()->BagSize);
return false;
}
@@ -2493,7 +2491,7 @@ void Client::DisenchantSummonedBags(bool client_update)
if (!new_inst) { continue; }
if (CopyBagContents(new_inst, inst)) {
Log(Logs::General, Logs::Inventory, "Disenchant Summoned Bags: Replacing %s with %s in slot %i", inst->GetItem()->Name, new_inst->GetItem()->Name, slot_id);
LogInventory("Disenchant Summoned Bags: Replacing [{}] with [{}] in slot [{}]", inst->GetItem()->Name, new_inst->GetItem()->Name, slot_id);
PutItemInInventory(slot_id, *new_inst, client_update);
}
safe_delete(new_inst);
@@ -2517,7 +2515,7 @@ void Client::DisenchantSummonedBags(bool client_update)
if (!new_inst) { continue; }
if (CopyBagContents(new_inst, inst)) {
Log(Logs::General, Logs::Inventory, "Disenchant Summoned Bags: Replacing %s with %s in slot %i", inst->GetItem()->Name, new_inst->GetItem()->Name, slot_id);
LogInventory("Disenchant Summoned Bags: Replacing [{}] with [{}] in slot [{}]", inst->GetItem()->Name, new_inst->GetItem()->Name, slot_id);
PutItemInInventory(slot_id, *new_inst, client_update);
}
safe_delete(new_inst);
@@ -2538,7 +2536,7 @@ void Client::DisenchantSummonedBags(bool client_update)
if (!new_inst) { continue; }
if (CopyBagContents(new_inst, inst)) {
Log(Logs::General, Logs::Inventory, "Disenchant Summoned Bags: Replacing %s with %s in slot %i", inst->GetItem()->Name, new_inst->GetItem()->Name, slot_id);
LogInventory("Disenchant Summoned Bags: Replacing [{}] with [{}] in slot [{}]", inst->GetItem()->Name, new_inst->GetItem()->Name, slot_id);
PutItemInInventory(slot_id, *new_inst, client_update);
}
safe_delete(new_inst);
@@ -2559,7 +2557,7 @@ void Client::DisenchantSummonedBags(bool client_update)
if (!new_inst) { break; }
if (CopyBagContents(new_inst, inst)) {
Log(Logs::General, Logs::Inventory, "Disenchant Summoned Bags: Replacing %s with %s in slot %i", inst->GetItem()->Name, new_inst->GetItem()->Name, EQEmu::invslot::slotCursor);
LogInventory("Disenchant Summoned Bags: Replacing [{}] with [{}] in slot [{}]", inst->GetItem()->Name, new_inst->GetItem()->Name, EQEmu::invslot::slotCursor);
std::list<EQEmu::ItemInstance*> local;
local.push_front(new_inst);
m_inv.PopItem(EQEmu::invslot::slotCursor);
@@ -2598,7 +2596,7 @@ void Client::RemoveNoRent(bool client_update)
auto inst = m_inv[slot_id];
if(inst && !inst->GetItem()->NoRent) {
Log(Logs::Detail, Logs::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
LogInventory("NoRent Timer Lapse: Deleting [{}] from slot [{}]", inst->GetItem()->Name, slot_id);
DeleteItemInInventory(slot_id, 0, client_update);
}
}
@@ -2609,7 +2607,7 @@ void Client::RemoveNoRent(bool client_update)
auto inst = m_inv[slot_id];
if (inst && !inst->GetItem()->NoRent) {
Log(Logs::Detail, Logs::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
LogInventory("NoRent Timer Lapse: Deleting [{}] from slot [{}]", inst->GetItem()->Name, slot_id);
DeleteItemInInventory(slot_id, 0, client_update);
}
}
@@ -2621,7 +2619,7 @@ void Client::RemoveNoRent(bool client_update)
auto inst = m_inv[slot_id];
if(inst && !inst->GetItem()->NoRent) {
Log(Logs::Detail, Logs::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
LogInventory("NoRent Timer Lapse: Deleting [{}] from slot [{}]", inst->GetItem()->Name, slot_id);
DeleteItemInInventory(slot_id, 0, client_update);
}
}
@@ -2632,7 +2630,7 @@ void Client::RemoveNoRent(bool client_update)
auto inst = m_inv[slot_id];
if(inst && !inst->GetItem()->NoRent) {
Log(Logs::Detail, Logs::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
LogInventory("NoRent Timer Lapse: Deleting [{}] from slot [{}]", inst->GetItem()->Name, slot_id);
DeleteItemInInventory(slot_id, 0, false); // Can't delete from client Bank slots
}
}
@@ -2644,7 +2642,7 @@ void Client::RemoveNoRent(bool client_update)
auto inst = m_inv[slot_id];
if(inst && !inst->GetItem()->NoRent) {
Log(Logs::Detail, Logs::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
LogInventory("NoRent Timer Lapse: Deleting [{}] from slot [{}]", inst->GetItem()->Name, slot_id);
DeleteItemInInventory(slot_id, 0, false); // Can't delete from client Bank Container slots
}
}
@@ -2652,7 +2650,7 @@ void Client::RemoveNoRent(bool client_update)
for (auto slot_id = EQEmu::invslot::SHARED_BANK_BEGIN; slot_id <= EQEmu::invslot::SHARED_BANK_END; ++slot_id) {
auto inst = m_inv[slot_id];
if(inst && !inst->GetItem()->NoRent) {
Log(Logs::Detail, Logs::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
LogInventory("NoRent Timer Lapse: Deleting [{}] from slot [{}]", inst->GetItem()->Name, slot_id);
DeleteItemInInventory(slot_id, 0, false); // Can't delete from client Shared Bank slots
}
}
@@ -2660,7 +2658,7 @@ void Client::RemoveNoRent(bool client_update)
for (auto slot_id = EQEmu::invbag::SHARED_BANK_BAGS_BEGIN; slot_id <= EQEmu::invbag::SHARED_BANK_BAGS_END; ++slot_id) {
auto inst = m_inv[slot_id];
if(inst && !inst->GetItem()->NoRent) {
Log(Logs::Detail, Logs::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
LogInventory("NoRent Timer Lapse: Deleting [{}] from slot [{}]", inst->GetItem()->Name, slot_id);
DeleteItemInInventory(slot_id, 0, false); // Can't delete from client Shared Bank Container slots
}
}
@@ -2678,7 +2676,7 @@ void Client::RemoveNoRent(bool client_update)
auto inst = *iter;
if (inst == nullptr) { continue; }
if (!inst->GetItem()->NoRent) {
Log(Logs::Detail, Logs::Inventory, "NoRent Timer Lapse: Deleting %s from `Limbo`", inst->GetItem()->Name);
LogInventory("NoRent Timer Lapse: Deleting [{}] from `Limbo`", inst->GetItem()->Name);
}
else {
m_inv.PushCursor(*inst);
@@ -2702,7 +2700,7 @@ void Client::RemoveDuplicateLore(bool client_update)
auto inst = m_inv.PopItem(slot_id);
if (inst == nullptr) { continue; }
if(CheckLoreConflict(inst->GetItem())) {
Log(Logs::Detail, Logs::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
LogInventory("Lore Duplication Error: Deleting [{}] from slot [{}]", inst->GetItem()->Name, slot_id);
database.SaveInventory(character_id, nullptr, slot_id);
}
else {
@@ -2718,7 +2716,7 @@ void Client::RemoveDuplicateLore(bool client_update)
auto inst = m_inv.PopItem(slot_id);
if (inst == nullptr) { continue; }
if (CheckLoreConflict(inst->GetItem())) {
Log(Logs::Detail, Logs::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
LogInventory("Lore Duplication Error: Deleting [{}] from slot [{}]", inst->GetItem()->Name, slot_id);
database.SaveInventory(character_id, nullptr, slot_id);
}
else {
@@ -2735,7 +2733,7 @@ void Client::RemoveDuplicateLore(bool client_update)
auto inst = m_inv.PopItem(slot_id);
if (inst == nullptr) { continue; }
if(CheckLoreConflict(inst->GetItem())) {
Log(Logs::Detail, Logs::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
LogInventory("Lore Duplication Error: Deleting [{}] from slot [{}]", inst->GetItem()->Name, slot_id);
database.SaveInventory(character_id, nullptr, slot_id);
}
else {
@@ -2751,7 +2749,7 @@ void Client::RemoveDuplicateLore(bool client_update)
auto inst = m_inv.PopItem(slot_id);
if (inst == nullptr) { continue; }
if(CheckLoreConflict(inst->GetItem())) {
Log(Logs::Detail, Logs::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
LogInventory("Lore Duplication Error: Deleting [{}] from slot [{}]", inst->GetItem()->Name, slot_id);
database.SaveInventory(character_id, nullptr, slot_id);
}
else {
@@ -2768,7 +2766,7 @@ void Client::RemoveDuplicateLore(bool client_update)
auto inst = m_inv.PopItem(slot_id);
if (inst == nullptr) { continue; }
if(CheckLoreConflict(inst->GetItem())) {
Log(Logs::Detail, Logs::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
LogInventory("Lore Duplication Error: Deleting [{}] from slot [{}]", inst->GetItem()->Name, slot_id);
database.SaveInventory(character_id, nullptr, slot_id);
}
else {
@@ -2793,7 +2791,7 @@ void Client::RemoveDuplicateLore(bool client_update)
auto inst = *iter;
if (inst == nullptr) { continue; }
if (CheckLoreConflict(inst->GetItem())) {
Log(Logs::Detail, Logs::Inventory, "Lore Duplication Error: Deleting %s from `Limbo`", inst->GetItem()->Name);
LogInventory("Lore Duplication Error: Deleting [{}] from `Limbo`", inst->GetItem()->Name);
safe_delete(inst);
}
else {
@@ -2812,7 +2810,7 @@ void Client::RemoveDuplicateLore(bool client_update)
m_inv.PushCursor(*inst);
}
else {
Log(Logs::Detail, Logs::Inventory, "Lore Duplication Error: Deleting %s from `Limbo`", inst->GetItem()->Name);
LogInventory("Lore Duplication Error: Deleting [{}] from `Limbo`", inst->GetItem()->Name);
}
safe_delete(inst);
}
@@ -2830,7 +2828,7 @@ void Client::MoveSlotNotAllowed(bool client_update)
auto inst = m_inv.PopItem(slot_id);
bool is_arrow = (inst->GetItem()->ItemType == EQEmu::item::ItemTypeArrow) ? true : false;
int16 free_slot_id = m_inv.FindFreeSlot(inst->IsClassBag(), true, inst->GetItem()->Size, is_arrow);
Log(Logs::Detail, Logs::Inventory, "Slot Assignment Error: Moving %s from slot %i to %i", inst->GetItem()->Name, slot_id, free_slot_id);
LogInventory("Slot Assignment Error: Moving [{}] from slot [{}] to [{}]", inst->GetItem()->Name, slot_id, free_slot_id);
PutItemInInventory(free_slot_id, *inst, client_update);
database.SaveInventory(character_id, nullptr, slot_id);
safe_delete(inst);
@@ -2846,7 +2844,7 @@ void Client::MoveSlotNotAllowed(bool client_update)
// auto inst = m_inv.PopItem(slot_id);
// bool is_arrow = (inst->GetItem()->ItemType == EQEmu::item::ItemTypeArrow) ? true : false;
// int16 free_slot_id = m_inv.FindFreeSlot(inst->IsClassBag(), true, inst->GetItem()->Size, is_arrow);
// Log(Logs::Detail, Logs::Inventory, "Slot Assignment Error: Moving %s from slot %i to %i", inst->GetItem()->Name, slot_id, free_slot_id);
// LogInventory("Slot Assignment Error: Moving [{}] from slot [{}] to [{}]", inst->GetItem()->Name, slot_id, free_slot_id);
// PutItemInInventory(free_slot_id, *inst, client_update);
// database.SaveInventory(character_id, nullptr, slot_id);
// safe_delete(inst);
@@ -3001,7 +2999,7 @@ void Client::CreateBandolier(const EQApplicationPacket *app)
BandolierCreate_Struct *bs = (BandolierCreate_Struct*)app->pBuffer;
Log(Logs::Detail, Logs::Inventory, "Char: %s Creating Bandolier Set %i, Set Name: %s", GetName(), bs->Number, bs->Name);
LogInventory("Char: [{}] Creating Bandolier Set [{}], Set Name: [{}]", GetName(), bs->Number, bs->Name);
strcpy(m_pp.bandoliers[bs->Number].Name, bs->Name);
const EQEmu::ItemInstance* InvItem = nullptr;
@@ -3015,13 +3013,13 @@ void Client::CreateBandolier(const EQApplicationPacket *app)
InvItem = GetInv()[WeaponSlot];
if(InvItem) {
BaseItem = InvItem->GetItem();
Log(Logs::Detail, Logs::Inventory, "Char: %s adding item %s to slot %i", 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].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);
}
else {
Log(Logs::Detail, Logs::Inventory, "Char: %s no item in slot %i", GetName(), WeaponSlot);
LogInventory("Char: [{}] no item in slot [{}]", GetName(), WeaponSlot);
m_pp.bandoliers[bs->Number].Items[BandolierSlot].ID = 0;
m_pp.bandoliers[bs->Number].Items[BandolierSlot].Icon = 0;
}
@@ -3031,7 +3029,7 @@ void Client::CreateBandolier(const EQApplicationPacket *app)
void Client::RemoveBandolier(const EQApplicationPacket *app)
{
BandolierDelete_Struct *bds = (BandolierDelete_Struct*)app->pBuffer;
Log(Logs::Detail, Logs::Inventory, "Char: %s removing set", GetName(), bds->Number);
LogInventory("Char: [{}] removing set", GetName(), bds->Number);
memset(m_pp.bandoliers[bds->Number].Name, 0, 32);
for(int i = bandolierPrimary; i <= bandolierAmmo; i++) {
m_pp.bandoliers[bds->Number].Items[i].ID = 0;
@@ -3046,7 +3044,7 @@ void Client::SetBandolier(const EQApplicationPacket *app)
// any items currently in the weapon slots to inventory.
BandolierSet_Struct *bss = (BandolierSet_Struct*)app->pBuffer;
Log(Logs::Detail, Logs::Inventory, "Char: %s activating set %i", GetName(), bss->Number);
LogInventory("Char: [{}] activating set [{}]", GetName(), bss->Number);
int16 slot = 0;
int16 WeaponSlot = 0;
EQEmu::ItemInstance *BandolierItems[4]; // Temporary holding area for the weapons we pull out of their inventory
@@ -3113,19 +3111,19 @@ void Client::SetBandolier(const EQApplicationPacket *app)
else { // The player doesn't have the required weapon with them.
BandolierItems[BandolierSlot] = 0;
if (slot == INVALID_INDEX) {
Log(Logs::Detail, Logs::Inventory, "Character does not have required bandolier item for slot %i", WeaponSlot);
LogInventory("Character does not have required bandolier item for slot [{}]", WeaponSlot);
EQEmu::ItemInstance *InvItem = m_inv.PopItem(WeaponSlot);
if(InvItem) {
// If there was an item in that weapon slot, put it in the inventory
Log(Logs::Detail, Logs::Inventory, "returning item %s in weapon slot %i to inventory",
LogInventory("returning item [{}] in weapon slot [{}] to inventory",
InvItem->GetItem()->Name, WeaponSlot);
Log(Logs::Detail, Logs::Inventory, "returning item %s in weapon slot %i to inventory", InvItem->GetItem()->Name, WeaponSlot);
LogInventory("returning item [{}] in weapon slot [{}] to inventory", InvItem->GetItem()->Name, WeaponSlot);
if (MoveItemToInventory(InvItem)) {
database.SaveInventory(character_id, 0, WeaponSlot);
Log(Logs::General, Logs::Error, "returning item %s in weapon slot %i to inventory", InvItem->GetItem()->Name, WeaponSlot);
LogError("returning item [{}] in weapon slot [{}] to inventory", InvItem->GetItem()->Name, WeaponSlot);
}
else {
Log(Logs::General, Logs::Error, "Char: %s, ERROR returning %s to inventory", GetName(), InvItem->GetItem()->Name);
LogError("Char: [{}], ERROR returning [{}] to inventory", GetName(), InvItem->GetItem()->Name);
}
safe_delete(InvItem);
}
@@ -3159,7 +3157,7 @@ void Client::SetBandolier(const EQApplicationPacket *app)
if(InvItem) {
// If there was already an item in that weapon slot that we replaced, find a place to put it
if (!MoveItemToInventory(InvItem)) {
Log(Logs::General, Logs::Error, "Char: %s, ERROR returning %s to inventory", GetName(), InvItem->GetItem()->Name);
LogError("Char: [{}], ERROR returning [{}] to inventory", GetName(), InvItem->GetItem()->Name);
}
safe_delete(InvItem);
}
@@ -3170,13 +3168,13 @@ void Client::SetBandolier(const EQApplicationPacket *app)
// put it in the player's inventory.
EQEmu::ItemInstance *InvItem = m_inv.PopItem(WeaponSlot);
if(InvItem) {
Log(Logs::Detail, Logs::Inventory, "Bandolier has no item for slot %i, returning item %s to inventory", WeaponSlot, InvItem->GetItem()->Name);
LogInventory("Bandolier has no item for slot [{}], returning item [{}] to inventory", WeaponSlot, InvItem->GetItem()->Name);
// If there was an item in that weapon slot, put it in the inventory
if (MoveItemToInventory(InvItem)) {
database.SaveInventory(character_id, 0, WeaponSlot);
}
else {
Log(Logs::General, Logs::Error, "Char: %s, ERROR returning %s to inventory", GetName(), InvItem->GetItem()->Name);
LogError("Char: [{}], ERROR returning [{}] to inventory", GetName(), InvItem->GetItem()->Name);
}
safe_delete(InvItem);
}
@@ -3209,7 +3207,7 @@ bool Client::MoveItemToInventory(EQEmu::ItemInstance *ItemToReturn, bool UpdateC
return false;
}
Log(Logs::Detail, Logs::Inventory,"Char: %s Returning %s to inventory", GetName(), ItemToReturn->GetItem()->Name);
LogInventory("Char: [{}] Returning [{}] to inventory", GetName(), ItemToReturn->GetItem()->Name);
uint32 ItemID = ItemToReturn->GetItem()->ID;
@@ -3293,7 +3291,7 @@ bool Client::MoveItemToInventory(EQEmu::ItemInstance *ItemToReturn, bool UpdateC
database.SaveInventory(character_id, m_inv.GetItem(i), i);
Log(Logs::Detail, Logs::Inventory, "Char: %s Storing in main inventory slot %i", GetName(), i);
LogInventory("Char: [{}] Storing in main inventory slot [{}]", GetName(), i);
return true;
}
@@ -3316,7 +3314,7 @@ bool Client::MoveItemToInventory(EQEmu::ItemInstance *ItemToReturn, bool UpdateC
database.SaveInventory(character_id, m_inv.GetItem(BaseSlotID + BagSlot), BaseSlotID + BagSlot);
Log(Logs::Detail, Logs::Inventory, "Char: %s Storing in bag slot %i", GetName(), BaseSlotID + BagSlot);
LogInventory("Char: [{}] Storing in bag slot [{}]", GetName(), BaseSlotID + BagSlot);
return true;
}
@@ -3326,7 +3324,7 @@ bool Client::MoveItemToInventory(EQEmu::ItemInstance *ItemToReturn, bool UpdateC
// Store on the cursor
//
Log(Logs::Detail, Logs::Inventory, "Char: %s No space, putting on the cursor", GetName());
LogInventory("Char: [{}] No space, putting on the cursor", GetName());
PushItemOnCursor(*ItemToReturn, UpdateClient);
@@ -3394,7 +3392,7 @@ bool Client::InterrogateInventory(Client* requester, bool log, bool silent, bool
log = true;
if (log) {
Log(Logs::General, Logs::Error, "Client::InterrogateInventory() called for %s by %s with an error state of %s", GetName(), requester->GetName(), (error ? "TRUE" : "FALSE"));
LogError("Client::InterrogateInventory() called for [{}] by [{}] with an error state of [{}]", GetName(), requester->GetName(), (error ? "TRUE" : "FALSE"));
}
if (!silent) {
requester->Message(Chat::Default, "--- Inventory Interrogation Report for %s (requested by: %s, error state: %s) ---", GetName(), requester->GetName(), (error ? "TRUE" : "FALSE"));
@@ -3415,8 +3413,8 @@ bool Client::InterrogateInventory(Client* requester, bool log, bool silent, bool
}
if (log) {
Log(Logs::General, Logs::Error, "Target interrogate inventory flag: %s", (GetInterrogateInvState() ? "TRUE" : "FALSE"));
Log(Logs::Detail, Logs::None, "[CLIENT] Client::InterrogateInventory() -- End");
LogError("Target interrogate inventory flag: [{}]", (GetInterrogateInvState() ? "TRUE" : "FALSE"));
LogDebug("[CLIENT] Client::InterrogateInventory() -- End");
}
if (!silent) {
requester->Message(Chat::Default, "Target interrogation flag: %s", (GetInterrogateInvState() ? "TRUE" : "FALSE"));
@@ -3431,7 +3429,7 @@ bool Client::InterrogateInventory(Client* requester, bool log, bool silent, bool
void Client::InterrogateInventory_(bool errorcheck, Client* requester, int16 head, int16 index, const EQEmu::ItemInstance* inst, const EQEmu::ItemInstance* parent, bool log, bool silent, bool &error, int depth)
{
if (depth >= 10) {
Log(Logs::Detail, Logs::None, "[CLIENT] Client::InterrogateInventory_() - Recursion count has exceeded the maximum allowable (You have a REALLY BIG PROBLEM!!)");
LogDebug("[CLIENT] Client::InterrogateInventory_() - Recursion count has exceeded the maximum allowable (You have a REALLY BIG PROBLEM!!)");
return;
}
@@ -3462,7 +3460,7 @@ void Client::InterrogateInventory_(bool errorcheck, Client* requester, int16 hea
else { e = ""; }
if (log) {
Log(Logs::General, Logs::Error, "Head: %i, Depth: %i, Instance: %s, Parent: %s%s",
LogError("Head: [{}], Depth: [{}], Instance: [{}], Parent: [{}][{}]",
head, depth, i.c_str(), p.c_str(), e.c_str());
}
if (!silent) {
+2 -2
View File
@@ -240,7 +240,7 @@ void NPC::AddLootDrop(const EQEmu::ItemData *item2, ItemList* itemlist, int16 ch
auto item = new ServerLootItem_Struct;
#if EQDEBUG>=11
Log(Logs::General, Logs::None, "Adding drop to npc: %s, Item: %i", GetName(), item2->ID);
LogDebug("Adding drop to npc: [{}], Item: [{}]", GetName(), item2->ID);
#endif
EQApplicationPacket* outapp = nullptr;
@@ -352,7 +352,7 @@ void NPC::AddLootDrop(const EQEmu::ItemData *item2, ItemList* itemlist, int16 ch
}
else if (foundslot == EQEmu::invslot::slotSecondary
&& (GetOwner() != nullptr || (CanThisClassDualWield() && zone->random.Roll(NPC_DW_CHANCE)) || (item2->Damage==0)) &&
(item2->IsType1HWeapon() || item2->ItemType == EQEmu::item::ItemTypeShield))
(item2->IsType1HWeapon() || item2->ItemType == EQEmu::item::ItemTypeShield || item2->ItemType == EQEmu::item::ItemTypeLight))
{
if (item2->Proc.Effect!=0)
CastToMob()->AddProcToWeapon(item2->Proc.Effect, true);
+5 -5
View File
@@ -1368,14 +1368,14 @@ double lua_clock() {
}
void lua_debug(std::string message) {
Log(Logs::General, Logs::QuestDebug, message);
Log(Logs::General, Logs::QuestDebug, message.c_str());
}
void lua_debug(std::string message, int level) {
if (level < Logs::General || level > Logs::Detail)
return;
Log(static_cast<Logs::DebugLevel>(level), Logs::QuestDebug, message);
Log(static_cast<Logs::DebugLevel>(level), Logs::QuestDebug, message.c_str());
}
void lua_update_zone_header(std::string type, std::string value) {
@@ -2327,17 +2327,17 @@ luabind::scope lua_register_rules_const() {
return luabind::class_<Rule>("Rule")
.enum_("constants")
[
#define RULE_INT(cat, rule, default_value) \
#define RULE_INT(cat, rule, default_value, notes) \
luabind::value(#rule, RuleManager::Int__##rule),
#include "../common/ruletypes.h"
luabind::value("_IntRuleCount", RuleManager::_IntRuleCount),
#undef RULE_INT
#define RULE_REAL(cat, rule, default_value) \
#define RULE_REAL(cat, rule, default_value, notes) \
luabind::value(#rule, RuleManager::Real__##rule),
#include "../common/ruletypes.h"
luabind::value("_RealRuleCount", RuleManager::_RealRuleCount),
#undef RULE_REAL
#define RULE_BOOL(cat, rule, default_value) \
#define RULE_BOOL(cat, rule, default_value, notes) \
luabind::value(#rule, RuleManager::Bool__##rule),
#include "../common/ruletypes.h"
luabind::value("_BoolRuleCount", RuleManager::_BoolRuleCount)
+6
View File
@@ -335,6 +335,11 @@ int Lua_StatBonuses::Geteffective_casting_level() const {
return self->effective_casting_level;
}
int Lua_StatBonuses::Getadjusted_casting_skill() const {
Lua_Safe_Call_Int();
return self->adjusted_casting_skill;
}
int Lua_StatBonuses::Getreflect_chance() const {
Lua_Safe_Call_Int();
return self->reflect_chance;
@@ -1349,6 +1354,7 @@ luabind::scope lua_register_stat_bonuses() {
.def("skillmod", &Lua_StatBonuses::Getskillmod)
.def("skillmodmax", &Lua_StatBonuses::Getskillmodmax)
.def("effective_casting_level", &Lua_StatBonuses::Geteffective_casting_level)
.def("adjusted_casting_skill", &Lua_StatBonuses::Getadjusted_casting_skill)
.def("reflect_chance", &Lua_StatBonuses::Getreflect_chance)
.def("singingMod", &Lua_StatBonuses::GetsingingMod)
.def("Amplification", &Lua_StatBonuses::GetAmplification)
+1
View File
@@ -91,6 +91,7 @@ public:
int32 Getskillmod(int idx) const;
int32 Getskillmodmax(int idx) const;
int Geteffective_casting_level() const;
int Getadjusted_casting_skill() const;
int Getreflect_chance() const;
uint32 GetsingingMod() const;
uint32 GetAmplification() const;
+23 -23
View File
@@ -223,7 +223,7 @@ Map *Map::LoadMapFile(std::string file) {
filename += file;
filename += ".map";
Log(Logs::General, Logs::Status, "Attempting to load Map File '%s'", filename.c_str());
LogInfo("Attempting to load Map File [{}]", filename.c_str());
auto m = new Map();
if (m->Load(filename)) {
@@ -238,7 +238,7 @@ Map *Map::LoadMapFile(std::string file) {
bool Map::Load(std::string filename, bool force_mmf_overwrite)
{
if (LoadMMF(filename, force_mmf_overwrite)) {
Log(Logs::General, Logs::Status, "Loaded .MMF Map File in place of '%s'", filename.c_str());
LogInfo("Loaded .MMF Map File in place of [{}]", filename.c_str());
return true;
}
#else
@@ -255,7 +255,7 @@ bool Map::Load(std::string filename)
}
if(version == 0x01000000) {
Log(Logs::General, Logs::Status, "Loaded V1 Map File '%s'", filename.c_str());
LogInfo("Loaded V1 Map File [{}]", filename.c_str());
bool v = LoadV1(f);
fclose(f);
@@ -266,7 +266,7 @@ bool Map::Load(std::string filename)
return v;
} else if(version == 0x02000000) {
Log(Logs::General, Logs::Status, "Loaded V2 Map File '%s'", filename.c_str());
LogInfo("Loaded V2 Map File [{}]", filename.c_str());
bool v = LoadV2(f);
fclose(f);
@@ -943,53 +943,53 @@ bool Map::LoadMMF(const std::string& map_file_name, bool force_mmf_overwrite)
std::string mmf_file_name = map_file_name;
strip_map_extension(mmf_file_name);
if (!add_mmf_extension(mmf_file_name)) {
Log(Logs::General, Logs::Zone_Server, "Failed to load Map MMF file: '%s'", mmf_file_name.c_str());
LogInfo("Failed to load Map MMF file: [{}]", mmf_file_name.c_str());
return false;
}
FILE *f = fopen(mmf_file_name.c_str(), "rb");
if (!f) {
Log(Logs::General, Logs::Zone_Server, "Failed to load Map MMF file: '%s' - could not open file", mmf_file_name.c_str());
LogInfo("Failed to load Map MMF file: [{}] - could not open file", mmf_file_name.c_str());
return false;
}
uint32 file_version;
if (fread(&file_version, sizeof(uint32), 1, f) != 1) {
fclose(f);
Log(Logs::General, Logs::Zone_Server, "Failed to load Map MMF file: '%s' - f@file_version", mmf_file_name.c_str());
LogInfo("Failed to load Map MMF file: [{}] - f@file_version", mmf_file_name.c_str());
return false;
}
uint32 rm_buffer_size;
if (fread(&rm_buffer_size, sizeof(uint32), 1, f) != 1) {
fclose(f);
Log(Logs::General, Logs::Zone_Server, "Failed to load Map MMF file: '%s' - f@rm_buffer_size", mmf_file_name.c_str());
LogInfo("Failed to load Map MMF file: [{}] - f@rm_buffer_size", mmf_file_name.c_str());
return false;
}
uint32 rm_buffer_crc32;
if (fread(&rm_buffer_crc32, sizeof(uint32), 1, f) != 1) {
fclose(f);
Log(Logs::General, Logs::Zone_Server, "Failed to load Map MMF file: '%s' - f@rm_buffer_crc32", mmf_file_name.c_str());
LogInfo("Failed to load Map MMF file: [{}] - f@rm_buffer_crc32", mmf_file_name.c_str());
return false;
}
if (rm_buffer_crc32 != /*crc32_check*/ 0) {
fclose(f);
Log(Logs::General, Logs::Zone_Server, "Failed to load Map MMF file: '%s' - bad rm_buffer checksum", mmf_file_name.c_str());
LogInfo("Failed to load Map MMF file: [{}] - bad rm_buffer checksum", mmf_file_name.c_str());
return false;
}
uint32 mmf_buffer_size;
if (fread(&mmf_buffer_size, sizeof(uint32), 1, f) != 1) {
fclose(f);
Log(Logs::General, Logs::Zone_Server, "Failed to load Map MMF file: '%s' - f@mmf_buffer_size", mmf_file_name.c_str());
LogInfo("Failed to load Map MMF file: [{}] - f@mmf_buffer_size", mmf_file_name.c_str());
return false;
}
std::vector<char> mmf_buffer(mmf_buffer_size);
if (fread(mmf_buffer.data(), mmf_buffer_size, 1, f) != 1) {
fclose(f);
Log(Logs::General, Logs::Zone_Server, "Failed to load Map MMF file: '%s' - f@mmf_buffer", mmf_file_name.c_str());
LogInfo("Failed to load Map MMF file: [{}] - f@mmf_buffer", mmf_file_name.c_str());
return false;
}
@@ -1016,7 +1016,7 @@ bool Map::LoadMMF(const std::string& map_file_name, bool force_mmf_overwrite)
if (!imp->rm) {
delete imp;
imp = nullptr;
Log(Logs::General, Logs::Zone_Server, "Failed to load Map MMF file: '%s' - null RaycastMesh", mmf_file_name.c_str());
LogInfo("Failed to load Map MMF file: [{}] - null RaycastMesh", mmf_file_name.c_str());
return false;
}
@@ -1026,14 +1026,14 @@ bool Map::LoadMMF(const std::string& map_file_name, bool force_mmf_overwrite)
bool Map::SaveMMF(const std::string& map_file_name, bool force_mmf_overwrite)
{
if (!imp || !imp->rm) {
Log(Logs::General, Logs::Zone_Server, "Failed to save Map MMF file - No implementation (map_file_name: '%s')", map_file_name.c_str());
LogInfo("Failed to save Map MMF file - No implementation (map_file_name: [{}])", map_file_name.c_str());
return false;
}
std::string mmf_file_name = map_file_name;
strip_map_extension(mmf_file_name);
if (!add_mmf_extension(mmf_file_name)) {
Log(Logs::General, Logs::Zone_Server, "Failed to save Map MMF file: '%s'", mmf_file_name.c_str());
LogInfo("Failed to save Map MMF file: [{}]", mmf_file_name.c_str());
return false;
}
@@ -1047,7 +1047,7 @@ bool Map::SaveMMF(const std::string& map_file_name, bool force_mmf_overwrite)
std::vector<char> rm_buffer; // size set in MyRaycastMesh::serialize()
serializeRaycastMesh(imp->rm, rm_buffer);
if (rm_buffer.empty()) {
Log(Logs::General, Logs::Zone_Server, "Failed to save Map MMF file: '%s' - empty RaycastMesh buffer", mmf_file_name.c_str());
LogInfo("Failed to save Map MMF file: [{}] - empty RaycastMesh buffer", mmf_file_name.c_str());
return false;
}
@@ -1058,13 +1058,13 @@ bool Map::SaveMMF(const std::string& map_file_name, bool force_mmf_overwrite)
mmf_buffer_size = DeflateData(rm_buffer.data(), rm_buffer.size(), mmf_buffer.data(), mmf_buffer.size());
if (!mmf_buffer_size) {
Log(Logs::General, Logs::Zone_Server, "Failed to save Map MMF file: '%s' - null MMF buffer size", mmf_file_name.c_str());
LogInfo("Failed to save Map MMF file: [{}] - null MMF buffer size", mmf_file_name.c_str());
return false;
}
f = fopen(mmf_file_name.c_str(), "wb");
if (!f) {
Log(Logs::General, Logs::Zone_Server, "Failed to save Map MMF file: '%s' - could not open file", mmf_file_name.c_str());
LogInfo("Failed to save Map MMF file: [{}] - could not open file", mmf_file_name.c_str());
return false;
}
@@ -1072,14 +1072,14 @@ bool Map::SaveMMF(const std::string& map_file_name, bool force_mmf_overwrite)
if (fwrite(&file_version, sizeof(uint32), 1, f) != 1) {
fclose(f);
std::remove(mmf_file_name.c_str());
Log(Logs::General, Logs::Zone_Server, "Failed to save Map MMF file: '%s' - f@file_version", mmf_file_name.c_str());
LogInfo("Failed to save Map MMF file: [{}] - f@file_version", mmf_file_name.c_str());
return false;
}
if (fwrite(&rm_buffer_size, sizeof(uint32), 1, f) != 1) {
fclose(f);
std::remove(mmf_file_name.c_str());
Log(Logs::General, Logs::Zone_Server, "Failed to save Map MMF file: '%s' - f@rm_buffer_size", mmf_file_name.c_str());
LogInfo("Failed to save Map MMF file: [{}] - f@rm_buffer_size", mmf_file_name.c_str());
return false;
}
@@ -1087,21 +1087,21 @@ bool Map::SaveMMF(const std::string& map_file_name, bool force_mmf_overwrite)
if (fwrite(&rm_buffer_crc32, sizeof(uint32), 1, f) != 1) {
fclose(f);
std::remove(mmf_file_name.c_str());
Log(Logs::General, Logs::Zone_Server, "Failed to save Map MMF file: '%s' - f@rm_buffer_crc32", mmf_file_name.c_str());
LogInfo("Failed to save Map MMF file: [{}] - f@rm_buffer_crc32", mmf_file_name.c_str());
return false;
}
if (fwrite(&mmf_buffer_size, sizeof(uint32), 1, f) != 1) {
fclose(f);
std::remove(mmf_file_name.c_str());
Log(Logs::General, Logs::Zone_Server, "Failed to save Map MMF file: '%s' - f@mmf_buffer_size", mmf_file_name.c_str());
LogInfo("Failed to save Map MMF file: [{}] - f@mmf_buffer_size", mmf_file_name.c_str());
return false;
}
if (fwrite(mmf_buffer.data(), mmf_buffer_size, 1, f) != 1) {
fclose(f);
std::remove(mmf_file_name.c_str());
Log(Logs::General, Logs::Zone_Server, "Failed to save Map MMF file: '%s' - f@mmf_buffer", mmf_file_name.c_str());
LogInfo("Failed to save Map MMF file: [{}] - f@mmf_buffer", mmf_file_name.c_str());
return false;
}
+9 -9
View File
@@ -891,7 +891,7 @@ int32 Merc::CalcMaxMana()
break;
}
default: {
Log(Logs::General, Logs::None, "Invalid Class '%c' in CalcMaxMana", GetCasterClass());
LogDebug("Invalid Class [{}] in CalcMaxMana", GetCasterClass());
max_mana = 0;
break;
}
@@ -912,7 +912,7 @@ int32 Merc::CalcMaxMana()
}
#if EQDEBUG >= 11
Log(Logs::General, Logs::None, "Merc::CalcMaxMana() called for %s - returning %d", GetName(), max_mana);
LogDebug("Merc::CalcMaxMana() called for [{}] - returning [{}]", GetName(), max_mana);
#endif
return max_mana;
}
@@ -1688,7 +1688,7 @@ void Merc::AI_Process() {
if (AI_movement_timer->Check())
{
if(!IsRooted()) {
Log(Logs::Detail, Logs::AI, "Pursuing %s while engaged.", GetTarget()->GetCleanName());
LogAI("Pursuing [{}] while engaged", GetTarget()->GetCleanName());
RunTo(GetTarget()->GetX(), GetTarget()->GetY(), GetTarget()->GetZ());
return;
}
@@ -1807,7 +1807,7 @@ bool Merc::AI_EngagedCastCheck() {
{
AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting.
Log(Logs::Detail, Logs::AI, "Merc Engaged autocast check triggered");
LogAI("Merc Engaged autocast check triggered");
int8 mercClass = GetClass();
@@ -1862,7 +1862,7 @@ bool Merc::AI_IdleCastCheck() {
if (AIautocastspell_timer->Check(false)) {
#if MercAI_DEBUG_Spells >= 25
Log(Logs::Detail, Logs::AI, "Merc Non-Engaged autocast check triggered: %s", this->GetCleanName());
LogAI("Merc Non-Engaged autocast check triggered: [{}]", this->GetCleanName());
#endif
AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting.
@@ -1914,7 +1914,7 @@ bool EntityList::Merc_AICheckCloseBeneficialSpells(Merc* caster, uint8 iChance,
// according to Rogean, Live NPCs will just cast through walls/floors, no problem..
//
// This check was put in to address an idle-mob CPU issue
Log(Logs::General, Logs::Error, "Error: detrimental spells requested from AICheckCloseBeneficialSpells!!");
LogError("Error: detrimental spells requested from AICheckCloseBeneficialSpells!!");
return(false);
}
@@ -4494,7 +4494,7 @@ bool Merc::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, boo
{
if (!other) {
SetTarget(nullptr);
Log(Logs::General, Logs::Error, "A null Mob object was passed to Merc::Attack() for evaluation!");
LogError("A null Mob object was passed to Merc::Attack() for evaluation!");
return false;
}
@@ -6181,7 +6181,7 @@ void NPC::LoadMercTypes() {
auto results = database.QueryDatabase(query);
if (!results.Success())
{
Log(Logs::General, Logs::Error, "Error in NPC::LoadMercTypes()");
LogError("Error in NPC::LoadMercTypes()");
return;
}
@@ -6214,7 +6214,7 @@ void NPC::LoadMercs() {
if (!results.Success())
{
Log(Logs::General, Logs::Error, "Error in NPC::LoadMercTypes()");
LogError("Error in NPC::LoadMercTypes()");
return;
}
+7 -9
View File
@@ -1322,7 +1322,7 @@ void Mob::SendHPUpdate(bool skip_self /*= false*/, bool force_update_all /*= fal
* This is to prevent excessive packet sending under trains/fast combat
*/
if (this->CastToClient()->hp_self_update_throttle_timer.Check() || force_update_all) {
Log(Logs::General, Logs::HP_Update,
Log(Logs::General, Logs::HPUpdate,
"Mob::SendHPUpdate :: Update HP of self (%s) HP: %i last: %i skip_self: %s",
this->GetCleanName(),
current_hp,
@@ -1356,14 +1356,14 @@ void Mob::SendHPUpdate(bool skip_self /*= false*/, bool force_update_all /*= fal
int8 current_hp_percent = static_cast<int8>(max_hp == 0 ? 0 : static_cast<int>(current_hp * 100 / max_hp));
Log(Logs::General,
Logs::HP_Update,
Logs::HPUpdate,
"Mob::SendHPUpdate :: SendHPUpdate %s HP is %i last %i",
this->GetCleanName(),
current_hp_percent,
last_hp_percent);
if (current_hp_percent == last_hp_percent && !force_update_all) {
Log(Logs::General, Logs::HP_Update, "Mob::SendHPUpdate :: Same HP - skipping update");
Log(Logs::General, Logs::HPUpdate, "Mob::SendHPUpdate :: Same HP - skipping update");
ResetHPUpdateTimer();
return;
}
@@ -1373,7 +1373,7 @@ void Mob::SendHPUpdate(bool skip_self /*= false*/, bool force_update_all /*= fal
this->CastToClient()->SendHPUpdateMarquee();
}
Log(Logs::General, Logs::HP_Update, "Mob::SendHPUpdate :: HP Changed - Send update");
Log(Logs::General, Logs::HPUpdate, "Mob::SendHPUpdate :: HP Changed - Send update");
last_hp_percent = current_hp_percent;
}
@@ -1840,9 +1840,7 @@ void Mob::SendIllusionPacket(
/* Refresh armor and tints after send illusion packet */
this->SendArmorAppearance();
Log(Logs::Detail,
Logs::Spells,
"Illusion: Race = %i, Gender = %i, Texture = %i, HelmTexture = %i, HairColor = %i, BeardColor = %i, EyeColor1 = %i, EyeColor2 = %i, HairStyle = %i, Face = %i, DrakkinHeritage = %i, DrakkinTattoo = %i, DrakkinDetails = %i, Size = %f",
LogSpells("Illusion: Race = [{}], Gender = [{}], Texture = [{}], HelmTexture = [{}], HairColor = [{}], BeardColor = [{}], EyeColor1 = [{}], EyeColor2 = [{}], HairStyle = [{}], Face = [{}], DrakkinHeritage = [{}], DrakkinTattoo = [{}], DrakkinDetails = [{}], Size = [{}]",
race,
gender,
new_texture,
@@ -3063,7 +3061,7 @@ void Mob::ExecWeaponProc(const EQEmu::ItemInstance *inst, uint16 spell_id, Mob *
if(!IsValidSpell(spell_id)) { // Check for a valid spell otherwise it will crash through the function
if(IsClient()){
Message(0, "Invalid spell proc %u", spell_id);
Log(Logs::Detail, Logs::Spells, "Player %s, Weapon Procced invalid spell %u", this->GetName(), spell_id);
LogSpells("Player [{}], Weapon Procced invalid spell [{}]", this->GetName(), spell_id);
}
return;
}
@@ -4629,7 +4627,7 @@ void Mob::MeleeLifeTap(int32 damage) {
if(lifetap_amt && damage > 0){
lifetap_amt = damage * lifetap_amt / 100;
Log(Logs::Detail, Logs::Combat, "Melee lifetap healing for %d damage.", damage);
LogCombat("Melee lifetap healing for [{}] damage", damage);
if (lifetap_amt > 0)
HealDamage(lifetap_amt); //Heal self for modified damage amount.
+2 -2
View File
@@ -1467,8 +1467,8 @@ protected:
eStandingPetOrder pStandingPetOrder;
uint32 minLastFightingDelayMoving;
uint32 maxLastFightingDelayMoving;
float pAggroRange;
float pAssistRange;
float pAggroRange = 0;
float pAssistRange = 0;
std::unique_ptr<Timer> AI_think_timer;
std::unique_ptr<Timer> AI_movement_timer;
std::unique_ptr<Timer> AI_target_check_timer;
+19 -26
View File
@@ -127,7 +127,7 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint32 iSpellTypes, bool bInnates
) {
#if MobAI_DEBUG_Spells >= 21
Log(Logs::Detail, Logs::AI, "Mob::AICastSpell: Casting: spellid=%u, tar=%s, dist2[%f]<=%f, mana_cost[%i]<=%i, cancast[%u]<=%u, type=%u",
LogAI("Mob::AICastSpell: Casting: spellid=[{}], tar=[{}], dist2[[{}]]<=[{}], mana_cost[[{}]]<=[{}], cancast[[{}]]<=[{}], type=[{}]",
AIspells[i].spellid, tar->GetName(), dist2, (spells[AIspells[i].spellid].range * spells[AIspells[i].spellid].range), mana_cost, GetMana(), AIspells[i].time_cancast, Timer::GetCurrentTime(), AIspells[i].type);
#endif
@@ -360,7 +360,7 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint32 iSpellTypes, bool bInnates
}
#if MobAI_DEBUG_Spells >= 21
else {
Log(Logs::Detail, Logs::AI, "Mob::AICastSpell: NotCasting: spellid=%u, tar=%s, dist2[%f]<=%f, mana_cost[%i]<=%i, cancast[%u]<=%u, type=%u",
LogAI("Mob::AICastSpell: NotCasting: spellid=[{}], tar=[{}], dist2[[{}]]<=[{}], mana_cost[[{}]]<=[{}], cancast[[{}]]<=[{}], type=[{}]",
AIspells[i].spellid, tar->GetName(), dist2, (spells[AIspells[i].spellid].range * spells[AIspells[i].spellid].range), mana_cost, GetMana(), AIspells[i].time_cancast, Timer::GetCurrentTime(), AIspells[i].type);
}
#endif
@@ -371,7 +371,7 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint32 iSpellTypes, bool bInnates
bool NPC::AIDoSpellCast(uint8 i, Mob* tar, int32 mana_cost, uint32* oDontDoAgainBefore) {
#if MobAI_DEBUG_Spells >= 1
Log(Logs::Detail, Logs::AI, "Mob::AIDoSpellCast: spellid = %u, tar = %s, mana = %i, Name: '%s'", AIspells[i].spellid, tar->GetName(), mana_cost, spells[AIspells[i].spellid].name);
LogAI("Mob::AIDoSpellCast: spellid = [{}], tar = [{}], mana = [{}], Name: [{}]", AIspells[i].spellid, tar->GetName(), mana_cost, spells[AIspells[i].spellid].name);
#endif
casting_spell_AIindex = i;
@@ -385,7 +385,7 @@ bool EntityList::AICheckCloseBeneficialSpells(NPC* caster, uint8 iChance, float
// according to Rogean, Live NPCs will just cast through walls/floors, no problem..
//
// This check was put in to address an idle-mob CPU issue
Log(Logs::General, Logs::Error, "Error: detrimental spells requested from AICheckCloseBeneficialSpells!!");
LogError("Error: detrimental spells requested from AICheckCloseBeneficialSpells!!");
return(false);
}
@@ -1356,7 +1356,7 @@ void Mob::AI_Process() {
}
else if (AI_movement_timer->Check() && target) {
if (!IsRooted()) {
Log(Logs::Detail, Logs::AI, "Pursuing %s while engaged.", target->GetName());
LogAI("Pursuing [{}] while engaged", target->GetName());
RunTo(target->GetX(), target->GetY(), target->GetZ());
}
@@ -1721,9 +1721,7 @@ void NPC::AI_DoMovement() {
else if (!(AI_walking_timer->Enabled())) { // currently moving
bool doMove = true;
if(IsPositionEqual(glm::vec2(m_CurrentWayPoint.x, m_CurrentWayPoint.y), glm::vec2(GetX(), GetY()))) {
Log(Logs::Detail,
Logs::AI,
"We have reached waypoint %d (%.3f,%.3f,%.3f) on grid %d",
LogAI("We have reached waypoint [{}] ({},{},{}) on grid [{}]",
cur_wp,
GetX(),
GetY(),
@@ -1775,7 +1773,7 @@ void NPC::AI_DoMovement() {
else if (gridno < 0) { // this mob is under quest control
if (pause_timer_complete == true) { // time to pause has ended
SetGrid(0 - GetGrid()); // revert to AI control
Log(Logs::Detail, Logs::Pathing, "Quest pathing is finished. Resuming on grid %d", GetGrid());
LogPathing("Quest pathing is finished. Resuming on grid [{}]", GetGrid());
SetAppearance(eaStanding, false);
@@ -1790,12 +1788,7 @@ void NPC::AI_DoMovement() {
if (at_gp) {
if (moved) {
Log(Logs::Detail,
Logs::AI,
"Reached guard point (%.3f,%.3f,%.3f)",
m_GuardPoint.x,
m_GuardPoint.y,
m_GuardPoint.z);
LogAI("Reached guard point ({},{},{})", m_GuardPoint.x, m_GuardPoint.y, m_GuardPoint.z);
ClearFeignMemory();
moved = false;
@@ -1843,10 +1836,10 @@ void NPC::AI_SetupNextWaypoint() {
}
else {
pause_timer_complete = false;
Log(Logs::Detail, Logs::Pathing, "We are departing waypoint %d.", cur_wp);
LogPathing("We are departing waypoint [{}]", cur_wp);
//if we were under quest control (with no grid), we are done now..
if (cur_wp == EQEmu::WaypointStatus::QuestControlNoGrid) {
Log(Logs::Detail, Logs::Pathing, "Non-grid quest mob has reached its quest ordered waypoint. Leaving pathing mode.");
LogPathing("Non-grid quest mob has reached its quest ordered waypoint. Leaving pathing mode");
roamer = false;
cur_wp = 0;
}
@@ -1983,7 +1976,7 @@ bool NPC::AI_EngagedCastCheck() {
if (AIautocastspell_timer->Check(false)) {
AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting.
Log(Logs::Detail, Logs::AI, "Engaged autocast check triggered. Trying to cast healing spells then maybe offensive spells.");
LogAI("Engaged autocast check triggered. Trying to cast healing spells then maybe offensive spells");
// first try innate (spam) spells
if(!AICastSpell(GetTarget(), 0, SpellType_Nuke | SpellType_Lifetap | SpellType_DOT | SpellType_Dispel | SpellType_Mez | SpellType_Slow | SpellType_Debuff | SpellType_Charm | SpellType_Root, true)) {
@@ -2012,7 +2005,7 @@ bool NPC::AI_PursueCastCheck() {
if (AIautocastspell_timer->Check(false)) {
AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting.
Log(Logs::Detail, Logs::AI, "Engaged (pursuing) autocast check triggered. Trying to cast offensive spells.");
LogAI("Engaged (pursuing) autocast check triggered. Trying to cast offensive spells");
// checking innate (spam) spells first
if(!AICastSpell(GetTarget(), AISpellVar.pursue_detrimental_chance, SpellType_Root | SpellType_Nuke | SpellType_Lifetap | SpellType_Snare | SpellType_DOT | SpellType_Dispel | SpellType_Mez | SpellType_Slow | SpellType_Debuff, true)) {
if(!AICastSpell(GetTarget(), AISpellVar.pursue_detrimental_chance, SpellType_Root | SpellType_Nuke | SpellType_Lifetap | SpellType_Snare | SpellType_DOT | SpellType_Dispel | SpellType_Mez | SpellType_Slow | SpellType_Debuff)) {
@@ -2034,7 +2027,7 @@ bool NPC::AI_IdleCastCheck() {
//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);
Log(Logs::Moderate, Logs::Spells, "Triggering AI_IdleCastCheck :: Mob %s - Min : %u Max : %u", this->GetCleanName(), AISpellVar.idle_no_sp_recast_min, AISpellVar.idle_no_sp_recast_max);
LogSpells("Triggering AI_IdleCastCheck :: Mob [{}] - Min : [{}] Max : [{}]", this->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.
@@ -2507,21 +2500,21 @@ bool NPC::AI_AddNPCSpells(uint32 iDBSpellsID) {
else {
debug_msg.append(" (not found)");
}
Log(Logs::Detail, Logs::AI, "%s", debug_msg.c_str());
LogAI("[{}]", debug_msg.c_str());
#ifdef MobAI_DEBUG_Spells >= 25
if (parentlist) {
for (const auto &iter : parentlist->entries) {
Log(Logs::Detail, Logs::AI, "(%i) %s", iter.spellid, spells[iter.spellid].name);
LogAI("([{}]) [{}]", iter.spellid, spells[iter.spellid].name);
}
}
Log(Logs::Detail, Logs::AI, "fin (parent list)");
LogAI("fin (parent list)");
if (spell_list) {
for (const auto &iter : spell_list->entries) {
Log(Logs::Detail, Logs::AI, "(%i) %s", iter.spellid, spells[iter.spellid].name);
LogAI("([{}]) [{}]", iter.spellid, spells[iter.spellid].name);
}
}
Log(Logs::Detail, Logs::AI, "fin (spell list)");
LogAI("fin (spell list)");
#endif
#endif
@@ -2682,7 +2675,7 @@ bool NPC::AI_AddNPCSpellsEffects(uint32 iDBSpellsEffectsID) {
else {
debug_msg.append(" (not found)");
}
Log(Logs::Detail, Logs::AI, "%s", debug_msg.c_str());
LogAI("[{}]", debug_msg.c_str());
#endif
if (parentlist) {
+61 -67
View File
@@ -42,7 +42,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "../common/eqemu_exception.h"
#include "../common/spdat.h"
#include "../common/eqemu_logsys.h"
#include "../common/eqemu_logsys_fmt.h"
#include "api_service.h"
#include "zone_config.h"
@@ -146,9 +145,9 @@ int main(int argc, char** argv) {
QServ = new QueryServ;
Log(Logs::General, Logs::Zone_Server, "Loading server configuration..");
LogInfo("Loading server configuration..");
if (!ZoneConfig::LoadConfig()) {
Log(Logs::General, Logs::Error, "Loading server configuration failed.");
LogError("Loading server configuration failed");
return 1;
}
Config = ZoneConfig::get();
@@ -226,14 +225,14 @@ int main(int argc, char** argv) {
worldserver.SetLauncherName("NONE");
}
Log(Logs::General, Logs::Zone_Server, "Connecting to MySQL...");
LogInfo("Connecting to MySQL... ");
if (!database.Connect(
Config->DatabaseHost.c_str(),
Config->DatabaseUsername.c_str(),
Config->DatabasePassword.c_str(),
Config->DatabaseDB.c_str(),
Config->DatabasePort)) {
Log(Logs::General, Logs::Error, "Cannot continue without a database connection.");
LogError("Cannot continue without a database connection");
return 1;
}
@@ -256,135 +255,135 @@ int main(int argc, char** argv) {
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
#endif
Log(Logs::General, Logs::Zone_Server, "CURRENT_VERSION: %s", CURRENT_VERSION);
LogInfo("CURRENT_VERSION: {}", CURRENT_VERSION);
/*
* Setup nice signal handlers
*/
if (signal(SIGINT, CatchSignal) == SIG_ERR) {
Log(Logs::General, Logs::Error, "Could not set signal handler");
LogError("Could not set signal handler");
return 1;
}
if (signal(SIGTERM, CatchSignal) == SIG_ERR) {
Log(Logs::General, Logs::Error, "Could not set signal handler");
LogError("Could not set signal handler");
return 1;
}
#ifndef WIN32
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) {
Log(Logs::General, Logs::Error, "Could not set signal handler");
LogError("Could not set signal handler");
return 1;
}
#endif
Log(Logs::General, Logs::Zone_Server, "Mapping Incoming Opcodes");
LogInfo("Mapping Incoming Opcodes");
MapOpcodes();
Log(Logs::General, Logs::Zone_Server, "Loading Variables");
LogInfo("Loading Variables");
database.LoadVariables();
std::string hotfix_name;
if (database.GetVariable("hotfix_name", hotfix_name)) {
if (!hotfix_name.empty()) {
Log(Logs::General, Logs::Zone_Server, "Current hotfix in use: '%s'", hotfix_name.c_str());
LogInfo("Current hotfix in use: [{}]", hotfix_name.c_str());
}
}
Log(Logs::General, Logs::Zone_Server, "Loading zone names");
LogInfo("Loading zone names");
database.LoadZoneNames();
Log(Logs::General, Logs::Zone_Server, "Loading items");
LogInfo("Loading items");
if (!database.LoadItems(hotfix_name)) {
Log(Logs::General, Logs::Error, "Loading items FAILED!");
Log(Logs::General, Logs::Error, "Failed. But ignoring error and going on...");
LogError("Loading items failed!");
LogError("Failed. But ignoring error and going on..");
}
Log(Logs::General, Logs::Zone_Server, "Loading npc faction lists");
LogInfo("Loading npc faction lists");
if (!database.LoadNPCFactionLists(hotfix_name)) {
Log(Logs::General, Logs::Error, "Loading npcs faction lists FAILED!");
LogError("Loading npcs faction lists failed!");
return 1;
}
Log(Logs::General, Logs::Zone_Server, "Loading loot tables");
LogInfo("Loading loot tables");
if (!database.LoadLoot(hotfix_name)) {
Log(Logs::General, Logs::Error, "Loading loot FAILED!");
LogError("Loading loot failed!");
return 1;
}
Log(Logs::General, Logs::Zone_Server, "Loading skill caps");
LogInfo("Loading skill caps");
if (!database.LoadSkillCaps(std::string(hotfix_name))) {
Log(Logs::General, Logs::Error, "Loading skill caps FAILED!");
LogError("Loading skill caps failed!");
return 1;
}
Log(Logs::General, Logs::Zone_Server, "Loading spells");
LogInfo("Loading spells");
if (!database.LoadSpells(hotfix_name, &SPDAT_RECORDS, &spells)) {
Log(Logs::General, Logs::Error, "Loading spells FAILED!");
LogError("Loading spells failed!");
return 1;
}
Log(Logs::General, Logs::Zone_Server, "Loading base data");
LogInfo("Loading base data");
if (!database.LoadBaseData(hotfix_name)) {
Log(Logs::General, Logs::Error, "Loading base data FAILED!");
LogError("Loading base data failed!");
return 1;
}
Log(Logs::General, Logs::Zone_Server, "Loading guilds");
LogInfo("Loading guilds");
guild_mgr.LoadGuilds();
Log(Logs::General, Logs::Zone_Server, "Loading factions");
LogInfo("Loading factions");
database.LoadFactionData();
Log(Logs::General, Logs::Zone_Server, "Loading titles");
LogInfo("Loading titles");
title_manager.LoadTitles();
Log(Logs::General, Logs::Zone_Server, "Loading tributes");
LogInfo("Loading tributes");
database.LoadTributes();
Log(Logs::General, Logs::Zone_Server, "Loading corpse timers");
LogInfo("Loading corpse timers");
database.GetDecayTimes(npcCorpseDecayTimes);
Log(Logs::General, Logs::Zone_Server, "Loading profanity list");
LogInfo("Loading profanity list");
if (!EQEmu::ProfanityManager::LoadProfanityList(&database))
Log(Logs::General, Logs::Error, "Loading profanity list FAILED!");
LogError("Loading profanity list failed!");
Log(Logs::General, Logs::Zone_Server, "Loading commands");
LogInfo("Loading commands");
int retval = command_init();
if (retval<0)
Log(Logs::General, Logs::Error, "Command loading FAILED");
LogError("Command loading failed");
else
Log(Logs::General, Logs::Zone_Server, "%d commands loaded", retval);
LogInfo("{} commands loaded", retval);
//rules:
{
std::string tmp;
if (database.GetVariable("RuleSet", tmp)) {
Log(Logs::General, Logs::Zone_Server, "Loading rule set '%s'", tmp.c_str());
LogInfo("Loading rule set [{}]", tmp.c_str());
if (!RuleManager::Instance()->LoadRules(&database, tmp.c_str(), false)) {
Log(Logs::General, Logs::Error, "Failed to load ruleset '%s', falling back to defaults.", tmp.c_str());
LogError("Failed to load ruleset [{}], falling back to defaults", tmp.c_str());
}
}
else {
if (!RuleManager::Instance()->LoadRules(&database, "default", false)) {
Log(Logs::General, Logs::Zone_Server, "No rule set configured, using default rules");
LogInfo("No rule set configured, using default rules");
}
else {
Log(Logs::General, Logs::Zone_Server, "Loaded default rule set 'default'", tmp.c_str());
LogInfo("Loaded default rule set 'default'");
}
}
EQEmu::InitializeDynamicLookups();
Log(Logs::General, Logs::Zone_Server, "Initialized dynamic dictionary entries");
LogInfo("Initialized dynamic dictionary entries");
}
#ifdef BOTS
Log(Logs::General, Logs::Zone_Server, "Loading bot commands");
LogInfo("Loading bot commands");
int botretval = bot_command_init();
if (botretval<0)
Log(Logs::General, Logs::Error, "Bot command loading FAILED");
LogError("Bot command loading failed");
else
Log(Logs::General, Logs::Zone_Server, "%d bot commands loaded", botretval);
LogInfo("[{}] bot commands loaded", botretval);
Log(Logs::General, Logs::Zone_Server, "Loading bot spell casting chances");
LogInfo("Loading bot spell casting chances");
if (!database.botdb.LoadBotSpellCastingChances())
Log(Logs::General, Logs::Error, "Bot spell casting chances loading FAILED");
LogError("Bot spell casting chances loading failed");
#endif
if (RuleB(TaskSystem, EnableTaskSystem)) {
@@ -408,7 +407,7 @@ int main(int argc, char** argv) {
#endif
//now we have our parser, load the quests
Log(Logs::General, Logs::Zone_Server, "Loading quests");
LogInfo("Loading quests");
parse->ReloadQuests();
worldserver.Connect();
@@ -421,10 +420,10 @@ int main(int argc, char** argv) {
#endif
#endif
if (!strlen(zone_name) || !strcmp(zone_name, ".")) {
Log(Logs::General, Logs::Zone_Server, "Entering sleep mode");
LogInfo("Entering sleep mode");
}
else if (!Zone::Bootup(database.GetZoneID(zone_name), instance_id, true)) {
Log(Logs::General, Logs::Error, "Zone Bootup failed :: Zone::Bootup");
LogError("Zone Bootup failed :: Zone::Bootup");
zone = 0;
}
@@ -433,11 +432,11 @@ int main(int argc, char** argv) {
RegisterAllPatches(stream_identifier);
#ifndef WIN32
Log(Logs::Detail, Logs::None, "Main thread running with thread id %d", pthread_self());
LogDebug("Main thread running with thread id [{}]", pthread_self());
#endif
bool worldwasconnected = worldserver.Connected();
bool eqsf_open = false;
bool worldwasconnected = worldserver.Connected();
bool eqsf_open = false;
bool websocker_server_opened = false;
Timer quest_timers(100);
@@ -460,16 +459,10 @@ int main(int argc, char** argv) {
frame_prev = frame_now;
/**
* Telnet server
* Websocket server
*/
if (!websocker_server_opened && Config->ZonePort != 0) {
Log(
Logs::General,
Logs::Zone_Server,
"Websocket Server listener started (%s:%u).",
Config->TelnetIP.c_str(),
Config->ZonePort
);
LogInfo("Websocket Server listener started ([{}]:[{}])", Config->TelnetIP.c_str(), Config->ZonePort);
ws_server.reset(new EQ::Net::WebsocketServer(Config->TelnetIP, Config->ZonePort));
RegisterApiService(ws_server);
websocker_server_opened = true;
@@ -479,7 +472,7 @@ int main(int argc, char** argv) {
* EQStreamManager
*/
if (!eqsf_open && Config->ZonePort != 0) {
Log(Logs::General, Logs::Zone_Server, "Starting EQ Network server on port %d", Config->ZonePort);
LogInfo("Starting EQ Network server on port {}", Config->ZonePort);
EQStreamManagerInterfaceOptions opts(Config->ZonePort, false, RuleB(Network, CompressZoneStream));
opts.daybreak_options.resend_delay_ms = RuleI(Network, ResendDelayBaseMS);
@@ -492,7 +485,7 @@ int main(int argc, char** argv) {
eqsm->OnNewConnection([&stream_identifier](std::shared_ptr<EQ::Net::EQStream> stream) {
stream_identifier.AddStream(stream);
LogF(Logs::Detail, Logs::World_Server, "New connection from IP {0}:{1}", stream->GetRemoteIP(), ntohs(stream->GetRemotePort()));
LogF(Logs::Detail, Logs::WorldServer, "New connection from IP {0}:{1}", stream->GetRemoteIP(), ntohs(stream->GetRemotePort()));
});
}
@@ -504,7 +497,7 @@ int main(int argc, char** argv) {
//now that we know what patch they are running, start up their client object
struct in_addr in;
in.s_addr = eqsi->GetRemoteIP();
Log(Logs::Detail, Logs::World_Server, "New client from %s:%d", inet_ntoa(in), ntohs(eqsi->GetRemotePort()));
LogInfo("New client from [{}]:[{}]", inet_ntoa(in), ntohs(eqsi->GetRemotePort()));
auto client = new Client(eqsi);
entity_list.AddClient(client);
}
@@ -550,8 +543,9 @@ int main(int argc, char** argv) {
}
}
if (quest_timers.Check())
if (quest_timers.Check()) {
quest_manager.Process();
}
}
}
@@ -608,14 +602,14 @@ int main(int argc, char** argv) {
bot_command_deinit();
#endif
safe_delete(parse);
Log(Logs::General, Logs::Zone_Server, "Proper zone shutdown complete.");
LogInfo("Proper zone shutdown complete.");
LogSys.CloseFileLogs();
return 0;
}
void CatchSignal(int sig_num) {
#ifdef _WINDOWS
Log(Logs::General, Logs::Zone_Server, "Recieved signal: %i", sig_num);
LogInfo("Recieved signal: [{}]", sig_num);
#endif
RunLoops = false;
}
@@ -624,7 +618,7 @@ void Shutdown()
{
Zone::Shutdown(true);
RunLoops = false;
Log(Logs::General, Logs::Zone_Server, "Shutting down...");
LogInfo("Shutting down...");
LogSys.CloseFileLogs();
}
+49 -26
View File
@@ -209,6 +209,7 @@ NPC::NPC(const NPCType *npc_type_data, Spawn2 *in_respawn, const glm::vec4 &posi
default_accuracy_rating = npc_type_data->accuracy_rating;
default_avoidance_rating = npc_type_data->avoidance_rating;
default_atk = npc_type_data->ATK;
strn0cpy(default_special_abilities, npc_type_data->special_abilities, 512);
// used for when getting charmed, if 0, doesn't swap
charm_ac = npc_type_data->charm_ac;
@@ -616,11 +617,11 @@ void NPC::QueryLoot(Client* to)
int item_count = 0;
for (auto cur = itemlist.begin(); cur != itemlist.end(); ++cur, ++item_count) {
if (!(*cur)) {
Log(Logs::General, Logs::Error, "NPC::QueryLoot() - ItemList error, null item");
LogError("NPC::QueryLoot() - ItemList error, null item");
continue;
}
if (!(*cur)->item_id || !database.GetItem((*cur)->item_id)) {
Log(Logs::General, Logs::Error, "NPC::QueryLoot() - Database error, invalid item");
LogError("NPC::QueryLoot() - Database error, invalid item");
continue;
}
@@ -1902,7 +1903,7 @@ void Mob::NPCSpecialAttacks(const char* parse, int permtag, bool reset, bool rem
{
if(database.SetSpecialAttkFlag(this->GetNPCTypeID(), orig_parse))
{
Log(Logs::General, Logs::Normal, "NPCTypeID: %i flagged to '%s' for Special Attacks.\n",this->GetNPCTypeID(),orig_parse);
LogInfo("NPCTypeID: [{}] flagged to [{}] for Special Attacks.\n",this->GetNPCTypeID(),orig_parse);
}
}
}
@@ -2152,7 +2153,7 @@ void NPC::ModifyNPCStat(const char *identifier, const char *new_value)
std::string variable_key = StringFormat("modify_stat_%s", id.c_str());
SetEntityVariable(variable_key.c_str(), new_value);
Log(Logs::Detail, Logs::NPCScaling, "NPC::ModifyNPCStat key: %s val: %s ", variable_key.c_str(), new_value);
LogNPCScaling("NPC::ModifyNPCStat key: [{}] val: [{}] ", variable_key.c_str(), new_value);
if (id == "ac") {
AC = atoi(val.c_str());
@@ -2838,39 +2839,61 @@ void NPC::DepopSwarmPets()
}
}
void NPC::ModifyStatsOnCharm(bool bRemoved)
void NPC::ModifyStatsOnCharm(bool is_charm_removed)
{
if (bRemoved) {
if (charm_ac)
if (is_charm_removed) {
if (charm_ac) {
AC = default_ac;
if (charm_attack_delay)
}
if (charm_attack_delay) {
attack_delay = default_attack_delay;
if (charm_accuracy_rating)
}
if (charm_accuracy_rating) {
accuracy_rating = default_accuracy_rating;
if (charm_avoidance_rating)
}
if (charm_avoidance_rating) {
avoidance_rating = default_avoidance_rating;
if (charm_atk)
}
if (charm_atk) {
ATK = default_atk;
}
if (charm_min_dmg || charm_max_dmg) {
base_damage = round((default_max_dmg - default_min_dmg) / 1.9);
min_damage = default_min_dmg - round(base_damage / 10.0);
min_damage = default_min_dmg - round(base_damage / 10.0);
}
} else {
if (charm_ac)
AC = charm_ac;
if (charm_attack_delay)
attack_delay = charm_attack_delay;
if (charm_accuracy_rating)
accuracy_rating = charm_accuracy_rating;
if (charm_avoidance_rating)
avoidance_rating = charm_avoidance_rating;
if (charm_atk)
ATK = charm_atk;
if (charm_min_dmg || charm_max_dmg) {
base_damage = round((charm_max_dmg - charm_min_dmg) / 1.9);
min_damage = charm_min_dmg - round(base_damage / 10.0);
if (RuleB(Spells, CharmDisablesSpecialAbilities)) {
ProcessSpecialAbilities(default_special_abilities);
}
SetAttackTimer();
CalcAC();
return;
}
if (charm_ac) {
AC = charm_ac;
}
if (charm_attack_delay) {
attack_delay = charm_attack_delay;
}
if (charm_accuracy_rating) {
accuracy_rating = charm_accuracy_rating;
}
if (charm_avoidance_rating) {
avoidance_rating = charm_avoidance_rating;
}
if (charm_atk) {
ATK = charm_atk;
}
if (charm_min_dmg || charm_max_dmg) {
base_damage = round((charm_max_dmg - charm_min_dmg) / 1.9);
min_damage = charm_min_dmg - round(base_damage / 10.0);
}
if (RuleB(Spells, CharmDisablesSpecialAbilities)) {
ClearSpecialAbilities();
}
// the rest of the stats aren't cached, so lets just do these two instead of full CalcBonuses()
SetAttackTimer();
CalcAC();
+2 -1
View File
@@ -294,7 +294,7 @@ public:
int32 GetNPCHPRegen() const { return hp_regen + itembonuses.HPRegen + spellbonuses.HPRegen; }
inline const char* GetAmmoIDfile() const { return ammo_idfile; }
void ModifyStatsOnCharm(bool bRemoved);
void ModifyStatsOnCharm(bool is_charm_removed);
//waypoint crap
int GetMaxWp() const { return max_wp; }
@@ -541,6 +541,7 @@ protected:
int default_accuracy_rating;
int default_avoidance_rating;
int default_atk;
char default_special_abilities[512];
// when charmed, switch to these
int charm_ac;
+17 -28
View File
@@ -24,10 +24,11 @@
/**
* @param npc
*/
void NpcScaleManager::ScaleNPC(NPC * npc)
void NpcScaleManager::ScaleNPC(NPC *npc)
{
if (npc->IsSkipAutoScale())
if (npc->IsSkipAutoScale()) {
return;
}
int8 npc_type = GetNPCScalingType(npc);
int npc_level = npc->GetLevel();
@@ -36,7 +37,8 @@ void NpcScaleManager::ScaleNPC(NPC * npc)
global_npc_scale scale_data = GetGlobalScaleDataForTypeLevel(npc_type, npc_level);
if (!scale_data.level) {
Log(Logs::General, Logs::NPCScaling, "NPC: %s - scaling data not found for type: %i level: %i",
LogNPCScaling(
"NPC: [{}] - scaling data not found for type: [{}] level: [{}]",
npc->GetCleanName(),
npc_type,
npc_level
@@ -109,11 +111,7 @@ void NpcScaleManager::ScaleNPC(NPC * npc)
int32 class_level_damage_mod = GetClassLevelDamageMod(npc->GetLevel(), npc->GetClass());
min_dmg = (min_dmg * class_level_damage_mod) / 220;
Log(Logs::Moderate,
Logs::NPCScaling,
"ClassLevelDamageMod::min_dmg base: %i calc: %i",
scale_data.min_dmg,
min_dmg);
LogNPCScaling("ClassLevelDamageMod::min_dmg base: [{}] calc: [{}]", scale_data.min_dmg, min_dmg);
}
npc->ModifyNPCStat("min_hit", std::to_string(min_dmg).c_str());
@@ -124,12 +122,7 @@ void NpcScaleManager::ScaleNPC(NPC * npc)
int32 class_level_damage_mod = GetClassLevelDamageMod(npc->GetLevel(), npc->GetClass());
max_dmg = (scale_data.max_dmg * class_level_damage_mod) / 220;
Log(Logs::Moderate,
Logs::NPCScaling,
"ClassLevelDamageMod::max_dmg base: %i calc: %i",
scale_data.max_dmg,
max_dmg
);
LogNPCScaling("ClassLevelDamageMod::max_dmg base: [{}] calc: [{}]", scale_data.max_dmg, max_dmg);
}
npc->ModifyNPCStat("max_hit", std::to_string(max_dmg).c_str());
@@ -160,14 +153,14 @@ void NpcScaleManager::ScaleNPC(NPC * npc)
}
}
Log(Logs::General,
Logs::NPCScaling,
"(%s) level: %i type: %i Auto: %s Setting: %s",
LogNPCScaling(
"([{}]) level: [{}] type: [{}] Auto: [{}] Setting: [{}]",
npc->GetCleanName(),
npc_level,
npc_type,
(is_auto_scaled ? "true" : "false"),
scale_log.c_str());
scale_log.c_str()
);
}
}
@@ -249,7 +242,7 @@ bool NpcScaleManager::LoadScaleData()
);
}
Log(Logs::General, Logs::NPCScaling, "Global Base Scaling Data Loaded...");
LogNPCScaling("Global Base Scaling Data Loaded");
return true;
}
@@ -426,7 +419,7 @@ int8 NpcScaleManager::GetNPCScalingType(NPC *&npc)
if (npc->IsRareSpawn() || npc_name.find('#') != std::string::npos || isupper(npc_name[0])) {
return 1;
}
return 0;
}
@@ -489,10 +482,8 @@ bool NpcScaleManager::ApplyGlobalBaseScalingToNPCStatically(NPC *&npc)
global_npc_scale scale_data = GetGlobalScaleDataForTypeLevel(npc_type, npc_level);
if (!scale_data.level) {
Log(
Logs::General,
Logs::NPCScaling,
"NpcScaleManager::ApplyGlobalBaseScalingToNPCStatically NPC: %s - scaling data not found for type: %i level: %i",
LogNPCScaling(
"NpcScaleManager::ApplyGlobalBaseScalingToNPCStatically NPC: [{}] - scaling data not found for type: [{}] level: [{}]",
npc->GetCleanName(),
npc_type,
npc_level
@@ -577,10 +568,8 @@ bool NpcScaleManager::ApplyGlobalBaseScalingToNPCDynamically(NPC *&npc)
global_npc_scale scale_data = GetGlobalScaleDataForTypeLevel(npc_type, npc_level);
if (!scale_data.level) {
Log(
Logs::General,
Logs::NPCScaling,
"NpcScaleManager::ApplyGlobalBaseScalingToNPCDynamically NPC: %s - scaling data not found for type: %i level: %i",
LogNPCScaling(
"NpcScaleManager::ApplyGlobalBaseScalingToNPCDynamically NPC: [{}] - scaling data not found for type: [{}] level: [{}]",
npc->GetCleanName(),
npc_type,
npc_level
+14 -12
View File
@@ -339,7 +339,7 @@ const EQEmu::ItemInstance* Object::GetItem(uint8 index) {
void Object::PutItem(uint8 index, const EQEmu::ItemInstance* inst)
{
if (index > 9) {
Log(Logs::General, Logs::Error, "Object::PutItem: Invalid index specified (%i)", index);
LogError("Object::PutItem: Invalid index specified ([{}])", index);
return;
}
@@ -443,6 +443,14 @@ bool Object::Process(){
if(m_ground_spawn && respawn_timer.Check()){
RandomSpawn(true);
}
if (user != nullptr && !entity_list.GetClientByCharID(user->CharacterID())) {
m_inuse = false;
last_user = user;
user->SetTradeskillObject(nullptr);
user = nullptr;
}
return true;
}
@@ -465,7 +473,7 @@ void Object::RandomSpawn(bool send_packet) {
}
}
Log(Logs::Detail, Logs::Zone_Server, "Object::RandomSpawn(%s): %d (%.2f, %.2f, %.2f)", m_data.object_name, m_inst->GetID(), m_data.x, m_data.y, m_data.z);
LogInfo("Object::RandomSpawn([{}]): [{}] ([{}], [{}], [{}])", m_data.object_name, m_inst->GetID(), m_data.x, m_data.y, m_data.z);
respawn_timer.Disable();
@@ -554,7 +562,6 @@ bool Object::HandleClick(Client* sender, const ClickObject_Struct* click_object)
ClickObjectAction_Struct* coa = (ClickObjectAction_Struct*)outapp->pBuffer;
//TODO: there is prolly a better way to do this.
m_inuse = true;
coa->type = m_type;
coa->unknown16 = 0x0a;
@@ -576,12 +583,6 @@ bool Object::HandleClick(Client* sender, const ClickObject_Struct* click_object)
}
}
if(sender->IsLooting())
{
coa->open = 0x00;
user = sender;
}
sender->QueuePacket(outapp);
safe_delete(outapp);
@@ -590,6 +591,7 @@ bool Object::HandleClick(Client* sender, const ClickObject_Struct* click_object)
return(false);
// Starting to use this object
m_inuse = true;
sender->SetTradeskillObject(this);
user = sender;
@@ -645,7 +647,7 @@ uint32 ZoneDatabase::AddObject(uint32 type, uint32 icon, const Object_Struct& ob
safe_delete_array(object_name);
auto results = QueryDatabase(query);
if (!results.Success()) {
Log(Logs::General, Logs::Error, "Unable to insert object: %s", results.ErrorMessage().c_str());
LogError("Unable to insert object: [{}]", results.ErrorMessage().c_str());
return 0;
}
@@ -684,7 +686,7 @@ void ZoneDatabase::UpdateObject(uint32 id, uint32 type, uint32 icon, const Objec
safe_delete_array(object_name);
auto results = QueryDatabase(query);
if (!results.Success()) {
Log(Logs::General, Logs::Error, "Unable to update object: %s", results.ErrorMessage().c_str());
LogError("Unable to update object: [{}]", results.ErrorMessage().c_str());
return;
}
@@ -728,7 +730,7 @@ void ZoneDatabase::DeleteObject(uint32 id)
std::string query = StringFormat("DELETE FROM object WHERE id = %i", id);
auto results = QueryDatabase(query);
if (!results.Success()) {
Log(Logs::General, Logs::Error, "Unable to delete object: %s", results.ErrorMessage().c_str());
LogError("Unable to delete object: [{}]", results.ErrorMessage().c_str());
}
}
+1 -1
View File
@@ -475,7 +475,7 @@ void PathfinderNavmesh::Load(const std::string &path)
m_impl->nav_mesh->addTile(data, data_size, DT_TILE_FREE_DATA, tile_ref, 0);
}
Log(Logs::General, Logs::Status, "Loaded Navmesh V%u file %s", version, path.c_str());
LogInfo("Loaded Navmesh V[{}] file [{}]", version, path.c_str());
}
}
+4 -4
View File
@@ -251,14 +251,14 @@ void PathfinderWaypoint::Load(const std::string &filename) {
if (strncmp(Magic, "EQEMUPATH", 9))
{
Log(Logs::General, Logs::Error, "Bad Magic String in .path file.");
LogError("Bad Magic String in .path file");
fclose(f);
return;
}
fread(&Head, sizeof(Head), 1, f);
Log(Logs::General, Logs::Status, "Path File Header: Version %ld, PathNodes %ld",
LogInfo("Path File Header: Version [{}], PathNodes [{}]",
(long)Head.version, (long)Head.PathNodeCount);
if (Head.version == 2)
@@ -271,7 +271,7 @@ void PathfinderWaypoint::Load(const std::string &filename) {
return;
}
else {
Log(Logs::General, Logs::Error, "Unsupported path file version.");
LogError("Unsupported path file version");
fclose(f);
return;
}
@@ -306,7 +306,7 @@ void PathfinderWaypoint::LoadV2(FILE *f, const PathFileHeader &header)
auto &node = m_impl->Nodes[i];
if (PathNodes[i].Neighbours[j].id > MaxNodeID)
{
Log(Logs::General, Logs::Error, "Path Node %i, Neighbour %i (%i) out of range.", i, j, PathNodes[i].Neighbours[j].id);
LogError("Path Node [{}], Neighbour [{}] ([{}]) out of range", i, j, PathNodes[i].Neighbours[j].id);
m_impl->PathFileValid = false;
}
+1 -1
View File
@@ -30,7 +30,7 @@ void CullPoints(std::vector<FindPerson_Point> &points) {
if (zone->zonemap->CheckLoS(glm::vec3(p.x, p.y, p.z), glm::vec3(p2.x, p2.y, p2.z))) {
points.erase(points.begin() + i + 1);
Log(Logs::General, Logs::Status, "Culled find path point %u, connecting %u->%u instead.", i + 1, i, i + 2);
LogInfo("Culled find path point [{}], connecting [{}]->[{}] instead", i + 1, i, i + 2);
}
else {
break;
+23 -46
View File
@@ -961,8 +961,7 @@ XS(XS_Client_SetEXP); /* prototype to pass -Wmissing-prototypes */
XS(XS_Client_SetEXP) {
dXSARGS;
if (items < 3 || items > 4)
Perl_croak(aTHX_
"Usage: Client::SetEXP(THIS, uint32 experience_points, uint32 aa_experience_points, [bool resexp=false])");
Perl_croak(aTHX_ "Usage: Client::SetEXP(THIS, uint32 experience_points, uint32 aa_experience_points, [bool resexp=false])");
{
Client *THIS;
uint32 set_exp = (uint32) SvUV(ST(1));
@@ -992,8 +991,7 @@ XS(XS_Client_SetBindPoint); /* prototype to pass -Wmissing-prototypes */
XS(XS_Client_SetBindPoint) {
dXSARGS;
if (items < 1 || items > 6)
Perl_croak(aTHX_
"Usage: Client::SetBindPoint(THIS, int to_zone = -1, int to_instance = 0, float new_x = 0.0f, float new_y = 0.0f, float new_z = 0.0f)");
Perl_croak(aTHX_ "Usage: Client::SetBindPoint(THIS, int to_zone = -1, int to_instance = 0, float new_x = 0.0f, float new_y = 0.0f, float new_z = 0.0f)");
{
Client *THIS;
int to_zone;
@@ -1231,22 +1229,18 @@ XS(XS_Client_MovePC) {
THIS->MovePC(zoneID, x, y, z, heading);
} else {
if (THIS->IsMerc()) {
Log(Logs::Detail, Logs::None,
"[CLIENT] Perl(XS_Client_MovePC) attempted to process a type Merc reference");
LogDebug("[CLIENT] Perl(XS_Client_MovePC) attempted to process a type Merc reference");
}
#ifdef BOTS
else if (THIS->IsBot()) {
Log(Logs::Detail, Logs::None,
"[CLIENT] Perl(XS_Client_MovePC) attempted to process a type Bot reference");
LogDebug("[CLIENT] Perl(XS_Client_MovePC) attempted to process a type Bot reference");
}
#endif
else if (THIS->IsNPC()) {
Log(Logs::Detail, Logs::None,
"[CLIENT] Perl(XS_Client_MovePC) attempted to process a type NPC reference");
LogDebug("[CLIENT] Perl(XS_Client_MovePC) attempted to process a type NPC reference");
}
else {
Log(Logs::Detail, Logs::None,
"[CLIENT] Perl(XS_Client_MovePC) attempted to process an Unknown type reference");
LogDebug("[CLIENT] Perl(XS_Client_MovePC) attempted to process an Unknown type reference");
}
Perl_croak(aTHX_ "THIS is not of type Client");
@@ -1260,8 +1254,7 @@ XS(XS_Client_MovePCInstance); /* prototype to pass -Wmissing-prototypes */
XS(XS_Client_MovePCInstance) {
dXSARGS;
if (items != 7)
Perl_croak(aTHX_
"Usage: Client::MovePCInstance(THIS, uint32 zone_id, uint32 instance_id, float x, float y, float z, float heading)");
Perl_croak(aTHX_ "Usage: Client::MovePCInstance(THIS, uint32 zone_id, uint32 instance_id, float x, float y, float z, float heading)");
{
Client *THIS;
uint32 zoneID = (uint32) SvUV(ST(1));
@@ -1283,22 +1276,18 @@ XS(XS_Client_MovePCInstance) {
THIS->MovePC(zoneID, instanceID, x, y, z, heading);
} else {
if (THIS->IsMerc()) {
Log(Logs::Detail, Logs::None,
"[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type Merc reference");
LogDebug("[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type Merc reference");
}
#ifdef BOTS
else if (THIS->IsBot()) {
Log(Logs::Detail, Logs::None,
"[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type Bot reference");
LogDebug("[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type Bot reference");
}
#endif
else if (THIS->IsNPC()) {
Log(Logs::Detail, Logs::None,
"[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type NPC reference");
LogDebug("[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type NPC reference");
}
else {
Log(Logs::Detail, Logs::None,
"[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process an Unknown type reference");
LogDebug("[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process an Unknown type reference");
}
Perl_croak(aTHX_ "THIS is not of type Client");
@@ -1335,8 +1324,7 @@ XS(XS_Client_GetFactionLevel); /* prototype to pass -Wmissing-prototypes */
XS(XS_Client_GetFactionLevel) {
dXSARGS;
if (items != 8)
Perl_croak(aTHX_
"Usage: Client::GetFactionLevel(THIS, uint32 character_id, uint32 npc_id, uint32 player_race_id, uint32 player_class_id, uint32 player_deity_id, uint32 player_faction_id, Mob*)");
Perl_croak(aTHX_ "Usage: Client::GetFactionLevel(THIS, uint32 character_id, uint32 npc_id, uint32 player_race_id, uint32 player_class_id, uint32 player_deity_id, uint32 player_faction_id, Mob*)");
{
Client *THIS;
FACTION_VALUE RETVAL;
@@ -1376,8 +1364,7 @@ XS(XS_Client_SetFactionLevel); /* prototype to pass -Wmissing-prototypes */
XS(XS_Client_SetFactionLevel) {
dXSARGS;
if (items != 6)
Perl_croak(aTHX_
"Usage: Client::SetFactionLevel(THIS, uint32 character_id, uint32 npc_id, uint8 character_class, uint8 character_race, uint8 character_deity)");
Perl_croak(aTHX_ "Usage: Client::SetFactionLevel(THIS, uint32 character_id, uint32 npc_id, uint8 character_class, uint8 character_race, uint8 character_deity)");
{
Client *THIS;
uint32 char_id = (uint32) SvUV(ST(1));
@@ -1403,8 +1390,7 @@ XS(XS_Client_SetFactionLevel2); /* prototype to pass -Wmissing-prototypes */
XS(XS_Client_SetFactionLevel2) {
dXSARGS;
if (items < 7 || items > 8)
Perl_croak(aTHX_
"Usage: Client::SetFactionLevel2(THIS, uint32 character_id, int32 faction_id, uint8 character_class, uint8 character_race, uint8 character_deity, int32 value, uint8 temp)");
Perl_croak(aTHX_ "Usage: Client::SetFactionLevel2(THIS, uint32 character_id, int32 faction_id, uint8 character_class, uint8 character_race, uint8 character_deity, int32 value, uint8 temp)");
{
Client *THIS;
uint32 char_id = (uint32) SvUV(ST(1));
@@ -1724,8 +1710,7 @@ XS(XS_Client_AddMoneyToPP); /* prototype to pass -Wmissing-prototypes */
XS(XS_Client_AddMoneyToPP) {
dXSARGS;
if (items != 6)
Perl_croak(aTHX_
"Usage: Client::AddMoneyToPP(THIS, uint32 copper, uint32 silver, uint32 gold, uint32 platinum, bool update_client)");
Perl_croak(aTHX_ "Usage: Client::AddMoneyToPP(THIS, uint32 copper, uint32 silver, uint32 gold, uint32 platinum, bool update_client)");
{
Client *THIS;
uint32 copper = (uint32) SvUV(ST(1));
@@ -3095,8 +3080,7 @@ XS(XS_Client_DeleteItemInInventory); /* prototype to pass -Wmissing-prototypes *
XS(XS_Client_DeleteItemInInventory) {
dXSARGS;
if (items < 2 || items > 4)
Perl_croak(aTHX_
"Usage: Client::DeleteItemInInventory(THIS, int16 slot_id, [int8 quantity = 0], [bool client_update = false])");
Perl_croak(aTHX_ "Usage: Client::DeleteItemInInventory(THIS, int16 slot_id, [int8 quantity = 0], [bool client_update = false])");
{
Client *THIS;
int16 slot_id = (int16) SvIV(ST(1));
@@ -3132,8 +3116,7 @@ XS(XS_Client_SummonItem); /* prototype to pass -Wmissing-prototypes */
XS(XS_Client_SummonItem) {
dXSARGS;
if (items < 2 || items > 10)
Perl_croak(aTHX_
"Usage: Client::SummonItem(THIS, uint32 item_id, [int16 charges = -1], [bool attune = false], [uint32 aug1 = 0], [uint32 aug2 = 0], [uint32 aug3 = 0], [uint32 aug4 = 0], [uint32 aug5 = 0], [uint16 slot_id = cursor])");
Perl_croak(aTHX_ "Usage: Client::SummonItem(THIS, uint32 item_id, [int16 charges = -1], [bool attune = false], [uint32 aug1 = 0], [uint32 aug2 = 0], [uint32 aug3 = 0], [uint32 aug4 = 0], [uint32 aug5 = 0], [uint16 slot_id = cursor])");
{
Client *THIS;
uint32 item_id = (uint32) SvUV(ST(1));
@@ -4834,8 +4817,7 @@ XS(XS_Client_GrantAlternateAdvancementAbility); /* prototype to pass -Wmissing-p
XS(XS_Client_GrantAlternateAdvancementAbility) {
dXSARGS;
if (items < 3 || items > 4)
Perl_croak(aTHX_
"Usage: Client::GrantAlternateAdvancementAbility(THIS, int aa_id, int points, [bool ignore_cost = false])");
Perl_croak(aTHX_ "Usage: Client::GrantAlternateAdvancementAbility(THIS, int aa_id, int points, [bool ignore_cost = false])");
{
Client *THIS;
bool RETVAL;
@@ -4992,8 +4974,7 @@ XS(XS_Client_UpdateTaskActivity); /* prototype to pass -Wmissing-prototypes */
XS(XS_Client_UpdateTaskActivity) {
dXSARGS;
if (items < 4)
Perl_croak(aTHX_
"Usage: Client::UpdateTaskActivity(THIS, int task_id, int activity_id, int count, [bool ignore_quest_update = false])");
Perl_croak(aTHX_ "Usage: Client::UpdateTaskActivity(THIS, int task_id, int activity_id, int count, [bool ignore_quest_update = false])");
{
bool ignore_quest_update = false;
@@ -5052,8 +5033,7 @@ XS(XS_Client_AssignTask); /* prototype to pass -Wmissing-prototypes */
XS(XS_Client_AssignTask) {
dXSARGS;
if (items != 3 && items != 4)
Perl_croak(aTHX_
"Usage: Client::AssignTask(THIS, int task_id, int npc_id, [bool enforce_level_requirement = false])");
Perl_croak(aTHX_ "Usage: Client::AssignTask(THIS, int task_id, int npc_id, [bool enforce_level_requirement = false])");
{
Client *THIS;
int TaskID = (int) SvIV(ST(1));
@@ -5964,8 +5944,7 @@ XS(XS_Client_SendMarqueeMessage); /* prototype to pass -Wmissing-prototypes */
XS(XS_Client_SendMarqueeMessage) {
dXSARGS;
if (items != 7)
Perl_croak(aTHX_
"Usage: Client::SendMarqueeMessage(THIS, uint32 type, uint32 priority, uint32 fade_in, uint32 fade_out, uint32 duration, string msg)");
Perl_croak(aTHX_ "Usage: Client::SendMarqueeMessage(THIS, uint32 type, uint32 priority, uint32 fade_in, uint32 fade_out, uint32 duration, string msg)");
{
Client *THIS;
uint32 type = (uint32) SvUV(ST(1));
@@ -6144,8 +6123,7 @@ XS(XS_Client_QuestReward); /* prototype to pass -Wmissing-prototypes */
XS(XS_Client_QuestReward) {
dXSARGS;
if (items < 1 || items > 9)
Perl_croak(aTHX_
"Usage: Client::QuestReward(THIS, int32 mob, int32 copper, int32 silver, int32 gold, int32 platinum, int32 item_id, int32 exp, [bool faction = false])");
Perl_croak(aTHX_ "Usage: Client::QuestReward(THIS, int32 mob, int32 copper, int32 silver, int32 gold, int32 platinum, int32 item_id, int32 exp, [bool faction = false])");
{
Client *THIS;
Mob *mob = nullptr;
@@ -6245,8 +6223,7 @@ XS(XS_Client_Popup2); /* prototype to pass -Wmissing-prototypes */
XS(XS_Client_Popup2) {
dXSARGS;
if (items < 3 || items > 10)
Perl_croak(aTHX_
"Usage: Client::SendFullPopup(THIS, string title, string text, uint32 popup_id, uint32 negative_id, uint32 buttons, uint32 duration, string button_name_0, string button_name_1, uint32 sound_controls)");
Perl_croak(aTHX_ "Usage: Client::SendFullPopup(THIS, string title, string text, uint32 popup_id, uint32 negative_id, uint32 buttons, uint32 duration, string button_name_0, string button_name_1, uint32 sound_controls)");
{
Client *THIS;
char *Title = (char *) SvPV_nolen(ST(1));
+4 -8
View File
@@ -1222,8 +1222,7 @@ XS(XS_EntityList_MessageStatus); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_MessageStatus) {
dXSARGS;
if (items < 5)
Perl_croak(aTHX_
"Usage: EntityList::MessageStatus(THIS, uint32 guild_id, uint32 emote_color_type, string message)");
Perl_croak(aTHX_ "Usage: EntityList::MessageStatus(THIS, uint32 guild_id, uint32 emote_color_type, string message)");
{
EntityList *THIS;
uint32 to_guilddbid = (uint32) SvUV(ST(1));
@@ -1248,8 +1247,7 @@ XS(XS_EntityList_MessageClose); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_MessageClose) {
dXSARGS;
if (items < 6)
Perl_croak(aTHX_
"Usage: EntityList::MessageClose(THIS, Mob* sender, bool skip_sender, float distance, uint32 emote_color_type, string message)");
Perl_croak(aTHX_ "Usage: EntityList::MessageClose(THIS, Mob* sender, bool skip_sender, float distance, uint32 emote_color_type, string message)");
{
EntityList *THIS;
Mob *sender;
@@ -1682,8 +1680,7 @@ XS(XS_EntityList_MessageGroup); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_MessageGroup) {
dXSARGS;
if (items < 5)
Perl_croak(aTHX_
"Usage: EntityList::MessageGroup(THIS, Mob* sender, bool skip_close, uint32 emote_color_type, string message)");
Perl_croak(aTHX_ "Usage: EntityList::MessageGroup(THIS, Mob* sender, bool skip_close, uint32 emote_color_type, string message)");
{
EntityList *THIS;
Mob *sender;
@@ -1716,8 +1713,7 @@ XS(XS_EntityList_GetRandomClient); /* prototype to pass -Wmissing-prototypes */
XS(XS_EntityList_GetRandomClient) {
dXSARGS;
if ((items < 5) || (items > 6))
Perl_croak(aTHX_
"Usage: EntityList::GetRandomClient(THIS, float x, float y, float z, float distance, [Client* exclude_client = nullptr])");
Perl_croak(aTHX_ "Usage: EntityList::GetRandomClient(THIS, float x, float y, float z, float distance, [Client* exclude_client = nullptr])");
{
EntityList *THIS;
Client *RETVAL, *c = nullptr;
+1 -2
View File
@@ -486,8 +486,7 @@ XS(XS_Group_TeleportGroup); /* prototype to pass -Wmissing-prototypes */
XS(XS_Group_TeleportGroup) {
dXSARGS;
if (items != 7)
Perl_croak(aTHX_
"Usage: Group::TeleportGroup(THIS, Mob* sender, uint32 zone_id, float x, float y, float z, float heading)");
Perl_croak(aTHX_ "Usage: Group::TeleportGroup(THIS, Mob* sender, uint32 zone_id, float x, float y, float z, float heading)");
{
Group *THIS;
Mob *sender;
+24 -48
View File
@@ -794,8 +794,7 @@ XS(XS_Mob_Attack); /* prototype to pass -Wmissing-prototypes */
XS(XS_Mob_Attack) {
dXSARGS;
if (items < 2 || items > 4)
Perl_croak(aTHX_
"Usage: Mob::Attack(THIS, Mob* other, [int hand = 13 [prim|sec]], [bool from_riposte = false])");
Perl_croak(aTHX_ "Usage: Mob::Attack(THIS, Mob* other, [int hand = 13 [prim|sec]], [bool from_riposte = false])");
{
Mob *THIS;
bool RETVAL;
@@ -842,8 +841,7 @@ XS(XS_Mob_Damage); /* prototype to pass -Wmissing-prototypes */
XS(XS_Mob_Damage) {
dXSARGS;
if (items < 5 || items > 8)
Perl_croak(aTHX_
"Usage: Mob::Damage(THIS, Mob* from, int32 damage, uint16 spell_id, int attack_skill, [bool avoidable = true], [int8 buffslot = -1], [bool buff_tic = false])");
Perl_croak(aTHX_ "Usage: Mob::Damage(THIS, Mob* from, int32 damage, uint16 spell_id, int attack_skill, [bool avoidable = true], [int8 buffslot = -1], [bool buff_tic = false])");
{
Mob *THIS;
Mob *from;
@@ -1447,8 +1445,7 @@ XS(XS_Mob_MakeTempPet); /* prototype to pass -Wmissing-prototypes */
XS(XS_Mob_MakeTempPet) {
dXSARGS;
if (items < 2 || items > 6)
Perl_croak(aTHX_
"Usage: Mob::MakeTempPet(THIS, uint16 spell_id, [string name = nullptr], [uint32 duration = 0], [Mob* target = nullptr], [bool sticktarg = 0])");
Perl_croak(aTHX_ "Usage: Mob::MakeTempPet(THIS, uint16 spell_id, [string name = nullptr], [uint32 duration = 0], [Mob* target = nullptr], [bool sticktarg = 0])");
{
Mob *THIS;
uint16 spell_id = (uint16) SvUV(ST(1));
@@ -1498,8 +1495,7 @@ XS(XS_Mob_TypesTempPet); /* prototype to pass -Wmissing-prototypes */
XS(XS_Mob_TypesTempPet) {
dXSARGS;
if (items < 2 || items > 7)
Perl_croak(aTHX_
"Usage: Mob::TypesTempPet(THIS, uint32 type_id, [string name = nullptr], [uint32 duration = 0], [bool follow = 0], [Mob* target = nullptr], [bool stick_targ = 0])");
Perl_croak(aTHX_ "Usage: Mob::TypesTempPet(THIS, uint32 type_id, [string name = nullptr], [uint32 duration = 0], [bool follow = 0], [Mob* target = nullptr], [bool stick_targ = 0])");
{
Mob *THIS;
uint32 typesid = (uint32) SvUV(ST(1));
@@ -3680,8 +3676,7 @@ XS(XS_Mob_Message_StringID); /* prototype to pass -Wmissing-prototypes */
XS(XS_Mob_Message_StringID) {
dXSARGS;
if (items < 3 || items > 4)
Perl_croak(aTHX_
"Usage: Mob::Message_StringID(THIS, uint32 emote_color_type, uint32 string_id, [uint32 distance = 0])");
Perl_croak(aTHX_ "Usage: Mob::Message_StringID(THIS, uint32 emote_color_type, uint32 string_id, [uint32 distance = 0])");
{
Mob *THIS;
uint32 type = (uint32) SvUV(ST(1));
@@ -3805,8 +3800,7 @@ XS(XS_Mob_CastSpell); /* prototype to pass -Wmissing-prototypes */
XS(XS_Mob_CastSpell) {
dXSARGS;
if (items < 3 || items > 7)
Perl_croak(aTHX_
"Usage: Mob::CastSpell(THIS, uint16 spell_id, uint16 target_id, [int slot = 22], [int32 cast_time = -1], [int32 mana_cost = -1], [int16 resist_adjust = 0])");
Perl_croak(aTHX_ "Usage: Mob::CastSpell(THIS, uint16 spell_id, uint16 target_id, [int slot = 22], [int32 cast_time = -1], [int32 mana_cost = -1], [int16 resist_adjust = 0])");
{
Mob *THIS;
uint16 spell_id = (uint16) SvUV(ST(1));
@@ -3862,8 +3856,7 @@ XS(XS_Mob_SpellFinished); /* prototype to pass -Wmissing-prototypes */
XS(XS_Mob_SpellFinished) {
dXSARGS;
if (items < 2 || items > 5)
Perl_croak(aTHX_
"Usage: Mob::SpellFinished(uint16 spell_id, [Mob* spell_target = this], [uint16 mana_cost = 0], [uint16 resist_diff = 0])");
Perl_croak(aTHX_ "Usage: Mob::SpellFinished(uint16 spell_id, [Mob* spell_target = this], [uint16 mana_cost = 0], [uint16 resist_diff = 0])");
{
Mob *THIS;
uint16 spell_id = (uint16) SvUV(ST(1));
@@ -4045,8 +4038,7 @@ XS(XS_Mob_CanBuffStack); /* prototype to pass -Wmissing-prototypes */
XS(XS_Mob_CanBuffStack) {
dXSARGS;
if (items < 3 || items > 4)
Perl_croak(aTHX_
"Usage: Mob::CanBuffStack(THIS, uint16 spell_id, uint8 caster_level, [bool fail_if_overwritten = false])");
Perl_croak(aTHX_ "Usage: Mob::CanBuffStack(THIS, uint16 spell_id, uint8 caster_level, [bool fail_if_overwritten = false])");
{
Mob *THIS;
int RETVAL;
@@ -5044,8 +5036,7 @@ XS(XS_Mob_AddToHateList); /* prototype to pass -Wmissing-prototypes */
XS(XS_Mob_AddToHateList) {
dXSARGS;
if (items < 2 || items > 7)
Perl_croak(aTHX_
"Usage: Mob::AddToHateList(THIS, Mob* other, [int32 hate = 0], [int32 damage = 0], [bool yell_for_help = true], [bool frenzy = false], [bool buff_tic = false])");
Perl_croak(aTHX_ "Usage: Mob::AddToHateList(THIS, Mob* other, [int32 hate = 0], [int32 damage = 0], [bool yell_for_help = true], [bool frenzy = false], [bool buff_tic = false])");
{
Mob *THIS;
Mob *other;
@@ -5609,8 +5600,7 @@ XS(XS_Mob_NavigateTo); /* prototype to pass -Wmissing-prototypes */
XS(XS_Mob_NavigateTo) {
dXSARGS;
if (items < 4 || items > 5)
Perl_croak(aTHX_
"Usage: Mob::NavigateTo(THIS, float x, float y, float z)");
Perl_croak(aTHX_ "Usage: Mob::NavigateTo(THIS, float x, float y, float z)");
{
Mob *THIS;
float x = (float) SvNV(ST(1));
@@ -5735,8 +5725,7 @@ XS(XS_Mob_NPCSpecialAttacks); /* prototype to pass -Wmissing-prototypes */
XS(XS_Mob_NPCSpecialAttacks) {
dXSARGS;
if (items < 3 || items > 5)
Perl_croak(aTHX_
"Usage: Mob::NPCSpecialAttacks(THIS, string abilities_string, int perm_tag, [bool reset = true], [bool remove = true])");
Perl_croak(aTHX_ "Usage: Mob::NPCSpecialAttacks(THIS, string abilities_string, int perm_tag, [bool reset = true], [bool remove = true])");
{
Mob *THIS;
char *parse = (char *) SvPV_nolen(ST(1));
@@ -6476,8 +6465,7 @@ XS(XS_Mob_DoSpecialAttackDamage); /* prototype to pass -Wmissing-prototypes */
XS(XS_Mob_DoSpecialAttackDamage) {
dXSARGS;
if (items < 4 || items > 6)
Perl_croak(aTHX_
"Usage: Mob::DoSpecialAttackDamage(THIS, Mob* target, int skill, int32 max_damage, [int32 min_damage = 1], [int32 hate_override = -11])");
Perl_croak(aTHX_ "Usage: Mob::DoSpecialAttackDamage(THIS, Mob* target, int skill, int32 max_damage, [int32 min_damage = 1], [int32 hate_override = -11])");
{
Mob *THIS;
Mob *target;
@@ -6620,8 +6608,7 @@ XS(XS_Mob_ProjectileAnim); /* prototype to pass -Wmissing-prototypes */
XS(XS_Mob_ProjectileAnim) {
dXSARGS;
if (items < 3 || items > 9)
Perl_croak(aTHX_
"Usage: Mob::ProjectileAnim(THIS, Mob* mob, int item_id, [bool is_arrow = false], [float speed = 0], [float angle = 0], [float tilt = 0], [float arc = 0])");
Perl_croak(aTHX_ "Usage: Mob::ProjectileAnim(THIS, Mob* mob, int item_id, [bool is_arrow = false], [float speed = 0], [float angle = 0], [float tilt = 0], [float arc = 0])");
{
Mob *THIS;
@@ -6703,8 +6690,7 @@ XS(XS_Mob_SendAppearanceEffect); /* prototype to pass -Wmissing-prototypes */
XS(XS_Mob_SendAppearanceEffect) {
dXSARGS;
if (items < 2 || items > 7)
Perl_croak(aTHX_
"Usage: Mob::SendAppearanceEffect(THIS, int32 param_1, [int32 param_2 = 0], [int32 param_3 = 0], [int32 param_4 = 0], [int32 param_5 = 0], [Client* single_client_to_send_to = null])");
Perl_croak(aTHX_ "Usage: Mob::SendAppearanceEffect(THIS, int32 param_1, [int32 param_2 = 0], [int32 param_3 = 0], [int32 param_4 = 0], [int32 param_5 = 0], [Client* single_client_to_send_to = null])");
{
Mob *THIS;
int32 parm1 = (int32) SvIV(ST(1));
@@ -6833,8 +6819,7 @@ XS(XS_Mob_SendIllusion); /* prototype to pass -Wmissing-prototypes */
XS(XS_Mob_SendIllusion) {
dXSARGS;
if (items < 2 || items > 14)
Perl_croak(aTHX_
"Usage: Mob::SendIllusion(THIS, uint16 race, [uint8 gender = 0xFF], [uint8 texture face = 0xFF], [uint8 hairstyle = 0xFF], [uint8 hair_color = 0xFF], [uint8 beard = 0xFF], [uint8 beard_color =FF], [uint32 drakkin_tattoo = 0xFFFFFFFF], [uint32 drakkin_details = 0xFFFFFFFF], [float size = -1])");
Perl_croak(aTHX_ "Usage: Mob::SendIllusion(THIS, uint16 race, [uint8 gender = 0xFF], [uint8 texture face = 0xFF], [uint8 hairstyle = 0xFF], [uint8 hair_color = 0xFF], [uint8 beard = 0xFF], [uint8 beard_color =FF], [uint32 drakkin_tattoo = 0xFFFFFFFF], [uint32 drakkin_details = 0xFFFFFFFF], [float size = -1])");
{
Mob *THIS;
uint16 race = (uint16) SvIV(ST(1));
@@ -6882,8 +6867,7 @@ XS(XS_Mob_CameraEffect); /* prototype to pass -Wmissing-prototypes */
XS(XS_Mob_CameraEffect) {
dXSARGS;
if (items < 2 || items > 5)
Perl_croak(aTHX_
"Usage: Mob::CameraEffect(THIS, uint32 duration, [uint32 intensity = 0], [Client* single_client = nullptr], [bool is_world_wide = false])");
Perl_croak(aTHX_ "Usage: Mob::CameraEffect(THIS, uint32 duration, [uint32 intensity = 0], [Client* single_client = nullptr], [bool is_world_wide = false])");
{
Mob *THIS;
uint32 duration = (uint32) SvUV(ST(1));
@@ -6925,8 +6909,7 @@ XS(XS_Mob_SpellEffect); /* prototype to pass -Wmissing-prototypes */
XS(XS_Mob_SpellEffect) {
dXSARGS;
if (items < 2 || items > 8)
Perl_croak(aTHX_
"Usage: Mob::SpellEffect(THIS, uint32 effect, [uint32 duration = 5000], [uint32 finish_delay = 0], [bool zone_wide = false], [uint32 unk20 = 3000], [bool perm_effect = false], [Client* single_client])");
Perl_croak(aTHX_ "Usage: Mob::SpellEffect(THIS, uint32 effect, [uint32 duration = 5000], [uint32 finish_delay = 0], [bool zone_wide = false], [uint32 unk20 = 3000], [bool perm_effect = false], [Client* single_client])");
{
Mob *THIS;
uint32 effect = (uint32) SvUV(ST(1));
@@ -7054,8 +7037,7 @@ XS(XS_Mob_SetGlobal);
XS(XS_Mob_SetGlobal) {
dXSARGS;
if (items < 5 || items > 6)
Perl_croak(aTHX_
"Usage: SetGlobal(THIS, string var_name, string new_value, int options, string duration, [Mob* other = nullptr])");
Perl_croak(aTHX_ "Usage: SetGlobal(THIS, string var_name, string new_value, int options, string duration, [Mob* other = nullptr])");
{
Mob *THIS;
char *varname = (char *) SvPV_nolen(ST(1));
@@ -7091,8 +7073,7 @@ XS(XS_Mob_TarGlobal);
XS(XS_Mob_TarGlobal) {
dXSARGS;
if (items != 7)
Perl_croak(aTHX_
"Usage: TarGlobal(THIS, string var_name, string value, string duration, int npc_id, int character_id, int zone_id)");
Perl_croak(aTHX_ "Usage: TarGlobal(THIS, string var_name, string value, string duration, int npc_id, int character_id, int zone_id)");
{
Mob *THIS;
char *varname = (char *) SvPV_nolen(ST(1));
@@ -7141,8 +7122,7 @@ XS(XS_Mob_SetSlotTint); /* prototype to pass -Wmissing-prototypes */
XS(XS_Mob_SetSlotTint) {
dXSARGS;
if (items != 5)
Perl_croak(aTHX_
"Usage: Mob::SetSlotTint(THIS, uint8 material_slot, uint8 red_tint, uint8 green_tint, uint8 blue_tint)");
Perl_croak(aTHX_ "Usage: Mob::SetSlotTint(THIS, uint8 material_slot, uint8 red_tint, uint8 green_tint, uint8 blue_tint)");
{
Mob *THIS;
uint8 material_slot = (uint8) SvIV(ST(1));
@@ -7167,8 +7147,7 @@ XS(XS_Mob_WearChange); /* prototype to pass -Wmissing-prototypes */
XS(XS_Mob_WearChange) {
dXSARGS;
if (items < 3 || items > 4)
Perl_croak(aTHX_
"Usage: Mob::WearChange(THIS, uint8 material_slot, uint16 texture, [uint32 color = 0, uint32 hero_forge_model = 0])");
Perl_croak(aTHX_ "Usage: Mob::WearChange(THIS, uint8 material_slot, uint16 texture, [uint32 color = 0, uint32 hero_forge_model = 0])");
{
Mob *THIS;
uint8 material_slot = (uint8) SvIV(ST(1));
@@ -7598,8 +7577,7 @@ XS(XS_Mob_DoMeleeSkillAttackDmg); /* prototype to pass -Wmissing-prototypes */
XS(XS_Mob_DoMeleeSkillAttackDmg) {
dXSARGS;
if (items != 7)
Perl_croak(aTHX_
"Usage: Mob::DoMeleeSkillAttackDmg(THIS, Mob* target, uint16 weapon_damage, int skill, int16 chance_mod, int16 focus, uint8 can_riposte)");
Perl_croak(aTHX_ "Usage: Mob::DoMeleeSkillAttackDmg(THIS, Mob* target, uint16 weapon_damage, int skill, int16 chance_mod, int16 focus, uint8 can_riposte)");
{
Mob *THIS;
Mob *target;
@@ -7634,8 +7612,7 @@ XS(XS_Mob_DoArcheryAttackDmg); /* prototype to pass -Wmissing-prototypes */
XS(XS_Mob_DoArcheryAttackDmg) {
dXSARGS;
if (items != 7)
Perl_croak(aTHX_
"Usage: Mob::DoArcheryAttackDmg(THIS, Mob* target, [range_weapon_item_instance = nullptr], [ammo_item_instance = nullptr], uint16 weapon_damage, int16 chance_mod, int16 focus)");
Perl_croak(aTHX_ "Usage: Mob::DoArcheryAttackDmg(THIS, Mob* target, [range_weapon_item_instance = nullptr], [ammo_item_instance = nullptr], uint16 weapon_damage, int16 chance_mod, int16 focus)");
{
Mob *THIS;
Mob *target;
@@ -7670,8 +7647,7 @@ XS(XS_Mob_DoThrowingAttackDmg); /* prototype to pass -Wmissing-prototypes */
XS(XS_Mob_DoThrowingAttackDmg) {
dXSARGS;
if (items != 7)
Perl_croak(aTHX_
"Usage: Mob::DoThrowingAttackDmg(THIS, Mob* target, [range_weapon_item_instance = nullptr], [ammo_item_instance = nullptr], uint16 weapon_damage, int16 chance_mod, int16 focus)");
Perl_croak(aTHX_ "Usage: Mob::DoThrowingAttackDmg(THIS, Mob* target, [range_weapon_item_instance = nullptr], [ammo_item_instance = nullptr], uint16 weapon_damage, int16 chance_mod, int16 focus)");
{
Mob *THIS;
Mob *target;
+4 -8
View File
@@ -97,8 +97,7 @@ XS(XS_NPC_AddItem); /* prototype to pass -Wmissing-prototypes */
XS(XS_NPC_AddItem) {
dXSARGS;
if (items < 2 || items > 10)
Perl_croak(aTHX_
"Usage: NPC::AddItem(THIS, uint32 item_id, [uint16 charges = 0], [bool equip_item = true], [uint32 aug1 = 0], [uint32 aug2 = 0], [uint32 aug3 = 0], [uint32 aug4 = 0], [uint32 aug5 = 0], [uint32 aug6 = 0])");
Perl_croak(aTHX_ "Usage: NPC::AddItem(THIS, uint32 item_id, [uint16 charges = 0], [bool equip_item = true], [uint32 aug1 = 0], [uint32 aug2 = 0], [uint32 aug3 = 0], [uint32 aug4 = 0], [uint32 aug5 = 0], [uint32 aug6 = 0])");
{
NPC *THIS;
uint32 itemid = (uint32) SvUV(ST(1));
@@ -1283,8 +1282,7 @@ XS(XS_NPC_MoveTo); /* prototype to pass -Wmissing-prototypes */
XS(XS_NPC_MoveTo) {
dXSARGS;
if (items != 4 && items != 5 && items != 6)
Perl_croak(aTHX_
"Usage: NPC::MoveTo(THIS, float x, float y, float z, [float heading], [bool save_guard_location = false])");
Perl_croak(aTHX_ "Usage: NPC::MoveTo(THIS, float x, float y, float z, [float heading], [bool save_guard_location = false])");
{
NPC *THIS;
float mtx = (float) SvNV(ST(1));
@@ -1391,8 +1389,7 @@ XS(XS_NPC_AI_SetRoambox); /* prototype to pass -Wmissing-prototypes */
XS(XS_NPC_AI_SetRoambox) {
dXSARGS;
if (items < 6 || items > 8)
Perl_croak(aTHX_
"Usage: NPC::AI_SetRoambox(THIS, float distance, float max_x, float min_x, float max_y, float min_y, [uint32 max_delay = 2500], [uint32 min_delay = 2500])");
Perl_croak(aTHX_ "Usage: NPC::AI_SetRoambox(THIS, float distance, float max_x, float min_x, float max_y, float min_y, [uint32 max_delay = 2500], [uint32 min_delay = 2500])");
{
NPC *THIS;
float iDist = (float) SvNV(ST(1));
@@ -1852,8 +1849,7 @@ XS(XS_NPC_AddSpellToNPCList); /* prototype to pass -Wmissing-prototypes */
XS(XS_NPC_AddSpellToNPCList) {
dXSARGS;
if (items != 7)
Perl_croak(aTHX_
"Usage: NPC::AddAISpell(THIS, int priority, int spell_id, int type, int mana_cost, int recast_delay, int resist_adjust)");
Perl_croak(aTHX_ "Usage: NPC::AddAISpell(THIS, int priority, int spell_id, int type, int mana_cost, int recast_delay, int resist_adjust)");
{
NPC *THIS;
int priority = (int) SvIV(ST(1));
+2 -4
View File
@@ -420,8 +420,7 @@ XS(XS_Raid_TeleportGroup); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_TeleportGroup) {
dXSARGS;
if (items != 8)
Perl_croak(aTHX_
"Usage: Raid::TeleportGroup(THIS, Mob* sender, uint32 zone_id, float x, float y, float z, float heading, uint32 group_id)");
Perl_croak(aTHX_ "Usage: Raid::TeleportGroup(THIS, Mob* sender, uint32 zone_id, float x, float y, float z, float heading, uint32 group_id)");
{
Raid *THIS;
Mob *sender;
@@ -457,8 +456,7 @@ XS(XS_Raid_TeleportRaid); /* prototype to pass -Wmissing-prototypes */
XS(XS_Raid_TeleportRaid) {
dXSARGS;
if (items != 7)
Perl_croak(aTHX_
"Usage: Raid::TeleportRaid(THIS, Mob* sender, uint32 zone_id, float x, float y, float z, float heading)");
Perl_croak(aTHX_ "Usage: Raid::TeleportRaid(THIS, Mob* sender, uint32 zone_id, float x, float y, float z, float heading)");
{
Raid *THIS;
Mob *sender;
+1 -1
View File
@@ -252,7 +252,7 @@ void ZoneDatabase::InsertPetitionToDB(Petition* wpet)
}
#if EQDEBUG >= 5
Log(Logs::General, Logs::None, "New petition created");
LogDebug("New petition created");
#endif
}
+4 -4
View File
@@ -213,7 +213,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower,
PetRecord record;
if(!database.GetPoweredPetEntry(pettype, act_power, &record)) {
Message(Chat::Red, "Unable to find data for pet %s", pettype);
Log(Logs::General, Logs::Error, "Unable to find data for pet %s, check pets table.", pettype);
LogError("Unable to find data for pet [{}], check pets table", pettype);
return;
}
@@ -221,7 +221,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower,
const NPCType *base = database.LoadNPCTypesData(record.npc_type);
if(base == nullptr) {
Message(Chat::Red, "Unable to load NPC data for pet %s", pettype);
Log(Logs::General, Logs::Error, "Unable to load NPC data for pet %s (NPC ID %d), check pets and npc_types tables.", pettype, record.npc_type);
LogError("Unable to load NPC data for pet [{}] (NPC ID [{}]), check pets and npc_types tables", pettype, record.npc_type);
return;
}
@@ -374,7 +374,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower,
npc_type->helmtexture = monster->helmtexture;
npc_type->herosforgemodel = monster->herosforgemodel;
} else
Log(Logs::General, Logs::Error, "Error loading NPC data for monster summoning pet (NPC ID %d)", monsterid);
LogError("Error loading NPC data for monster summoning pet (NPC ID [{}])", monsterid);
}
@@ -665,7 +665,7 @@ bool ZoneDatabase::GetBasePetItems(int32 equipmentset, uint32 *items) {
if (results.RowCount() != 1) {
// invalid set reference, it doesn't exist
Log(Logs::General, Logs::Error, "Error in GetBasePetItems equipment set '%d' does not exist", curset);
LogError("Error in GetBasePetItems equipment set [{}] does not exist", curset);
return false;
}
+1 -1
View File
@@ -1050,7 +1050,7 @@ int QuestParserCollection::DispatchEventSpell(QuestEventID evt, NPC* npc, Client
void QuestParserCollection::LoadPerlEventExportSettings(PerlEventExportSettings* perl_event_export_settings) {
Log(Logs::General, Logs::Zone_Server, "Loading Perl Event Export Settings...");
LogInfo("Loading Perl Event Export Settings...");
/* Write Defaults First (All Enabled) */
for (int i = 0; i < _LargestEventID; i++){
+26 -17
View File
@@ -157,7 +157,7 @@ void QuestManager::echo(int colour, const char *str) {
void QuestManager::say(const char *str, Journal::Options &opts) {
QuestManagerCurrentQuestVars();
if (!owner) {
Log(Logs::General, Logs::Quests, "QuestManager::say called with nullptr owner. Probably syntax error in quest file.");
LogQuests("QuestManager::say called with nullptr owner. Probably syntax error in quest file");
return;
}
else {
@@ -258,7 +258,16 @@ Mob *QuestManager::spawn_from_spawn2(uint32 spawn2_id)
return nullptr;
}
}
uint32 npcid = spawn_group->GetNPCType();
uint16 condition_value=1;
uint16 condition_id=found_spawn->GetSpawnCondition();
if (condition_id > 0) {
condition_value = zone->spawn_conditions.GetCondition(zone->GetShortName(), zone->GetInstanceID(), condition_id);
}
uint32 npcid = spawn_group->GetNPCType(condition_value);
if (npcid == 0) {
return nullptr;
}
@@ -558,7 +567,7 @@ void QuestManager::pausetimer(const char *timer_name) {
{
if (pcur->owner && pcur->owner == owner && pcur->name == timer_name)
{
Log(Logs::General, Logs::Quests, "Timer %s is already paused for %s. Returning...", timer_name, owner->GetName());
LogQuests("Timer [{}] is already paused for [{}]. Returning", timer_name, owner->GetName());
return;
}
++pcur;
@@ -580,7 +589,7 @@ void QuestManager::pausetimer(const char *timer_name) {
pt.name = timername;
pt.owner = owner;
pt.time = milliseconds;
Log(Logs::General, Logs::Quests, "Pausing timer %s for %s with %d ms remaining.", timer_name, owner->GetName(), milliseconds);
LogQuests("Pausing timer [{}] for [{}] with [{}] ms remaining", timer_name, owner->GetName(), milliseconds);
PTimerList.push_back(pt);
}
@@ -606,7 +615,7 @@ void QuestManager::resumetimer(const char *timer_name) {
if (milliseconds == 0)
{
Log(Logs::General, Logs::Quests, "Paused timer %s not found or has expired. Returning...", timer_name);
LogQuests("Paused timer [{}] not found or has expired. Returning", timer_name);
return;
}
@@ -617,14 +626,14 @@ void QuestManager::resumetimer(const char *timer_name) {
{
cur->Timer_.Enable();
cur->Timer_.Start(milliseconds, false);
Log(Logs::General, Logs::Quests, "Resuming timer %s for %s with %d ms remaining.", timer_name, owner->GetName(), milliseconds);
LogQuests("Resuming timer [{}] for [{}] with [{}] ms remaining", timer_name, owner->GetName(), milliseconds);
return;
}
++cur;
}
QTimerList.push_back(QuestTimer(milliseconds, owner, timer_name));
Log(Logs::General, Logs::Quests, "Creating a new timer and resuming %s for %s with %d ms remaining.", timer_name, owner->GetName(), milliseconds);
LogQuests("Creating a new timer and resuming [{}] for [{}] with [{}] ms remaining", timer_name, owner->GetName(), milliseconds);
}
@@ -649,7 +658,7 @@ bool QuestManager::ispausedtimer(const char *timer_name) {
void QuestManager::emote(const char *str) {
QuestManagerCurrentQuestVars();
if (!owner) {
Log(Logs::General, Logs::Quests, "QuestManager::emote called with nullptr owner. Probably syntax error in quest file.");
LogQuests("QuestManager::emote called with nullptr owner. Probably syntax error in quest file");
return;
}
else {
@@ -660,7 +669,7 @@ void QuestManager::emote(const char *str) {
void QuestManager::shout(const char *str) {
QuestManagerCurrentQuestVars();
if (!owner) {
Log(Logs::General, Logs::Quests, "QuestManager::shout called with nullptr owner. Probably syntax error in quest file.");
LogQuests("QuestManager::shout called with nullptr owner. Probably syntax error in quest file");
return;
}
else {
@@ -671,7 +680,7 @@ void QuestManager::shout(const char *str) {
void QuestManager::shout2(const char *str) {
QuestManagerCurrentQuestVars();
if (!owner) {
Log(Logs::General, Logs::Quests, "QuestManager::shout2 called with nullptr owner. Probably syntax error in quest file.");
LogQuests("QuestManager::shout2 called with nullptr owner. Probably syntax error in quest file");
return;
}
else {
@@ -690,7 +699,7 @@ void QuestManager::gmsay(const char *str, uint32 color, bool send_to_world, uint
void QuestManager::depop(int npc_type) {
QuestManagerCurrentQuestVars();
if (!owner || !owner->IsNPC()) {
Log(Logs::General, Logs::Quests, "QuestManager::depop called with nullptr owner or non-NPC owner. Probably syntax error in quest file.");
LogQuests("QuestManager::depop called with nullptr owner or non-NPC owner. Probably syntax error in quest file");
return;
}
else {
@@ -720,7 +729,7 @@ void QuestManager::depop(int npc_type) {
void QuestManager::depop_withtimer(int npc_type) {
QuestManagerCurrentQuestVars();
if (!owner || !owner->IsNPC()) {
Log(Logs::General, Logs::Quests, "QuestManager::depop_withtimer called with nullptr owner or non-NPC owner. Probably syntax error in quest file.");
LogQuests("QuestManager::depop_withtimer called with nullptr owner or non-NPC owner. Probably syntax error in quest file");
return;
}
else {
@@ -747,7 +756,7 @@ void QuestManager::depopall(int npc_type) {
entity_list.DepopAll(npc_type);
}
else {
Log(Logs::General, Logs::Quests, "QuestManager::depopall called with nullptr owner, non-NPC owner, or invalid NPC Type ID. Probably syntax error in quest file.");
LogQuests("QuestManager::depopall called with nullptr owner, non-NPC owner, or invalid NPC Type ID. Probably syntax error in quest file");
}
}
@@ -756,7 +765,7 @@ void QuestManager::depopzone(bool StartSpawnTimer) {
zone->Depop(StartSpawnTimer);
}
else {
Log(Logs::General, Logs::Quests, "QuestManager::depopzone called with nullptr zone. Probably syntax error in quest file.");
LogQuests("QuestManager::depopzone called with nullptr zone. Probably syntax error in quest file");
}
}
@@ -765,7 +774,7 @@ void QuestManager::repopzone() {
zone->Repop();
}
else {
Log(Logs::General, Logs::Quests, "QuestManager::repopzone called with nullptr zone. Probably syntax error in quest file.");
LogQuests("QuestManager::repopzone called with nullptr zone. Probably syntax error in quest file");
}
}
@@ -1825,7 +1834,7 @@ void QuestManager::showgrid(int grid) {
"ORDER BY `number`", grid, zone->GetZoneID());
auto results = database.QueryDatabase(query);
if (!results.Success()) {
Log(Logs::General, Logs::Quests, "Error loading grid %d for showgrid(): %s", grid, results.ErrorMessage().c_str());
LogQuests("Error loading grid [{}] for showgrid(): [{}]", grid, results.ErrorMessage().c_str());
return;
}
@@ -2978,7 +2987,7 @@ void QuestManager::voicetell(const char *str, int macronum, int racenum, int gen
safe_delete(outapp);
}
else
Log(Logs::General, Logs::Quests, "QuestManager::voicetell from %s. Client %s not found.", owner->GetName(), str);
LogQuests("QuestManager::voicetell from [{}]. Client [{}] not found", owner->GetName(), str);
}
}
+18 -14
View File
@@ -103,7 +103,7 @@ void Raid::AddMember(Client *c, uint32 group, bool rleader, bool groupleader, bo
auto results = database.QueryDatabase(query);
if(!results.Success()) {
Log(Logs::General, Logs::Error, "Error inserting into raid members: %s", results.ErrorMessage().c_str());
LogError("Error inserting into raid members: [{}]", results.ErrorMessage().c_str());
}
LearnMembers();
@@ -266,12 +266,12 @@ void Raid::SetRaidLeader(const char *wasLead, const char *name)
std::string query = StringFormat("UPDATE raid_members SET israidleader = 0 WHERE name = '%s'", wasLead);
auto results = database.QueryDatabase(query);
if (!results.Success())
Log(Logs::General, Logs::Error, "Set Raid Leader error: %s\n", results.ErrorMessage().c_str());
LogError("Set Raid Leader error: [{}]\n", results.ErrorMessage().c_str());
query = StringFormat("UPDATE raid_members SET israidleader = 1 WHERE name = '%s'", name);
results = database.QueryDatabase(query);
if (!results.Success())
Log(Logs::General, Logs::Error, "Set Raid Leader error: %s\n", results.ErrorMessage().c_str());
LogError("Set Raid Leader error: [{}]\n", results.ErrorMessage().c_str());
strn0cpy(leadername, name, 64);
@@ -304,7 +304,7 @@ void Raid::SaveGroupLeaderAA(uint32 gid)
safe_delete_array(queryBuffer);
auto results = database.QueryDatabase(query);
if (!results.Success())
Log(Logs::General, Logs::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str());
LogError("Unable to store LeadershipAA: [{}]\n", results.ErrorMessage().c_str());
}
void Raid::SaveRaidLeaderAA()
@@ -318,7 +318,7 @@ void Raid::SaveRaidLeaderAA()
safe_delete_array(queryBuffer);
auto results = database.QueryDatabase(query);
if (!results.Success())
Log(Logs::General, Logs::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str());
LogError("Unable to store LeadershipAA: [{}]\n", results.ErrorMessage().c_str());
}
void Raid::UpdateGroupAAs(uint32 gid)
@@ -547,7 +547,7 @@ void Raid::CastGroupSpell(Mob* caster, uint16 spellid, uint32 gid)
#endif
}
else{
Log(Logs::Detail, Logs::Spells, "Raid spell: %s is out of range %f at distance %f from %s", members[x].member->GetName(), range, distance, caster->GetName());
LogSpells("Raid spell: [{}] is out of range [{}] at distance [{}] from [{}]", members[x].member->GetName(), range, distance, caster->GetName());
}
}
}
@@ -848,7 +848,7 @@ void Raid::GroupBardPulse(Mob* caster, uint16 spellid, uint32 gid){
members[z].member->GetPet()->BardPulse(spellid, caster);
#endif
} else
Log(Logs::Detail, Logs::Spells, "Group bard pulse: %s is out of range %f at distance %f from %s", members[z].member->GetName(), range, distance, caster->GetName());
LogSpells("Group bard pulse: [{}] is out of range [{}] at distance [{}] from [{}]", members[z].member->GetName(), range, distance, caster->GetName());
}
}
}
@@ -1455,10 +1455,14 @@ void Raid::GetRaidDetails()
if (!results.Success())
return;
if (results.RowCount() == 0) {
Log(Logs::General, Logs::Error, "Error getting raid details for raid %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str());
return;
}
if (results.RowCount() == 0) {
LogError(
"Error getting raid details for raid [{}]: [{}]",
(unsigned long) GetID(),
results.ErrorMessage().c_str()
);
return;
}
auto row = results.begin();
@@ -1488,7 +1492,7 @@ bool Raid::LearnMembers()
return false;
if(results.RowCount() == 0) {
Log(Logs::General, Logs::Error, "Error getting raid members for raid %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str());
LogError("Error getting raid members for raid [{}]: [{}]", (unsigned long)GetID(), results.ErrorMessage().c_str());
disbandCheck = true;
return false;
}
@@ -1750,7 +1754,7 @@ void Raid::SetGroupMentor(uint32 group_id, int percent, char *name)
name, percent, group_id, GetID());
auto results = database.QueryDatabase(query);
if (!results.Success())
Log(Logs::General, Logs::Error, "Unable to set raid group mentor: %s\n", results.ErrorMessage().c_str());
LogError("Unable to set raid group mentor: [{}]\n", results.ErrorMessage().c_str());
}
void Raid::ClearGroupMentor(uint32 group_id)
@@ -1765,7 +1769,7 @@ void Raid::ClearGroupMentor(uint32 group_id)
group_id, GetID());
auto results = database.QueryDatabase(query);
if (!results.Success())
Log(Logs::General, Logs::Error, "Unable to clear raid group mentor: %s\n", results.ErrorMessage().c_str());
LogError("Unable to clear raid group mentor: [{}]\n", results.ErrorMessage().c_str());
}
// there isn't a nice place to add this in another function, unlike groups
+138 -150
View File
@@ -154,17 +154,13 @@ bool Spawn2::Process() {
if (timer.Check()) {
timer.Disable();
Log(Logs::Detail, Logs::Spawns, "Spawn2 %d: Timer has triggered", spawn2_id);
LogSpawns("Spawn2 [{}]: Timer has triggered", spawn2_id);
//first check our spawn condition, if this isnt active
//then we reset the timer and try again next time.
if (condition_id != SC_AlwaysEnabled
&& !zone->spawn_conditions.Check(condition_id, condition_min_value)) {
Log(Logs::Detail,
Logs::Spawns,
"Spawn2 %d: spawning prevented by spawn condition %d",
spawn2_id,
condition_id);
LogSpawns("Spawn2 [{}]: spawning prevented by spawn condition [{}]", spawn2_id, condition_id);
Reset();
return (true);
}
@@ -175,23 +171,21 @@ bool Spawn2::Process() {
}
if (spawn_group == nullptr) {
Log(Logs::Detail,
Logs::Spawns,
"Spawn2 %d: Unable to locate spawn group %d. Disabling.",
spawn2_id,
spawngroup_id_);
LogSpawns("Spawn2 [{}]: Unable to locate spawn group [{}]. Disabling", spawn2_id, spawngroup_id_);
return false;
}
uint16 condition_value=1;
if (condition_id > 0) {
condition_value = zone->spawn_conditions.GetCondition(zone->GetShortName(), zone->GetInstanceID(), condition_id);
}
//have the spawn group pick an NPC for us
uint32 npcid = spawn_group->GetNPCType();
uint32 npcid = spawn_group->GetNPCType(condition_value);
if (npcid == 0) {
Log(Logs::Detail,
Logs::Spawns,
"Spawn2 %d: Spawn group %d did not yeild an NPC! not spawning.",
spawn2_id,
spawngroup_id_);
LogSpawns("Spawn2 [{}]: Spawn group [{}] did not yeild an NPC! not spawning", spawn2_id, spawngroup_id_);
Reset(); //try again later (why?)
return (true);
@@ -200,24 +194,14 @@ bool Spawn2::Process() {
//try to find our NPC type.
const NPCType *tmp = database.LoadNPCTypesData(npcid);
if (tmp == nullptr) {
Log(Logs::Detail,
Logs::Spawns,
"Spawn2 %d: Spawn group %d yeilded an invalid NPC type %d",
spawn2_id,
spawngroup_id_,
npcid);
LogSpawns("Spawn2 [{}]: Spawn group [{}] yeilded an invalid NPC type [{}]", spawn2_id, spawngroup_id_, npcid);
Reset(); //try again later
return (true);
}
if (tmp->unique_spawn_by_name) {
if (!entity_list.LimitCheckName(tmp->name)) {
Log(Logs::Detail,
Logs::Spawns,
"Spawn2 %d: Spawn group %d yeilded NPC type %d, which is unique and one already exists.",
spawn2_id,
spawngroup_id_,
npcid);
LogSpawns("Spawn2 [{}]: Spawn group [{}] yeilded NPC type [{}], which is unique and one already exists", spawn2_id, spawngroup_id_, npcid);
timer.Start(5000); //try again in five seconds.
return (true);
}
@@ -225,13 +209,7 @@ bool Spawn2::Process() {
if (tmp->spawn_limit > 0) {
if (!entity_list.LimitCheckType(npcid, tmp->spawn_limit)) {
Log(Logs::Detail,
Logs::Spawns,
"Spawn2 %d: Spawn group %d yeilded NPC type %d, which is over its spawn limit (%d)",
spawn2_id,
spawngroup_id_,
npcid,
tmp->spawn_limit);
LogSpawns("Spawn2 [{}]: Spawn group [{}] yeilded NPC type [{}], which is over its spawn limit ([{}])", spawn2_id, spawngroup_id_, npcid, tmp->spawn_limit);
timer.Start(5000); //try again in five seconds.
return (true);
}
@@ -287,9 +265,7 @@ bool Spawn2::Process() {
}
if (zone->InstantGrids()) {
Log(Logs::Detail,
Logs::Spawns,
"Spawn2 %d: Group %d spawned %s (%d) at (%.3f, %.3f, %.3f).",
LogSpawns("Spawn2 [{}]: Group [{}] spawned [{}] ([{}]) at ([{}], [{}], [{}])",
spawn2_id,
spawngroup_id_,
npc->GetName(),
@@ -302,16 +278,15 @@ bool Spawn2::Process() {
LoadGrid();
}
else {
Log(Logs::Detail,
Logs::Spawns,
"Spawn2 %d: Group %d spawned %s (%d) at (%.3f, %.3f, %.3f). Grid loading delayed.",
LogSpawns("Spawn2 [{}]: Group [{}] spawned [{}] ([{}]) at ([{}], [{}], [{}]). Grid loading delayed",
spawn2_id,
spawngroup_id_,
tmp->name,
npcid,
x,
y,
z);
z
);
}
}
@@ -337,7 +312,7 @@ void Spawn2::LoadGrid() {
//dont set an NPC's grid until its loaded for them.
npcthis->SetGrid(grid_);
npcthis->AssignWaypoints(grid_);
Log(Logs::Detail, Logs::Spawns, "Spawn2 %d: Loading grid %d for %s", spawn2_id, grid_, npcthis->GetName());
LogSpawns("Spawn2 [{}]: Loading grid [{}] for [{}]", spawn2_id, grid_, npcthis->GetName());
}
/*
@@ -347,21 +322,21 @@ void Spawn2::LoadGrid() {
void Spawn2::Reset() {
timer.Start(resetTimer());
npcthis = nullptr;
Log(Logs::Detail, Logs::Spawns, "Spawn2 %d: Spawn reset, repop in %d ms", spawn2_id, timer.GetRemainingTime());
LogSpawns("Spawn2 [{}]: Spawn reset, repop in [{}] ms", spawn2_id, timer.GetRemainingTime());
}
void Spawn2::Depop() {
timer.Disable();
Log(Logs::Detail, Logs::Spawns, "Spawn2 %d: Spawn reset, repop disabled", spawn2_id);
LogSpawns("Spawn2 [{}]: Spawn reset, repop disabled", spawn2_id);
npcthis = nullptr;
}
void Spawn2::Repop(uint32 delay) {
if (delay == 0) {
timer.Trigger();
Log(Logs::Detail, Logs::Spawns, "Spawn2 %d: Spawn reset, repop immediately.", spawn2_id);
LogSpawns("Spawn2 [{}]: Spawn reset, repop immediately", spawn2_id);
} else {
Log(Logs::Detail, Logs::Spawns, "Spawn2 %d: Spawn reset for repop, repop in %d ms", spawn2_id, delay);
LogSpawns("Spawn2 [{}]: Spawn reset for repop, repop in [{}] ms", spawn2_id, delay);
timer.Start(delay);
}
npcthis = nullptr;
@@ -406,7 +381,7 @@ void Spawn2::ForceDespawn()
cur = despawnTimer(dtimer);
}
Log(Logs::Detail, Logs::Spawns, "Spawn2 %d: Spawn group %d set despawn timer to %d ms.", spawn2_id, spawngroup_id_, cur);
LogSpawns("Spawn2 [{}]: Spawn group [{}] set despawn timer to [{}] ms", spawn2_id, spawngroup_id_, cur);
timer.Start(cur);
}
@@ -427,7 +402,7 @@ void Spawn2::DeathReset(bool realdeath)
if(spawn2_id)
{
database.UpdateRespawnTime(spawn2_id, zone->GetInstanceID(), (cur/1000));
Log(Logs::Detail, Logs::Spawns, "Spawn2 %d: Spawn reset by death, repop in %d ms", spawn2_id, timer.GetRemainingTime());
LogSpawns("Spawn2 [{}]: Spawn reset by death, repop in [{}] ms", spawn2_id, timer.GetRemainingTime());
//store it to database too
}
}
@@ -712,12 +687,12 @@ void Spawn2::SpawnConditionChanged(const SpawnCondition &c, int16 old_value) {
if(GetSpawnCondition() != c.condition_id)
return;
Log(Logs::Detail, Logs::Spawns, "Spawn2 %d: Notified that our spawn condition %d has changed from %d to %d. Our min value is %d.", spawn2_id, c.condition_id, old_value, c.value, condition_min_value);
LogSpawns("Spawn2 [{}]: Notified that our spawn condition [{}] has changed from [{}] to [{}]. Our min value is [{}]", spawn2_id, c.condition_id, old_value, c.value, condition_min_value);
bool old_state = (old_value >= condition_min_value);
bool new_state = (c.value >= condition_min_value);
if(old_state == new_state) {
Log(Logs::Detail, Logs::Spawns, "Spawn2 %d: Our threshold for this condition was not crossed. Doing nothing.", spawn2_id);
LogSpawns("Spawn2 [{}]: Our threshold for this condition was not crossed. Doing nothing", spawn2_id);
return; //no change
}
@@ -725,50 +700,50 @@ void Spawn2::SpawnConditionChanged(const SpawnCondition &c, int16 old_value) {
switch(c.on_change) {
case SpawnCondition::DoNothing:
//that was easy.
Log(Logs::Detail, Logs::Spawns, "Spawn2 %d: Our condition is now %s. Taking no action on existing spawn.", spawn2_id, new_state?"enabled":"disabled");
LogSpawns("Spawn2 [{}]: Our condition is now [{}]. Taking no action on existing spawn", spawn2_id, new_state?"enabled":"disabled");
break;
case SpawnCondition::DoDepop:
Log(Logs::Detail, Logs::Spawns, "Spawn2 %d: Our condition is now %s. Depoping our mob.", spawn2_id, new_state?"enabled":"disabled");
LogSpawns("Spawn2 [{}]: Our condition is now [{}]. Depoping our mob", spawn2_id, new_state?"enabled":"disabled");
if(npcthis != nullptr)
npcthis->Depop(false); //remove the current mob
Reset(); //reset our spawn timer
break;
case SpawnCondition::DoRepop:
Log(Logs::Detail, Logs::Spawns, "Spawn2 %d: Our condition is now %s. Forcing a repop.", spawn2_id, new_state?"enabled":"disabled");
LogSpawns("Spawn2 [{}]: Our condition is now [{}]. Forcing a repop", spawn2_id, new_state?"enabled":"disabled");
if(npcthis != nullptr)
npcthis->Depop(false); //remove the current mob
Repop(); //repop
break;
case SpawnCondition::DoRepopIfReady:
Log(Logs::Detail, Logs::Spawns, "Spawn2 %d: Our condition is now %s. Forcing a repop if repsawn timer is expired.", spawn2_id, new_state?"enabled":"disabled");
LogSpawns("Spawn2 [{}]: Our condition is now [{}]. Forcing a repop if repsawn timer is expired", spawn2_id, new_state?"enabled":"disabled");
if(npcthis != nullptr) {
Log(Logs::Detail, Logs::Spawns, "Spawn2 %d: Our npcthis is currently not null. The zone thinks it is %s. Forcing a depop.", spawn2_id, npcthis->GetName());
LogSpawns("Spawn2 [{}]: Our npcthis is currently not null. The zone thinks it is [{}]. Forcing a depop", spawn2_id, npcthis->GetName());
npcthis->Depop(false); //remove the current mob
npcthis = nullptr;
}
if(new_state) { // only get repawn timer remaining when the SpawnCondition is enabled.
timer_remaining = database.GetSpawnTimeLeft(spawn2_id,zone->GetInstanceID());
Log(Logs::Detail, Logs::Spawns,"Spawn2 %d: Our condition is now %s. The respawn timer_remaining is %d. Forcing a repop if it is <= 0.", spawn2_id, new_state?"enabled":"disabled", timer_remaining);
LogSpawns("Spawn2 [{}]: Our condition is now [{}]. The respawn timer_remaining is [{}]. Forcing a repop if it is <= 0", spawn2_id, new_state?"enabled":"disabled", timer_remaining);
if(timer_remaining <= 0)
Repop();
} else {
Log(Logs::Detail, Logs::Spawns,"Spawn2 %d: Our condition is now %s. Not checking respawn timer.", spawn2_id, new_state?"enabled":"disabled");
LogSpawns("Spawn2 [{}]: Our condition is now [{}]. Not checking respawn timer", spawn2_id, new_state?"enabled":"disabled");
}
break;
default:
if(c.on_change < SpawnCondition::DoSignalMin) {
Log(Logs::Detail, Logs::Spawns, "Spawn2 %d: Our condition is now %s. Invalid on-change action %d.", spawn2_id, new_state?"enabled":"disabled", c.on_change);
LogSpawns("Spawn2 [{}]: Our condition is now [{}]. Invalid on-change action [{}]", spawn2_id, new_state?"enabled":"disabled", c.on_change);
return; //unknown onchange action
}
int signal_id = c.on_change - SpawnCondition::DoSignalMin;
Log(Logs::Detail, Logs::Spawns, "Spawn2 %d: Our condition is now %s. Signaling our mob with %d.", spawn2_id, new_state?"enabled":"disabled", signal_id);
LogSpawns("Spawn2 [{}]: Our condition is now [{}]. Signaling our mob with [{}]", spawn2_id, new_state?"enabled":"disabled", signal_id);
if(npcthis != nullptr)
npcthis->SignalNPC(signal_id);
}
}
void Zone::SpawnConditionChanged(const SpawnCondition &c, int16 old_value) {
Log(Logs::Detail, Logs::Spawns, "Zone notified that spawn condition %d has changed from %d to %d. Notifying all spawn points.", c.condition_id, old_value, c.value);
LogSpawns("Zone notified that spawn condition [{}] has changed from [{}] to [{}]. Notifying all spawn points", c.condition_id, old_value, c.value);
LinkedListIterator<Spawn2*> iterator(spawn2_list);
@@ -838,7 +813,7 @@ void SpawnConditionManager::Process() {
EQTime::AddMinutes(cevent.period, &cevent.next);
std::string t;
EQTime::ToString(&cevent.next, t);
Log(Logs::Detail, Logs::Spawns, "Event %d: Will trigger again in %d EQ minutes at %s.", cevent.id, cevent.period, t.c_str());
LogSpawns("Event [{}]: Will trigger again in [{}] EQ minutes at [{}]", cevent.id, cevent.period, t.c_str());
//save the next event time in the DB
UpdateDBEvent(cevent);
//find the next closest event timer.
@@ -857,7 +832,7 @@ void SpawnConditionManager::ExecEvent(SpawnEvent &event, bool send_update) {
std::map<uint16, SpawnCondition>::iterator condi;
condi = spawn_conditions.find(event.condition_id);
if(condi == spawn_conditions.end()) {
Log(Logs::Detail, Logs::Spawns, "Event %d: Unable to find condition %d to execute on.", event.id, event.condition_id);
LogSpawns("Event [{}]: Unable to find condition [{}] to execute on", event.id, event.condition_id);
return; //unable to find the spawn condition to operate on
}
@@ -865,7 +840,7 @@ void SpawnConditionManager::ExecEvent(SpawnEvent &event, bool send_update) {
zone->zone_time.GetCurrentEQTimeOfDay(&tod);
if(event.strict && (event.next.hour != tod.hour || event.next.day != tod.day || event.next.month != tod.month || event.next.year != tod.year))
{
Log(Logs::Detail, Logs::Spawns, "Event %d: Unable to execute. Condition is strict, and event time has already passed.", event.id);
LogSpawns("Event [{}]: Unable to execute. Condition is strict, and event time has already passed", event.id);
return;
}
@@ -877,26 +852,26 @@ void SpawnConditionManager::ExecEvent(SpawnEvent &event, bool send_update) {
switch(event.action) {
case SpawnEvent::ActionSet:
new_value = event.argument;
Log(Logs::Detail, Logs::Spawns, "Event %d: Executing. Setting condition %d to %d.", event.id, event.condition_id, event.argument);
LogSpawns("Event [{}]: Executing. Setting condition [{}] to [{}]", event.id, event.condition_id, event.argument);
break;
case SpawnEvent::ActionAdd:
new_value += event.argument;
Log(Logs::Detail, Logs::Spawns, "Event %d: Executing. Adding %d to condition %d, yeilding %d.", event.id, event.argument, event.condition_id, new_value);
LogSpawns("Event [{}]: Executing. Adding [{}] to condition [{}], yielding [{}]", event.id, event.argument, event.condition_id, new_value);
break;
case SpawnEvent::ActionSubtract:
new_value -= event.argument;
Log(Logs::Detail, Logs::Spawns, "Event %d: Executing. Subtracting %d from condition %d, yeilding %d.", event.id, event.argument, event.condition_id, new_value);
LogSpawns("Event [{}]: Executing. Subtracting [{}] from condition [{}], yielding [{}]", event.id, event.argument, event.condition_id, new_value);
break;
case SpawnEvent::ActionMultiply:
new_value *= event.argument;
Log(Logs::Detail, Logs::Spawns, "Event %d: Executing. Multiplying condition %d by %d, yeilding %d.", event.id, event.condition_id, event.argument, new_value);
LogSpawns("Event [{}]: Executing. Multiplying condition [{}] by [{}], yielding [{}]", event.id, event.condition_id, event.argument, new_value);
break;
case SpawnEvent::ActionDivide:
new_value /= event.argument;
Log(Logs::Detail, Logs::Spawns, "Event %d: Executing. Dividing condition %d by %d, yeilding %d.", event.id, event.condition_id, event.argument, new_value);
LogSpawns("Event [{}]: Executing. Dividing condition [{}] by [{}], yielding [{}]", event.id, event.condition_id, event.argument, new_value);
break;
default:
Log(Logs::Detail, Logs::Spawns, "Event %d: Invalid event action type %d", event.id, event.action);
LogSpawns("Event [{}]: Invalid event action type [{}]", event.id, event.action);
return;
}
@@ -966,7 +941,7 @@ bool SpawnConditionManager::LoadDBEvent(uint32 event_id, SpawnEvent &event, std:
std::string timeAsString;
EQTime::ToString(&event.next, timeAsString);
Log(Logs::Detail, Logs::Spawns, "(LoadDBEvent) Loaded %s spawn event %d on condition %d with period %d, action %d, argument %d, strict %d. Will trigger at %s", event.enabled? "enabled": "disabled", event.id, event.condition_id, event.period, event.action, event.argument, event.strict, timeAsString.c_str());
LogSpawns("(LoadDBEvent) Loaded [{}] spawn event [{}] on condition [{}] with period [{}], action [{}], argument [{}], strict [{}]. Will trigger at [{}]", event.enabled? "enabled": "disabled", event.id, event.condition_id, event.period, event.action, event.argument, event.strict, timeAsString.c_str());
return true;
}
@@ -993,7 +968,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in
cond.on_change = (SpawnCondition::OnChange) atoi(row[1]);
spawn_conditions[cond.condition_id] = cond;
Log(Logs::Detail, Logs::Spawns, "Loaded spawn condition %d with value %d and on_change %d", cond.condition_id, cond.value, cond.on_change);
LogSpawns("Loaded spawn condition [{}] with value [{}] and on_change [{}]", cond.condition_id, cond.value, cond.on_change);
}
//load values
@@ -1022,33 +997,42 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in
return false;
}
for (auto row = results.begin(); row != results.end(); ++row) {
SpawnEvent event;
for (auto row = results.begin(); row != results.end(); ++row) {
SpawnEvent event;
event.id = atoi(row[0]);
event.condition_id = atoi(row[1]);
event.period = atoi(row[2]);
event.id = atoi(row[0]);
event.condition_id = atoi(row[1]);
event.period = atoi(row[2]);
if(event.period == 0) {
Log(Logs::General, Logs::Error, "Refusing to load spawn event #%d because it has a period of 0\n", event.id);
continue;
}
if (event.period == 0) {
LogError("Refusing to load spawn event #[{}] because it has a period of 0\n", event.id);
continue;
}
event.next.minute = atoi(row[3]);
event.next.hour = atoi(row[4]);
event.next.day = atoi(row[5]);
event.next.month = atoi(row[6]);
event.next.year = atoi(row[7]);
event.next.minute = atoi(row[3]);
event.next.hour = atoi(row[4]);
event.next.day = atoi(row[5]);
event.next.month = atoi(row[6]);
event.next.year = atoi(row[7]);
event.enabled = atoi(row[8])==0?false:true;
event.action = (SpawnEvent::Action) atoi(row[9]);
event.argument = atoi(row[10]);
event.strict = atoi(row[11])==0?false:true;
event.enabled = atoi(row[8]) == 0 ? false : true;
event.action = (SpawnEvent::Action) atoi(row[9]);
event.argument = atoi(row[10]);
event.strict = atoi(row[11]) == 0 ? false : true;
spawn_events.push_back(event);
spawn_events.push_back(event);
Log(Logs::Detail, Logs::Spawns, "(LoadSpawnConditions) Loaded %s spawn event %d on condition %d with period %d, action %d, argument %d, strict %d", event.enabled? "enabled": "disabled", event.id, event.condition_id, event.period, event.action, event.argument, event.strict);
}
LogSpawns(
"(LoadSpawnConditions) Loaded [{}] spawn event [{}] on condition [{}] with period [{}], action [{}], argument [{}], strict [{}]",
event.enabled ? "enabled" : "disabled",
event.id,
event.condition_id,
event.period,
event.action,
event.argument,
event.strict
);
}
//now we need to catch up on events that happened while we were away
//and use them to alter just the condition variables.
@@ -1080,31 +1064,33 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in
if(!cevent.enabled)
continue;
//watch for special case of all 0s, which means to reset next to now
if(cevent.next.year == 0 && cevent.next.month == 0 && cevent.next.day == 0 && cevent.next.hour == 0 && cevent.next.minute == 0) {
Log(Logs::Detail, Logs::Spawns, "Initial next trigger time set for spawn event %d", cevent.id);
memcpy(&cevent.next, &tod, sizeof(cevent.next));
//add one period
EQTime::AddMinutes(cevent.period, &cevent.next);
//save it in the db.
UpdateDBEvent(cevent);
continue; //were done with this event.
}
//watch for special case of all 0s, which means to reset next to now
if (cevent.next.year == 0 && cevent.next.month == 0 && cevent.next.day == 0 && cevent.next.hour == 0 &&
cevent.next.minute == 0) {
LogSpawns("Initial next trigger time set for spawn event [{}]", cevent.id);
memcpy(&cevent.next, &tod, sizeof(cevent.next));
//add one period
EQTime::AddMinutes(cevent.period, &cevent.next);
//save it in the db.
UpdateDBEvent(cevent);
continue; //were done with this event.
}
bool ran = false;
while(EQTime::IsTimeBefore(&tod, &cevent.next)) {
Log(Logs::Detail, Logs::Spawns, "Catch up triggering on event %d", cevent.id);
//this event has been triggered.
//execute the event
if(!cevent.strict || StrictCheck)
ExecEvent(cevent, false);
bool ran = false;
while (EQTime::IsTimeBefore(&tod, &cevent.next)) {
LogSpawns("Catch up triggering on event [{}]", cevent.id);
//this event has been triggered.
//execute the event
if (!cevent.strict || StrictCheck) {
ExecEvent(cevent, false);
}
//add the period of the event to the trigger time
EQTime::AddMinutes(cevent.period, &cevent.next);
ran = true;
}
//add the period of the event to the trigger time
EQTime::AddMinutes(cevent.period, &cevent.next);
ran = true;
}
//only write it out if the event actually ran
//only write it out if the event actually ran
if(ran)
UpdateDBEvent(cevent); //save the event in the DB
}
@@ -1136,10 +1122,10 @@ void SpawnConditionManager::FindNearestEvent() {
}
}
if (next_id == -1) {
Log(Logs::Detail, Logs::Spawns, "No spawn events enabled. Disabling next event.");
LogSpawns("No spawn events enabled. Disabling next event");
}
else {
Log(Logs::Detail, Logs::Spawns, "Next event determined to be event %d", next_id);
LogSpawns("Next event determined to be event [{}]", next_id);
}
}
@@ -1152,14 +1138,14 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance
std::map<uint16, SpawnCondition>::iterator condi;
condi = spawn_conditions.find(condition_id);
if(condi == spawn_conditions.end()) {
Log(Logs::Detail, Logs::Spawns, "Condition update received from world for %d, but we do not have that conditon.", condition_id);
LogSpawns("Condition update received from world for [{}], but we do not have that conditon", condition_id);
return; //unable to find the spawn condition
}
SpawnCondition &cond = condi->second;
if(cond.value == new_value) {
Log(Logs::Detail, Logs::Spawns, "Condition update received from world for %d with value %d, which is what we already have.", condition_id, new_value);
LogSpawns("Condition update received from world for [{}] with value [{}], which is what we already have", condition_id, new_value);
return;
}
@@ -1168,7 +1154,7 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance
//set our local value
cond.value = new_value;
Log(Logs::Detail, Logs::Spawns, "Condition update received from world for %d with value %d", condition_id, new_value);
LogSpawns("Condition update received from world for [{}] with value [{}]", condition_id, new_value);
//now we have to test each spawn point to see if it changed.
zone->SpawnConditionChanged(cond, old_value);
@@ -1179,14 +1165,14 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance
std::map<uint16, SpawnCondition>::iterator condi;
condi = spawn_conditions.find(condition_id);
if(condi == spawn_conditions.end()) {
Log(Logs::Detail, Logs::Spawns, "Local Condition update requested for %d, but we do not have that conditon.", condition_id);
LogSpawns("Local Condition update requested for [{}], but we do not have that conditon", condition_id);
return; //unable to find the spawn condition
}
SpawnCondition &cond = condi->second;
if(cond.value == new_value) {
Log(Logs::Detail, Logs::Spawns, "Local Condition update requested for %d with value %d, which is what we already have.", condition_id, new_value);
LogSpawns("Local Condition update requested for [{}] with value [{}], which is what we already have", condition_id, new_value);
return;
}
@@ -1197,7 +1183,7 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance
//save it in the DB too
UpdateDBCondition(zone_short, instance_id, condition_id, new_value);
Log(Logs::Detail, Logs::Spawns, "Local Condition update requested for %d with value %d", condition_id, new_value);
LogSpawns("Local Condition update requested for [{}] with value [{}]", condition_id, new_value);
//now we have to test each spawn point to see if it changed.
zone->SpawnConditionChanged(cond, old_value);
@@ -1207,7 +1193,7 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance
//this is a remote spawn condition, update the DB and send
//an update packet to the zone if its up
Log(Logs::Detail, Logs::Spawns, "Remote spawn condition %d set to %d. Updating DB and notifying world.", condition_id, new_value);
LogSpawns("Remote spawn condition [{}] set to [{}]. Updating DB and notifying world", condition_id, new_value);
UpdateDBCondition(zone_short, instance_id, condition_id, new_value);
@@ -1227,7 +1213,7 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance
void SpawnConditionManager::ReloadEvent(uint32 event_id) {
std::string zone_short_name;
Log(Logs::Detail, Logs::Spawns, "Requested to reload event %d from the database.", event_id);
LogSpawns("Requested to reload event [{}] from the database", event_id);
//first look for the event in our local event list
std::vector<SpawnEvent>::iterator cur,end;
@@ -1240,7 +1226,7 @@ void SpawnConditionManager::ReloadEvent(uint32 event_id) {
//load the event into the old event slot
if(!LoadDBEvent(event_id, cevent, zone_short_name)) {
//unable to find the event in the database...
Log(Logs::Detail, Logs::Spawns, "Failed to reload event %d from the database.", event_id);
LogSpawns("Failed to reload event [{}] from the database", event_id);
return;
}
//sync up our nearest event
@@ -1253,7 +1239,7 @@ void SpawnConditionManager::ReloadEvent(uint32 event_id) {
SpawnEvent e;
if(!LoadDBEvent(event_id, e, zone_short_name)) {
//unable to find the event in the database...
Log(Logs::Detail, Logs::Spawns, "Failed to reload event %d from the database.", event_id);
LogSpawns("Failed to reload event [{}] from the database", event_id);
return;
}
@@ -1270,7 +1256,7 @@ void SpawnConditionManager::ReloadEvent(uint32 event_id) {
void SpawnConditionManager::ToggleEvent(uint32 event_id, bool enabled, bool strict, bool reset_base) {
Log(Logs::Detail, Logs::Spawns, "Request to %s spawn event %d %sresetting trigger time", enabled?"enable":"disable", event_id, reset_base?"":"without ");
LogSpawns("Request to [{}] spawn event [{}] [{}]resetting trigger time", enabled?"enable":"disable", event_id, reset_base?"":"without ");
//first look for the event in our local event list
std::vector<SpawnEvent>::iterator cur,end;
@@ -1285,13 +1271,13 @@ void SpawnConditionManager::ToggleEvent(uint32 event_id, bool enabled, bool stri
cevent.enabled = enabled;
cevent.strict = strict;
if(reset_base) {
Log(Logs::Detail, Logs::Spawns, "Spawn event %d located in this zone. State set. Trigger time reset (period %d).", event_id, cevent.period);
LogSpawns("Spawn event [{}] located in this zone. State set. Trigger time reset (period [{}])", event_id, cevent.period);
//start with the time now
zone->zone_time.GetCurrentEQTimeOfDay(&cevent.next);
//advance the next time by our period
EQTime::AddMinutes(cevent.period, &cevent.next);
} else {
Log(Logs::Detail, Logs::Spawns, "Spawn event %d located in this zone. State changed.", event_id);
LogSpawns("Spawn event [{}] located in this zone. State changed", event_id);
}
//save the event in the DB
@@ -1300,7 +1286,7 @@ void SpawnConditionManager::ToggleEvent(uint32 event_id, bool enabled, bool stri
//sync up our nearest event
FindNearestEvent();
} else {
Log(Logs::Detail, Logs::Spawns, "Spawn event %d located in this zone but no change was needed.", event_id);
LogSpawns("Spawn event [{}] located in this zone but no change was needed", event_id);
}
//even if we dont change anything, we still found it
return;
@@ -1319,24 +1305,24 @@ void SpawnConditionManager::ToggleEvent(uint32 event_id, bool enabled, bool stri
SpawnEvent e;
std::string zone_short_name;
if(!LoadDBEvent(event_id, e, zone_short_name)) {
Log(Logs::Detail, Logs::Spawns, "Unable to find spawn event %d in the database.", event_id);
LogSpawns("Unable to find spawn event [{}] in the database", event_id);
//unable to find the event in the database...
return;
}
if(e.enabled == enabled && !reset_base) {
Log(Logs::Detail, Logs::Spawns, "Spawn event %d is not located in this zone but no change was needed.", event_id);
LogSpawns("Spawn event [{}] is not located in this zone but no change was needed", event_id);
return; //no changes.
}
e.enabled = enabled;
if(reset_base) {
Log(Logs::Detail, Logs::Spawns, "Spawn event %d is in zone %s. State set. Trigger time reset (period %d). Notifying world.", event_id, zone_short_name.c_str(), e.period);
LogSpawns("Spawn event [{}] is in zone [{}]. State set. Trigger time reset (period [{}]). Notifying world", event_id, zone_short_name.c_str(), e.period);
//start with the time now
zone->zone_time.GetCurrentEQTimeOfDay(&e.next);
//advance the next time by our period
EQTime::AddMinutes(e.period, &e.next);
} else {
Log(Logs::Detail, Logs::Spawns, "Spawn event %d is in zone %s. State changed. Notifying world.", event_id, zone_short_name.c_str(), e.period);
LogSpawns("Spawn event [{}] is in zone [{}]. State changed. Notifying world", event_id, zone_short_name.c_str(), e.period);
}
//save the event in the DB
UpdateDBEvent(e);
@@ -1361,7 +1347,7 @@ int16 SpawnConditionManager::GetCondition(const char *zone_short, uint32 instanc
condi = spawn_conditions.find(condition_id);
if(condi == spawn_conditions.end())
{
Log(Logs::Detail, Logs::Spawns, "Unable to find local condition %d in Get request.", condition_id);
LogSpawns("Unable to find local condition [{}] in Get request", condition_id);
return(0); //unable to find the spawn condition
}
@@ -1370,20 +1356,22 @@ int16 SpawnConditionManager::GetCondition(const char *zone_short, uint32 instanc
}
//this is a remote spawn condition, grab it from the DB
//load spawn conditions
std::string query = StringFormat("SELECT value FROM spawn_condition_values "
"WHERE zone = '%s' AND instance_id = %u AND id = %d",
zone_short, instance_id, condition_id);
auto results = database.QueryDatabase(query);
if (!results.Success()) {
Log(Logs::Detail, Logs::Spawns, "Unable to query remote condition %d from zone %s in Get request.", condition_id, zone_short);
return 0; //dunno a better thing to do...
}
//load spawn conditions
std::string query = StringFormat(
"SELECT value FROM spawn_condition_values "
"WHERE zone = '%s' AND instance_id = %u AND id = %d",
zone_short, instance_id, condition_id
);
auto results = database.QueryDatabase(query);
if (!results.Success()) {
LogSpawns("Unable to query remote condition [{}] from zone [{}] in Get request", condition_id, zone_short);
return 0; //dunno a better thing to do...
}
if (results.RowCount() == 0) {
Log(Logs::Detail, Logs::Spawns, "Unable to load remote condition %d from zone %s in Get request.", condition_id, zone_short);
return 0; //dunno a better thing to do...
}
if (results.RowCount() == 0) {
LogSpawns("Unable to load remote condition [{}] from zone [{}] in Get request", condition_id, zone_short);
return 0; //dunno a better thing to do...
}
auto row = results.begin();
+15 -11
View File
@@ -28,11 +28,12 @@
extern EntityList entity_list;
extern Zone *zone;
SpawnEntry::SpawnEntry(uint32 in_NPCType, int in_chance, uint8 in_npc_spawn_limit)
SpawnEntry::SpawnEntry(uint32 in_NPCType, int in_chance, uint16 in_filter, uint8 in_npc_spawn_limit)
{
NPCType = in_NPCType;
chance = in_chance;
npc_spawn_limit = in_npc_spawn_limit;
NPCType = in_NPCType;
chance = in_chance;
condition_value_filter = in_filter;
npc_spawn_limit = in_npc_spawn_limit;
}
SpawnGroup::SpawnGroup(
@@ -64,11 +65,8 @@ SpawnGroup::SpawnGroup(
despawn_timer = despawn_timer_in;
}
uint32 SpawnGroup::GetNPCType()
uint32 SpawnGroup::GetNPCType(uint16 in_filter)
{
#if EQDEBUG >= 10
Log(Logs::General, Logs::None, "SpawnGroup[%08x]::GetNPCType()", (uint32) this);
#endif
int npcType = 0;
int totalchance = 0;
@@ -87,6 +85,9 @@ uint32 SpawnGroup::GetNPCType()
continue;
}
if (se->condition_value_filter != in_filter)
continue;
totalchance += se->chance;
possible.push_back(se);
}
@@ -94,7 +95,6 @@ uint32 SpawnGroup::GetNPCType()
return 0;
}
int32 roll = 0;
roll = zone->random.Int(0, totalchance - 1);
@@ -242,6 +242,7 @@ bool ZoneDatabase::LoadSpawnGroups(const char *zone_name, uint16 version, SpawnG
spawnentry.spawngroupID,
npcid,
chance,
condition_value_filter,
npc_types.spawn_limit
AS sl
FROM
@@ -266,7 +267,8 @@ bool ZoneDatabase::LoadSpawnGroups(const char *zone_name, uint16 version, SpawnG
auto new_spawn_entry = new SpawnEntry(
atoi(row[1]),
atoi(row[2]),
(row[3] ? atoi(row[3]) : 0)
atoi(row[3]),
(row[4] ? atoi(row[4]) : 0)
);
SpawnGroup *spawn_group = spawn_group_list->GetSpawnGroup(atoi(row[0]));
@@ -342,6 +344,7 @@ bool ZoneDatabase::LoadSpawnGroupsByID(int spawn_group_id, SpawnGroupList *spawn
(spawnentry.spawngroupID),
spawnentry.npcid,
spawnentry.chance,
spawnentry.condition_value_filter,
spawngroup.spawn_limit
FROM
spawnentry,
@@ -362,7 +365,8 @@ bool ZoneDatabase::LoadSpawnGroupsByID(int spawn_group_id, SpawnGroupList *spawn
auto new_spawn_entry = new SpawnEntry(
atoi(row[1]),
atoi(row[2]),
(row[3] ? atoi(row[3]) : 0)
atoi(row[3]),
(row[4] ? atoi(row[4]) : 0)
);
SpawnGroup *spawn_group = spawn_group_list->GetSpawnGroup(atoi(row[0]));
+3 -2
View File
@@ -25,10 +25,11 @@
class SpawnEntry {
public:
SpawnEntry(uint32 in_NPCType, int in_chance, uint8 in_npc_spawn_limit);
SpawnEntry(uint32 in_NPCType, int in_chance, uint16 in_filter, uint8 in_npc_spawn_limit);
~SpawnEntry() {}
uint32 NPCType;
int chance;
uint16 condition_value_filter;
//this is a cached value from npc_types, for speed
uint8 npc_spawn_limit; //max # of this entry which can be spawned in this zone
@@ -52,7 +53,7 @@ public:
);
~SpawnGroup();
uint32 GetNPCType();
uint32 GetNPCType(uint16 condition_value_filter=1);
void AddSpawnEntry(SpawnEntry *newEntry);
uint32 id;
float roamdist;
+26 -28
View File
@@ -631,7 +631,7 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) {
//make sure the attack and ranged timers are up
//if the ranged timer is disabled, then they have no ranged weapon and shouldent be attacking anyhow
if(!CanDoubleAttack && ((attack_timer.Enabled() && !attack_timer.Check(false)) || (ranged_timer.Enabled() && !ranged_timer.Check()))) {
Log(Logs::Detail, Logs::Combat, "Throwing attack canceled. Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime());
LogCombat("Throwing attack canceled. Timer not up. Attack [{}], ranged [{}]", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime());
// The server and client timers are not exact matches currently, so this would spam too often if enabled
//Message(0, "Error: Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime());
return;
@@ -643,12 +643,12 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) {
const EQEmu::ItemInstance* Ammo = m_inv[EQEmu::invslot::slotAmmo];
if (!RangeWeapon || !RangeWeapon->IsClassCommon()) {
Log(Logs::Detail, Logs::Combat, "Ranged attack canceled. Missing or invalid ranged weapon (%d) in slot %d", GetItemIDAt(EQEmu::invslot::slotRange), EQEmu::invslot::slotRange);
LogCombat("Ranged attack canceled. Missing or invalid ranged weapon ([{}]) in slot [{}]", GetItemIDAt(EQEmu::invslot::slotRange), EQEmu::invslot::slotRange);
Message(0, "Error: Rangeweapon: GetItem(%i)==0, you have no bow!", GetItemIDAt(EQEmu::invslot::slotRange));
return;
}
if (!Ammo || !Ammo->IsClassCommon()) {
Log(Logs::Detail, Logs::Combat, "Ranged attack canceled. Missing or invalid ammo item (%d) in slot %d", GetItemIDAt(EQEmu::invslot::slotAmmo), EQEmu::invslot::slotAmmo);
LogCombat("Ranged attack canceled. Missing or invalid ammo item ([{}]) in slot [{}]", GetItemIDAt(EQEmu::invslot::slotAmmo), EQEmu::invslot::slotAmmo);
Message(0, "Error: Ammo: GetItem(%i)==0, you have no ammo!", GetItemIDAt(EQEmu::invslot::slotAmmo));
return;
}
@@ -657,17 +657,17 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) {
const EQEmu::ItemData* AmmoItem = Ammo->GetItem();
if (RangeItem->ItemType != EQEmu::item::ItemTypeBow) {
Log(Logs::Detail, Logs::Combat, "Ranged attack canceled. Ranged item is not a bow. type %d.", RangeItem->ItemType);
LogCombat("Ranged attack canceled. Ranged item is not a bow. type [{}]", RangeItem->ItemType);
Message(0, "Error: Rangeweapon: Item %d is not a bow.", RangeWeapon->GetID());
return;
}
if (AmmoItem->ItemType != EQEmu::item::ItemTypeArrow) {
Log(Logs::Detail, Logs::Combat, "Ranged attack canceled. Ammo item is not an arrow. type %d.", AmmoItem->ItemType);
LogCombat("Ranged attack canceled. Ammo item is not an arrow. type [{}]", AmmoItem->ItemType);
Message(0, "Error: Ammo: type %d != %d, you have the wrong type of ammo!", AmmoItem->ItemType, EQEmu::item::ItemTypeArrow);
return;
}
Log(Logs::Detail, Logs::Combat, "Shooting %s with bow %s (%d) and arrow %s (%d)", other->GetName(), RangeItem->Name, RangeItem->ID, AmmoItem->Name, AmmoItem->ID);
LogCombat("Shooting [{}] with bow [{}] ([{}]) and arrow [{}] ([{}])", other->GetName(), RangeItem->Name, RangeItem->ID, AmmoItem->Name, AmmoItem->ID);
//look for ammo in inventory if we only have 1 left...
if(Ammo->GetCharges() == 1) {
@@ -694,7 +694,7 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) {
Ammo = baginst;
ammo_slot = m_inv.CalcSlotId(r, i);
found = true;
Log(Logs::Detail, Logs::Combat, "Using ammo from quiver stack at slot %d. %d in stack.", ammo_slot, Ammo->GetCharges());
LogCombat("Using ammo from quiver stack at slot [{}]. [{}] in stack", ammo_slot, Ammo->GetCharges());
break;
}
}
@@ -709,17 +709,17 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) {
if (aslot != INVALID_INDEX) {
ammo_slot = aslot;
Ammo = m_inv[aslot];
Log(Logs::Detail, Logs::Combat, "Using ammo from inventory stack at slot %d. %d in stack.", ammo_slot, Ammo->GetCharges());
LogCombat("Using ammo from inventory stack at slot [{}]. [{}] in stack", ammo_slot, Ammo->GetCharges());
}
}
}
float range = RangeItem->Range + AmmoItem->Range + GetRangeDistTargetSizeMod(GetTarget());
Log(Logs::Detail, Logs::Combat, "Calculated bow range to be %.1f", range);
LogCombat("Calculated bow range to be [{}]", range);
range *= range;
float dist = DistanceSquared(m_Position, other->GetPosition());
if(dist > range) {
Log(Logs::Detail, Logs::Combat, "Ranged attack out of range... client should catch this. (%f > %f).\n", dist, range);
LogCombat("Ranged attack out of range client should catch this. ([{}] > [{}]).\n", dist, range);
MessageString(Chat::Red,TARGET_OUT_OF_RANGE);//Client enforces range and sends the message, this is a backup just incase.
return;
}
@@ -747,9 +747,9 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) {
if (RangeItem->ExpendableArrow || !ChanceAvoidConsume || (ChanceAvoidConsume < 100 && zone->random.Int(0,99) > ChanceAvoidConsume)){
DeleteItemInInventory(ammo_slot, 1, true);
Log(Logs::Detail, Logs::Combat, "Consumed one arrow from slot %d", ammo_slot);
LogCombat("Consumed one arrow from slot [{}]", ammo_slot);
} else {
Log(Logs::Detail, Logs::Combat, "Endless Quiver prevented ammo consumption.");
LogCombat("Endless Quiver prevented ammo consumption");
}
CheckIncreaseSkill(EQEmu::skills::SkillArchery, GetTarget(), -15);
@@ -808,7 +808,7 @@ void Mob::DoArcheryAttackDmg(Mob *other, const EQEmu::ItemInstance *RangeWeapon,
SendItemAnimation(other, AmmoItem, EQEmu::skills::SkillArchery);
}
Log(Logs::Detail, Logs::Combat, "Ranged attack hit %s.", other->GetName());
LogCombat("Ranged attack hit [{}]", other->GetName());
uint32 hate = 0;
int TotalDmg = 0;
@@ -840,12 +840,10 @@ void Mob::DoArcheryAttackDmg(Mob *other, const EQEmu::ItemInstance *RangeWeapon,
hate = ((WDmg + ADmg));
if (RuleB(Combat, ProjectileDmgOnImpact)) {
Log(Logs::Detail, Logs::Combat, "Bow and Arrow DMG %d, Max Damage %d.", WDmg,
MaxDmg);
LogCombat("Bow and Arrow DMG [{}], Max Damage [{}]", WDmg, MaxDmg);
}
else {
Log(Logs::Detail, Logs::Combat, "Bow DMG %d, Arrow DMG %d, Max Damage %d.", WDmg,
ADmg, MaxDmg);
LogCombat("Bow DMG [{}], Arrow DMG [{}], Max Damage [{}]", WDmg, ADmg, MaxDmg);
}
if (MaxDmg == 0)
@@ -1087,7 +1085,7 @@ void NPC::RangedAttack(Mob* other)
//make sure the attack and ranged timers are up
//if the ranged timer is disabled, then they have no ranged weapon and shouldent be attacking anyhow
if((attack_timer.Enabled() && !attack_timer.Check(false)) || (ranged_timer.Enabled() && !ranged_timer.Check())){
Log(Logs::Detail, Logs::Combat, "Archery canceled. Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime());
LogCombat("Archery canceled. Timer not up. Attack [{}], ranged [{}]", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime());
return;
}
@@ -1223,7 +1221,7 @@ void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51
//make sure the attack and ranged timers are up
//if the ranged timer is disabled, then they have no ranged weapon and shouldent be attacking anyhow
if((!CanDoubleAttack && (attack_timer.Enabled() && !attack_timer.Check(false)) || (ranged_timer.Enabled() && !ranged_timer.Check()))) {
Log(Logs::Detail, Logs::Combat, "Throwing attack canceled. Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime());
LogCombat("Throwing attack canceled. Timer not up. Attack [{}], ranged [{}]", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime());
// The server and client timers are not exact matches currently, so this would spam too often if enabled
//Message(0, "Error: Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime());
return;
@@ -1233,19 +1231,19 @@ void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51
const EQEmu::ItemInstance* RangeWeapon = m_inv[EQEmu::invslot::slotRange];
if (!RangeWeapon || !RangeWeapon->IsClassCommon()) {
Log(Logs::Detail, Logs::Combat, "Ranged attack canceled. Missing or invalid ranged weapon (%d) in slot %d", GetItemIDAt(EQEmu::invslot::slotRange), EQEmu::invslot::slotRange);
LogCombat("Ranged attack canceled. Missing or invalid ranged weapon ([{}]) in slot [{}]", GetItemIDAt(EQEmu::invslot::slotRange), EQEmu::invslot::slotRange);
Message(0, "Error: Rangeweapon: GetItem(%i)==0, you have nothing to throw!", GetItemIDAt(EQEmu::invslot::slotRange));
return;
}
const EQEmu::ItemData* item = RangeWeapon->GetItem();
if (item->ItemType != EQEmu::item::ItemTypeLargeThrowing && item->ItemType != EQEmu::item::ItemTypeSmallThrowing) {
Log(Logs::Detail, Logs::Combat, "Ranged attack canceled. Ranged item %d is not a throwing weapon. type %d.", item->ItemType);
LogCombat("Ranged attack canceled. Ranged item [{}] is not a throwing weapon. type [{}]", item->ItemType);
Message(0, "Error: Rangeweapon: GetItem(%i)==0, you have nothing useful to throw!", GetItemIDAt(EQEmu::invslot::slotRange));
return;
}
Log(Logs::Detail, Logs::Combat, "Throwing %s (%d) at %s", item->Name, item->ID, other->GetName());
LogCombat("Throwing [{}] ([{}]) at [{}]", item->Name, item->ID, other->GetName());
if(RangeWeapon->GetCharges() == 1) {
//first check ammo
@@ -1254,7 +1252,7 @@ void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51
//more in the ammo slot, use it
RangeWeapon = AmmoItem;
ammo_slot = EQEmu::invslot::slotAmmo;
Log(Logs::Detail, Logs::Combat, "Using ammo from ammo slot, stack at slot %d. %d in stack.", ammo_slot, RangeWeapon->GetCharges());
LogCombat("Using ammo from ammo slot, stack at slot [{}]. [{}] in stack", ammo_slot, RangeWeapon->GetCharges());
} else {
//look through our inventory for more
int32 aslot = m_inv.HasItem(item->ID, 1, invWherePersonal);
@@ -1262,17 +1260,17 @@ void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51
//the item wont change, but the instance does, not that it matters
ammo_slot = aslot;
RangeWeapon = m_inv[aslot];
Log(Logs::Detail, Logs::Combat, "Using ammo from inventory slot, stack at slot %d. %d in stack.", ammo_slot, RangeWeapon->GetCharges());
LogCombat("Using ammo from inventory slot, stack at slot [{}]. [{}] in stack", ammo_slot, RangeWeapon->GetCharges());
}
}
}
float range = item->Range + GetRangeDistTargetSizeMod(other);
Log(Logs::Detail, Logs::Combat, "Calculated bow range to be %.1f", range);
LogCombat("Calculated bow range to be [{}]", range);
range *= range;
float dist = DistanceSquared(m_Position, other->GetPosition());
if(dist > range) {
Log(Logs::Detail, Logs::Combat, "Throwing attack out of range... client should catch this. (%f > %f).\n", dist, range);
LogCombat("Throwing attack out of range client should catch this. ([{}] > [{}]).\n", dist, range);
MessageString(Chat::Red,TARGET_OUT_OF_RANGE);//Client enforces range and sends the message, this is a backup just incase.
return;
}
@@ -1339,7 +1337,7 @@ void Mob::DoThrowingAttackDmg(Mob *other, const EQEmu::ItemInstance *RangeWeapon
SendItemAnimation(other, AmmoItem, EQEmu::skills::SkillThrowing);
}
Log(Logs::Detail, Logs::Combat, "Throwing attack hit %s.", other->GetName());
LogCombat("Throwing attack hit [{}]", other->GetName());
int WDmg = 0;
@@ -1377,7 +1375,7 @@ void Mob::DoThrowingAttackDmg(Mob *other, const EQEmu::ItemInstance *RangeWeapon
DoAttack(other, my_hit);
TotalDmg = my_hit.damage_done;
Log(Logs::Detail, Logs::Combat, "Item DMG %d. Hit for damage %d", WDmg, TotalDmg);
LogCombat("Item DMG [{}]. Hit for damage [{}]", WDmg, TotalDmg);
} else {
TotalDmg = DMG_INVULNERABLE;
}
+15 -15
View File
@@ -489,7 +489,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
if(!target_zone) {
#ifdef SPELL_EFFECT_SPAM
Log(Logs::General, Logs::None, "Succor/Evacuation Spell In Same Zone.");
LogDebug("Succor/Evacuation Spell In Same Zone");
#endif
if(IsClient())
CastToClient()->MovePC(zone->GetZoneID(), zone->GetInstanceID(), x, y, z, heading, 0, EvacToSafeCoords);
@@ -498,7 +498,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
}
else {
#ifdef SPELL_EFFECT_SPAM
Log(Logs::General, Logs::None, "Succor/Evacuation Spell To Another Zone.");
LogDebug("Succor/Evacuation Spell To Another Zone");
#endif
if(IsClient())
CastToClient()->MovePC(target_zone, x, y, z, heading);
@@ -710,7 +710,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
stun_resist += aabonuses.StunResist;
if (stun_resist <= 0 || zone->random.Int(0,99) >= stun_resist) {
Log(Logs::Detail, Logs::Combat, "Stunned. We had %d percent resist chance.", stun_resist);
LogCombat("Stunned. We had [{}] percent resist chance", stun_resist);
if (caster && caster->IsClient())
effect_value += effect_value*caster->GetFocusEffect(focusFcStunTimeMod, spell_id)/100;
@@ -720,7 +720,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
if (IsClient())
MessageString(Chat::Stun, SHAKE_OFF_STUN);
Log(Logs::Detail, Logs::Combat, "Stun Resisted. We had %d percent resist chance.", stun_resist);
LogCombat("Stun Resisted. We had [{}] percent resist chance", stun_resist);
}
}
break;
@@ -1678,7 +1678,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
if (IsCorpse() && CastToCorpse()->IsPlayerCorpse()) {
if(caster)
Log(Logs::Detail, Logs::Spells, " corpse being rezzed using spell %i by %s",
LogSpells(" corpse being rezzed using spell [{}] by [{}]",
spell_id, caster->GetName());
CastToCorpse()->CastRezz(spell_id, caster);
@@ -1810,7 +1810,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
}
else {
MessageString(Chat::LightBlue, TARGET_NOT_FOUND);
Log(Logs::General, Logs::Error, "%s attempted to cast spell id %u with spell effect SE_SummonCorpse, but could not cast target into a Client object.", GetCleanName(), spell_id);
LogError("[{}] attempted to cast spell id [{}] with spell effect SE_SummonCorpse, but could not cast target into a Client object", GetCleanName(), spell_id);
}
}
@@ -3060,7 +3060,7 @@ int Mob::CalcSpellEffectValue(uint16 spell_id, int effect_id, int caster_level,
int oval = effect_value;
int mod = ApplySpellEffectiveness(spell_id, instrument_mod, true, caster_id);
effect_value = effect_value * mod / 10;
Log(Logs::Detail, Logs::Spells, "Effect value %d altered with bard modifier of %d to yeild %d",
LogSpells("Effect value [{}] altered with bard modifier of [{}] to yeild [{}]",
oval, mod, effect_value);
}
@@ -3123,7 +3123,7 @@ snare has both of them negative, yet their range should work the same:
updownsign = 1;
}
Log(Logs::Detail, Logs::Spells, "CSEV: spell %d, formula %d, base %d, max %d, lvl %d. Up/Down %d",
LogSpells("CSEV: spell [{}], formula [{}], base [{}], max [{}], lvl [{}]. Up/Down [{}]",
spell_id, formula, base, max, caster_level, updownsign);
switch(formula)
@@ -3345,7 +3345,7 @@ snare has both of them negative, yet their range should work the same:
result = ubase * (caster_level * (formula - 2000) + 1);
}
else
Log(Logs::General, Logs::None, "Unknown spell effect value forumula %d", formula);
LogDebug("Unknown spell effect value forumula [{}]", formula);
}
}
@@ -3370,7 +3370,7 @@ snare has both of them negative, yet their range should work the same:
if (base < 0 && result > 0)
result *= -1;
Log(Logs::Detail, Logs::Spells, "Result: %d (orig %d), cap %d %s", result, oresult, max, (base < 0 && result > 0)?"Inverted due to negative base":"");
LogSpells("Result: [{}] (orig [{}]), cap [{}] [{}]", result, oresult, max, (base < 0 && result > 0)?"Inverted due to negative base":"");
return result;
}
@@ -3397,12 +3397,12 @@ void Mob::BuffProcess()
--buffs[buffs_i].ticsremaining;
if (buffs[buffs_i].ticsremaining < 0) {
Log(Logs::Detail, Logs::Spells, "Buff %d in slot %d has expired. Fading.", buffs[buffs_i].spellid, buffs_i);
LogSpells("Buff [{}] in slot [{}] has expired. Fading", buffs[buffs_i].spellid, buffs_i);
BuffFadeBySlot(buffs_i);
}
else
{
Log(Logs::Detail, Logs::Spells, "Buff %d in slot %d has %d tics remaining.", buffs[buffs_i].spellid, buffs_i, buffs[buffs_i].ticsremaining);
LogSpells("Buff [{}] in slot [{}] has [{}] tics remaining", buffs[buffs_i].spellid, buffs_i, buffs[buffs_i].ticsremaining);
}
}
else if (IsClient() && !(CastToClient()->ClientVersionBit() & EQEmu::versions::maskSoFAndLater))
@@ -3733,7 +3733,7 @@ void Mob::BuffFadeBySlot(int slot, bool iRecalcBonuses)
if (IsClient() && !CastToClient()->IsDead())
CastToClient()->MakeBuffFadePacket(buffs[slot].spellid, slot);
Log(Logs::Detail, Logs::Spells, "Fading buff %d from slot %d", buffs[slot].spellid, slot);
LogSpells("Fading buff [{}] from slot [{}]", buffs[slot].spellid, slot);
if(spells[buffs[slot].spellid].viral_targets > 0) {
bool last_virus = true;
@@ -4712,7 +4712,7 @@ int16 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo
return 0;
break;
default:
Log(Logs::General, Logs::Normal, "CalcFocusEffect: unknown limit spelltype %d",
LogInfo("CalcFocusEffect: unknown limit spelltype [{}]",
focus_spell.base[i]);
}
break;
@@ -5090,7 +5090,7 @@ int16 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo
// this spits up a lot of garbage when calculating spell focuses
// since they have all kinds of extra effects on them.
default:
Log(Logs::General, Logs::Normal, "CalcFocusEffect: unknown effectid %d",
LogInfo("CalcFocusEffect: unknown effectid [{}]",
focus_spell.effectid[i]);
#endif
}
+241 -205
View File
File diff suppressed because it is too large Load Diff
+45 -58
View File
@@ -54,31 +54,34 @@ TaskManager::~TaskManager() {
}
}
bool TaskManager::LoadTaskSets() {
bool TaskManager::LoadTaskSets()
{
// Clear all task sets in memory. Done so we can reload them on the fly if required by just calling
// this method again.
for(int i=0; i<MAXTASKSETS; i++)
for (int i = 0; i < MAXTASKSETS; i++)
TaskSets[i].clear();
std::string query = StringFormat("SELECT `id`, `taskid` from `tasksets` "
"WHERE `id` > 0 AND `id` < %i "
"AND `taskid` >= 0 AND `taskid` < %i "
"ORDER BY `id`, `taskid` ASC",
MAXTASKSETS, MAXTASKS);
auto results = database.QueryDatabase(query);
if (!results.Success()) {
Log(Logs::General, Logs::Error, "[TASKS]Error in TaskManager::LoadTaskSets: %s", results.ErrorMessage().c_str());
std::string query = StringFormat(
"SELECT `id`, `taskid` from `tasksets` "
"WHERE `id` > 0 AND `id` < %i "
"AND `taskid` >= 0 AND `taskid` < %i "
"ORDER BY `id`, `taskid` ASC",
MAXTASKSETS, MAXTASKS
);
auto results = database.QueryDatabase(query);
if (!results.Success()) {
LogError("Error in TaskManager::LoadTaskSets: [{}]", results.ErrorMessage().c_str());
return false;
}
}
for (auto row = results.begin(); row != results.end(); ++row) {
int taskSet = atoi(row[0]);
int taskID = atoi(row[1]);
int taskSet = atoi(row[0]);
int taskID = atoi(row[1]);
TaskSets[taskSet].push_back(taskID);
Log(Logs::General, Logs::Tasks, "[GLOBALLOAD] Adding TaskID %4i to TaskSet %4i", taskID, taskSet);
}
TaskSets[taskSet].push_back(taskID);
Log(Logs::General, Logs::Tasks, "[GLOBALLOAD] Adding TaskID %4i to TaskSet %4i", taskID, taskSet);
}
return true;
}
@@ -130,7 +133,7 @@ bool TaskManager::LoadTasks(int singleTask)
auto results = database.QueryDatabase(query);
if (!results.Success()) {
Log(Logs::General, Logs::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str());
LogError(ERR_MYSQLERROR, results.ErrorMessage().c_str());
return false;
}
@@ -139,8 +142,7 @@ bool TaskManager::LoadTasks(int singleTask)
if ((taskID <= 0) || (taskID >= MAXTASKS)) {
// This shouldn't happen, as the SELECT is bounded by MAXTASKS
Log(Logs::General, Logs::Error,
"[TASKS]Task ID %i out of range while loading tasks from database", taskID);
LogError("[TASKS]Task ID [{}] out of range while loading tasks from database", taskID);
continue;
}
@@ -188,7 +190,7 @@ bool TaskManager::LoadTasks(int singleTask)
singleTask, MAXACTIVITIESPERTASK);
results = database.QueryDatabase(query);
if (!results.Success()) {
Log(Logs::General, Logs::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str());
LogError(ERR_MYSQLERROR, results.ErrorMessage().c_str());
return false;
}
@@ -200,16 +202,12 @@ bool TaskManager::LoadTasks(int singleTask)
if ((taskID <= 0) || (taskID >= MAXTASKS) || (activityID < 0) || (activityID >= MAXACTIVITIESPERTASK)) {
// This shouldn't happen, as the SELECT is bounded by MAXTASKS
Log(Logs::General, Logs::Error,
"[TASKS]Task or Activity ID (%i, %i) out of range while loading "
"activities from database",
taskID, activityID);
LogError("[TASKS]Task or Activity ID ([{}], [{}]) out of range while loading activities from database", taskID, activityID);
continue;
}
if (Tasks[taskID] == nullptr) {
Log(Logs::General, Logs::Error,
"[TASKS]Activity for non-existent task (%i, %i) while loading activities from database",
LogError("[TASKS]Activity for non-existent task ([{}], [{}]) while loading activities from database",
taskID, activityID);
continue;
}
@@ -227,8 +225,7 @@ bool TaskManager::LoadTasks(int singleTask)
// ERR_NOTASK errors.
// Change to (activityID != (Tasks[taskID]->ActivityCount + 1)) to index from 1
if (activityID != Tasks[taskID]->ActivityCount) {
Log(Logs::General, Logs::Error,
"[TASKS]Activities for Task %i are not sequential starting at 0. Not loading task.", taskID,
LogError("[TASKS]Activities for Task [{}] are not sequential starting at 0. Not loading task", taskID,
activityID);
Tasks[taskID] = nullptr;
continue;
@@ -318,7 +315,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state)
state->ActiveTasks[task].AcceptedTime);
auto results = database.QueryDatabase(query);
if (!results.Success()) {
Log(Logs::General, Logs::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str());
LogError(ERR_MYSQLERROR, results.ErrorMessage().c_str());
} else {
state->ActiveTasks[task].Updated = false;
}
@@ -362,7 +359,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state)
auto results = database.QueryDatabase(query);
if (!results.Success()) {
Log(Logs::General, Logs::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str());
LogError(ERR_MYSQLERROR, results.ErrorMessage().c_str());
continue;
}
@@ -398,7 +395,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state)
StringFormat(completedTaskQuery, characterID, state->CompletedTasks[i].CompletedTime, taskID, -1);
auto results = database.QueryDatabase(query);
if (!results.Success()) {
Log(Logs::General, Logs::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str());
LogError(ERR_MYSQLERROR, results.ErrorMessage().c_str());
continue;
}
@@ -416,7 +413,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state)
taskID, j);
results = database.QueryDatabase(query);
if (!results.Success())
Log(Logs::General, Logs::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str());
LogError(ERR_MYSQLERROR, results.ErrorMessage().c_str());
}
}
@@ -467,7 +464,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state)
characterID);
auto results = database.QueryDatabase(query);
if (!results.Success()) {
Log(Logs::General, Logs::Error, "[TASKS]Error in TaskManager::LoadClientState load Tasks: %s",
LogError("[TASKS]Error in TaskManager::LoadClientState load Tasks: [{}]",
results.ErrorMessage().c_str());
return false;
}
@@ -478,21 +475,19 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state)
TaskType type = static_cast<TaskType>(atoi(row[2]));
if ((taskID < 0) || (taskID >= MAXTASKS)) {
Log(Logs::General, Logs::Error,
"[TASKS]Task ID %i out of range while loading character tasks from database", taskID);
LogError("[TASKS]Task ID [{}] out of range while loading character tasks from database", taskID);
continue;
}
auto task_info = state->GetClientTaskInfo(type, slot);
if (task_info == nullptr) {
Log(Logs::General, Logs::Error,
"[TASKS] Slot %i out of range while loading character tasks from database", slot);
LogError("[TASKS] Slot [{}] out of range while loading character tasks from database", slot);
continue;
}
if (task_info->TaskID != TASKSLOTEMPTY) {
Log(Logs::General, Logs::Error, "[TASKS] Slot %i for Task %is is already occupied.", slot,
LogError("[TASKS] Slot [{}] for Task [{}]s is already occupied", slot,
taskID);
continue;
}
@@ -526,7 +521,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state)
characterID);
results = database.QueryDatabase(query);
if (!results.Success()) {
Log(Logs::General, Logs::Error, "[TASKS]Error in TaskManager::LoadClientState load Activities: %s",
LogError("[TASKS]Error in TaskManager::LoadClientState load Activities: [{}]",
results.ErrorMessage().c_str());
return false;
}
@@ -534,15 +529,13 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state)
for (auto row = results.begin(); row != results.end(); ++row) {
int taskID = atoi(row[0]);
if ((taskID < 0) || (taskID >= MAXTASKS)) {
Log(Logs::General, Logs::Error,
"[TASKS]Task ID %i out of range while loading character activities from database", taskID);
LogError("[TASKS]Task ID [{}] out of range while loading character activities from database", taskID);
continue;
}
int activityID = atoi(row[1]);
if ((activityID < 0) || (activityID >= MAXACTIVITIESPERTASK)) {
Log(Logs::General, Logs::Error,
"[TASKS]Activity ID %i out of range while loading character activities from database",
LogError("[TASKS]Activity ID [{}] out of range while loading character activities from database",
activityID);
continue;
}
@@ -559,8 +552,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state)
task_info = &state->ActiveQuests[i];
if (task_info == nullptr) {
Log(Logs::General, Logs::Error,
"[TASKS]Activity %i found for task %i which client does not have.", activityID, taskID);
LogError("[TASKS]Activity [{}] found for task [{}] which client does not have", activityID, taskID);
continue;
}
@@ -588,8 +580,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state)
characterID);
results = database.QueryDatabase(query);
if (!results.Success()) {
Log(Logs::General, Logs::Error,
"[TASKS]Error in TaskManager::LoadClientState load completed tasks: %s",
LogError("[TASKS]Error in TaskManager::LoadClientState load completed tasks: [{}]",
results.ErrorMessage().c_str());
return false;
}
@@ -606,8 +597,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state)
int taskID = atoi(row[0]);
if ((taskID <= 0) || (taskID >= MAXTASKS)) {
Log(Logs::General, Logs::Error,
"[TASKS]Task ID %i out of range while loading completed tasks from database",
LogError("[TASKS]Task ID [{}] out of range while loading completed tasks from database",
taskID);
continue;
}
@@ -618,8 +608,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state)
// completed.
int activityID = atoi(row[1]);
if ((activityID < -1) || (activityID >= MAXACTIVITIESPERTASK)) {
Log(Logs::General, Logs::Error,
"[TASKS]Activity ID %i out of range while loading completed tasks from database",
LogError("[TASKS]Activity ID [{}] out of range while loading completed tasks from database",
activityID);
continue;
}
@@ -660,7 +649,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state)
characterID, MAXTASKS);
results = database.QueryDatabase(query);
if (!results.Success()) {
Log(Logs::General, Logs::Error, "[TASKS]Error in TaskManager::LoadClientState load enabled tasks: %s",
LogError("[TASKS]Error in TaskManager::LoadClientState load enabled tasks: [{}]",
results.ErrorMessage().c_str());
} else {
for (auto row = results.begin(); row != results.end(); ++row) {
@@ -683,7 +672,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state)
"Removing from memory. Contact a GM to resolve this.",
i, taskID);
Log(Logs::General, Logs::Error, "[TASKS]Character %i has task %i which does not exist.",
LogError("[TASKS]Character [{}] has task [{}] which does not exist",
characterID, taskID);
state->ActiveTasks[i].TaskID = TASKSLOTEMPTY;
continue;
@@ -696,9 +685,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state)
"Removing from memory. Contact a GM to resolve this.",
taskID, Tasks[taskID]->Title.c_str());
Log(Logs::General, Logs::Error,
"[TASKS]Fatal error in character %i task state. Activity %i for "
"Task %i either missing from client state or from task.",
LogError("[TASKS]Fatal error in character [{}] task state. Activity [{}] for Task [{}] either missing from client state or from task",
characterID, j, taskID);
state->ActiveTasks[i].TaskID = TASKSLOTEMPTY;
break;
@@ -3171,7 +3158,7 @@ void ClientTaskState::RemoveTask(Client *c, int sequenceNumber, TaskType type)
characterID, task_id);
auto results = database.QueryDatabase(query);
if (!results.Success()) {
Log(Logs::General, Logs::Error, "[TASKS] Error in CientTaskState::CancelTask %s",
LogError("[TASKS] Error in CientTaskState::CancelTask [{}]",
results.ErrorMessage().c_str());
return;
}
@@ -3181,7 +3168,7 @@ void ClientTaskState::RemoveTask(Client *c, int sequenceNumber, TaskType type)
task_id, static_cast<int>(type));
results = database.QueryDatabase(query);
if (!results.Success())
Log(Logs::General, Logs::Error, "[TASKS] Error in CientTaskState::CancelTask %s",
LogError("[TASKS] Error in CientTaskState::CancelTask [{}]",
results.ErrorMessage().c_str());
Log(Logs::General, Logs::Tasks, "[UPDATE] CancelTask: %s", query.c_str());
+1 -1
View File
@@ -349,7 +349,7 @@ void Client::EnableTitle(int titleSet) {
CharacterID(), titleSet);
auto results = database.QueryDatabase(query);
if(!results.Success())
Log(Logs::General, Logs::Error, "Error in EnableTitle query for titleset %i and charid %i", titleSet, CharacterID());
LogError("Error in EnableTitle query for titleset [{}] and charid [{}]", titleSet, CharacterID());
}
+54 -45
View File
@@ -42,7 +42,7 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme
{
if (!user || !in_augment)
{
Log(Logs::General, Logs::Error, "Client or AugmentItem_Struct not set in Object::HandleAugmentation");
LogError("Client or AugmentItem_Struct not set in Object::HandleAugmentation");
return;
}
@@ -89,7 +89,7 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme
if(!container)
{
Log(Logs::General, Logs::Error, "Player tried to augment an item without a container set.");
LogError("Player tried to augment an item without a container set");
user->Message(Chat::Red, "Error: This item is not a container!");
return;
}
@@ -169,7 +169,7 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme
bool isSolvent = auged_with->GetItem()->ItemType == EQEmu::item::ItemTypeAugmentationSolvent;
if (!isSolvent && auged_with->GetItem()->ItemType != EQEmu::item::ItemTypeAugmentationDistiller)
{
Log(Logs::General, Logs::Error, "Player tried to remove an augment without a solvent or distiller.");
LogError("Player tried to remove an augment without a solvent or distiller");
user->Message(Chat::Red, "Error: Missing an augmentation solvent or distiller for removing this augment.");
return;
@@ -179,7 +179,7 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme
if (aug) {
if (!isSolvent && auged_with->GetItem()->ID != aug->GetItem()->AugDistiller)
{
Log(Logs::General, Logs::Error, "Player tried to safely remove an augment with the wrong distiller (item %u vs expected %u).", auged_with->GetItem()->ID, aug->GetItem()->AugDistiller);
LogError("Player tried to safely remove an augment with the wrong distiller (item [{}] vs expected [{}])", auged_with->GetItem()->ID, aug->GetItem()->AugDistiller);
user->Message(Chat::Red, "Error: Wrong augmentation distiller for safely removing this augment.");
return;
}
@@ -252,7 +252,7 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme
void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Object *worldo)
{
if (!user || !in_combine) {
Log(Logs::General, Logs::Error, "Client or NewCombine_Struct not set in Object::HandleCombine");
LogError("Client or NewCombine_Struct not set in Object::HandleCombine");
return;
}
@@ -433,7 +433,7 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob
if(success && spec.replace_container) {
if(worldcontainer){
//should report this error, but we dont have the recipe ID, so its not very useful
Log(Logs::General, Logs::Error, "Replace container combine executed in a world container.");
LogError("Replace container combine executed in a world container");
}
else
user->DeleteItemInInventory(in_combine->container_slot, 0, true);
@@ -459,7 +459,7 @@ void Object::HandleAutoCombine(Client* user, const RecipeAutoCombine_Struct* rac
//ask the database for the recipe to make sure it exists...
DBTradeskillRecipe_Struct spec;
if (!database.GetTradeRecipe(rac->recipe_id, rac->object_type, rac->some_id, user->CharacterID(), &spec)) {
Log(Logs::General, Logs::Error, "Unknown recipe for HandleAutoCombine: %u\n", rac->recipe_id);
LogError("Unknown recipe for HandleAutoCombine: [{}]\n", rac->recipe_id);
user->QueuePacket(outapp);
safe_delete(outapp);
return;
@@ -488,14 +488,14 @@ void Object::HandleAutoCombine(Client* user, const RecipeAutoCombine_Struct* rac
}
if(results.RowCount() < 1) {
Log(Logs::General, Logs::Error, "Error in HandleAutoCombine: no components returned");
LogError("Error in HandleAutoCombine: no components returned");
user->QueuePacket(outapp);
safe_delete(outapp);
return;
}
if(results.RowCount() > 10) {
Log(Logs::General, Logs::Error, "Error in HandleAutoCombine: too many components returned (%u)", results.RowCount());
LogError("Error in HandleAutoCombine: too many components returned ([{}])", results.RowCount());
user->QueuePacket(outapp);
safe_delete(outapp);
return;
@@ -706,7 +706,7 @@ void Client::TradeskillSearchResults(const std::string &query, unsigned long obj
return; //search gave no results... not an error
if(results.ColumnCount() != 6) {
Log(Logs::General, Logs::Error, "Error in TradeskillSearchResults query '%s': Invalid column count in result", query.c_str());
LogError("Error in TradeskillSearchResults query [{}]: Invalid column count in result", query.c_str());
return;
}
@@ -756,12 +756,12 @@ void Client::SendTradeskillDetails(uint32 recipe_id) {
}
if(results.RowCount() < 1) {
Log(Logs::General, Logs::Error, "Error in SendTradeskillDetails: no components returned");
LogError("Error in SendTradeskillDetails: no components returned");
return;
}
if(results.RowCount() > 10) {
Log(Logs::General, Logs::Error, "Error in SendTradeskillDetails: too many components returned (%u)", results.RowCount());
LogError("Error in SendTradeskillDetails: too many components returned ([{}])", results.RowCount());
return;
}
@@ -940,7 +940,7 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) {
//handle caps
if(spec->nofail) {
chance = 100; //cannot fail.
Log(Logs::Detail, Logs::Tradeskills, "...This combine cannot fail.");
LogTradeskills("This combine cannot fail");
} else if(over_trivial >= 0) {
// At reaching trivial the chance goes to 95% going up an additional
// percent for every 40 skillpoints above the trivial.
@@ -960,8 +960,8 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) {
chance = 95;
}
Log(Logs::Detail, Logs::Tradeskills, "...Current skill: %d , Trivial: %d , Success chance: %f percent", user_skill , spec->trivial , chance);
Log(Logs::Detail, Logs::Tradeskills, "...Bonusstat: %d , INT: %d , WIS: %d , DEX: %d , STR: %d", bonusstat , GetINT() , GetWIS() , GetDEX() , GetSTR());
LogTradeskills("Current skill: [{}] , Trivial: [{}] , Success chance: [{}] percent", user_skill , spec->trivial , chance);
LogTradeskills("Bonusstat: [{}] , INT: [{}] , WIS: [{}] , DEX: [{}] , STR: [{}]", bonusstat , GetINT() , GetWIS() , GetDEX() , GetSTR());
float res = zone->random.Real(0, 99);
int aa_chance = 0;
@@ -980,7 +980,7 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) {
MessageString(Chat::LightBlue, TRADESKILL_SUCCEED, spec->name.c_str());
Log(Logs::Detail, Logs::Tradeskills, "Tradeskill success");
LogTradeskills("Tradeskill success");
itr = spec->onsuccess.begin();
while(itr != spec->onsuccess.end() && !spec->quest) {
@@ -1012,7 +1012,7 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) {
MessageString(Chat::Emote,TRADESKILL_FAILED);
Log(Logs::Detail, Logs::Tradeskills, "Tradeskill failed");
LogTradeskills("Tradeskill failed");
if (this->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");
@@ -1091,9 +1091,9 @@ void Client::CheckIncreaseTradeskill(int16 bonusstat, int16 stat_modifier, float
NotifyNewTitlesAvailable();
}
Log(Logs::Detail, Logs::Tradeskills, "...skillup_modifier: %f , success_modifier: %d , stat modifier: %d", skillup_modifier , success_modifier , stat_modifier);
Log(Logs::Detail, Logs::Tradeskills, "...Stage1 chance was: %f percent", chance_stage1);
Log(Logs::Detail, Logs::Tradeskills, "...Stage2 chance was: %f percent. 0 percent means stage1 failed", chance_stage2);
LogTradeskills("skillup_modifier: [{}] , success_modifier: [{}] , stat modifier: [{}]", skillup_modifier , success_modifier , stat_modifier);
LogTradeskills("Stage1 chance was: [{}] percent", chance_stage1);
LogTradeskills("Stage2 chance was: [{}] percent. 0 percent means stage1 failed", chance_stage2);
}
bool ZoneDatabase::GetTradeRecipe(const EQEmu::ItemInstance* container, uint8 c_type, uint32 some_id,
@@ -1146,8 +1146,8 @@ bool ZoneDatabase::GetTradeRecipe(const EQEmu::ItemInstance* container, uint8 c_
buf2.c_str(), containers.c_str(), count, sum);
auto results = QueryDatabase(query);
if (!results.Success()) {
Log(Logs::General, Logs::Error, "Error in GetTradeRecipe search, query: %s", query.c_str());
Log(Logs::General, Logs::Error, "Error in GetTradeRecipe search, error: %s", results.ErrorMessage().c_str());
LogError("Error in GetTradeRecipe search, query: [{}]", query.c_str());
LogError("Error in GetTradeRecipe search, error: [{}]", results.ErrorMessage().c_str());
return false;
}
@@ -1168,7 +1168,7 @@ bool ZoneDatabase::GetTradeRecipe(const EQEmu::ItemInstance* container, uint8 c_
//length limit on buf2
if(index == 214) { //Maximum number of recipe matches (19 * 215 = 4096)
Log(Logs::General, Logs::Error, "GetTradeRecipe warning: Too many matches. Unable to search all recipe entries. Searched %u of %u possible entries.", index + 1, results.RowCount());
LogError("GetTradeRecipe warning: Too many matches. Unable to search all recipe entries. Searched [{}] of [{}] possible entries", index + 1, results.RowCount());
break;
}
}
@@ -1180,8 +1180,8 @@ bool ZoneDatabase::GetTradeRecipe(const EQEmu::ItemInstance* container, uint8 c_
"AND sum(tre.item_id * tre.componentcount) = %u", buf2.c_str(), count, sum);
results = QueryDatabase(query);
if (!results.Success()) {
Log(Logs::General, Logs::Error, "Error in GetTradeRecipe, re-query: %s", query.c_str());
Log(Logs::General, Logs::Error, "Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str());
LogError("Error in GetTradeRecipe, re-query: [{}]", query.c_str());
LogError("Error in GetTradeRecipe, error: [{}]", results.ErrorMessage().c_str());
return false;
}
}
@@ -1189,36 +1189,45 @@ bool ZoneDatabase::GetTradeRecipe(const EQEmu::ItemInstance* container, uint8 c_
if (results.RowCount() < 1)
return false;
if(results.RowCount() > 1) {
if (results.RowCount() > 1) {
//The recipe is not unique, so we need to compare the container were using.
uint32 containerId = 0;
if(some_id) //Standard container
if (some_id) { //Standard container
containerId = some_id;
else if(c_type)//World container
}
else if (c_type) {//World container
containerId = c_type;
else //Invalid container
}
else { //Invalid container
return false;
}
query = StringFormat("SELECT tre.recipe_id "
"FROM tradeskill_recipe_entries AS tre "
"WHERE tre.recipe_id IN (%s) "
"AND tre.item_id = %u;", buf2.c_str(), containerId);
results = QueryDatabase(query);
query = StringFormat(
"SELECT tre.recipe_id "
"FROM tradeskill_recipe_entries AS tre "
"WHERE tre.recipe_id IN (%s) "
"AND tre.item_id = %u;", buf2.c_str(), containerId
);
results = QueryDatabase(query);
if (!results.Success()) {
Log(Logs::General, Logs::Error, "Error in GetTradeRecipe, re-query: %s", query.c_str());
Log(Logs::General, Logs::Error, "Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str());
LogError("Error in GetTradeRecipe, re-query: [{}]", query.c_str());
LogError("Error in GetTradeRecipe, error: [{}]", results.ErrorMessage().c_str());
return false;
}
if(results.RowCount() == 0) { //Recipe contents matched more than 1 recipe, but not in this container
Log(Logs::General, Logs::Error, "Combine error: Incorrect container is being used!");
if (results.RowCount() == 0) { //Recipe contents matched more than 1 recipe, but not in this container
LogError("Combine error: Incorrect container is being used!");
return false;
}
if (results.RowCount() > 1) //Recipe contents matched more than 1 recipe in this container
Log(Logs::General, Logs::Error, "Combine error: Recipe is not unique! %u matches found for container %u. Continuing with first recipe match.", results.RowCount(), containerId);
if (results.RowCount() > 1) { //Recipe contents matched more than 1 recipe in this container
LogError(
"Combine error: Recipe is not unique! [{}] matches found for container [{}]. Continuing with first recipe match",
results.RowCount(),
containerId
);
}
}
auto row = results.begin();
@@ -1288,8 +1297,8 @@ bool ZoneDatabase::GetTradeRecipe(uint32 recipe_id, uint8 c_type, uint32 some_id
char_id, (unsigned long)recipe_id, containers.c_str());
auto results = QueryDatabase(query);
if (!results.Success()) {
Log(Logs::General, Logs::Error, "Error in GetTradeRecipe, query: %s", query.c_str());
Log(Logs::General, Logs::Error, "Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str());
LogError("Error in GetTradeRecipe, query: [{}]", query.c_str());
LogError("Error in GetTradeRecipe, error: [{}]", results.ErrorMessage().c_str());
return false;
}
@@ -1324,7 +1333,7 @@ bool ZoneDatabase::GetTradeRecipe(uint32 recipe_id, uint8 c_type, uint32 some_id
}
if(results.RowCount() < 1 && !spec->quest) {
Log(Logs::General, Logs::Error, "Error in GetTradeRecept success: no success items returned");
LogError("Error in GetTradeRecept success: no success items returned");
return false;
}
@@ -1391,7 +1400,7 @@ void Client::LearnRecipe(uint32 recipeID)
}
if (results.RowCount() != 1) {
Log(Logs::General, Logs::Normal, "Client::LearnRecipe - RecipeID: %d had %d occurences.", recipeID, results.RowCount());
LogInfo("Client::LearnRecipe - RecipeID: [{}] had [{}] occurences", recipeID, results.RowCount());
return;
}
+61 -64
View File
@@ -87,7 +87,7 @@ void Trade::AddEntity(uint16 trade_slot_id, uint32 stack_size) {
if (!owner || !owner->IsClient()) {
// This should never happen
Log(Logs::General, Logs::None, "Programming error: NPC's should not call Trade::AddEntity()");
LogDebug("Programming error: NPC's should not call Trade::AddEntity()");
return;
}
@@ -127,7 +127,7 @@ void Trade::AddEntity(uint16 trade_slot_id, uint32 stack_size) {
inst2->SetCharges(stack_size + inst2->GetCharges());
}
Log(Logs::Detail, Logs::Trading, "%s added partial item '%s' stack (qty: %i) to trade slot %i", owner->GetName(), inst->GetItem()->Name, stack_size, trade_slot_id);
LogTrading("[{}] added partial item [{}] stack (qty: [{}]) to trade slot [{}]", owner->GetName(), inst->GetItem()->Name, stack_size, trade_slot_id);
if (_stack_size > 0)
inst->SetCharges(_stack_size);
@@ -144,7 +144,7 @@ void Trade::AddEntity(uint16 trade_slot_id, uint32 stack_size) {
SendItemData(inst, trade_slot_id);
Log(Logs::Detail, Logs::Trading, "%s added item '%s' to trade slot %i", owner->GetName(), inst->GetItem()->Name, trade_slot_id);
LogTrading("[{}] added item [{}] to trade slot [{}]", owner->GetName(), inst->GetItem()->Name, trade_slot_id);
client->PutItemInInventory(trade_slot_id, *inst);
client->DeleteItemInInventory(EQEmu::invslot::slotCursor);
@@ -297,7 +297,7 @@ void Trade::LogTrade()
void Trade::DumpTrade()
{
Mob* with = With();
Log(Logs::Detail, Logs::Trading, "Dumping trade data: '%s' in TradeState %i with '%s'",
LogTrading("Dumping trade data: [{}] in TradeState [{}] with [{}]",
this->owner->GetName(), state, ((with==nullptr)?"(null)":with->GetName()));
if (!owner->IsClient())
@@ -308,7 +308,7 @@ void Trade::DumpTrade()
const EQEmu::ItemInstance* inst = trader->GetInv().GetItem(i);
if (inst) {
Log(Logs::Detail, Logs::Trading, "Item %i (Charges=%i, Slot=%i, IsBag=%s)",
LogTrading("Item [{}] (Charges=[{}], Slot=[{}], IsBag=[{}])",
inst->GetItem()->ID, inst->GetCharges(),
i, ((inst->IsClassBag()) ? "True" : "False"));
@@ -316,7 +316,7 @@ void Trade::DumpTrade()
for (uint8 j = EQEmu::invbag::SLOT_BEGIN; j <= EQEmu::invbag::SLOT_END; j++) {
inst = trader->GetInv().GetItem(i, j);
if (inst) {
Log(Logs::Detail, Logs::Trading, "\tBagItem %i (Charges=%i, Slot=%i)",
LogTrading("\tBagItem [{}] (Charges=[{}], Slot=[{}])",
inst->GetItem()->ID, inst->GetCharges(),
EQEmu::InventoryProfile::CalcSlotId(i, j));
}
@@ -325,7 +325,7 @@ void Trade::DumpTrade()
}
}
Log(Logs::Detail, Logs::Trading, "\tpp:%i, gp:%i, sp:%i, cp:%i", pp, gp, sp, cp);
LogTrading("\tpp:[{}], gp:[{}], sp:[{}], cp:[{}]", pp, gp, sp, cp);
}
@@ -369,7 +369,7 @@ void Client::ResetTrade() {
break;
if (partial_inst->GetID() != inst->GetID()) {
Log(Logs::Detail, Logs::None, "[CLIENT] Client::ResetTrade() - an incompatible location reference was returned by Inventory::FindFreeSlotForTradeItem()");
LogDebug("[CLIENT] Client::ResetTrade() - an incompatible location reference was returned by Inventory::FindFreeSlotForTradeItem()");
break;
}
@@ -459,7 +459,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st
bool qs_log = false;
if(other) {
Log(Logs::Detail, Logs::Trading, "Finishing trade with client %s", other->GetName());
LogTrading("Finishing trade with client [{}]", other->GetName());
this->AddMoneyToPP(other->trade->cp, other->trade->sp, other->trade->gp, other->trade->pp, true);
@@ -492,7 +492,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st
const EQEmu::ItemInstance* inst = m_inv[trade_slot];
if (inst && inst->IsClassBag()) {
Log(Logs::Detail, Logs::Trading, "Giving container %s (%d) in slot %d to %s", inst->GetItem()->Name, inst->GetItem()->ID, trade_slot, other->GetName());
LogTrading("Giving container [{}] ([{}]) in slot [{}] to [{}]", inst->GetItem()->Name, inst->GetItem()->ID, trade_slot, other->GetName());
// TODO: need to check bag items/augments for no drop..everything for attuned...
if (inst->GetItem()->NoDrop != 0 || Admin() >= RuleI(Character, MinStatusForNoDropExemptions) || RuleI(World, FVNoDropFlag) == 1 || other == this) {
@@ -500,7 +500,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st
if (free_slot != INVALID_INDEX) {
if (other->PutItemInInventory(free_slot, *inst, true)) {
Log(Logs::Detail, Logs::Trading, "Container %s (%d) successfully transferred, deleting from trade slot.", inst->GetItem()->Name, inst->GetItem()->ID);
LogTrading("Container [{}] ([{}]) successfully transferred, deleting from trade slot", inst->GetItem()->Name, inst->GetItem()->ID);
if (qs_log) {
auto detail = new QSTradeItems_Struct;
@@ -552,17 +552,17 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st
}
}
else {
Log(Logs::Detail, Logs::Trading, "Transfer of container %s (%d) to %s failed, returning to giver.", inst->GetItem()->Name, inst->GetItem()->ID, other->GetName());
LogTrading("Transfer of container [{}] ([{}]) to [{}] failed, returning to giver", inst->GetItem()->Name, inst->GetItem()->ID, other->GetName());
PushItemOnCursor(*inst, true);
}
}
else {
Log(Logs::Detail, Logs::Trading, "%s's inventory is full, returning container %s (%d) to giver.", other->GetName(), inst->GetItem()->Name, inst->GetItem()->ID);
LogTrading("[{}]'s inventory is full, returning container [{}] ([{}]) to giver", other->GetName(), inst->GetItem()->Name, inst->GetItem()->ID);
PushItemOnCursor(*inst, true);
}
}
else {
Log(Logs::Detail, Logs::Trading, "Container %s (%d) is NoDrop, returning to giver.", inst->GetItem()->Name, inst->GetItem()->ID);
LogTrading("Container [{}] ([{}]) is NoDrop, returning to giver", inst->GetItem()->Name, inst->GetItem()->ID);
PushItemOnCursor(*inst, true);
}
@@ -588,7 +588,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st
break;
if (partial_inst->GetID() != inst->GetID()) {
Log(Logs::Detail, Logs::Trading, "[CLIENT] Client::ResetTrade() - an incompatible location reference was returned by Inventory::FindFreeSlotForTradeItem()");
LogTrading("[CLIENT] Client::ResetTrade() - an incompatible location reference was returned by Inventory::FindFreeSlotForTradeItem()");
break;
}
@@ -606,10 +606,10 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st
inst->SetCharges(0);
}
Log(Logs::Detail, Logs::Trading, "Transferring partial stack %s (%d) in slot %d to %s", inst->GetItem()->Name, inst->GetItem()->ID, trade_slot, other->GetName());
LogTrading("Transferring partial stack [{}] ([{}]) in slot [{}] to [{}]", inst->GetItem()->Name, inst->GetItem()->ID, trade_slot, other->GetName());
if (other->PutItemInInventory(partial_slot, *partial_inst, true)) {
Log(Logs::Detail, Logs::Trading, "Partial stack %s (%d) successfully transferred, deleting %i charges from trade slot.",
LogTrading("Partial stack [{}] ([{}]) successfully transferred, deleting [{}] charges from trade slot",
inst->GetItem()->Name, inst->GetItem()->ID, (old_charges - inst->GetCharges()));
if (qs_log) {
auto detail = new QSTradeItems_Struct;
@@ -635,7 +635,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st
}
}
else {
Log(Logs::Detail, Logs::Trading, "Transfer of partial stack %s (%d) to %s failed, returning %i charges to trade slot.",
LogTrading("Transfer of partial stack [{}] ([{}]) to [{}] failed, returning [{}] charges to trade slot",
inst->GetItem()->Name, inst->GetItem()->ID, other->GetName(), (old_charges - inst->GetCharges()));
inst->SetCharges(old_charges);
@@ -710,7 +710,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st
const EQEmu::ItemInstance* inst = m_inv[trade_slot];
if (inst) {
Log(Logs::Detail, Logs::Trading, "Giving item %s (%d) in slot %d to %s", inst->GetItem()->Name, inst->GetItem()->ID, trade_slot, other->GetName());
LogTrading("Giving item [{}] ([{}]) in slot [{}] to [{}]", inst->GetItem()->Name, inst->GetItem()->ID, trade_slot, other->GetName());
// TODO: need to check bag items/augments for no drop..everything for attuned...
if (inst->GetItem()->NoDrop != 0 || Admin() >= RuleI(Character, MinStatusForNoDropExemptions) || RuleI(World, FVNoDropFlag) == 1 || other == this) {
@@ -718,7 +718,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st
if (free_slot != INVALID_INDEX) {
if (other->PutItemInInventory(free_slot, *inst, true)) {
Log(Logs::Detail, Logs::Trading, "Item %s (%d) successfully transferred, deleting from trade slot.", inst->GetItem()->Name, inst->GetItem()->ID);
LogTrading("Item [{}] ([{}]) successfully transferred, deleting from trade slot", inst->GetItem()->Name, inst->GetItem()->ID);
if (qs_log) {
auto detail = new QSTradeItems_Struct;
@@ -771,17 +771,17 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st
}
}
else {
Log(Logs::Detail, Logs::Trading, "Transfer of Item %s (%d) to %s failed, returning to giver.", inst->GetItem()->Name, inst->GetItem()->ID, other->GetName());
LogTrading("Transfer of Item [{}] ([{}]) to [{}] failed, returning to giver", inst->GetItem()->Name, inst->GetItem()->ID, other->GetName());
PushItemOnCursor(*inst, true);
}
}
else {
Log(Logs::Detail, Logs::Trading, "%s's inventory is full, returning item %s (%d) to giver.", other->GetName(), inst->GetItem()->Name, inst->GetItem()->ID);
LogTrading("[{}]'s inventory is full, returning item [{}] ([{}]) to giver", other->GetName(), inst->GetItem()->Name, inst->GetItem()->ID);
PushItemOnCursor(*inst, true);
}
}
else {
Log(Logs::Detail, Logs::Trading, "Item %s (%d) is NoDrop, returning to giver.", inst->GetItem()->Name, inst->GetItem()->ID);
LogTrading("Item [{}] ([{}]) is NoDrop, returning to giver", inst->GetItem()->Name, inst->GetItem()->ID);
PushItemOnCursor(*inst, true);
}
@@ -1178,7 +1178,7 @@ void Client::SendTraderItem(uint32 ItemID, uint16 Quantity) {
const EQEmu::ItemData* item = database.GetItem(ItemID);
if(!item){
Log(Logs::Detail, Logs::Trading, "Bogus item deleted in Client::SendTraderItem!\n");
LogTrading("Bogus item deleted in Client::SendTraderItem!\n");
return;
}
@@ -1237,10 +1237,8 @@ void Client::BulkSendTraderInventory(uint32 char_id) {
safe_delete(inst);
}
else
Log(Logs::Detail, Logs::Trading, "Client::BulkSendTraderInventory nullptr inst pointer");
LogTrading("Client::BulkSendTraderInventory nullptr inst pointer");
}
else
Log(Logs::Detail, Logs::Trading, "Client::BulkSendTraderInventory nullptr item pointer or item is NODROP %8X",item);
}
safe_delete(TraderItems);
}
@@ -1263,7 +1261,7 @@ uint32 Client::FindTraderItemSerialNumber(int32 ItemID) {
}
}
}
Log(Logs::Detail, Logs::Trading, "Client::FindTraderItemSerialNumber Couldn't find item! Item ID %i", ItemID);
LogTrading("Client::FindTraderItemSerialNumber Couldn't find item! Item ID [{}]", ItemID);
return 0;
}
@@ -1286,7 +1284,7 @@ EQEmu::ItemInstance* Client::FindTraderItemBySerialNumber(int32 SerialNumber){
}
}
}
Log(Logs::Detail, Logs::Trading, "Client::FindTraderItemBySerialNumber Couldn't find item! Serial No. was %i", SerialNumber);
LogTrading("Client::FindTraderItemBySerialNumber Couldn't find item! Serial No. was [{}]", SerialNumber);
return nullptr;
}
@@ -1348,7 +1346,7 @@ uint16 Client::FindTraderItem(int32 SerialNumber, uint16 Quantity){
}
}
}
Log(Logs::Detail, Logs::Trading, "Could NOT find a match for Item: %i with a quantity of: %i on Trader: %s\n",
LogTrading("Could NOT find a match for Item: [{}] with a quantity of: [{}] on Trader: [{}]\n",
SerialNumber , Quantity, this->GetName());
return 0;
@@ -1359,7 +1357,7 @@ void Client::NukeTraderItem(uint16 Slot,int16 Charges,uint16 Quantity,Client* Cu
if(!Customer)
return;
Log(Logs::Detail, Logs::Trading, "NukeTraderItem(Slot %i, Charges %i, Quantity %i", Slot, Charges, Quantity);
LogTrading("NukeTraderItem(Slot [{}], Charges [{}], Quantity [{}]", Slot, Charges, Quantity);
if(Quantity < Charges)
{
@@ -1446,7 +1444,7 @@ void Client::FindAndNukeTraderItem(int32 SerialNumber, uint16 Quantity, Client*
if (!item)
{
Log(Logs::Detail, Logs::Trading, "Could not find Item: %i on Trader: %s", SerialNumber, Quantity, this->GetName());
LogTrading("Could not find Item: [{}] on Trader: [{}]", SerialNumber, Quantity, this->GetName());
return;
}
@@ -1457,7 +1455,7 @@ void Client::FindAndNukeTraderItem(int32 SerialNumber, uint16 Quantity, Client*
if (!Stackable)
Quantity = (Charges > 0) ? Charges : 1;
Log(Logs::Detail, Logs::Trading, "FindAndNuke %s, Charges %i, Quantity %i", item->GetItem()->Name, Charges, Quantity);
LogTrading("FindAndNuke [{}], Charges [{}], Quantity [{}]", item->GetItem()->Name, Charges, Quantity);
if (Charges <= Quantity || (Charges <= 0 && Quantity==1) || !Stackable)
{
@@ -1499,7 +1497,7 @@ void Client::FindAndNukeTraderItem(int32 SerialNumber, uint16 Quantity, Client*
}
}
Log(Logs::Detail, Logs::Trading, "Could NOT find a match for Item: %i with a quantity of: %i on Trader: %s\n",SerialNumber,
LogTrading("Could NOT find a match for Item: [{}] with a quantity of: [{}] on Trader: [{}]\n",SerialNumber,
Quantity,this->GetName());
}
@@ -1599,7 +1597,7 @@ void Client::BuyTraderItem(TraderBuy_Struct* tbs, Client* Trader, const EQApplic
BuyItem = Trader->FindTraderItemBySerialNumber(tbs->ItemID);
if(!BuyItem) {
Log(Logs::Detail, Logs::Trading, "Unable to find item on trader.");
LogTrading("Unable to find item on trader");
TradeRequestFailed(app);
safe_delete(outapp);
return;
@@ -1607,7 +1605,7 @@ void Client::BuyTraderItem(TraderBuy_Struct* tbs, Client* Trader, const EQApplic
tbs->Price = BuyItem->GetPrice();
Log(Logs::Detail, Logs::Trading, "Buyitem: Name: %s, IsStackable: %i, Requested Quantity: %i, Charges on Item %i",
LogTrading("Buyitem: Name: [{}], IsStackable: [{}], Requested Quantity: [{}], Charges on Item [{}]",
BuyItem->GetItem()->Name, BuyItem->IsStackable(), tbs->Quantity, BuyItem->GetCharges());
// If the item is not stackable, then we can only be buying one of them.
if(!BuyItem->IsStackable())
@@ -1625,13 +1623,12 @@ void Client::BuyTraderItem(TraderBuy_Struct* tbs, Client* Trader, const EQApplic
outtbs->Quantity = tbs->Quantity;
}
Log(Logs::Detail, Logs::Trading, "Actual quantity that will be traded is %i", outtbs->Quantity);
LogTrading("Actual quantity that will be traded is [{}]", outtbs->Quantity);
if((tbs->Price * outtbs->Quantity) <= 0) {
Message(Chat::Red, "Internal error. Aborting trade. Please report this to the ServerOP. Error code is 1");
Trader->Message(Chat::Red, "Internal error. Aborting trade. Please report this to the ServerOP. Error code is 1");
Log(Logs::General, Logs::Error, "Bazaar: Zero price transaction between %s and %s aborted."
"Item: %s, Charges: %i, TBS: Qty %i, Price: %i",
LogError("Bazaar: Zero price transaction between [{}] and [{}] aborted. Item: [{}], Charges: [{}], TBS: Qty [{}], Price: [{}]",
GetName(), Trader->GetName(),
BuyItem->GetItem()->Name, BuyItem->GetCharges(), tbs->Quantity, tbs->Price);
TradeRequestFailed(app);
@@ -1668,7 +1665,7 @@ void Client::BuyTraderItem(TraderBuy_Struct* tbs, Client* Trader, const EQApplic
return;
}
Log(Logs::Detail, Logs::Trading, "Customer Paid: %d in Copper", TotalCost);
LogTrading("Customer Paid: [{}] in Copper", TotalCost);
uint32 platinum = TotalCost / 1000;
TotalCost -= (platinum * 1000);
@@ -1680,7 +1677,7 @@ void Client::BuyTraderItem(TraderBuy_Struct* tbs, Client* Trader, const EQApplic
Trader->AddMoneyToPP(copper, silver, gold, platinum, true);
Log(Logs::Detail, Logs::Trading, "Trader Received: %d Platinum, %d Gold, %d Silver, %d Copper", platinum, gold, silver, copper);
LogTrading("Trader Received: [{}] Platinum, [{}] Gold, [{}] Silver, [{}] Copper", platinum, gold, silver, copper);
ReturnTraderReq(app, outtbs->Quantity, ItemID);
@@ -1939,7 +1936,7 @@ void Client::SendBazaarResults(uint32 TraderID, uint32 Class_, uint32 Race, uint
return;
}
Log(Logs::Detail, Logs::Trading, "SRCH: %s", query.c_str());
LogTrading("SRCH: [{}]", query.c_str());
int Size = 0;
uint32 ID = 0;
@@ -1984,7 +1981,7 @@ void Client::SendBazaarResults(uint32 TraderID, uint32 Class_, uint32 Race, uint
ID = Trader2->GetID();
VARSTRUCT_ENCODE_TYPE(uint32, bufptr, ID);
} else {
Log(Logs::Detail, Logs::Trading, "Unable to find trader: %i\n", atoi(row[1]));
LogTrading("Unable to find trader: [{}]\n", atoi(row[1]));
VARSTRUCT_ENCODE_TYPE(uint32, bufptr, 0);
}
Cost = atoi(row[5]);
@@ -2074,7 +2071,7 @@ static void UpdateTraderCustomerItemsAdded(uint32 CustomerID, TraderCharges_Stru
if(inst->IsStackable())
inst->SetMerchantCount(gis->Charges[i]);
Log(Logs::Detail, Logs::Trading, "Sending price update for %s, Serial No. %i with %i charges",
LogTrading("Sending price update for [{}], Serial No. [{}] with [{}] charges",
item->Name, gis->SerialNumber[i], gis->Charges[i]);
Customer->SendItemPacket(EQEmu::invslot::slotCursor, inst, ItemPacketMerchant); // MainCursor?
@@ -2120,7 +2117,7 @@ static void UpdateTraderCustomerPriceChanged(uint32 CustomerID, TraderCharges_St
tdis->ItemID = gis->SerialNumber[i];
}
tdis->ItemID = gis->SerialNumber[i];
Log(Logs::Detail, Logs::Trading, "Telling customer to remove item %i with %i charges and S/N %i",
LogTrading("Telling customer to remove item [{}] with [{}] charges and S/N [{}]",
ItemID, Charges, gis->SerialNumber[i]);
@@ -2132,7 +2129,7 @@ static void UpdateTraderCustomerPriceChanged(uint32 CustomerID, TraderCharges_St
return;
}
Log(Logs::Detail, Logs::Trading, "Sending price updates to customer %s", Customer->GetName());
LogTrading("Sending price updates to customer [{}]", Customer->GetName());
EQEmu::ItemInstance* inst = database.CreateItem(item);
@@ -2158,7 +2155,7 @@ static void UpdateTraderCustomerPriceChanged(uint32 CustomerID, TraderCharges_St
inst->SetMerchantSlot(gis->SerialNumber[i]);
Log(Logs::Detail, Logs::Trading, "Sending price update for %s, Serial No. %i with %i charges",
LogTrading("Sending price update for [{}], Serial No. [{}] with [{}] charges",
item->Name, gis->SerialNumber[i], gis->Charges[i]);
Customer->SendItemPacket(EQEmu::invslot::slotCursor, inst, ItemPacketMerchant); // MainCursor??
@@ -2174,7 +2171,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) {
//
TraderPriceUpdate_Struct* tpus = (TraderPriceUpdate_Struct*)app->pBuffer;
Log(Logs::Detail, Logs::Trading, "Received Price Update for %s, Item Serial No. %i, New Price %i",
LogTrading("Received Price Update for [{}], Item Serial No. [{}], New Price [{}]",
GetName(), tpus->SerialNumber, tpus->NewPrice);
// Pull the items this Trader currently has for sale from the trader table.
@@ -2182,7 +2179,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) {
TraderCharges_Struct* gis = database.LoadTraderItemWithCharges(CharacterID());
if(!gis) {
Log(Logs::Detail, Logs::None, "[CLIENT] Error retrieving Trader items details to update price.");
LogDebug("[CLIENT] Error retrieving Trader items details to update price");
return;
}
@@ -2202,7 +2199,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) {
if((gis->ItemID[i] > 0) && (gis->SerialNumber[i] == tpus->SerialNumber)) {
// We found the item that the Trader wants to change the price of (or add back up for sale).
//
Log(Logs::Detail, Logs::Trading, "ItemID is %i, Charges is %i", gis->ItemID[i], gis->Charges[i]);
LogTrading("ItemID is [{}], Charges is [{}]", gis->ItemID[i], gis->Charges[i]);
IDOfItemToUpdate = gis->ItemID[i];
@@ -2228,7 +2225,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) {
return ;
}
Log(Logs::Detail, Logs::Trading, "Unable to find item to update price for. Rechecking trader satchels");
LogTrading("Unable to find item to update price for. Rechecking trader satchels");
// Find what is in their Trader Satchels
GetItems_Struct* newgis=GetTraderItems();
@@ -2241,7 +2238,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) {
if((newgis->Items[i] > 0) && (newgis->SerialNumber[i] == tpus->SerialNumber)) {
Log(Logs::Detail, Logs::Trading, "Found new Item to Add, ItemID is %i, Charges is %i", newgis->Items[i],
LogTrading("Found new Item to Add, ItemID is [{}], Charges is [{}]", newgis->Items[i],
newgis->Charges[i]);
IDOfItemToAdd = newgis->Items[i];
@@ -2259,7 +2256,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) {
if(!IDOfItemToAdd || !item) {
Log(Logs::Detail, Logs::Trading, "Item not found in Trader Satchels either.");
LogTrading("Item not found in Trader Satchels either");
tpus->SubAction = BazaarPriceChange_Fail;
QueuePacket(app);
Trader_EndTrader();
@@ -2304,7 +2301,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) {
gis->SerialNumber[i] = newgis->SerialNumber[i];
gis->ItemCost[i] = tpus->NewPrice;
Log(Logs::Detail, Logs::Trading, "Adding new item for %s. ItemID %i, SerialNumber %i, Charges %i, Price: %i, Slot %i",
LogTrading("Adding new item for [{}]. ItemID [{}], SerialNumber [{}], Charges [{}], Price: [{}], Slot [{}]",
GetName(), newgis->Items[i], newgis->SerialNumber[i], newgis->Charges[i],
tpus->NewPrice, i);
}
@@ -2350,7 +2347,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) {
QueuePacket(app);
if(OldPrice == tpus->NewPrice) {
Log(Logs::Detail, Logs::Trading, "The new price is the same as the old one.");
LogTrading("The new price is the same as the old one");
safe_delete(gis);
return;
}
@@ -2371,7 +2368,7 @@ void Client::SendBuyerResults(char* searchString, uint32 searchID) {
// This method is called when a potential seller in the /barter window searches for matching buyers
//
Log(Logs::Detail, Logs::None, "[CLIENT] Client::SendBuyerResults %s\n", searchString);
LogDebug("[CLIENT] Client::SendBuyerResults [{}]\n", searchString);
auto escSearchString = new char[strlen(searchString) * 2 + 1];
database.DoEscapeString(escSearchString, searchString, strlen(searchString));
@@ -2619,7 +2616,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) {
Quantity = i;
break;
}
Log(Logs::General, Logs::Error, "Unexpected error while moving item from seller to buyer.");
LogError("Unexpected error while moving item from seller to buyer");
Message(Chat::Red, "Internal error while processing transaction.");
return;
}
@@ -2627,7 +2624,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) {
EQEmu::ItemInstance* ItemToTransfer = m_inv.PopItem(SellerSlot);
if(!ItemToTransfer || !Buyer->MoveItemToInventory(ItemToTransfer, true)) {
Log(Logs::General, Logs::Error, "Unexpected error while moving item from seller to buyer.");
LogError("Unexpected error while moving item from seller to buyer");
Message(Chat::Red, "Internal error while processing transaction.");
if(ItemToTransfer)
@@ -2665,7 +2662,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) {
int16 SellerSlot = m_inv.HasItem(ItemID, 1, invWhereWorn|invWherePersonal|invWhereCursor);
if (SellerSlot == INVALID_INDEX) {
Log(Logs::General, Logs::Error, "Unexpected error while moving item from seller to buyer.");
LogError("Unexpected error while moving item from seller to buyer");
Message(Chat::Red, "Internal error while processing transaction.");
return;
}
@@ -2673,7 +2670,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) {
EQEmu::ItemInstance* ItemToTransfer = m_inv.PopItem(SellerSlot);
if(!ItemToTransfer) {
Log(Logs::General, Logs::Error, "Unexpected error while moving item from seller to buyer.");
LogError("Unexpected error while moving item from seller to buyer");
Message(Chat::Red, "Internal error while processing transaction.");
return;
}
@@ -2685,7 +2682,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) {
QuantityMoved += ItemToTransfer->GetCharges();
if(!Buyer->MoveItemToInventory(ItemToTransfer, true)) {
Log(Logs::General, Logs::Error, "Unexpected error while moving item from seller to buyer.");
LogError("Unexpected error while moving item from seller to buyer");
Message(Chat::Red, "Internal error while processing transaction.");
safe_delete(ItemToTransfer);
return;
@@ -2720,7 +2717,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) {
ItemToTransfer->SetCharges(QuantityToRemoveFromStack);
if(!Buyer->MoveItemToInventory(ItemToTransfer, true)) {
Log(Logs::General, Logs::Error, "Unexpected error while moving item from seller to buyer.");
LogError("Unexpected error while moving item from seller to buyer");
Message(Chat::Red, "Internal error while processing transaction.");
safe_delete(ItemToTransfer);
return;
@@ -2955,11 +2952,11 @@ void Client::UpdateBuyLine(const EQApplicationPacket *app) {
bool LoreConflict = CheckLoreConflict(item);
Log(Logs::Detail, Logs::Trading, "UpdateBuyLine: Char: %s BuySlot: %i ItemID %i %s Quantity %i Toggle: %i Price %i ItemCount %i LoreConflict %i",
LogTrading("UpdateBuyLine: Char: [{}] BuySlot: [{}] ItemID [{}] [{}] Quantity [{}] Toggle: [{}] Price [{}] ItemCount [{}] LoreConflict [{}]",
GetName(), BuySlot, ItemID, item->Name, Quantity, ToggleOnOff, Price, ItemCount, LoreConflict);
if((item->NoDrop != 0) && !LoreConflict && (Quantity > 0) && HasMoney(Quantity * Price) && ToggleOnOff && (ItemCount == 0)) {
Log(Logs::Detail, Logs::Trading, "Adding to database");
LogTrading("Adding to database");
database.AddBuyLine(CharacterID(), BuySlot, ItemID, ItemName, Quantity, Price);
QueuePacket(app);
}
+18 -18
View File
@@ -220,7 +220,7 @@ void Client::ChangeTributeSettings(TributeInfo_Struct *t) {
void Client::SendTributeDetails(uint32 client_id, uint32 tribute_id) {
if(tribute_list.count(tribute_id) != 1) {
Log(Logs::General, Logs::Error, "Details request for invalid tribute %lu", (unsigned long)tribute_id);
LogError("Details request for invalid tribute [{}]", (unsigned long)tribute_id);
return;
}
TributeData &td = tribute_list[tribute_id];
@@ -409,28 +409,28 @@ bool ZoneDatabase::LoadTributes() {
return false;
}
for (auto row = results.begin(); row != results.end(); ++row) {
uint32 id = atoul(row[0]);
for (auto row = results.begin(); row != results.end(); ++row) {
uint32 id = atoul(row[0]);
if(tribute_list.count(id) != 1) {
Log(Logs::General, Logs::Error, "Error in LoadTributes: unknown tribute %lu in tribute_levels", (unsigned long)id);
continue;
}
if (tribute_list.count(id) != 1) {
LogError("Error in LoadTributes: unknown tribute [{}] in tribute_levels", (unsigned long) id);
continue;
}
TributeData &cur = tribute_list[id];
TributeData &cur = tribute_list[id];
if(cur.tier_count >= MAX_TRIBUTE_TIERS) {
Log(Logs::General, Logs::Error, "Error in LoadTributes: on tribute %lu: more tiers defined than permitted", (unsigned long)id);
continue;
}
if (cur.tier_count >= MAX_TRIBUTE_TIERS) {
LogError("Error in LoadTributes: on tribute [{}]: more tiers defined than permitted", (unsigned long) id);
continue;
}
TributeLevel_Struct &s = cur.tiers[cur.tier_count];
TributeLevel_Struct &s = cur.tiers[cur.tier_count];
s.level = atoul(row[1]);
s.cost = atoul(row[2]);
s.tribute_item_id = atoul(row[3]);
cur.tier_count++;
}
s.level = atoul(row[1]);
s.cost = atoul(row[2]);
s.tribute_item_id = atoul(row[3]);
cur.tier_count++;
}
return true;
}
+9 -9
View File
@@ -14,30 +14,30 @@ WaterMap* WaterMap::LoadWaterMapfile(std::string zone_name) {
std::transform(zone_name.begin(), zone_name.end(), zone_name.begin(), ::tolower);
std::string file_path = Config->MapDir + "water/" + zone_name + std::string(".wtr");
Log(Logs::General, Logs::Debug, "Attempting to load water map with path %s", file_path.c_str());
LogDebug("Attempting to load water map with path [{}]", file_path.c_str());
FILE *f = fopen(file_path.c_str(), "rb");
if(f) {
char magic[10];
uint32 version;
if(fread(magic, 10, 1, f) != 1) {
Log(Logs::General, Logs::Debug, "Failed to load water map, error reading magic string in header.");
LogDebug("Failed to load water map, error reading magic string in header");
fclose(f);
return nullptr;
}
if(strncmp(magic, "EQEMUWATER", 10)) {
Log(Logs::General, Logs::Debug, "Failed to load water map, bad magic string in header.");
LogDebug("Failed to load water map, bad magic string in header");
fclose(f);
return nullptr;
}
if(fread(&version, sizeof(version), 1, f) != 1) {
Log(Logs::General, Logs::Debug, "Failed to load water map, error reading version.");
LogDebug("Failed to load water map, error reading version");
fclose(f);
return nullptr;
}
Log(Logs::General, Logs::Debug, "Attempting to V%u load water map %s.", version, file_path.c_str());
LogDebug("Attempting to V[{}] load water map [{}]", version, file_path.c_str());
if(version == 1) {
auto wm = new WaterMapV1();
if(!wm->Load(f)) {
@@ -45,7 +45,7 @@ WaterMap* WaterMap::LoadWaterMapfile(std::string zone_name) {
wm = nullptr;
}
Log(Logs::General, Logs::Status, "Loaded Water Map V%u file %s", version, file_path.c_str());
LogInfo("Loaded Water Map V[{}] file [{}]", version, file_path.c_str());
fclose(f);
return wm;
@@ -56,17 +56,17 @@ WaterMap* WaterMap::LoadWaterMapfile(std::string zone_name) {
wm = nullptr;
}
Log(Logs::General, Logs::Status, "Loaded Water Map V%u file %s", version, file_path.c_str());
LogInfo("Loaded Water Map V[{}] file [{}]", version, file_path.c_str());
fclose(f);
return wm;
} else {
Log(Logs::General, Logs::Debug, "Failed to load water map, unsupported version V%u.", version);
LogDebug("Failed to load water map, unsupported version V[{}]", version);
fclose(f);
return nullptr;
}
}
Log(Logs::General, Logs::Debug, "Failed to load water map, could not open file for reading %s.", file_path.c_str());
LogDebug("Failed to load water map, could not open file for reading [{}]", file_path.c_str());
return nullptr;
}
+19 -34
View File
@@ -25,7 +25,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "../common/string_util.h"
#include "../common/misc_functions.h"
#include "../common/eqemu_logsys.h"
#include "../common/eqemu_logsys_fmt.h"
#include "map.h"
#include "npc.h"
@@ -105,7 +104,7 @@ void NPC::StopWandering()
roamer = false;
CastToNPC()->SetGrid(0);
StopNavigation();
Log(Logs::Detail, Logs::Pathing, "Stop Wandering requested.");
LogPathing("Stop Wandering requested");
return;
}
@@ -124,16 +123,16 @@ void NPC::ResumeWandering()
cur_wp = save_wp;
UpdateWaypoint(cur_wp); // have him head to last destination from here
}
Log(Logs::Detail, Logs::Pathing, "Resume Wandering requested. Grid %d, wp %d", GetGrid(), cur_wp);
LogPathing("Resume Wandering requested. Grid [{}], wp [{}]", GetGrid(), cur_wp);
}
else if (AI_walking_timer->Enabled())
{ // we are at a waypoint paused normally
Log(Logs::Detail, Logs::Pathing, "Resume Wandering on timed pause. Grid %d, wp %d", GetGrid(), cur_wp);
LogPathing("Resume Wandering on timed pause. Grid [{}], wp [{}]", GetGrid(), cur_wp);
AI_walking_timer->Trigger(); // disable timer to end pause now
}
else
{
Log(Logs::General, Logs::Error, "NPC not paused - can't resume wandering: %lu", (unsigned long)GetNPCTypeID());
LogError("NPC not paused - can't resume wandering: [{}]", (unsigned long)GetNPCTypeID());
return;
}
@@ -148,7 +147,7 @@ void NPC::ResumeWandering()
}
else
{
Log(Logs::General, Logs::Error, "NPC not on grid - can't resume wandering: %lu", (unsigned long)GetNPCTypeID());
LogError("NPC not on grid - can't resume wandering: [{}]", (unsigned long)GetNPCTypeID());
}
return;
}
@@ -160,7 +159,7 @@ void NPC::PauseWandering(int pausetime)
if (GetGrid() != 0) {
moving = false;
DistractedFromGrid = true;
Log(Logs::Detail, Logs::Pathing, "Paused Wandering requested. Grid %d. Resuming in %d ms (0=not until told)", GetGrid(), pausetime);
LogPathing("Paused Wandering requested. Grid [{}]. Resuming in [{}] ms (0=not until told)", GetGrid(), pausetime);
StopNavigation();
if (pausetime < 1) { // negative grid number stops him dead in his tracks until ResumeWandering()
SetGrid(0 - GetGrid());
@@ -170,7 +169,7 @@ void NPC::PauseWandering(int pausetime)
}
}
else {
Log(Logs::General, Logs::Error, "NPC not on grid - can't pause wandering: %lu", (unsigned long)GetNPCTypeID());
LogError("NPC not on grid - can't pause wandering: [{}]", (unsigned long)GetNPCTypeID());
}
return;
}
@@ -180,19 +179,14 @@ void NPC::MoveTo(const glm::vec4 &position, bool saveguardspot)
if (IsNPC() && GetGrid() != 0) { // he is on a grid
if (GetGrid() < 0) { // currently stopped by a quest command
SetGrid(0 - GetGrid()); // get him moving again
Log(Logs::Detail,
Logs::AI,
"MoveTo during quest wandering. Canceling quest wandering and going back to grid %d when MoveTo is done.",
GetGrid());
LogAI("MoveTo during quest wandering. Canceling quest wandering and going back to grid [{}] when MoveTo is done", GetGrid());
}
AI_walking_timer->Disable(); // disable timer in case he is paused at a wp
if (cur_wp >= 0) { // we've not already done a MoveTo()
save_wp = cur_wp; // save the current waypoint
cur_wp = EQEmu::WaypointStatus::QuestControlGrid;
}
Log(Logs::Detail,
Logs::AI,
"MoveTo %s, pausing regular grid wandering. Grid %d, save_wp %d",
LogAI("MoveTo [{}], pausing regular grid wandering. Grid [{}], save_wp [{}]",
to_string(static_cast<glm::vec3>(position)).c_str(),
-GetGrid(),
save_wp);
@@ -201,7 +195,7 @@ void NPC::MoveTo(const glm::vec4 &position, bool saveguardspot)
roamer = true;
save_wp = 0;
cur_wp = EQEmu::WaypointStatus::QuestControlNoGrid;
Log(Logs::Detail, Logs::AI, "MoveTo %s without a grid.", to_string(static_cast<glm::vec3>(position)).c_str());
LogAI("MoveTo [{}] without a grid", to_string(static_cast<glm::vec3>(position)).c_str());
}
glm::vec3 dest(position);
@@ -219,10 +213,7 @@ void NPC::MoveTo(const glm::vec4 &position, bool saveguardspot)
if (m_GuardPoint.w == -1)
m_GuardPoint.w = this->CalculateHeadingToTarget(position.x, position.y);
Log(Logs::Detail,
Logs::AI,
"Setting guard position to %s",
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());
}
cur_wp_pause = 0;
@@ -235,7 +226,7 @@ void NPC::MoveTo(const glm::vec4 &position, bool saveguardspot)
void NPC::UpdateWaypoint(int wp_index)
{
if (wp_index >= static_cast<int>(Waypoints.size())) {
Log(Logs::Detail, Logs::AI, "Update to waypoint %d failed. Not found.", wp_index);
LogAI("Update to waypoint [{}] failed. Not found", wp_index);
return;
}
std::vector<wplist>::iterator cur;
@@ -244,7 +235,7 @@ void NPC::UpdateWaypoint(int wp_index)
m_CurrentWayPoint = glm::vec4(cur->x, cur->y, cur->z, cur->heading);
cur_wp_pause = cur->pause;
Log(Logs::Detail, Logs::AI, "Next waypoint %d: (%.3f, %.3f, %.3f, %.3f)", wp_index, m_CurrentWayPoint.x, m_CurrentWayPoint.y, m_CurrentWayPoint.z, m_CurrentWayPoint.w);
LogAI("Next waypoint [{}]: ({}, {}, {}, {})", wp_index, m_CurrentWayPoint.x, m_CurrentWayPoint.y, m_CurrentWayPoint.z, m_CurrentWayPoint.w);
}
@@ -432,7 +423,7 @@ void NPC::SaveGuardSpot(const glm::vec4 &pos)
if (m_GuardPoint.w == 0)
m_GuardPoint.w = 0.0001; //hack to make IsGuarding simpler
LogF(Logs::Detail, Logs::AI, "Setting guard position to {0}", to_string(static_cast<glm::vec3>(m_GuardPoint)));
LogAI("Setting guard position to {0}", to_string(static_cast<glm::vec3>(m_GuardPoint)));
}
void NPC::NextGuardPosition() {
@@ -566,7 +557,7 @@ void Mob::SendTo(float new_x, float new_y, float new_z) {
m_Position.x = new_x;
m_Position.y = new_y;
m_Position.z = new_z;
Log(Logs::Detail, Logs::AI, "Sent To (%.3f, %.3f, %.3f)", new_x, new_y, new_z);
LogAI("Sent To ({}, {}, {})", new_x, new_y, new_z);
if (flymode == GravityBehavior::Flying)
return;
@@ -582,7 +573,7 @@ void Mob::SendTo(float new_x, float new_y, float new_z) {
float newz = zone->zonemap->FindBestZ(dest, nullptr);
Log(Logs::Detail, Logs::AI, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz, m_Position.x, m_Position.y, m_Position.z);
LogAI("BestZ returned {} at {}, {}, {}", newz, m_Position.x, m_Position.y, m_Position.z);
if ((newz > -2000) && std::abs(newz - dest.z) < RuleR(Map, FixPathingZMaxDeltaSendTo)) // Sanity check.
m_Position.z = newz + 1;
@@ -610,7 +601,7 @@ void Mob::SendToFixZ(float new_x, float new_y, float new_z) {
float newz = zone->zonemap->FindBestZ(dest, nullptr);
Log(Logs::Moderate, Logs::Pathing, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz, m_Position.x, m_Position.y, m_Position.z);
LogPathing("BestZ returned [{}] at [{}], [{}], [{}]", newz, m_Position.x, m_Position.y, m_Position.z);
if ((newz > -2000) && std::abs(newz - dest.z) < RuleR(Map, FixPathingZMaxDeltaSendTo)) // Sanity check.
m_Position.z = newz + 1;
@@ -646,9 +637,7 @@ float Mob::GetFixedZ(const glm::vec3 &destination, int32 z_find_offset) {
auto duration = timer.elapsed();
Log(Logs::Moderate,
Logs::FixZ,
"Mob::GetFixedZ() (%s) returned %4.3f at %4.3f, %4.3f, %4.3f - Took %lf",
LogFixZ("Mob::GetFixedZ() ([{}]) returned [{}] at [{}], [{}], [{}] - Took [{}]",
this->GetCleanName(),
new_z,
destination.x,
@@ -691,11 +680,7 @@ void Mob::FixZ(int32 z_find_offset /*= 5*/, bool fix_client_z /*= false*/) {
this->SendAppearanceEffect(103, 0, 0, 0, 0);
}
Log(Logs::General,
Logs::FixZ,
"%s is failing to find Z %f",
this->GetCleanName(),
std::abs(m_Position.z - new_z));
LogFixZ("[{}] is failing to find Z [{}]", this->GetCleanName(), std::abs(m_Position.z - new_z));
}
}
+36 -28
View File
@@ -85,6 +85,8 @@ void WorldServer::Connect()
});
m_connection->OnMessage(std::bind(&WorldServer::HandleMessage, this, std::placeholders::_1, std::placeholders::_2));
m_keepalive.reset(new EQ::Timer(2500, true, std::bind(&WorldServer::OnKeepAlive, this, std::placeholders::_1)));
}
bool WorldServer::SendPacket(ServerPacket *pack)
@@ -191,7 +193,7 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
if (pack->size != sizeof(ServerConnectInfo))
break;
ServerConnectInfo* sci = (ServerConnectInfo*)pack->pBuffer;
Log(Logs::Detail, Logs::Zone_Server, "World assigned Port: %d for this zone.", sci->port);
LogInfo("World assigned Port: [{}] for this zone", sci->port);
ZoneConfig::SetZonePort(sci->port);
break;
}
@@ -423,12 +425,12 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
}
}
else {
Log(Logs::Detail, Logs::None, "[CLIENT] id=%i, playerineqstring=%i, playersinzonestring=%i. Dumping WhoAllReturnStruct:",
LogDebug("[CLIENT] id=[{}], playerineqstring=[{}], playersinzonestring=[{}]. Dumping WhoAllReturnStruct:",
wars->id, wars->playerineqstring, wars->playersinzonestring);
}
}
else
Log(Logs::General, Logs::Error, "WhoAllReturnStruct: Could not get return struct!");
LogError("WhoAllReturnStruct: Could not get return struct!");
break;
}
case ServerOP_EmoteMessage: {
@@ -563,7 +565,7 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
ServerZoneDropClient_Struct* drop = (ServerZoneDropClient_Struct*)pack->pBuffer;
if (zone) {
zone->RemoveAuth(drop->lsid);
auto client = entity_list.GetClientByLSID(drop->lsid);
if (client) {
client->Kick("Dropped by world CLE subsystem");
@@ -747,7 +749,7 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
//pendingrezexp is the amount of XP on the corpse. Setting it to a value >= 0
//also serves to inform Client::OPRezzAnswer to expect a packet.
client->SetPendingRezzData(srs->exp, srs->dbid, srs->rez.spellid, srs->rez.corpse_name);
Log(Logs::Detail, Logs::Spells, "OP_RezzRequest in zone %s for %s, spellid:%i",
LogSpells("OP_RezzRequest in zone [{}] for [{}], spellid:[{}]",
zone->GetShortName(), client->GetName(), srs->rez.spellid);
auto outapp = new EQApplicationPacket(OP_RezzRequest,
sizeof(Resurrect_Struct));
@@ -762,10 +764,10 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
// to the zone that the corpse is in.
Corpse* corpse = entity_list.GetCorpseByName(srs->rez.corpse_name);
if (corpse && corpse->IsCorpse()) {
Log(Logs::Detail, Logs::Spells, "OP_RezzComplete received in zone %s for corpse %s",
LogSpells("OP_RezzComplete received in zone [{}] for corpse [{}]",
zone->GetShortName(), srs->rez.corpse_name);
Log(Logs::Detail, Logs::Spells, "Found corpse. Marking corpse as rezzed if needed.");
LogSpells("Found corpse. Marking corpse as rezzed if needed");
// I don't know why Rezzed is not set to true in CompleteRezz().
if (!IsEffectInSpell(srs->rez.spellid, SE_SummonToCorpse)) {
corpse->IsRezzed(true);
@@ -794,7 +796,7 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
}
case ServerOP_SyncWorldTime: {
if (zone != 0 && !zone->is_zone_time_localized) {
Log(Logs::Moderate, Logs::Zone_Server, "%s Received Message SyncWorldTime", __FUNCTION__);
LogInfo("[{}] Received Message SyncWorldTime", __FUNCTION__);
eqTimeOfDay* newtime = (eqTimeOfDay*)pack->pBuffer;
zone->zone_time.SetCurrentEQTimeOfDay(newtime->start_eqtime, newtime->start_realtime);
@@ -816,18 +818,18 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
(eq_time.hour >= 13) ? "pm" : "am"
);
Log(Logs::General, Logs::Zone_Server, "Time Broadcast Packet: %s", time_message);
LogInfo("Time Broadcast Packet: {}", time_message);
zone->SetZoneHasCurrentTime(true);
}
if (zone && zone->is_zone_time_localized) {
Log(Logs::General, Logs::Zone_Server, "Received request to sync time from world, but our time is localized currently");
LogInfo("Received request to sync time from world, but our time is localized currently");
}
break;
}
case ServerOP_RefreshCensorship: {
if (!EQEmu::ProfanityManager::LoadProfanityList(&database))
Log(Logs::General, Logs::Error, "Received request to refresh the profanity list..but, the action failed");
LogError("Received request to refresh the profanity list..but, the action failed");
break;
}
case ServerOP_ChangeWID: {
@@ -1436,7 +1438,7 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
if (NewCorpse)
NewCorpse->Spawn();
else
Log(Logs::General, Logs::Error, "Unable to load player corpse id %u for zone %s.", s->player_corpse_id, zone->GetShortName());
LogError("Unable to load player corpse id [{}] for zone [{}]", s->player_corpse_id, zone->GetShortName());
break;
}
@@ -1942,34 +1944,34 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
case ServerOP_ChangeSharedMem:
{
std::string hotfix_name = std::string((char*)pack->pBuffer);
Log(Logs::General, Logs::Zone_Server, "Loading items");
LogInfo("Loading items");
if (!database.LoadItems(hotfix_name)) {
Log(Logs::General, Logs::Error, "Loading items FAILED!");
LogError("Loading items failed!");
}
Log(Logs::General, Logs::Zone_Server, "Loading npc faction lists");
LogInfo("Loading npc faction lists");
if (!database.LoadNPCFactionLists(hotfix_name)) {
Log(Logs::General, Logs::Error, "Loading npcs faction lists FAILED!");
LogError("Loading npcs faction lists failed!");
}
Log(Logs::General, Logs::Zone_Server, "Loading loot tables");
LogInfo("Loading loot tables");
if (!database.LoadLoot(hotfix_name)) {
Log(Logs::General, Logs::Error, "Loading loot FAILED!");
LogError("Loading loot failed!");
}
Log(Logs::General, Logs::Zone_Server, "Loading skill caps");
LogInfo("Loading skill caps");
if (!database.LoadSkillCaps(std::string(hotfix_name))) {
Log(Logs::General, Logs::Error, "Loading skill caps FAILED!");
LogError("Loading skill caps failed!");
}
Log(Logs::General, Logs::Zone_Server, "Loading spells");
LogInfo("Loading spells");
if (!database.LoadSpells(hotfix_name, &SPDAT_RECORDS, &spells)) {
Log(Logs::General, Logs::Error, "Loading spells FAILED!");
LogError("Loading spells failed!");
}
Log(Logs::General, Logs::Zone_Server, "Loading base data");
LogInfo("Loading base data");
if (!database.LoadBaseData(hotfix_name)) {
Log(Logs::General, Logs::Error, "Loading base data FAILED!");
LogError("Loading base data failed!");
}
break;
}
@@ -2103,7 +2105,7 @@ bool WorldServer::SendVoiceMacro(Client* From, uint32 Type, char* Target, uint32
bool WorldServer::RezzPlayer(EQApplicationPacket* rpack, uint32 rezzexp, uint32 dbid, uint16 opcode)
{
Log(Logs::Detail, Logs::Spells, "WorldServer::RezzPlayer rezzexp is %i (0 is normal for RezzComplete", rezzexp);
LogSpells("WorldServer::RezzPlayer rezzexp is [{}] (0 is normal for RezzComplete", rezzexp);
auto pack = new ServerPacket(ServerOP_RezzPlayer, sizeof(RezzPlayer_Struct));
RezzPlayer_Struct* sem = (RezzPlayer_Struct*)pack->pBuffer;
sem->rezzopcode = opcode;
@@ -2112,9 +2114,9 @@ bool WorldServer::RezzPlayer(EQApplicationPacket* rpack, uint32 rezzexp, uint32
sem->dbid = dbid;
bool ret = SendPacket(pack);
if (ret)
Log(Logs::Detail, Logs::Spells, "Sending player rezz packet to world spellid:%i", sem->rez.spellid);
LogSpells("Sending player rezz packet to world spellid:[{}]", sem->rez.spellid);
else
Log(Logs::Detail, Logs::Spells, "NOT Sending player rezz packet to world");
LogSpells("NOT Sending player rezz packet to world");
safe_delete(pack);
return ret;
@@ -2190,7 +2192,7 @@ uint32 WorldServer::NextGroupID() {
if (cur_groupid >= last_groupid) {
//this is an error... This means that 50 groups were created before
//1 packet could make the zone->world->zone trip... so let it error.
Log(Logs::General, Logs::Error, "Ran out of group IDs before the server sent us more.");
LogError("Ran out of group IDs before the server sent us more");
return(0);
}
if (cur_groupid > (last_groupid - /*50*/995)) {
@@ -2352,3 +2354,9 @@ void WorldServer::RequestTellQueue(const char *who)
safe_delete(pack);
return;
}
void WorldServer::OnKeepAlive(EQ::Timer *t)
{
ServerPacket pack(ServerOP_KeepAlive, 0);
SendPacket(&pack);
}
+3
View File
@@ -72,7 +72,10 @@ private:
uint32 cur_groupid;
uint32 last_groupid;
void OnKeepAlive(EQ::Timer *t);
std::unique_ptr<EQ::Net::ServertalkClient> m_connection;
std::unique_ptr<EQ::Timer> m_keepalive;
};
#endif
+173 -181
View File
@@ -92,7 +92,7 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) {
return false;
}
Log(Logs::General, Logs::Status, "Booting %s (%d:%d)", zonename, iZoneID, iInstanceID);
LogInfo("Booting [{}] ([{}]:[{}])", zonename, iZoneID, iInstanceID);
numclients = 0;
zone = new Zone(iZoneID, iInstanceID, zonename);
@@ -117,13 +117,13 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) {
log_levels[i]=0; //set to zero on a bogue char
}
zone->loglevelvar = log_levels[0];
Log(Logs::General, Logs::Status, "General logging level: %i", zone->loglevelvar);
LogInfo("General logging level: [{}]", zone->loglevelvar);
zone->merchantvar = log_levels[1];
Log(Logs::General, Logs::Status, "Merchant logging level: %i", zone->merchantvar);
LogInfo("Merchant logging level: [{}]", zone->merchantvar);
zone->tradevar = log_levels[2];
Log(Logs::General, Logs::Status, "Trade logging level: %i", zone->tradevar);
LogInfo("Trade logging level: [{}]", zone->tradevar);
zone->lootvar = log_levels[3];
Log(Logs::General, Logs::Status, "Loot logging level: %i", zone->lootvar);
LogInfo("Loot logging level: [{}]", zone->lootvar);
}
else {
zone->loglevelvar = uint8(tmp_i); //continue supporting only command logging (for now)
@@ -144,8 +144,8 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) {
delete pack;
}
Log(Logs::General, Logs::Normal, "---- Zone server %s, listening on port:%i ----", zonename, ZoneConfig::get()->ZonePort);
Log(Logs::General, Logs::Status, "Zone Bootup: %s (%i: %i)", zonename, iZoneID, iInstanceID);
LogInfo("---- Zone server [{}], listening on port:[{}] ----", zonename, ZoneConfig::get()->ZonePort);
LogInfo("Zone Bootup: [{}] ([{}]: [{}])", zonename, iZoneID, iInstanceID);
parse->Init();
UpdateWindowTitle();
zone->GetTimeSync();
@@ -176,12 +176,12 @@ bool Zone::LoadZoneObjects()
zoneid, instanceversion);
auto results = database.QueryDatabase(query);
if (!results.Success()) {
Log(Logs::General, Logs::Error, "Error Loading Objects from DB: %s",
LogError("Error Loading Objects from DB: [{}]",
results.ErrorMessage().c_str());
return false;
}
Log(Logs::General, Logs::Status, "Loading Objects from DB...");
LogInfo("Loading Objects from DB");
for (auto row = results.begin(); row != results.end(); ++row) {
if (atoi(row[9]) == 0) {
// Type == 0 - Static Object
@@ -300,7 +300,7 @@ bool Zone::LoadGroundSpawns() {
memset(&groundspawn, 0, sizeof(groundspawn));
int gsindex=0;
Log(Logs::General, Logs::Status, "Loading Ground Spawns from DB...");
LogInfo("Loading Ground Spawns from DB");
database.LoadGroundSpawns(zoneid, GetInstanceVersion(), &groundspawn);
uint32 ix=0;
char* name = nullptr;
@@ -419,7 +419,7 @@ uint32 Zone::GetTempMerchantQuantity(uint32 NPCID, uint32 Slot) {
}
void Zone::LoadTempMerchantData() {
Log(Logs::General, Logs::Status, "Loading Temporary Merchant Lists...");
LogInfo("Loading Temporary Merchant Lists");
std::string query = StringFormat(
"SELECT "
"DISTINCT ml.npcid, "
@@ -489,7 +489,7 @@ void Zone::LoadNewMerchantData(uint32 merchantid) {
}
void Zone::GetMerchantDataForZoneLoad() {
Log(Logs::General, Logs::Status, "Loading Merchant Lists...");
LogInfo("Loading Merchant Lists");
std::string query = StringFormat(
"SELECT "
"DISTINCT ml.merchantid, "
@@ -512,7 +512,7 @@ void Zone::GetMerchantDataForZoneLoad() {
std::map<uint32, std::list<MerchantList> >::iterator cur;
uint32 npcid = 0;
if (results.RowCount() == 0) {
Log(Logs::General, Logs::None, "No Merchant Data found for %s.", GetShortName());
LogDebug("No Merchant Data found for [{}]", GetShortName());
return;
}
for (auto row = results.begin(); row != results.end(); ++row) {
@@ -560,18 +560,18 @@ void Zone::LoadMercTemplates(){
merc_templates.clear();
std::string query = "SELECT `class_id`, `proficiency_id`, `stance_id`, `isdefault` FROM "
"`merc_stance_entries` ORDER BY `class_id`, `proficiency_id`, `stance_id`";
auto results = database.QueryDatabase(query);
auto results = database.QueryDatabase(query);
if (!results.Success()) {
Log(Logs::General, Logs::Error, "Error in ZoneDatabase::LoadMercTemplates()");
LogError("Error in ZoneDatabase::LoadMercTemplates()");
}
else {
for (auto row = results.begin(); row != results.end(); ++row) {
MercStanceInfo tempMercStanceInfo;
tempMercStanceInfo.ClassID = atoi(row[0]);
tempMercStanceInfo.ClassID = atoi(row[0]);
tempMercStanceInfo.ProficiencyID = atoi(row[1]);
tempMercStanceInfo.StanceID = atoi(row[2]);
tempMercStanceInfo.IsDefault = atoi(row[3]);
tempMercStanceInfo.StanceID = atoi(row[2]);
tempMercStanceInfo.IsDefault = atoi(row[3]);
merc_stances.push_back(tempMercStanceInfo);
}
@@ -583,11 +583,11 @@ void Zone::LoadMercTemplates(){
"AS CostFormula, MTem.clientversion, MTem.merc_npc_type_id "
"FROM merc_types MTyp, merc_templates MTem, merc_subtypes MS "
"WHERE MTem.merc_type_id = MTyp.merc_type_id AND MTem.merc_subtype_id = MS.merc_subtype_id "
"ORDER BY MTyp.race_id, MS.class_id, MTyp.proficiency_id;";
results = database.QueryDatabase(query);
if (!results.Success()) {
Log(Logs::General, Logs::Error, "Error in ZoneDatabase::LoadMercTemplates()");
return;
"ORDER BY MTyp.race_id, MS.class_id, MTyp.proficiency_id;";
results = database.QueryDatabase(query);
if (!results.Success()) {
LogError("Error in ZoneDatabase::LoadMercTemplates()");
return;
}
for (auto row = results.begin(); row != results.end(); ++row) {
@@ -630,7 +630,7 @@ void Zone::LoadLevelEXPMods(){
const std::string query = "SELECT level, exp_mod, aa_exp_mod FROM level_exp_mods";
auto results = database.QueryDatabase(query);
if (!results.Success()) {
Log(Logs::General, Logs::Error, "Error in ZoneDatabase::LoadEXPLevelMods()");
LogError("Error in ZoneDatabase::LoadEXPLevelMods()");
return;
}
@@ -652,11 +652,11 @@ void Zone::LoadMercSpells(){
"FROM merc_spell_lists msl, merc_spell_list_entries msle "
"WHERE msle.merc_spell_list_id = msl.merc_spell_list_id "
"ORDER BY msl.class_id, msl.proficiency_id, msle.spell_type, msle.minlevel, msle.slot;";
auto results = database.QueryDatabase(query);
if (!results.Success()) {
Log(Logs::General, Logs::Error, "Error in Zone::LoadMercSpells()");
return;
}
auto results = database.QueryDatabase(query);
if (!results.Success()) {
LogError("Error in Zone::LoadMercSpells()");
return;
}
for (auto row = results.begin(); row != results.end(); ++row) {
uint32 classid;
@@ -683,42 +683,44 @@ bool Zone::IsLoaded() {
return is_zone_loaded;
}
void Zone::Shutdown(bool quite)
void Zone::Shutdown(bool quiet)
{
if (!is_zone_loaded)
if (!is_zone_loaded) {
return;
}
entity_list.StopMobAI();
std::map<uint32,NPCType *>::iterator itr;
while(!zone->npctable.empty()) {
itr=zone->npctable.begin();
std::map<uint32, NPCType *>::iterator itr;
while (!zone->npctable.empty()) {
itr = zone->npctable.begin();
delete itr->second;
zone->npctable.erase(itr);
}
while(!zone->merctable.empty()) {
itr=zone->merctable.begin();
while (!zone->merctable.empty()) {
itr = zone->merctable.begin();
delete itr->second;
zone->merctable.erase(itr);
}
zone->adventure_entry_list_flavor.clear();
std::map<uint32,LDoNTrapTemplate*>::iterator itr4;
while(!zone->ldon_trap_list.empty())
{
std::map<uint32, LDoNTrapTemplate *>::iterator itr4;
while (!zone->ldon_trap_list.empty()) {
itr4 = zone->ldon_trap_list.begin();
delete itr4->second;
zone->ldon_trap_list.erase(itr4);
}
zone->ldon_trap_entry_list.clear();
Log(Logs::General, Logs::Status, "Zone Shutdown: %s (%i)", zone->GetShortName(), zone->GetZoneID());
LogInfo("Zone Shutdown: [{}] ([{}])", zone->GetShortName(), zone->GetZoneID());
petition_list.ClearPetitions();
zone->SetZoneHasCurrentTime(false);
if (!quite)
Log(Logs::General, Logs::Normal, "Zone shutdown: going to sleep");
if (!quiet) {
LogInfo("Zone Shutdown: Going to sleep");
}
is_zone_loaded = false;
zone->ResetAuth();
@@ -728,23 +730,28 @@ void Zone::Shutdown(bool quite)
UpdateWindowTitle();
LogSys.CloseFileLogs();
if (RuleB(Zone, KillProcessOnDynamicShutdown)) {
LogInfo("[KillProcessOnDynamicShutdown] Shutting down");
std::exit(EXIT_SUCCESS);
}
}
void Zone::LoadZoneDoors(const char* zone, int16 version)
{
Log(Logs::General, Logs::Status, "Loading doors for %s ...", zone);
LogInfo("Loading doors for [{}] ", zone);
uint32 maxid;
int32 count = database.GetDoorsCount(&maxid, zone, version);
if(count < 1) {
Log(Logs::General, Logs::Status, "... No doors loaded.");
LogInfo("No doors loaded");
return;
}
auto dlist = new Door[count];
if(!database.LoadDoors(count, dlist, zone, version)) {
Log(Logs::General, Logs::Error, "... Failed to load doors.");
LogError("Failed to load doors");
delete[] dlist;
return;
}
@@ -805,14 +812,14 @@ Zone::Zone(uint32 in_zoneid, uint32 in_instanceid, const char* in_short_name)
database.GetZoneLongName(short_name, &long_name, file_name, &m_SafePoint.x, &m_SafePoint.y, &m_SafePoint.z, &pgraveyard_id, &pMaxClients);
if(graveyard_id() > 0)
{
Log(Logs::General, Logs::None, "Graveyard ID is %i.", graveyard_id());
LogDebug("Graveyard ID is [{}]", graveyard_id());
bool GraveYardLoaded = database.GetZoneGraveyard(graveyard_id(), &pgraveyard_zoneid, &m_Graveyard.x, &m_Graveyard.y, &m_Graveyard.z, &m_Graveyard.w);
if (GraveYardLoaded) {
Log(Logs::General, Logs::None, "Loaded a graveyard for zone %s: graveyard zoneid is %u at %s.", short_name, graveyard_zoneid(), to_string(m_Graveyard).c_str());
LogDebug("Loaded a graveyard for zone [{}]: graveyard zoneid is [{}] at [{}]", short_name, graveyard_zoneid(), to_string(m_Graveyard).c_str());
}
else {
Log(Logs::General, Logs::Error, "Unable to load the graveyard id %i for zone %s.", graveyard_id(), short_name);
LogError("Unable to load the graveyard id [{}] for zone [{}]", graveyard_id(), short_name);
}
}
if (long_name == 0) {
@@ -821,12 +828,12 @@ Zone::Zone(uint32 in_zoneid, uint32 in_instanceid, const char* in_short_name)
autoshutdown_timer.Start(AUTHENTICATION_TIMEOUT * 1000, false);
Weather_Timer = new Timer(60000);
Weather_Timer->Start();
Log(Logs::General, Logs::None, "The next weather check for zone: %s will be in %i seconds.", short_name, Weather_Timer->GetRemainingTime()/1000);
zone_weather = 0;
weather_intensity = 0;
blocked_spells = nullptr;
totalBS = 0;
zone_has_current_time = false;
LogDebug("The next weather check for zone: [{}] will be in [{}] seconds", short_name, Weather_Timer->GetRemainingTime()/1000);
zone_weather = 0;
weather_intensity = 0;
blocked_spells = nullptr;
zone_total_blocked_spells = 0;
zone_has_current_time = false;
Instance_Shutdown_Timer = nullptr;
bool is_perma = false;
@@ -915,64 +922,64 @@ bool Zone::Init(bool iStaticZone) {
zone->watermap = WaterMap::LoadWaterMapfile(zone->map_name);
zone->pathing = IPathfinder::Load(zone->map_name);
Log(Logs::General, Logs::Status, "Loading spawn conditions...");
LogInfo("Loading spawn conditions");
if(!spawn_conditions.LoadSpawnConditions(short_name, instanceid)) {
Log(Logs::General, Logs::Error, "Loading spawn conditions failed, continuing without them.");
LogError("Loading spawn conditions failed, continuing without them");
}
Log(Logs::General, Logs::Status, "Loading static zone points...");
LogInfo("Loading static zone points");
if (!database.LoadStaticZonePoints(&zone_point_list, short_name, GetInstanceVersion())) {
Log(Logs::General, Logs::Error, "Loading static zone points failed.");
LogError("Loading static zone points failed");
return false;
}
Log(Logs::General, Logs::Status, "Loading spawn groups...");
LogInfo("Loading spawn groups");
if (!database.LoadSpawnGroups(short_name, GetInstanceVersion(), &spawn_group_list)) {
Log(Logs::General, Logs::Error, "Loading spawn groups failed.");
LogError("Loading spawn groups failed");
return false;
}
Log(Logs::General, Logs::Status, "Loading spawn2 points...");
LogInfo("Loading spawn2 points");
if (!database.PopulateZoneSpawnList(zoneid, spawn2_list, GetInstanceVersion()))
{
Log(Logs::General, Logs::Error, "Loading spawn2 points failed.");
LogError("Loading spawn2 points failed");
return false;
}
Log(Logs::General, Logs::Status, "Loading player corpses...");
LogInfo("Loading player corpses");
if (!database.LoadCharacterCorpses(zoneid, instanceid)) {
Log(Logs::General, Logs::Error, "Loading player corpses failed.");
LogError("Loading player corpses failed");
return false;
}
Log(Logs::General, Logs::Status, "Loading traps...");
LogInfo("Loading traps");
if (!database.LoadTraps(short_name, GetInstanceVersion()))
{
Log(Logs::General, Logs::Error, "Loading traps failed.");
LogError("Loading traps failed");
return false;
}
Log(Logs::General, Logs::Status, "Loading adventure flavor text...");
LogInfo("Loading adventure flavor text");
LoadAdventureFlavor();
Log(Logs::General, Logs::Status, "Loading ground spawns...");
LogInfo("Loading ground spawns");
if (!LoadGroundSpawns())
{
Log(Logs::General, Logs::Error, "Loading ground spawns failed. continuing.");
LogError("Loading ground spawns failed. continuing");
}
Log(Logs::General, Logs::Status, "Loading World Objects from DB...");
LogInfo("Loading World Objects from DB");
if (!LoadZoneObjects())
{
Log(Logs::General, Logs::Error, "Loading World Objects failed. continuing.");
LogError("Loading World Objects failed. continuing");
}
Log(Logs::General, Logs::Status, "Flushing old respawn timers...");
LogInfo("Flushing old respawn timers");
database.QueryDatabase("DELETE FROM `respawn_times` WHERE (`start` + `duration`) < UNIX_TIMESTAMP(NOW())");
//load up the zone's doors (prints inside)
zone->LoadZoneDoors(zone->GetShortName(), zone->GetInstanceVersion());
zone->LoadBlockedSpells(zone->GetZoneID());
zone->LoadZoneBlockedSpells(zone->GetZoneID());
//clear trader items if we are loading the bazaar
if(strncasecmp(short_name,"bazaar",6)==0) {
@@ -1008,10 +1015,10 @@ bool Zone::Init(bool iStaticZone) {
petition_list.ClearPetitions();
petition_list.ReadDatabase();
Log(Logs::General, Logs::Status, "Loading timezone data...");
LogInfo("Loading timezone data");
zone->zone_time.setEQTimeZone(database.GetZoneTZ(zoneid, GetInstanceVersion()));
Log(Logs::General, Logs::Status, "Init Finished: ZoneID = %d, Time Offset = %d", zoneid, zone->zone_time.getEQTimeZone());
LogInfo("Init Finished: ZoneID = [{}], Time Offset = [{}]", zoneid, zone->zone_time.getEQTimeZone());
LoadTickItems();
@@ -1022,32 +1029,32 @@ bool Zone::Init(bool iStaticZone) {
}
void Zone::ReloadStaticData() {
Log(Logs::General, Logs::Status, "Reloading Zone Static Data...");
LogInfo("Reloading Zone Static Data");
Log(Logs::General, Logs::Status, "Reloading static zone points...");
LogInfo("Reloading static zone points");
zone_point_list.Clear();
if (!database.LoadStaticZonePoints(&zone_point_list, GetShortName(), GetInstanceVersion())) {
Log(Logs::General, Logs::Error, "Loading static zone points failed.");
LogError("Loading static zone points failed");
}
Log(Logs::General, Logs::Status, "Reloading traps...");
LogInfo("Reloading traps");
entity_list.RemoveAllTraps();
if (!database.LoadTraps(GetShortName(), GetInstanceVersion()))
{
Log(Logs::General, Logs::Error, "Reloading traps failed.");
LogError("Reloading traps failed");
}
Log(Logs::General, Logs::Status, "Reloading ground spawns...");
LogInfo("Reloading ground spawns");
if (!LoadGroundSpawns())
{
Log(Logs::General, Logs::Error, "Reloading ground spawns failed. continuing.");
LogError("Reloading ground spawns failed. continuing");
}
entity_list.RemoveAllObjects();
Log(Logs::General, Logs::Status, "Reloading World Objects from DB...");
LogInfo("Reloading World Objects from DB");
if (!LoadZoneObjects())
{
Log(Logs::General, Logs::Error, "Reloading World Objects failed. continuing.");
LogError("Reloading World Objects failed. continuing");
}
entity_list.RemoveAllDoors();
@@ -1063,7 +1070,7 @@ void Zone::ReloadStaticData() {
if (!LoadZoneCFG(zone->GetShortName(), zone->GetInstanceVersion())) // try loading the zone name...
LoadZoneCFG(zone->GetFileName(), zone->GetInstanceVersion()); // if that fails, try the file name, then load defaults
Log(Logs::General, Logs::Status, "Zone Static Data Reloaded.");
LogInfo("Zone Static Data Reloaded");
}
bool Zone::LoadZoneCFG(const char* filename, uint16 instance_id)
@@ -1082,7 +1089,7 @@ bool Zone::LoadZoneCFG(const char* filename, uint16 instance_id)
if(!database.GetZoneCFG(database.GetZoneID(filename), 0, &newzone_data, can_bind, can_combat, can_levitate,
can_castoutdoor, is_city, is_hotzone, allow_mercs, max_movement_update_range, zone_type, default_ruleset, &map_name))
{
Log(Logs::General, Logs::Error, "Error loading the Zone Config.");
LogError("Error loading the Zone Config");
return false;
}
}
@@ -1093,7 +1100,7 @@ bool Zone::LoadZoneCFG(const char* filename, uint16 instance_id)
strcpy(newzone_data.zone_long_name, GetLongName());
strcpy(newzone_data.zone_short_name2, GetShortName());
Log(Logs::General, Logs::Status, "Successfully loaded Zone Config.");
LogInfo("Successfully loaded Zone Config");
return true;
}
@@ -1203,7 +1210,7 @@ bool Zone::Process() {
EQEmu::InventoryProfile::CleanDirty();
Log(Logs::Detail, Logs::Spawns, "Running Zone::Process -> Spawn2::Process");
LogSpawns("Running Zone::Process -> Spawn2::Process");
iterator.Reset();
while (iterator.MoreElements()) {
@@ -1423,11 +1430,11 @@ void Zone::ChangeWeather()
weathertimer = weatherTimerRule*1000;
Weather_Timer->Start(weathertimer);
}
Log(Logs::General, Logs::None, "The next weather check for zone: %s will be in %i seconds.", zone->GetShortName(), Weather_Timer->GetRemainingTime()/1000);
LogDebug("The next weather check for zone: [{}] will be in [{}] seconds", zone->GetShortName(), Weather_Timer->GetRemainingTime()/1000);
}
else
{
Log(Logs::General, Logs::None, "The weather for zone: %s has changed. Old weather was = %i. New weather is = %i The next check will be in %i seconds. Rain chance: %i, Rain duration: %i, Snow chance %i, Snow duration: %i", 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();
if (zone->weather_intensity == 0)
{
@@ -1458,16 +1465,12 @@ void Zone::StartShutdownTimer(uint32 set_time) {
if (set_time == (RuleI(Zone, AutoShutdownDelay))) {
set_time = static_cast<uint32>(database.getZoneShutDownDelay(GetZoneID(), GetInstanceVersion()));
}
autoshutdown_timer.SetTimer(set_time);
Log(Logs::General, Logs::Zone_Server, "Zone::StartShutdownTimer set to %u", set_time);
LogDebug("Zone::StartShutdownTimer set to {}", set_time);
}
Log(Logs::Detail, Logs::Zone_Server,
"Zone::StartShutdownTimer trigger - set_time: %u remaining_time: %u diff: %i",
set_time,
autoshutdown_timer.GetRemainingTime(),
(set_time - autoshutdown_timer.GetRemainingTime())
);
LogDebug("Zone::StartShutdownTimer trigger - set_time: [{}] remaining_time: [{}] diff: [{}]", set_time, autoshutdown_timer.GetRemainingTime(), (set_time - autoshutdown_timer.GetRemainingTime()));
}
bool Zone::Depop(bool StartSpawnTimer) {
@@ -1528,7 +1531,7 @@ void Zone::RepopClose(const glm::vec4& client_position, uint32 repop_distance)
quest_manager.ClearAllTimers();
if (!database.PopulateZoneSpawnListClose(zoneid, spawn2_list, GetInstanceVersion(), client_position, repop_distance))
Log(Logs::General, Logs::None, "Error in Zone::Repop: database.PopulateZoneSpawnList failed");
LogDebug("Error in Zone::Repop: database.PopulateZoneSpawnList failed");
initgrids_timer.Start();
@@ -1556,7 +1559,7 @@ void Zone::Repop(uint32 delay)
quest_manager.ClearAllTimers();
if (!database.PopulateZoneSpawnList(zoneid, spawn2_list, GetInstanceVersion(), delay))
Log(Logs::General, Logs::None, "Error in Zone::Repop: database.PopulateZoneSpawnList failed");
LogDebug("Error in Zone::Repop: database.PopulateZoneSpawnList failed");
initgrids_timer.Start();
@@ -1606,7 +1609,7 @@ void Zone::SetTime(uint8 hour, uint8 minute, bool update_world /*= true*/)
/* By Default we update worlds time, but we can optionally no update world which updates the rest of the zone servers */
if (update_world){
Log(Logs::General, Logs::Zone_Server, "Setting master time on world server to: %d:%d (%d)\n", hour, minute, (int)eq_time_of_day->start_realtime);
LogInfo("Setting master time on world server to: {}:{} ({})\n", hour, minute, (int)eq_time_of_day->start_realtime);
worldserver.SendPacket(pack);
/* Set Time Localization Flag */
@@ -1615,7 +1618,7 @@ void Zone::SetTime(uint8 hour, uint8 minute, bool update_world /*= true*/)
/* When we don't update world, we are localizing ourselves, we become disjointed from normal syncs and set time locally */
else{
Log(Logs::General, Logs::Zone_Server, "Setting zone localized time...");
LogInfo("Setting zone localized time...");
zone->zone_time.SetCurrentEQTimeOfDay(eq_time_of_day->start_eqtime, eq_time_of_day->start_realtime);
auto outapp = new EQApplicationPacket(OP_TimeOfDay, sizeof(TimeOfDay_Struct));
@@ -1668,8 +1671,8 @@ ZonePoint* Zone::GetClosestZonePoint(const glm::vec3& location, uint32 to, Clien
if ((zone->HasWaterMap() && !zone->watermap->InZoneLine(glm::vec3(client->GetPosition()))) || (!zone->HasWaterMap() && closest_dist > 400.0f && closest_dist < max_distance2))
{
//TODO cheat detection
Log(Logs::General, Logs::Status, "WARNING: Closest zone point for zone id %d is %f, you might need to update your zone_points table if you dont arrive at the right spot.", to, closest_dist);
Log(Logs::General, Logs::Status, "<Real Zone Points>. %s", to_string(location).c_str());
LogInfo("WARNING: Closest zone point for zone id [{}] is [{}], you might need to update your zone_points table if you dont arrive at the right spot", to, closest_dist);
LogInfo("<Real Zone Points>. [{}]", to_string(location).c_str());
}
if(closest_dist > max_distance2)
@@ -1880,17 +1883,21 @@ bool ZoneDatabase::GetDecayTimes(npcDecayTimes_Struct *npcCorpseDecayTimes)
return true;
}
void Zone::weatherSend(Client* client)
void Zone::weatherSend(Client *client)
{
auto outapp = new EQApplicationPacket(OP_Weather, 8);
if(zone_weather>0)
outapp->pBuffer[0] = zone_weather-1;
if(zone_weather>0)
if (zone_weather > 0) {
outapp->pBuffer[0] = zone_weather - 1;
}
if (zone_weather > 0) {
outapp->pBuffer[4] = zone->weather_intensity;
if (client)
}
if (client) {
client->QueuePacket(outapp);
else
}
else {
entity_list.QueueClients(0, outapp);
}
safe_delete(outapp);
}
@@ -1908,16 +1915,14 @@ void Zone::SetGraveyard(uint32 zoneid, const glm::vec4& graveyardPosition) {
m_Graveyard = graveyardPosition;
}
void Zone::LoadBlockedSpells(uint32 zoneid)
void Zone::LoadZoneBlockedSpells(uint32 zone_id)
{
if(!blocked_spells)
{
totalBS = database.GetBlockedSpellsCount(zoneid);
if(totalBS > 0){
blocked_spells = new ZoneSpellsBlocked[totalBS];
if(!database.LoadBlockedSpells(totalBS, blocked_spells, zoneid))
{
Log(Logs::General, Logs::Error, "... Failed to load blocked spells.");
if (!blocked_spells) {
zone_total_blocked_spells = database.GetBlockedSpellsCount(zone_id);
if (zone_total_blocked_spells > 0) {
blocked_spells = new ZoneSpellsBlocked[zone_total_blocked_spells];
if (!database.LoadBlockedSpells(zone_total_blocked_spells, blocked_spells, zone_id)) {
LogError(" Failed to load blocked spells");
ClearBlockedSpells();
}
}
@@ -1926,102 +1931,89 @@ void Zone::LoadBlockedSpells(uint32 zoneid)
void Zone::ClearBlockedSpells()
{
if(blocked_spells){
if (blocked_spells) {
safe_delete_array(blocked_spells);
totalBS = 0;
zone_total_blocked_spells = 0;
}
}
bool Zone::IsSpellBlocked(uint32 spell_id, const glm::vec3& location)
bool Zone::IsSpellBlocked(uint32 spell_id, const glm::vec3 &location)
{
if (blocked_spells)
{
if (blocked_spells) {
bool exception = false;
bool block_all = false;
for (int x = 0; x < totalBS; x++)
{
if (blocked_spells[x].spellid == spell_id)
{
for (int x = 0; x < GetZoneTotalBlockedSpells(); x++) {
if (blocked_spells[x].spellid == spell_id) {
exception = true;
}
if (blocked_spells[x].spellid == 0)
{
if (blocked_spells[x].spellid == 0) {
block_all = true;
}
}
for (int x = 0; x < totalBS; x++)
{
// If spellid is 0, block all spells in the zone
if (block_all)
{
// If the same zone has entries other than spellid 0, they act as exceptions and are allowed
if (exception)
{
return false;
}
else
{
return true;
}
}
else
{
if (spell_id != blocked_spells[x].spellid)
{
continue;
}
// If all spells are blocked and this is an exception, it is not blocked
if (block_all && exception) {
return false;
}
switch (blocked_spells[x].type)
{
case 1:
{
for (int x = 0; x < GetZoneTotalBlockedSpells(); x++) {
// Spellid of 0 matches all spells
if (0 != blocked_spells[x].spellid && spell_id != blocked_spells[x].spellid) {
continue;
}
switch (blocked_spells[x].type) {
case ZoneBlockedSpellTypes::ZoneWide: {
return true;
break;
}
case ZoneBlockedSpellTypes::Region: {
if (IsWithinAxisAlignedBox(
location,
blocked_spells[x].m_Location - blocked_spells[x].m_Difference,
blocked_spells[x].m_Location + blocked_spells[x].m_Difference
)) {
return true;
break;
}
case 2:
{
if (IsWithinAxisAlignedBox(location, blocked_spells[x].m_Location - blocked_spells[x].m_Difference, blocked_spells[x].m_Location + blocked_spells[x].m_Difference))
return true;
break;
}
default:
{
continue;
break;
}
break;
}
default: {
continue;
break;
}
}
}
}
return false;
}
const char* Zone::GetSpellBlockedMessage(uint32 spell_id, const glm::vec3& location)
const char *Zone::GetSpellBlockedMessage(uint32 spell_id, const glm::vec3 &location)
{
if(blocked_spells)
{
for(int x = 0; x < totalBS; x++)
{
if(spell_id != blocked_spells[x].spellid && blocked_spells[x].spellid != 0)
if (blocked_spells) {
for (int x = 0; x < GetZoneTotalBlockedSpells(); x++) {
if (spell_id != blocked_spells[x].spellid && blocked_spells[x].spellid != 0) {
continue;
}
switch(blocked_spells[x].type)
{
case 1:
{
switch (blocked_spells[x].type) {
case ZoneBlockedSpellTypes::ZoneWide: {
return blocked_spells[x].message;
break;
}
case 2:
{
if(IsWithinAxisAlignedBox(location, blocked_spells[x].m_Location - blocked_spells[x].m_Difference, blocked_spells[x].m_Location + blocked_spells[x].m_Difference))
case ZoneBlockedSpellTypes::Region: {
if (IsWithinAxisAlignedBox(
location,
blocked_spells[x].m_Location - blocked_spells[x].m_Difference,
blocked_spells[x].m_Location + blocked_spells[x].m_Difference
)) {
return blocked_spells[x].message;
}
break;
}
default:
{
default: {
continue;
break;
}
+4 -4
View File
@@ -84,7 +84,7 @@ class MobMovementManager;
class Zone {
public:
static bool Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone = false);
static void Shutdown(bool quite = false);
static void Shutdown(bool quiet = false);
Zone(uint32 in_zoneid, uint32 in_instanceid, const char *in_short_name);
~Zone();
@@ -162,7 +162,7 @@ public:
inline void SetZoneHasCurrentTime(bool time) { zone_has_current_time = time; }
inline void ShowNPCGlobalLoot(Client *to, NPC *who) { m_global_loot.ShowNPCGlobalLoot(to, who); }
inline void ShowZoneGlobalLoot(Client *to) { m_global_loot.ShowZoneGlobalLoot(to); }
int GetTotalBlockedSpells() { return totalBS; }
int GetZoneTotalBlockedSpells() { return zone_total_blocked_spells; }
int SaveTempItem(uint32 merchantid, uint32 npcid, uint32 item, int32 charges, bool sold = false);
int32 MobsAggroCount() { return aggroedmobs; }
@@ -234,7 +234,7 @@ public:
void LoadAdventureFlavor();
void LoadAlternateAdvancement();
void LoadAlternateCurrencies();
void LoadBlockedSpells(uint32 zoneid);
void LoadZoneBlockedSpells(uint32 zone_id);
void LoadLDoNTrapEntries();
void LoadLDoNTraps();
void LoadLevelEXPMods();
@@ -348,7 +348,7 @@ private:
glm::vec3 m_SafePoint;
glm::vec4 m_Graveyard;
int default_ruleset;
int totalBS;
int zone_total_blocked_spells;
int npc_position_update_distance;
int32 aggroedmobs;
uint8 zone_type;
+161 -106
View File
@@ -15,6 +15,7 @@
#include <ctime>
#include <iostream>
#include <fmt/format.h>
extern Zone* zone;
@@ -204,7 +205,7 @@ bool ZoneDatabase::GetZoneCFG(
//not in the DB yet:
zone_data->gravity = atof(row[56]);
Log(Logs::General, Logs::Debug, "Zone Gravity is %f", zone_data->gravity);
LogDebug("Zone Gravity is [{}]", zone_data->gravity);
allow_mercs = true;
zone_data->FastRegenHP = atoi(row[57]);
@@ -681,17 +682,20 @@ void ZoneDatabase::GetEventLogs(const char* name,char* target,uint32 account_id,
void ZoneDatabase::LoadWorldContainer(uint32 parentid, EQEmu::ItemInstance* container)
{
if (!container) {
Log(Logs::General, Logs::Error, "Programming error: LoadWorldContainer passed nullptr pointer");
LogError("Programming error: LoadWorldContainer passed nullptr pointer");
return;
}
std::string query = StringFormat("SELECT bagidx, itemid, charges, augslot1, augslot2, augslot3, augslot4, augslot5, augslot6 "
"FROM object_contents WHERE parentid = %i", parentid);
auto results = QueryDatabase(query);
if (!results.Success()) {
Log(Logs::General, Logs::Error, "Error in DB::LoadWorldContainer: %s", results.ErrorMessage().c_str());
return;
}
std::string query = StringFormat(
"SELECT bagidx, itemid, charges, augslot1, augslot2, augslot3, augslot4, augslot5, augslot6 "
"FROM object_contents WHERE parentid = %i", parentid
);
auto results = QueryDatabase(query);
if (!results.Success()) {
LogError("Error in DB::LoadWorldContainer: [{}]", results.ErrorMessage().c_str());
return;
}
for (auto row = results.begin(); row != results.end(); ++row) {
uint8 index = (uint8)atoi(row[0]);
@@ -754,7 +758,7 @@ void ZoneDatabase::SaveWorldContainer(uint32 zone_id, uint32 parent_id, const EQ
augslot[0], augslot[1], augslot[2], augslot[3], augslot[4], augslot[5]);
auto results = QueryDatabase(query);
if (!results.Success())
Log(Logs::General, Logs::Error, "Error in ZoneDatabase::SaveWorldContainer: %s", results.ErrorMessage().c_str());
LogError("Error in ZoneDatabase::SaveWorldContainer: [{}]", results.ErrorMessage().c_str());
}
@@ -766,7 +770,7 @@ void ZoneDatabase::DeleteWorldContainer(uint32 parent_id, uint32 zone_id)
std::string query = StringFormat("DELETE FROM object_contents WHERE parentid = %i AND zoneid = %i", parent_id, zone_id);
auto results = QueryDatabase(query);
if (!results.Success())
Log(Logs::General, Logs::Error, "Error in ZoneDatabase::DeleteWorldContainer: %s", results.ErrorMessage().c_str());
LogError("Error in ZoneDatabase::DeleteWorldContainer: [{}]", results.ErrorMessage().c_str());
}
@@ -778,14 +782,14 @@ Trader_Struct* ZoneDatabase::LoadTraderItem(uint32 char_id)
std::string query = StringFormat("SELECT * FROM trader WHERE char_id = %i ORDER BY slot_id LIMIT 80", char_id);
auto results = QueryDatabase(query);
if (!results.Success()) {
Log(Logs::Detail, Logs::Trading, "Failed to load trader information!\n");
LogTrading("Failed to load trader information!\n");
return loadti;
}
loadti->Code = BazaarTrader_ShowItems;
for (auto row = results.begin(); row != results.end(); ++row) {
if (atoi(row[5]) >= 80 || atoi(row[4]) < 0) {
Log(Logs::Detail, Logs::Trading, "Bad Slot number when trying to load trader information!\n");
LogTrading("Bad Slot number when trying to load trader information!\n");
continue;
}
@@ -803,13 +807,13 @@ TraderCharges_Struct* ZoneDatabase::LoadTraderItemWithCharges(uint32 char_id)
std::string query = StringFormat("SELECT * FROM trader WHERE char_id=%i ORDER BY slot_id LIMIT 80", char_id);
auto results = QueryDatabase(query);
if (!results.Success()) {
Log(Logs::Detail, Logs::Trading, "Failed to load trader information!\n");
LogTrading("Failed to load trader information!\n");
return loadti;
}
for (auto row = results.begin(); row != results.end(); ++row) {
if (atoi(row[5]) >= 80 || atoi(row[5]) < 0) {
Log(Logs::Detail, Logs::Trading, "Bad Slot number when trying to load trader information!\n");
LogTrading("Bad Slot number when trying to load trader information!\n");
continue;
}
@@ -829,7 +833,7 @@ EQEmu::ItemInstance* ZoneDatabase::LoadSingleTraderItem(uint32 CharID, int Seria
return nullptr;
if (results.RowCount() == 0) {
Log(Logs::Detail, Logs::Trading, "Bad result from query\n"); fflush(stdout);
LogTrading("Bad result from query\n"); fflush(stdout);
return nullptr;
}
@@ -842,7 +846,7 @@ EQEmu::ItemInstance* ZoneDatabase::LoadSingleTraderItem(uint32 CharID, int Seria
const EQEmu::ItemData *item = database.GetItem(ItemID);
if(!item) {
Log(Logs::Detail, Logs::Trading, "Unable to create item\n");
LogTrading("Unable to create item\n");
fflush(stdout);
return nullptr;
}
@@ -852,7 +856,7 @@ EQEmu::ItemInstance* ZoneDatabase::LoadSingleTraderItem(uint32 CharID, int Seria
EQEmu::ItemInstance* inst = database.CreateItem(item);
if(!inst) {
Log(Logs::Detail, Logs::Trading, "Unable to create item instance\n");
LogTrading("Unable to create item instance\n");
fflush(stdout);
return nullptr;
}
@@ -874,25 +878,24 @@ void ZoneDatabase::SaveTraderItem(uint32 CharID, uint32 ItemID, uint32 SerialNum
CharID, ItemID, SerialNumber, Charges, ItemCost, Slot);
auto results = QueryDatabase(query);
if (!results.Success())
Log(Logs::Detail, Logs::None, "[CLIENT] Failed to save trader item: %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str());
LogDebug("[CLIENT] Failed to save trader item: [{}] for char_id: [{}], the error was: [{}]\n", ItemID, CharID, results.ErrorMessage().c_str());
}
void ZoneDatabase::UpdateTraderItemCharges(int CharID, uint32 SerialNumber, int32 Charges) {
Log(Logs::Detail, Logs::Trading, "ZoneDatabase::UpdateTraderItemCharges(%i, %i, %i)", CharID, SerialNumber, Charges);
LogTrading("ZoneDatabase::UpdateTraderItemCharges([{}], [{}], [{}])", CharID, SerialNumber, Charges);
std::string query = StringFormat("UPDATE trader SET charges = %i WHERE char_id = %i AND serialnumber = %i",
Charges, CharID, SerialNumber);
auto results = QueryDatabase(query);
if (!results.Success())
Log(Logs::Detail, Logs::None, "[CLIENT] Failed to update charges for trader item: %i for char_id: %i, the error was: %s\n",
SerialNumber, CharID, results.ErrorMessage().c_str());
LogDebug("[CLIENT] Failed to update charges for trader item: [{}] for char_id: [{}], the error was: [{}]\n", SerialNumber, CharID, results.ErrorMessage().c_str());
}
void ZoneDatabase::UpdateTraderItemPrice(int CharID, uint32 ItemID, uint32 Charges, uint32 NewPrice) {
Log(Logs::Detail, Logs::Trading, "ZoneDatabase::UpdateTraderPrice(%i, %i, %i, %i)", CharID, ItemID, Charges, NewPrice);
LogTrading("ZoneDatabase::UpdateTraderPrice([{}], [{}], [{}], [{}])", CharID, ItemID, Charges, NewPrice);
const EQEmu::ItemData *item = database.GetItem(ItemID);
@@ -900,12 +903,12 @@ void ZoneDatabase::UpdateTraderItemPrice(int CharID, uint32 ItemID, uint32 Charg
return;
if(NewPrice == 0) {
Log(Logs::Detail, Logs::Trading, "Removing Trader items from the DB for CharID %i, ItemID %i", CharID, ItemID);
LogTrading("Removing Trader items from the DB for CharID [{}], ItemID [{}]", CharID, ItemID);
std::string query = StringFormat("DELETE FROM trader WHERE char_id = %i AND item_id = %i",CharID, ItemID);
auto results = QueryDatabase(query);
if (!results.Success())
Log(Logs::Detail, Logs::None, "[CLIENT] Failed to remove trader item(s): %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str());
LogDebug("[CLIENT] Failed to remove trader item(s): [{}] for char_id: [{}], the error was: [{}]\n", ItemID, CharID, results.ErrorMessage().c_str());
return;
}
@@ -916,7 +919,7 @@ void ZoneDatabase::UpdateTraderItemPrice(int CharID, uint32 ItemID, uint32 Charg
NewPrice, CharID, ItemID, Charges);
auto results = QueryDatabase(query);
if (!results.Success())
Log(Logs::Detail, Logs::None, "[CLIENT] Failed to update price for trader item: %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str());
LogDebug("[CLIENT] Failed to update price for trader item: [{}] for char_id: [{}], the error was: [{}]\n", ItemID, CharID, results.ErrorMessage().c_str());
return;
}
@@ -926,7 +929,7 @@ void ZoneDatabase::UpdateTraderItemPrice(int CharID, uint32 ItemID, uint32 Charg
NewPrice, CharID, ItemID);
auto results = QueryDatabase(query);
if (!results.Success())
Log(Logs::Detail, Logs::None, "[CLIENT] Failed to update price for trader item: %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str());
LogDebug("[CLIENT] Failed to update price for trader item: [{}] for char_id: [{}], the error was: [{}]\n", ItemID, CharID, results.ErrorMessage().c_str());
}
void ZoneDatabase::DeleteTraderItem(uint32 char_id){
@@ -935,7 +938,7 @@ void ZoneDatabase::DeleteTraderItem(uint32 char_id){
const std::string query = "DELETE FROM trader";
auto results = QueryDatabase(query);
if (!results.Success())
Log(Logs::Detail, Logs::None, "[CLIENT] Failed to delete all trader items data, the error was: %s\n", results.ErrorMessage().c_str());
LogDebug("[CLIENT] Failed to delete all trader items data, the error was: [{}]\n", results.ErrorMessage().c_str());
return;
}
@@ -943,7 +946,7 @@ void ZoneDatabase::DeleteTraderItem(uint32 char_id){
std::string query = StringFormat("DELETE FROM trader WHERE char_id = %i", char_id);
auto results = QueryDatabase(query);
if (!results.Success())
Log(Logs::Detail, Logs::None, "[CLIENT] Failed to delete trader item data for char_id: %i, the error was: %s\n", char_id, results.ErrorMessage().c_str());
LogDebug("[CLIENT] Failed to delete trader item data for char_id: [{}], the error was: [{}]\n", char_id, results.ErrorMessage().c_str());
}
void ZoneDatabase::DeleteTraderItem(uint32 CharID,uint16 SlotID) {
@@ -951,7 +954,7 @@ void ZoneDatabase::DeleteTraderItem(uint32 CharID,uint16 SlotID) {
std::string query = StringFormat("DELETE FROM trader WHERE char_id = %i And slot_id = %i", CharID, SlotID);
auto results = QueryDatabase(query);
if (!results.Success())
Log(Logs::Detail, Logs::None, "[CLIENT] Failed to delete trader item data for char_id: %i, the error was: %s\n",CharID, results.ErrorMessage().c_str());
LogDebug("[CLIENT] Failed to delete trader item data for char_id: [{}], the error was: [{}]\n",CharID, results.ErrorMessage().c_str());
}
void ZoneDatabase::DeleteBuyLines(uint32 CharID) {
@@ -960,7 +963,7 @@ void ZoneDatabase::DeleteBuyLines(uint32 CharID) {
const std::string query = "DELETE FROM buyer";
auto results = QueryDatabase(query);
if (!results.Success())
Log(Logs::Detail, Logs::None, "[CLIENT] Failed to delete all buyer items data, the error was: %s\n",results.ErrorMessage().c_str());
LogDebug("[CLIENT] Failed to delete all buyer items data, the error was: [{}]\n",results.ErrorMessage().c_str());
return;
}
@@ -968,7 +971,7 @@ void ZoneDatabase::DeleteBuyLines(uint32 CharID) {
std::string query = StringFormat("DELETE FROM buyer WHERE charid = %i", CharID);
auto results = QueryDatabase(query);
if (!results.Success())
Log(Logs::Detail, Logs::None, "[CLIENT] Failed to delete buyer item data for charid: %i, the error was: %s\n",CharID,results.ErrorMessage().c_str());
LogDebug("[CLIENT] Failed to delete buyer item data for charid: [{}], the error was: [{}]\n",CharID,results.ErrorMessage().c_str());
}
@@ -977,7 +980,7 @@ void ZoneDatabase::AddBuyLine(uint32 CharID, uint32 BuySlot, uint32 ItemID, cons
CharID, BuySlot, ItemID, ItemName, Quantity, Price);
auto results = QueryDatabase(query);
if (!results.Success())
Log(Logs::Detail, Logs::None, "[CLIENT] Failed to save buline item: %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str());
LogDebug("[CLIENT] Failed to save buline item: [{}] for char_id: [{}], the error was: [{}]\n", ItemID, CharID, results.ErrorMessage().c_str());
}
@@ -985,7 +988,7 @@ void ZoneDatabase::RemoveBuyLine(uint32 CharID, uint32 BuySlot) {
std::string query = StringFormat("DELETE FROM buyer WHERE charid = %i AND buyslot = %i", CharID, BuySlot);
auto results = QueryDatabase(query);
if (!results.Success())
Log(Logs::Detail, Logs::None, "[CLIENT] Failed to delete buyslot %i for charid: %i, the error was: %s\n", BuySlot, CharID, results.ErrorMessage().c_str());
LogDebug("[CLIENT] Failed to delete buyslot [{}] for charid: [{}], the error was: [{}]\n", BuySlot, CharID, results.ErrorMessage().c_str());
}
@@ -998,7 +1001,7 @@ void ZoneDatabase::UpdateBuyLine(uint32 CharID, uint32 BuySlot, uint32 Quantity)
std::string query = StringFormat("UPDATE buyer SET quantity = %i WHERE charid = %i AND buyslot = %i", Quantity, CharID, BuySlot);
auto results = QueryDatabase(query);
if (!results.Success())
Log(Logs::Detail, Logs::None, "[CLIENT] Failed to update quantity in buyslot %i for charid: %i, the error was: %s\n", BuySlot, CharID, results.ErrorMessage().c_str());
LogDebug("[CLIENT] Failed to update quantity in buyslot [{}] for charid: [{}], the error was: [{}]\n", BuySlot, CharID, results.ErrorMessage().c_str());
}
@@ -1509,7 +1512,7 @@ bool ZoneDatabase::LoadCharacterBindPoint(uint32 character_id, PlayerProfile_Str
bool ZoneDatabase::SaveCharacterLanguage(uint32 character_id, uint32 lang_id, uint32 value){
std::string query = StringFormat("REPLACE INTO `character_languages` (id, lang_id, value) VALUES (%u, %u, %u)", character_id, lang_id, value); QueryDatabase(query);
Log(Logs::General, Logs::None, "ZoneDatabase::SaveCharacterLanguage for character ID: %i, lang_id:%u value:%u done", character_id, lang_id, value);
LogDebug("ZoneDatabase::SaveCharacterLanguage for character ID: [{}], lang_id:[{}] value:[{}] done", character_id, lang_id, value);
return true;
}
@@ -1521,13 +1524,12 @@ bool ZoneDatabase::SaveCharacterBindPoint(uint32 character_id, const BindStruct
"%u, %u, %f, %f, %f, %f, %i)",
character_id, bind.zoneId, bind.instance_id, bind.x, bind.y, bind.z, bind.heading, bind_num);
Log(Logs::General, Logs::None, "ZoneDatabase::SaveCharacterBindPoint for character ID: %i zone_id: %u "
"instance_id: %u position: %f %f %f %f bind_num: %u",
LogDebug("ZoneDatabase::SaveCharacterBindPoint for character ID: [{}] zone_id: [{}] instance_id: [{}] position: [{}] [{}] [{}] [{}] bind_num: [{}]",
character_id, bind.zoneId, bind.instance_id, bind.x, bind.y, bind.z, bind.heading, bind_num);
auto results = QueryDatabase(query);
if (!results.RowsAffected())
Log(Logs::General, Logs::None, "ERROR Bind Home Save: %s. %s", results.ErrorMessage().c_str(),
LogDebug("ERROR Bind Home Save: [{}]. [{}]", results.ErrorMessage().c_str(),
query.c_str());
return true;
@@ -1539,20 +1541,20 @@ bool ZoneDatabase::SaveCharacterMaterialColor(uint32 character_id, uint32 slot_i
uint8 blue = (color & 0x000000FF);
std::string query = StringFormat("REPLACE INTO `character_material` (id, slot, red, green, blue, color, use_tint) VALUES (%u, %u, %u, %u, %u, %u, 255)", character_id, slot_id, red, green, blue, color); auto results = QueryDatabase(query);
Log(Logs::General, Logs::None, "ZoneDatabase::SaveCharacterMaterialColor for character ID: %i, slot_id: %u color: %u done", character_id, slot_id, color);
LogDebug("ZoneDatabase::SaveCharacterMaterialColor for character ID: [{}], slot_id: [{}] color: [{}] done", character_id, slot_id, color);
return true;
}
bool ZoneDatabase::SaveCharacterSkill(uint32 character_id, uint32 skill_id, uint32 value){
std::string query = StringFormat("REPLACE INTO `character_skills` (id, skill_id, value) VALUES (%u, %u, %u)", character_id, skill_id, value); auto results = QueryDatabase(query);
Log(Logs::General, Logs::None, "ZoneDatabase::SaveCharacterSkill for character ID: %i, skill_id:%u value:%u done", character_id, skill_id, value);
LogDebug("ZoneDatabase::SaveCharacterSkill for character ID: [{}], skill_id:[{}] value:[{}] done", character_id, skill_id, value);
return true;
}
bool ZoneDatabase::SaveCharacterDisc(uint32 character_id, uint32 slot_id, uint32 disc_id){
std::string query = StringFormat("REPLACE INTO `character_disciplines` (id, slot_id, disc_id) VALUES (%u, %u, %u)", character_id, slot_id, disc_id);
auto results = QueryDatabase(query);
Log(Logs::General, Logs::None, "ZoneDatabase::SaveCharacterDisc for character ID: %i, slot:%u disc_id:%u done", character_id, slot_id, disc_id);
LogDebug("ZoneDatabase::SaveCharacterDisc for character ID: [{}], slot:[{}] disc_id:[{}] done", character_id, slot_id, disc_id);
return true;
}
@@ -1564,7 +1566,7 @@ bool ZoneDatabase::SaveCharacterTribute(uint32 character_id, PlayerProfile_Struc
if (pp->tributes[i].tribute >= 0 && pp->tributes[i].tribute != TRIBUTE_NONE){
std::string query = StringFormat("REPLACE INTO `character_tribute` (id, tier, tribute) VALUES (%u, %u, %u)", character_id, pp->tributes[i].tier, pp->tributes[i].tribute);
QueryDatabase(query);
Log(Logs::General, Logs::None, "ZoneDatabase::SaveCharacterTribute for character ID: %i, tier:%u tribute:%u done", character_id, pp->tributes[i].tier, pp->tributes[i].tribute);
LogDebug("ZoneDatabase::SaveCharacterTribute for character ID: [{}], tier:[{}] tribute:[{}] done", character_id, pp->tributes[i].tier, pp->tributes[i].tribute);
}
}
return true;
@@ -1576,7 +1578,7 @@ bool ZoneDatabase::SaveCharacterBandolier(uint32 character_id, uint8 bandolier_i
DoEscapeString(bandolier_name_esc, bandolier_name, strlen(bandolier_name));
std::string query = StringFormat("REPLACE INTO `character_bandolier` (id, bandolier_id, bandolier_slot, item_id, icon, bandolier_name) VALUES (%u, %u, %u, %u, %u,'%s')", character_id, bandolier_id, bandolier_slot, item_id, icon, bandolier_name_esc);
auto results = QueryDatabase(query);
Log(Logs::General, Logs::None, "ZoneDatabase::SaveCharacterBandolier for character ID: %i, bandolier_id: %u, bandolier_slot: %u item_id: %u, icon:%u band_name:%s done", character_id, bandolier_id, bandolier_slot, item_id, icon, bandolier_name);
LogDebug("ZoneDatabase::SaveCharacterBandolier for character ID: [{}], bandolier_id: [{}], bandolier_slot: [{}] item_id: [{}], icon:[{}] band_name:[{}] done", character_id, bandolier_id, bandolier_slot, item_id, icon, bandolier_name);
return true;
}
@@ -1903,7 +1905,7 @@ bool ZoneDatabase::SaveCharacterData(uint32 character_id, uint32 account_id, Pla
mail_key.c_str()
);
auto results = database.QueryDatabase(query);
Log(Logs::General, Logs::None, "ZoneDatabase::SaveCharacterData %i, done... Took %f seconds", character_id, ((float)(std::clock() - t)) / CLOCKS_PER_SEC);
LogDebug("ZoneDatabase::SaveCharacterData [{}], done Took [{}] seconds", character_id, ((float)(std::clock() - t)) / CLOCKS_PER_SEC);
return true;
}
@@ -1944,7 +1946,7 @@ bool ZoneDatabase::SaveCharacterCurrency(uint32 character_id, PlayerProfile_Stru
pp->currentEbonCrystals,
pp->careerEbonCrystals);
auto results = database.QueryDatabase(query);
Log(Logs::General, Logs::None, "Saving Currency for character ID: %i, done", character_id);
LogDebug("Saving Currency for character ID: [{}], done", character_id);
return true;
}
@@ -1953,7 +1955,7 @@ bool ZoneDatabase::SaveCharacterAA(uint32 character_id, uint32 aa_id, uint32 cur
" VALUES (%u, %u, %u, %u)",
character_id, aa_id, current_level, charges);
auto results = QueryDatabase(rquery);
Log(Logs::General, Logs::None, "Saving AA for character ID: %u, aa_id: %u current_level: %u", character_id, aa_id, current_level);
LogDebug("Saving AA for character ID: [{}], aa_id: [{}] current_level: [{}]", character_id, aa_id, current_level);
return true;
}
@@ -2078,7 +2080,7 @@ bool ZoneDatabase::SaveCharacterInvSnapshot(uint32 character_id) {
character_id
);
auto results = database.QueryDatabase(query);
Log(Logs::Moderate, Logs::Inventory, "ZoneDatabase::SaveCharacterInventorySnapshot %i (%s)", character_id, (results.Success() ? "pass" : "fail"));
LogInventory("ZoneDatabase::SaveCharacterInventorySnapshot [{}] ([{}])", character_id, (results.Success() ? "pass" : "fail"));
return results.Success();
}
@@ -2295,7 +2297,7 @@ bool ZoneDatabase::RestoreCharacterInvSnapshot(uint32 character_id, uint32 times
// we should know what we're doing by the time we call this function..but,
// this is to prevent inventory deletions where no timestamp entries exists
if (!ValidateCharacterInvSnapshotTimestamp(character_id, timestamp)) {
Log(Logs::General, Logs::Error, "ZoneDatabase::RestoreCharacterInvSnapshot() called for id: %u without valid snapshot entries @ %u", character_id, timestamp);
LogError("ZoneDatabase::RestoreCharacterInvSnapshot() called for id: [{}] without valid snapshot entries @ [{}]", character_id, timestamp);
return false;
}
@@ -2360,7 +2362,7 @@ bool ZoneDatabase::RestoreCharacterInvSnapshot(uint32 character_id, uint32 times
);
results = database.QueryDatabase(query);
Log(Logs::General, Logs::Inventory, "ZoneDatabase::RestoreCharacterInvSnapshot() %s snapshot for %u @ %u",
LogInventory("ZoneDatabase::RestoreCharacterInvSnapshot() [{}] snapshot for [{}] @ [{}]",
(results.Success() ? "restored" : "failed to restore"), character_id, timestamp);
return results.Success();
@@ -2379,7 +2381,7 @@ const NPCType *ZoneDatabase::LoadNPCTypesData(uint32 npc_type_id, bool bulk_load
std::string where_condition = "";
if (bulk_load) {
Log(Logs::General, Logs::Debug, "Performing bulk NPC Types load");
LogDebug("Performing bulk NPC Types load");
where_condition = StringFormat(
"INNER JOIN spawnentry ON npc_types.id = spawnentry.npcID "
"INNER JOIN spawn2 ON spawnentry.spawngroupID = spawn2.spawngroupID "
@@ -3113,12 +3115,12 @@ void ZoneDatabase::SaveMercBuffs(Merc *merc) {
Buffs_Struct *buffs = merc->GetBuffs();
// Remove any existing buff saves
std::string query = StringFormat("DELETE FROM merc_buffs WHERE MercId = %u", merc->GetMercID());
auto results = database.QueryDatabase(query);
if(!results.Success()) {
Log(Logs::General, Logs::Error, "Error While Deleting Merc Buffs before save: %s", results.ErrorMessage().c_str());
return;
}
std::string query = StringFormat("DELETE FROM merc_buffs WHERE MercId = %u", merc->GetMercID());
auto results = database.QueryDatabase(query);
if (!results.Success()) {
LogError("Error While Deleting Merc Buffs before save: [{}]", results.ErrorMessage().c_str());
return;
}
for (int buffCount = 0; buffCount <= BUFF_COUNT; buffCount++) {
if(buffs[buffCount].spellid == 0 || buffs[buffCount].spellid == SPELL_UNKNOWN)
@@ -3142,7 +3144,7 @@ void ZoneDatabase::SaveMercBuffs(Merc *merc) {
buffs[buffCount].caston_z, buffs[buffCount].ExtraDIChance);
results = database.QueryDatabase(query);
if(!results.Success()) {
Log(Logs::General, Logs::Error, "Error Saving Merc Buffs: %s", results.ErrorMessage().c_str());
LogError("Error Saving Merc Buffs: [{}]", results.ErrorMessage().c_str());
break;
}
}
@@ -3161,7 +3163,7 @@ void ZoneDatabase::LoadMercBuffs(Merc *merc) {
merc->GetMercID());
auto results = database.QueryDatabase(query);
if(!results.Success()) {
Log(Logs::General, Logs::Error, "Error Loading Merc Buffs: %s", results.ErrorMessage().c_str());
LogError("Error Loading Merc Buffs: [{}]", results.ErrorMessage().c_str());
return;
}
@@ -3206,7 +3208,7 @@ void ZoneDatabase::LoadMercBuffs(Merc *merc) {
query = StringFormat("DELETE FROM merc_buffs WHERE MercId = %u", merc->GetMercID());
results = database.QueryDatabase(query);
if(!results.Success())
Log(Logs::General, Logs::Error, "Error Loading Merc Buffs: %s", results.ErrorMessage().c_str());
LogError("Error Loading Merc Buffs: [{}]", results.ErrorMessage().c_str());
}
@@ -3222,14 +3224,14 @@ bool ZoneDatabase::DeleteMerc(uint32 merc_id) {
auto results = database.QueryDatabase(query);
if(!results.Success())
{
Log(Logs::General, Logs::Error, "Error Deleting Merc Buffs: %s", results.ErrorMessage().c_str());
LogError("Error Deleting Merc Buffs: [{}]", results.ErrorMessage().c_str());
}
query = StringFormat("DELETE FROM mercs WHERE MercID = '%u'", merc_id);
results = database.QueryDatabase(query);
if(!results.Success())
{
Log(Logs::General, Logs::Error, "Error Deleting Merc: %s", results.ErrorMessage().c_str());
LogError("Error Deleting Merc: [{}]", results.ErrorMessage().c_str());
return false;
}
@@ -3247,7 +3249,7 @@ void ZoneDatabase::LoadMercEquipment(Merc *merc) {
merc->GetLevel(), merc->GetLevel());
auto results = database.QueryDatabase(query);
if(!results.Success()) {
Log(Logs::General, Logs::Error, "Error Loading Merc Inventory: %s", results.ErrorMessage().c_str());
LogError("Error Loading Merc Inventory: [{}]", results.ErrorMessage().c_str());
return;
}
@@ -3458,7 +3460,7 @@ int32 ZoneDatabase::GetBlockedSpellsCount(uint32 zoneid)
bool ZoneDatabase::LoadBlockedSpells(int32 blockedSpellsCount, ZoneSpellsBlocked* into, uint32 zoneid)
{
Log(Logs::General, Logs::Status, "Loading Blocked Spells from database...");
LogInfo("Loading Blocked Spells from database");
std::string query = StringFormat("SELECT id, spellid, type, x, y, z, x_diff, y_diff, z_diff, message "
"FROM blocked_spells WHERE zoneid = %d ORDER BY id ASC", zoneid);
@@ -4072,60 +4074,113 @@ bool ZoneDatabase::SetCharacterFactionLevel(uint32 char_id, int32 faction_id, in
bool ZoneDatabase::LoadFactionData()
{
std::string query = "SELECT MAX(id) FROM faction_list";
auto results = QueryDatabase(query);
if (!results.Success()) {
std::string query("SELECT MAX(`id`) FROM `faction_list`");
auto faction_max_results = QueryDatabase(query);
if (!faction_max_results.Success() || faction_max_results.RowCount() == 0) {
return false;
}
if (results.RowCount() == 0)
return false;
auto fmr_row = faction_max_results.begin();
auto row = results.begin();
max_faction = atoul(fmr_row[0]);
faction_array = new Faction *[max_faction + 1];
max_faction = row[0] ? atoi(row[0]) : 0;
faction_array = new Faction*[max_faction+1];
for(unsigned int index=0; index<max_faction; index++)
faction_array[index] = nullptr;
memset(faction_array, 0, (sizeof(Faction*) * (max_faction + 1)));
std::vector<size_t> faction_ids;
// load factions
query = "SELECT `id`, `name`, `base` FROM `faction_list`";
query = "SELECT id, name, base FROM faction_list";
results = QueryDatabase(query);
if (!results.Success()) {
auto faction_results = QueryDatabase(query);
if (!faction_results.Success()) {
return false;
}
for (row = results.begin(); row != results.end(); ++row) {
uint32 index = atoi(row[0]);
for (auto fr_row : faction_results) {
uint32 index = atoul(fr_row[0]);
if (index > max_faction) {
Log(Logs::General, Logs::Error, "Faction '%u' is out-of-bounds for faction array size!", index);
continue;
}
// this should never hit since `id` is keyed..but, it alleviates any risk of lost pointers
if (faction_array[index] != nullptr) {
Log(Logs::General, Logs::Error, "Faction '%u' has already been assigned! (Duplicate Entry)", index);
continue;
}
faction_array[index] = new Faction;
strn0cpy(faction_array[index]->name, row[1], 50);
faction_array[index]->base = atoi(row[2]);
strn0cpy(faction_array[index]->name, fr_row[1], 50);
faction_array[index]->base = atoi(fr_row[2]);
faction_array[index]->min = MIN_PERSONAL_FACTION;
faction_array[index]->max = MAX_PERSONAL_FACTION;
faction_ids.push_back(index);
}
// Load in the mimimum and maximum faction that can be earned for this faction
query = StringFormat("SELECT `min` , `max` FROM `faction_base_data` WHERE client_faction_id = %u", index);
auto baseResults = QueryDatabase(query);
if (!baseResults.Success() || baseResults.RowCount() == 0) {
Log(Logs::General, Logs::General, "Faction %d has no base data", (int)index);
}
else {
for (auto modRow = baseResults.begin(); modRow != baseResults.end(); ++modRow) {
faction_array[index]->min = atoi(modRow[0]);
faction_array[index]->max = atoi(modRow[1]);
Log(Logs::General, Logs::None, "Min(%d), Max(%d) for faction (%u)",faction_array[index]->min, faction_array[index]->max, index);
LogInfo("[{}] Faction(s) loaded...", faction_ids.size());
const std::string faction_id_criteria(implode(",", std::pair<char, char>('\'', '\''), faction_ids));
// load faction mins/maxes
query = fmt::format("SELECT `client_faction_id`, `min`, `max` FROM `faction_base_data` WHERE `client_faction_id` IN ({})", faction_id_criteria);
auto base_results = QueryDatabase(query);
if (base_results.Success()) {
for (auto br_row : base_results) {
uint32 index = atoul(br_row[0]);
if (index > max_faction) {
LogError("Faction [{}] is out-of-bounds for faction array size in Base adjustment!", index);
continue;
}
if (faction_array[index] == nullptr) {
LogError("Faction [{}] does not exist for Base adjustment!", index);
continue;
}
faction_array[index]->min = atoi(br_row[1]);
faction_array[index]->max = atoi(br_row[2]);
}
// Load in modifiers to the faction based on characters race, class and diety.
query = StringFormat("SELECT `mod`, `mod_name` FROM `faction_list_mod` WHERE faction_id = %u", index);
auto modResults = QueryDatabase(query);
if (!modResults.Success())
continue;
LogInfo("[{}] Faction Base(s) loaded...", base_results.RowCount());
}
else {
LogInfo("Unable to load Faction Base data...");
}
// load race, class and diety modifiers
query = fmt::format("SELECT `faction_id`, `mod`, `mod_name` FROM `faction_list_mod` WHERE `faction_id` IN ({})", faction_id_criteria);
for (auto modRow = modResults.begin(); modRow != modResults.end(); ++modRow) {
faction_array[index]->mods[modRow[1]] = atoi(modRow[0]);
auto modifier_results = QueryDatabase(query);
if (modifier_results.Success()) {
for (auto mr_row : modifier_results) {
uint32 index = atoul(mr_row[0]);
if (index > max_faction) {
Log(Logs::General, Logs::Error, "Faction '%u' is out-of-bounds for faction array size in Modifier adjustment!", index);
continue;
}
if (faction_array[index] == nullptr) {
Log(Logs::General, Logs::Error, "Faction '%u' does not exist for Modifier adjustment!", index);
continue;
}
faction_array[index]->mods[mr_row[2]] = atoi(mr_row[1]);
}
}
LogInfo("[{}] Faction Modifier(s) loaded", modifier_results.RowCount());
}
else {
LogError("Unable to load Faction Modifier data");
}
return true;
}
@@ -4602,11 +4657,11 @@ Corpse* ZoneDatabase::SummonBuriedCharacterCorpses(uint32 char_id, uint32 dest_z
if (!corpse)
continue;
entity_list.AddCorpse(corpse);
corpse->SetDecayTimer(RuleI(Character, CorpseDecayTimeMS));
corpse->Spawn();
if (!UnburyCharacterCorpse(corpse->GetCorpseDBID(), dest_zone_id, dest_instance_id, position))
Log(Logs::General, Logs::Error, "Unable to unbury a summoned player corpse for character id %u.", char_id);
entity_list.AddCorpse(corpse);
corpse->SetDecayTimer(RuleI(Character, CorpseDecayTimeMS));
corpse->Spawn();
if (!UnburyCharacterCorpse(corpse->GetCorpseDBID(), dest_zone_id, dest_instance_id, position))
LogError("Unable to unbury a summoned player corpse for character id [{}]", char_id);
}
return corpse;
@@ -4645,7 +4700,7 @@ bool ZoneDatabase::SummonAllCharacterCorpses(uint32 char_id, uint32 dest_zone_id
++CorpseCount;
}
else{
Log(Logs::General, Logs::Error, "Unable to construct a player corpse for character id %u.", char_id);
LogError("Unable to construct a player corpse for character id [{}]", char_id);
}
}
+23 -23
View File
@@ -44,12 +44,12 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) {
bZoning = true;
if (app->size != sizeof(ZoneChange_Struct)) {
Log(Logs::General, Logs::None, "Wrong size: OP_ZoneChange, size=%d, expected %d", app->size, sizeof(ZoneChange_Struct));
LogDebug("Wrong size: OP_ZoneChange, size=[{}], expected [{}]", app->size, sizeof(ZoneChange_Struct));
return;
}
#if EQDEBUG >= 5
Log(Logs::General, Logs::None, "Zone request from %s", GetName());
LogDebug("Zone request from [{}]", GetName());
DumpPacket(app);
#endif
ZoneChange_Struct* zc=(ZoneChange_Struct*)app->pBuffer;
@@ -97,7 +97,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) {
//Todo cheat detection
Message(Chat::Red, "Invalid unsolicited zone request.");
Log(Logs::General, Logs::Error, "Zoning %s: Invalid unsolicited zone request to zone id '%d'.", GetName(), target_zone_id);
LogError("Zoning [{}]: Invalid unsolicited zone request to zone id [{}]", GetName(), target_zone_id);
SendZoneCancel(zc);
return;
}
@@ -129,7 +129,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) {
//if we didnt get a zone point, or its to a different zone,
//then we assume this is invalid.
if(!zone_point || zone_point->target_zone_id != target_zone_id) {
Log(Logs::General, Logs::Error, "Zoning %s: Invalid unsolicited zone request to zone id '%d'.", GetName(), target_zone_id);
LogError("Zoning [{}]: Invalid unsolicited zone request to zone id [{}]", GetName(), target_zone_id);
//todo cheat detection
SendZoneCancel(zc);
return;
@@ -160,7 +160,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) {
if(target_zone_name == nullptr) {
//invalid zone...
Message(Chat::Red, "Invalid target zone ID.");
Log(Logs::General, Logs::Error, "Zoning %s: Unable to get zone name for zone id '%d'.", GetName(), target_zone_id);
LogError("Zoning [{}]: Unable to get zone name for zone id [{}]", GetName(), target_zone_id);
SendZoneCancel(zc);
return;
}
@@ -173,7 +173,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) {
if(!database.GetSafePoints(target_zone_name, database.GetInstanceVersion(target_instance_id), &safe_x, &safe_y, &safe_z, &minstatus, &minlevel, flag_needed)) {
//invalid zone...
Message(Chat::Red, "Invalid target zone while getting safe points.");
Log(Logs::General, Logs::Error, "Zoning %s: Unable to get safe coordinates for zone '%s'.", GetName(), target_zone_name);
LogError("Zoning [{}]: Unable to get safe coordinates for zone [{}]", GetName(), target_zone_name);
SendZoneCancel(zc);
return;
}
@@ -193,7 +193,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) {
switch(zone_mode) {
case EvacToSafeCoords:
case ZoneToSafeCoords:
Log(Logs::General, Logs::None, "Zoning %s to safe coords (%f,%f,%f) in %s (%d)", GetName(), safe_x, safe_y, safe_z, target_zone_name, target_zone_id);
LogDebug("Zoning [{}] to safe coords ([{}],[{}],[{}]) in [{}] ([{}])", GetName(), safe_x, safe_y, safe_z, target_zone_name, target_zone_id);
dest_x = safe_x;
dest_y = safe_y;
dest_z = safe_z;
@@ -253,7 +253,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) {
//could not find a valid reason for them to be zoning, stop it.
//todo cheat detection
Log(Logs::General, Logs::Error, "Zoning %s: Invalid unsolicited zone request to zone id '%s'. Not near a zone point.", GetName(), target_zone_name);
LogError("Zoning [{}]: Invalid unsolicited zone request to zone id [{}]. Not near a zone point", GetName(), target_zone_name);
SendZoneCancel(zc);
return;
default:
@@ -288,7 +288,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) {
//we have successfully zoned
DoZoneSuccess(zc, target_zone_id, target_instance_id, dest_x, dest_y, dest_z, dest_h, ignorerestrictions);
} else {
Log(Logs::General, Logs::Error, "Zoning %s: Rules prevent this char from zoning into '%s'", GetName(), target_zone_name);
LogError("Zoning [{}]: Rules prevent this char from zoning into [{}]", GetName(), target_zone_name);
SendZoneError(zc, myerror);
}
}
@@ -313,7 +313,7 @@ void Client::SendZoneCancel(ZoneChange_Struct *zc) {
void Client::SendZoneError(ZoneChange_Struct *zc, int8 err)
{
Log(Logs::General, Logs::Error, "Zone %i is not available because target wasn't found or character insufficent level", zc->zoneID);
LogError("Zone [{}] is not available because target wasn't found or character insufficent level", zc->zoneID);
EQApplicationPacket *outapp = nullptr;
outapp = new EQApplicationPacket(OP_ZoneChange, sizeof(ZoneChange_Struct));
@@ -348,7 +348,7 @@ void Client::DoZoneSuccess(ZoneChange_Struct *zc, uint16 zone_id, uint32 instanc
if(this->GetPet())
entity_list.RemoveFromHateLists(this->GetPet());
Log(Logs::General, Logs::Status, "Zoning '%s' to: %s (%i) - (%i) x=%f, y=%f, z=%f", m_pp.name, database.GetZoneName(zone_id), zone_id, instance_id, dest_x, dest_y, dest_z);
LogInfo("Zoning [{}] to: [{}] ([{}]) - ([{}]) x [{}] y [{}] z [{}]", m_pp.name, database.GetZoneName(zone_id), zone_id, instance_id, dest_x, dest_y, dest_z);
//set the player's coordinates in the new zone so they have them
//when they zone into it
@@ -471,7 +471,7 @@ void Client::ProcessMovePC(uint32 zoneID, uint32 instance_id, float x, float y,
ZonePC(zoneID, instance_id, x, y, z, heading, ignorerestrictions, zm);
break;
default:
Log(Logs::General, Logs::Error, "Client::ProcessMovePC received a reguest to perform an unsupported client zone operation.");
LogError("Client::ProcessMovePC received a reguest to perform an unsupported client zone operation");
break;
}
}
@@ -530,7 +530,7 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z
heading = m_pp.binds[0].heading;
zonesummon_ignorerestrictions = 1;
Log(Logs::General, Logs::None, "Player %s has died and will be zoned to bind point in zone: %s at LOC x=%f, y=%f, z=%f, heading=%f",
LogDebug("Player [{}] has died and will be zoned to bind point in zone: [{}] at LOC x=[{}], y=[{}], z=[{}], heading=[{}]",
GetName(), pZoneName, m_pp.binds[0].x, m_pp.binds[0].y, m_pp.binds[0].z, m_pp.binds[0].heading);
break;
case SummonPC:
@@ -539,7 +539,7 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z
SetHeading(heading);
break;
case Rewind:
Log(Logs::General, Logs::None, "%s has requested a /rewind from %f, %f, %f, to %f, %f, %f in %s", GetName(),
LogDebug("[{}] has requested a /rewind from [{}], [{}], [{}], to [{}], [{}], [{}] in [{}]", GetName(),
m_Position.x, m_Position.y, m_Position.z,
m_RewindLocation.x, m_RewindLocation.y, m_RewindLocation.z, zone->GetShortName());
m_ZoneSummonLocation = glm::vec3(x, y, z);
@@ -547,7 +547,7 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z
SetHeading(heading);
break;
default:
Log(Logs::General, Logs::Error, "Client::ZonePC() received a reguest to perform an unsupported client zone operation.");
LogError("Client::ZonePC() received a reguest to perform an unsupported client zone operation");
ReadyToZone = false;
break;
}
@@ -683,7 +683,7 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z
safe_delete(outapp);
}
Log(Logs::Detail, Logs::None, "Player %s has requested a zoning to LOC x=%f, y=%f, z=%f, heading=%f in zoneid=%i", GetName(), x, y, z, heading, zoneID);
LogDebug("Player [{}] has requested a zoning to LOC x=[{}], y=[{}], z=[{}], heading=[{}] in zoneid=[{}]", GetName(), x, y, z, heading, zoneID);
//Clear zonesummon variables if we're zoning to our own zone
//Client wont generate a zone change packet to the server in this case so
//They aren't needed and it keeps behavior on next zone attempt from being undefined.
@@ -777,7 +777,7 @@ void Client::SetZoneFlag(uint32 zone_id) {
std::string query = StringFormat("INSERT INTO zone_flags (charID,zoneID) VALUES(%d,%d)", CharacterID(), zone_id);
auto results = database.QueryDatabase(query);
if(!results.Success())
Log(Logs::General, Logs::Error, "MySQL Error while trying to set zone flag for %s: %s", GetName(), results.ErrorMessage().c_str());
LogError("MySQL Error while trying to set zone flag for [{}]: [{}]", GetName(), results.ErrorMessage().c_str());
}
void Client::ClearZoneFlag(uint32 zone_id) {
@@ -790,7 +790,7 @@ void Client::ClearZoneFlag(uint32 zone_id) {
std::string query = StringFormat("DELETE FROM zone_flags WHERE charID=%d AND zoneID=%d", CharacterID(), zone_id);
auto results = database.QueryDatabase(query);
if(!results.Success())
Log(Logs::General, Logs::Error, "MySQL Error while trying to clear zone flag for %s: %s", GetName(), results.ErrorMessage().c_str());
LogError("MySQL Error while trying to clear zone flag for [{}]: [{}]", GetName(), results.ErrorMessage().c_str());
}
@@ -800,7 +800,7 @@ void Client::LoadZoneFlags() {
std::string query = StringFormat("SELECT zoneID from zone_flags WHERE charID=%d", CharacterID());
auto results = database.QueryDatabase(query);
if (!results.Success()) {
Log(Logs::General, Logs::Error, "MySQL Error while trying to load zone flags for %s: %s", GetName(), results.ErrorMessage().c_str());
LogError("MySQL Error while trying to load zone flags for [{}]: [{}]", GetName(), results.ErrorMessage().c_str());
return;
}
@@ -863,23 +863,23 @@ bool Client::CanBeInZone() {
char flag_needed[128];
if(!database.GetSafePoints(zone->GetShortName(), zone->GetInstanceVersion(), &safe_x, &safe_y, &safe_z, &minstatus, &minlevel, flag_needed)) {
//this should not happen...
Log(Logs::Detail, Logs::None, "[CLIENT] Unable to query zone info for ourself '%s'", zone->GetShortName());
LogDebug("[CLIENT] Unable to query zone info for ourself [{}]", zone->GetShortName());
return(false);
}
if(GetLevel() < minlevel) {
Log(Logs::Detail, Logs::None, "[CLIENT] Character does not meet min level requirement (%d < %d)!", GetLevel(), minlevel);
LogDebug("[CLIENT] Character does not meet min level requirement ([{}] < [{}])!", GetLevel(), minlevel);
return(false);
}
if(Admin() < minstatus) {
Log(Logs::Detail, Logs::None, "[CLIENT] Character does not meet min status requirement (%d < %d)!", Admin(), minstatus);
LogDebug("[CLIENT] Character does not meet min status requirement ([{}] < [{}])!", Admin(), minstatus);
return(false);
}
if(flag_needed[0] != '\0') {
//the flag needed string is not empty, meaning a flag is required.
if(Admin() < minStatusToIgnoreZoneFlags && !HasZoneFlag(zone->GetZoneID())) {
Log(Logs::Detail, Logs::None, "[CLIENT] Character does not have the flag to be in this zone (%s)!", flag_needed);
LogDebug("[CLIENT] Character does not have the flag to be in this zone ([{}])!", flag_needed);
return(false);
}
}