Merge of a monster

This commit is contained in:
KimLS
2017-04-02 20:03:51 -07:00
146 changed files with 10532 additions and 7432 deletions
+74 -70
View File
@@ -47,20 +47,20 @@ void Mob::TemporaryPets(uint16 spell_id, Mob *targ, const char *name_override, u
return;
PetRecord record;
if(!database.GetPetEntry(spells[spell_id].teleport_zone, &record))
if (!database.GetPetEntry(spells[spell_id].teleport_zone, &record))
{
Log.Out(Logs::General, Logs::Error, "Unknown swarm pet spell id: %d, check pets table", spell_id);
Log(Logs::General, Logs::Error, "Unknown swarm pet spell id: %d, check pets table", spell_id);
Message(13, "Unable to find data for pet %s", spells[spell_id].teleport_zone);
return;
}
AA_SwarmPet pet;
SwarmPet_Struct pet;
pet.count = 1;
pet.duration = 1;
for(int x = 0; x < MAX_SWARM_PETS; x++)
for (int x = 0; x < MAX_SWARM_PETS; x++)
{
if(spells[spell_id].effectid[x] == SE_TemporaryPets)
if (spells[spell_id].effectid[x] == SE_TemporaryPets)
{
pet.count = spells[spell_id].base[x];
pet.duration = spells[spell_id].max[x];
@@ -74,14 +74,14 @@ void Mob::TemporaryPets(uint16 spell_id, Mob *targ, const char *name_override, u
NPCType *made_npc = nullptr;
const NPCType *npc_type = database.LoadNPCTypesData(pet.npc_id);
if(npc_type == nullptr) {
if (npc_type == nullptr) {
//log write
Log.Out(Logs::General, Logs::Error, "Unknown npc type for swarm pet spell id: %d", spell_id);
Message(0,"Unable to find pet!");
Log(Logs::General, Logs::Error, "Unknown npc type for swarm pet spell id: %d", spell_id);
Message(0, "Unable to find pet!");
return;
}
if(name_override != nullptr) {
if (name_override != nullptr) {
//we have to make a custom NPC type for this name change
made_npc = new NPCType;
memcpy(made_npc, npc_type, sizeof(NPCType));
@@ -92,7 +92,7 @@ void Mob::TemporaryPets(uint16 spell_id, Mob *targ, const char *name_override, u
int summon_count = 0;
summon_count = pet.count;
if(summon_count > MAX_SWARM_PETS)
if (summon_count > MAX_SWARM_PETS)
summon_count = MAX_SWARM_PETS;
static const glm::vec2 swarmPetLocations[MAX_SWARM_PETS] = {
@@ -101,59 +101,61 @@ void Mob::TemporaryPets(uint16 spell_id, Mob *targ, const char *name_override, u
glm::vec2(8, 8), glm::vec2(-8, 8), glm::vec2(8, -8), glm::vec2(-8, -8)
};
while(summon_count > 0) {
while (summon_count > 0) {
int pet_duration = pet.duration;
if(duration_override > 0)
if (duration_override > 0)
pet_duration = duration_override;
//this is a little messy, but the only way to do it right
//it would be possible to optimize out this copy for the last pet, but oh well
NPCType *npc_dup = nullptr;
if(made_npc != nullptr) {
if (made_npc != nullptr) {
npc_dup = new NPCType;
memcpy(npc_dup, made_npc, sizeof(NPCType));
}
NPC* npca = new NPC(
(npc_dup!=nullptr)?npc_dup:npc_type, //make sure we give the NPC the correct data pointer
0,
GetPosition() + glm::vec4(swarmPetLocations[summon_count], 0.0f, 0.0f),
FlyMode3);
NPC* swarm_pet_npc = new NPC(
(npc_dup != nullptr) ? npc_dup : npc_type, //make sure we give the NPC the correct data pointer
0,
GetPosition() + glm::vec4(swarmPetLocations[summon_count], 0.0f, 0.0f),
FlyMode3);
if (followme)
npca->SetFollowID(GetID());
swarm_pet_npc->SetFollowID(GetID());
if(!npca->GetSwarmInfo()){
auto nSI = new AA_SwarmPetInfo;
npca->SetSwarmInfo(nSI);
npca->GetSwarmInfo()->duration = new Timer(pet_duration*1000);
if (!swarm_pet_npc->GetSwarmInfo()) {
auto nSI = new SwarmPet;
swarm_pet_npc->SetSwarmInfo(nSI);
swarm_pet_npc->GetSwarmInfo()->duration = new Timer(pet_duration * 1000);
}
else{
npca->GetSwarmInfo()->duration->Start(pet_duration*1000);
else {
swarm_pet_npc->GetSwarmInfo()->duration->Start(pet_duration * 1000);
}
swarm_pet_npc->StartSwarmTimer(pet_duration * 1000);
//removing this prevents the pet from attacking
npca->GetSwarmInfo()->owner_id = GetID();
swarm_pet_npc->GetSwarmInfo()->owner_id = GetID();
//give the pets somebody to "love"
if(targ != nullptr){
npca->AddToHateList(targ, 1000, 1000);
if (targ != nullptr) {
swarm_pet_npc->AddToHateList(targ, 1000, 1000);
if (RuleB(Spells, SwarmPetTargetLock) || sticktarg)
npca->GetSwarmInfo()->target = targ->GetID();
swarm_pet_npc->GetSwarmInfo()->target = targ->GetID();
else
npca->GetSwarmInfo()->target = 0;
swarm_pet_npc->GetSwarmInfo()->target = 0;
}
//we allocated a new NPC type object, give the NPC ownership of that memory
if(npc_dup != nullptr)
npca->GiveNPCTypeData(npc_dup);
if (npc_dup != nullptr)
swarm_pet_npc->GiveNPCTypeData(npc_dup);
entity_list.AddNPC(npca, true, true);
entity_list.AddNPC(swarm_pet_npc, true, true);
summon_count--;
}
//the target of these swarm pets will take offense to being cast on...
if(targ != nullptr)
if (targ != nullptr)
targ->AddToHateList(this, 1, 0);
// The other pointers we make are handled elsewhere.
@@ -162,7 +164,7 @@ void Mob::TemporaryPets(uint16 spell_id, Mob *targ, const char *name_override, u
void Mob::TypesTemporaryPets(uint32 typesid, Mob *targ, const char *name_override, uint32 duration_override, bool followme, bool sticktarg) {
AA_SwarmPet pet;
SwarmPet_Struct pet;
pet.count = 1;
pet.duration = 1;
@@ -173,7 +175,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.Out(Logs::General, Logs::Error, "Unknown npc type for swarm pet type id: %d", typesid);
Log(Logs::General, Logs::Error, "Unknown npc type for swarm pet type id: %d", typesid);
Message(0,"Unable to find pet!");
return;
}
@@ -211,42 +213,44 @@ void Mob::TypesTemporaryPets(uint32 typesid, Mob *targ, const char *name_overrid
memcpy(npc_dup, made_npc, sizeof(NPCType));
}
NPC* npca = new NPC(
NPC* swarm_pet_npc = new NPC(
(npc_dup!=nullptr)?npc_dup:npc_type, //make sure we give the NPC the correct data pointer
0,
GetPosition() + glm::vec4(swarmPetLocations[summon_count], 0.0f, 0.0f),
FlyMode3);
if (followme)
npca->SetFollowID(GetID());
swarm_pet_npc->SetFollowID(GetID());
if(!npca->GetSwarmInfo()){
auto nSI = new AA_SwarmPetInfo;
npca->SetSwarmInfo(nSI);
npca->GetSwarmInfo()->duration = new Timer(pet_duration*1000);
if(!swarm_pet_npc->GetSwarmInfo()){
auto nSI = new SwarmPet;
swarm_pet_npc->SetSwarmInfo(nSI);
swarm_pet_npc->GetSwarmInfo()->duration = new Timer(pet_duration*1000);
}
else{
npca->GetSwarmInfo()->duration->Start(pet_duration*1000);
else {
swarm_pet_npc->GetSwarmInfo()->duration->Start(pet_duration*1000);
}
swarm_pet_npc->StartSwarmTimer(pet_duration * 1000);
//removing this prevents the pet from attacking
npca->GetSwarmInfo()->owner_id = GetID();
swarm_pet_npc->GetSwarmInfo()->owner_id = GetID();
//give the pets somebody to "love"
if(targ != nullptr){
npca->AddToHateList(targ, 1000, 1000);
swarm_pet_npc->AddToHateList(targ, 1000, 1000);
if (RuleB(Spells, SwarmPetTargetLock) || sticktarg)
npca->GetSwarmInfo()->target = targ->GetID();
swarm_pet_npc->GetSwarmInfo()->target = targ->GetID();
else
npca->GetSwarmInfo()->target = 0;
swarm_pet_npc->GetSwarmInfo()->target = 0;
}
//we allocated a new NPC type object, give the NPC ownership of that memory
if(npc_dup != nullptr)
npca->GiveNPCTypeData(npc_dup);
swarm_pet_npc->GiveNPCTypeData(npc_dup);
entity_list.AddNPC(npca, true, true);
entity_list.AddNPC(swarm_pet_npc, true, true);
summon_count--;
}
@@ -404,7 +408,7 @@ void Mob::WakeTheDead(uint16 spell_id, Mob *target, uint32 duration)
auto npca = new NPC(make_npc, 0, GetPosition(), FlyMode3);
if(!npca->GetSwarmInfo()){
auto nSI = new AA_SwarmPetInfo;
auto nSI = new SwarmPet;
npca->SetSwarmInfo(nSI);
npca->GetSwarmInfo()->duration = new Timer(duration*1000);
}
@@ -793,21 +797,21 @@ void Client::RefundAA() {
SendAlternateAdvancementStats();
}
AA_SwarmPetInfo::AA_SwarmPetInfo()
SwarmPet::SwarmPet()
{
target = 0;
owner_id = 0;
duration = nullptr;
}
AA_SwarmPetInfo::~AA_SwarmPetInfo()
SwarmPet::~SwarmPet()
{
target = 0;
owner_id = 0;
safe_delete(duration);
}
Mob *AA_SwarmPetInfo::GetOwner()
Mob *SwarmPet::GetOwner()
{
return entity_list.GetMobID(owner_id);
}
@@ -1533,17 +1537,17 @@ bool Mob::CanPurchaseAlternateAdvancementRank(AA::Rank *rank, bool check_price,
}
void Zone::LoadAlternateAdvancement() {
Log.Out(Logs::General, Logs::Status, "Loading Alternate Advancement Data...");
Log(Logs::General, Logs::Status, "Loading Alternate Advancement Data...");
if(!database.LoadAlternateAdvancementAbilities(aa_abilities,
aa_ranks))
{
aa_abilities.clear();
aa_ranks.clear();
Log.Out(Logs::General, Logs::Status, "Failed to load Alternate Advancement Data");
Log(Logs::General, Logs::Status, "Failed to load Alternate Advancement Data");
return;
}
Log.Out(Logs::General, Logs::Status, "Processing Alternate Advancement Data...");
Log(Logs::General, Logs::Status, "Processing Alternate Advancement Data...");
for(const auto &ability : aa_abilities) {
ability.second->first = GetAlternateAdvancementRank(ability.second->first_rank_id);
@@ -1594,13 +1598,13 @@ void Zone::LoadAlternateAdvancement() {
}
}
Log.Out(Logs::General, Logs::Status, "Loaded Alternate Advancement Data");
Log(Logs::General, Logs::Status, "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.Out(Logs::General, Logs::Status, "Loading Alternate Advancement Abilities...");
Log(Logs::General, Logs::Status, "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";
@@ -1626,13 +1630,13 @@ bool ZoneDatabase::LoadAlternateAdvancementAbilities(std::unordered_map<int, std
abilities[ability->id] = std::unique_ptr<AA::Ability>(ability);
}
} else {
Log.Out(Logs::General, Logs::Error, "Failed to load Alternate Advancement Abilities");
Log(Logs::General, Logs::Error, "Failed to load Alternate Advancement Abilities");
return false;
}
Log.Out(Logs::General, Logs::Status, "Loaded %d Alternate Advancement Abilities", (int)abilities.size());
Log(Logs::General, Logs::Status, "Loaded %d Alternate Advancement Abilities", (int)abilities.size());
Log.Out(Logs::General, Logs::Status, "Loading Alternate Advancement Ability Ranks...");
Log(Logs::General, Logs::Status, "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";
@@ -1661,13 +1665,13 @@ bool ZoneDatabase::LoadAlternateAdvancementAbilities(std::unordered_map<int, std
ranks[rank->id] = std::unique_ptr<AA::Rank>(rank);
}
} else {
Log.Out(Logs::General, Logs::Error, "Failed to load Alternate Advancement Ability Ranks");
Log(Logs::General, Logs::Error, "Failed to load Alternate Advancement Ability Ranks");
return false;
}
Log.Out(Logs::General, Logs::Status, "Loaded %d Alternate Advancement Ability Ranks", (int)ranks.size());
Log(Logs::General, Logs::Status, "Loaded %d Alternate Advancement Ability Ranks", (int)ranks.size());
Log.Out(Logs::General, Logs::Status, "Loading Alternate Advancement Ability Rank Effects...");
Log(Logs::General, Logs::Status, "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()) {
@@ -1688,13 +1692,13 @@ bool ZoneDatabase::LoadAlternateAdvancementAbilities(std::unordered_map<int, std
}
}
} else {
Log.Out(Logs::General, Logs::Error, "Failed to load Alternate Advancement Ability Rank Effects");
Log(Logs::General, Logs::Error, "Failed to load Alternate Advancement Ability Rank Effects");
return false;
}
Log.Out(Logs::General, Logs::Status, "Loaded Alternate Advancement Ability Rank Effects");
Log(Logs::General, Logs::Status, "Loaded Alternate Advancement Ability Rank Effects");
Log.Out(Logs::General, Logs::Status, "Loading Alternate Advancement Ability Rank Prereqs...");
Log(Logs::General, Logs::Status, "Loading Alternate Advancement Ability Rank Prereqs...");
query = "SELECT rank_id, aa_id, points FROM aa_rank_prereqs";
results = QueryDatabase(query);
if(results.Success()) {
@@ -1713,11 +1717,11 @@ bool ZoneDatabase::LoadAlternateAdvancementAbilities(std::unordered_map<int, std
}
}
} else {
Log.Out(Logs::General, Logs::Error, "Failed to load Alternate Advancement Ability Rank Prereqs");
Log(Logs::General, Logs::Error, "Failed to load Alternate Advancement Ability Rank Prereqs");
return false;
}
Log.Out(Logs::General, Logs::Status, "Loaded Alternate Advancement Ability Rank Prereqs");
Log(Logs::General, Logs::Status, "Loaded Alternate Advancement Ability Rank Prereqs");
return true;
}
+4 -4
View File
@@ -1511,7 +1511,7 @@ typedef enum { //AA IDs
} aaID;
//Structure representing the database's swarm pet configs
struct AA_SwarmPet {
struct SwarmPet_Struct {
uint8 count; //number to summon
uint32 npc_id; //id from npc_types to represent it.
uint16 duration; //how long they last, in seconds
@@ -1526,10 +1526,10 @@ enum { //values of AA_Action.action
class Timer;
class Mob;
class AA_SwarmPetInfo {
class SwarmPet {
public:
AA_SwarmPetInfo();
~AA_SwarmPetInfo();
SwarmPet();
~SwarmPet();
Mob * GetOwner();
Timer *duration;
uint32 target; //the target ID
+14 -14
View File
@@ -284,7 +284,7 @@ bool Mob::CheckWillAggro(Mob *mob) {
if(( t1 > iAggroRange)
|| ( t2 > iAggroRange)
|| ( t3 > iAggroRange)
||(mob->IsInvisible(this))
|| (mob->IsInvisible(this))
|| (mob->IsClient() &&
(!mob->CastToClient()->Connected()
|| mob->CastToClient()->IsLD()
@@ -298,7 +298,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.Out(Logs::Moderate, Logs::Aggro,
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());
return false;
@@ -360,7 +360,7 @@ bool Mob::CheckWillAggro(Mob *mob) {
{
//FatherNiwtit: make sure we can see them. last since it is very expensive
if(CheckLosFN(mob)) {
Log.Out(Logs::Detail, Logs::Aggro, "Check aggro for %s target %s.", GetName(), mob->GetName());
Log(Logs::Detail, Logs::Aggro, "Check aggro for %s target %s.", GetName(), mob->GetName());
return( mod_will_aggro(mob, this) );
}
}
@@ -392,18 +392,18 @@ bool Mob::CheckWillAggro(Mob *mob) {
{
//FatherNiwtit: make sure we can see them. last since it is very expensive
if(CheckLosFN(mob)) {
Log.Out(Logs::Detail, Logs::Aggro, "Check aggro for %s target %s.", GetName(), mob->GetName());
Log(Logs::Detail, Logs::Aggro, "Check aggro for %s target %s.", GetName(), mob->GetName());
return( mod_will_aggro(mob, this) );
}
}
}
Log.Out(Logs::Detail, Logs::Aggro, "Is In zone?:%d\n", mob->InZone());
Log.Out(Logs::Detail, Logs::Aggro, "Dist^2: %f\n", dist2);
Log.Out(Logs::Detail, Logs::Aggro, "Range^2: %f\n", iAggroRange2);
Log.Out(Logs::Detail, Logs::Aggro, "Faction: %d\n", fv);
Log.Out(Logs::Detail, Logs::Aggro, "Int: %d\n", GetINT());
Log.Out(Logs::Detail, Logs::Aggro, "Con: %d\n", GetLevelCon(mob->GetLevel()));
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()));
return(false);
}
@@ -526,7 +526,7 @@ void EntityList::AIYellForHelp(Mob* sender, Mob* attacker) {
//Father Nitwit: make sure we can see them.
if(mob->CheckLosFN(sender)) {
#if (EQDEBUG>=5)
Log.Out(Logs::General, Logs::None, "AIYellForHelp(\"%s\",\"%s\") %s attacking %s Dist %f Z %f",
Log(Logs::General, Logs::None, "AIYellForHelp(\"%s\",\"%s\") %s attacking %s Dist %f Z %f",
sender->GetName(), attacker->GetName(), mob->GetName(),
attacker->GetName(), DistanceSquared(mob->GetPosition(),
sender->GetPosition()), fabs(sender->GetZ()+mob->GetZ()));
@@ -756,7 +756,7 @@ type', in which case, the answer is yes.
}
while( reverse++ == 0 );
Log.Out(Logs::General, Logs::None, "Mob::IsAttackAllowed: don't have a rule for this - %s vs %s\n", this->GetName(), target->GetName());
Log(Logs::General, Logs::None, "Mob::IsAttackAllowed: don't have a rule for this - %s vs %s\n", this->GetName(), target->GetName());
return false;
}
@@ -896,7 +896,7 @@ bool Mob::IsBeneficialAllowed(Mob *target)
}
while( reverse++ == 0 );
Log.Out(Logs::General, Logs::None, "Mob::IsBeneficialAllowed: don't have a rule for this - %s to %s\n", this->GetName(), target->GetName());
Log(Logs::General, Logs::None, "Mob::IsBeneficialAllowed: don't have a rule for this - %s to %s\n", this->GetName(), target->GetName());
return false;
}
@@ -1008,7 +1008,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.Out(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);
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);
#endif
return zone->zonemap->CheckLoS(myloc, oloc);
}
+900 -813
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -660,7 +660,7 @@ void Mob::ApplyAABonuses(const AA::Rank &rank, StatBonuses *newbon)
effect == SE_StackingCommand_Overwrite)
continue;
Log.Out(Logs::Detail, Logs::AA, "Applying Effect %d from AA %u in slot %d (base1: %d, base2: %d) on %s",
Log(Logs::Detail, Logs::AA, "Applying Effect %d from AA %u in slot %d (base1: %d, base2: %d) on %s",
effect, rank.id, slot, base1, base2, GetCleanName());
uint8 focus = IsFocusEffect(0, 0, true, effect);
@@ -1498,7 +1498,7 @@ void Mob::ApplyAABonuses(const AA::Rank &rank, StatBonuses *newbon)
break;
default:
Log.Out(Logs::Detail, Logs::AA, "SPA %d not accounted for in AA %s (%d)", effect, rank.base_ability->name.c_str(), rank.id);
Log(Logs::Detail, Logs::AA, "SPA %d not accounted for in AA %s (%d)", effect, rank.base_ability->name.c_str(), rank.id);
break;
}
+42 -42
View File
@@ -1150,7 +1150,7 @@ int32 Bot::acmod() {
else
return (65 + ((agility - 300) / 21));
#if EQDEBUG >= 11
Log.Out(Logs::General, Logs::Error, "Error in Bot::acmod(): Agility: %i, Level: %i",agility,level);
Log(Logs::General, Logs::Error, "Error in Bot::acmod(): Agility: %i, Level: %i",agility,level);
#endif
return 0;
}
@@ -1890,7 +1890,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.Out(Logs::Detail, Logs::Combat, "Bot Archery attack canceled. Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime());
Log(Logs::Detail, Logs::Combat, "Bot Archery attack canceled. Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime());
Message(0, "Error: Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime());
return;
}
@@ -1908,7 +1908,7 @@ void Bot::BotRangedAttack(Mob* other) {
if(!RangeWeapon || !Ammo)
return;
Log.Out(Logs::Detail, Logs::Combat, "Shooting %s with bow %s (%d) and arrow %s (%d)", other->GetCleanName(), RangeWeapon->Name, RangeWeapon->ID, Ammo->Name, Ammo->ID);
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);
if(!IsAttackAllowed(other) || IsCasting() || DivineAura() || IsStunned() || IsMezzed() || (GetAppearance() == eaDead))
return;
@@ -1918,21 +1918,21 @@ void Bot::BotRangedAttack(Mob* other) {
//break invis when you attack
if(invisible) {
Log.Out(Logs::Detail, Logs::Combat, "Removing invisibility due to melee attack.");
Log(Logs::Detail, Logs::Combat, "Removing invisibility due to melee attack.");
BuffFadeByEffect(SE_Invisibility);
BuffFadeByEffect(SE_Invisibility2);
invisible = false;
}
if(invisible_undead) {
Log.Out(Logs::Detail, Logs::Combat, "Removing invisibility vs. undead due to melee attack.");
Log(Logs::Detail, Logs::Combat, "Removing invisibility vs. undead due to melee attack.");
BuffFadeByEffect(SE_InvisVsUndead);
BuffFadeByEffect(SE_InvisVsUndead2);
invisible_undead = false;
}
if(invisible_animals) {
Log.Out(Logs::Detail, Logs::Combat, "Removing invisibility vs. animals due to melee attack.");
Log(Logs::Detail, Logs::Combat, "Removing invisibility vs. animals due to melee attack.");
BuffFadeByEffect(SE_InvisVsAnimals);
invisible_animals = false;
}
@@ -2138,7 +2138,7 @@ void Bot::AI_Process() {
Mob* delete_me = HealRotationTarget();
if (AIHealRotation(HealRotationTarget(), UseHealRotationFastHeals())) {
#if (EQDEBUG >= 12)
Log.Out(Logs::General, Logs::Error, "Bot::AI_Process() - Casting succeeded (m: %s, t: %s) : AdvHR(true)", GetCleanName(), ((delete_me) ? (delete_me->GetCleanName()) : ("nullptr")));
Log(Logs::General, Logs::Error, "Bot::AI_Process() - Casting succeeded (m: %s, t: %s) : AdvHR(true)", GetCleanName(), ((delete_me) ? (delete_me->GetCleanName()) : ("nullptr")));
#endif
m_member_of_heal_rotation->SetMemberIsCasting(this);
m_member_of_heal_rotation->UpdateTargetHealingStats(HealRotationTarget());
@@ -2146,7 +2146,7 @@ void Bot::AI_Process() {
}
else {
#if (EQDEBUG >= 12)
Log.Out(Logs::General, Logs::Error, "Bot::AI_Process() - Casting failed (m: %s, t: %s) : AdvHR(false)", GetCleanName(), ((delete_me) ? (delete_me->GetCleanName()) : ("nullptr")));
Log(Logs::General, Logs::Error, "Bot::AI_Process() - Casting failed (m: %s, t: %s) : AdvHR(false)", GetCleanName(), ((delete_me) ? (delete_me->GetCleanName()) : ("nullptr")));
#endif
m_member_of_heal_rotation->SetMemberIsCasting(this, false);
AdvanceHealRotation(false);
@@ -2163,7 +2163,7 @@ void Bot::AI_Process() {
SetHasBeenSummoned(false);
} else if(!IsRooted()) {
if(GetTarget() && GetTarget()->GetHateTop() && GetTarget()->GetHateTop() != this) {
Log.Out(Logs::Detail, Logs::AI, "Returning to location prior to being summoned.");
Log(Logs::Detail, Logs::AI, "Returning to location prior to being summoned.");
CalculateNewPosition2(m_PreSummonLocation.x, m_PreSummonLocation.y, m_PreSummonLocation.z, GetBotRunspeed());
SetHeading(CalculateHeadingToTarget(m_PreSummonLocation.x, m_PreSummonLocation.y));
return;
@@ -2498,7 +2498,7 @@ void Bot::AI_Process() {
if (AI_movement_timer->Check()) {
if(!IsRooted()) {
Log.Out(Logs::Detail, Logs::AI, "Pursuing %s while engaged.", GetTarget()->GetCleanName());
Log(Logs::Detail, Logs::AI, "Pursuing %s while engaged.", GetTarget()->GetCleanName());
CalculateNewPosition2(GetTarget()->GetX(), GetTarget()->GetY(), GetTarget()->GetZ(), GetBotRunspeed());
return;
}
@@ -2746,7 +2746,7 @@ void Bot::PetAIProcess() {
else if (botPet->GetTarget() && botPet->GetAIMovementTimer()->Check()) {
botPet->SetRunAnimSpeed(0);
if(!botPet->IsRooted()) {
Log.Out(Logs::Detail, Logs::AI, "Pursuing %s while engaged.", botPet->GetTarget()->GetCleanName());
Log(Logs::Detail, Logs::AI, "Pursuing %s while engaged.", botPet->GetTarget()->GetCleanName());
botPet->CalculateNewPosition2(botPet->GetTarget()->GetX(), botPet->GetTarget()->GetY(), botPet->GetTarget()->GetZ(), botPet->GetOwner()->GetRunspeed());
return;
} else {
@@ -3813,7 +3813,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.Out(Logs::Detail, Logs::Combat, "Triggering EVENT_ATTACK due to attack by %s", from->GetName());
Log(Logs::Detail, Logs::Combat, "Triggering EVENT_ATTACK due to attack by %s", from->GetName());
parse->EventNPC(EVENT_ATTACK, this, from, "", 0);
}
@@ -3821,7 +3821,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.Out(Logs::Detail, Logs::Combat, "Applying lifetap heal of %d to %s", healed, GetCleanName());
Log(Logs::Detail, Logs::Combat, "Applying lifetap heal of %d to %s", healed, GetCleanName());
HealDamage(healed);
entity_list.MessageClose(this, true, 300, MT_Spells, "%s beams a smile at %s", GetCleanName(), from->GetCleanName() );
}
@@ -3857,13 +3857,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.Out(Logs::General, Logs::Error, "A null Mob object was passed to Bot::Attack for evaluation!");
Log(Logs::General, Logs::Error, "A null Mob object was passed to Bot::Attack for evaluation!");
return false;
}
if ((GetHP() <= 0) || (GetAppearance() == eaDead)) {
SetTarget(nullptr);
Log.Out(Logs::Detail, Logs::Combat, "Attempted to attack %s while unconscious or, otherwise, appearing dead", other->GetCleanName());
Log(Logs::Detail, Logs::Combat, "Attempted to attack %s while unconscious or, otherwise, appearing dead", other->GetCleanName());
return false;
}
@@ -3875,20 +3875,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.Out(Logs::Detail, Logs::Combat, "Attacking %s with hand %d %s", other->GetCleanName(), Hand, (FromRiposte ? "(this is a riposte)" : ""));
Log(Logs::Detail, Logs::Combat, "Attacking %s with hand %d %s", 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.Out(Logs::Detail, Logs::Combat, "I am not allowed to attack %s", other->GetCleanName());
Log(Logs::Detail, Logs::Combat, "I am not allowed to attack %s", other->GetCleanName());
}
return false;
}
if(DivineAura()) {//cant attack while invulnerable
Log.Out(Logs::Detail, Logs::Combat, "Attack canceled, Divine Aura is in effect.");
Log(Logs::Detail, Logs::Combat, "Attack canceled, Divine Aura is in effect.");
return false;
}
@@ -3906,19 +3906,19 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b
if(weapon != nullptr) {
if (!weapon->IsWeapon()) {
Log.Out(Logs::Detail, Logs::Combat, "Attack canceled, Item %s (%d) is not a weapon.", weapon->GetItem()->Name, weapon->GetID());
Log(Logs::Detail, Logs::Combat, "Attack canceled, Item %s (%d) is not a weapon.", weapon->GetItem()->Name, weapon->GetID());
return false;
}
Log.Out(Logs::Detail, Logs::Combat, "Attacking with weapon: %s (%d)", weapon->GetItem()->Name, weapon->GetID());
Log(Logs::Detail, Logs::Combat, "Attacking with weapon: %s (%d)", weapon->GetItem()->Name, weapon->GetID());
}
else
Log.Out(Logs::Detail, Logs::Combat, "Attacking without a weapon.");
Log(Logs::Detail, Logs::Combat, "Attacking without a weapon.");
// calculate attack_skill and skillinuse depending on hand and weapon
// also send Packet to near clients
DamageHitInfo my_hit;
AttackAnimation(my_hit.skill, Hand, weapon);
Log.Out(Logs::Detail, Logs::Combat, "Attacking with %s in slot %d using skill %d", weapon?weapon->GetItem()->Name:"Fist", Hand, my_hit.skill);
Log(Logs::Detail, Logs::Combat, "Attacking with %s in slot %d using skill %d", weapon?weapon->GetItem()->Name:"Fist", Hand, my_hit.skill);
// Now figure out damage
my_hit.damage_done = 1;
@@ -3966,7 +3966,7 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b
}
}
Log.Out(Logs::Detail, Logs::Combat, "Damage calculated: base %d min damage %d skill %d", my_hit.base_damage, my_hit.min_damage, my_hit.skill);
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);
int hit_chance_bonus = 0;
my_hit.offense = offense(my_hit.skill);
@@ -3984,7 +3984,7 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b
DoAttack(other, my_hit, opts);
Log.Out(Logs::Detail, Logs::Combat, "Final damage after all reductions: %d", my_hit.damage_done);
Log(Logs::Detail, Logs::Combat, "Final damage after all reductions: %d", my_hit.damage_done);
} else {
my_hit.damage_done = DMG_INVULNERABLE;
}
@@ -4595,7 +4595,7 @@ int32 Bot::CalcBotFocusEffect(BotfocusType bottype, uint16 focus_id, uint16 spel
return 0;
break;
default:
Log.Out(Logs::General, Logs::Normal, "CalcFocusEffect: unknown limit spelltype %d", focus_spell.base[i]);
Log(Logs::General, Logs::Normal, "CalcFocusEffect: unknown limit spelltype %d", focus_spell.base[i]);
}
break;
@@ -4809,7 +4809,7 @@ int32 Bot::CalcBotFocusEffect(BotfocusType bottype, uint16 focus_id, uint16 spel
break;
}
default:
Log.Out(Logs::General, Logs::Spells, "CalcFocusEffect: unknown effectid %d", focus_spell.effectid[i]);
Log(Logs::General, Logs::Spells, "CalcFocusEffect: unknown effectid %d", focus_spell.effectid[i]);
break;
}
}
@@ -4849,7 +4849,7 @@ float Bot::GetProcChances(float ProcBonus, uint16 hand) {
ProcChance += (ProcChance * ProcBonus / 100.0f);
}
Log.Out(Logs::Detail, Logs::Combat, "Proc chance %.2f (%.2f from bonuses)", ProcChance, ProcBonus);
Log(Logs::Detail, Logs::Combat, "Proc chance %.2f (%.2f from bonuses)", ProcChance, ProcBonus);
return ProcChance;
}
@@ -4903,13 +4903,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.Out(Logs::Detail, Logs::Combat, "Landed a finishing blow: levelreq at %d, other level %d",
Log(Logs::Detail, Logs::Combat, "Landed a finishing blow: levelreq at %d, other level %d",
levelreq, defender->GetLevel());
entity_list.MessageClose_StringID(this, false, 200, MT_CritMelee, FINISHING_BLOW, GetName());
damage = fb_damage;
return true;
} else {
Log.Out(Logs::Detail, Logs::Combat, "FAILED a finishing blow: levelreq at %d, other level %d",
Log(Logs::Detail, Logs::Combat, "FAILED a finishing blow: levelreq at %d, other level %d",
levelreq, defender->GetLevel());
return false;
}
@@ -4918,14 +4918,14 @@ bool Bot::TryFinishingBlow(Mob *defender, int &damage)
}
void Bot::DoRiposte(Mob* defender) {
Log.Out(Logs::Detail, Logs::Combat, "Preforming a riposte");
Log(Logs::Detail, Logs::Combat, "Preforming a riposte");
if (!defender)
return;
defender->Attack(this, EQEmu::inventory::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.Out(Logs::Detail, Logs::Combat, "Preforming a double riposte (%d percent chance)", DoubleRipChance);
Log(Logs::Detail, Logs::Combat, "Preforming a double riposte (%d percent chance)", DoubleRipChance);
defender->Attack(this, EQEmu::inventory::slotPrimary, true);
}
@@ -5548,7 +5548,7 @@ int32 Bot::CalcMaxMana() {
break;
}
default: {
Log.Out(Logs::General, Logs::None, "Invalid Class '%c' in CalcMaxMana", GetCasterClass());
Log(Logs::General, Logs::None, "Invalid Class '%c' in CalcMaxMana", GetCasterClass());
max_mana = 0;
break;
}
@@ -5976,14 +5976,14 @@ bool Bot::CastSpell(uint16 spell_id, uint16 target_id, EQEmu::CastingSlot slot,
uint32* oSpellWillFinish, uint32 item_slot, int16 *resist_adjust, uint32 aa_id) {
bool Result = false;
if(zone && !zone->IsSpellBlocked(spell_id, glm::vec3(GetPosition()))) {
Log.Out(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);
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);
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.Out(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() );
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() );
if(IsSilenced() && !IsDiscipline(spell_id))
Message_StringID(13, SILENCED_STRING);
@@ -6007,7 +6007,7 @@ bool Bot::CastSpell(uint16 spell_id, uint16 target_id, EQEmu::CastingSlot slot,
}
if(DivineAura()) {
Log.Out(Logs::Detail, Logs::Spells, "Spell casting canceled: cannot cast while Divine Aura is in effect.");
Log(Logs::Detail, Logs::Spells, "Spell casting canceled: cannot cast while Divine Aura is in effect.");
InterruptSpell(173, 0x121, false);
return false;
}
@@ -6017,13 +6017,13 @@ bool Bot::CastSpell(uint16 spell_id, uint16 target_id, EQEmu::CastingSlot slot,
InterruptSpell(fizzle_msg, 0x121, spell_id);
uint32 use_mana = ((spells[spell_id].mana) / 4);
Log.Out(Logs::Detail, Logs::Spells, "Spell casting canceled: fizzled. %d mana has been consumed", use_mana);
Log(Logs::Detail, Logs::Spells, "Spell casting canceled: fizzled. %d mana has been consumed", use_mana);
SetMana(GetMana() - use_mana);
return false;
}
if (HasActiveSong()) {
Log.Out(Logs::Detail, Logs::Spells, "Casting a new spell/song while singing a song. Killing old song %d.", bardsong);
Log(Logs::Detail, Logs::Spells, "Casting a new spell/song while singing a song. Killing old song %d.", bardsong);
bardsong = 0;
bardsong_target_id = 0;
bardsong_slot = EQEmu::CastingSlot::Gem1;
@@ -6137,19 +6137,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.Out(Logs::Detail, Logs::Spells, "Bot's target is not an undead.");
Log(Logs::Detail, Logs::Spells, "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.Out(Logs::Detail, Logs::Spells, "Bot's target is not a summoned creature.");
Log(Logs::Detail, Logs::Spells, "Bot's target is not a summoned creature.");
return true;
}
}
}
Log.Out(Logs::Detail, Logs::Spells, "No bot immunities to spell %d found.", spell_id);
Log(Logs::Detail, Logs::Spells, "No bot immunities to spell %d found.", spell_id);
}
}
@@ -6300,7 +6300,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.Out(Logs::General, Logs::Spells, "Bot::DoFinishedSpellSingleTarget - GroupBuffing failure");
Log(Logs::General, Logs::Spells, "Bot::DoFinishedSpellSingleTarget - GroupBuffing failure");
return false;
}
@@ -7807,7 +7807,7 @@ bool Bot::CheckLoreConflict(const EQEmu::ItemData* item) {
bool EntityList::Bot_AICheckCloseBeneficialSpells(Bot* caster, uint8 iChance, float iRange, uint32 iSpellTypes) {
if((iSpellTypes&SpellTypes_Detrimental) != 0) {
Log.Out(Logs::General, Logs::Error, "Error: detrimental spells requested from AICheckCloseBeneficialSpells!!");
Log(Logs::General, Logs::Error, "Error: detrimental spells requested from AICheckCloseBeneficialSpells!!");
return false;
}
+18 -18
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.Out(Logs::General, Logs::Error, "DELETING entry_prototype (primary clause) - name: %s, target_type: %s, BCST: %s",
Log(Logs::General, Logs::Error, "DELETING entry_prototype (primary clause) - name: %s, target_type: %s, BCST: %s",
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.Out(Logs::General, Logs::Error, "DELETING entry_prototype (secondary clause) - name: %s, BCST: %s, target_type: %s",
Log(Logs::General, Logs::Error, "DELETING entry_prototype (secondary clause) - name: %s, BCST: %s, target_type: %s",
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.Out(Logs::General, Logs::Error, "load_teleport_zone_names() - Error in zone names query: %s", results.ErrorMessage().c_str());
Log(Logs::General, Logs::Error, "load_teleport_zone_names() - Error in zone names query: %s", results.ErrorMessage().c_str());
return;
}
@@ -1088,14 +1088,14 @@ private:
}
static void status_report() {
Log.Out(Logs::General, Logs::Commands, "load_bot_command_spells(): - 'RuleI(Bots, CommandSpellRank)' set to %i.", RuleI(Bots, CommandSpellRank));
Log(Logs::General, Logs::Commands, "load_bot_command_spells(): - 'RuleI(Bots, CommandSpellRank)' set to %i.", RuleI(Bots, CommandSpellRank));
if (bot_command_spells.empty()) {
Log.Out(Logs::General, Logs::Error, "load_bot_command_spells() - 'bot_command_spells' is empty.");
Log(Logs::General, Logs::Error, "load_bot_command_spells() - 'bot_command_spells' is empty.");
return;
}
for (int i = BCEnum::SpellTypeFirst; i <= BCEnum::SpellTypeLast; ++i)
Log.Out(Logs::General, Logs::Commands, "load_bot_command_spells(): - '%s' returned %u spell entries.",
Log(Logs::General, Logs::Commands, "load_bot_command_spells(): - '%s' returned %u spell entries.",
BCEnum::SpellTypeEnumToString(static_cast<BCEnum::SpType>(i)).c_str(), bot_command_spells[static_cast<BCEnum::SpType>(i)].size());
}
@@ -1428,12 +1428,12 @@ int bot_command_init(void)
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.Out(Logs::General, Logs::Commands, "bot_command_init(): Warning: Bot Command '%s' defaulting to access level 0!", working_bcl_iter.first.c_str());
Log(Logs::General, Logs::Commands, "bot_command_init(): Warning: Bot Command '%s' defaulting to access level 0!", working_bcl_iter.first.c_str());
continue;
}
working_bcl_iter.second->access = bot_command_settings_iter->second.first;
Log.Out(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);
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())
continue;
@@ -1441,14 +1441,14 @@ int bot_command_init(void)
if (alias_iter.empty())
continue;
if (bot_command_list.find(alias_iter) != bot_command_list.end()) {
Log.Out(Logs::General, Logs::Commands, "bot_command_init(): Warning: Alias '%s' already exists as a bot command - skipping!", alias_iter.c_str());
Log(Logs::General, Logs::Commands, "bot_command_init(): Warning: Alias '%s' 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.Out(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());
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());
}
}
@@ -1494,21 +1494,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.Out(Logs::General, Logs::Error, "bot_command_add() - Bot command added with empty name string - check bot_command.cpp.");
Log(Logs::General, Logs::Error, "bot_command_add() - Bot command added with empty name string - check bot_command.cpp.");
return -1;
}
if (function == nullptr) {
Log.Out(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());
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());
return -1;
}
if (bot_command_list.count(bot_command_name) != 0) {
Log.Out(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());
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());
return -1;
}
for (auto iter : bot_command_list) {
if (iter.second->function != function)
continue;
Log.Out(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());
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());
return -1;
}
@@ -1563,11 +1563,11 @@ int bot_command_real_dispatch(Client *c, const char *message)
}
if(cur->access >= COMMANDS_LOGGING_MIN_STATUS) {
Log.Out(Logs::General, Logs::Commands, "%s (%s) used bot command: %s (target=%s)", c->GetName(), c->AccountName(), message, c->GetTarget()?c->GetTarget()->GetName():"NONE");
Log(Logs::General, Logs::Commands, "%s (%s) used bot command: %s (target=%s)", c->GetName(), c->AccountName(), message, c->GetTarget()?c->GetTarget()->GetName():"NONE");
}
if(cur->function == nullptr) {
Log.Out(Logs::General, Logs::Error, "Bot command '%s' has a null function\n", cstr.c_str());
Log(Logs::General, Logs::Error, "Bot command '%s' has a null function\n", cstr.c_str());
return(-1);
} else {
//dispatch C++ bot command
@@ -3500,7 +3500,7 @@ void bot_command_pick_lock(Client *c, const Seperator *sep)
float curelev = (diff.z * diff.z);
#if (EQDEBUG >= 11)
if (curdist <= 130 && curelev <= 65 && curelev >= 25) // 2D limit is '130' (x^2 + y^2), 1D theoretically should be '65' (z^2)
Log.Out(Logs::Detail, Logs::Doors, "bot_command_pick_lock(): DoorID: %i - Elevation difference failure within theoretical limit (%f <= 65.0)", door_iter->GetDoorID(), curelev);
Log(Logs::Detail, Logs::Doors, "bot_command_pick_lock(): DoorID: %i - Elevation difference failure within theoretical limit (%f <= 65.0)", door_iter->GetDoorID(), curelev);
#endif
if (curelev >= 25 || curdist > 130) // changed curelev from '10' to '25' - requiring diff.z to be less than '5'
continue;
@@ -4188,7 +4188,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.Out(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)",
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)",
my_bot->GetCleanName(), my_bot->GetBotID(), c->GetCleanName(), c->CharacterID(), c->AccountName(), c->AccountID());
return;
}
+4 -4
View File
@@ -49,11 +49,11 @@ bool BotDatabase::Connect(const char* host, const char* user, const char* passwd
uint32 errnum = 0;
char errbuf[MYSQL_ERRMSG_SIZE];
if (!Open(host, user, passwd, database, port, &errnum, errbuf)) {
Log.Out(Logs::General, Logs::Error, "Failed to connect to bot database: Error: %s", errbuf);
Log(Logs::General, Logs::Error, "Failed to connect to bot database: Error: %s", errbuf);
return false;
}
else {
Log.Out(Logs::General, Logs::Status, "Using bot database '%s' at %s:%d", database, host, port);
Log(Logs::General, Logs::Status, "Using bot database '%s' at %s:%d", database, host, port);
return true;
}
}
@@ -1143,7 +1143,7 @@ bool BotDatabase::LoadItems(const uint32 bot_id, EQEmu::InventoryProfile& invent
(uint32)atoul(row[14])
);
if (!item_inst) {
Log.Out(Logs::General, Logs::Error, "Warning: bot_id '%i' has an invalid item_id '%i' in inventory slot '%i'", bot_id, item_id, slot_id);
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);
continue;
}
@@ -1196,7 +1196,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.Out(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);
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);
safe_delete(item_inst);
}
+5 -5
View File
@@ -1137,7 +1137,7 @@ bool Bot::AI_PursueCastCheck() {
AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting.
Log.Out(Logs::Detail, Logs::AI, "Bot Engaged (pursuing) autocast check triggered. Trying to cast offensive spells.");
Log(Logs::Detail, Logs::AI, "Bot Engaged (pursuing) autocast check triggered. Trying to cast offensive spells.");
if(!AICastSpell(GetTarget(), 100, SpellType_Snare)) {
if(!AICastSpell(GetTarget(), 100, SpellType_Lifetap)) {
@@ -1165,7 +1165,7 @@ bool Bot::AI_IdleCastCheck() {
if (AIautocastspell_timer->Check(false)) {
#if BotAI_DEBUG_Spells >= 25
Log.Out(Logs::Detail, Logs::AI, "Bot Non-Engaged autocast check triggered: %s", this->GetCleanName());
Log(Logs::Detail, Logs::AI, "Bot Non-Engaged autocast check triggered: %s", this->GetCleanName());
#endif
AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting.
@@ -1313,7 +1313,7 @@ bool Bot::AI_EngagedCastCheck() {
BotStanceType botStance = GetBotStance();
bool mayGetAggro = HasOrMayGetAggro();
Log.Out(Logs::Detail, Logs::AI, "Engaged autocast check triggered (BOTS). Trying to cast healing spells then maybe offensive spells.");
Log(Logs::Detail, Logs::AI, "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)) {
@@ -1563,11 +1563,11 @@ bool Bot::AIHealRotation(Mob* tar, bool useFastHeals) {
}
#if BotAI_DEBUG_Spells >= 10
Log.Out(Logs::Detail, Logs::AI, "Bot::AIHealRotation: heal spellid = %u, fastheals = %c, casterlevel = %u",
Log(Logs::Detail, Logs::AI, "Bot::AIHealRotation: heal spellid = %u, fastheals = %c, casterlevel = %u",
botSpell.SpellId, ((useFastHeals) ? ('T') : ('F')), GetLevel());
#endif
#if BotAI_DEBUG_Spells >= 25
Log.Out(Logs::Detail, Logs::AI, "Bot::AIHealRotation: target = %s, current_time = %u, donthealmebefore = %u", tar->GetCleanName(), Timer::GetCurrentTime(), tar->DontHealMeBefore());
Log(Logs::Detail, Logs::AI, "Bot::AIHealRotation: target = %s, current_time = %u, donthealmebefore = %u", 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
+53 -51
View File
@@ -135,7 +135,7 @@ Client::Client(EQStreamInterface* ieqs)
forget_timer(0),
autosave_timer(RuleI(Character, AutosaveIntervalS) * 1000),
#ifdef REVERSE_AGGRO
scanarea_timer(RuleI(Aggro, ClientAggroCheckInterval) * 1000),
client_scan_npc_aggro_timer(RuleI(Aggro, ClientAggroCheckInterval) * 1000),
#endif
tribute_timer(Tribute_duration),
proximity_timer(ClientProximity_interval),
@@ -153,14 +153,14 @@ Client::Client(EQStreamInterface* ieqs)
anon_toggle_timer(250),
afk_toggle_timer(250),
helm_toggle_timer(250),
light_update_timer(600),
aggro_meter_timer(AGGRO_METER_UPDATE_MS),
m_Proximity(FLT_MAX, FLT_MAX, FLT_MAX), //arbitrary large number
m_ZoneSummonLocation(-2.0f,-2.0f,-2.0f),
m_AutoAttackPosition(0.0f, 0.0f, 0.0f, 0.0f),
m_AutoAttackTargetLocation(0.0f, 0.0f, 0.0f),
last_region_type(RegionTypeUnsupported),
m_dirtyautohaters(false)
m_dirtyautohaters(false),
npc_close_scan_timer(6000)
{
for(int cf=0; cf < _FilterCount; cf++)
ClientFilters[cf] = FilterShow;
@@ -176,6 +176,7 @@ Client::Client(EQStreamInterface* ieqs)
client_state = CLIENT_CONNECTING;
Trader=false;
Buyer = false;
Haste = 0;
CustomerID = 0;
TraderID = 0;
TrackingID = 0;
@@ -349,7 +350,7 @@ Client::~Client() {
ToggleBuyerMode(false);
if(conn_state != ClientConnectFinished) {
Log.Out(Logs::General, Logs::None, "Client '%s' was destroyed before reaching the connected state:", GetName());
Log(Logs::General, Logs::None, "Client '%s' was destroyed before reaching the connected state:", GetName());
ReportConnectingState();
}
@@ -358,6 +359,8 @@ Client::~Client() {
m_tradeskill_object = nullptr;
}
close_npcs.clear();
if(IsDueling() && GetDuelTarget() != 0) {
Entity* entity = entity_list.GetID(GetDuelTarget());
if(entity != nullptr && entity->IsClient()) {
@@ -508,31 +511,31 @@ void Client::SendLogoutPackets() {
void Client::ReportConnectingState() {
switch(conn_state) {
case NoPacketsReceived: //havent gotten anything
Log.Out(Logs::General, Logs::None, "Client has not sent us an initial zone entry packet.");
Log(Logs::General, Logs::None, "Client has not sent us an initial zone entry packet.");
break;
case ReceivedZoneEntry: //got the first packet, loading up PP
Log.Out(Logs::General, Logs::None, "Client sent initial zone packet, but we never got their player info from the database.");
Log(Logs::General, Logs::None, "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.Out(Logs::General, Logs::None, "We were sending the player profile, tributes, tasks, spawns, time and weather, but never finished.");
Log(Logs::General, Logs::None, "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.Out(Logs::General, Logs::None, "We successfully sent player info and spawns, waiting for client to request new zone.");
Log(Logs::General, Logs::None, "We successfully sent player info and spawns, waiting for client to request new zone.");
break;
case NewZoneRequested: //received and sent new zone request
Log.Out(Logs::General, Logs::None, "We received client's new zone request, waiting for client spawn request.");
Log(Logs::General, Logs::None, "We received client's new zone request, waiting for client spawn request.");
break;
case ClientSpawnRequested: //client sent ReqClientSpawn
Log.Out(Logs::General, Logs::None, "We received the client spawn request, and were sending objects, doors, zone points and some other stuff, but never finished.");
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.");
break;
case ZoneContentsSent: //objects, doors, zone points
Log.Out(Logs::General, Logs::None, "The rest of the zone contents were successfully sent, waiting for client ready notification.");
Log(Logs::General, Logs::None, "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.Out(Logs::General, Logs::None, "We received client ready notification, but never finished Client::CompleteConnect");
Log(Logs::General, Logs::None, "We received client ready notification, but never finished Client::CompleteConnect");
break;
case ClientConnectFinished: //client finally moved to finished state, were done here
Log.Out(Logs::General, Logs::None, "Client is successfully connected.");
Log(Logs::General, Logs::None, "Client is successfully connected.");
break;
};
}
@@ -733,7 +736,7 @@ bool Client::SendAllPackets() {
if(eqs)
eqs->FastQueuePacket((EQApplicationPacket **)&cp->app, cp->ack_req);
iterator.RemoveCurrent();
Log.Out(Logs::Moderate, Logs::Client_Server_Packet, "Transmitting a packet");
Log(Logs::Moderate, Logs::Client_Server_Packet, "Transmitting a packet");
}
return true;
}
@@ -781,7 +784,7 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s
char message[4096];
strn0cpy(message, orig_message, sizeof(message));
Log.Out(Logs::Detail, Logs::Zone_Server, "Client::ChannelMessageReceived() Channel:%i message:'%s'", chan_num, message);
Log(Logs::Detail, Logs::Zone_Server, "Client::ChannelMessageReceived() Channel:%i message:'%s'", chan_num, message);
if (targetname == nullptr) {
targetname = (!GetTarget()) ? "" : GetTarget()->GetName();
@@ -1216,7 +1219,7 @@ void Client::ChannelMessageSend(const char* from, const char* to, uint8 chan_num
QueuePacket(&app);
if ((chan_num == 2) && (ListenerSkill < 100)) { // group message in unmastered language, check for skill up
if ((m_pp.languages[language] <= lang_skill) && (from != this->GetName()))
if (m_pp.languages[language] <= lang_skill)
CheckLanguageSkillIncrease(language, lang_skill);
}
}
@@ -1607,7 +1610,7 @@ void Client::UpdateAdmin(bool iFromDB) {
if(m_pp.gm)
{
Log.Out(Logs::Moderate, Logs::Zone_Server, "%s - %s is a GM", __FUNCTION__ , GetName());
Log(Logs::Moderate, Logs::Zone_Server, "%s - %s 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);
@@ -2015,7 +2018,7 @@ void Client::ReadBook(BookRequest_Struct *book) {
if (booktxt2[0] != '\0') {
#if EQDEBUG >= 6
Log.Out(Logs::General, Logs::Normal, "Client::ReadBook() textfile:%s Text:%s", txtfile, booktxt2.c_str());
Log(Logs::General, Logs::Normal, "Client::ReadBook() textfile:%s Text:%s", txtfile, booktxt2.c_str());
#endif
auto outapp = new EQApplicationPacket(OP_ReadBook, length + sizeof(BookText_Struct));
@@ -2235,7 +2238,7 @@ void Client::AddMoneyToPP(uint64 copper, bool updateclient){
SaveCurrency();
Log.Out(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);
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);
}
void Client::EVENT_ITEM_ScriptStopReturn(){
@@ -2275,7 +2278,7 @@ void Client::AddMoneyToPP(uint32 copper, uint32 silver, uint32 gold, uint32 plat
SaveCurrency();
#if (EQDEBUG>=5)
Log.Out(Logs::General, Logs::None, "Client::AddMoneyToPP() %s should have: plat:%i gold:%i silver:%i copper:%i",
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);
#endif
}
@@ -2365,13 +2368,13 @@ bool Client::CheckIncreaseSkill(EQEmu::skills::SkillType skillid, Mob *against_w
if(zone->random.Real(0, 99) < Chance)
{
SetSkill(skillid, GetRawSkill(skillid) + 1);
Log.Out(Logs::Detail, Logs::Skills, "Skill %d at value %d successfully gain with %d%%chance (mod %d)", skillid, skillval, Chance, chancemodi);
Log(Logs::Detail, Logs::Skills, "Skill %d at value %d successfully gain with %d%%chance (mod %d)", skillid, skillval, Chance, chancemodi);
return true;
} else {
Log.Out(Logs::Detail, Logs::Skills, "Skill %d at value %d failed to gain with %d%%chance (mod %d)", skillid, skillval, Chance, chancemodi);
Log(Logs::Detail, Logs::Skills, "Skill %d at value %d failed to gain with %d%%chance (mod %d)", skillid, skillval, Chance, chancemodi);
}
} else {
Log.Out(Logs::Detail, Logs::Skills, "Skill %d at value %d cannot increase due to maxmum %d", skillid, skillval, maxskill);
Log(Logs::Detail, Logs::Skills, "Skill %d at value %d cannot increase due to maxmum %d", skillid, skillval, maxskill);
}
return false;
}
@@ -2392,10 +2395,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.Out(Logs::Detail, Logs::Skills, "Language %d at value %d successfully gain with %.4f%%chance", langid, LangSkill, Chance);
Log(Logs::Detail, Logs::Skills, "Language %d at value %d successfully gain with %.4f%%chance", langid, LangSkill, Chance);
}
else
Log.Out(Logs::Detail, Logs::Skills, "Language %d at value %d failed to gain with %.4f%%chance", langid, LangSkill, Chance);
Log(Logs::Detail, Logs::Skills, "Language %d at value %d failed to gain with %.4f%%chance", langid, LangSkill, Chance);
}
}
@@ -2504,7 +2507,7 @@ uint16 Client::GetMaxSkillAfterSpecializationRules(EQEmu::skills::SkillType skil
Save();
Log.Out(Logs::General, Logs::Normal, "Reset %s's caster specialization skills to 1. "
Log(Logs::General, Logs::Normal, "Reset %s's caster specialization skills to 1. "
"Too many specializations skills were above 50.", GetCleanName());
}
@@ -4702,14 +4705,14 @@ void Client::HandleLDoNOpen(NPC *target)
{
if(target->GetClass() != LDON_TREASURE)
{
Log.Out(Logs::General, Logs::None, "%s tried to open %s but %s was not a treasure chest.",
Log(Logs::General, Logs::None, "%s tried to open %s but %s was not a treasure chest.",
GetName(), target->GetName(), target->GetName());
return;
}
if(DistanceSquaredNoZ(m_Position, target->GetPosition()) > RuleI(Adventure, LDoNTrapDistanceUse))
{
Log.Out(Logs::General, Logs::None, "%s tried to open %s but %s was out of range",
Log(Logs::General, Logs::None, "%s tried to open %s but %s was out of range",
GetName(), target->GetName(), target->GetName());
Message(13, "Treasure chest out of range.");
return;
@@ -6346,12 +6349,12 @@ void Client::Doppelganger(uint16 spell_id, Mob *target, const char *name_overrid
PetRecord record;
if(!database.GetPetEntry(spells[spell_id].teleport_zone, &record))
{
Log.Out(Logs::General, Logs::Error, "Unknown doppelganger spell id: %d, check pets table", spell_id);
Log(Logs::General, Logs::Error, "Unknown doppelganger spell id: %d, check pets table", spell_id);
Message(13, "Unable to find data for pet %s", spells[spell_id].teleport_zone);
return;
}
AA_SwarmPet pet;
SwarmPet_Struct pet;
pet.count = pet_count;
pet.duration = pet_duration;
pet.npc_id = record.npc_type;
@@ -6360,7 +6363,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.Out(Logs::General, Logs::Error, "Unknown npc type for doppelganger spell id: %d", spell_id);
Log(Logs::General, Logs::Error, "Unknown npc type for doppelganger spell id: %d", spell_id);
Message(0,"Unable to find pet!");
return;
}
@@ -6426,33 +6429,35 @@ void Client::Doppelganger(uint16 spell_id, Mob *target, const char *name_overrid
memcpy(npc_dup, made_npc, sizeof(NPCType));
}
NPC* npca = new NPC(
NPC* swarm_pet_npc = new NPC(
(npc_dup!=nullptr)?npc_dup:npc_type, //make sure we give the NPC the correct data pointer
0,
GetPosition() + glm::vec4(swarmPetLocations[summon_count], 0.0f, 0.0f),
FlyMode3);
if(!npca->GetSwarmInfo()){
auto nSI = new AA_SwarmPetInfo;
npca->SetSwarmInfo(nSI);
npca->GetSwarmInfo()->duration = new Timer(pet_duration*1000);
if(!swarm_pet_npc->GetSwarmInfo()){
auto nSI = new SwarmPet;
swarm_pet_npc->SetSwarmInfo(nSI);
swarm_pet_npc->GetSwarmInfo()->duration = new Timer(pet_duration*1000);
}
else{
npca->GetSwarmInfo()->duration->Start(pet_duration*1000);
swarm_pet_npc->GetSwarmInfo()->duration->Start(pet_duration*1000);
}
npca->GetSwarmInfo()->owner_id = GetID();
swarm_pet_npc->StartSwarmTimer(pet_duration * 1000);
swarm_pet_npc->GetSwarmInfo()->owner_id = GetID();
// Give the pets alittle more agro than the caster and then agro them on the target
target->AddToHateList(npca, (target->GetHateAmount(this) + 100), (target->GetDamageAmount(this) + 100));
npca->AddToHateList(target, 1000, 1000);
npca->GetSwarmInfo()->target = target->GetID();
target->AddToHateList(swarm_pet_npc, (target->GetHateAmount(this) + 100), (target->GetDamageAmount(this) + 100));
swarm_pet_npc->AddToHateList(target, 1000, 1000);
swarm_pet_npc->GetSwarmInfo()->target = target->GetID();
//we allocated a new NPC type object, give the NPC ownership of that memory
if(npc_dup != nullptr)
npca->GiveNPCTypeData(npc_dup);
swarm_pet_npc->GiveNPCTypeData(npc_dup);
entity_list.AddNPC(npca);
entity_list.AddNPC(swarm_pet_npc);
summon_count--;
}
}
@@ -7628,7 +7633,7 @@ void Client::SendMercPersonalInfo()
stancecount += zone->merc_stance_list[GetMercInfo().MercTemplateID].size();
if(stancecount > MAX_MERC_STANCES || mercCount > MAX_MERC || mercTypeCount > MAX_MERC_GRADES)
{
Log.Out(Logs::General, Logs::Mercenaries, "SendMercPersonalInfo canceled: (%i) (%i) (%i) for %s", stancecount, mercCount, mercTypeCount, GetName());
Log(Logs::General, Logs::Mercenaries, "SendMercPersonalInfo canceled: (%i) (%i) (%i) for %s", stancecount, mercCount, mercTypeCount, GetName());
SendMercMerchantResponsePacket(0);
return;
}
@@ -7724,13 +7729,13 @@ void Client::SendMercPersonalInfo()
return;
}
}
Log.Out(Logs::General, Logs::Mercenaries, "SendMercPersonalInfo Send Successful for %s.", GetName());
Log(Logs::General, Logs::Mercenaries, "SendMercPersonalInfo Send Successful for %s.", GetName());
SendMercMerchantResponsePacket(0);
}
else
{
Log.Out(Logs::General, Logs::Mercenaries, "SendMercPersonalInfo Send Failed Due to no MercData (%i) for %s", GetMercInfo().MercTemplateID, GetName());
Log(Logs::General, Logs::Mercenaries, "SendMercPersonalInfo Send Failed Due to no MercData (%i) for %s", GetMercInfo().MercTemplateID, GetName());
}
}
@@ -8498,7 +8503,7 @@ void Client::Consume(const EQEmu::ItemData *item, uint8 type, int16 slot, bool a
entity_list.MessageClose_StringID(this, true, 50, 0, EATING_MESSAGE, GetName(), item->Name);
#if EQDEBUG >= 5
Log.Out(Logs::General, Logs::None, "Eating from slot:%i", (int)slot);
Log(Logs::General, Logs::None, "Eating from slot:%i", (int)slot);
#endif
}
else
@@ -8515,7 +8520,7 @@ void Client::Consume(const EQEmu::ItemData *item, uint8 type, int16 slot, bool a
entity_list.MessageClose_StringID(this, true, 50, 0, DRINKING_MESSAGE, GetName(), item->Name);
#if EQDEBUG >= 5
Log.Out(Logs::General, Logs::None, "Drinking from slot:%i", (int)slot);
Log(Logs::General, Logs::None, "Drinking from slot:%i", (int)slot);
#endif
}
}
@@ -8653,9 +8658,6 @@ void Client::QuestReward(Mob* target, uint32 copper, uint32 silver, uint32 gold,
}
void Client::SendHPUpdateMarquee(){
if (!RuleB(Character, MarqueeHPUpdates))
return;
if (!this || !this->IsClient() || !this->cur_hp || !this->max_hp)
return;
+5 -2
View File
@@ -221,6 +221,9 @@ public:
Client(EQStreamInterface * ieqs);
~Client();
std::unordered_map<NPC *, float> close_npcs;
bool is_client_moving;
//abstract virtual function implementations required by base abstract class
virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, EQEmu::skills::SkillType attack_skill);
virtual void Damage(Mob* from, int32 damage, uint16 spell_id, EQEmu::skills::SkillType attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false, eSpecialAttacks special = eSpecialAttacks::None);
@@ -1458,7 +1461,7 @@ private:
Timer forget_timer; // our 2 min everybody forgets you timer
Timer autosave_timer;
#ifdef REVERSE_AGGRO
Timer scanarea_timer;
Timer client_scan_npc_aggro_timer;
#endif
Timer tribute_timer;
@@ -1475,8 +1478,8 @@ private:
Timer anon_toggle_timer;
Timer afk_toggle_timer;
Timer helm_toggle_timer;
Timer light_update_timer;
Timer aggro_meter_timer;
Timer npc_close_scan_timer;
glm::vec3 m_Proximity;
+6 -6
View File
@@ -1021,7 +1021,7 @@ int32 Client::acmod()
//seems about 21 agil per extra AC pt over 300...
return (65 + ((agility - 300) / 21));
}
Log.Out(Logs::Detail, Logs::Error, "Error in Client::acmod(): Agility: %i, Level: %i", agility, level);
Log(Logs::Detail, Logs::Error, "Error in Client::acmod(): Agility: %i, Level: %i", agility, level);
return 0;
};
@@ -1038,7 +1038,7 @@ int32 Client::CalcMaxMana()
break;
}
default: {
Log.Out(Logs::Detail, Logs::Spells, "Invalid Class '%c' in CalcMaxMana", GetCasterClass());
Log(Logs::Detail, Logs::Spells, "Invalid Class '%c' in CalcMaxMana", GetCasterClass());
max_mana = 0;
break;
}
@@ -1056,7 +1056,7 @@ int32 Client::CalcMaxMana()
cur_mana = curMana_cap;
}
}
Log.Out(Logs::Detail, Logs::Spells, "Client::CalcMaxMana() called for %s - returning %d", GetName(), max_mana);
Log(Logs::Detail, Logs::Spells, "Client::CalcMaxMana() called for %s - returning %d", GetName(), max_mana);
return max_mana;
}
@@ -1140,13 +1140,13 @@ int32 Client::CalcBaseMana()
break;
}
default: {
Log.Out(Logs::General, Logs::None, "Invalid Class '%c' in CalcMaxMana", GetCasterClass());
Log(Logs::General, Logs::None, "Invalid Class '%c' in CalcMaxMana", GetCasterClass());
max_m = 0;
break;
}
}
#if EQDEBUG >= 11
Log.Out(Logs::General, Logs::None, "Client::CalcBaseMana() called for %s - returning %d", GetName(), max_m);
Log(Logs::General, Logs::None, "Client::CalcBaseMana() called for %s - returning %d", GetName(), max_m);
#endif
return max_m;
}
@@ -2023,7 +2023,7 @@ 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.Out(Logs::Detail, Logs::Spells, "%s::GetInstrumentMod() spell=%d mod=%d modcap=%d\n", GetName(), spell_id,
Log(Logs::Detail, Logs::Spells, "%s::GetInstrumentMod() spell=%d mod=%d modcap=%d\n", GetName(), spell_id,
effectmod, effectmodcap);
return effectmod;
}
+874 -866
View File
File diff suppressed because it is too large Load Diff
+129 -118
View File
@@ -63,7 +63,7 @@ extern EntityList entity_list;
bool Client::Process() {
bool ret = true;
if(Connected() || IsLD())
if (Connected() || IsLD())
{
// try to send all packets that weren't sent before
if (!IsLD() && zoneinpacket_timer.Check())
@@ -71,58 +71,58 @@ bool Client::Process() {
SendAllPackets();
}
if(adventure_request_timer)
if (adventure_request_timer)
{
if(adventure_request_timer->Check())
if (adventure_request_timer->Check())
{
safe_delete(adventure_request_timer);
}
}
if(adventure_create_timer)
if (adventure_create_timer)
{
if(adventure_create_timer->Check())
if (adventure_create_timer->Check())
{
safe_delete(adventure_create_timer);
}
}
if(adventure_leave_timer)
if (adventure_leave_timer)
{
if(adventure_leave_timer->Check())
if (adventure_leave_timer->Check())
{
safe_delete(adventure_leave_timer);
}
}
if(adventure_door_timer)
if (adventure_door_timer)
{
if(adventure_door_timer->Check())
if (adventure_door_timer->Check())
{
safe_delete(adventure_door_timer);
}
}
if(adventure_stats_timer)
if (adventure_stats_timer)
{
if(adventure_stats_timer->Check())
if (adventure_stats_timer->Check())
{
safe_delete(adventure_stats_timer);
}
}
if(adventure_leaderboard_timer)
if (adventure_leaderboard_timer)
{
if(adventure_leaderboard_timer->Check())
if (adventure_leaderboard_timer->Check())
{
safe_delete(adventure_leaderboard_timer);
}
}
if(dead)
if (dead)
{
SetHP(-100);
if(RespawnFromHoverTimer.Check())
if (RespawnFromHoverTimer.Check())
HandleRespawnFromHover(0);
}
@@ -131,13 +131,13 @@ bool Client::Process() {
// SendHPUpdate calls hpupdate_timer.Start so it can delay this timer, so lets not reset with the check
// since the function will anyways
if(hpupdate_timer.Check(false))
if (hpupdate_timer.Check(false))
SendHPUpdate();
if(mana_timer.Check())
if (mana_timer.Check())
SendManaUpdatePacket();
if(dead && dead_timer.Check()) {
if (dead && dead_timer.Check()) {
database.MoveCharacterToZone(GetName(), database.GetZoneName(m_pp.binds[0].zoneId));
m_pp.zone_id = m_pp.binds[0].zoneId;
@@ -150,7 +150,7 @@ bool Client::Process() {
Group *mygroup = GetGroup();
if (mygroup)
{
entity_list.MessageGroup(this,true,15,"%s died.", GetName());
entity_list.MessageGroup(this, true, 15, "%s died.", GetName());
mygroup->MemberZoned(this);
}
Raid *myraid = entity_list.GetRaidByClient(this);
@@ -161,34 +161,29 @@ bool Client::Process() {
return(false);
}
if(charm_update_timer.Check())
{
if (charm_update_timer.Check()) {
CalcItemScale();
}
if(TaskPeriodic_Timer.Check() && taskstate)
if (TaskPeriodic_Timer.Check() && taskstate)
taskstate->TaskPeriodicChecks(this);
if(linkdead_timer.Check())
{
if (linkdead_timer.Check()) {
LeaveGroup();
Save();
if (GetMerc())
{
if (GetMerc()) {
GetMerc()->Save();
GetMerc()->Depop();
}
Raid *myraid = entity_list.GetRaidByClient(this);
if (myraid)
{
if (myraid) {
myraid->MemberZoned(this);
}
return false; //delete client
}
if (camp_timer.Check())
{
if (camp_timer.Check()) {
LeaveGroup();
Save();
if (GetMerc())
@@ -202,8 +197,7 @@ bool Client::Process() {
if (IsStunned() && stunned_timer.Check())
Mob::UnStun();
if(!m_CheatDetectMoved)
{
if (!m_CheatDetectMoved) {
m_TimeSinceLastPositionCheck = Timer::GetCurrentTime();
}
@@ -211,32 +205,32 @@ bool Client::Process() {
//NOTE: this is kinda a heavy-handed check to make sure the mob still exists before
//doing the next pulse on them...
Mob *song_target = nullptr;
if(bardsong_target_id == GetID()) {
if (bardsong_target_id == GetID()) {
song_target = this;
} else {
}
else {
song_target = entity_list.GetMob(bardsong_target_id);
}
if (song_target == nullptr) {
InterruptSpell(SONG_ENDS_ABRUPTLY, 0x121, bardsong);
} else {
if(!ApplyNextBardPulse(bardsong, song_target, bardsong_slot))
}
else {
if (!ApplyNextBardPulse(bardsong, song_target, bardsong_slot))
InterruptSpell(SONG_ENDS_ABRUPTLY, 0x121, bardsong);
//SpellFinished(bardsong, bardsong_target, bardsong_slot, spells[bardsong].mana);
}
}
if(GetMerc())
{
if (GetMerc()) {
UpdateMercTimer();
}
if(GetMercInfo().MercTemplateID != 0 && GetMercInfo().IsSuspended)
{
if (GetMercInfo().MercTemplateID != 0 && GetMercInfo().IsSuspended) {
CheckMercSuspendTimer();
}
if(IsAIControlled())
if (IsAIControlled())
AI_Process();
// Don't reset the bindwound timer so we can check it in BindWound as well.
@@ -244,28 +238,36 @@ bool Client::Process() {
BindWound(bindwound_target, false);
}
if(KarmaUpdateTimer)
{
if(KarmaUpdateTimer->Check(false))
{
if (KarmaUpdateTimer) {
if (KarmaUpdateTimer->Check(false)) {
KarmaUpdateTimer->Start(RuleI(Chat, KarmaUpdateIntervalMS));
database.UpdateKarma(AccountID(), ++TotalKarma);
}
}
if(qGlobals)
{
if(qglobal_purge_timer.Check())
{
if (qGlobals) {
if (qglobal_purge_timer.Check()) {
qGlobals->PurgeExpiredGlobals();
}
}
if(light_update_timer.Check()) {
/* Build a close range list of NPC's */
if (npc_close_scan_timer.Check()) {
UpdateEquipmentLight();
if(UpdateActiveLight()) {
SendAppearancePacket(AT_Light, GetActiveLightType());
close_npcs.clear();
auto &npc_list = entity_list.GetNPCList();
float scan_range = RuleI(Range, ClientNPCScan);
for (auto itr = npc_list.begin(); itr != npc_list.end(); ++itr) {
NPC* npc = itr->second;
float distance = DistanceNoZ(m_Position, npc->GetPosition());
if(distance <= scan_range) {
close_npcs.insert(std::pair<NPC *, float>(npc, distance));
}
else if (npc->GetAggroRange() > scan_range) {
close_npcs.insert(std::pair<NPC *, float>(npc, distance));
}
}
}
@@ -279,35 +281,35 @@ bool Client::Process() {
- being stunned or mezzed
- having used a ranged weapon recently
*/
if(auto_attack) {
if(!IsAIControlled() && !dead
if (auto_attack) {
if (!IsAIControlled() && !dead
&& !(spellend_timer.Enabled() && casting_spell_id && !IsBardSong(casting_spell_id))
&& !IsStunned() && !IsFeared() && !IsMezzed() && GetAppearance() != eaDead && !IsMeleeDisabled()
)
may_use_attacks = true;
if(may_use_attacks && ranged_timer.Enabled()) {
if (may_use_attacks && ranged_timer.Enabled()) {
//if the range timer is enabled, we need to consider it
if(!ranged_timer.Check(false)) {
if (!ranged_timer.Check(false)) {
//the ranged timer has not elapsed, cannot attack.
may_use_attacks = false;
}
}
}
if(AutoFireEnabled()){
if (AutoFireEnabled()) {
EQEmu::ItemInstance *ranged = GetInv().GetItem(EQEmu::inventory::slotRange);
if(ranged)
if (ranged)
{
if (ranged->GetItem() && ranged->GetItem()->ItemType == EQEmu::item::ItemTypeBow){
if(ranged_timer.Check(false)){
if(GetTarget() && (GetTarget()->IsNPC() || GetTarget()->IsClient())){
if(GetTarget()->InFrontMob(this, GetTarget()->GetX(), GetTarget()->GetY())){
if(CheckLosFN(GetTarget())){
if (ranged->GetItem() && ranged->GetItem()->ItemType == EQEmu::item::ItemTypeBow) {
if (ranged_timer.Check(false)) {
if (GetTarget() && (GetTarget()->IsNPC() || GetTarget()->IsClient())) {
if (GetTarget()->InFrontMob(this, GetTarget()->GetX(), GetTarget()->GetY())) {
if (CheckLosFN(GetTarget())) {
//client has built in los check, but auto fire does not.. done last.
RangedAttack(GetTarget());
if (CheckDoubleRangedAttack())
RangedAttack(GetTarget(), true);
if (CheckDoubleRangedAttack())
RangedAttack(GetTarget(), true);
}
else
ranged_timer.Start();
@@ -319,11 +321,11 @@ bool Client::Process() {
ranged_timer.Start();
}
}
else if (ranged->GetItem() && (ranged->GetItem()->ItemType == EQEmu::item::ItemTypeLargeThrowing || ranged->GetItem()->ItemType == EQEmu::item::ItemTypeSmallThrowing)){
if(ranged_timer.Check(false)){
if(GetTarget() && (GetTarget()->IsNPC() || GetTarget()->IsClient())){
if(GetTarget()->InFrontMob(this, GetTarget()->GetX(), GetTarget()->GetY())){
if(CheckLosFN(GetTarget())){
else if (ranged->GetItem() && (ranged->GetItem()->ItemType == EQEmu::item::ItemTypeLargeThrowing || ranged->GetItem()->ItemType == EQEmu::item::ItemTypeSmallThrowing)) {
if (ranged_timer.Check(false)) {
if (GetTarget() && (GetTarget()->IsNPC() || GetTarget()->IsClient())) {
if (GetTarget()->InFrontMob(this, GetTarget()->GetX(), GetTarget()->GetY())) {
if (CheckLosFN(GetTarget())) {
//client has built in los check, but auto fire does not.. done last.
ThrowingAttack(GetTarget());
}
@@ -345,9 +347,9 @@ bool Client::Process() {
{
//check if change
//only check on primary attack.. sorry offhand you gotta wait!
if(aa_los_them_mob)
if (aa_los_them_mob)
{
if(auto_attack_target != aa_los_them_mob ||
if (auto_attack_target != aa_los_them_mob ||
m_AutoAttackPosition.x != GetX() ||
m_AutoAttackPosition.y != GetY() ||
m_AutoAttackPosition.z != GetZ() ||
@@ -379,11 +381,11 @@ bool Client::Process() {
if (!CombatRange(auto_attack_target))
{
Message_StringID(MT_TooFarAway,TARGET_TOO_FAR);
Message_StringID(MT_TooFarAway, TARGET_TOO_FAR);
}
else if (auto_attack_target == this)
{
Message_StringID(MT_TooFarAway,TRY_ATTACKING_SOMEONE);
Message_StringID(MT_TooFarAway, TRY_ATTACKING_SOMEONE);
}
else if (!los_status || !los_status_facing)
{
@@ -412,23 +414,23 @@ bool Client::Process() {
}
}
if(auto_attack && may_use_attacks && auto_attack_target != nullptr
if (auto_attack && may_use_attacks && auto_attack_target != nullptr
&& CanThisClassDualWield() && attack_dw_timer.Check())
{
// Range check
if(!CombatRange(auto_attack_target)) {
if (!CombatRange(auto_attack_target)) {
// this is a duplicate message don't use it.
//Message_StringID(MT_TooFarAway,TARGET_TOO_FAR);
}
// Don't attack yourself
else if(auto_attack_target == this) {
else if (auto_attack_target == this) {
//Message_StringID(MT_TooFarAway,TRY_ATTACKING_SOMEONE);
}
else if (!los_status || !los_status_facing)
{
//you can't see your target
}
else if(auto_attack_target->GetHP() > -10) {
else if (auto_attack_target->GetHP() > -10) {
CheckIncreaseSkill(EQEmu::skills::SkillDualWield, auto_attack_target, -10);
if (CheckDualWield()) {
EQEmu::ItemInstance *wpn = GetInv().GetItem(EQEmu::inventory::slotSecondary);
@@ -442,7 +444,7 @@ bool Client::Process() {
if (position_timer.Check()) {
if (IsAIControlled())
{
if(!IsMoving())
if (!IsMoving())
{
animation = 0;
m_Delta = glm::vec4(0.0f, 0.0f, 0.0f, m_Delta.w);
@@ -464,25 +466,25 @@ bool Client::Process() {
}
}
if(HasVirus()) {
if(viral_timer.Check()) {
if (HasVirus()) {
if (viral_timer.Check()) {
viral_timer_counter++;
for(int i = 0; i < MAX_SPELL_TRIGGER*2; i+=2) {
if(viral_spells[i]) {
if(viral_timer_counter % spells[viral_spells[i]].viral_timer == 0) {
SpreadVirus(viral_spells[i], viral_spells[i+1]);
for (int i = 0; i < MAX_SPELL_TRIGGER * 2; i += 2) {
if (viral_spells[i]) {
if (viral_timer_counter % spells[viral_spells[i]].viral_timer == 0) {
SpreadVirus(viral_spells[i], viral_spells[i + 1]);
}
}
}
}
if(viral_timer_counter > 999)
if (viral_timer_counter > 999)
viral_timer_counter = 0;
}
ProjectileAttack();
if(spellbonuses.GravityEffect == 1) {
if(gravity_timer.Check())
if (spellbonuses.GravityEffect == 1) {
if (gravity_timer.Check())
DoGravityEffect();
}
@@ -514,7 +516,7 @@ bool Client::Process() {
}
SpellProcess();
if (endupkeep_timer.Check() && !dead){
if (endupkeep_timer.Check() && !dead) {
DoEnduranceUpkeep();
}
@@ -530,7 +532,7 @@ bool Client::Process() {
BuffProcess();
DoStaminaUpdate();
if(tribute_timer.Check()) {
if (tribute_timer.Check()) {
ToggleTribute(true); //re-activate the tribute.
}
@@ -542,18 +544,18 @@ bool Client::Process() {
Save(0);
}
if(m_pp.intoxication > 0)
if (m_pp.intoxication > 0)
{
--m_pp.intoxication;
CalcBonuses();
}
if(ItemTickTimer.Check())
if (ItemTickTimer.Check())
{
TickItemCheck();
}
if(ItemQuestTimer.Check())
if (ItemQuestTimer.Check())
{
ItemTimerCheck();
}
@@ -582,7 +584,7 @@ bool Client::Process() {
if (client_state != CLIENT_LINKDEAD && !eqs->CheckState(ESTABLISHED)) {
OnDisconnect(true);
Log.Out(Logs::General, Logs::Zone_Server, "Client linkdead: %s", name);
Log(Logs::General, Logs::Zone_Server, "Client linkdead: %s", name);
if (GetGM()) {
if (GetMerc())
@@ -592,8 +594,8 @@ bool Client::Process() {
}
return false;
}
else if(!linkdead_timer.Enabled()){
linkdead_timer.Start(RuleI(Zone,ClientLinkdeadMS));
else if (!linkdead_timer.Enabled()) {
linkdead_timer.Start(RuleI(Zone, ClientLinkdeadMS));
client_state = CLIENT_LINKDEAD;
AI_Start(CLIENT_LD_TIMEOUT);
SendAppearancePacket(AT_Linkdead, 1);
@@ -603,10 +605,10 @@ bool Client::Process() {
/************ Get all packets from packet manager out queue and process them ************/
EQApplicationPacket *app = nullptr;
if(!eqs->CheckState(CLOSING))
if (!eqs->CheckState(CLOSING))
{
while(ret && (app = (EQApplicationPacket *)eqs->PopPacket())) {
if(app)
while (ret && (app = (EQApplicationPacket *)eqs->PopPacket())) {
if (app)
ret = HandlePacket(app);
safe_delete(app);
}
@@ -616,8 +618,17 @@ bool Client::Process() {
//At this point, we are still connected, everything important has taken
//place, now check to see if anybody wants to aggro us.
// only if client is not feigned
if(zone->CanDoCombat() && ret && !GetFeigned() && scanarea_timer.Check()) {
entity_list.CheckClientAggro(this);
if (zone->CanDoCombat() && ret && !GetFeigned() && client_scan_npc_aggro_timer.Check()) {
int npc_scan_count = 0;
for (auto it = close_npcs.begin(); it != close_npcs.end(); ++it) {
NPC *npc = it->first;
if (npc->CheckWillAggro(this) && !npc->CheckAggro(this)) {
npc->AddToHateList(this, 25);
}
npc_scan_count++;
}
Log(Logs::General, Logs::Aggro, "Checking Reverse Aggro (client->npc) scanned_npcs (%i)", npc_scan_count);
}
#endif
@@ -718,7 +729,7 @@ void Client::OnDisconnect(bool hard_disconnect) {
Mob *Other = trade->With();
if(Other)
{
Log.Out(Logs::Detail, Logs::Trading, "Client disconnected during a trade. Returning their items.");
Log(Logs::Detail, Logs::Trading, "Client disconnected during a trade. Returning their items.");
FinishTrade(this);
if(Other->IsClient())
@@ -750,7 +761,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.Out(Logs::Detail, Logs::Inventory, "Incomplete Trade Transaction: Moving %s from slot %i to %i", inst->GetItem()->Name, slot_id, free_slot_id);
Log(Logs::Detail, Logs::Inventory, "Incomplete Trade Transaction: Moving %s from slot %i to %i", inst->GetItem()->Name, slot_id, free_slot_id);
PutItemInInventory(free_slot_id, *inst, false);
database.SaveInventory(character_id, nullptr, slot_id);
safe_delete(inst);
@@ -779,7 +790,7 @@ void Client::BulkSendInventoryItems()
inst->Serialize(ob, slot_id);
if (ob.tellp() == last_pos)
Log.Out(Logs::General, Logs::Inventory, "Serialization failed on item slot %d during BulkSendInventoryItems. Item skipped.", slot_id);
Log(Logs::General, Logs::Inventory, "Serialization failed on item slot %d during BulkSendInventoryItems. Item skipped.", slot_id);
last_pos = ob.tellp();
}
@@ -791,7 +802,7 @@ void Client::BulkSendInventoryItems()
inst->Serialize(ob, EQEmu::inventory::slotPowerSource);
if (ob.tellp() == last_pos)
Log.Out(Logs::General, Logs::Inventory, "Serialization failed on item slot %d during BulkSendInventoryItems. Item skipped.", EQEmu::inventory::slotPowerSource);
Log(Logs::General, Logs::Inventory, "Serialization failed on item slot %d during BulkSendInventoryItems. Item skipped.", EQEmu::inventory::slotPowerSource);
last_pos = ob.tellp();
}
@@ -806,7 +817,7 @@ void Client::BulkSendInventoryItems()
inst->Serialize(ob, slot_id);
if (ob.tellp() == last_pos)
Log.Out(Logs::General, Logs::Inventory, "Serialization failed on item slot %d during BulkSendInventoryItems. Item skipped.", slot_id);
Log(Logs::General, Logs::Inventory, "Serialization failed on item slot %d during BulkSendInventoryItems. Item skipped.", slot_id);
last_pos = ob.tellp();
}
@@ -820,7 +831,7 @@ void Client::BulkSendInventoryItems()
inst->Serialize(ob, slot_id);
if (ob.tellp() == last_pos)
Log.Out(Logs::General, Logs::Inventory, "Serialization failed on item slot %d during BulkSendInventoryItems. Item skipped.", slot_id);
Log(Logs::General, Logs::Inventory, "Serialization failed on item slot %d during BulkSendInventoryItems. Item skipped.", slot_id);
last_pos = ob.tellp();
}
@@ -908,7 +919,7 @@ void Client::BulkSendMerchantInventory(int merchant_id, int npcid) {
// Account for merchant lists with gaps.
if (ml.slot >= i) {
if (ml.slot > i)
Log.Out(Logs::General, Logs::None, "(WARNING) Merchantlist contains gap at slot %d. Merchant: %d, NPC: %d", i, merchant_id, npcid);
Log(Logs::General, Logs::None, "(WARNING) Merchantlist contains gap at slot %d. Merchant: %d, NPC: %d", i, merchant_id, npcid);
i = ml.slot + 1;
}
}
@@ -1000,7 +1011,7 @@ uint8 Client::WithCustomer(uint16 NewCustomer){
Client* c = entity_list.GetClientByID(CustomerID);
if(!c) {
Log.Out(Logs::Detail, Logs::Trading, "Previous customer has gone away.");
Log(Logs::Detail, Logs::Trading, "Previous customer has gone away.");
CustomerID = NewCustomer;
return 1;
}
@@ -1012,7 +1023,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.Out(Logs::Detail, Logs::Spells, "Unexpected OP_RezzAnswer. Ignoring it.");
Log(Logs::Detail, Logs::Spells, "Unexpected OP_RezzAnswer. Ignoring it.");
Message(13, "You have already been resurrected.\n");
return;
}
@@ -1022,7 +1033,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.Out(Logs::Detail, Logs::Spells, "Player %s got a %i Rezz, spellid %i in zone%i, instance id %i",
Log(Logs::Detail, Logs::Spells, "Player %s got a %i Rezz, spellid %i in zone%i, instance id %i",
this->name, (uint16)spells[SpellID].base[0],
SpellID, ZoneID, InstanceID);
@@ -1075,7 +1086,7 @@ void Client::OPMemorizeSpell(const EQApplicationPacket* app)
{
if(app->size != sizeof(MemorizeSpell_Struct))
{
Log.Out(Logs::General, Logs::Error, "Wrong size on OP_MemorizeSpell. Got: %i, Expected: %i", app->size, sizeof(MemorizeSpell_Struct));
Log(Logs::General, Logs::Error, "Wrong size on OP_MemorizeSpell. Got: %i, Expected: %i", app->size, sizeof(MemorizeSpell_Struct));
DumpPacket(app);
return;
}
@@ -1628,12 +1639,12 @@ void Client::OPGMTrainSkill(const EQApplicationPacket *app)
EQEmu::skills::SkillType skill = (EQEmu::skills::SkillType)gmskill->skill_id;
if(!CanHaveSkill(skill)) {
Log.Out(Logs::Detail, Logs::Skills, "Tried to train skill %d, which is not allowed.", skill);
Log(Logs::Detail, Logs::Skills, "Tried to train skill %d, which is not allowed.", skill);
return;
}
if(MaxSkill(skill) == 0) {
Log.Out(Logs::Detail, Logs::Skills, "Tried to train skill %d, but training is not allowed at this level.", skill);
Log(Logs::Detail, Logs::Skills, "Tried to train skill %d, but training is not allowed at this level.", skill);
return;
}
@@ -2027,7 +2038,7 @@ void Client::HandleRespawnFromHover(uint32 Option)
{
if (PendingRezzXP < 0 || PendingRezzSpellID == 0)
{
Log.Out(Logs::Detail, Logs::Spells, "Unexpected Rezz from hover request.");
Log(Logs::Detail, Logs::Spells, "Unexpected Rezz from hover request.");
return;
}
SetHP(GetMaxHP() / 5);
@@ -2061,10 +2072,10 @@ void Client::HandleRespawnFromHover(uint32 Option)
if (corpse && corpse->IsCorpse())
{
Log.Out(Logs::Detail, Logs::Spells, "Hover Rez in zone %s for corpse %s",
Log(Logs::Detail, Logs::Spells, "Hover Rez in zone %s for corpse %s",
zone->GetShortName(), PendingRezzCorpseName.c_str());
Log.Out(Logs::Detail, Logs::Spells, "Found corpse. Marking corpse as rezzed.");
Log(Logs::Detail, Logs::Spells, "Found corpse. Marking corpse as rezzed.");
corpse->IsRezzed(true);
corpse->CompleteResurrection();
+44 -44
View File
@@ -430,12 +430,12 @@ int command_init(void)
auto iter_cs = command_settings.find(iter_cl->first);
if (iter_cs == command_settings.end()) {
if (iter_cl->second->access == 0)
Log.Out(Logs::General, Logs::Commands, "command_init(): Warning: Command '%s' defaulting to access level 0!", iter_cl->first.c_str());
Log(Logs::General, Logs::Commands, "command_init(): Warning: Command '%s' defaulting to access level 0!", iter_cl->first.c_str());
continue;
}
iter_cl->second->access = iter_cs->second.first;
Log.Out(Logs::General, Logs::Commands, "command_init(): - Command '%s' set to access level %d.", iter_cl->first.c_str(), 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())
continue;
@@ -444,14 +444,14 @@ int command_init(void)
if (iter_aka->empty())
continue;
if (commandlist.find(*iter_aka) != commandlist.end()) {
Log.Out(Logs::General, Logs::Commands, "command_init(): Warning: Alias '%s' already exists as a command - skipping!", iter_aka->c_str());
Log(Logs::General, Logs::Commands, "command_init(): Warning: Alias '%s' already exists as a command - skipping!", iter_aka->c_str());
continue;
}
commandlist[*iter_aka] = iter_cl->second;
commandaliases[*iter_aka] = iter_cl->first;
Log.Out(Logs::General, Logs::Commands, "command_init(): - Alias '%s' added to command '%s'.", iter_aka->c_str(), commandaliases[*iter_aka].c_str());
Log(Logs::General, Logs::Commands, "command_init(): - Alias '%s' added to command '%s'.", iter_aka->c_str(), commandaliases[*iter_aka].c_str());
}
}
@@ -491,21 +491,21 @@ void command_deinit(void)
int command_add(std::string command_name, const char *desc, int access, CmdFuncPtr function)
{
if (command_name.empty()) {
Log.Out(Logs::General, Logs::Error, "command_add() - Command added with empty name string - check command.cpp.");
Log(Logs::General, Logs::Error, "command_add() - Command added with empty name string - check command.cpp.");
return -1;
}
if (function == nullptr) {
Log.Out(Logs::General, Logs::Error, "command_add() - Command '%s' added without a valid function pointer - check command.cpp.", command_name.c_str());
Log(Logs::General, Logs::Error, "command_add() - Command '%s' added without a valid function pointer - check command.cpp.", command_name.c_str());
return -1;
}
if (commandlist.count(command_name) != 0) {
Log.Out(Logs::General, Logs::Error, "command_add() - Command '%s' is a duplicate command name - check command.cpp.", command_name.c_str());
Log(Logs::General, Logs::Error, "command_add() - Command '%s' 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.Out(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());
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());
return -1;
}
@@ -559,11 +559,11 @@ int command_realdispatch(Client *c, const char *message)
}
if(cur->access >= COMMANDS_LOGGING_MIN_STATUS) {
Log.Out(Logs::General, Logs::Commands, "%s (%s) used command: %s (target=%s)", c->GetName(), c->AccountName(), message, c->GetTarget()?c->GetTarget()->GetName():"NONE");
Log(Logs::General, Logs::Commands, "%s (%s) used command: %s (target=%s)", c->GetName(), c->AccountName(), message, c->GetTarget()?c->GetTarget()->GetName():"NONE");
}
if(cur->function == nullptr) {
Log.Out(Logs::General, Logs::Error, "Command '%s' has a null function\n", cstr.c_str());
Log(Logs::General, Logs::Error, "Command '%s' has a null function\n", cstr.c_str());
return(-1);
} else {
//dispatch C++ command
@@ -1262,7 +1262,7 @@ void command_viewpetition(Client *c, const Seperator *sep)
if (!results.Success())
return;
Log.Out(Logs::General, Logs::Normal, "View petition request from %s, petition number: %i", c->GetName(), atoi(sep->argplus[1]) );
Log(Logs::General, Logs::Normal, "View petition request from %s, petition number: %i", c->GetName(), atoi(sep->argplus[1]) );
if (results.RowCount() == 0) {
c->Message(13,"There was an error in your request: ID not found! Please check the Id and try again.");
@@ -1287,7 +1287,7 @@ void command_petitioninfo(Client *c, const Seperator *sep)
if (!results.Success())
return;
Log.Out(Logs::General, Logs::Normal, "Petition information request from %s, petition number:", c->GetName(), atoi(sep->argplus[1]) );
Log(Logs::General, Logs::Normal, "Petition information request from %s, petition number:", c->GetName(), atoi(sep->argplus[1]) );
if (results.RowCount() == 0) {
c->Message(13,"There was an error in your request: ID not found! Please check the Id and try again.");
@@ -1313,7 +1313,7 @@ void command_delpetition(Client *c, const Seperator *sep)
if (!results.Success())
return;
Log.Out(Logs::General, Logs::Normal, "Delete petition request from %s, petition number:", c->GetName(), atoi(sep->argplus[1]) );
Log(Logs::General, Logs::Normal, "Delete petition request from %s, petition number:", c->GetName(), atoi(sep->argplus[1]) );
}
@@ -1549,7 +1549,7 @@ void command_permaclass(Client *c, const Seperator *sep)
c->Message(0,"Target is not a client.");
else {
c->Message(0, "Setting %s's class...Sending to char select.", t->GetName());
Log.Out(Logs::General, Logs::Normal, "Class change request from %s for %s, requested class:%i", c->GetName(), t->GetName(), atoi(sep->arg[1]) );
Log(Logs::General, Logs::Normal, "Class change request from %s for %s, requested class:%i", c->GetName(), t->GetName(), atoi(sep->arg[1]) );
t->SetBaseClass(atoi(sep->arg[1]));
t->Save();
t->Kick();
@@ -1571,7 +1571,7 @@ void command_permarace(Client *c, const Seperator *sep)
c->Message(0,"Target is not a client.");
else {
c->Message(0, "Setting %s's race - zone to take effect", t->GetName());
Log.Out(Logs::General, Logs::Normal, "Permanant race change request from %s for %s, requested race:%i", c->GetName(), t->GetName(), atoi(sep->arg[1]) );
Log(Logs::General, Logs::Normal, "Permanant race change request from %s for %s, requested race:%i", 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);
@@ -1595,7 +1595,7 @@ void command_permagender(Client *c, const Seperator *sep)
c->Message(0,"Target is not a client.");
else {
c->Message(0, "Setting %s's gender - zone to take effect", t->GetName());
Log.Out(Logs::General, Logs::Normal, "Permanant gender change request from %s for %s, requested gender:%i", c->GetName(), t->GetName(), atoi(sep->arg[1]) );
Log(Logs::General, Logs::Normal, "Permanant gender change request from %s for %s, requested gender:%i", c->GetName(), t->GetName(), atoi(sep->arg[1]) );
t->SetBaseGender(atoi(sep->arg[1]));
t->Save();
t->SendIllusionPacket(atoi(sep->arg[1]));
@@ -1932,7 +1932,7 @@ void command_dbspawn2(Client *c, const Seperator *sep)
{
if (sep->IsNumber(1) && sep->IsNumber(2) && sep->IsNumber(3)) {
Log.Out(Logs::General, Logs::Normal, "Spawning database spawn");
Log(Logs::General, Logs::Normal, "Spawning database spawn");
uint16 cond = 0;
int16 cond_min = 0;
if(sep->IsNumber(4)) {
@@ -2255,7 +2255,7 @@ void command_setlanguage(Client *c, const Seperator *sep)
}
else
{
Log.Out(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]) );
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]) );
uint8 langid = (uint8)atoi(sep->arg[1]);
uint8 value = (uint8)atoi(sep->arg[2]);
c->GetTarget()->CastToClient()->SetLanguageSkill( langid, value );
@@ -2280,7 +2280,7 @@ void command_setskill(Client *c, const Seperator *sep)
c->Message(0, " x = 0 to %d", HIGHEST_CAN_SET_SKILL);
}
else {
Log.Out(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]) );
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]) );
int skill_num = atoi(sep->arg[1]);
uint16 skill_value = atoi(sep->arg[2]);
if (skill_num <= EQEmu::skills::HIGHEST_SKILL)
@@ -2300,7 +2300,7 @@ void command_setskillall(Client *c, const Seperator *sep)
}
else {
if (c->Admin() >= commandSetSkillsOther || c->GetTarget()==c || c->GetTarget()==0) {
Log.Out(Logs::General, Logs::Normal, "Set ALL skill request from %s, target:%s", c->GetName(), c->GetTarget()->GetName());
Log(Logs::General, Logs::Normal, "Set ALL skill request from %s, target:%s", 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);
@@ -3123,7 +3123,7 @@ void command_listpetition(Client *c, const Seperator *sep)
if (!results.Success())
return;
Log.Out(Logs::General, Logs::Normal, "Petition list requested by %s", c->GetName());
Log(Logs::General, Logs::Normal, "Petition list requested by %s", c->GetName());
if (results.RowCount() == 0)
return;
@@ -3781,7 +3781,7 @@ void command_lastname(Client *c, const Seperator *sep)
if(c->GetTarget() && c->GetTarget()->IsClient())
t=c->GetTarget()->CastToClient();
Log.Out(Logs::General, Logs::Normal, "#lastname request from %s for %s", c->GetName(), t->GetName());
Log(Logs::General, Logs::Normal, "#lastname request from %s for %s", c->GetName(), t->GetName());
if(strlen(sep->arg[1]) <= 70)
t->ChangeLastName(sep->arg[1]);
@@ -4338,7 +4338,7 @@ void command_iteminfo(Client *c, const Seperator *sep)
}
auto item = inst->GetItem();
if (!item) {
Log.Out(Logs::General, Logs::Inventory, "(%s) Command #iteminfo processed an item with no data pointer");
Log(Logs::General, Logs::Inventory, "(%s) Command #iteminfo processed an item with no data pointer");
c->Message(13, "Error: This item has no data reference");
return;
}
@@ -4445,7 +4445,7 @@ void command_time(Client *c, const Seperator *sep)
}
c->Message(13, "Setting world time to %s:%i (Timezone: 0)...", sep->arg[1], minutes);
zone->SetTime(atoi(sep->arg[1])+1, minutes);
Log.Out(Logs::General, Logs::Zone_Server, "%s :: Setting world time to %s:%i (Timezone: 0)...", c->GetCleanName(), sep->arg[1], minutes);
Log(Logs::General, Logs::Zone_Server, "%s :: Setting world time to %s:%i (Timezone: 0)...", c->GetCleanName(), sep->arg[1], minutes);
}
else {
c->Message(13, "To set the Time: #time HH [MM]");
@@ -4460,7 +4460,7 @@ void command_time(Client *c, const Seperator *sep)
zone->zone_time.getEQTimeZoneMin()
);
c->Message(13, "It is now %s.", timeMessage);
Log.Out(Logs::General, Logs::Zone_Server, "Current Time is: %s", timeMessage);
Log(Logs::General, Logs::Zone_Server, "Current Time is: %s", timeMessage);
}
}
@@ -4594,10 +4594,10 @@ void command_guild(Client *c, const Seperator *sep)
}
if(guild_id == GUILD_NONE) {
Log.Out(Logs::Detail, Logs::Guilds, "%s: Removing %s (%d) from guild with GM command.", c->GetName(),
Log(Logs::Detail, Logs::Guilds, "%s: Removing %s (%d) from guild with GM command.", c->GetName(),
sep->arg[2], charid);
} else {
Log.Out(Logs::Detail, Logs::Guilds, "%s: Putting %s (%d) into guild %s (%d) with GM command.", c->GetName(),
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);
}
@@ -4646,7 +4646,7 @@ void command_guild(Client *c, const Seperator *sep)
return;
}
Log.Out(Logs::Detail, Logs::Guilds, "%s: Setting %s (%d)'s guild rank to %d with GM command.", c->GetName(),
Log(Logs::Detail, Logs::Guilds, "%s: Setting %s (%d)'s guild rank to %d with GM command.", c->GetName(),
sep->arg[2], charid, rank);
if(!guild_mgr.SetGuildRank(charid, rank))
@@ -4688,7 +4688,7 @@ void command_guild(Client *c, const Seperator *sep)
uint32 id = guild_mgr.CreateGuild(sep->argplus[3], leader);
Log.Out(Logs::Detail, Logs::Guilds, "%s: Creating guild %s with leader %d with GM command. It was given id %lu.", c->GetName(),
Log(Logs::Detail, Logs::Guilds, "%s: Creating guild %s with leader %d with GM command. It was given id %lu.", c->GetName(),
sep->argplus[3], leader, (unsigned long)id);
if (id == GUILD_NONE)
@@ -4727,7 +4727,7 @@ void command_guild(Client *c, const Seperator *sep)
}
}
Log.Out(Logs::Detail, Logs::Guilds, "%s: Deleting guild %s (%d) with GM command.", c->GetName(),
Log(Logs::Detail, Logs::Guilds, "%s: Deleting guild %s (%d) with GM command.", c->GetName(),
guild_mgr.GetGuildName(id), id);
if (!guild_mgr.DeleteGuild(id))
@@ -4761,7 +4761,7 @@ void command_guild(Client *c, const Seperator *sep)
}
}
Log.Out(Logs::Detail, Logs::Guilds, "%s: Renaming guild %s (%d) to '%s' with GM command.", c->GetName(),
Log(Logs::Detail, Logs::Guilds, "%s: Renaming guild %s (%d) to '%s' with GM command.", c->GetName(),
guild_mgr.GetGuildName(id), id, sep->argplus[3]);
if (!guild_mgr.RenameGuild(id, sep->argplus[3]))
@@ -4812,7 +4812,7 @@ void command_guild(Client *c, const Seperator *sep)
}
}
Log.Out(Logs::Detail, Logs::Guilds, "%s: Setting leader of guild %s (%d) to %d with GM command.", c->GetName(),
Log(Logs::Detail, Logs::Guilds, "%s: Setting leader of guild %s (%d) to %d with GM command.", c->GetName(),
guild_mgr.GetGuildName(id), id, leader);
if(!guild_mgr.SetGuildLeader(id, leader))
@@ -5272,7 +5272,7 @@ void command_scribespells(Client *c, const Seperator *sep)
t->Message(0, "Scribing spells to spellbook.");
if(t != c)
c->Message(0, "Scribing spells for %s.", t->GetName());
Log.Out(Logs::General, Logs::Normal, "Scribe spells request for %s from %s, levels: %u -> %u", t->GetName(), c->GetName(), min_level, max_level);
Log(Logs::General, Logs::Normal, "Scribe spells request for %s from %s, levels: %u -> %u", t->GetName(), c->GetName(), min_level, max_level);
for(curspell = 0, book_slot = t->GetNextAvailableSpellBookSlot(), count = 0; curspell < SPDAT_RECORDS && book_slot < MAX_PP_SPELLBOOK; curspell++, book_slot = t->GetNextAvailableSpellBookSlot(book_slot))
{
@@ -5329,7 +5329,7 @@ void command_scribespell(Client *c, const Seperator *sep) {
if(t != c)
c->Message(0, "Scribing spell: %s (%i) for %s.", spells[spell_id].name, spell_id, t->GetName());
Log.Out(Logs::General, Logs::Normal, "Scribe spell: %s (%i) request for %s from %s.", spells[spell_id].name, spell_id, t->GetName(), c->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());
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();
@@ -5376,7 +5376,7 @@ void command_unscribespell(Client *c, const Seperator *sep) {
if(t != c)
c->Message(0, "Unscribing spell: %s (%i) for %s.", spells[spell_id].name, spell_id, t->GetName());
Log.Out(Logs::General, Logs::Normal, "Unscribe spell: %s (%i) request for %s from %s.", spells[spell_id].name, spell_id, t->GetName(), c->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());
}
else {
t->Message(13, "Unable to unscribe spell: %s (%i) from your spellbook. This spell is not scribed.", spells[spell_id].name, spell_id);
@@ -7816,7 +7816,7 @@ void command_traindisc(Client *c, const Seperator *sep)
t->Message(0, "Training disciplines");
if(t != c)
c->Message(0, "Training disciplines for %s.", t->GetName());
Log.Out(Logs::General, Logs::Normal, "Train disciplines request for %s from %s, levels: %u -> %u", t->GetName(), c->GetName(), min_level, max_level);
Log(Logs::General, Logs::Normal, "Train disciplines request for %s from %s, levels: %u -> %u", t->GetName(), c->GetName(), min_level, max_level);
for(curspell = 0, count = 0; curspell < SPDAT_RECORDS; curspell++)
{
@@ -10613,7 +10613,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.Out(Logs::General, Logs::Debug, "[%u] Test #2... Took %f seconds", i, ((float)(std::clock() - t)) / CLOCKS_PER_SEC);
Log(Logs::General, Logs::Debug, "[%u] Test #2... Took %f seconds", i, ((float)(std::clock() - t)) / CLOCKS_PER_SEC);
}
}
@@ -10645,22 +10645,22 @@ void command_logs(Client *c, const Seperator *sep){
c->Message(0, "[Category ID | console | file | gmsay | Category Description]");
redisplay_columns = 0;
}
c->Message(0, StringFormat("--- %i | %u | %u | %u | %s", i, Log.log_settings[i].log_to_console, Log.log_settings[i].log_to_file, Log.log_settings[i].log_to_gmsay, Logs::LogCategoryName[i]).c_str());
c->Message(0, StringFormat("--- %i | %u | %u | %u | %s", i, LogSys.log_settings[i].log_to_console, LogSys.log_settings[i].log_to_file, LogSys.log_settings[i].log_to_gmsay, Logs::LogCategoryName[i]).c_str());
redisplay_columns++;
}
}
/* #logs set */
if (strcasecmp(sep->arg[1], "set") == 0){
if (strcasecmp(sep->arg[2], "console") == 0){
Log.log_settings[atoi(sep->arg[3])].log_to_console = atoi(sep->arg[4]);
LogSys.log_settings[atoi(sep->arg[3])].log_to_console = atoi(sep->arg[4]);
logs_set = 1;
}
else if (strcasecmp(sep->arg[2], "file") == 0){
Log.log_settings[atoi(sep->arg[3])].log_to_file = atoi(sep->arg[4]);
LogSys.log_settings[atoi(sep->arg[3])].log_to_file = atoi(sep->arg[4]);
logs_set = 1;
}
else if (strcasecmp(sep->arg[2], "gmsay") == 0){
Log.log_settings[atoi(sep->arg[3])].log_to_gmsay = atoi(sep->arg[4]);
LogSys.log_settings[atoi(sep->arg[3])].log_to_gmsay = atoi(sep->arg[4]);
logs_set = 1;
}
else{
@@ -10675,10 +10675,10 @@ void command_logs(Client *c, const Seperator *sep){
This is used in hot places of code to check if its enabled in any way before triggering logs
*/
if (atoi(sep->arg[4]) > 0){
Log.log_settings[atoi(sep->arg[3])].is_category_enabled = 1;
LogSys.log_settings[atoi(sep->arg[3])].is_category_enabled = 1;
}
else{
Log.log_settings[atoi(sep->arg[3])].is_category_enabled = 0;
LogSys.log_settings[atoi(sep->arg[3])].is_category_enabled = 0;
}
}
}
@@ -10701,7 +10701,7 @@ void command_mysqltest(Client *c, const Seperator *sep)
auto results = database.QueryDatabase(query);
}
}
Log.Out(Logs::General, Logs::Debug, "MySQL Test... Took %f seconds", ((float)(std::clock() - t)) / CLOCKS_PER_SEC);
Log(Logs::General, Logs::Debug, "MySQL Test... Took %f seconds", ((float)(std::clock() - t)) / CLOCKS_PER_SEC);
}
void command_resetaa_timer(Client *c, const Seperator *sep) {
+4 -4
View File
@@ -798,7 +798,7 @@ bool Corpse::Process() {
spc->zone_id = zone->graveyard_zoneid();
worldserver.SendPacket(pack);
safe_delete(pack);
Log.Out(Logs::General, Logs::None, "Moved %s player corpse to the designated graveyard in zone %s.", this->GetName(), database.GetZoneName(zone->graveyard_zoneid()));
Log(Logs::General, Logs::None, "Moved %s player corpse to the designated graveyard in zone %s.", this->GetName(), database.GetZoneName(zone->graveyard_zoneid()));
corpse_db_id = 0;
}
@@ -828,10 +828,10 @@ bool Corpse::Process() {
Save();
player_corpse_depop = true;
corpse_db_id = 0;
Log.Out(Logs::General, Logs::None, "Tagged %s player corpse has buried.", this->GetName());
Log(Logs::General, Logs::None, "Tagged %s player corpse has buried.", this->GetName());
}
else {
Log.Out(Logs::General, Logs::Error, "Unable to bury %s player corpse.", this->GetName());
Log(Logs::General, Logs::Error, "Unable to bury %s player corpse.", this->GetName());
return true;
}
}
@@ -1046,7 +1046,7 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a
for(; cur != end; ++cur) {
ServerLootItem_Struct* item_data = *cur;
item = database.GetItem(item_data->item_id);
Log.Out(Logs::General, Logs::None, "Corpse Looting: %s was not sent to client loot window (corpse_dbid: %i, charname: %s(%s))", item->Name, GetCorpseDBID(), client->GetName(), client->GetGM() ? "GM" : "Owner");
Log(Logs::General, Logs::None, "Corpse Looting: %s was not sent to client loot window (corpse_dbid: %i, charname: %s(%s))", item->Name, GetCorpseDBID(), client->GetName(), client->GetGM() ? "GM" : "Owner");
client->Message(0, "Inaccessable Corpse Item: %s", item->Name);
}
}
+9 -9
View File
@@ -133,9 +133,9 @@ bool Doors::Process()
void Doors::HandleClick(Client* sender, uint8 trigger)
{
//door debugging info dump
Log.Out(Logs::Detail, Logs::Doors, "%s clicked door %s (dbid %d, eqid %d) at %s", sender->GetName(), door_name, db_id, door_id, to_string(m_Position).c_str());
Log.Out(Logs::Detail, Logs::Doors, " incline %d, opentype %d, lockpick %d, key %d, nokeyring %d, trigger %d type %d, param %d", incline, opentype, lockpick, keyitem, nokeyring, trigger_door, trigger_type, door_param);
Log.Out(Logs::Detail, Logs::Doors, " size %d, invert %d, dest: %s %s", size, invert_state, dest_zone, to_string(m_Destination).c_str());
Log(Logs::Detail, Logs::Doors, "%s clicked door %s (dbid %d, eqid %d) at %s", sender->GetName(), door_name, db_id, door_id, to_string(m_Position).c_str());
Log(Logs::Detail, Logs::Doors, " incline %d, opentype %d, lockpick %d, key %d, nokeyring %d, trigger %d type %d, param %d", incline, opentype, lockpick, keyitem, nokeyring, trigger_door, trigger_type, door_param);
Log(Logs::Detail, Logs::Doors, " size %d, invert %d, dest: %s %s", size, invert_state, dest_zone, to_string(m_Destination).c_str());
auto outapp = new EQApplicationPacket(OP_MoveDoor, sizeof(MoveDoor_Struct));
MoveDoor_Struct* md = (MoveDoor_Struct*)outapp->pBuffer;
@@ -291,7 +291,7 @@ void Doors::HandleClick(Client* sender, uint8 trigger)
float modskill = sender->GetSkill(EQEmu::skills::SkillPickLock);
sender->CheckIncreaseSkill(EQEmu::skills::SkillPickLock, nullptr, 1);
Log.Out(Logs::General, Logs::Skills, "Client has lockpicks: skill=%f", modskill);
Log(Logs::General, Logs::Skills, "Client has lockpicks: skill=%f", modskill);
if(GetLockpick() <= modskill)
{
@@ -547,13 +547,13 @@ void Doors::ToggleState(Mob *sender)
}
void Doors::DumpDoor(){
Log.Out(Logs::General, Logs::None,
Log(Logs::General, Logs::None,
"db_id:%i door_id:%i zone_name:%s door_name:%s %s",
db_id, door_id, zone_name, door_name, to_string(m_Position).c_str());
Log.Out(Logs::General, Logs::None,
Log(Logs::General, Logs::None,
"opentype:%i guild_id:%i lockpick:%i keyitem:%i nokeyring:%i trigger_door:%i trigger_type:%i door_param:%i open:%s",
opentype, guild_id, lockpick, keyitem, nokeyring, trigger_door, trigger_type, door_param, (isopen) ? "open":"closed");
Log.Out(Logs::General, Logs::None,
Log(Logs::General, Logs::None,
"dest_zone:%s destination:%s ",
dest_zone, to_string(m_Destination).c_str());
}
@@ -629,7 +629,7 @@ int32 ZoneDatabase::GetDoorsDBCountPlusOne(const char *zone_name, int16 version)
}
bool ZoneDatabase::LoadDoors(int32 iDoorCount, Door *into, const char *zone_name, int16 version) {
Log.Out(Logs::General, Logs::Status, "Loading Doors from database...");
Log(Logs::General, Logs::Status, "Loading Doors from database...");
// Door tmpDoor;
@@ -656,7 +656,7 @@ bool ZoneDatabase::LoadDoors(int32 iDoorCount, Door *into, const char *zone_name
into[rowIndex].db_id = atoi(row[0]);
into[rowIndex].door_id = atoi(row[1]);
Log.Out(Logs::Detail, Logs::Doors, "Door Load: db id: %u, door_id %u", into[rowIndex].db_id, into[rowIndex].door_id);
Log(Logs::Detail, Logs::Doors, "Door Load: db id: %u, door_id %u", into[rowIndex].db_id, into[rowIndex].door_id);
strn0cpy(into[rowIndex].zone_name,row[2],32);
strn0cpy(into[rowIndex].door_name,row[3],32);
+1 -1
View File
@@ -485,7 +485,7 @@ bool Client::TrainDiscipline(uint32 itemid) {
const EQEmu::ItemData *item = database.GetItem(itemid);
if(item == nullptr) {
Message(13, "Unable to find the tome you turned in!");
Log.Out(Logs::General, Logs::Error, "Unable to find turned in tome id %lu\n", (unsigned long)itemid);
Log(Logs::General, Logs::Error, "Unable to find turned in tome id %lu\n", (unsigned long)itemid);
return(false);
}
+1 -1
View File
@@ -144,7 +144,7 @@ void PerlembParser::ReloadQuests() {
perl = nullptr;
}
Log.Out(Logs::General, Logs::Status, "Error re-initializing perlembed: %s", e.what());
Log(Logs::General, Logs::Status, "Error re-initializing perlembed: %s", e.what());
throw e.what();
}
+4 -4
View File
@@ -3654,13 +3654,13 @@ XS(XS__debug)
return;
if (debug_level == Logs::General){
Log.Out(Logs::General, Logs::QuestDebug, log_message);
Log(Logs::General, Logs::QuestDebug, log_message);
}
else if (debug_level == Logs::Moderate){
Log.Out(Logs::Moderate, Logs::QuestDebug, log_message);
Log(Logs::Moderate, Logs::QuestDebug, log_message);
}
else if (debug_level == Logs::Detail){
Log.Out(Logs::Detail, Logs::QuestDebug, log_message);
Log(Logs::Detail, Logs::QuestDebug, log_message);
}
}
XSRETURN_EMPTY;
@@ -3693,7 +3693,7 @@ EXTERN_C XS(boot_quest)
file[255] = '\0';
if(items != 1)
Log.Out(Logs::General, Logs::Error, "boot_quest does not take any arguments.");
Log(Logs::General, Logs::Error, "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.Out(Logs::General, Logs::Quests, "perl error: %s", err);
Log(Logs::General, Logs::Quests, "perl error: %s", err);
throw "failed to install eval_file hook";
}
#ifdef EMBPERL_IO_CAPTURE
Log.Out(Logs::General, Logs::Quests, "Tying perl output to eqemu logs");
Log(Logs::General, Logs::Quests, "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.Out(Logs::General, Logs::Quests, "Loading perlemb plugins.");
Log(Logs::General, Logs::Quests, "Loading perlemb plugins.");
try
{
std::string perl_command;
@@ -179,7 +179,7 @@ void Embperl::DoInit() {
}
catch(const char *err)
{
Log.Out(Logs::General, Logs::Quests, "Warning - %s: %s", Config->PluginPlFile.c_str(), err);
Log(Logs::General, Logs::Quests, "Warning - %s: %s", Config->PluginPlFile.c_str(), err);
}
try
{
@@ -197,7 +197,7 @@ void Embperl::DoInit() {
}
catch(const char *err)
{
Log.Out(Logs::General, Logs::Quests, "Perl warning: %s", err);
Log(Logs::General, Logs::Quests, "Perl warning: %s", err);
}
#endif //EMBPERL_PLUGIN
in_use = false;
+3 -3
View File
@@ -68,7 +68,7 @@ EXTERN_C XS(boot_qc)
file[255] = '\0';
if(items != 1)
Log.Out(Logs::General, Logs::Error, "boot_qc does not take any arguments.");
Log(Logs::General, Logs::Error, "boot_qc does not take any arguments.");
char buf[128]; //shouldent have any function names longer than this.
@@ -104,7 +104,7 @@ XS(XS_EQEmuIO_PRINT)
int len = 0;
for(i = 0; *cur != '\0'; i++, cur++) {
if(*cur == '\n') {
Log.Out(Logs::General, Logs::Quests, str);
Log(Logs::General, Logs::Quests, str);
len = 0;
pos = i+1;
} else {
@@ -112,7 +112,7 @@ XS(XS_EQEmuIO_PRINT)
}
}
if(len > 0) {
Log.Out(Logs::General, Logs::Quests, str);
Log(Logs::General, Logs::Quests, str);
}
}
+27 -12
View File
@@ -73,12 +73,12 @@ Entity::~Entity()
Client *Entity::CastToClient()
{
if (this == 0x00) {
Log.Out(Logs::General, Logs::Error, "CastToClient error (nullptr)");
Log(Logs::General, Logs::Error, "CastToClient error (nullptr)");
return 0;
}
#ifdef _EQDEBUG
if (!IsClient()) {
Log.Out(Logs::General, Logs::Error, "CastToClient error (not client)");
Log(Logs::General, Logs::Error, "CastToClient error (not client)");
return 0;
}
#endif
@@ -90,7 +90,7 @@ NPC *Entity::CastToNPC()
{
#ifdef _EQDEBUG
if (!IsNPC()) {
Log.Out(Logs::General, Logs::Error, "CastToNPC error (Not NPC)");
Log(Logs::General, Logs::Error, "CastToNPC error (Not NPC)");
return 0;
}
#endif
@@ -363,7 +363,7 @@ void EntityList::CheckGroupList (const char *fname, const int fline)
{
if (*it == nullptr)
{
Log.Out(Logs::General, Logs::Error, "nullptr group, %s:%i", fname, fline);
Log(Logs::General, Logs::Error, "nullptr group, %s:%i", fname, fline);
}
}
}
@@ -521,17 +521,17 @@ void EntityList::MobProcess()
#ifdef _WINDOWS
struct in_addr in;
in.s_addr = mob->CastToClient()->GetIP();
Log.Out(Logs::General, Logs::Zone_Server, "Dropping client: Process=false, ip=%s port=%u", inet_ntoa(in), mob->CastToClient()->GetPort());
Log(Logs::General, Logs::Zone_Server, "Dropping client: Process=false, ip=%s port=%u", inet_ntoa(in), mob->CastToClient()->GetPort());
#endif
zone->StartShutdownTimer();
Group *g = GetGroupByMob(mob);
if(g) {
Log.Out(Logs::General, Logs::Error, "About to delete a client still in a group.");
Log(Logs::General, Logs::Error, "About to delete a client still in a group.");
g->DelMember(mob);
}
Raid *r = entity_list.GetRaidByClient(mob->CastToClient());
if(r) {
Log.Out(Logs::General, Logs::Error, "About to delete a client still in a raid.");
Log(Logs::General, Logs::Error, "About to delete a client still in a raid.");
r->MemberZoned(mob->CastToClient());
}
entity_list.RemoveClient(id);
@@ -578,7 +578,7 @@ void EntityList::AddGroup(Group *group)
uint32 gid = worldserver.NextGroupID();
if (gid == 0) {
Log.Out(Logs::General, Logs::Error,
Log(Logs::General, Logs::Error,
"Unable to get new group ID from world server. group is going to be broken.");
return;
}
@@ -607,7 +607,7 @@ void EntityList::AddRaid(Raid *raid)
uint32 gid = worldserver.NextGroupID();
if (gid == 0) {
Log.Out(Logs::General, Logs::Error,
Log(Logs::General, Logs::Error,
"Unable to get new group ID from world server. group is going to be broken.");
return;
}
@@ -793,7 +793,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.Out(Logs::General, Logs::Error, "Error in EntityList::CheckSpawnQueue: Unable to find NPC for spawnId '%u'", ns->spawn.spawnId);
Log(Logs::General, Logs::Error, "Error in EntityList::CheckSpawnQueue: Unable to find NPC for spawnId '%u'", ns->spawn.spawnId);
}
else {
NPC *pnpc = it->second;
@@ -2288,10 +2288,15 @@ bool EntityList::RemoveNPC(uint16 delete_id)
{
auto it = npc_list.find(delete_id);
if (it != npc_list.end()) {
NPC *npc = it->second;
// make sure its proximity is removed
RemoveProximity(delete_id);
// remove from client close lists
RemoveNPCFromClientCloseLists(npc);
// remove from the list
npc_list.erase(it);
// remove from limit list if needed
if (npc_limit_list.count(delete_id))
npc_limit_list.erase(delete_id);
@@ -2300,6 +2305,16 @@ bool EntityList::RemoveNPC(uint16 delete_id)
return false;
}
bool EntityList::RemoveNPCFromClientCloseLists(NPC *npc)
{
auto it = client_list.begin();
while (it != client_list.end()) {
it->second->close_npcs.erase(npc);
++it;
}
return false;
}
bool EntityList::RemoveMerc(uint16 delete_id)
{
auto it = merc_list.find(delete_id);
@@ -2659,7 +2674,7 @@ char *EntityList::MakeNameUnique(char *name)
return name;
}
}
Log.Out(Logs::General, Logs::Error, "Fatal error in EntityList::MakeNameUnique: Unable to find unique name for '%s'", name);
Log(Logs::General, Logs::Error, "Fatal error in EntityList::MakeNameUnique: Unable to find unique name for '%s'", name);
char tmp[64] = "!";
strn0cpy(&tmp[1], name, sizeof(tmp) - 1);
strcpy(name, tmp);
@@ -3511,7 +3526,7 @@ void EntityList::ReloadAllClientsTaskState(int TaskID)
// If we have been passed a TaskID, only reload the client state if they have
// that Task active.
if ((!TaskID) || (TaskID && client->IsTaskActive(TaskID))) {
Log.Out(Logs::General, Logs::Tasks, "[CLIENTLOAD] Reloading Task State For Client %s", client->GetName());
Log(Logs::General, Logs::Tasks, "[CLIENTLOAD] Reloading Task State For Client %s", client->GetName());
client->RemoveClientTaskState();
client->LoadClientTaskState();
taskmanager->SendActiveTasksToClient(client);
+9
View File
@@ -279,6 +279,7 @@ public:
bool RemoveTrap(uint16 delete_id);
bool RemoveObject(uint16 delete_id);
bool RemoveProximity(uint16 delete_npc_id);
bool RemoveNPCFromClientCloseLists(NPC *npc);
void RemoveAllMobs();
void RemoveAllClients();
void RemoveAllNPCs();
@@ -454,6 +455,14 @@ public:
void GetSpawnList(std::list<Spawn2*> &d_list);
void GetTargetsForConeArea(Mob *start, float min_radius, float radius, float height, int pcnpc, std::list<Mob*> &m_list);
inline const std::unordered_map<uint16, Mob *> &GetMobList() { return mob_list; }
inline const std::unordered_map<uint16, NPC *> &GetNPCList() { return npc_list; }
inline const std::unordered_map<uint16, Merc *> &GetMercList() { return merc_list; }
inline const std::unordered_map<uint16, Client *> &GetClientList() { return client_list; }
inline const std::unordered_map<uint16, Corpse *> &GetCorpseList() { return corpse_list; }
inline const std::unordered_map<uint16, Object *> &GetObjectList() { return object_list; }
inline const std::unordered_map<uint16, Doors *> &GetDoorsList() { return door_list; }
void DepopAll(int NPCTypeID, bool StartSpawnTimer = true);
uint16 GetFreeID();
+4 -4
View File
@@ -331,7 +331,7 @@ void Client::AddEXP(uint32 in_add_exp, uint8 conlevel, bool resexp) {
}
void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) {
Log.Out(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");
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");
//max_AAXP = GetEXPForLevel(52) - GetEXPForLevel(51); //GetEXPForLevel() doesn't depend on class/race, just level, so it shouldn't change between Clients
max_AAXP = RuleI(AA, ExpPerPoint); //this may be redundant since we're doing this in Client::FinishConnState2()
if (max_AAXP == 0 || GetEXPForLevel(GetLevel()) == 0xFFFFFFFF) {
@@ -446,7 +446,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.Out(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);
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);
//get remainder exp points, set in PP below
set_aaxp = set_aaxp - (max_AAXP * m_pp.aapoints);
@@ -572,7 +572,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.Out(Logs::General, Logs::Error, "Client::SetLevel() GetEXPForLevel(%i) = 0xFFFFFFFF", set_level);
Log(Logs::General, Logs::Error, "Client::SetLevel() GetEXPForLevel(%i) = 0xFFFFFFFF", set_level);
return;
}
@@ -630,7 +630,7 @@ void Client::SetLevel(uint8 set_level, bool command)
safe_delete(outapp);
this->SendAppearancePacket(AT_WhoLevel, set_level); // who level change
Log.Out(Logs::General, Logs::Normal, "Setting Level for %s to %i", GetName(), set_level);
Log(Logs::General, Logs::Normal, "Setting Level for %s to %i", GetName(), set_level);
CalcBonuses();
+2 -2
View File
@@ -142,11 +142,11 @@ void Mob::CalculateNewFearpoint()
m_FearWalkTarget = glm::vec3(Loc.x, Loc.y, Loc.z);
currently_fleeing = true;
Log.Out(Logs::Detail, Logs::None, "Feared to node %i (%8.3f, %8.3f, %8.3f)", Node, Loc.x, Loc.y, Loc.z);
Log(Logs::Detail, Logs::None, "Feared to node %i (%8.3f, %8.3f, %8.3f)", Node, Loc.x, Loc.y, Loc.z);
return;
}
Log.Out(Logs::Detail, Logs::None, "No path found to selected node. Falling through to old fear point selection.");
Log(Logs::Detail, Logs::None, "No path found to selected node. Falling through to old fear point selection.");
}
int loop = 0;
+2 -2
View File
@@ -69,7 +69,7 @@ uint32 ZoneDatabase::GetZoneForage(uint32 ZoneID, uint8 skill) {
item[index] = atoi(row[0]);
chance[index] = atoi(row[1]) + chancepool;
Log.Out(Logs::General, Logs::Error, "Possible Forage: %d with a %d chance", item[index], chance[index]);
Log(Logs::General, Logs::Error, "Possible Forage: %d with a %d chance", item[index], chance[index]);
chancepool = chance[index];
}
@@ -405,7 +405,7 @@ void Client::ForageItem(bool guarantee) {
const EQEmu::ItemData* food_item = database.GetItem(foragedfood);
if(!food_item) {
Log.Out(Logs::General, Logs::Error, "nullptr returned from database.GetItem in ClientForageItem");
Log(Logs::General, Logs::Error, "nullptr returned from database.GetItem in ClientForageItem");
return;
}
+18 -18
View File
@@ -790,7 +790,7 @@ void Group::CastGroupSpell(Mob* caster, uint16 spell_id) {
caster->SpellOnTarget(spell_id, members[z]->GetPet());
#endif
} else
Log.Out(Logs::Detail, Logs::Spells, "Group spell: %s is out of range %f at distance %f from %s", members[z]->GetName(), range, distance, caster->GetName());
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());
}
}
@@ -829,7 +829,7 @@ void Group::GroupBardPulse(Mob* caster, uint16 spell_id) {
members[z]->GetPet()->BardPulse(spell_id, caster);
#endif
} else
Log.Out(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());
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());
}
}
}
@@ -1133,7 +1133,7 @@ bool Group::LearnMembers() {
return false;
if (results.RowCount() == 0) {
Log.Out(Logs::General, Logs::Error, "Error getting group members for group %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str());
Log(Logs::General, Logs::Error, "Error getting group members for group %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str());
return false;
}
@@ -1162,7 +1162,7 @@ void Group::VerifyGroup() {
for (i = 0; i < MAX_GROUP_MEMBERS; i++) {
if (membername[i][0] == '\0') {
#if EQDEBUG >= 7
Log.Out(Logs::General, Logs::None, "Group %lu: Verify %d: Empty.\n", (unsigned long)GetID(), i);
Log(Logs::General, Logs::None, "Group %lu: Verify %d: Empty.\n", (unsigned long)GetID(), i);
#endif
members[i] = nullptr;
continue;
@@ -1171,7 +1171,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.Out(Logs::General, Logs::None, "Member of group %lu named '%s' has disappeared!!", (unsigned long)GetID(), membername[i]);
Log(Logs::General, Logs::None, "Member of group %lu named '%s' has disappeared!!", (unsigned long)GetID(), membername[i]);
#endif
membername[i][0] = '\0';
members[i] = nullptr;
@@ -1180,13 +1180,13 @@ void Group::VerifyGroup() {
if(them != nullptr && members[i] != them) { //our pointer is out of date... not so good.
#if EQDEBUG >= 5
Log.Out(Logs::General, Logs::None, "Member of group %lu named '%s' had an out of date pointer!!", (unsigned long)GetID(), membername[i]);
Log(Logs::General, Logs::None, "Member of group %lu named '%s' had an out of date pointer!!", (unsigned long)GetID(), membername[i]);
#endif
members[i] = them;
continue;
}
#if EQDEBUG >= 8
Log.Out(Logs::General, Logs::None, "Member of group %lu named '%s' is valid.", (unsigned long)GetID(), membername[i]);
Log(Logs::General, Logs::None, "Member of group %lu named '%s' is valid.", (unsigned long)GetID(), membername[i]);
#endif
}
}
@@ -1521,7 +1521,7 @@ void Group::DelegateMainTank(const char *NewMainTankName, uint8 toggle)
MainTankName.c_str(), GetID());
auto results = database.QueryDatabase(query);
if (!results.Success())
Log.Out(Logs::General, Logs::Error, "Unable to set group main tank: %s\n", results.ErrorMessage().c_str());
Log(Logs::General, Logs::Error, "Unable to set group main tank: %s\n", results.ErrorMessage().c_str());
}
}
@@ -1567,7 +1567,7 @@ void Group::DelegateMainAssist(const char *NewMainAssistName, uint8 toggle)
MainAssistName.c_str(), GetID());
auto results = database.QueryDatabase(query);
if (!results.Success())
Log.Out(Logs::General, Logs::Error, "Unable to set group main assist: %s\n", results.ErrorMessage().c_str());
Log(Logs::General, Logs::Error, "Unable to set group main assist: %s\n", results.ErrorMessage().c_str());
}
}
@@ -1614,7 +1614,7 @@ void Group::DelegatePuller(const char *NewPullerName, uint8 toggle)
PullerName.c_str(), GetID());
auto results = database.QueryDatabase(query);
if (!results.Success())
Log.Out(Logs::General, Logs::Error, "Unable to set group main puller: %s\n", results.ErrorMessage().c_str());
Log(Logs::General, Logs::Error, "Unable to set group main puller: %s\n", results.ErrorMessage().c_str());
}
@@ -1765,7 +1765,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.Out(Logs::General, Logs::Error, "Unable to clear group main tank: %s\n", results.ErrorMessage().c_str());
Log(Logs::General, Logs::Error, "Unable to clear group main tank: %s\n", results.ErrorMessage().c_str());
if(!toggle) {
for(uint32 i = 0; i < MAX_GROUP_MEMBERS; ++i) {
@@ -1814,7 +1814,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.Out(Logs::General, Logs::Error, "Unable to clear group main assist: %s\n", results.ErrorMessage().c_str());
Log(Logs::General, Logs::Error, "Unable to clear group main assist: %s\n", results.ErrorMessage().c_str());
if(!toggle)
{
@@ -1842,7 +1842,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.Out(Logs::General, Logs::Error, "Unable to clear group main puller: %s\n", results.ErrorMessage().c_str());
Log(Logs::General, Logs::Error, "Unable to clear group main puller: %s\n", results.ErrorMessage().c_str());
if(!toggle) {
for(uint32 i = 0; i < MAX_GROUP_MEMBERS; ++i) {
@@ -1925,7 +1925,7 @@ void Group::SetGroupMentor(int percent, char *name)
mentoree_name.c_str(), mentor_percent, GetID());
auto results = database.QueryDatabase(query);
if (!results.Success())
Log.Out(Logs::General, Logs::Error, "Unable to set group mentor: %s\n", results.ErrorMessage().c_str());
Log(Logs::General, Logs::Error, "Unable to set group mentor: %s\n", results.ErrorMessage().c_str());
}
void Group::ClearGroupMentor()
@@ -1936,7 +1936,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.Out(Logs::General, Logs::Error, "Unable to clear group mentor: %s\n", results.ErrorMessage().c_str());
Log(Logs::General, Logs::Error, "Unable to clear group mentor: %s\n", results.ErrorMessage().c_str());
}
void Group::NotifyAssistTarget(Client *c)
@@ -2006,7 +2006,7 @@ void Group::DelegateMarkNPC(const char *NewNPCMarkerName)
NewNPCMarkerName, GetID());
auto results = database.QueryDatabase(query);
if (!results.Success())
Log.Out(Logs::General, Logs::Error, "Unable to set group mark npc: %s\n", results.ErrorMessage().c_str());
Log(Logs::General, Logs::Error, "Unable to set group mark npc: %s\n", results.ErrorMessage().c_str());
}
void Group::NotifyMarkNPC(Client *c)
@@ -2087,7 +2087,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.Out(Logs::General, Logs::Error, "Unable to clear group marknpc: %s\n", results.ErrorMessage().c_str());
Log(Logs::General, Logs::Error, "Unable to clear group marknpc: %s\n", results.ErrorMessage().c_str());
}
@@ -2104,7 +2104,7 @@ void Group::SaveGroupLeaderAA()
safe_delete_array(queryBuffer);
auto results = database.QueryDatabase(query);
if (!results.Success())
Log.Out(Logs::General, Logs::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str());
Log(Logs::General, Logs::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str());
}
+8 -8
View File
@@ -56,7 +56,7 @@ void Client::SendGuildMOTD(bool GetGuildMOTDReply) {
}
Log.Out(Logs::Detail, Logs::Guilds, "Sending OP_GuildMOTD of length %d", outapp->size);
Log(Logs::Detail, Logs::Guilds, "Sending OP_GuildMOTD of length %d", outapp->size);
FastQueuePacket(&outapp);
}
@@ -147,10 +147,10 @@ void Client::SendGuildSpawnAppearance() {
if (!IsInAGuild()) {
// clear guildtag
SendAppearancePacket(AT_GuildID, GUILD_NONE);
Log.Out(Logs::Detail, Logs::Guilds, "Sending spawn appearance for no guild tag.");
Log(Logs::Detail, Logs::Guilds, "Sending spawn appearance for no guild tag.");
} else {
uint8 rank = guild_mgr.GetDisplayedRank(GuildID(), GuildRank(), CharacterID());
Log.Out(Logs::Detail, Logs::Guilds, "Sending spawn appearance for guild %d at rank %d", GuildID(), rank);
Log(Logs::Detail, Logs::Guilds, "Sending spawn appearance for guild %d at rank %d", 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.Out(Logs::Detail, Logs::Guilds, "Unable to make guild list!");
Log(Logs::Detail, Logs::Guilds, "Unable to make guild list!");
return;
}
Log.Out(Logs::Detail, Logs::Guilds, "Sending OP_ZoneGuildList of length %d", outapp->size);
Log(Logs::Detail, Logs::Guilds, "Sending OP_ZoneGuildList of length %d", outapp->size);
FastQueuePacket(&outapp);
}
@@ -195,7 +195,7 @@ void Client::SendGuildMembers() {
outapp->pBuffer = data;
data = nullptr;
Log.Out(Logs::Detail, Logs::Guilds, "Sending OP_GuildMemberList of length %d", outapp->size);
Log(Logs::Detail, Logs::Guilds, "Sending OP_GuildMemberList of length %d", outapp->size);
FastQueuePacket(&outapp);
@@ -227,7 +227,7 @@ void Client::RefreshGuildInfo()
CharGuildInfo info;
if(!guild_mgr.GetCharInfo(CharacterID(), info)) {
Log.Out(Logs::Detail, Logs::Guilds, "Unable to obtain guild char info for %s (%d)", GetName(), CharacterID());
Log(Logs::Detail, Logs::Guilds, "Unable to obtain guild char info for %s (%d)", GetName(), CharacterID());
return;
}
@@ -341,7 +341,7 @@ void Client::SendGuildJoin(GuildJoin_Struct* gj){
outgj->rank = gj->rank;
outgj->zoneid = gj->zoneid;
Log.Out(Logs::Detail, Logs::Guilds, "Sending OP_GuildManageAdd for join of length %d", outapp->size);
Log(Logs::Detail, Logs::Guilds, "Sending OP_GuildManageAdd for join of length %d", outapp->size);
FastQueuePacket(&outapp);
+17 -17
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.Out(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);
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);
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.Out(Logs::Detail, Logs::Guilds, "Guild lookup for char %d when sending char refresh.", charid);
Log(Logs::Detail, Logs::Guilds, "Guild lookup for char %d 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.Out(Logs::Detail, Logs::Guilds, "Sending char refresh for %d from guild %d to world", charid, guild_id);
Log(Logs::Detail, Logs::Guilds, "Sending char refresh for %d from guild %d 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.Out(Logs::Detail, Logs::Guilds, "Sending guild delete for guild %d to world", guild_id);
Log(Logs::Detail, Logs::Guilds, "Sending guild delete for guild %d 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.Out(Logs::General, Logs::Error, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildRefresh_Struct));
Log(Logs::General, Logs::Error, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildRefresh_Struct));
return;
}
ServerGuildRefresh_Struct *s = (ServerGuildRefresh_Struct *) pack->pBuffer;
Log.Out(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);
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);
//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.Out(Logs::General, Logs::Error, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildCharRefresh_Struct));
Log(Logs::General, Logs::Error, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildCharRefresh_Struct));
return;
}
ServerGuildCharRefresh_Struct *s = (ServerGuildCharRefresh_Struct *) pack->pBuffer;
Log.Out(Logs::Detail, Logs::Guilds, "Received guild member refresh from world for char %d from guild %d", s->char_id, s->guild_id);
Log(Logs::Detail, Logs::Guilds, "Received guild member refresh from world for char %d from guild %d", 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.Out(Logs::General, Logs::Error, "Received ServerOP_RankUpdate of incorrect size %d, expected %d",
Log(Logs::General, Logs::Error, "Received ServerOP_RankUpdate of incorrect size %d, expected %d",
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.Out(Logs::General, Logs::Error, "Received ServerOP_DeleteGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildID_Struct));
Log(Logs::General, Logs::Error, "Received ServerOP_DeleteGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildID_Struct));
return;
}
ServerGuildID_Struct *s = (ServerGuildID_Struct *) pack->pBuffer;
Log.Out(Logs::Detail, Logs::Guilds, "Received guild delete from world for guild %d", s->guild_id);
Log(Logs::Detail, Logs::Guilds, "Received guild delete from world for guild %d", s->guild_id);
//clear all the guild tags.
entity_list.RefreshAllGuildInfo(s->guild_id);
@@ -417,10 +417,10 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) {
if (!c || !c->IsInAGuild())
{
Log.Out(Logs::Detail, Logs::Guilds,"Invalid Client or not in guild. ID=%i", FromID);
Log(Logs::Detail, Logs::Guilds,"Invalid Client or not in guild. ID=%i", FromID);
break;
}
Log.Out(Logs::Detail, Logs::Guilds,"Processing ServerOP_OnlineGuildMembersResponse");
Log(Logs::Detail, Logs::Guilds,"Processing ServerOP_OnlineGuildMembersResponse");
auto outapp = new EQApplicationPacket(OP_GuildMemberUpdate, sizeof(GuildMemberUpdate_Struct));
GuildMemberUpdate_Struct *gmus = (GuildMemberUpdate_Struct*)outapp->pBuffer;
char Name[64];
@@ -433,7 +433,7 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) {
VARSTRUCT_DECODE_STRING(Name, Buffer);
strn0cpy(gmus->MemberName, Name, sizeof(gmus->MemberName));
gmus->ZoneID = VARSTRUCT_DECODE_TYPE(uint32, Buffer);
Log.Out(Logs::Detail, Logs::Guilds,"Sending OP_GuildMemberUpdate to %i. Name=%s ZoneID=%i",FromID,Name,gmus->ZoneID);
Log(Logs::Detail, Logs::Guilds,"Sending OP_GuildMemberUpdate to %i. Name=%s ZoneID=%i",FromID,Name,gmus->ZoneID);
c->QueuePacket(outapp);
}
safe_delete(outapp);
@@ -683,7 +683,7 @@ void GuildBankManager::SendGuildBank(Client *c)
if(Iterator == Banks.end())
{
Log.Out(Logs::General, Logs::Error, "Unable to find guild bank for guild ID %i", c->GuildID());
Log(Logs::General, Logs::Error, "Unable to find guild bank for guild ID %i", c->GuildID());
return;
}
@@ -856,7 +856,7 @@ bool GuildBankManager::AddItem(uint32 GuildID, uint8 Area, uint32 ItemID, int32
if(Iterator == Banks.end())
{
Log.Out(Logs::General, Logs::Error, "Unable to find guild bank for guild ID %i", GuildID);
Log(Logs::General, Logs::Error, "Unable to find guild bank for guild ID %i", GuildID);
return false;
}
@@ -902,7 +902,7 @@ bool GuildBankManager::AddItem(uint32 GuildID, uint8 Area, uint32 ItemID, int32
if(Slot < 0)
{
Log.Out(Logs::General, Logs::Error, "No space to add item to the guild bank.");
Log(Logs::General, Logs::Error, "No space to add item to the guild bank.");
return false;
}
+9 -1
View File
@@ -364,12 +364,20 @@ Mob *HateList::GetEntWithMostHateOnList(Mob *center, Mob *skip)
int64 current_hate = cur->stored_hate_amount;
#ifdef BOTS
if (cur->entity_on_hatelist->IsClient() || cur->entity_on_hatelist->IsBot()){
if (cur->entity_on_hatelist->IsClient() && cur->entity_on_hatelist->CastToClient()->IsSitting()){
aggro_mod += RuleI(Aggro, SittingAggroMod);
}
#else
if (cur->entity_on_hatelist->IsClient()){
if (cur->entity_on_hatelist->CastToClient()->IsSitting()){
aggro_mod += RuleI(Aggro, SittingAggroMod);
}
#endif
if (center){
if (center->GetTarget() == cur->entity_on_hatelist)
aggro_mod += RuleI(Aggro, CurrentTargetAggroMod);
+25 -25
View File
@@ -860,42 +860,42 @@ void HealRotation::bias_targets()
m_casting_target_poke = true;
#if (EQDEBUG >= 12)
Log.Out(Logs::General, Logs::Error, "HealRotation::bias_targets() - *** Post-processing state ***");
Log.Out(Logs::General, Logs::Error, "HealRotation Settings:");
Log.Out(Logs::General, Logs::Error, "HealRotation::m_interval_ms = %u", m_interval_ms);
Log.Out(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.Out(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.Out(Logs::General, Logs::Error, "HealRotation::m_fast_heals = %s", ((m_fast_heals) ? ("true") : ("false")));
Log.Out(Logs::General, Logs::Error, "HealRotation::m_adaptive_targeting = %s", ((m_adaptive_targeting) ? ("true") : ("false")));
Log.Out(Logs::General, Logs::Error, "HealRotation::m_casting_override = %s", ((m_casting_override) ? ("true") : ("false")));
Log.Out(Logs::General, Logs::Error, "HealRotation::m_casting_target_poke = %s", ((m_casting_target_poke) ? ("true") : ("false")));
Log.Out(Logs::General, Logs::Error, "HealRotation::m_active_heal_target = %s", ((m_active_heal_target) ? ("true") : ("false")));
Log.Out(Logs::General, Logs::Error, "HealRotation::m_is_active = %s", ((m_is_active) ? ("true") : ("false")));
Log.Out(Logs::General, Logs::Error, "HealRotation::m_member_list.size() = %i", m_member_pool.size());
Log.Out(Logs::General, Logs::Error, "HealRotation::m_cycle_list.size() = %i", m_cycle_pool.size());
Log.Out(Logs::General, Logs::Error, "HealRotation::m_target_list.size() = %i", m_target_pool.size());
if (m_member_pool.size()) { Log.Out(Logs::General, Logs::Error, "(std::shared_ptr<HealRotation>::use_count() = %i", m_member_pool.front()->MemberOfHealRotation()->use_count()); }
else { Log.Out(Logs::General, Logs::Error, "(std::shared_ptr<HealRotation>::use_count() = unknown (0)"); }
Log.Out(Logs::General, Logs::Error, "HealRotation Members:");
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:");
int member_index = 0;
for (auto mlist_iter : m_member_pool) {
if (!mlist_iter) { continue; }
Log.Out(Logs::General, Logs::Error, "(%i) %s (hrcast: %c)", (++member_index), mlist_iter->GetCleanName(), ((mlist_iter->AmICastingForHealRotation())?('T'):('F')));
Log(Logs::General, Logs::Error, "(%i) %s (hrcast: %c)", (++member_index), mlist_iter->GetCleanName(), ((mlist_iter->AmICastingForHealRotation())?('T'):('F')));
}
if (!member_index) { Log.Out(Logs::General, Logs::Error, "(0) None"); }
Log.Out(Logs::General, Logs::Error, "HealRotation Cycle:");
if (!member_index) { Log(Logs::General, Logs::Error, "(0) None"); }
Log(Logs::General, Logs::Error, "HealRotation Cycle:");
int cycle_index = 0;
for (auto clist_iter : m_cycle_pool) {
if (!clist_iter) { continue; }
Log.Out(Logs::General, Logs::Error, "(%i) %s", (++cycle_index), clist_iter->GetCleanName());
Log(Logs::General, Logs::Error, "(%i) %s", (++cycle_index), clist_iter->GetCleanName());
}
if (!cycle_index) { Log.Out(Logs::General, Logs::Error, "(0) None"); }
Log.Out(Logs::General, Logs::Error, "HealRotation Targets: (sort type: %u)", sort_type);
if (!cycle_index) { Log(Logs::General, Logs::Error, "(0) None"); }
Log(Logs::General, Logs::Error, "HealRotation Targets: (sort type: %u)", sort_type);
int target_index = 0;
for (auto tlist_iter : m_target_pool) {
if (!tlist_iter) { continue; }
Log.Out(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))",
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))",
(++target_index), tlist_iter->GetCleanName(),
tlist_iter->GetHPRatio(),
ClassArmorType(tlist_iter->GetClass()),
@@ -909,7 +909,7 @@ void HealRotation::bias_targets()
tlist_iter->HealRotationHealFrequency(),
tlist_iter->HealRotationExtendedHealFrequency());
}
if (!target_index) { Log.Out(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) { 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))"); }
#endif
}
+2 -2
View File
@@ -79,7 +79,7 @@ const NPCType *Horse::BuildHorseType(uint16 spell_id) {
}
if (results.RowCount() != 1) {
Log.Out(Logs::General, Logs::Error, "No Database entry for mount: %s, check the horses table", fileName);
Log(Logs::General, Logs::Error, "No Database entry for mount: %s, check the horses table", fileName);
return nullptr;
}
@@ -122,7 +122,7 @@ void Client::SummonHorse(uint16 spell_id) {
return;
}
if(!Horse::IsHorseSpell(spell_id)) {
Log.Out(Logs::General, Logs::Error, "%s tried to summon an unknown horse, spell id %d", GetName(), spell_id);
Log(Logs::General, Logs::Error, "%s tried to summon an unknown horse, spell id %d", GetName(), spell_id);
return;
}
+108 -108
View File
@@ -200,7 +200,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
// make sure the item exists
if(item == nullptr) {
Message(13, "Item %u does not exist.", item_id);
Log.Out(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",
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",
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,
// check to make sure we are augmenting an augmentable item
else if (((!item->IsClassCommon()) || (item->AugType > 0)) && (aug1 | aug2 | aug3 | aug4 | aug5 | aug6)) {
Message(13, "You can not augment an augment or a non-common class item.");
Log.Out(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",
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",
GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5, aug6);
return false;
@@ -229,7 +229,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(13, "You are not a GM or do not have the status to summon this item.");
Log.Out(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",
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",
GetName(), account_name, this->Admin(), item->ID, aug1, aug2, aug3, aug4, aug5, aug6, item->MinStatus);
return false;
@@ -252,7 +252,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
if(augtest == nullptr) {
if(augments[iter]) {
Message(13, "Augment %u (Aug%i) does not exist.", augments[iter], iter + 1);
Log.Out(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",
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",
GetName(), account_name, (iter + 1), item->ID, aug1, aug2, aug3, aug4, aug5, aug6);
return false;
@@ -269,7 +269,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(13, "%s (%u) (Aug%i) is not an actual augment.", augtest->Name, augtest->ID, iter + 1);
Log.Out(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",
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",
GetName(), account_name, item->ID, (iter + 1), aug1, aug2, aug3, aug4, aug5, aug6);
return false;
@@ -281,7 +281,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(13, "You are not a GM or do not have the status to summon this augment.");
Log.Out(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",
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",
GetName(), account_name, (iter + 1), this->Admin(), item->ID, aug1, aug2, aug3, aug4, aug5, aug6, item->MinStatus);
return false;
@@ -292,7 +292,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(13, "Augment %u (Aug%i) is not acceptable wear on Item %u.", augments[iter], iter + 1, item->ID);
Log.Out(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",
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",
GetName(), account_name, (iter + 1), item->ID, aug1, aug2, aug3, aug4, aug5, aug6);
return false;
@@ -300,7 +300,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
if(item->AugSlotVisible[iter] == 0) {
Message(13, "Item %u has not evolved enough to accept Augment %u (Aug%i).", item->ID, augments[iter], iter + 1);
Log.Out(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",
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",
GetName(), account_name, (iter + 1), item->ID, aug1, aug2, aug3, aug4, aug5, aug6);
return false;
@@ -477,7 +477,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
if(restrictfail) {
Message(13, "Augment %u (Aug%i) is restricted from wear on Item %u.", augments[iter], (iter + 1), item->ID);
Log.Out(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",
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",
GetName(), account_name, (iter + 1), item->ID, aug1, aug2, aug3, aug4, aug5, aug6);
return false;
@@ -488,7 +488,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
// check for class usability
if(item->Classes && !(classes &= augtest->Classes)) {
Message(13, "Augment %u (Aug%i) will result in an item not usable by any class.", augments[iter], (iter + 1));
Log.Out(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",
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",
GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5, aug6);
return false;
@@ -497,7 +497,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
// check for race usability
if(item->Races && !(races &= augtest->Races)) {
Message(13, "Augment %u (Aug%i) will result in an item not usable by any race.", augments[iter], (iter + 1));
Log.Out(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",
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",
GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5, aug6);
return false;
@@ -506,7 +506,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
// check for slot usability
if(item->Slots && !(slots &= augtest->Slots)) {
Message(13, "Augment %u (Aug%i) will result in an item not usable in any slot.", augments[iter], (iter + 1));
Log.Out(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",
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",
GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5, aug6);
return false;
@@ -533,7 +533,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
if(inst == nullptr) {
Message(13, "An unknown server error has occurred and your item was not created.");
// this goes to logfile since this is a major error
Log.Out(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",
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",
GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5, aug6);
return false;
@@ -559,7 +559,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.Out(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",
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",
GetName(), account_name, to_slot, item->ID, aug1, aug2, aug3, aug4, aug5, aug6);
to_slot = EQEmu::inventory::slotCursor;
@@ -596,7 +596,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.Out(Logs::General, Logs::Inventory, "'%s' (char_id: %u) Attempting to drop item from slot %i on the ground",
Log(Logs::General, Logs::Inventory, "'%s' (char_id: %u) Attempting to drop item from slot %i on the ground",
GetCleanName(), CharacterID(), slot_id);
if(GetInv().CheckNoDrop(slot_id, recurse) && RuleI(World, FVNoDropFlag) == 0 ||
@@ -604,20 +604,20 @@ void Client::DropItem(int16 slot_id, bool recurse)
{
auto invalid_drop = m_inv.GetItem(slot_id);
if (!invalid_drop) {
Log.Out(Logs::General, Logs::Inventory, "Error in InventoryProfile::CheckNoDrop() - returned 'true' for empty slot");
Log(Logs::General, Logs::Inventory, "Error in InventoryProfile::CheckNoDrop() - returned 'true' for empty slot");
}
else {
if (Log.log_settings[Logs::Inventory].is_category_enabled) {
Log.Out(Logs::General, Logs::Inventory, "DropItem() Hack detected - full item parse:");
Log.Out(Logs::General, Logs::Inventory, "depth: 0, Item: '%s' (id: %u), IsDroppable: %s",
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",
(invalid_drop->GetItem() ? invalid_drop->GetItem()->Name : "null data"), invalid_drop->GetID(), invalid_drop->IsDroppable(false));
for (auto iter1 : *invalid_drop->GetContents()) { // depth 1
Log.Out(Logs::General, Logs::Inventory, "-depth: 1, Item: '%s' (id: %u), IsDroppable: %s",
Log(Logs::General, Logs::Inventory, "-depth: 1, Item: '%s' (id: %u), IsDroppable: %s",
(iter1.second->GetItem() ? iter1.second->GetItem()->Name : "null data"), iter1.second->GetID(), iter1.second->IsDroppable(false));
for (auto iter2 : *iter1.second->GetContents()) { // depth 2
Log.Out(Logs::General, Logs::Inventory, "--depth: 2, Item: '%s' (id: %u), IsDroppable: %s",
Log(Logs::General, Logs::Inventory, "--depth: 2, Item: '%s' (id: %u), IsDroppable: %s",
(iter2.second->GetItem() ? iter2.second->GetItem()->Name : "null data"), iter2.second->GetID(), iter2.second->IsDroppable(false));
}
}
@@ -633,39 +633,39 @@ void Client::DropItem(int16 slot_id, bool recurse)
// Take control of item in client inventory
EQEmu::ItemInstance *inst = m_inv.PopItem(slot_id);
if(inst) {
if (Log.log_settings[Logs::Inventory].is_category_enabled) {
Log.Out(Logs::General, Logs::Inventory, "DropItem() Processing - full item parse:");
Log.Out(Logs::General, Logs::Inventory, "depth: 0, Item: '%s' (id: %u), IsDroppable: %s",
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",
(inst->GetItem() ? inst->GetItem()->Name : "null data"), inst->GetID(), inst->IsDroppable(false));
if (!inst->IsDroppable(false))
Log.Out(Logs::General, Logs::Error, "Non-droppable item being processed for drop by '%s'", GetCleanName());
Log(Logs::General, Logs::Error, "Non-droppable item being processed for drop by '%s'", GetCleanName());
for (auto iter1 : *inst->GetContents()) { // depth 1
Log.Out(Logs::General, Logs::Inventory, "-depth: 1, Item: '%s' (id: %u), IsDroppable: %s",
Log(Logs::General, Logs::Inventory, "-depth: 1, Item: '%s' (id: %u), IsDroppable: %s",
(iter1.second->GetItem() ? iter1.second->GetItem()->Name : "null data"), iter1.second->GetID(), iter1.second->IsDroppable(false));
if (!iter1.second->IsDroppable(false))
Log.Out(Logs::General, Logs::Error, "Non-droppable item being processed for drop by '%s'", GetCleanName());
Log(Logs::General, Logs::Error, "Non-droppable item being processed for drop by '%s'", GetCleanName());
for (auto iter2 : *iter1.second->GetContents()) { // depth 2
Log.Out(Logs::General, Logs::Inventory, "--depth: 2, Item: '%s' (id: %u), IsDroppable: %s",
Log(Logs::General, Logs::Inventory, "--depth: 2, Item: '%s' (id: %u), IsDroppable: %s",
(iter2.second->GetItem() ? iter2.second->GetItem()->Name : "null data"), iter2.second->GetID(), iter2.second->IsDroppable(false));
if (!iter2.second->IsDroppable(false))
Log.Out(Logs::General, Logs::Error, "Non-droppable item being processed for drop by '%s'", GetCleanName());
Log(Logs::General, Logs::Error, "Non-droppable item being processed for drop by '%s'", GetCleanName());
}
}
}
int i = parse->EventItem(EVENT_DROP_ITEM, this, inst, nullptr, "", slot_id);
if(i != 0) {
Log.Out(Logs::General, Logs::Inventory, "Item drop handled by [EVENT_DROP_ITEM]");
Log(Logs::General, Logs::Inventory, "Item drop handled by [EVENT_DROP_ITEM]");
safe_delete(inst);
}
} else {
// Item doesn't exist in inventory!
Log.Out(Logs::General, Logs::Inventory, "DropItem() - No item found in slot %i", slot_id);
Log(Logs::General, Logs::Inventory, "DropItem() - No item found in slot %i", slot_id);
Message(13, "Error: Item not found in slot %i", slot_id);
return;
}
@@ -687,7 +687,7 @@ void Client::DropItem(int16 slot_id, bool recurse)
entity_list.AddObject(object, true);
object->StartDecay();
Log.Out(Logs::General, Logs::Inventory, "Item drop handled ut assolet");
Log(Logs::General, Logs::Inventory, "Item drop handled ut assolet");
safe_delete(inst);
}
@@ -758,7 +758,7 @@ void Client::SendCursorBuffer()
}
if (!lore_pass) {
Log.Out(Logs::General, Logs::Inventory, "(%s) Duplicate lore items are not allowed - destroying item %s(id:%u) on cursor",
Log(Logs::General, Logs::Inventory, "(%s) Duplicate lore items are not allowed - destroying item %s(id:%u) on cursor",
GetName(), test_item->Name, test_item->ID);
Message_StringID(MT_LootMessages, 290);
parse->EventItem(EVENT_DESTROY_ITEM, this, test_inst, nullptr, "", 0);
@@ -773,7 +773,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.Out(Logs::General, Logs::None, "DeleteItemInInventory(%i, %i, %s)", slot_id, quantity, (client_update) ? "true":"false");
Log(Logs::General, Logs::None, "DeleteItemInInventory(%i, %i, %s)", slot_id, quantity, (client_update) ? "true":"false");
#endif
// Added 'IsSlotValid(slot_id)' check to both segments of client packet processing.
@@ -893,7 +893,7 @@ void Client::DeleteItemInInventory(int16 slot_id, int8 quantity, bool client_upd
bool Client::PushItemOnCursor(const EQEmu::ItemInstance& inst, bool client_update)
{
Log.Out(Logs::Detail, Logs::Inventory, "Putting item %s (%d) on the cursor", inst.GetItem()->Name, inst.GetItem()->ID);
Log(Logs::Detail, Logs::Inventory, "Putting item %s (%d) on the cursor", inst.GetItem()->Name, inst.GetItem()->ID);
m_inv.PushCursor(inst);
if (client_update) {
@@ -909,7 +909,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.Out(Logs::Detail, Logs::Inventory, "Putting item %s (%d) into slot %d", inst.GetItem()->Name, inst.GetItem()->ID, slot_id);
Log(Logs::Detail, Logs::Inventory, "Putting item %s (%d) into slot %d", inst.GetItem()->Name, inst.GetItem()->ID, slot_id);
if (slot_id == EQEmu::inventory::slotCursor) { // don't trust macros before conditional statements...
return PushItemOnCursor(inst, client_update);
@@ -938,7 +938,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.Out(Logs::Detail, Logs::Inventory, "Putting loot item %s (%d) into slot %d", inst.GetItem()->Name, inst.GetItem()->ID, slot_id);
Log(Logs::Detail, Logs::Inventory, "Putting loot item %s (%d) into slot %d", inst.GetItem()->Name, inst.GetItem()->ID, slot_id);
bool cursor_empty = m_inv.CursorEmpty();
@@ -982,7 +982,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::inventory::slotCursor && !cursor_empty) {
Log.Out(Logs::Detail, Logs::Inventory,
Log(Logs::Detail, Logs::Inventory,
"Putting bag loot item %s (%d) into slot %d (non-empty cursor override)",
inst.GetItem()->Name, inst.GetItem()->ID, EQEmu::inventory::slotCursor);
@@ -991,7 +991,7 @@ void Client::PutLootInInventory(int16 slot_id, const EQEmu::ItemInstance &inst,
else {
auto bag_slot = EQEmu::InventoryProfile::CalcSlotId(slot_id, index);
Log.Out(Logs::Detail, Logs::Inventory,
Log(Logs::Detail, Logs::Inventory,
"Putting bag loot item %s (%d) into slot %d (bag slot %d)",
inst.GetItem()->Name, inst.GetItem()->ID, bag_slot, index);
@@ -1417,7 +1417,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(13, "Warning: Invalid slot move from slot %u to slot %u with %u charges!", src_slot_check, dst_slot_check, stack_count_check);
Log.Out(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);
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);
return false;
}
@@ -1425,7 +1425,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(13, "Warning: Invalid slot move from slot %u to slot %u with %u charges!", src_slot_check, dst_slot_check, stack_count_check);
Log.Out(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);
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);
return false;
}
@@ -1449,7 +1449,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
}
if (!lore_pass) {
Log.Out(Logs::General, Logs::Inventory, "(%s) Duplicate lore items are not allowed - destroying item %s(id:%u) on cursor",
Log(Logs::General, Logs::Inventory, "(%s) Duplicate lore items are not allowed - destroying item %s(id:%u) on cursor",
GetName(), test_item->Name, test_item->ID);
Message_StringID(MT_LootMessages, 290);
parse->EventItem(EVENT_DESTROY_ITEM, this, test_inst, nullptr, "", 0);
@@ -1461,7 +1461,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
if (move_in->to_slot == (uint32)INVALID_INDEX) {
if (move_in->from_slot == (uint32)EQEmu::inventory::slotCursor) {
Log.Out(Logs::Detail, Logs::Inventory, "Client destroyed item from cursor slot %d", move_in->from_slot);
Log(Logs::Detail, Logs::Inventory, "Client destroyed item from cursor slot %d", move_in->from_slot);
if(RuleB(QueryServ, PlayerLogMoves)) { QSSwapItemAuditor(move_in); } // QS Audit
EQEmu::ItemInstance *inst = m_inv.GetItem(EQEmu::inventory::slotCursor);
@@ -1475,7 +1475,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
return true; // Item destroyed by client
}
else {
Log.Out(Logs::Detail, Logs::Inventory, "Deleted item from slot %d as a result of an inventory container tradeskill combine.", move_in->from_slot);
Log(Logs::Detail, Logs::Inventory, "Deleted item from slot %d 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
@@ -1511,7 +1511,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.Out(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());
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());
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))
@@ -1521,7 +1521,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
}
}
if (dst_inst) {
Log.Out(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());
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());
dstitemid = dst_inst->GetItem()->ID;
}
if (Trader && srcitemid>0){
@@ -1558,7 +1558,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.Out(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)) { 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); }
}
return false;
@@ -1566,7 +1566,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
//verify shared bank transactions in the database
if (src_inst && src_slot_id >= EQEmu::legacy::SHARED_BANK_BEGIN && src_slot_id <= EQEmu::legacy::SHARED_BANK_BAGS_END) {
if(!database.VerifyInventory(account_id, src_slot_id, src_inst)) {
Log.Out(Logs::General, Logs::Error, "Player %s on account %s was found exploiting the shared bank.\n", GetName(), account_name);
Log(Logs::General, Logs::Error, "Player %s on account %s was found exploiting the shared bank.\n", GetName(), account_name);
DeleteItemInInventory(dst_slot_id,0,true);
return(false);
}
@@ -1581,7 +1581,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
}
if (dst_inst && dst_slot_id >= EQEmu::legacy::SHARED_BANK_BEGIN && dst_slot_id <= EQEmu::legacy::SHARED_BANK_BAGS_END) {
if(!database.VerifyInventory(account_id, dst_slot_id, dst_inst)) {
Log.Out(Logs::General, Logs::Error, "Player %s on account %s was found exploting the shared bank.\n", GetName(), account_name);
Log(Logs::General, Logs::Error, "Player %s on account %s was found exploting the shared bank.\n", GetName(), account_name);
DeleteItemInInventory(src_slot_id,0,true);
return(false);
}
@@ -1618,7 +1618,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.Out(Logs::General, Logs::Error, "WorldKick() of Player %s(id:%u, acct:%u) due to 'NoDrop Hack' detection >> SlotID:%i, ItemData:'%s'",
Log(Logs::General, Logs::Error, "WorldKick() of Player %s(id:%u, acct:%u) due to 'NoDrop Hack' detection >> SlotID:%i, ItemData:'%s'",
GetName(), CharacterID(), AccountID(), src_slot_id, ndh_item_data.c_str());
ndh_inst = nullptr;
@@ -1720,7 +1720,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
return false;
}
if (with) {
Log.Out(Logs::Detail, Logs::Inventory, "Trade item move from slot %d to slot %d (trade with %s)", src_slot_id, dst_slot_id, with->GetName());
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());
// Fill Trade list with items from cursor
if (!m_inv[EQEmu::inventory::slotCursor]) {
Message(13, "Error: Cursor item not located on server!");
@@ -1753,18 +1753,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.Out(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());
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());
return false;
}
if (dst_inst) {
if(src_inst->GetID() != dst_inst->GetID()) {
Log.Out(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());
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());
return(false);
}
if(dst_inst->GetCharges() < dst_inst->GetItem()->StackSize) {
//we have a chance of stacking.
Log.Out(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);
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);
// Charges can be emptied into dst
uint16 usedcharges = dst_inst->GetItem()->StackSize - dst_inst->GetCharges();
if (usedcharges > move_in->number_in_stack)
@@ -1776,15 +1776,15 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
// Depleted all charges?
if (src_inst->GetCharges() < 1)
{
Log.Out(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);
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);
database.SaveInventory(CharacterID(),nullptr,src_slot_id);
m_inv.DeleteItem(src_slot_id);
all_to_stack = true;
} else {
Log.Out(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);
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);
}
} else {
Log.Out(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);
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);
return false;
}
}
@@ -1793,12 +1793,12 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
if ((int16)move_in->number_in_stack >= src_inst->GetCharges()) {
// Move entire stack
if(!m_inv.SwapItem(src_slot_id, dst_slot_id)) { return false; }
Log.Out(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);
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);
}
else {
// Split into two
src_inst->SetCharges(src_inst->GetCharges() - move_in->number_in_stack);
Log.Out(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());
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());
EQEmu::ItemInstance* inst = database.CreateItem(src_inst->GetItem(), move_in->number_in_stack);
m_inv.PutItem(dst_slot_id, *inst);
safe_delete(inst);
@@ -1822,8 +1822,8 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
}
SetMaterial(dst_slot_id,src_inst->GetItem()->ID);
}
if(!m_inv.SwapItem(src_slot_id, dst_slot_id)) { return false; }
Log.Out(Logs::Detail, Logs::Inventory, "Moving entire item from slot %d to slot %d", src_slot_id, dst_slot_id);
if(!m_inv.SwapItem(src_slot_id, dst_slot_id, GetRace(), GetClass(), GetDeity(), GetLevel())) { return false; }
Log(Logs::Detail, Logs::Inventory, "Moving entire item from slot %d to slot %d", src_slot_id, dst_slot_id);
if (src_slot_id <= EQEmu::legacy::EQUIPMENT_END || src_slot_id == EQEmu::inventory::slotPowerSource) {
if(src_inst) {
@@ -1886,7 +1886,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.Out(Logs::Detail, Logs::Inventory, "Inventory desyncronization. (charname: %s, source: %i, destination: %i)", GetName(), move_slots->from_slot, move_slots->to_slot);
Log(Logs::Detail, Logs::Inventory, "Inventory desyncronization. (charname: %s, source: %i, destination: %i)", GetName(), move_slots->from_slot, move_slots->to_slot);
Message(15, "Inventory Desyncronization detected: Resending slot data...");
if ((move_slots->from_slot >= EQEmu::legacy::EQUIPMENT_BEGIN && move_slots->from_slot <= EQEmu::legacy::CURSOR_BAG_END) || move_slots->from_slot == EQEmu::inventory::slotPowerSource) {
@@ -2267,7 +2267,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.Out(Logs::General, Logs::Inventory, "Copy Bag Contents: Failure due to %s is larger than size capacity of %s (%i > %i)",
Log(Logs::General, Logs::Inventory, "Copy Bag Contents: Failure due to %s is larger than size capacity of %s (%i > %i)",
old_bag->GetItem(bag_slot)->GetItem()->Name, new_bag->GetItem()->Name, old_bag->GetItem(bag_slot)->GetItem()->Size, new_bag->GetItem()->BagSize);
return false;
}
@@ -2298,7 +2298,7 @@ void Client::DisenchantSummonedBags(bool client_update)
if (!new_inst) { continue; }
if (CopyBagContents(new_inst, inst)) {
Log.Out(Logs::General, Logs::Inventory, "Disenchant Summoned Bags: Replacing %s with %s in slot %i", inst->GetItem()->Name, new_inst->GetItem()->Name, slot_id);
Log(Logs::General, Logs::Inventory, "Disenchant Summoned Bags: Replacing %s with %s in slot %i", inst->GetItem()->Name, new_inst->GetItem()->Name, slot_id);
PutItemInInventory(slot_id, *new_inst, client_update);
}
safe_delete(new_inst);
@@ -2319,7 +2319,7 @@ void Client::DisenchantSummonedBags(bool client_update)
if (!new_inst) { continue; }
if (CopyBagContents(new_inst, inst)) {
Log.Out(Logs::General, Logs::Inventory, "Disenchant Summoned Bags: Replacing %s with %s in slot %i", inst->GetItem()->Name, new_inst->GetItem()->Name, slot_id);
Log(Logs::General, Logs::Inventory, "Disenchant Summoned Bags: Replacing %s with %s in slot %i", inst->GetItem()->Name, new_inst->GetItem()->Name, slot_id);
PutItemInInventory(slot_id, *new_inst, client_update);
}
safe_delete(new_inst);
@@ -2340,7 +2340,7 @@ void Client::DisenchantSummonedBags(bool client_update)
if (!new_inst) { continue; }
if (CopyBagContents(new_inst, inst)) {
Log.Out(Logs::General, Logs::Inventory, "Disenchant Summoned Bags: Replacing %s with %s in slot %i", inst->GetItem()->Name, new_inst->GetItem()->Name, slot_id);
Log(Logs::General, Logs::Inventory, "Disenchant Summoned Bags: Replacing %s with %s in slot %i", inst->GetItem()->Name, new_inst->GetItem()->Name, slot_id);
PutItemInInventory(slot_id, *new_inst, client_update);
}
safe_delete(new_inst);
@@ -2361,7 +2361,7 @@ void Client::DisenchantSummonedBags(bool client_update)
if (!new_inst) { break; }
if (CopyBagContents(new_inst, inst)) {
Log.Out(Logs::General, Logs::Inventory, "Disenchant Summoned Bags: Replacing %s with %s in slot %i", inst->GetItem()->Name, new_inst->GetItem()->Name, EQEmu::inventory::slotCursor);
Log(Logs::General, Logs::Inventory, "Disenchant Summoned Bags: Replacing %s with %s in slot %i", inst->GetItem()->Name, new_inst->GetItem()->Name, EQEmu::inventory::slotCursor);
std::list<EQEmu::ItemInstance*> local;
local.push_front(new_inst);
m_inv.PopItem(EQEmu::inventory::slotCursor);
@@ -2397,7 +2397,7 @@ void Client::RemoveNoRent(bool client_update)
for (auto slot_id = EQEmu::legacy::EQUIPMENT_BEGIN; slot_id <= EQEmu::legacy::EQUIPMENT_END; ++slot_id) {
auto inst = m_inv[slot_id];
if(inst && !inst->GetItem()->NoRent) {
Log.Out(Logs::Detail, Logs::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
Log(Logs::Detail, Logs::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
DeleteItemInInventory(slot_id, 0, client_update);
}
}
@@ -2405,7 +2405,7 @@ void Client::RemoveNoRent(bool client_update)
for (auto slot_id = EQEmu::legacy::GENERAL_BEGIN; slot_id <= EQEmu::legacy::GENERAL_END; ++slot_id) {
auto inst = m_inv[slot_id];
if (inst && !inst->GetItem()->NoRent) {
Log.Out(Logs::Detail, Logs::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
Log(Logs::Detail, Logs::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
DeleteItemInInventory(slot_id, 0, client_update);
}
}
@@ -2413,7 +2413,7 @@ void Client::RemoveNoRent(bool client_update)
if (m_inv[EQEmu::inventory::slotPowerSource]) {
auto inst = m_inv[EQEmu::inventory::slotPowerSource];
if (inst && !inst->GetItem()->NoRent) {
Log.Out(Logs::Detail, Logs::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, EQEmu::inventory::slotPowerSource);
Log(Logs::Detail, Logs::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, EQEmu::inventory::slotPowerSource);
DeleteItemInInventory(EQEmu::inventory::slotPowerSource, 0, (ClientVersion() >= EQEmu::versions::ClientVersion::SoF) ? client_update : false); // Ti slot non-existent
}
}
@@ -2421,7 +2421,7 @@ void Client::RemoveNoRent(bool client_update)
for (auto slot_id = EQEmu::legacy::GENERAL_BAGS_BEGIN; slot_id <= EQEmu::legacy::CURSOR_BAG_END; ++slot_id) {
auto inst = m_inv[slot_id];
if(inst && !inst->GetItem()->NoRent) {
Log.Out(Logs::Detail, Logs::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
Log(Logs::Detail, Logs::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
DeleteItemInInventory(slot_id, 0, client_update);
}
}
@@ -2429,7 +2429,7 @@ void Client::RemoveNoRent(bool client_update)
for (auto slot_id = EQEmu::legacy::BANK_BEGIN; slot_id <= EQEmu::legacy::BANK_END; ++slot_id) {
auto inst = m_inv[slot_id];
if(inst && !inst->GetItem()->NoRent) {
Log.Out(Logs::Detail, Logs::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
Log(Logs::Detail, Logs::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
DeleteItemInInventory(slot_id, 0, false); // Can't delete from client Bank slots
}
}
@@ -2437,7 +2437,7 @@ void Client::RemoveNoRent(bool client_update)
for (auto slot_id = EQEmu::legacy::BANK_BAGS_BEGIN; slot_id <= EQEmu::legacy::BANK_BAGS_END; ++slot_id) {
auto inst = m_inv[slot_id];
if(inst && !inst->GetItem()->NoRent) {
Log.Out(Logs::Detail, Logs::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
Log(Logs::Detail, Logs::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
DeleteItemInInventory(slot_id, 0, false); // Can't delete from client Bank Container slots
}
}
@@ -2445,7 +2445,7 @@ void Client::RemoveNoRent(bool client_update)
for (auto slot_id = EQEmu::legacy::SHARED_BANK_BEGIN; slot_id <= EQEmu::legacy::SHARED_BANK_END; ++slot_id) {
auto inst = m_inv[slot_id];
if(inst && !inst->GetItem()->NoRent) {
Log.Out(Logs::Detail, Logs::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
Log(Logs::Detail, Logs::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
DeleteItemInInventory(slot_id, 0, false); // Can't delete from client Shared Bank slots
}
}
@@ -2453,7 +2453,7 @@ void Client::RemoveNoRent(bool client_update)
for (auto slot_id = EQEmu::legacy::SHARED_BANK_BAGS_BEGIN; slot_id <= EQEmu::legacy::SHARED_BANK_BAGS_END; ++slot_id) {
auto inst = m_inv[slot_id];
if(inst && !inst->GetItem()->NoRent) {
Log.Out(Logs::Detail, Logs::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
Log(Logs::Detail, Logs::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
DeleteItemInInventory(slot_id, 0, false); // Can't delete from client Shared Bank Container slots
}
}
@@ -2471,7 +2471,7 @@ void Client::RemoveNoRent(bool client_update)
auto inst = *iter;
if (inst == nullptr) { continue; }
if (!inst->GetItem()->NoRent) {
Log.Out(Logs::Detail, Logs::Inventory, "NoRent Timer Lapse: Deleting %s from `Limbo`", inst->GetItem()->Name);
Log(Logs::Detail, Logs::Inventory, "NoRent Timer Lapse: Deleting %s from `Limbo`", inst->GetItem()->Name);
}
else {
m_inv.PushCursor(*inst);
@@ -2492,7 +2492,7 @@ void Client::RemoveDuplicateLore(bool client_update)
auto inst = m_inv.PopItem(slot_id);
if (inst == nullptr) { continue; }
if(CheckLoreConflict(inst->GetItem())) {
Log.Out(Logs::Detail, Logs::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
Log(Logs::Detail, Logs::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
database.SaveInventory(character_id, nullptr, slot_id);
}
else {
@@ -2505,7 +2505,7 @@ void Client::RemoveDuplicateLore(bool client_update)
auto inst = m_inv.PopItem(slot_id);
if (inst == nullptr) { continue; }
if (CheckLoreConflict(inst->GetItem())) {
Log.Out(Logs::Detail, Logs::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
Log(Logs::Detail, Logs::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
database.SaveInventory(character_id, nullptr, slot_id);
}
else {
@@ -2518,7 +2518,7 @@ void Client::RemoveDuplicateLore(bool client_update)
auto inst = m_inv.PopItem(EQEmu::inventory::slotPowerSource);
if (inst) {
if (CheckLoreConflict(inst->GetItem())) {
Log.Out(Logs::Detail, Logs::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, EQEmu::inventory::slotPowerSource);
Log(Logs::Detail, Logs::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, EQEmu::inventory::slotPowerSource);
database.SaveInventory(character_id, nullptr, EQEmu::inventory::slotPowerSource);
}
else {
@@ -2532,7 +2532,7 @@ void Client::RemoveDuplicateLore(bool client_update)
auto inst = m_inv.PopItem(slot_id);
if (inst == nullptr) { continue; }
if(CheckLoreConflict(inst->GetItem())) {
Log.Out(Logs::Detail, Logs::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
Log(Logs::Detail, Logs::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
database.SaveInventory(character_id, nullptr, slot_id);
}
else {
@@ -2545,7 +2545,7 @@ void Client::RemoveDuplicateLore(bool client_update)
auto inst = m_inv.PopItem(slot_id);
if (inst == nullptr) { continue; }
if(CheckLoreConflict(inst->GetItem())) {
Log.Out(Logs::Detail, Logs::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
Log(Logs::Detail, Logs::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
database.SaveInventory(character_id, nullptr, slot_id);
}
else {
@@ -2558,7 +2558,7 @@ void Client::RemoveDuplicateLore(bool client_update)
auto inst = m_inv.PopItem(slot_id);
if (inst == nullptr) { continue; }
if(CheckLoreConflict(inst->GetItem())) {
Log.Out(Logs::Detail, Logs::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
Log(Logs::Detail, Logs::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
database.SaveInventory(character_id, nullptr, slot_id);
}
else {
@@ -2583,7 +2583,7 @@ void Client::RemoveDuplicateLore(bool client_update)
auto inst = *iter;
if (inst == nullptr) { continue; }
if (CheckLoreConflict(inst->GetItem())) {
Log.Out(Logs::Detail, Logs::Inventory, "Lore Duplication Error: Deleting %s from `Limbo`", inst->GetItem()->Name);
Log(Logs::Detail, Logs::Inventory, "Lore Duplication Error: Deleting %s from `Limbo`", inst->GetItem()->Name);
safe_delete(inst);
}
else {
@@ -2602,7 +2602,7 @@ void Client::RemoveDuplicateLore(bool client_update)
m_inv.PushCursor(*inst);
}
else {
Log.Out(Logs::Detail, Logs::Inventory, "Lore Duplication Error: Deleting %s from `Limbo`", inst->GetItem()->Name);
Log(Logs::Detail, Logs::Inventory, "Lore Duplication Error: Deleting %s from `Limbo`", inst->GetItem()->Name);
}
safe_delete(inst);
}
@@ -2620,7 +2620,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.Out(Logs::Detail, Logs::Inventory, "Slot Assignment Error: Moving %s from slot %i to %i", inst->GetItem()->Name, slot_id, free_slot_id);
Log(Logs::Detail, Logs::Inventory, "Slot Assignment Error: Moving %s from slot %i to %i", 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);
@@ -2631,7 +2631,7 @@ void Client::MoveSlotNotAllowed(bool client_update)
auto inst = m_inv.PopItem(EQEmu::inventory::slotPowerSource);
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.Out(Logs::Detail, Logs::Inventory, "Slot Assignment Error: Moving %s from slot %i to %i", inst->GetItem()->Name, EQEmu::inventory::slotPowerSource, free_slot_id);
Log(Logs::Detail, Logs::Inventory, "Slot Assignment Error: Moving %s from slot %i to %i", inst->GetItem()->Name, EQEmu::inventory::slotPowerSource, free_slot_id);
PutItemInInventory(free_slot_id, *inst, (ClientVersion() >= EQEmu::versions::ClientVersion::SoF) ? client_update : false);
database.SaveInventory(character_id, nullptr, EQEmu::inventory::slotPowerSource);
safe_delete(inst);
@@ -2768,7 +2768,7 @@ void Client::CreateBandolier(const EQApplicationPacket *app)
BandolierCreate_Struct *bs = (BandolierCreate_Struct*)app->pBuffer;
Log.Out(Logs::Detail, Logs::Inventory, "Char: %s Creating Bandolier Set %i, Set Name: %s", GetName(), bs->Number, bs->Name);
Log(Logs::Detail, Logs::Inventory, "Char: %s Creating Bandolier Set %i, Set Name: %s", GetName(), bs->Number, bs->Name);
strcpy(m_pp.bandoliers[bs->Number].Name, bs->Name);
const EQEmu::ItemInstance* InvItem = nullptr;
@@ -2782,13 +2782,13 @@ void Client::CreateBandolier(const EQApplicationPacket *app)
InvItem = GetInv()[WeaponSlot];
if(InvItem) {
BaseItem = InvItem->GetItem();
Log.Out(Logs::Detail, Logs::Inventory, "Char: %s adding item %s to slot %i", GetName(),BaseItem->Name, WeaponSlot);
Log(Logs::Detail, Logs::Inventory, "Char: %s adding item %s to slot %i", 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.Out(Logs::Detail, Logs::Inventory, "Char: %s no item in slot %i", GetName(), WeaponSlot);
Log(Logs::Detail, Logs::Inventory, "Char: %s no item in slot %i", GetName(), WeaponSlot);
m_pp.bandoliers[bs->Number].Items[BandolierSlot].ID = 0;
m_pp.bandoliers[bs->Number].Items[BandolierSlot].Icon = 0;
}
@@ -2798,7 +2798,7 @@ void Client::CreateBandolier(const EQApplicationPacket *app)
void Client::RemoveBandolier(const EQApplicationPacket *app)
{
BandolierDelete_Struct *bds = (BandolierDelete_Struct*)app->pBuffer;
Log.Out(Logs::Detail, Logs::Inventory, "Char: %s removing set", GetName(), bds->Number);
Log(Logs::Detail, Logs::Inventory, "Char: %s 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;
@@ -2813,7 +2813,7 @@ void Client::SetBandolier(const EQApplicationPacket *app)
// any items currently in the weapon slots to inventory.
BandolierSet_Struct *bss = (BandolierSet_Struct*)app->pBuffer;
Log.Out(Logs::Detail, Logs::Inventory, "Char: %s activating set %i", GetName(), bss->Number);
Log(Logs::Detail, Logs::Inventory, "Char: %s activating set %i", 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
@@ -2880,19 +2880,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.Out(Logs::Detail, Logs::Inventory, "Character does not have required bandolier item for slot %i", WeaponSlot);
Log(Logs::Detail, Logs::Inventory, "Character does not have required bandolier item for slot %i", 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.Out(Logs::Detail, Logs::Inventory, "returning item %s in weapon slot %i to inventory",
Log(Logs::Detail, Logs::Inventory, "returning item %s in weapon slot %i to inventory",
InvItem->GetItem()->Name, WeaponSlot);
Log.Out(Logs::Detail, Logs::Inventory, "returning item %s in weapon slot %i to inventory", InvItem->GetItem()->Name, WeaponSlot);
Log(Logs::Detail, Logs::Inventory, "returning item %s in weapon slot %i to inventory", InvItem->GetItem()->Name, WeaponSlot);
if (MoveItemToInventory(InvItem)) {
database.SaveInventory(character_id, 0, WeaponSlot);
Log.Out(Logs::General, Logs::Error, "returning item %s in weapon slot %i to inventory", InvItem->GetItem()->Name, WeaponSlot);
Log(Logs::General, Logs::Error, "returning item %s in weapon slot %i to inventory", InvItem->GetItem()->Name, WeaponSlot);
}
else {
Log.Out(Logs::General, Logs::Error, "Char: %s, ERROR returning %s to inventory", GetName(), InvItem->GetItem()->Name);
Log(Logs::General, Logs::Error, "Char: %s, ERROR returning %s to inventory", GetName(), InvItem->GetItem()->Name);
}
safe_delete(InvItem);
}
@@ -2926,7 +2926,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.Out(Logs::General, Logs::Error, "Char: %s, ERROR returning %s to inventory", GetName(), InvItem->GetItem()->Name);
Log(Logs::General, Logs::Error, "Char: %s, ERROR returning %s to inventory", GetName(), InvItem->GetItem()->Name);
}
safe_delete(InvItem);
}
@@ -2937,13 +2937,13 @@ void Client::SetBandolier(const EQApplicationPacket *app)
// put it in the player's inventory.
EQEmu::ItemInstance *InvItem = m_inv.PopItem(WeaponSlot);
if(InvItem) {
Log.Out(Logs::Detail, Logs::Inventory, "Bandolier has no item for slot %i, returning item %s to inventory", WeaponSlot, InvItem->GetItem()->Name);
Log(Logs::Detail, Logs::Inventory, "Bandolier has no item for slot %i, returning item %s 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.Out(Logs::General, Logs::Error, "Char: %s, ERROR returning %s to inventory", GetName(), InvItem->GetItem()->Name);
Log(Logs::General, Logs::Error, "Char: %s, ERROR returning %s to inventory", GetName(), InvItem->GetItem()->Name);
}
safe_delete(InvItem);
}
@@ -2976,7 +2976,7 @@ bool Client::MoveItemToInventory(EQEmu::ItemInstance *ItemToReturn, bool UpdateC
return false;
}
Log.Out(Logs::Detail, Logs::Inventory,"Char: %s Returning %s to inventory", GetName(), ItemToReturn->GetItem()->Name);
Log(Logs::Detail, Logs::Inventory,"Char: %s Returning %s to inventory", GetName(), ItemToReturn->GetItem()->Name);
uint32 ItemID = ItemToReturn->GetItem()->ID;
@@ -3056,7 +3056,7 @@ bool Client::MoveItemToInventory(EQEmu::ItemInstance *ItemToReturn, bool UpdateC
database.SaveInventory(character_id, m_inv.GetItem(i), i);
Log.Out(Logs::Detail, Logs::Inventory, "Char: %s Storing in main inventory slot %i", GetName(), i);
Log(Logs::Detail, Logs::Inventory, "Char: %s Storing in main inventory slot %i", GetName(), i);
return true;
}
@@ -3079,7 +3079,7 @@ bool Client::MoveItemToInventory(EQEmu::ItemInstance *ItemToReturn, bool UpdateC
database.SaveInventory(character_id, m_inv.GetItem(BaseSlotID + BagSlot), BaseSlotID + BagSlot);
Log.Out(Logs::Detail, Logs::Inventory, "Char: %s Storing in bag slot %i", GetName(), BaseSlotID + BagSlot);
Log(Logs::Detail, Logs::Inventory, "Char: %s Storing in bag slot %i", GetName(), BaseSlotID + BagSlot);
return true;
}
@@ -3089,7 +3089,7 @@ bool Client::MoveItemToInventory(EQEmu::ItemInstance *ItemToReturn, bool UpdateC
// Store on the cursor
//
Log.Out(Logs::Detail, Logs::Inventory, "Char: %s No space, putting on the cursor", GetName());
Log(Logs::Detail, Logs::Inventory, "Char: %s No space, putting on the cursor", GetName());
PushItemOnCursor(*ItemToReturn, UpdateClient);
@@ -3160,7 +3160,7 @@ bool Client::InterrogateInventory(Client* requester, bool log, bool silent, bool
log = true;
if (log) {
Log.Out(Logs::General, Logs::Error, "Client::InterrogateInventory() called for %s by %s with an error state of %s", GetName(), requester->GetName(), (error ? "TRUE" : "FALSE"));
Log(Logs::General, Logs::Error, "Client::InterrogateInventory() called for %s by %s with an error state of %s", GetName(), requester->GetName(), (error ? "TRUE" : "FALSE"));
}
if (!silent) {
requester->Message(1, "--- Inventory Interrogation Report for %s (requested by: %s, error state: %s) ---", GetName(), requester->GetName(), (error ? "TRUE" : "FALSE"));
@@ -3181,8 +3181,8 @@ bool Client::InterrogateInventory(Client* requester, bool log, bool silent, bool
}
if (log) {
Log.Out(Logs::General, Logs::Error, "Target interrogate inventory flag: %s", (GetInterrogateInvState() ? "TRUE" : "FALSE"));
Log.Out(Logs::Detail, Logs::None, "[CLIENT] Client::InterrogateInventory() -- End");
Log(Logs::General, Logs::Error, "Target interrogate inventory flag: %s", (GetInterrogateInvState() ? "TRUE" : "FALSE"));
Log(Logs::Detail, Logs::None, "[CLIENT] Client::InterrogateInventory() -- End");
}
if (!silent) {
requester->Message(1, "Target interrogation flag: %s", (GetInterrogateInvState() ? "TRUE" : "FALSE"));
@@ -3197,7 +3197,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.Out(Logs::Detail, Logs::None, "[CLIENT] Client::InterrogateInventory_() - Recursion count has exceeded the maximum allowable (You have a REALLY BIG PROBLEM!!)");
Log(Logs::Detail, Logs::None, "[CLIENT] Client::InterrogateInventory_() - Recursion count has exceeded the maximum allowable (You have a REALLY BIG PROBLEM!!)");
return;
}
@@ -3228,7 +3228,7 @@ void Client::InterrogateInventory_(bool errorcheck, Client* requester, int16 hea
else { e = ""; }
if (log) {
Log.Out(Logs::General, Logs::Error, "Head: %i, Depth: %i, Instance: %s, Parent: %s%s",
Log(Logs::General, Logs::Error, "Head: %i, Depth: %i, Instance: %s, Parent: %s%s",
head, depth, i.c_str(), p.c_str(), e.c_str());
}
if (!silent) {
+1 -1
View File
@@ -232,7 +232,7 @@ void NPC::AddLootDrop(const EQEmu::ItemData *item2, ItemList* itemlist, int16 ch
auto item = new ServerLootItem_Struct;
#if EQDEBUG>=11
Log.Out(Logs::General, Logs::None, "Adding drop to npc: %s, Item: %i", GetName(), item2->ID);
Log(Logs::General, Logs::None, "Adding drop to npc: %s, Item: %i", GetName(), item2->ID);
#endif
EQApplicationPacket* outapp = nullptr;
+12 -18
View File
@@ -309,12 +309,11 @@ Lua_Client Lua_EntityList::GetRandomClient(float x, float y, float z, float dist
Lua_Mob_List Lua_EntityList::GetMobList() {
Lua_Safe_Call_Class(Lua_Mob_List);
Lua_Mob_List ret;
std::list<Mob*> t_list;
self->GetMobList(t_list);
auto &t_list = self->GetMobList();
auto iter = t_list.begin();
while(iter != t_list.end()) {
ret.entries.push_back(Lua_Mob(*iter));
ret.entries.push_back(Lua_Mob(iter->second));
++iter;
}
@@ -324,12 +323,11 @@ Lua_Mob_List Lua_EntityList::GetMobList() {
Lua_Client_List Lua_EntityList::GetClientList() {
Lua_Safe_Call_Class(Lua_Client_List);
Lua_Client_List ret;
std::list<Client*> t_list;
self->GetClientList(t_list);
auto &t_list = self->GetClientList();
auto iter = t_list.begin();
while(iter != t_list.end()) {
ret.entries.push_back(Lua_Client(*iter));
ret.entries.push_back(Lua_Client(iter->second));
++iter;
}
@@ -339,12 +337,11 @@ Lua_Client_List Lua_EntityList::GetClientList() {
Lua_NPC_List Lua_EntityList::GetNPCList() {
Lua_Safe_Call_Class(Lua_NPC_List);
Lua_NPC_List ret;
std::list<NPC*> t_list;
self->GetNPCList(t_list);
auto &t_list = self->GetNPCList();
auto iter = t_list.begin();
while(iter != t_list.end()) {
ret.entries.push_back(Lua_NPC(*iter));
ret.entries.push_back(Lua_NPC(iter->second));
++iter;
}
@@ -354,12 +351,11 @@ Lua_NPC_List Lua_EntityList::GetNPCList() {
Lua_Corpse_List Lua_EntityList::GetCorpseList() {
Lua_Safe_Call_Class(Lua_Corpse_List);
Lua_Corpse_List ret;
std::list<Corpse*> t_list;
self->GetCorpseList(t_list);
auto &t_list = self->GetCorpseList();
auto iter = t_list.begin();
while(iter != t_list.end()) {
ret.entries.push_back(Lua_Corpse(*iter));
ret.entries.push_back(Lua_Corpse(iter->second));
++iter;
}
@@ -369,12 +365,11 @@ Lua_Corpse_List Lua_EntityList::GetCorpseList() {
Lua_Object_List Lua_EntityList::GetObjectList() {
Lua_Safe_Call_Class(Lua_Object_List);
Lua_Object_List ret;
std::list<Object*> t_list;
self->GetObjectList(t_list);
auto &t_list = self->GetObjectList();
auto iter = t_list.begin();
while(iter != t_list.end()) {
ret.entries.push_back(Lua_Object(*iter));
ret.entries.push_back(Lua_Object(iter->second));
++iter;
}
@@ -384,12 +379,11 @@ Lua_Object_List Lua_EntityList::GetObjectList() {
Lua_Doors_List Lua_EntityList::GetDoorsList() {
Lua_Safe_Call_Class(Lua_Doors_List);
Lua_Doors_List ret;
std::list<Doors*> t_list;
self->GetDoorsList(t_list);
auto &t_list = self->GetDoorsList();
auto iter = t_list.begin();
while(iter != t_list.end()) {
ret.entries.push_back(Lua_Door(*iter));
ret.entries.push_back(Lua_Door(iter->second));
++iter;
}
+2 -2
View File
@@ -1298,14 +1298,14 @@ double lua_clock() {
}
void lua_debug(std::string message) {
Log.Out(Logs::General, Logs::QuestDebug, message);
Log(Logs::General, Logs::QuestDebug, message);
}
void lua_debug(std::string message, int level) {
if (level < Logs::General || level > Logs::Detail)
return;
Log.Out(static_cast<Logs::DebugLevel>(level), Logs::QuestDebug, message);
Log(static_cast<Logs::DebugLevel>(level), Logs::QuestDebug, message);
}
void lua_update_zone_header(std::string type, std::string value) {
+2
View File
@@ -2129,6 +2129,8 @@ luabind::scope lua_register_mob() {
.def("SpellFinished", (bool(Lua_Mob::*)(int,Lua_Mob,int,int,uint32,int))&Lua_Mob::SpellFinished)
.def("SpellFinished", (bool(Lua_Mob::*)(int,Lua_Mob,int,int,uint32,int,bool))&Lua_Mob::SpellFinished)
.def("SpellEffect", &Lua_Mob::SpellEffect)
.def("GetPet", &Lua_Mob::GetPet)
.def("GetOwner", &Lua_Mob::GetOwner)
.def("GetHateList", &Lua_Mob::GetHateList)
.def("GetHateTop", (Lua_Mob(Lua_Mob::*)(void))&Lua_Mob::GetHateTop)
.def("GetHateDamageTop", (Lua_Mob(Lua_Mob::*)(Lua_Mob))&Lua_Mob::GetHateDamageTop)
+23 -23
View File
@@ -290,7 +290,7 @@ Map *Map::LoadMapFile(std::string file) {
filename += file;
filename += ".map";
Log.Out(Logs::General, Logs::Status, "Attempting to load Map File :: '%s'", filename.c_str());
Log(Logs::General, Logs::Status, "Attempting to load Map File :: '%s'", filename.c_str());
auto m = new Map();
if (m->Load(filename)) {
@@ -305,7 +305,7 @@ Map *Map::LoadMapFile(std::string file) {
bool Map::Load(std::string filename, bool force_mmf_overwrite)
{
if (LoadMMF(filename, force_mmf_overwrite)) {
Log.Out(Logs::General, Logs::Status, "Loaded .MMF Map File in place of '%s'", filename.c_str());
Log(Logs::General, Logs::Status, "Loaded .MMF Map File in place of '%s'", filename.c_str());
return true;
}
#else
@@ -322,7 +322,7 @@ bool Map::Load(std::string filename)
}
if(version == 0x01000000) {
Log.Out(Logs::General, Logs::Status, "Loaded V1 Map File :: '%s'", filename.c_str());
Log(Logs::General, Logs::Status, "Loaded V1 Map File :: '%s'", filename.c_str());
bool v = LoadV1(f);
fclose(f);
@@ -333,7 +333,7 @@ bool Map::Load(std::string filename)
return v;
} else if(version == 0x02000000) {
Log.Out(Logs::General, Logs::Status, "Loaded V2 Map File :: '%s'", filename.c_str());
Log(Logs::General, Logs::Status, "Loaded V2 Map File :: '%s'", filename.c_str());
bool v = LoadV2(f);
fclose(f);
@@ -1010,53 +1010,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.Out(Logs::General, Logs::Zone_Server, "Failed to load Map MMF file: '%s'", mmf_file_name.c_str());
Log(Logs::General, Logs::Zone_Server, "Failed to load Map MMF file: '%s'", mmf_file_name.c_str());
return false;
}
FILE *f = fopen(mmf_file_name.c_str(), "rb");
if (!f) {
Log.Out(Logs::General, Logs::Zone_Server, "Failed to load Map MMF file: '%s' - could not open file", mmf_file_name.c_str());
Log(Logs::General, Logs::Zone_Server, "Failed to load Map MMF file: '%s' - 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.Out(Logs::General, Logs::Zone_Server, "Failed to load Map MMF file: '%s' - f@file_version", mmf_file_name.c_str());
Log(Logs::General, Logs::Zone_Server, "Failed to load Map MMF file: '%s' - 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.Out(Logs::General, Logs::Zone_Server, "Failed to load Map MMF file: '%s' - f@rm_buffer_size", mmf_file_name.c_str());
Log(Logs::General, Logs::Zone_Server, "Failed to load Map MMF file: '%s' - 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.Out(Logs::General, Logs::Zone_Server, "Failed to load Map MMF file: '%s' - f@rm_buffer_crc32", mmf_file_name.c_str());
Log(Logs::General, Logs::Zone_Server, "Failed to load Map MMF file: '%s' - f@rm_buffer_crc32", mmf_file_name.c_str());
return false;
}
if (rm_buffer_crc32 != /*crc32_check*/ 0) {
fclose(f);
Log.Out(Logs::General, Logs::Zone_Server, "Failed to load Map MMF file: '%s' - bad rm_buffer checksum", mmf_file_name.c_str());
Log(Logs::General, Logs::Zone_Server, "Failed to load Map MMF file: '%s' - 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.Out(Logs::General, Logs::Zone_Server, "Failed to load Map MMF file: '%s' - f@mmf_buffer_size", mmf_file_name.c_str());
Log(Logs::General, Logs::Zone_Server, "Failed to load Map MMF file: '%s' - 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.Out(Logs::General, Logs::Zone_Server, "Failed to load Map MMF file: '%s' - f@mmf_buffer", mmf_file_name.c_str());
Log(Logs::General, Logs::Zone_Server, "Failed to load Map MMF file: '%s' - f@mmf_buffer", mmf_file_name.c_str());
return false;
}
@@ -1083,7 +1083,7 @@ bool Map::LoadMMF(const std::string& map_file_name, bool force_mmf_overwrite)
if (!imp->rm) {
delete imp;
imp = nullptr;
Log.Out(Logs::General, Logs::Zone_Server, "Failed to load Map MMF file: '%s' - null RaycastMesh", mmf_file_name.c_str());
Log(Logs::General, Logs::Zone_Server, "Failed to load Map MMF file: '%s' - null RaycastMesh", mmf_file_name.c_str());
return false;
}
@@ -1093,14 +1093,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.Out(Logs::General, Logs::Zone_Server, "Failed to save Map MMF file - No implementation (map_file_name: '%s')", map_file_name.c_str());
Log(Logs::General, Logs::Zone_Server, "Failed to save Map MMF file - No implementation (map_file_name: '%s')", 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.Out(Logs::General, Logs::Zone_Server, "Failed to save Map MMF file: '%s'", mmf_file_name.c_str());
Log(Logs::General, Logs::Zone_Server, "Failed to save Map MMF file: '%s'", mmf_file_name.c_str());
return false;
}
@@ -1114,7 +1114,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.Out(Logs::General, Logs::Zone_Server, "Failed to save Map MMF file: '%s' - empty RaycastMesh buffer", mmf_file_name.c_str());
Log(Logs::General, Logs::Zone_Server, "Failed to save Map MMF file: '%s' - empty RaycastMesh buffer", mmf_file_name.c_str());
return false;
}
@@ -1125,13 +1125,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.Out(Logs::General, Logs::Zone_Server, "Failed to save Map MMF file: '%s' - null MMF buffer size", mmf_file_name.c_str());
Log(Logs::General, Logs::Zone_Server, "Failed to save Map MMF file: '%s' - null MMF buffer size", mmf_file_name.c_str());
return false;
}
f = fopen(mmf_file_name.c_str(), "wb");
if (!f) {
Log.Out(Logs::General, Logs::Zone_Server, "Failed to save Map MMF file: '%s' - could not open file", mmf_file_name.c_str());
Log(Logs::General, Logs::Zone_Server, "Failed to save Map MMF file: '%s' - could not open file", mmf_file_name.c_str());
return false;
}
@@ -1139,14 +1139,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.Out(Logs::General, Logs::Zone_Server, "Failed to save Map MMF file: '%s' - f@file_version", 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());
return false;
}
if (fwrite(&rm_buffer_size, sizeof(uint32), 1, f) != 1) {
fclose(f);
std::remove(mmf_file_name.c_str());
Log.Out(Logs::General, Logs::Zone_Server, "Failed to save Map MMF file: '%s' - f@rm_buffer_size", 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());
return false;
}
@@ -1154,21 +1154,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.Out(Logs::General, Logs::Zone_Server, "Failed to save Map MMF file: '%s' - f@rm_buffer_crc32", 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());
return false;
}
if (fwrite(&mmf_buffer_size, sizeof(uint32), 1, f) != 1) {
fclose(f);
std::remove(mmf_file_name.c_str());
Log.Out(Logs::General, Logs::Zone_Server, "Failed to save Map MMF file: '%s' - f@mmf_buffer_size", 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());
return false;
}
if (fwrite(mmf_buffer.data(), mmf_buffer_size, 1, f) != 1) {
fclose(f);
std::remove(mmf_file_name.c_str());
Log.Out(Logs::General, Logs::Zone_Server, "Failed to save Map MMF file: '%s' - f@mmf_buffer", 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());
return false;
}
+53 -53
View File
@@ -897,7 +897,7 @@ int32 Merc::CalcMaxMana()
break;
}
default: {
Log.Out(Logs::General, Logs::None, "Invalid Class '%c' in CalcMaxMana", GetCasterClass());
Log(Logs::General, Logs::None, "Invalid Class '%c' in CalcMaxMana", GetCasterClass());
max_mana = 0;
break;
}
@@ -918,7 +918,7 @@ int32 Merc::CalcMaxMana()
}
#if EQDEBUG >= 11
Log.Out(Logs::General, Logs::None, "Merc::CalcMaxMana() called for %s - returning %d", GetName(), max_mana);
Log(Logs::General, Logs::None, "Merc::CalcMaxMana() called for %s - returning %d", GetName(), max_mana);
#endif
return max_mana;
}
@@ -1708,7 +1708,7 @@ void Merc::AI_Process() {
if (AI_movement_timer->Check())
{
if(!IsRooted()) {
Log.Out(Logs::Detail, Logs::AI, "Pursuing %s while engaged.", GetTarget()->GetCleanName());
Log(Logs::Detail, Logs::AI, "Pursuing %s while engaged.", GetTarget()->GetCleanName());
CalculateNewPosition2(GetTarget()->GetX(), GetTarget()->GetY(), GetTarget()->GetZ(), GetRunspeed());
return;
}
@@ -1836,7 +1836,7 @@ bool Merc::AI_EngagedCastCheck() {
{
AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting.
Log.Out(Logs::Detail, Logs::AI, "Merc Engaged autocast check triggered");
Log(Logs::Detail, Logs::AI, "Merc Engaged autocast check triggered");
int8 mercClass = GetClass();
@@ -1891,7 +1891,7 @@ bool Merc::AI_IdleCastCheck() {
if (AIautocastspell_timer->Check(false)) {
#if MercAI_DEBUG_Spells >= 25
Log.Out(Logs::Detail, Logs::AI, "Merc Non-Engaged autocast check triggered: %s", this->GetCleanName());
Log(Logs::Detail, Logs::AI, "Merc Non-Engaged autocast check triggered: %s", this->GetCleanName());
#endif
AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting.
@@ -1943,7 +1943,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.Out(Logs::General, Logs::Error, "Error: detrimental spells requested from AICheckCloseBeneficialSpells!!");
Log(Logs::General, Logs::Error, "Error: detrimental spells requested from AICheckCloseBeneficialSpells!!");
return(false);
}
@@ -2310,7 +2310,7 @@ bool Merc::AICastSpell(int8 iChance, uint32 iSpellTypes) {
if(CheckAETaunt()) {
//get AE taunt
selectedMercSpell = GetBestMercSpellForAETaunt(this);
Log.Out(Logs::General, Logs::Mercenaries, "%s AE Taunting.", GetName());
Log(Logs::General, Logs::Mercenaries, "%s AE Taunting.", GetName());
}
if(selectedMercSpell.spellid == 0 && CheckTaunt()) {
@@ -4209,7 +4209,7 @@ bool Merc::CheckAETaunt() {
}
if(result >= 1) {
Log.Out(Logs::General, Logs::Mercenaries, "%s: Attempting AE Taunt", GetCleanName());
Log(Logs::General, Logs::Mercenaries, "%s: Attempting AE Taunt", GetCleanName());
return true;
}
}
@@ -4518,7 +4518,7 @@ bool Merc::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, boo
{
if (!other) {
SetTarget(nullptr);
Log.Out(Logs::General, Logs::Error, "A null Mob object was passed to Merc::Attack() for evaluation!");
Log(Logs::General, Logs::Error, "A null Mob object was passed to Merc::Attack() for evaluation!");
return false;
}
@@ -4876,7 +4876,7 @@ Merc* Merc::LoadMerc(Client *c, MercTemplate* merc_template, uint32 merchant_id,
merc->LoadMercSpells();
}
Log.Out(Logs::General, Logs::Mercenaries, "LoadMerc Successful for %s (%s).", merc->GetName(), c->GetName());
Log(Logs::General, Logs::Mercenaries, "LoadMerc Successful for %s (%s).", merc->GetName(), c->GetName());
return merc;
}
}
@@ -4908,7 +4908,7 @@ void Merc::UpdateMercInfo(Client *c) {
void Merc::UpdateMercStats(Client *c, bool setmax)
{
if (c->GetMercInfo().MercTemplateID > 0) {
Log.Out(Logs::General, Logs::Mercenaries, "Updating Mercenary Stats for %s (%s).", GetName(),
Log(Logs::General, Logs::Mercenaries, "Updating Mercenary Stats for %s (%s).", GetName(),
c->GetName());
const NPCType *npc_type = database.GetMercType(
zone->GetMercTemplate(c->GetMercInfo().MercTemplateID)->MercNPCID, GetRace(), c->GetLevel());
@@ -4961,7 +4961,7 @@ void Merc::UpdateMercStats(Client *c, bool setmax)
void Merc::ScaleStats(int scalepercent, bool setmax) {
Log.Out(Logs::General, Logs::Mercenaries, "Scaling Mercenary Stats to %d Percent for %s.", scalepercent, GetName());
Log(Logs::General, Logs::Mercenaries, "Scaling Mercenary Stats to %d Percent for %s.", scalepercent, GetName());
if (scalepercent <= 0)
return;
@@ -5154,7 +5154,7 @@ bool Merc::Spawn(Client *owner) {
SendPosition();
Log.Out(Logs::General, Logs::Mercenaries, "Spawn Mercenary %s.", GetName());
Log(Logs::General, Logs::Mercenaries, "Spawn Mercenary %s.", GetName());
//UpdateMercAppearance();
@@ -5300,7 +5300,7 @@ void Client::SendMercResponsePackets(uint32 ResponseType)
SendMercMerchantResponsePacket(3);
break;
}
Log.Out(Logs::General, Logs::Mercenaries, "SendMercResponsePackets %i for %s.", ResponseType, GetName());
Log(Logs::General, Logs::Mercenaries, "SendMercResponsePackets %i for %s.", ResponseType, GetName());
}
@@ -5342,7 +5342,7 @@ void Client::UpdateMercTimer()
SendMercResponsePackets(16);
}
Log.Out(Logs::General, Logs::Mercenaries, "UpdateMercTimer Complete for %s.", GetName());
Log(Logs::General, Logs::Mercenaries, "UpdateMercTimer Complete for %s.", GetName());
// Normal upkeep charge message
//Message(7, "You have been charged a mercenary upkeep cost of %i plat, and %i gold and your mercenary upkeep cost timer has been reset to 15 minutes.", upkeep_plat, upkeep_gold, (int)(RuleI(Mercs, UpkeepIntervalMS) / 1000 / 60));
@@ -5395,7 +5395,7 @@ bool Client::CheckCanHireMerc(Mob* merchant, uint32 template_id) {
}
}
Log.Out(Logs::General, Logs::Mercenaries, "CheckCanHireMerc True for %s.", GetName());
Log(Logs::General, Logs::Mercenaries, "CheckCanHireMerc True for %s.", GetName());
return true;
}
@@ -5468,7 +5468,7 @@ bool Client::CheckCanSpawnMerc(uint32 template_id) {
return false;
}
Log.Out(Logs::General, Logs::Mercenaries, "CheckCanSpawnMerc True for %s.", GetName());
Log(Logs::General, Logs::Mercenaries, "CheckCanSpawnMerc True for %s.", GetName());
return true;
}
@@ -5490,7 +5490,7 @@ bool Client::CheckCanUnsuspendMerc() {
return false;
}
Log.Out(Logs::General, Logs::Mercenaries, "CheckCanUnsuspendMerc True for %s.", GetName());
Log(Logs::General, Logs::Mercenaries, "CheckCanUnsuspendMerc True for %s.", GetName());
return true;
}
@@ -5505,7 +5505,7 @@ void Client::CheckMercSuspendTimer() {
GetMercInfo().SuspendedTime = 0;
SendMercResponsePackets(0);
SendMercSuspendResponsePacket(GetMercInfo().SuspendedTime);
Log.Out(Logs::General, Logs::Mercenaries, "CheckMercSuspendTimer Ready for %s.", GetName());
Log(Logs::General, Logs::Mercenaries, "CheckMercSuspendTimer Ready for %s.", GetName());
}
}
}
@@ -5518,7 +5518,7 @@ void Client::SuspendMercCommand() {
{
if(!CheckCanUnsuspendMerc())
{
Log.Out(Logs::General, Logs::Mercenaries, "SuspendMercCommand Unable to Unsuspend Merc for %s.", GetName());
Log(Logs::General, Logs::Mercenaries, "SuspendMercCommand Unable to Unsuspend Merc for %s.", GetName());
return;
}
@@ -5528,13 +5528,13 @@ void Client::SuspendMercCommand() {
if(merc)
{
SpawnMerc(merc, false);
Log.Out(Logs::General, Logs::Mercenaries, "SuspendMercCommand Successful Unsuspend for %s.", GetName());
Log(Logs::General, Logs::Mercenaries, "SuspendMercCommand Successful Unsuspend for %s.", GetName());
}
else
{
//merc failed to spawn
SendMercResponsePackets(3);
Log.Out(Logs::General, Logs::Mercenaries, "SuspendMercCommand Failed to Spawn Merc for %s.", GetName());
Log(Logs::General, Logs::Mercenaries, "SuspendMercCommand Failed to Spawn Merc for %s.", GetName());
}
}
else
@@ -5553,7 +5553,7 @@ void Client::SuspendMercCommand() {
if(CurrentMerc && GetMercID())
{
CurrentMerc->Suspend();
Log.Out(Logs::General, Logs::Mercenaries, "SuspendMercCommand Successful Suspend for %s.", GetName());
Log(Logs::General, Logs::Mercenaries, "SuspendMercCommand Successful Suspend for %s.", GetName());
}
else
{
@@ -5565,14 +5565,14 @@ void Client::SuspendMercCommand() {
GetMercTimer()->Disable();
SendMercSuspendResponsePacket(GetMercInfo().SuspendedTime);
SendMercTimer(nullptr);
Log.Out(Logs::General, Logs::Mercenaries, "SuspendMercCommand Failed to Get Merc to Suspend. Resetting Suspend State for %s.", GetName());
Log(Logs::General, Logs::Mercenaries, "SuspendMercCommand Failed to Get Merc to Suspend. Resetting Suspend State for %s.", GetName());
}
}
}
else
{
SpawnMercOnZone();
Log.Out(Logs::General, Logs::Mercenaries, "SuspendMercCommand Request Failed to Load Merc for %s. Trying SpawnMercOnZone.", GetName());
Log(Logs::General, Logs::Mercenaries, "SuspendMercCommand Request Failed to Load Merc for %s. Trying SpawnMercOnZone.", GetName());
}
}
@@ -5605,7 +5605,7 @@ void Client::SpawnMercOnZone() {
{
SpawnMerc(merc, false);
}
Log.Out(Logs::General, Logs::Mercenaries, "SpawnMercOnZone Normal Merc for %s.", GetName());
Log(Logs::General, Logs::Mercenaries, "SpawnMercOnZone Normal Merc for %s.", GetName());
}
else
{
@@ -5621,7 +5621,7 @@ void Client::SpawnMercOnZone() {
// Send Mercenary Status/Timer packet
SendMercTimer(GetMerc());
Log.Out(Logs::General, Logs::Mercenaries, "SpawnMercOnZone Suspended Merc for %s.", GetName());
Log(Logs::General, Logs::Mercenaries, "SpawnMercOnZone Suspended Merc for %s.", GetName());
}
}
else
@@ -5629,7 +5629,7 @@ void Client::SpawnMercOnZone() {
// No Merc Hired
// RoF+ displays a message from the following packet, which seems useless
//SendClearMercInfo();
Log.Out(Logs::General, Logs::Mercenaries, "SpawnMercOnZone Failed to load Merc Info from the Database for %s.", GetName());
Log(Logs::General, Logs::Mercenaries, "SpawnMercOnZone Failed to load Merc Info from the Database for %s.", GetName());
}
}
@@ -5643,17 +5643,17 @@ void Client::SendMercTimer(Merc* merc) {
if (!merc)
{
SendMercTimerPacket(NO_MERC_ID, MERC_STATE_SUSPENDED, GetMercInfo().SuspendedTime, GetMercInfo().MercTimerRemaining, RuleI(Mercs, SuspendIntervalMS));
Log.Out(Logs::General, Logs::Mercenaries, "SendMercTimer No Merc for %s.", GetName());
Log(Logs::General, Logs::Mercenaries, "SendMercTimer No Merc for %s.", GetName());
}
else if (merc->IsSuspended())
{
SendMercTimerPacket(NO_MERC_ID, MERC_STATE_SUSPENDED, GetMercInfo().SuspendedTime, GetMercInfo().MercTimerRemaining, RuleI(Mercs, SuspendIntervalMS));
Log.Out(Logs::General, Logs::Mercenaries, "SendMercTimer Suspended Merc for %s.", GetName());
Log(Logs::General, Logs::Mercenaries, "SendMercTimer Suspended Merc for %s.", GetName());
}
else
{
SendMercTimerPacket(merc->GetID(), MERC_STATE_NORMAL, NOT_SUSPENDED_TIME, GetMercInfo().MercTimerRemaining, RuleI(Mercs, SuspendIntervalMS));
Log.Out(Logs::General, Logs::Mercenaries, "SendMercTimer Normal Merc for %s.", GetName());
Log(Logs::General, Logs::Mercenaries, "SendMercTimer Normal Merc for %s.", GetName());
}
}
@@ -5675,7 +5675,7 @@ void Client::SpawnMerc(Merc* merc, bool setMaxStats) {
merc->Unsuspend(setMaxStats);
merc->SetStance(GetMercInfo().Stance);
Log.Out(Logs::General, Logs::Mercenaries, "SpawnMerc Success for %s.", GetName());
Log(Logs::General, Logs::Mercenaries, "SpawnMerc Success for %s.", GetName());
return;
@@ -5704,7 +5704,7 @@ bool Merc::Suspend() {
// Start the timer to send the packet that refreshes the Unsuspend Button
mercOwner->GetPTimers().Start(pTimerMercSuspend, RuleI(Mercs, SuspendIntervalS));
Log.Out(Logs::General, Logs::Mercenaries, "Suspend Complete for %s.", mercOwner->GetName());
Log(Logs::General, Logs::Mercenaries, "Suspend Complete for %s.", mercOwner->GetName());
return true;
}
@@ -5790,12 +5790,12 @@ bool Client::DismissMerc(uint32 MercID) {
bool Dismissed = true;
if (!database.DeleteMerc(MercID))
{
Log.Out(Logs::General, Logs::Mercenaries, "Dismiss Failed Database Query for MercID: %i, Client: %s.", MercID, GetName());
Log(Logs::General, Logs::Mercenaries, "Dismiss Failed Database Query for MercID: %i, Client: %s.", MercID, GetName());
Dismissed = false;
}
else
{
Log.Out(Logs::General, Logs::Mercenaries, "Dismiss Successful for %s.", GetName());
Log(Logs::General, Logs::Mercenaries, "Dismiss Successful for %s.", GetName());
}
if (GetMerc())
@@ -5952,13 +5952,13 @@ bool Merc::MercJoinClientGroup() {
database.SetGroupLeaderName(g->GetID(), mercOwner->GetName());
database.RefreshGroupFromDB(mercOwner);
g->SaveGroupLeaderAA();
Log.Out(Logs::General, Logs::Mercenaries, "Mercenary joined new group: %s (%s).", GetName(), mercOwner->GetName());
Log(Logs::General, Logs::Mercenaries, "Mercenary joined new group: %s (%s).", GetName(), mercOwner->GetName());
}
else
{
g->DisbandGroup();
Suspend();
Log.Out(Logs::General, Logs::Mercenaries, "Mercenary disbanded new group: %s (%s).", GetName(), mercOwner->GetName());
Log(Logs::General, Logs::Mercenaries, "Mercenary disbanded new group: %s (%s).", GetName(), mercOwner->GetName());
}
}
@@ -5968,12 +5968,12 @@ bool Merc::MercJoinClientGroup() {
database.RefreshGroupFromDB(mercOwner);
// Update members that are out of zone
GetGroup()->SendGroupJoinOOZ(this);
Log.Out(Logs::General, Logs::Mercenaries, "Mercenary %s joined existing group with %s.", GetName(), mercOwner->GetName());
Log(Logs::General, Logs::Mercenaries, "Mercenary %s joined existing group with %s.", GetName(), mercOwner->GetName());
}
else
{
Suspend();
Log.Out(Logs::General, Logs::Mercenaries, "Mercenary failed to join the group - Suspending %s for (%s).", GetName(), mercOwner->GetName());
Log(Logs::General, Logs::Mercenaries, "Mercenary failed to join the group - Suspending %s for (%s).", GetName(), mercOwner->GetName());
}
}
@@ -6024,7 +6024,7 @@ Merc* Client::GetMerc() {
if(GetMercID() == 0)
{
Log.Out(Logs::Detail, Logs::Mercenaries, "GetMerc - GetMercID: 0 for %s.", GetName());
Log(Logs::Detail, Logs::Mercenaries, "GetMerc - GetMercID: 0 for %s.", GetName());
return (nullptr);
}
@@ -6032,14 +6032,14 @@ Merc* Client::GetMerc() {
if(tmp == nullptr)
{
SetMercID(0);
Log.Out(Logs::Detail, Logs::Mercenaries, "GetMerc No Merc for %s.", GetName());
Log(Logs::Detail, Logs::Mercenaries, "GetMerc No Merc for %s.", GetName());
return (nullptr);
}
if(tmp->GetOwnerID() != GetID())
{
SetMercID(0);
Log.Out(Logs::Detail, Logs::Mercenaries, "GetMerc Owner Mismatch - OwnerID: %d, ClientID: %d, Client: %s.", tmp->GetOwnerID(), GetID(), GetName());
Log(Logs::Detail, Logs::Mercenaries, "GetMerc Owner Mismatch - OwnerID: %d, ClientID: %d, Client: %s.", tmp->GetOwnerID(), GetID(), GetName());
return (nullptr);
}
@@ -6057,7 +6057,7 @@ uint8 Client::GetNumMercs() {
numMercs++;
}
}
Log.Out(Logs::General, Logs::Mercenaries, "GetNumMercs Number: %i for %s.", numMercs, GetName());
Log(Logs::General, Logs::Mercenaries, "GetNumMercs Number: %i for %s.", numMercs, GetName());
return numMercs;
}
@@ -6098,7 +6098,7 @@ void Client::SetMerc(Merc* newmerc) {
GetMercInfo().Gender = 0;
GetMercInfo().State = 0;
memset(GetMercInfo().merc_name, 0, 64);
Log.Out(Logs::General, Logs::Mercenaries, "SetMerc No Merc for %s.", GetName());
Log(Logs::General, Logs::Mercenaries, "SetMerc No Merc for %s.", GetName());
}
else
{
@@ -6115,7 +6115,7 @@ void Client::SetMerc(Merc* newmerc) {
GetMercInfo().Gender = newmerc->GetGender();
GetMercInfo().State = newmerc->IsSuspended() ? MERC_STATE_SUSPENDED : MERC_STATE_NORMAL;
snprintf(GetMercInfo().merc_name, 64, "%s", newmerc->GetName());
Log.Out(Logs::General, Logs::Mercenaries, "SetMerc New Merc for %s.", GetName());
Log(Logs::General, Logs::Mercenaries, "SetMerc New Merc for %s.", GetName());
}
}
@@ -6136,7 +6136,7 @@ void Client::SendMercMerchantResponsePacket(int32 response_type) {
MercenaryMerchantResponse_Struct* mmr = (MercenaryMerchantResponse_Struct*)outapp->pBuffer;
mmr->ResponseType = response_type; // send specified response type
FastQueuePacket(&outapp);
Log.Out(Logs::Moderate, Logs::Mercenaries, "Sent SendMercMerchantResponsePacket ResponseType: %i, Client: %s.", response_type, GetName());
Log(Logs::Moderate, Logs::Mercenaries, "Sent SendMercMerchantResponsePacket ResponseType: %i, Client: %s.", response_type, GetName());
}
}
@@ -6145,7 +6145,7 @@ void Client::SendMercenaryUnknownPacket(uint8 type) {
auto outapp = new EQApplicationPacket(OP_MercenaryUnknown1, 1);
outapp->WriteUInt8(type);
FastQueuePacket(&outapp);
Log.Out(Logs::Moderate, Logs::Mercenaries, "Sent SendMercenaryUnknownPacket Type: %i, Client: %s.", type, GetName());
Log(Logs::Moderate, Logs::Mercenaries, "Sent SendMercenaryUnknownPacket Type: %i, Client: %s.", type, GetName());
}
@@ -6154,7 +6154,7 @@ void Client::SendMercenaryUnsuspendPacket(uint8 type) {
auto outapp = new EQApplicationPacket(OP_MercenaryUnsuspendResponse, 1);
outapp->WriteUInt8(type);
FastQueuePacket(&outapp);
Log.Out(Logs::Moderate, Logs::Mercenaries, "Sent SendMercenaryUnsuspendPacket Type: %i, Client: %s.", type, GetName());
Log(Logs::Moderate, Logs::Mercenaries, "Sent SendMercenaryUnsuspendPacket Type: %i, Client: %s.", type, GetName());
}
@@ -6164,7 +6164,7 @@ void Client::SendMercSuspendResponsePacket(uint32 suspended_time) {
SuspendMercenaryResponse_Struct* smr = (SuspendMercenaryResponse_Struct*)outapp->pBuffer;
smr->SuspendTime = suspended_time; // Seen 0 (not suspended) or c9 c2 64 4f (suspended on Sat Mar 17 11:58:49 2012) - Unix Timestamp
FastQueuePacket(&outapp);
Log.Out(Logs::Moderate, Logs::Mercenaries, "Sent SendMercSuspendResponsePacket Time: %i, Client: %s.", suspended_time, GetName());
Log(Logs::Moderate, Logs::Mercenaries, "Sent SendMercSuspendResponsePacket Time: %i, Client: %s.", suspended_time, GetName());
}
@@ -6179,7 +6179,7 @@ void Client::SendMercTimerPacket(int32 entity_id, int32 merc_state, int32 suspen
mss->UpdateInterval = update_interval; // Seen 900000 - 15 minutes in ms
mss->MercUnk01 = unk01; // Seen 180000 - 3 minutes in ms - Used for the unsuspend button refresh timer
FastQueuePacket(&outapp);
Log.Out(Logs::Moderate, Logs::Mercenaries, "Sent SendMercTimerPacket EndID: %i, State: %i, SuspendTime: %i, Interval: %i, Unk1: %i, Client: %s.", entity_id, merc_state, suspended_time, update_interval, unk01, GetName());
Log(Logs::Moderate, Logs::Mercenaries, "Sent SendMercTimerPacket EndID: %i, State: %i, SuspendTime: %i, Interval: %i, Unk1: %i, Client: %s.", entity_id, merc_state, suspended_time, update_interval, unk01, GetName());
}
@@ -6190,7 +6190,7 @@ void Client::SendMercAssignPacket(uint32 entityID, uint32 unk01, uint32 unk02) {
mas->MercUnk01 = unk01;
mas->MercUnk02 = unk02;
FastQueuePacket(&outapp);
Log.Out(Logs::Moderate, Logs::Mercenaries, "Sent SendMercAssignPacket EndID: %i, Unk1: %i, Unk2: %i, Client: %s.", entityID, unk01, unk02, GetName());
Log(Logs::Moderate, Logs::Mercenaries, "Sent SendMercAssignPacket EndID: %i, Unk1: %i, Unk2: %i, Client: %s.", entityID, unk01, unk02, GetName());
}
void NPC::LoadMercTypes() {
@@ -6205,7 +6205,7 @@ void NPC::LoadMercTypes() {
auto results = database.QueryDatabase(query);
if (!results.Success())
{
Log.Out(Logs::General, Logs::Error, "Error in NPC::LoadMercTypes()");
Log(Logs::General, Logs::Error, "Error in NPC::LoadMercTypes()");
return;
}
@@ -6238,7 +6238,7 @@ void NPC::LoadMercs() {
if (!results.Success())
{
Log.Out(Logs::General, Logs::Error, "Error in NPC::LoadMercTypes()");
Log(Logs::General, Logs::Error, "Error in NPC::LoadMercTypes()");
return;
}
+5 -4
View File
@@ -1382,7 +1382,8 @@ void Mob::SendHPUpdate(bool skip_self)
// send to self - we need the actual hps here
if(IsClient() && (!skip_self || dospam)) {
this->CastToClient()->SendHPUpdateMarquee();
if (RuleB(Character, MarqueeHPUpdates))
this->CastToClient()->SendHPUpdateMarquee();
auto hp_app2 = new EQApplicationPacket(OP_HPUpdate, sizeof(SpawnHPUpdate_Struct));
SpawnHPUpdate_Struct* ds = (SpawnHPUpdate_Struct*)hp_app2->pBuffer;
@@ -1800,7 +1801,7 @@ void Mob::SendIllusionPacket(uint16 in_race, uint8 in_gender, uint8 in_texture,
/* Refresh armor and tints after send illusion packet */
this->SendArmorAppearance();
Log.Out(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",
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",
race, gender, texture, helmtexture, haircolor, beardcolor, eyecolor1, eyecolor2, hairstyle, luclinface, drakkin_heritage, drakkin_tattoo, drakkin_details, size);
}
@@ -3255,7 +3256,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.Out(Logs::Detail, Logs::Spells, "Player %s, Weapon Procced invalid spell %u", this->GetName(), spell_id);
Log(Logs::Detail, Logs::Spells, "Player %s, Weapon Procced invalid spell %u", this->GetName(), spell_id);
}
return;
}
@@ -4782,7 +4783,7 @@ void Mob::MeleeLifeTap(int32 damage) {
if(lifetap_amt && damage > 0){
lifetap_amt = damage * lifetap_amt / 100;
Log.Out(Logs::Detail, Logs::Combat, "Melee lifetap healing for %d damage.", damage);
Log(Logs::Detail, Logs::Combat, "Melee lifetap healing for %d damage.", damage);
if (lifetap_amt > 0)
HealDamage(lifetap_amt); //Heal self for modified damage amount.
+22 -20
View File
@@ -99,7 +99,7 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint32 iSpellTypes) {
) {
#if MobAI_DEBUG_Spells >= 21
Log.Out(Logs::Detail, Logs::AI, "Mob::AICastSpell: Casting: spellid=%u, tar=%s, dist2[%f]<=%f, mana_cost[%i]<=%i, cancast[%u]<=%u, type=%u",
Log(Logs::Detail, Logs::AI, "Mob::AICastSpell: Casting: spellid=%u, tar=%s, dist2[%f]<=%f, mana_cost[%i]<=%i, cancast[%u]<=%u, type=%u",
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
@@ -321,7 +321,7 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint32 iSpellTypes) {
}
#if MobAI_DEBUG_Spells >= 21
else {
Log.Out(Logs::Detail, Logs::AI, "Mob::AICastSpell: NotCasting: spellid=%u, tar=%s, dist2[%f]<=%f, mana_cost[%i]<=%i, cancast[%u]<=%u, type=%u",
Log(Logs::Detail, Logs::AI, "Mob::AICastSpell: NotCasting: spellid=%u, tar=%s, dist2[%f]<=%f, mana_cost[%i]<=%i, cancast[%u]<=%u, type=%u",
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
@@ -332,7 +332,7 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint32 iSpellTypes) {
bool NPC::AIDoSpellCast(uint8 i, Mob* tar, int32 mana_cost, uint32* oDontDoAgainBefore) {
#if MobAI_DEBUG_Spells >= 1
Log.Out(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);
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);
#endif
casting_spell_AIindex = i;
@@ -351,7 +351,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.Out(Logs::General, Logs::Error, "Error: detrimental spells requested from AICheckCloseBeneficialSpells!!");
Log(Logs::General, Logs::Error, "Error: detrimental spells requested from AICheckCloseBeneficialSpells!!");
return(false);
}
@@ -989,8 +989,8 @@ void Mob::AI_Process() {
CastToNPC()->CheckSignal();
}
if (engaged)
{
if (engaged) {
if (!(m_PlayerState & static_cast<uint32>(PlayerState::Aggressive)))
SendAddPlayerState(PlayerState::Aggressive);
// we are prevented from getting here if we are blind and don't have a target in range
@@ -1017,8 +1017,7 @@ void Mob::AI_Process() {
if (!target)
return;
if (target->IsCorpse())
{
if (target->IsCorpse()) {
RemoveFromHateList(this);
return;
}
@@ -1035,6 +1034,8 @@ void Mob::AI_Process() {
if (DivineAura())
return;
ProjectileAttack();
auto npcSpawnPoint = CastToNPC()->GetSpawnPoint();
if (GetSpecialAbility(TETHER)) {
float tether_range = static_cast<float>(GetSpecialAbilityParam(TETHER, 0));
@@ -1233,6 +1234,7 @@ void Mob::AI_Process() {
}
AI_EngagedCastCheck();
} //end is within combat rangepet
else {
//we cannot reach our target...
@@ -1271,7 +1273,7 @@ void Mob::AI_Process() {
else if (AI_movement_timer->Check())
{
if (!IsRooted()) {
Log.Out(Logs::Detail, Logs::AI, "Pursuing %s while engaged.", target->GetName());
Log(Logs::Detail, Logs::AI, "Pursuing %s while engaged.", target->GetName());
if (!RuleB(Pathing, Aggro) || !zone->pathing)
CalculateNewPosition2(target->GetX(), target->GetY(), target->GetZ(), GetRunspeed());
else
@@ -1506,7 +1508,7 @@ void NPC::AI_DoMovement() {
roambox_movingto_y = zone->random.Real(roambox_min_y+1,roambox_max_y-1);
}
Log.Out(Logs::Detail, Logs::AI, "Roam Box: d=%.3f (%.3f->%.3f,%.3f->%.3f): Go To (%.3f,%.3f)",
Log(Logs::Detail, Logs::AI, "Roam Box: d=%.3f (%.3f->%.3f,%.3f->%.3f): Go To (%.3f,%.3f)",
roambox_distance, roambox_min_x, roambox_max_x, roambox_min_y, roambox_max_y, roambox_movingto_x, roambox_movingto_y);
if (!CalculateNewPosition2(roambox_movingto_x, roambox_movingto_y, GetZ(), walksp, true))
{
@@ -1536,7 +1538,7 @@ void NPC::AI_DoMovement() {
bool doMove = true;
if (m_CurrentWayPoint.x == GetX() && m_CurrentWayPoint.y == GetY())
{ // are we there yet? then stop
Log.Out(Logs::Detail, Logs::AI, "We have reached waypoint %d (%.3f,%.3f,%.3f) on grid %d", cur_wp, GetX(), GetY(), GetZ(), GetGrid());
Log(Logs::Detail, Logs::AI, "We have reached waypoint %d (%.3f,%.3f,%.3f) on grid %d", cur_wp, GetX(), GetY(), GetZ(), GetGrid());
SetWaypointPause();
SetAppearance(eaStanding, false);
@@ -1587,7 +1589,7 @@ void NPC::AI_DoMovement() {
if (movetimercompleted==true)
{ // time to pause has ended
SetGrid( 0 - GetGrid()); // revert to AI control
Log.Out(Logs::Detail, Logs::Pathing, "Quest pathing is finished. Resuming on grid %d", GetGrid());
Log(Logs::Detail, Logs::Pathing, "Quest pathing is finished. Resuming on grid %d", GetGrid());
SetAppearance(eaStanding, false);
@@ -1622,7 +1624,7 @@ void NPC::AI_DoMovement() {
if (!CP2Moved)
{
if(moved) {
Log.Out(Logs::Detail, Logs::AI, "Reached guard point (%.3f,%.3f,%.3f)", m_GuardPoint.x, m_GuardPoint.y, m_GuardPoint.z);
Log(Logs::Detail, Logs::AI, "Reached guard point (%.3f,%.3f,%.3f)", m_GuardPoint.x, m_GuardPoint.y, m_GuardPoint.z);
ClearFeignMemory();
moved=false;
if (GetTarget() == nullptr || DistanceSquared(m_Position, GetTarget()->GetPosition()) >= 5*5 )
@@ -1668,11 +1670,11 @@ void NPC::AI_SetupNextWaypoint() {
else {
movetimercompleted = false;
Log.Out(Logs::Detail, Logs::Pathing, "We are departing waypoint %d.", cur_wp);
Log(Logs::Detail, Logs::Pathing, "We are departing waypoint %d.", cur_wp);
//if we were under quest control (with no grid), we are done now..
if (cur_wp == -2) {
Log.Out(Logs::Detail, Logs::Pathing, "Non-grid quest mob has reached its quest ordered waypoint. Leaving pathing mode.");
Log(Logs::Detail, Logs::Pathing, "Non-grid quest mob has reached its quest ordered waypoint. Leaving pathing mode.");
roamer = false;
cur_wp = 0;
}
@@ -1809,7 +1811,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.Out(Logs::Detail, Logs::AI, "Engaged autocast check triggered. Trying to cast healing spells then maybe offensive spells.");
Log(Logs::Detail, Logs::AI, "Engaged autocast check triggered. Trying to cast healing spells then maybe offensive spells.");
// try casting a heal or gate
if (!AICastSpell(this, AISpellVar.engaged_beneficial_self_chance, SpellType_Heal | SpellType_Escape | SpellType_InCombatBuff)) {
@@ -1832,7 +1834,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.Out(Logs::Detail, Logs::AI, "Engaged (pursuing) autocast check triggered. Trying to cast offensive spells.");
Log(Logs::Detail, Logs::AI, "Engaged (pursuing) autocast check triggered. Trying to cast offensive spells.");
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)) {
//no spell cast, try again soon.
AIautocastspell_timer->Start(RandomTimer(AISpellVar.pursue_no_sp_recast_min, AISpellVar.pursue_no_sp_recast_max), false);
@@ -1851,7 +1853,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.Out(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);
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);
} //else, spell casting finishing will reset the timer.
} //else, spell casting finishing will reset the timer.
@@ -2244,7 +2246,7 @@ bool NPC::AI_AddNPCSpells(uint32 iDBSpellsID) {
else {
debug_msg.append(" (not found)");
}
Log.Out(Logs::Detail, Logs::AI, "%s", debug_msg.c_str());
Log(Logs::Detail, Logs::AI, "%s", debug_msg.c_str());
#endif
uint16 attack_proc_spell = -1;
int8 proc_chance = 3;
@@ -2408,7 +2410,7 @@ bool NPC::AI_AddNPCSpellsEffects(uint32 iDBSpellsEffectsID) {
else {
debug_msg.append(" (not found)");
}
Log.Out(Logs::Detail, Logs::AI, "%s", debug_msg.c_str());
Log(Logs::Detail, Logs::AI, "%s", debug_msg.c_str());
#endif
if (parentlist) {
+240 -233
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemu.org)
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemu.org)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#define DONT_SHARED_OPCODES
@@ -79,16 +79,16 @@
#include <chrono>
#ifdef _CRTDBG_MAP_ALLOC
#undef new
#define new new(_NORMAL_BLOCK, __FILE__, __LINE__)
#undef new
#define new new(_NORMAL_BLOCK, __FILE__, __LINE__)
#endif
#ifdef _WINDOWS
#include <conio.h>
#include <process.h>
#include <conio.h>
#include <process.h>
#else
#include <pthread.h>
#include "../common/unix.h"
#include <pthread.h>
#include "../common/unix.h"
#endif
volatile bool RunLoops = true;
@@ -105,7 +105,7 @@ TitleManager title_manager;
QueryServ *QServ = 0;
TaskManager *taskmanager = 0;
QuestParserCollection *parse = 0;
EQEmuLogSys Log;
EQEmuLogSys LogSys;
const SPDat_Spell_Struct* spells;
int32 SPDAT_RECORDS = -1;
const ZoneConfig *Config;
@@ -115,10 +115,10 @@ void Shutdown();
extern void MapOpcodes();
int main(int argc, char** argv) {
RegisterExecutablePlatform(ExePlatformZone);
Log.LoadLogSettingsDefaults();
RegisterExecutablePlatform(ExePlatformZone);
LogSys.LoadLogSettingsDefaults();
set_exception_handler();
set_exception_handler();
#ifdef USE_MAP_MMFS
if (argc == 3 && strcasecmp(argv[1], "convert_map") == 0) {
@@ -135,16 +135,16 @@ int main(int argc, char** argv) {
auto success = m->Load(filename, true);
delete m;
std::cout << mapfile.c_str() << " conversion " << (success ? "succeeded" : "failed") << std::endl;
return 0;
}
#endif /*USE_MAP_MMFS*/
QServ = new QueryServ;
Log.Out(Logs::General, Logs::Zone_Server, "Loading server configuration..");
if(!ZoneConfig::LoadConfig()) {
Log.Out(Logs::General, Logs::Error, "Loading server configuration failed.");
Log(Logs::General, Logs::Zone_Server, "Loading server configuration..");
if (!ZoneConfig::LoadConfig()) {
Log(Logs::General, Logs::Error, "Loading server configuration failed.");
return 1;
}
Config = ZoneConfig::get();
@@ -152,81 +152,85 @@ int main(int argc, char** argv) {
const char *zone_name;
uint32 instance_id = 0;
std::string z_name;
if(argc == 4) {
if (argc == 4) {
instance_id = atoi(argv[3]);
worldserver.SetLauncherName(argv[2]);
auto zone_port = SplitString(argv[1], ':');
if(!zone_port.empty()) {
if (!zone_port.empty()) {
z_name = zone_port[0];
}
if(zone_port.size() > 1) {
if (zone_port.size() > 1) {
std::string p_name = zone_port[1];
Config->SetZonePort(atoi(p_name.c_str()));
}
worldserver.SetLaunchedName(z_name.c_str());
if(strncmp(z_name.c_str(), "dynamic_", 8) == 0) {
if (strncmp(z_name.c_str(), "dynamic_", 8) == 0) {
zone_name = ".";
}
else {
zone_name = z_name.c_str();
}
} else if(argc == 3) {
}
else if (argc == 3) {
worldserver.SetLauncherName(argv[2]);
auto zone_port = SplitString(argv[1], ':');
if(!zone_port.empty()) {
if (!zone_port.empty()) {
z_name = zone_port[0];
}
if(zone_port.size() > 1) {
if (zone_port.size() > 1) {
std::string p_name = zone_port[1];
Config->SetZonePort(atoi(p_name.c_str()));
}
worldserver.SetLaunchedName(z_name.c_str());
if(strncmp(z_name.c_str(), "dynamic_", 8) == 0) {
zone_name = ".";
} else {
zone_name = z_name.c_str();
}
} else if (argc == 2) {
worldserver.SetLauncherName("NONE");
auto zone_port = SplitString(argv[1], ':');
if(!zone_port.empty()) {
z_name = zone_port[0];
}
if(zone_port.size() > 1) {
std::string p_name = zone_port[1];
Config->SetZonePort(atoi(p_name.c_str()));
}
worldserver.SetLaunchedName(z_name.c_str());
if(strncmp(z_name.c_str(), "dynamic_", 8) == 0) {
if (strncmp(z_name.c_str(), "dynamic_", 8) == 0) {
zone_name = ".";
}
else {
zone_name = z_name.c_str();
}
} else {
}
else if (argc == 2) {
worldserver.SetLauncherName("NONE");
auto zone_port = SplitString(argv[1], ':');
if (!zone_port.empty()) {
z_name = zone_port[0];
}
if (zone_port.size() > 1) {
std::string p_name = zone_port[1];
Config->SetZonePort(atoi(p_name.c_str()));
}
worldserver.SetLaunchedName(z_name.c_str());
if (strncmp(z_name.c_str(), "dynamic_", 8) == 0) {
zone_name = ".";
}
else {
zone_name = z_name.c_str();
}
}
else {
zone_name = ".";
worldserver.SetLaunchedName(".");
worldserver.SetLauncherName("NONE");
}
Log.Out(Logs::General, Logs::Zone_Server, "Connecting to MySQL...");
Log(Logs::General, Logs::Zone_Server, "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.Out(Logs::General, Logs::Error, "Cannot continue without a database connection.");
Log(Logs::General, Logs::Error, "Cannot continue without a database connection.");
return 1;
}
@@ -237,148 +241,150 @@ int main(int argc, char** argv) {
Config->DatabasePassword.c_str(),
Config->DatabaseDB.c_str(),
Config->DatabasePort)) {
Log.Out(Logs::General, Logs::Error, "Cannot continue without a bots database connection.");
Log(Logs::General, Logs::Error, "Cannot continue without a bots database connection.");
return 1;
}
#endif
/* Register Log System and Settings */
Log.OnLogHookCallBackZone(&Zone::GMSayHookCallBackProcess);
database.LoadLogSettings(Log.log_settings);
Log.StartFileLogs();
LogSys.OnLogHookCallBackZone(&Zone::GMSayHookCallBackProcess);
database.LoadLogSettings(LogSys.log_settings);
LogSys.StartFileLogs();
/* Guilds */
guild_mgr.SetDatabase(&database);
GuildBanks = nullptr;
#ifdef _EQDEBUG
_CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
#endif
Log.Out(Logs::General, Logs::Zone_Server, "CURRENT_VERSION: %s", CURRENT_VERSION);
Log(Logs::General, Logs::Zone_Server, "CURRENT_VERSION: %s", CURRENT_VERSION);
/*
* Setup nice signal handlers
*/
if (signal(SIGINT, CatchSignal) == SIG_ERR) {
Log.Out(Logs::General, Logs::Error, "Could not set signal handler");
if (signal(SIGINT, CatchSignal) == SIG_ERR) {
Log(Logs::General, Logs::Error, "Could not set signal handler");
return 1;
}
if (signal(SIGTERM, CatchSignal) == SIG_ERR) {
Log.Out(Logs::General, Logs::Error, "Could not set signal handler");
if (signal(SIGTERM, CatchSignal) == SIG_ERR) {
Log(Logs::General, Logs::Error, "Could not set signal handler");
return 1;
}
#ifndef WIN32
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) {
Log.Out(Logs::General, Logs::Error, "Could not set signal handler");
#ifndef WIN32
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) {
Log(Logs::General, Logs::Error, "Could not set signal handler");
return 1;
}
#endif
#endif
Log.Out(Logs::General, Logs::Zone_Server, "Mapping Incoming Opcodes");
Log(Logs::General, Logs::Zone_Server, "Mapping Incoming Opcodes");
MapOpcodes();
Log.Out(Logs::General, Logs::Zone_Server, "Loading Variables");
Log(Logs::General, Logs::Zone_Server, "Loading Variables");
database.LoadVariables();
std::string hotfix_name;
if(database.GetVariable("hotfix_name", hotfix_name)) {
if(!hotfix_name.empty()) {
Log.Out(Logs::General, Logs::Zone_Server, "Current hotfix in use: '%s'", hotfix_name.c_str());
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());
}
}
Log.Out(Logs::General, Logs::Zone_Server, "Loading zone names");
Log(Logs::General, Logs::Zone_Server, "Loading zone names");
database.LoadZoneNames();
Log.Out(Logs::General, Logs::Zone_Server, "Loading items");
if(!database.LoadItems(hotfix_name)) {
Log.Out(Logs::General, Logs::Error, "Loading items FAILED!");
Log.Out(Logs::General, Logs::Error, "Failed. But ignoring error and going on...");
Log(Logs::General, Logs::Zone_Server, "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...");
}
Log.Out(Logs::General, Logs::Zone_Server, "Loading npc faction lists");
if(!database.LoadNPCFactionLists(hotfix_name)) {
Log.Out(Logs::General, Logs::Error, "Loading npcs faction lists FAILED!");
Log(Logs::General, Logs::Zone_Server, "Loading npc faction lists");
if (!database.LoadNPCFactionLists(hotfix_name)) {
Log(Logs::General, Logs::Error, "Loading npcs faction lists FAILED!");
return 1;
}
Log.Out(Logs::General, Logs::Zone_Server, "Loading loot tables");
if(!database.LoadLoot(hotfix_name)) {
Log.Out(Logs::General, Logs::Error, "Loading loot FAILED!");
Log(Logs::General, Logs::Zone_Server, "Loading loot tables");
if (!database.LoadLoot(hotfix_name)) {
Log(Logs::General, Logs::Error, "Loading loot FAILED!");
return 1;
}
Log.Out(Logs::General, Logs::Zone_Server, "Loading skill caps");
if(!database.LoadSkillCaps(std::string(hotfix_name))) {
Log.Out(Logs::General, Logs::Error, "Loading skill caps FAILED!");
Log(Logs::General, Logs::Zone_Server, "Loading skill caps");
if (!database.LoadSkillCaps(std::string(hotfix_name))) {
Log(Logs::General, Logs::Error, "Loading skill caps FAILED!");
return 1;
}
Log.Out(Logs::General, Logs::Zone_Server, "Loading spells");
if(!database.LoadSpells(hotfix_name, &SPDAT_RECORDS, &spells)) {
Log.Out(Logs::General, Logs::Error, "Loading spells FAILED!");
Log(Logs::General, Logs::Zone_Server, "Loading spells");
if (!database.LoadSpells(hotfix_name, &SPDAT_RECORDS, &spells)) {
Log(Logs::General, Logs::Error, "Loading spells FAILED!");
return 1;
}
Log.Out(Logs::General, Logs::Zone_Server, "Loading base data");
if(!database.LoadBaseData(hotfix_name)) {
Log.Out(Logs::General, Logs::Error, "Loading base data FAILED!");
Log(Logs::General, Logs::Zone_Server, "Loading base data");
if (!database.LoadBaseData(hotfix_name)) {
Log(Logs::General, Logs::Error, "Loading base data FAILED!");
return 1;
}
Log.Out(Logs::General, Logs::Zone_Server, "Loading guilds");
Log(Logs::General, Logs::Zone_Server, "Loading guilds");
guild_mgr.LoadGuilds();
Log.Out(Logs::General, Logs::Zone_Server, "Loading factions");
Log(Logs::General, Logs::Zone_Server, "Loading factions");
database.LoadFactionData();
Log.Out(Logs::General, Logs::Zone_Server, "Loading titles");
Log(Logs::General, Logs::Zone_Server, "Loading titles");
title_manager.LoadTitles();
Log.Out(Logs::General, Logs::Zone_Server, "Loading tributes");
Log(Logs::General, Logs::Zone_Server, "Loading tributes");
database.LoadTributes();
Log.Out(Logs::General, Logs::Zone_Server, "Loading corpse timers");
Log(Logs::General, Logs::Zone_Server, "Loading corpse timers");
database.GetDecayTimes(npcCorpseDecayTimes);
Log.Out(Logs::General, Logs::Zone_Server, "Loading commands");
int retval=command_init();
if(retval<0)
Log.Out(Logs::General, Logs::Error, "Command loading FAILED");
Log(Logs::General, Logs::Zone_Server, "Loading commands");
int retval = command_init();
if (retval<0)
Log(Logs::General, Logs::Error, "Command loading FAILED");
else
Log.Out(Logs::General, Logs::Zone_Server, "%d commands loaded", retval);
Log(Logs::General, Logs::Zone_Server, "%d commands loaded", retval);
//rules:
{
std::string tmp;
if (database.GetVariable("RuleSet", tmp)) {
Log.Out(Logs::General, Logs::Zone_Server, "Loading rule set '%s'", tmp.c_str());
if(!RuleManager::Instance()->LoadRules(&database, tmp.c_str())) {
Log.Out(Logs::General, Logs::Error, "Failed to load ruleset '%s', falling back to defaults.", tmp.c_str());
Log(Logs::General, Logs::Zone_Server, "Loading rule set '%s'", tmp.c_str());
if (!RuleManager::Instance()->LoadRules(&database, tmp.c_str())) {
Log(Logs::General, Logs::Error, "Failed to load ruleset '%s', falling back to defaults.", tmp.c_str());
}
} else {
if(!RuleManager::Instance()->LoadRules(&database, "default")) {
Log.Out(Logs::General, Logs::Zone_Server, "No rule set configured, using default rules");
} else {
Log.Out(Logs::General, Logs::Zone_Server, "Loaded default rule set 'default'", tmp.c_str());
}
else {
if (!RuleManager::Instance()->LoadRules(&database, "default")) {
Log(Logs::General, Logs::Zone_Server, "No rule set configured, using default rules");
}
else {
Log(Logs::General, Logs::Zone_Server, "Loaded default rule set 'default'", tmp.c_str());
}
}
}
#ifdef BOTS
Log.Out(Logs::General, Logs::Zone_Server, "Loading bot commands");
Log(Logs::General, Logs::Zone_Server, "Loading bot commands");
int botretval = bot_command_init();
if (botretval<0)
Log.Out(Logs::General, Logs::Error, "Bot command loading FAILED");
Log(Logs::General, Logs::Error, "Bot command loading FAILED");
else
Log.Out(Logs::General, Logs::Zone_Server, "%d bot commands loaded", botretval);
Log(Logs::General, Logs::Zone_Server, "%d bot commands loaded", botretval);
Log.Out(Logs::General, Logs::Zone_Server, "Loading bot spell casting chances");
Log(Logs::General, Logs::Zone_Server, "Loading bot spell casting chances");
if (!botdb.LoadBotSpellCastingChances())
Log.Out(Logs::General, Logs::Error, "Bot spell casting chances loading FAILED");
Log(Logs::General, Logs::Error, "Bot spell casting chances loading FAILED");
#endif
if(RuleB(TaskSystem, EnableTaskSystem)) {
Log.Out(Logs::General, Logs::Tasks, "[INIT] Loading Tasks");
if (RuleB(TaskSystem, EnableTaskSystem)) {
Log(Logs::General, Logs::Tasks, "[INIT] Loading Tasks");
taskmanager = new TaskManager;
taskmanager->LoadTasks();
}
@@ -399,7 +405,7 @@ int main(int argc, char** argv) {
#endif
//now we have our parser, load the quests
Log.Out(Logs::General, Logs::Zone_Server, "Loading quests");
Log(Logs::General, Logs::Zone_Server, "Loading quests");
parse->ReloadQuests();
worldserver.Connect();
@@ -407,14 +413,15 @@ int main(int argc, char** argv) {
Timer InterserverTimer(INTERSERVER_TIMER); // does MySQL pings and auto-reconnect
#ifdef EQPROFILE
#ifdef PROFILE_DUMP_TIME
Timer profile_dump_timer(PROFILE_DUMP_TIME*1000);
Timer profile_dump_timer(PROFILE_DUMP_TIME * 1000);
profile_dump_timer.Start();
#endif
#endif
if (!strlen(zone_name) || !strcmp(zone_name,".")) {
Log.Out(Logs::General, Logs::Zone_Server, "Entering sleep mode");
} else if (!Zone::Bootup(database.GetZoneID(zone_name), instance_id, true)) {
Log.Out(Logs::General, Logs::Error, "Zone Bootup failed :: Zone::Bootup");
if (!strlen(zone_name) || !strcmp(zone_name, ".")) {
Log(Logs::General, Logs::Zone_Server, "Entering sleep mode");
}
else if (!Zone::Bootup(database.GetZoneID(zone_name), instance_id, true)) {
Log(Logs::General, Logs::Error, "Zone Bootup failed :: Zone::Bootup");
zone = 0;
}
@@ -423,7 +430,7 @@ int main(int argc, char** argv) {
RegisterAllPatches(stream_identifier);
#ifndef WIN32
Log.Out(Logs::Detail, Logs::None, "Main thread running with thread id %d", pthread_self());
Log(Logs::Detail, Logs::None, "Main thread running with thread id %d", pthread_self());
#endif
Timer quest_timers(100);
@@ -436,94 +443,94 @@ int main(int argc, char** argv) {
std::chrono::time_point<std::chrono::system_clock> frame_prev = std::chrono::system_clock::now();
EQ::Timer process_timer(32, true, [&](EQ::Timer* t) {
//Advance the timer to our current point in time
Timer::SetCurrentTime();
//Advance the timer to our current point in time
Timer::SetCurrentTime();
//Calculate frame time
std::chrono::time_point<std::chrono::system_clock> frame_now = std::chrono::system_clock::now();
frame_time = std::chrono::duration_cast<std::chrono::milliseconds>(frame_now - frame_prev).count();
frame_prev = frame_now;
if (!eqsf_open && Config->ZonePort != 0) {
Log.Out(Logs::General, Logs::Zone_Server, "Starting EQ Network server on port %d", Config->ZonePort);
EQ::Net::EQStreamManagerOptions opts(Config->ZonePort, false, false);
eqsm.reset(new EQ::Net::EQStreamManager(opts));
eqsf_open = true;
eqsm->OnNewConnection([&stream_identifier](std::shared_ptr<EQ::Net::EQStream> stream) {
stream_identifier.AddStream(stream);
Log.OutF(Logs::Detail, Logs::World_Server, "New connection from IP {0}:{1}", stream->RemoteEndpoint(), ntohs(stream->GetRemotePort()));
});
}
//give the stream identifier a chance to do its work....
stream_identifier.Process();
//check the stream identifier for any now-identified streams
while((eqsi = stream_identifier.PopIdentified())) {
//now that we know what patch they are running, start up their client object
struct in_addr in;
in.s_addr = eqsi->GetRemoteIP();
Log.Out(Logs::Detail, Logs::World_Server, "New client from %s:%d", inet_ntoa(in), ntohs(eqsi->GetRemotePort()));
auto client = new Client(eqsi);
entity_list.AddClient(client);
}
if (worldserver.Connected()) {
worldwasconnected = true;
}
else {
if (worldwasconnected && is_zone_loaded)
entity_list.ChannelMessageFromWorld(0, 0, 6, 0, 0, "WARNING: World server connection lost");
worldwasconnected = false;
}
if (is_zone_loaded) {
{
if(net.group_timer.Enabled() && net.group_timer.Check())
entity_list.GroupProcess();
if(net.door_timer.Enabled() && net.door_timer.Check())
entity_list.DoorProcess();
if(net.object_timer.Enabled() && net.object_timer.Check())
entity_list.ObjectProcess();
if(net.corpse_timer.Enabled() && net.corpse_timer.Check())
entity_list.CorpseProcess();
if(net.trap_timer.Enabled() && net.trap_timer.Check())
entity_list.TrapProcess();
if(net.raid_timer.Enabled() && net.raid_timer.Check())
entity_list.RaidProcess();
entity_list.Process();
entity_list.MobProcess();
entity_list.BeaconProcess();
entity_list.EncounterProcess();
if (zone) {
if(!zone->Process()) {
Zone::Shutdown();
}
//Calculate frame time
std::chrono::time_point<std::chrono::system_clock> frame_now = std::chrono::system_clock::now();
frame_time = std::chrono::duration_cast<std::chrono::milliseconds>(frame_now - frame_prev).count();
frame_prev = frame_now;
if (!eqsf_open && Config->ZonePort != 0) {
Log(Logs::General, Logs::Zone_Server, "Starting EQ Network server on port %d", Config->ZonePort);
EQ::Net::EQStreamManagerOptions opts(Config->ZonePort, false, true);
eqsm.reset(new EQ::Net::EQStreamManager(opts));
eqsf_open = true;
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->RemoteEndpoint(), ntohs(stream->GetRemotePort()));
});
}
//give the stream identifier a chance to do its work....
stream_identifier.Process();
//check the stream identifier for any now-identified streams
while ((eqsi = stream_identifier.PopIdentified())) {
//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()));
auto client = new Client(eqsi);
entity_list.AddClient(client);
}
if (worldserver.Connected()) {
worldwasconnected = true;
}
else {
if (worldwasconnected && is_zone_loaded)
entity_list.ChannelMessageFromWorld(0, 0, 6, 0, 0, "WARNING: World server connection lost");
worldwasconnected = false;
}
if (is_zone_loaded) {
{
if (net.group_timer.Enabled() && net.group_timer.Check())
entity_list.GroupProcess();
if (net.door_timer.Enabled() && net.door_timer.Check())
entity_list.DoorProcess();
if (net.object_timer.Enabled() && net.object_timer.Check())
entity_list.ObjectProcess();
if (net.corpse_timer.Enabled() && net.corpse_timer.Check())
entity_list.CorpseProcess();
if (net.trap_timer.Enabled() && net.trap_timer.Check())
entity_list.TrapProcess();
if (net.raid_timer.Enabled() && net.raid_timer.Check())
entity_list.RaidProcess();
entity_list.Process();
entity_list.MobProcess();
entity_list.BeaconProcess();
entity_list.EncounterProcess();
if (zone) {
if (!zone->Process()) {
Zone::Shutdown();
}
if(quest_timers.Check())
quest_manager.Process();
}
}
if (InterserverTimer.Check()) {
InterserverTimer.Start();
database.ping();
entity_list.UpdateWho();
if (quest_timers.Check())
quest_manager.Process();
}
}
if (InterserverTimer.Check()) {
InterserverTimer.Start();
database.ping();
entity_list.UpdateWho();
}
});
while(RunLoops) {
while (RunLoops) {
EQ::EventLoop::Get().Process();
if (is_zone_loaded) {
Sleep(1);
@@ -539,7 +546,7 @@ int main(int argc, char** argv) {
parse->ClearInterfaces();
#ifdef EMBPERL
safe_delete(perl_parser);
safe_delete(perl_parser);
#endif
#ifdef LUA_EQEMU
@@ -557,14 +564,14 @@ int main(int argc, char** argv) {
bot_command_deinit();
#endif
safe_delete(parse);
Log.Out(Logs::General, Logs::Zone_Server, "Proper zone shutdown complete.");
Log.CloseFileLogs();
Log(Logs::General, Logs::Zone_Server, "Proper zone shutdown complete.");
LogSys.CloseFileLogs();
return 0;
}
void CatchSignal(int sig_num) {
#ifdef _WINDOWS
Log.Out(Logs::General, Logs::Zone_Server, "Recieved signal: %i", sig_num);
Log(Logs::General, Logs::Zone_Server, "Recieved signal: %i", sig_num);
#endif
RunLoops = false;
}
@@ -573,13 +580,13 @@ void Shutdown()
{
Zone::Shutdown(true);
RunLoops = false;
Log.Out(Logs::General, Logs::Zone_Server, "Shutting down...");
Log.CloseFileLogs();
Log(Logs::General, Logs::Zone_Server, "Shutting down...");
LogSys.CloseFileLogs();
}
uint32 NetConnection::GetIP()
{
char name[255+1];
char name[255 + 1];
size_t len = 0;
hostent* host = 0;
@@ -612,7 +619,7 @@ uint32 NetConnection::GetIP(char* name)
}
NetConnection::NetConnection()
:
:
object_timer(5000),
door_timer(5000),
corpse_timer(2000),
@@ -640,20 +647,20 @@ void UpdateWindowTitle(char* iNewTitle) {
}
else {
if (zone) {
#if defined(GOTFRAGS) || defined(_EQDEBUG)
snprintf(tmp, sizeof(tmp), "%i: %s, %i clients, %i", ZoneConfig::get()->ZonePort, zone->GetShortName(), numclients, getpid());
#else
#if defined(GOTFRAGS) || defined(_EQDEBUG)
snprintf(tmp, sizeof(tmp), "%i: %s, %i clients, %i", ZoneConfig::get()->ZonePort, zone->GetShortName(), numclients, getpid());
#else
snprintf(tmp, sizeof(tmp), "%s :: clients: %i inst_id: %i inst_ver: %i :: port: %i", zone->GetShortName(), numclients, zone->GetInstanceID(), zone->GetInstanceVersion(), ZoneConfig::get()->ZonePort);
#endif
#endif
}
else {
#if defined(GOTFRAGS) || defined(_EQDEBUG)
snprintf(tmp, sizeof(tmp), "%i: sleeping, %i", ZoneConfig::get()->ZonePort, getpid());
#else
snprintf(tmp, sizeof(tmp), "%i: sleeping", ZoneConfig::get()->ZonePort);
#endif
#if defined(GOTFRAGS) || defined(_EQDEBUG)
snprintf(tmp, sizeof(tmp), "%i: sleeping, %i", ZoneConfig::get()->ZonePort, getpid());
#else
snprintf(tmp, sizeof(tmp), "%i: sleeping", ZoneConfig::get()->ZonePort);
#endif
}
}
SetConsoleTitle(tmp);
#endif
}
}
+36 -31
View File
@@ -529,11 +529,11 @@ void NPC::QueryLoot(Client* to)
int x = 0;
for (auto cur = itemlist.begin(); cur != itemlist.end(); ++cur, ++x) {
if (!(*cur)) {
Log.Out(Logs::General, Logs::Error, "NPC::QueryLoot() - ItemList error, null item");
Log(Logs::General, Logs::Error, "NPC::QueryLoot() - ItemList error, null item");
continue;
}
if (!(*cur)->item_id || !database.GetItem((*cur)->item_id)) {
Log.Out(Logs::General, Logs::Error, "NPC::QueryLoot() - Database error, invalid item");
Log(Logs::General, Logs::Error, "NPC::QueryLoot() - Database error, invalid item");
continue;
}
@@ -587,8 +587,7 @@ void NPC::RemoveCash() {
bool NPC::Process()
{
if (IsStunned() && stunned_timer.Check())
{
if (IsStunned() && stunned_timer.Check()) {
Mob::UnStun();
this->spun_timer.Disable();
}
@@ -608,58 +607,60 @@ bool NPC::Process()
SpellProcess();
if(tic_timer.Check())
{
if (tic_timer.Check()) {
parse->EventNPC(EVENT_TICK, this, nullptr, "", 0);
BuffProcess();
if(currently_fleeing)
if (currently_fleeing)
ProcessFlee();
uint32 bonus = 0;
if(GetAppearance() == eaSitting)
bonus+=3;
if (GetAppearance() == eaSitting)
bonus += 3;
int32 OOCRegen = 0;
if(oocregen > 0){ //should pull from Mob class
if (oocregen > 0) { //should pull from Mob class
OOCRegen += GetMaxHP() * oocregen / 100;
}
}
//Lieka Edit:Fixing NPC regen.NPCs should regen to full during a set duration, not based on their HPs.Increase NPC's HPs by % of total HPs / tick.
if((GetHP() < GetMaxHP()) && !IsPet()) {
if(!IsEngaged()) {//NPC out of combat
if(GetNPCHPRegen() > OOCRegen)
if ((GetHP() < GetMaxHP()) && !IsPet()) {
if (!IsEngaged()) {//NPC out of combat
if (GetNPCHPRegen() > OOCRegen)
SetHP(GetHP() + GetNPCHPRegen());
else
SetHP(GetHP() + OOCRegen);
} else
SetHP(GetHP()+GetNPCHPRegen());
} else if(GetHP() < GetMaxHP() && GetOwnerID() !=0) {
if(!IsEngaged()) //pet
SetHP(GetHP()+GetNPCHPRegen()+bonus+(GetLevel()/5));
}
else
SetHP(GetHP()+GetNPCHPRegen()+bonus);
} else
SetHP(GetHP()+GetNPCHPRegen());
SetHP(GetHP() + GetNPCHPRegen());
}
else if (GetHP() < GetMaxHP() && GetOwnerID() != 0) {
if (!IsEngaged()) //pet
SetHP(GetHP() + GetNPCHPRegen() + bonus + (GetLevel() / 5));
else
SetHP(GetHP() + GetNPCHPRegen() + bonus);
}
else
SetHP(GetHP() + GetNPCHPRegen());
if(GetMana() < GetMaxMana()) {
SetMana(GetMana()+mana_regen+bonus);
if (GetMana() < GetMaxMana()) {
SetMana(GetMana() + mana_regen + bonus);
}
if(zone->adv_data && !p_depop)
if (zone->adv_data && !p_depop)
{
ServerZoneAdventureDataReply_Struct* ds = (ServerZoneAdventureDataReply_Struct*)zone->adv_data;
if(ds->type == Adventure_Rescue && ds->data_id == GetNPCTypeID())
if (ds->type == Adventure_Rescue && ds->data_id == GetNPCTypeID())
{
Mob *o = GetOwner();
if(o && o->IsClient())
if (o && o->IsClient())
{
float x_diff = ds->dest_x - GetX();
float y_diff = ds->dest_y - GetY();
float z_diff = ds->dest_z - GetZ();
float dist = ((x_diff * x_diff) + (y_diff * y_diff) + (z_diff * z_diff));
if(dist < RuleR(Adventure, DistanceForRescueComplete))
if (dist < RuleR(Adventure, DistanceForRescueComplete))
{
zone->DoAdventureCountIncrease();
Say("You don't know what this means to me. Thank you so much for finding and saving me from"
@@ -693,8 +694,6 @@ bool NPC::Process()
viral_timer_counter = 0;
}
ProjectileAttack();
if(spellbonuses.GravityEffect == 1) {
if(gravity_timer.Check())
DoGravityEffect();
@@ -717,6 +716,11 @@ bool NPC::Process()
if (enraged_timer.Check()){
ProcessEnrage();
/* Don't keep running the check every second if we don't have enrage */
if (!GetSpecialAbility(SPECATK_ENRAGE)) {
enraged_timer.Disable();
}
}
//Handle assists...
@@ -1710,7 +1714,7 @@ void Mob::NPCSpecialAttacks(const char* parse, int permtag, bool reset, bool rem
{
if(database.SetSpecialAttkFlag(this->GetNPCTypeID(), orig_parse))
{
Log.Out(Logs::General, Logs::Normal, "NPCTypeID: %i flagged to '%s' for Special Attacks.\n",this->GetNPCTypeID(),orig_parse);
Log(Logs::General, Logs::Normal, "NPCTypeID: %i flagged to '%s' for Special Attacks.\n",this->GetNPCTypeID(),orig_parse);
}
}
}
@@ -2557,6 +2561,7 @@ void NPC::ClearLastName()
void NPC::DepopSwarmPets()
{
if (GetSwarmInfo()) {
if (GetSwarmInfo()->duration->Check(false)){
Mob* owner = entity_list.GetMobID(GetSwarmInfo()->owner_id);
+4 -4
View File
@@ -85,7 +85,7 @@ struct AISpellsVar_Struct {
uint8 idle_beneficial_chance;
};
class AA_SwarmPetInfo;
class SwarmPet;
class Client;
class Group;
class Raid;
@@ -330,8 +330,8 @@ public:
QGlobalCache *GetQGlobals() { return qGlobals; }
QGlobalCache *CreateQGlobals() { qGlobals = new QGlobalCache(); return qGlobals; }
AA_SwarmPetInfo *GetSwarmInfo() { return (swarmInfoPtr); }
void SetSwarmInfo(AA_SwarmPetInfo *mSwarmInfo) { swarmInfoPtr = mSwarmInfo; }
SwarmPet *GetSwarmInfo() { return (swarmInfoPtr); }
void SetSwarmInfo(SwarmPet *mSwarmInfo) { swarmInfoPtr = mSwarmInfo; }
int32 GetAccuracyRating() const { return (accuracy_rating); }
void SetAccuracyRating(int32 d) { accuracy_rating = d;}
@@ -515,7 +515,7 @@ protected:
uint8 sec_melee_type; //Sets the Secondary Weapon attack message and animation
uint8 ranged_type; //Sets the Ranged Weapon attack message and animation
AA_SwarmPetInfo *swarmInfoPtr;
SwarmPet *swarmInfoPtr;
bool ldon_trapped;
uint8 ldon_trap_type;
+5 -5
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.Out(Logs::General, Logs::Error, "Object::PutItem: Invalid index specified (%i)", index);
Log(Logs::General, Logs::Error, "Object::PutItem: Invalid index specified (%i)", index);
return;
}
@@ -465,7 +465,7 @@ void Object::RandomSpawn(bool send_packet) {
}
}
Log.Out(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);
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);
respawn_timer.Disable();
@@ -643,7 +643,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.Out(Logs::General, Logs::Error, "Unable to insert object: %s", results.ErrorMessage().c_str());
Log(Logs::General, Logs::Error, "Unable to insert object: %s", results.ErrorMessage().c_str());
return 0;
}
@@ -682,7 +682,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.Out(Logs::General, Logs::Error, "Unable to update object: %s", results.ErrorMessage().c_str());
Log(Logs::General, Logs::Error, "Unable to update object: %s", results.ErrorMessage().c_str());
return;
}
@@ -726,7 +726,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.Out(Logs::General, Logs::Error, "Unable to delete object: %s", results.ErrorMessage().c_str());
Log(Logs::General, Logs::Error, "Unable to delete object: %s", results.ErrorMessage().c_str());
}
}
+73 -73
View File
@@ -60,19 +60,19 @@ PathManager* PathManager::LoadPathFile(const char* ZoneName)
if(Ret->loadPaths(PathFile))
{
Log.Out(Logs::General, Logs::Status, "Path File %s loaded.", ZonePathFileName);
Log(Logs::General, Logs::Status, "Path File %s loaded.", ZonePathFileName);
}
else
{
Log.Out(Logs::General, Logs::Error, "Path File %s failed to load.", ZonePathFileName);
Log(Logs::General, Logs::Error, "Path File %s failed to load.", ZonePathFileName);
safe_delete(Ret);
}
fclose(PathFile);
}
else
{
Log.Out(Logs::General, Logs::Error, "Path File %s not found.", ZonePathFileName);
Log(Logs::General, Logs::Error, "Path File %s not found.", ZonePathFileName);
}
return Ret;
@@ -102,18 +102,18 @@ bool PathManager::loadPaths(FILE *PathFile)
if(strncmp(Magic, "EQEMUPATH", 9))
{
Log.Out(Logs::General, Logs::Error, "Bad Magic String in .path file.");
Log(Logs::General, Logs::Error, "Bad Magic String in .path file.");
return false;
}
fread(&Head, sizeof(Head), 1, PathFile);
Log.Out(Logs::General, Logs::Status, "Path File Header: Version %ld, PathNodes %ld",
Log(Logs::General, Logs::Status, "Path File Header: Version %ld, PathNodes %ld",
(long)Head.version, (long)Head.PathNodeCount);
if(Head.version != 2)
{
Log.Out(Logs::General, Logs::Error, "Unsupported path file version.");
Log(Logs::General, Logs::Error, "Unsupported path file version.");
return false;
}
@@ -137,7 +137,7 @@ bool PathManager::loadPaths(FILE *PathFile)
{
if(PathNodes[i].Neighbours[j].id > MaxNodeID)
{
Log.Out(Logs::General, Logs::Error, "Path Node %i, Neighbour %i (%i) out of range.", i, j, PathNodes[i].Neighbours[j].id);
Log(Logs::General, Logs::Error, "Path Node %i, Neighbour %i (%i) out of range.", i, j, PathNodes[i].Neighbours[j].id);
PathFileValid = false;
}
@@ -206,7 +206,7 @@ glm::vec3 PathManager::GetPathNodeCoordinates(int NodeNumber, bool BestZ)
std::deque<int> PathManager::FindRoute(int startID, int endID)
{
Log.Out(Logs::Detail, Logs::None, "FindRoute from node %i to %i", startID, endID);
Log(Logs::Detail, Logs::None, "FindRoute from node %i to %i", startID, endID);
memset(ClosedListFlag, 0, sizeof(int) * Head.PathNodeCount);
@@ -329,7 +329,7 @@ std::deque<int> PathManager::FindRoute(int startID, int endID)
}
}
Log.Out(Logs::Detail, Logs::None, "Unable to find a route.");
Log(Logs::Detail, Logs::None, "Unable to find a route.");
return Route;
}
@@ -351,7 +351,7 @@ auto path_compare = [](const PathNodeSortStruct& a, const PathNodeSortStruct& b)
std::deque<int> PathManager::FindRoute(glm::vec3 Start, glm::vec3 End)
{
Log.Out(Logs::Detail, Logs::None, "FindRoute(%8.3f, %8.3f, %8.3f, %8.3f, %8.3f, %8.3f)", Start.x, Start.y, Start.z, End.x, End.y, End.z);
Log(Logs::Detail, Logs::None, "FindRoute(%8.3f, %8.3f, %8.3f, %8.3f, %8.3f, %8.3f)", Start.x, Start.y, Start.z, End.x, End.y, End.z);
std::deque<int> noderoute;
@@ -384,7 +384,7 @@ std::deque<int> PathManager::FindRoute(glm::vec3 Start, glm::vec3 End)
for(auto Iterator = SortedByDistance.begin(); Iterator != SortedByDistance.end(); ++Iterator)
{
Log.Out(Logs::Detail, Logs::None, "Checking Reachability of Node %i from Start Position.", PathNodes[(*Iterator).id].id);
Log(Logs::Detail, Logs::None, "Checking Reachability of Node %i from Start Position.", PathNodes[(*Iterator).id].id);
if(!zone->zonemap->LineIntersectsZone(Start, PathNodes[(*Iterator).id].v, 1.0f, nullptr))
{
@@ -394,11 +394,11 @@ std::deque<int> PathManager::FindRoute(glm::vec3 Start, glm::vec3 End)
}
if(ClosestPathNodeToStart <0 ) {
Log.Out(Logs::Detail, Logs::None, "No LOS to any starting Path Node within range.");
Log(Logs::Detail, Logs::None, "No LOS to any starting Path Node within range.");
return noderoute;
}
Log.Out(Logs::Detail, Logs::None, "Closest Path Node To Start: %2d", ClosestPathNodeToStart);
Log(Logs::Detail, Logs::None, "Closest Path Node To Start: %2d", ClosestPathNodeToStart);
// Find the nearest PathNode the end point has LOS to
@@ -421,8 +421,8 @@ std::deque<int> PathManager::FindRoute(glm::vec3 Start, glm::vec3 End)
for(auto Iterator = SortedByDistance.begin(); Iterator != SortedByDistance.end(); ++Iterator)
{
Log.Out(Logs::Detail, Logs::None, "Checking Reachability of Node %i from End Position.", PathNodes[(*Iterator).id].id);
Log.Out(Logs::Detail, Logs::None, " (%8.3f, %8.3f, %8.3f) to (%8.3f, %8.3f, %8.3f)",
Log(Logs::Detail, Logs::None, "Checking Reachability of Node %i from End Position.", PathNodes[(*Iterator).id].id);
Log(Logs::Detail, Logs::None, " (%8.3f, %8.3f, %8.3f) to (%8.3f, %8.3f, %8.3f)",
End.x, End.y, End.z,
PathNodes[(*Iterator).id].v.x, PathNodes[(*Iterator).id].v.y, PathNodes[(*Iterator).id].v.z);
@@ -434,11 +434,11 @@ std::deque<int> PathManager::FindRoute(glm::vec3 Start, glm::vec3 End)
}
if(ClosestPathNodeToEnd < 0) {
Log.Out(Logs::Detail, Logs::None, "No LOS to any end Path Node within range.");
Log(Logs::Detail, Logs::None, "No LOS to any end Path Node within range.");
return noderoute;
}
Log.Out(Logs::Detail, Logs::None, "Closest Path Node To End: %2d", ClosestPathNodeToEnd);
Log(Logs::Detail, Logs::None, "Closest Path Node To End: %2d", ClosestPathNodeToEnd);
if(ClosestPathNodeToStart == ClosestPathNodeToEnd)
{
@@ -673,7 +673,7 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
if(To == From)
return To;
Log.Out(Logs::Detail, Logs::None, "UpdatePath. From(%8.3f, %8.3f, %8.3f) To(%8.3f, %8.3f, %8.3f)", From.x, From.y, From.z, To.x, To.y, To.z);
Log(Logs::Detail, Logs::None, "UpdatePath. From(%8.3f, %8.3f, %8.3f) To(%8.3f, %8.3f, %8.3f)", From.x, From.y, From.z, To.x, To.y, To.z);
if(From == PathingLastPosition)
{
@@ -681,7 +681,7 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
if((PathingLoopCount > 5) && !IsRooted())
{
Log.Out(Logs::Detail, Logs::None, "appears to be stuck. Teleporting them to next position.", GetName());
Log(Logs::Detail, Logs::None, "appears to be stuck. Teleporting them to next position.", GetName());
if(Route.empty())
{
@@ -721,7 +721,7 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
// If we are already pathing, and the destination is the same as before ...
if(SameDestination)
{
Log.Out(Logs::Detail, Logs::None, " Still pathing to the same destination.");
Log(Logs::Detail, Logs::None, " Still pathing to the same destination.");
// Get the coordinates of the first path node we are going to.
NextNode = Route.front();
@@ -732,7 +732,7 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
// We have reached the path node.
if(NodeLoc == From)
{
Log.Out(Logs::Detail, Logs::None, " Arrived at node %i", NextNode);
Log(Logs::Detail, Logs::None, " Arrived at node %i", NextNode);
NodeReached = true;
@@ -746,17 +746,17 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
// target, and we may run past the target if we don't check LOS at this point.
int RouteSize = Route.size();
Log.Out(Logs::Detail, Logs::None, "Route size is %i", RouteSize);
Log(Logs::Detail, Logs::None, "Route size is %i", RouteSize);
if((RouteSize == 2)
|| ((PathingTraversedNodes >= RuleI(Pathing, MinNodesTraversedForLOSCheck))
&& (RouteSize <= RuleI(Pathing, MinNodesLeftForLOSCheck))
&& PathingLOSCheckTimer->Check()))
{
Log.Out(Logs::Detail, Logs::None, " Checking distance to target.");
Log(Logs::Detail, Logs::None, " Checking distance to target.");
float Distance = VectorDistanceNoRoot(From, To);
Log.Out(Logs::Detail, Logs::None, " Distance between From and To (NoRoot) is %8.3f", Distance);
Log(Logs::Detail, Logs::None, " Distance between From and To (NoRoot) is %8.3f", Distance);
if ((Distance <= RuleR(Pathing, MinDistanceForLOSCheckShort)) &&
(std::abs(From.z - To.z) <= RuleR(Pathing, ZDiffThreshold))) {
@@ -764,18 +764,18 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
PathingLOSState = HaveLOS;
else
PathingLOSState = NoLOS;
Log.Out(Logs::Detail, Logs::None, "NoLOS");
Log(Logs::Detail, Logs::None, "NoLOS");
if((PathingLOSState == HaveLOS) && zone->pathing->NoHazards(From, To))
{
Log.Out(Logs::Detail, Logs::None, " No hazards. Running directly to target.");
Log(Logs::Detail, Logs::None, " No hazards. Running directly to target.");
Route.clear();
return To;
}
else
{
Log.Out(Logs::Detail, Logs::None, " Continuing on node path.");
Log(Logs::Detail, Logs::None, " Continuing on node path.");
}
}
else
@@ -801,7 +801,7 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
if(Route.empty())
{
Log.Out(Logs::Detail, Logs::None, "Missing node after teleport.");
Log(Logs::Detail, Logs::None, "Missing node after teleport.");
return To;
}
@@ -811,7 +811,7 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
Teleport(NodeLoc);
Log.Out(Logs::Detail, Logs::None, " TELEPORTED to %8.3f, %8.3f, %8.3f\n", NodeLoc.x, NodeLoc.y, NodeLoc.z);
Log(Logs::Detail, Logs::None, " TELEPORTED to %8.3f, %8.3f, %8.3f\n", NodeLoc.x, NodeLoc.y, NodeLoc.z);
Route.pop_front();
@@ -822,7 +822,7 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
}
zone->pathing->OpenDoors(PathingLastNodeVisited, NextNode, this);
Log.Out(Logs::Detail, Logs::None, " Now moving to node %i", NextNode);
Log(Logs::Detail, Logs::None, " Now moving to node %i", NextNode);
return zone->pathing->GetPathNodeCoordinates(NextNode);
}
@@ -830,7 +830,7 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
{
// we have run all the nodes, all that is left is the direct path from the last node
// to the destination
Log.Out(Logs::Detail, Logs::None, " Reached end of node path, running direct to target.");
Log(Logs::Detail, Logs::None, " Reached end of node path, running direct to target.");
return To;
}
@@ -844,11 +844,11 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
&& (RouteSize <= RuleI(Pathing, MinNodesLeftForLOSCheck))
&& PathingLOSCheckTimer->Check())
{
Log.Out(Logs::Detail, Logs::None, " Checking distance to target.");
Log(Logs::Detail, Logs::None, " Checking distance to target.");
float Distance = VectorDistanceNoRoot(From, To);
Log.Out(Logs::Detail, Logs::None, " Distance between From and To (NoRoot) is %8.3f", Distance);
Log(Logs::Detail, Logs::None, " Distance between From and To (NoRoot) is %8.3f", Distance);
if ((Distance <= RuleR(Pathing, MinDistanceForLOSCheckShort)) &&
(std::abs(From.z - To.z) <= RuleR(Pathing, ZDiffThreshold))) {
@@ -856,18 +856,18 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
PathingLOSState = HaveLOS;
else
PathingLOSState = NoLOS;
Log.Out(Logs::Detail, Logs::None, "NoLOS");
Log(Logs::Detail, Logs::None, "NoLOS");
if((PathingLOSState == HaveLOS) && zone->pathing->NoHazards(From, To))
{
Log.Out(Logs::Detail, Logs::None, " No hazards. Running directly to target.");
Log(Logs::Detail, Logs::None, " No hazards. Running directly to target.");
Route.clear();
return To;
}
else
{
Log.Out(Logs::Detail, Logs::None, " Continuing on node path.");
Log(Logs::Detail, Logs::None, " Continuing on node path.");
}
}
else
@@ -879,7 +879,7 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
{
// We get here if we were already pathing, but our destination has now changed.
//
Log.Out(Logs::Detail, Logs::None, " Target has changed position.");
Log(Logs::Detail, Logs::None, " Target has changed position.");
// Update our record of where we are going to.
PathingDestination = To;
// Check if we now have LOS etc to the new destination.
@@ -889,23 +889,23 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
if ((Distance <= RuleR(Pathing, MinDistanceForLOSCheckShort)) &&
(std::abs(From.z - To.z) <= RuleR(Pathing, ZDiffThreshold))) {
Log.Out(Logs::Detail, Logs::None, " Checking for short LOS at distance %8.3f.", Distance);
Log(Logs::Detail, Logs::None, " Checking for short LOS at distance %8.3f.", Distance);
if(!zone->zonemap->LineIntersectsZone(HeadPosition, To, 1.0f, nullptr))
PathingLOSState = HaveLOS;
else
PathingLOSState = NoLOS;
Log.Out(Logs::Detail, Logs::None, "NoLOS");
Log(Logs::Detail, Logs::None, "NoLOS");
if((PathingLOSState == HaveLOS) && zone->pathing->NoHazards(From, To))
{
Log.Out(Logs::Detail, Logs::None, " No hazards. Running directly to target.");
Log(Logs::Detail, Logs::None, " No hazards. Running directly to target.");
Route.clear();
return To;
}
else
{
Log.Out(Logs::Detail, Logs::None, " Continuing on node path.");
Log(Logs::Detail, Logs::None, " Continuing on node path.");
}
}
}
@@ -916,19 +916,19 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
{
if(!PathingRouteUpdateTimerShort->Check())
{
Log.Out(Logs::Detail, Logs::None, "Short route update timer not yet expired.");
Log(Logs::Detail, Logs::None, "Short route update timer not yet expired.");
return zone->pathing->GetPathNodeCoordinates(Route.front());
}
Log.Out(Logs::Detail, Logs::None, "Short route update timer expired.");
Log(Logs::Detail, Logs::None, "Short route update timer expired.");
}
else
{
if(!PathingRouteUpdateTimerLong->Check())
{
Log.Out(Logs::Detail, Logs::None, "Long route update timer not yet expired.");
Log(Logs::Detail, Logs::None, "Long route update timer not yet expired.");
return zone->pathing->GetPathNodeCoordinates(Route.front());
}
Log.Out(Logs::Detail, Logs::None, "Long route update timer expired.");
Log(Logs::Detail, Logs::None, "Long route update timer expired.");
}
// We are already pathing, destination changed, no LOS. Find the nearest node to our destination.
@@ -937,7 +937,7 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
// Destination unreachable via pathing, return direct route.
if(DestinationPathNode == -1)
{
Log.Out(Logs::Detail, Logs::None, " Unable to find path node for new destination. Running straight to target.");
Log(Logs::Detail, Logs::None, " Unable to find path node for new destination. Running straight to target.");
Route.clear();
return To;
}
@@ -945,7 +945,7 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
// one, we will carry on on our path.
if(DestinationPathNode == Route.back())
{
Log.Out(Logs::Detail, Logs::None, " Same destination Node (%i). Continue with current path.", DestinationPathNode);
Log(Logs::Detail, Logs::None, " Same destination Node (%i). Continue with current path.", DestinationPathNode);
NodeLoc = zone->pathing->GetPathNodeCoordinates(Route.front());
@@ -953,7 +953,7 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
// Check if we have reached a path node.
if(NodeLoc == From)
{
Log.Out(Logs::Detail, Logs::None, " Arrived at node %i, moving to next one.\n", Route.front());
Log(Logs::Detail, Logs::None, " Arrived at node %i, moving to next one.\n", Route.front());
NodeReached = true;
@@ -976,7 +976,7 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
if(Route.empty())
{
Log.Out(Logs::Detail, Logs::None, "Missing node after teleport.");
Log(Logs::Detail, Logs::None, "Missing node after teleport.");
return To;
}
@@ -986,7 +986,7 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
Teleport(NodeLoc);
Log.Out(Logs::Detail, Logs::None, " TELEPORTED to %8.3f, %8.3f, %8.3f\n", NodeLoc.x, NodeLoc.y, NodeLoc.z);
Log(Logs::Detail, Logs::None, " TELEPORTED to %8.3f, %8.3f, %8.3f\n", NodeLoc.x, NodeLoc.y, NodeLoc.z);
Route.pop_front();
@@ -996,7 +996,7 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
NextNode = Route.front();
}
// Return the coords of our next path node on the route.
Log.Out(Logs::Detail, Logs::None, " Now moving to node %i", NextNode);
Log(Logs::Detail, Logs::None, " Now moving to node %i", NextNode);
zone->pathing->OpenDoors(PathingLastNodeVisited, NextNode, this);
@@ -1004,7 +1004,7 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
}
else
{
Log.Out(Logs::Detail, Logs::None, " Reached end of path grid. Running direct to target.");
Log(Logs::Detail, Logs::None, " Reached end of path grid. Running direct to target.");
return To;
}
}
@@ -1012,7 +1012,7 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
}
else
{
Log.Out(Logs::Detail, Logs::None, " Target moved. End node is different. Clearing route.");
Log(Logs::Detail, Logs::None, " Target moved. End node is different. Clearing route.");
Route.clear();
// We will now fall through to get a new route.
@@ -1022,11 +1022,11 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
}
Log.Out(Logs::Detail, Logs::None, " Our route list is empty.");
Log(Logs::Detail, Logs::None, " Our route list is empty.");
if((SameDestination) && !PathingLOSCheckTimer->Check())
{
Log.Out(Logs::Detail, Logs::None, " Destination same as before, LOS check timer not reached. Returning To.");
Log(Logs::Detail, Logs::None, " Destination same as before, LOS check timer not reached. Returning To.");
return To;
}
@@ -1040,22 +1040,22 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
if ((Distance <= RuleR(Pathing, MinDistanceForLOSCheckLong)) &&
(std::abs(From.z - To.z) <= RuleR(Pathing, ZDiffThreshold))) {
Log.Out(Logs::Detail, Logs::None, " Checking for long LOS at distance %8.3f.", Distance);
Log(Logs::Detail, Logs::None, " Checking for long LOS at distance %8.3f.", Distance);
if(!zone->zonemap->LineIntersectsZone(HeadPosition, To, 1.0f, nullptr))
PathingLOSState = HaveLOS;
else
PathingLOSState = NoLOS;
Log.Out(Logs::Detail, Logs::None, "NoLOS");
Log(Logs::Detail, Logs::None, "NoLOS");
if((PathingLOSState == HaveLOS) && zone->pathing->NoHazards(From, To))
{
Log.Out(Logs::Detail, Logs::None, "Target is reachable. Running directly there.");
Log(Logs::Detail, Logs::None, "Target is reachable. Running directly there.");
return To;
}
}
Log.Out(Logs::Detail, Logs::None, " Calculating new route to target.");
Log(Logs::Detail, Logs::None, " Calculating new route to target.");
Route = zone->pathing->FindRoute(From, To);
@@ -1063,14 +1063,14 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
if(Route.empty())
{
Log.Out(Logs::Detail, Logs::None, " No route available, running direct.");
Log(Logs::Detail, Logs::None, " No route available, running direct.");
return To;
}
if(SameDestination && (Route.front() == PathingLastNodeVisited))
{
Log.Out(Logs::Detail, Logs::None, " Probable loop detected. Same destination and Route.front() == PathingLastNodeVisited.");
Log(Logs::Detail, Logs::None, " Probable loop detected. Same destination and Route.front() == PathingLastNodeVisited.");
Route.clear();
@@ -1078,7 +1078,7 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
}
NodeLoc = zone->pathing->GetPathNodeCoordinates(Route.front());
Log.Out(Logs::Detail, Logs::None, " New route determined, heading for node %i", Route.front());
Log(Logs::Detail, Logs::None, " New route determined, heading for node %i", Route.front());
PathingLoopCount = 0;
@@ -1119,7 +1119,7 @@ int PathManager::FindNearestPathNode(glm::vec3 Position)
for(auto Iterator = SortedByDistance.begin(); Iterator != SortedByDistance.end(); ++Iterator)
{
Log.Out(Logs::Detail, Logs::None, "Checking Reachability of Node %i from Start Position.", PathNodes[(*Iterator).id].id);
Log(Logs::Detail, Logs::None, "Checking Reachability of Node %i from Start Position.", PathNodes[(*Iterator).id].id);
if(!zone->zonemap->LineIntersectsZone(Position, PathNodes[(*Iterator).id].v, 1.0f, nullptr))
{
@@ -1129,7 +1129,7 @@ int PathManager::FindNearestPathNode(glm::vec3 Position)
}
if(ClosestPathNodeToStart <0 ) {
Log.Out(Logs::Detail, Logs::None, "No LOS to any starting Path Node within range.");
Log(Logs::Detail, Logs::None, "No LOS to any starting Path Node within range.");
return -1;
}
return ClosestPathNodeToStart;
@@ -1144,14 +1144,14 @@ bool PathManager::NoHazards(glm::vec3 From, glm::vec3 To)
float NewZ = zone->zonemap->FindBestZ(MidPoint, nullptr);
if (std::abs(NewZ - From.z) > RuleR(Pathing, ZDiffThreshold)) {
Log.Out(Logs::Detail, Logs::None, " HAZARD DETECTED moving from %8.3f, %8.3f, %8.3f to %8.3f, %8.3f, %8.3f. Z Change is %8.3f",
Log(Logs::Detail, Logs::None, " HAZARD DETECTED moving from %8.3f, %8.3f, %8.3f to %8.3f, %8.3f, %8.3f. Z Change is %8.3f",
From.x, From.y, From.z, MidPoint.x, MidPoint.y, MidPoint.z, NewZ - From.z);
return false;
}
else
{
Log.Out(Logs::Detail, Logs::None, "No HAZARD DETECTED moving from %8.3f, %8.3f, %8.3f to %8.3f, %8.3f, %8.3f. Z Change is %8.3f",
Log(Logs::Detail, Logs::None, "No HAZARD DETECTED moving from %8.3f, %8.3f, %8.3f to %8.3f, %8.3f, %8.3f. Z Change is %8.3f",
From.x, From.y, From.z, MidPoint.x, MidPoint.y, MidPoint.z, NewZ - From.z);
}
@@ -1182,7 +1182,7 @@ bool PathManager::NoHazardsAccurate(glm::vec3 From, glm::vec3 To)
glm::vec3 TestPoint(curx, cury, curz);
float NewZ = zone->zonemap->FindBestZ(TestPoint, nullptr);
if (std::abs(NewZ - last_z) > 5.0f) {
Log.Out(Logs::Detail, Logs::None, " HAZARD DETECTED moving from %8.3f, %8.3f, %8.3f to %8.3f, %8.3f, %8.3f. Best Z %8.3f, Z Change is %8.3f",
Log(Logs::Detail, Logs::None, " HAZARD DETECTED moving from %8.3f, %8.3f, %8.3f to %8.3f, %8.3f, %8.3f. Best Z %8.3f, Z Change is %8.3f",
From.x, From.y, From.z, TestPoint.x, TestPoint.y, TestPoint.z, NewZ, NewZ - From.z);
return false;
}
@@ -1210,20 +1210,20 @@ bool PathManager::NoHazardsAccurate(glm::vec3 From, glm::vec3 To)
}
if (best_z2 == -999990)
{
Log.Out(Logs::Detail, Logs::None, " HAZARD DETECTED, really deep water/lava!");
Log(Logs::Detail, Logs::None, " HAZARD DETECTED, really deep water/lava!");
return false;
}
else
{
if (std::abs(NewZ - best_z2) > RuleR(Pathing, ZDiffThreshold)) {
Log.Out(Logs::Detail, Logs::None,
Log(Logs::Detail, Logs::None,
" HAZARD DETECTED, water is fairly deep at %8.3f units deep",
std::abs(NewZ - best_z2));
return false;
}
else
{
Log.Out(Logs::Detail, Logs::None,
Log(Logs::Detail, Logs::None,
" HAZARD NOT DETECTED, water is shallow at %8.3f units deep",
std::abs(NewZ - best_z2));
}
@@ -1231,12 +1231,12 @@ bool PathManager::NoHazardsAccurate(glm::vec3 From, glm::vec3 To)
}
else
{
Log.Out(Logs::Detail, Logs::None, "Hazard point not in water or lava!");
Log(Logs::Detail, Logs::None, "Hazard point not in water or lava!");
}
}
else
{
Log.Out(Logs::Detail, Logs::None, "No water map loaded for hazards!");
Log(Logs::Detail, Logs::None, "No water map loaded for hazards!");
}
curx += stepx;
@@ -1291,7 +1291,7 @@ void PathManager::OpenDoors(int Node1, int Node2, Mob *ForWho)
if(d && !d->IsDoorOpen() )
{
Log.Out(Logs::Detail, Logs::None, "Opening door %i for %s", PathNodes[Node1].Neighbours[i].DoorID, ForWho->GetName());
Log(Logs::Detail, Logs::None, "Opening door %i for %s", PathNodes[Node1].Neighbours[i].DoorID, ForWho->GetName());
d->ForceOpen(ForWho);
}
+24 -16
View File
@@ -1296,16 +1296,20 @@ XS(XS_Client_MovePC)
THIS->MovePC(zoneID, x, y, z, heading);
}
else {
if (THIS->IsMerc())
Log.Out(Logs::Detail, Logs::None, "[CLIENT] Perl(XS_Client_MovePC) attempted to process a type Merc reference");
else if (THIS->IsNPC())
Log.Out(Logs::Detail, Logs::None, "[CLIENT] Perl(XS_Client_MovePC) attempted to process a type NPC reference");
if (THIS->IsMerc()) {
Log(Logs::Detail, Logs::None, "[CLIENT] Perl(XS_Client_MovePC) attempted to process a type Merc reference");
}
else if (THIS->IsNPC()) {
Log(Logs::Detail, Logs::None, "[CLIENT] Perl(XS_Client_MovePC) attempted to process a type NPC reference");
}
#ifdef BOTS
else if (THIS->IsBot())
Log.Out(Logs::Detail, Logs::None, "[CLIENT] Perl(XS_Client_MovePC) attempted to process a type Bot reference");
else if (THIS->IsBot()) {
Log(Logs::Detail, Logs::None, "[CLIENT] Perl(XS_Client_MovePC) attempted to process a type Bot reference");
}
#endif
else
Log.Out(Logs::Detail, Logs::None, "[CLIENT] Perl(XS_Client_MovePC) attempted to process an Unknown type reference");
else {
Log(Logs::Detail, Logs::None, "[CLIENT] Perl(XS_Client_MovePC) attempted to process an Unknown type reference");
}
Perl_croak(aTHX_ "THIS is not of type Client");
}
@@ -1342,16 +1346,20 @@ XS(XS_Client_MovePCInstance)
THIS->MovePC(zoneID, instanceID, x, y, z, heading);
}
else {
if (THIS->IsMerc())
Log.Out(Logs::Detail, Logs::None, "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type Merc reference");
else if (THIS->IsNPC())
Log.Out(Logs::Detail, Logs::None, "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type NPC reference");
if (THIS->IsMerc()) {
Log(Logs::Detail, Logs::None, "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type Merc reference");
}
else if (THIS->IsNPC()) {
Log(Logs::Detail, Logs::None, "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type NPC reference");
}
#ifdef BOTS
else if (THIS->IsBot())
Log.Out(Logs::Detail, Logs::None, "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type Bot reference");
else if (THIS->IsBot()) {
Log(Logs::Detail, Logs::None, "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type Bot reference");
}
#endif
else
Log.Out(Logs::Detail, Logs::None, "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process an Unknown type reference");
else {
Log(Logs::Detail, Logs::None, "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process an Unknown type reference");
}
Perl_croak(aTHX_ "THIS is not of type Client");
+1 -1
View File
@@ -252,7 +252,7 @@ void ZoneDatabase::InsertPetitionToDB(Petition* wpet)
}
#if EQDEBUG >= 5
Log.Out(Logs::General, Logs::None, "New petition created");
Log(Logs::General, Logs::None, "New petition created");
#endif
}
+4 -4
View File
@@ -251,7 +251,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower,
PetRecord record;
if(!database.GetPoweredPetEntry(pettype, act_power, &record)) {
Message(13, "Unable to find data for pet %s", pettype);
Log.Out(Logs::General, Logs::Error, "Unable to find data for pet %s, check pets table.", pettype);
Log(Logs::General, Logs::Error, "Unable to find data for pet %s, check pets table.", pettype);
return;
}
@@ -259,7 +259,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower,
const NPCType *base = database.LoadNPCTypesData(record.npc_type);
if(base == nullptr) {
Message(13, "Unable to load NPC data for pet %s", pettype);
Log.Out(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);
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);
return;
}
@@ -412,7 +412,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower,
npc_type->helmtexture = monster->helmtexture;
npc_type->herosforgemodel = monster->herosforgemodel;
} else
Log.Out(Logs::General, Logs::Error, "Error loading NPC data for monster summoning pet (NPC ID %d)", monsterid);
Log(Logs::General, Logs::Error, "Error loading NPC data for monster summoning pet (NPC ID %d)", monsterid);
}
@@ -714,7 +714,7 @@ bool ZoneDatabase::GetBasePetItems(int32 equipmentset, uint32 *items) {
if (results.RowCount() != 1) {
// invalid set reference, it doesn't exist
Log.Out(Logs::General, Logs::Error, "Error in GetBasePetItems equipment set '%d' does not exist", curset);
Log(Logs::General, Logs::Error, "Error in GetBasePetItems equipment set '%d' does not exist", curset);
return false;
}
+19 -12
View File
@@ -16,6 +16,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/global_define.h"
#include "../common/misc_functions.h"
#include "../common/features.h"
@@ -186,7 +187,7 @@ bool QuestParserCollection::SpellHasQuestSub(uint32 spell_id, QuestEventID evt)
auto qiter = _interfaces.find(iter->second);
return qiter->second->SpellHasQuestSub(spell_id, evt);
}
} else {
} else if(_spell_quest_status[spell_id] != QuestFailedToLoad){
std::string filename;
QuestInterface *qi = GetQIBySpellQuest(spell_id, filename);
if(qi) {
@@ -263,7 +264,7 @@ int QuestParserCollection::EventNPCLocal(QuestEventID evt, NPC* npc, Mob *init,
auto qiter = _interfaces.find(iter->second);
return qiter->second->EventNPC(evt, npc, init, data, extra_data, extra_pointers);
}
} else {
} else if (_npc_quest_status[npc->GetNPCTypeID()] != QuestFailedToLoad){
std::string filename;
QuestInterface *qi = GetQIByNPCQuest(npc->GetNPCTypeID(), filename);
if(qi) {
@@ -282,7 +283,8 @@ int QuestParserCollection::EventNPCGlobal(QuestEventID evt, NPC* npc, Mob *init,
if(_global_npc_quest_status != QuestUnloaded && _global_npc_quest_status != QuestFailedToLoad) {
auto qiter = _interfaces.find(_global_npc_quest_status);
return qiter->second->EventGlobalNPC(evt, npc, init, data, extra_data, extra_pointers);
} else {
}
else if(_global_npc_quest_status != QuestFailedToLoad){
std::string filename;
QuestInterface *qi = GetQIByGlobalNPCQuest(filename);
if(qi) {
@@ -380,7 +382,7 @@ int QuestParserCollection::EventItem(QuestEventID evt, Client *client, EQEmu::It
return ret;
}
return DispatchEventItem(evt, client, item, mob, data, extra_data, extra_pointers);
} else {
} else if(_item_quest_status[item_id] != QuestFailedToLoad){
std::string filename;
QuestInterface *qi = GetQIByItemQuest(item_script, filename);
if(qi) {
@@ -415,19 +417,21 @@ int QuestParserCollection::EventSpell(QuestEventID evt, NPC* npc, Client *client
return ret;
}
return DispatchEventSpell(evt, npc, client, spell_id, extra_data, extra_pointers);
} else {
}
else if (_spell_quest_status[spell_id] != QuestFailedToLoad) {
std::string filename;
QuestInterface *qi = GetQIBySpellQuest(spell_id, filename);
if(qi) {
if (qi) {
_spell_quest_status[spell_id] = qi->GetIdentifier();
qi->LoadSpellScript(filename, spell_id);
int ret = DispatchEventSpell(evt, npc, client, spell_id, extra_data, extra_pointers);
int i = qi->EventSpell(evt, npc, client, spell_id, extra_data, extra_pointers);
if(i != 0) {
ret = i;
}
if (i != 0) {
ret = i;
}
return ret;
} else {
}
else {
_spell_quest_status[spell_id] = QuestFailedToLoad;
return DispatchEventSpell(evt, npc, client, spell_id, extra_data, extra_pointers);
}
@@ -444,7 +448,7 @@ int QuestParserCollection::EventEncounter(QuestEventID evt, std::string encounte
auto qiter = _interfaces.find(iter->second);
return qiter->second->EventEncounter(evt, encounter_name, data, extra_data, extra_pointers);
}
} else {
} else if(_encounter_quest_status[encounter_name] != QuestFailedToLoad){
std::string filename;
QuestInterface *qi = GetQIByEncounterQuest(encounter_name, filename);
if(qi) {
@@ -695,12 +699,15 @@ QuestInterface *QuestParserCollection::GetQIByGlobalNPCQuest(std::string &filena
std::string tmp;
FILE *f = nullptr;
auto iter = _load_precedence.begin();
while(iter != _load_precedence.end()) {
tmp = filename;
auto ext = _extensions.find((*iter)->GetIdentifier());
tmp += ".";
tmp += ext->second;
f = fopen(tmp.c_str(), "r");
if(f) {
fclose(f);
@@ -1043,7 +1050,7 @@ int QuestParserCollection::DispatchEventSpell(QuestEventID evt, NPC* npc, Client
void QuestParserCollection::LoadPerlEventExportSettings(PerlEventExportSettings* perl_event_export_settings) {
Log.Out(Logs::General, Logs::Zone_Server, "Loading Perl Event Export Settings...");
Log(Logs::General, Logs::Zone_Server, "Loading Perl Event Export Settings...");
/* Write Defaults First (All Enabled) */
for (int i = 0; i < _LargestEventID; i++){
+19 -19
View File
@@ -157,7 +157,7 @@ void QuestManager::echo(int colour, const char *str) {
void QuestManager::say(const char *str) {
QuestManagerCurrentQuestVars();
if (!owner) {
Log.Out(Logs::General, Logs::Quests, "QuestManager::say called with nullptr owner. Probably syntax error in quest file.");
Log(Logs::General, Logs::Quests, "QuestManager::say called with nullptr owner. Probably syntax error in quest file.");
return;
}
else {
@@ -173,7 +173,7 @@ void QuestManager::say(const char *str) {
void QuestManager::say(const char *str, uint8 language) {
QuestManagerCurrentQuestVars();
if (!owner) {
Log.Out(Logs::General, Logs::Quests, "QuestManager::say called with nullptr owner. Probably syntax error in quest file.");
Log(Logs::General, Logs::Quests, "QuestManager::say called with nullptr owner. Probably syntax error in quest file.");
return;
}
else {
@@ -552,7 +552,7 @@ void QuestManager::stopalltimers(Mob *mob) {
void QuestManager::emote(const char *str) {
QuestManagerCurrentQuestVars();
if (!owner) {
Log.Out(Logs::General, Logs::Quests, "QuestManager::emote called with nullptr owner. Probably syntax error in quest file.");
Log(Logs::General, Logs::Quests, "QuestManager::emote called with nullptr owner. Probably syntax error in quest file.");
return;
}
else {
@@ -563,7 +563,7 @@ void QuestManager::emote(const char *str) {
void QuestManager::shout(const char *str) {
QuestManagerCurrentQuestVars();
if (!owner) {
Log.Out(Logs::General, Logs::Quests, "QuestManager::shout called with nullptr owner. Probably syntax error in quest file.");
Log(Logs::General, Logs::Quests, "QuestManager::shout called with nullptr owner. Probably syntax error in quest file.");
return;
}
else {
@@ -574,7 +574,7 @@ void QuestManager::shout(const char *str) {
void QuestManager::shout2(const char *str) {
QuestManagerCurrentQuestVars();
if (!owner) {
Log.Out(Logs::General, Logs::Quests, "QuestManager::shout2 called with nullptr owner. Probably syntax error in quest file.");
Log(Logs::General, Logs::Quests, "QuestManager::shout2 called with nullptr owner. Probably syntax error in quest file.");
return;
}
else {
@@ -593,7 +593,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.Out(Logs::General, Logs::Quests, "QuestManager::depop called with nullptr owner or non-NPC owner. Probably syntax error in quest file.");
Log(Logs::General, Logs::Quests, "QuestManager::depop called with nullptr owner or non-NPC owner. Probably syntax error in quest file.");
return;
}
else {
@@ -623,7 +623,7 @@ void QuestManager::depop(int npc_type) {
void QuestManager::depop_withtimer(int npc_type) {
QuestManagerCurrentQuestVars();
if (!owner || !owner->IsNPC()) {
Log.Out(Logs::General, Logs::Quests, "QuestManager::depop_withtimer called with nullptr owner or non-NPC owner. Probably syntax error in quest file.");
Log(Logs::General, Logs::Quests, "QuestManager::depop_withtimer called with nullptr owner or non-NPC owner. Probably syntax error in quest file.");
return;
}
else {
@@ -650,7 +650,7 @@ void QuestManager::depopall(int npc_type) {
entity_list.DepopAll(npc_type);
}
else {
Log.Out(Logs::General, Logs::Quests, "QuestManager::depopall called with nullptr owner, non-NPC owner, or invalid NPC Type ID. Probably syntax error in quest file.");
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.");
}
}
@@ -659,7 +659,7 @@ void QuestManager::depopzone(bool StartSpawnTimer) {
zone->Depop(StartSpawnTimer);
}
else {
Log.Out(Logs::General, Logs::Quests, "QuestManager::depopzone called with nullptr zone. Probably syntax error in quest file.");
Log(Logs::General, Logs::Quests, "QuestManager::depopzone called with nullptr zone. Probably syntax error in quest file.");
}
}
@@ -668,14 +668,14 @@ void QuestManager::repopzone() {
zone->Repop();
}
else {
Log.Out(Logs::General, Logs::Quests, "QuestManager::repopzone called with nullptr zone. Probably syntax error in quest file.");
Log(Logs::General, Logs::Quests, "QuestManager::repopzone called with nullptr zone. Probably syntax error in quest file.");
}
}
void QuestManager::ConnectNodeToNode(int node1, int node2, int teleport, int doorid) {
if (!node1 || !node2)
{
Log.Out(Logs::General, Logs::Quests, "QuestManager::ConnectNodeToNode called without node1 or node2. Probably syntax error in quest file.");
Log(Logs::General, Logs::Quests, "QuestManager::ConnectNodeToNode called without node1 or node2. Probably syntax error in quest file.");
}
else
{
@@ -702,7 +702,7 @@ void QuestManager::ConnectNodeToNode(int node1, int node2, int teleport, int doo
if (zone->pathing)
{
zone->pathing->ConnectNodeToNode(node1, node2, teleport, doorid);
Log.Out(Logs::Moderate, Logs::Quests, "QuestManager::ConnectNodeToNode connecting node %i to node %i.", node1, node2);
Log(Logs::Moderate, Logs::Quests, "QuestManager::ConnectNodeToNode connecting node %i to node %i.", node1, node2);
}
}
}
@@ -711,7 +711,7 @@ void QuestManager::AddNode(float x, float y, float z, float best_z, int32 reques
{
if (!x || !y || !z)
{
Log.Out(Logs::General, Logs::Quests, "QuestManager::AddNode called without x, y, z. Probably syntax error in quest file.");
Log(Logs::General, Logs::Quests, "QuestManager::AddNode called without x, y, z. Probably syntax error in quest file.");
}
if (!best_z || best_z == 0)
@@ -741,7 +741,7 @@ void QuestManager::AddNode(float x, float y, float z, float best_z, int32 reques
if (zone->pathing)
{
zone->pathing->AddNode(x, y, z, best_z, requested_id);
Log.Out(Logs::Moderate, Logs::Quests, "QuestManager::AddNode adding node at (%i, %i, %i).", x, y, z);
Log(Logs::Moderate, Logs::Quests, "QuestManager::AddNode adding node at (%i, %i, %i).", x, y, z);
}
}
@@ -1724,7 +1724,7 @@ void QuestManager::showgrid(int grid) {
"ORDER BY `number`", grid, zone->GetZoneID());
auto results = database.QueryDatabase(query);
if (!results.Success()) {
Log.Out(Logs::General, Logs::Quests, "Error loading grid %d for showgrid(): %s", grid, results.ErrorMessage().c_str());
Log(Logs::General, Logs::Quests, "Error loading grid %d for showgrid(): %s", grid, results.ErrorMessage().c_str());
return;
}
@@ -2141,7 +2141,7 @@ bool QuestManager::istaskenabled(int taskid) {
void QuestManager::tasksetselector(int tasksetid) {
QuestManagerCurrentQuestVars();
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] TaskSetSelector called for task set %i", tasksetid);
Log(Logs::General, Logs::Tasks, "[UPDATE] TaskSetSelector called for task set %i", tasksetid);
if(RuleB(TaskSystem, EnableTaskSystem) && initiator && owner && taskmanager)
initiator->TaskSetSelector(owner, tasksetid);
}
@@ -2747,7 +2747,7 @@ const char* QuestManager::saylink(char* Phrase, bool silent, const char* LinkNam
std::string insert_query = StringFormat("INSERT INTO `saylink` (`phrase`) VALUES ('%s')", escaped_string);
results = database.QueryDatabase(insert_query);
if (!results.Success()) {
Log.Out(Logs::General, Logs::Error, "Error in saylink phrase queries", results.ErrorMessage().c_str());
Log(Logs::General, Logs::Error, "Error in saylink phrase queries", results.ErrorMessage().c_str());
} else {
results = database.QueryDatabase(query);
if (results.Success()) {
@@ -2755,7 +2755,7 @@ const char* QuestManager::saylink(char* Phrase, bool silent, const char* LinkNam
for(auto row = results.begin(); row != results.end(); ++row)
sayid = atoi(row[0]);
} else {
Log.Out(Logs::General, Logs::Error, "Error in saylink phrase queries", results.ErrorMessage().c_str());
Log(Logs::General, Logs::Error, "Error in saylink phrase queries", results.ErrorMessage().c_str());
}
}
}
@@ -2914,7 +2914,7 @@ void QuestManager::voicetell(const char *str, int macronum, int racenum, int gen
safe_delete(outapp);
}
else
Log.Out(Logs::General, Logs::Quests, "QuestManager::voicetell from %s. Client %s not found.", owner->GetName(), str);
Log(Logs::General, Logs::Quests, "QuestManager::voicetell from %s. Client %s not found.", owner->GetName(), str);
}
}
+11 -11
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.Out(Logs::General, Logs::Error, "Error inserting into raid members: %s", results.ErrorMessage().c_str());
Log(Logs::General, Logs::Error, "Error inserting into raid members: %s", results.ErrorMessage().c_str());
}
LearnMembers();
@@ -259,12 +259,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.Out(Logs::General, Logs::Error, "Set Raid Leader error: %s\n", results.ErrorMessage().c_str());
Log(Logs::General, Logs::Error, "Set Raid Leader error: %s\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.Out(Logs::General, Logs::Error, "Set Raid Leader error: %s\n", results.ErrorMessage().c_str());
Log(Logs::General, Logs::Error, "Set Raid Leader error: %s\n", results.ErrorMessage().c_str());
strn0cpy(leadername, name, 64);
@@ -297,7 +297,7 @@ void Raid::SaveGroupLeaderAA(uint32 gid)
safe_delete_array(queryBuffer);
auto results = database.QueryDatabase(query);
if (!results.Success())
Log.Out(Logs::General, Logs::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str());
Log(Logs::General, Logs::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str());
}
void Raid::SaveRaidLeaderAA()
@@ -311,7 +311,7 @@ void Raid::SaveRaidLeaderAA()
safe_delete_array(queryBuffer);
auto results = database.QueryDatabase(query);
if (!results.Success())
Log.Out(Logs::General, Logs::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str());
Log(Logs::General, Logs::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str());
}
void Raid::UpdateGroupAAs(uint32 gid)
@@ -524,7 +524,7 @@ void Raid::CastGroupSpell(Mob* caster, uint16 spellid, uint32 gid)
#endif
}
else{
Log.Out(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());
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());
}
}
}
@@ -825,7 +825,7 @@ void Raid::GroupBardPulse(Mob* caster, uint16 spellid, uint32 gid){
members[z].member->GetPet()->BardPulse(spellid, caster);
#endif
} else
Log.Out(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());
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());
}
}
}
@@ -1433,7 +1433,7 @@ void Raid::GetRaidDetails()
return;
if (results.RowCount() == 0) {
Log.Out(Logs::General, Logs::Error, "Error getting raid details for raid %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str());
Log(Logs::General, Logs::Error, "Error getting raid details for raid %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str());
return;
}
@@ -1465,7 +1465,7 @@ bool Raid::LearnMembers()
return false;
if(results.RowCount() == 0) {
Log.Out(Logs::General, Logs::Error, "Error getting raid members for raid %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str());
Log(Logs::General, Logs::Error, "Error getting raid members for raid %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str());
disbandCheck = true;
return false;
}
@@ -1671,7 +1671,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.Out(Logs::General, Logs::Error, "Unable to set raid group mentor: %s\n", results.ErrorMessage().c_str());
Log(Logs::General, Logs::Error, "Unable to set raid group mentor: %s\n", results.ErrorMessage().c_str());
}
void Raid::ClearGroupMentor(uint32 group_id)
@@ -1686,7 +1686,7 @@ void Raid::ClearGroupMentor(uint32 group_id)
group_id, GetID());
auto results = database.QueryDatabase(query);
if (!results.Success())
Log.Out(Logs::General, Logs::Error, "Unable to clear raid group mentor: %s\n", results.ErrorMessage().c_str());
Log(Logs::General, Logs::Error, "Unable to clear raid group mentor: %s\n", results.ErrorMessage().c_str());
}
// there isn't a nice place to add this in another function, unlike groups
+70 -68
View File
@@ -153,13 +153,13 @@ bool Spawn2::Process() {
if (timer.Check()) {
timer.Disable();
Log.Out(Logs::Detail, Logs::Spawns, "Spawn2 %d: Timer has triggered", spawn2_id);
Log(Logs::Detail, Logs::Spawns, "Spawn2 %d: 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.Out(Logs::Detail, Logs::Spawns, "Spawn2 %d: spawning prevented by spawn condition %d", spawn2_id, condition_id);
Log(Logs::Detail, Logs::Spawns, "Spawn2 %d: spawning prevented by spawn condition %d", spawn2_id, condition_id);
Reset();
return(true);
}
@@ -170,14 +170,14 @@ bool Spawn2::Process() {
}
if (sg == nullptr) {
Log.Out(Logs::Detail, Logs::Spawns, "Spawn2 %d: Unable to locate spawn group %d. Disabling.", spawn2_id, spawngroup_id_);
Log(Logs::Detail, Logs::Spawns, "Spawn2 %d: Unable to locate spawn group %d. Disabling.", spawn2_id, spawngroup_id_);
return false;
}
//have the spawn group pick an NPC for us
uint32 npcid = sg->GetNPCType();
if (npcid == 0) {
Log.Out(Logs::Detail, Logs::Spawns, "Spawn2 %d: Spawn group %d did not yeild an NPC! not spawning.", spawn2_id, spawngroup_id_);
Log(Logs::Detail, Logs::Spawns, "Spawn2 %d: Spawn group %d did not yeild an NPC! not spawning.", spawn2_id, spawngroup_id_);
Reset(); //try again later (why?)
return(true);
}
@@ -185,7 +185,7 @@ bool Spawn2::Process() {
//try to find our NPC type.
const NPCType* tmp = database.LoadNPCTypesData(npcid);
if (tmp == nullptr) {
Log.Out(Logs::Detail, Logs::Spawns, "Spawn2 %d: Spawn group %d yeilded an invalid NPC type %d", spawn2_id, spawngroup_id_, npcid);
Log(Logs::Detail, Logs::Spawns, "Spawn2 %d: Spawn group %d yeilded an invalid NPC type %d", spawn2_id, spawngroup_id_, npcid);
Reset(); //try again later
return(true);
}
@@ -194,7 +194,7 @@ bool Spawn2::Process() {
{
if(!entity_list.LimitCheckName(tmp->name))
{
Log.Out(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);
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);
timer.Start(5000); //try again in five seconds.
return(true);
}
@@ -202,7 +202,7 @@ bool Spawn2::Process() {
if(tmp->spawn_limit > 0) {
if(!entity_list.LimitCheckType(npcid, tmp->spawn_limit)) {
Log.Out(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);
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);
timer.Start(5000); //try again in five seconds.
return(true);
}
@@ -230,10 +230,10 @@ bool Spawn2::Process() {
if(sg->roamdist && sg->roambox[0] && sg->roambox[1] && sg->roambox[2] && sg->roambox[3] && sg->delay && sg->min_delay)
npc->AI_SetRoambox(sg->roamdist,sg->roambox[0],sg->roambox[1],sg->roambox[2],sg->roambox[3],sg->delay,sg->min_delay);
if(zone->InstantGrids()) {
Log.Out(Logs::Detail, Logs::Spawns, "Spawn2 %d: Group %d spawned %s (%d) at (%.3f, %.3f, %.3f).", spawn2_id, spawngroup_id_, npc->GetName(), npcid, x, y, z);
Log(Logs::Detail, Logs::Spawns, "Spawn2 %d: Group %d spawned %s (%d) at (%.3f, %.3f, %.3f).", spawn2_id, spawngroup_id_, npc->GetName(), npcid, x, y, z);
LoadGrid();
} else {
Log.Out(Logs::Detail, Logs::Spawns, "Spawn2 %d: Group %d spawned %s (%d) at (%.3f, %.3f, %.3f). Grid loading delayed.", spawn2_id, spawngroup_id_, tmp->name, npcid, x, y, z);
Log(Logs::Detail, Logs::Spawns, "Spawn2 %d: Group %d spawned %s (%d) at (%.3f, %.3f, %.3f). Grid loading delayed.", spawn2_id, spawngroup_id_, tmp->name, npcid, x, y, z);
}
}
return true;
@@ -258,7 +258,7 @@ void Spawn2::LoadGrid() {
//dont set an NPC's grid until its loaded for them.
npcthis->SetGrid(grid_);
npcthis->AssignWaypoints(grid_);
Log.Out(Logs::Detail, Logs::Spawns, "Spawn2 %d: Loading grid %d for %s", spawn2_id, grid_, npcthis->GetName());
Log(Logs::Detail, Logs::Spawns, "Spawn2 %d: Loading grid %d for %s", spawn2_id, grid_, npcthis->GetName());
}
@@ -269,21 +269,21 @@ void Spawn2::LoadGrid() {
void Spawn2::Reset() {
timer.Start(resetTimer());
npcthis = nullptr;
Log.Out(Logs::Detail, Logs::Spawns, "Spawn2 %d: Spawn reset, repop in %d ms", spawn2_id, timer.GetRemainingTime());
Log(Logs::Detail, Logs::Spawns, "Spawn2 %d: Spawn reset, repop in %d ms", spawn2_id, timer.GetRemainingTime());
}
void Spawn2::Depop() {
timer.Disable();
Log.Out(Logs::Detail, Logs::Spawns, "Spawn2 %d: Spawn reset, repop disabled", spawn2_id);
Log(Logs::Detail, Logs::Spawns, "Spawn2 %d: Spawn reset, repop disabled", spawn2_id);
npcthis = nullptr;
}
void Spawn2::Repop(uint32 delay) {
if (delay == 0) {
timer.Trigger();
Log.Out(Logs::Detail, Logs::Spawns, "Spawn2 %d: Spawn reset, repop immediately.", spawn2_id);
Log(Logs::Detail, Logs::Spawns, "Spawn2 %d: Spawn reset, repop immediately.", spawn2_id);
} else {
Log.Out(Logs::Detail, Logs::Spawns, "Spawn2 %d: Spawn reset for repop, repop in %d ms", spawn2_id, delay);
Log(Logs::Detail, Logs::Spawns, "Spawn2 %d: Spawn reset for repop, repop in %d ms", spawn2_id, delay);
timer.Start(delay);
}
npcthis = nullptr;
@@ -325,7 +325,7 @@ void Spawn2::ForceDespawn()
cur = despawnTimer(dtimer);
}
Log.Out(Logs::Detail, Logs::Spawns, "Spawn2 %d: Spawn group %d set despawn timer to %d ms.", spawn2_id, spawngroup_id_, cur);
Log(Logs::Detail, Logs::Spawns, "Spawn2 %d: Spawn group %d set despawn timer to %d ms.", spawn2_id, spawngroup_id_, cur);
timer.Start(cur);
}
@@ -346,7 +346,7 @@ void Spawn2::DeathReset(bool realdeath)
if(spawn2_id)
{
database.UpdateRespawnTime(spawn2_id, zone->GetInstanceID(), (cur/1000));
Log.Out(Logs::Detail, Logs::Spawns, "Spawn2 %d: Spawn reset by death, repop in %d ms", spawn2_id, timer.GetRemainingTime());
Log(Logs::Detail, Logs::Spawns, "Spawn2 %d: Spawn reset by death, repop in %d ms", spawn2_id, timer.GetRemainingTime());
//store it to database too
}
}
@@ -631,12 +631,12 @@ void Spawn2::SpawnConditionChanged(const SpawnCondition &c, int16 old_value) {
if(GetSpawnCondition() != c.condition_id)
return;
Log.Out(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);
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);
bool old_state = (old_value >= condition_min_value);
bool new_state = (c.value >= condition_min_value);
if(old_state == new_state) {
Log.Out(Logs::Detail, Logs::Spawns, "Spawn2 %d: Our threshold for this condition was not crossed. Doing nothing.", spawn2_id);
Log(Logs::Detail, Logs::Spawns, "Spawn2 %d: Our threshold for this condition was not crossed. Doing nothing.", spawn2_id);
return; //no change
}
@@ -644,50 +644,50 @@ void Spawn2::SpawnConditionChanged(const SpawnCondition &c, int16 old_value) {
switch(c.on_change) {
case SpawnCondition::DoNothing:
//that was easy.
Log.Out(Logs::Detail, Logs::Spawns, "Spawn2 %d: Our condition is now %s. Taking no action on existing spawn.", spawn2_id, new_state?"enabled":"disabled");
Log(Logs::Detail, Logs::Spawns, "Spawn2 %d: Our condition is now %s. Taking no action on existing spawn.", spawn2_id, new_state?"enabled":"disabled");
break;
case SpawnCondition::DoDepop:
Log.Out(Logs::Detail, Logs::Spawns, "Spawn2 %d: Our condition is now %s. Depoping our mob.", spawn2_id, new_state?"enabled":"disabled");
Log(Logs::Detail, Logs::Spawns, "Spawn2 %d: Our condition is now %s. 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.Out(Logs::Detail, Logs::Spawns, "Spawn2 %d: Our condition is now %s. Forcing a repop.", spawn2_id, new_state?"enabled":"disabled");
Log(Logs::Detail, Logs::Spawns, "Spawn2 %d: Our condition is now %s. 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.Out(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");
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");
if(npcthis != nullptr) {
Log.Out(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());
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());
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.Out(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);
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);
if(timer_remaining <= 0)
Repop();
} else {
Log.Out(Logs::Detail, Logs::Spawns,"Spawn2 %d: Our condition is now %s. Not checking respawn timer.", spawn2_id, new_state?"enabled":"disabled");
Log(Logs::Detail, Logs::Spawns,"Spawn2 %d: Our condition is now %s. Not checking respawn timer.", spawn2_id, new_state?"enabled":"disabled");
}
break;
default:
if(c.on_change < SpawnCondition::DoSignalMin) {
Log.Out(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);
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);
return; //unknown onchange action
}
int signal_id = c.on_change - SpawnCondition::DoSignalMin;
Log.Out(Logs::Detail, Logs::Spawns, "Spawn2 %d: Our condition is now %s. Signaling our mob with %d.", spawn2_id, new_state?"enabled":"disabled", signal_id);
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);
if(npcthis != nullptr)
npcthis->SignalNPC(signal_id);
}
}
void Zone::SpawnConditionChanged(const SpawnCondition &c, int16 old_value) {
Log.Out(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);
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);
LinkedListIterator<Spawn2*> iterator(spawn2_list);
@@ -757,7 +757,7 @@ void SpawnConditionManager::Process() {
EQTime::AddMinutes(cevent.period, &cevent.next);
std::string t;
EQTime::ToString(&cevent.next, t);
Log.Out(Logs::Detail, Logs::Spawns, "Event %d: Will trigger again in %d EQ minutes at %s.", cevent.id, cevent.period, t.c_str());
Log(Logs::Detail, Logs::Spawns, "Event %d: Will trigger again in %d EQ minutes at %s.", cevent.id, cevent.period, t.c_str());
//save the next event time in the DB
UpdateDBEvent(cevent);
//find the next closest event timer.
@@ -776,7 +776,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.Out(Logs::Detail, Logs::Spawns, "Event %d: Unable to find condition %d to execute on.", event.id, event.condition_id);
Log(Logs::Detail, Logs::Spawns, "Event %d: Unable to find condition %d to execute on.", event.id, event.condition_id);
return; //unable to find the spawn condition to operate on
}
@@ -784,7 +784,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.Out(Logs::Detail, Logs::Spawns, "Event %d: Unable to execute. Condition is strict, and event time has already passed.", event.id);
Log(Logs::Detail, Logs::Spawns, "Event %d: Unable to execute. Condition is strict, and event time has already passed.", event.id);
return;
}
@@ -796,26 +796,26 @@ void SpawnConditionManager::ExecEvent(SpawnEvent &event, bool send_update) {
switch(event.action) {
case SpawnEvent::ActionSet:
new_value = event.argument;
Log.Out(Logs::Detail, Logs::Spawns, "Event %d: Executing. Setting condition %d to %d.", event.id, event.condition_id, event.argument);
Log(Logs::Detail, Logs::Spawns, "Event %d: Executing. Setting condition %d to %d.", event.id, event.condition_id, event.argument);
break;
case SpawnEvent::ActionAdd:
new_value += event.argument;
Log.Out(Logs::Detail, Logs::Spawns, "Event %d: Executing. Adding %d to condition %d, yeilding %d.", event.id, event.argument, event.condition_id, new_value);
Log(Logs::Detail, Logs::Spawns, "Event %d: Executing. Adding %d to condition %d, yeilding %d.", event.id, event.argument, event.condition_id, new_value);
break;
case SpawnEvent::ActionSubtract:
new_value -= event.argument;
Log.Out(Logs::Detail, Logs::Spawns, "Event %d: Executing. Subtracting %d from condition %d, yeilding %d.", event.id, event.argument, event.condition_id, new_value);
Log(Logs::Detail, Logs::Spawns, "Event %d: Executing. Subtracting %d from condition %d, yeilding %d.", event.id, event.argument, event.condition_id, new_value);
break;
case SpawnEvent::ActionMultiply:
new_value *= event.argument;
Log.Out(Logs::Detail, Logs::Spawns, "Event %d: Executing. Multiplying condition %d by %d, yeilding %d.", event.id, event.condition_id, event.argument, new_value);
Log(Logs::Detail, Logs::Spawns, "Event %d: Executing. Multiplying condition %d by %d, yeilding %d.", event.id, event.condition_id, event.argument, new_value);
break;
case SpawnEvent::ActionDivide:
new_value /= event.argument;
Log.Out(Logs::Detail, Logs::Spawns, "Event %d: Executing. Dividing condition %d by %d, yeilding %d.", event.id, event.condition_id, event.argument, new_value);
Log(Logs::Detail, Logs::Spawns, "Event %d: Executing. Dividing condition %d by %d, yeilding %d.", event.id, event.condition_id, event.argument, new_value);
break;
default:
Log.Out(Logs::Detail, Logs::Spawns, "Event %d: Invalid event action type %d", event.id, event.action);
Log(Logs::Detail, Logs::Spawns, "Event %d: Invalid event action type %d", event.id, event.action);
return;
}
@@ -885,7 +885,7 @@ bool SpawnConditionManager::LoadDBEvent(uint32 event_id, SpawnEvent &event, std:
std::string timeAsString;
EQTime::ToString(&event.next, timeAsString);
Log.Out(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());
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());
return true;
}
@@ -912,7 +912,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.Out(Logs::Detail, Logs::Spawns, "Loaded spawn condition %d with value %d and on_change %d", cond.condition_id, cond.value, cond.on_change);
Log(Logs::Detail, Logs::Spawns, "Loaded spawn condition %d with value %d and on_change %d", cond.condition_id, cond.value, cond.on_change);
}
//load values
@@ -949,7 +949,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in
event.period = atoi(row[2]);
if(event.period == 0) {
Log.Out(Logs::General, Logs::Error, "Refusing to load spawn event #%d because it has a period of 0\n", event.id);
Log(Logs::General, Logs::Error, "Refusing to load spawn event #%d because it has a period of 0\n", event.id);
continue;
}
@@ -966,7 +966,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in
spawn_events.push_back(event);
Log.Out(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);
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);
}
//now we need to catch up on events that happened while we were away
@@ -1001,7 +1001,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in
//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.Out(Logs::Detail, Logs::Spawns, "Initial next trigger time set for spawn event %d", cevent.id);
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);
@@ -1012,7 +1012,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in
bool ran = false;
while(EQTime::IsTimeBefore(&tod, &cevent.next)) {
Log.Out(Logs::Detail, Logs::Spawns, "Catch up triggering on event %d", cevent.id);
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)
@@ -1054,10 +1054,12 @@ void SpawnConditionManager::FindNearestEvent() {
}
}
}
if(next_id == -1)
Log.Out(Logs::Detail, Logs::Spawns, "No spawn events enabled. Disabling next event.");
else
Log.Out(Logs::Detail, Logs::Spawns, "Next event determined to be event %d", next_id);
if (next_id == -1) {
Log(Logs::Detail, Logs::Spawns, "No spawn events enabled. Disabling next event.");
}
else {
Log(Logs::Detail, Logs::Spawns, "Next event determined to be event %d", next_id);
}
}
void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance_id, uint16 condition_id, int16 new_value, bool world_update)
@@ -1069,14 +1071,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.Out(Logs::Detail, Logs::Spawns, "Condition update received from world for %d, but we do not have that conditon.", condition_id);
Log(Logs::Detail, Logs::Spawns, "Condition update received from world for %d, 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.Out(Logs::Detail, Logs::Spawns, "Condition update received from world for %d with value %d, which is what we already have.", condition_id, 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);
return;
}
@@ -1085,7 +1087,7 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance
//set our local value
cond.value = new_value;
Log.Out(Logs::Detail, Logs::Spawns, "Condition update received from world for %d with value %d", condition_id, new_value);
Log(Logs::Detail, Logs::Spawns, "Condition update received from world for %d with value %d", condition_id, new_value);
//now we have to test each spawn point to see if it changed.
zone->SpawnConditionChanged(cond, old_value);
@@ -1096,14 +1098,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.Out(Logs::Detail, Logs::Spawns, "Local Condition update requested for %d, but we do not have that conditon.", condition_id);
Log(Logs::Detail, Logs::Spawns, "Local Condition update requested for %d, 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.Out(Logs::Detail, Logs::Spawns, "Local Condition update requested for %d with value %d, which is what we already have.", condition_id, 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);
return;
}
@@ -1114,7 +1116,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.Out(Logs::Detail, Logs::Spawns, "Local Condition update requested for %d with value %d", condition_id, new_value);
Log(Logs::Detail, Logs::Spawns, "Local Condition update requested for %d with value %d", condition_id, new_value);
//now we have to test each spawn point to see if it changed.
zone->SpawnConditionChanged(cond, old_value);
@@ -1124,7 +1126,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.Out(Logs::Detail, Logs::Spawns, "Remote spawn condition %d set to %d. Updating DB and notifying world.", condition_id, new_value);
Log(Logs::Detail, Logs::Spawns, "Remote spawn condition %d set to %d. Updating DB and notifying world.", condition_id, new_value);
UpdateDBCondition(zone_short, instance_id, condition_id, new_value);
@@ -1144,7 +1146,7 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance
void SpawnConditionManager::ReloadEvent(uint32 event_id) {
std::string zone_short_name;
Log.Out(Logs::Detail, Logs::Spawns, "Requested to reload event %d from the database.", event_id);
Log(Logs::Detail, Logs::Spawns, "Requested to reload event %d from the database.", event_id);
//first look for the event in our local event list
std::vector<SpawnEvent>::iterator cur,end;
@@ -1157,7 +1159,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.Out(Logs::Detail, Logs::Spawns, "Failed to reload event %d from the database.", event_id);
Log(Logs::Detail, Logs::Spawns, "Failed to reload event %d from the database.", event_id);
return;
}
//sync up our nearest event
@@ -1170,7 +1172,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.Out(Logs::Detail, Logs::Spawns, "Failed to reload event %d from the database.", event_id);
Log(Logs::Detail, Logs::Spawns, "Failed to reload event %d from the database.", event_id);
return;
}
@@ -1187,7 +1189,7 @@ void SpawnConditionManager::ReloadEvent(uint32 event_id) {
void SpawnConditionManager::ToggleEvent(uint32 event_id, bool enabled, bool strict, bool reset_base) {
Log.Out(Logs::Detail, Logs::Spawns, "Request to %s spawn event %d %sresetting trigger time", enabled?"enable":"disable", event_id, reset_base?"":"without ");
Log(Logs::Detail, Logs::Spawns, "Request to %s spawn event %d %sresetting 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;
@@ -1202,13 +1204,13 @@ void SpawnConditionManager::ToggleEvent(uint32 event_id, bool enabled, bool stri
cevent.enabled = enabled;
cevent.strict = strict;
if(reset_base) {
Log.Out(Logs::Detail, Logs::Spawns, "Spawn event %d located in this zone. State set. Trigger time reset (period %d).", event_id, cevent.period);
Log(Logs::Detail, Logs::Spawns, "Spawn event %d located in this zone. State set. Trigger time reset (period %d).", 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.Out(Logs::Detail, Logs::Spawns, "Spawn event %d located in this zone. State changed.", event_id);
Log(Logs::Detail, Logs::Spawns, "Spawn event %d located in this zone. State changed.", event_id);
}
//save the event in the DB
@@ -1217,7 +1219,7 @@ void SpawnConditionManager::ToggleEvent(uint32 event_id, bool enabled, bool stri
//sync up our nearest event
FindNearestEvent();
} else {
Log.Out(Logs::Detail, Logs::Spawns, "Spawn event %d located in this zone but no change was needed.", event_id);
Log(Logs::Detail, Logs::Spawns, "Spawn event %d located in this zone but no change was needed.", event_id);
}
//even if we dont change anything, we still found it
return;
@@ -1236,24 +1238,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.Out(Logs::Detail, Logs::Spawns, "Unable to find spawn event %d in the database.", event_id);
Log(Logs::Detail, Logs::Spawns, "Unable to find spawn event %d in the database.", event_id);
//unable to find the event in the database...
return;
}
if(e.enabled == enabled && !reset_base) {
Log.Out(Logs::Detail, Logs::Spawns, "Spawn event %d is not located in this zone but no change was needed.", event_id);
Log(Logs::Detail, Logs::Spawns, "Spawn event %d is not located in this zone but no change was needed.", event_id);
return; //no changes.
}
e.enabled = enabled;
if(reset_base) {
Log.Out(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);
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);
//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.Out(Logs::Detail, Logs::Spawns, "Spawn event %d is in zone %s. State changed. Notifying world.", event_id, zone_short_name.c_str(), e.period);
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);
}
//save the event in the DB
UpdateDBEvent(e);
@@ -1278,7 +1280,7 @@ int16 SpawnConditionManager::GetCondition(const char *zone_short, uint32 instanc
condi = spawn_conditions.find(condition_id);
if(condi == spawn_conditions.end())
{
Log.Out(Logs::Detail, Logs::Spawns, "Unable to find local condition %d in Get request.", condition_id);
Log(Logs::Detail, Logs::Spawns, "Unable to find local condition %d in Get request.", condition_id);
return(0); //unable to find the spawn condition
}
@@ -1293,12 +1295,12 @@ int16 SpawnConditionManager::GetCondition(const char *zone_short, uint32 instanc
zone_short, instance_id, condition_id);
auto results = database.QueryDatabase(query);
if (!results.Success()) {
Log.Out(Logs::Detail, Logs::Spawns, "Unable to query remote condition %d from zone %s in Get request.", condition_id, zone_short);
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...
}
if (results.RowCount() == 0) {
Log.Out(Logs::Detail, Logs::Spawns, "Unable to load remote condition %d from zone %s in Get request.", condition_id, zone_short);
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...
}
+4 -4
View File
@@ -51,7 +51,7 @@ SpawnGroup::SpawnGroup( uint32 in_id, char* name, int in_group_spawn_limit, floa
uint32 SpawnGroup::GetNPCType() {
#if EQDEBUG >= 10
Log.Out(Logs::General, Logs::None, "SpawnGroup[%08x]::GetNPCType()", (uint32) this);
Log(Logs::General, Logs::None, "SpawnGroup[%08x]::GetNPCType()", (uint32) this);
#endif
int npcType = 0;
int totalchance = 0;
@@ -169,7 +169,7 @@ bool ZoneDatabase::LoadSpawnGroups(const char *zone_name, uint16 version, SpawnG
zone_name);
results = QueryDatabase(query);
if (!results.Success()) {
Log.Out(Logs::General, Logs::Error, "Error2 in PopulateZoneLists query '%'", query.c_str());
Log(Logs::General, Logs::Error, "Error2 in PopulateZoneLists query '%'", query.c_str());
return false;
}
@@ -198,7 +198,7 @@ bool ZoneDatabase::LoadSpawnGroupsByID(int spawngroupid, SpawnGroupList *spawn_g
spawngroupid);
auto results = QueryDatabase(query);
if (!results.Success()) {
Log.Out(Logs::General, Logs::Error, "Error2 in PopulateZoneLists query %s", query.c_str());
Log(Logs::General, Logs::Error, "Error2 in PopulateZoneLists query %s", query.c_str());
return false;
}
@@ -216,7 +216,7 @@ bool ZoneDatabase::LoadSpawnGroupsByID(int spawngroupid, SpawnGroupList *spawn_g
spawngroupid);
results = QueryDatabase(query);
if (!results.Success()) {
Log.Out(Logs::General, Logs::Error, "Error3 in PopulateZoneLists query '%s'", query.c_str());
Log(Logs::General, Logs::Error, "Error3 in PopulateZoneLists query '%s'", query.c_str());
return false;
}
+31 -30
View File
@@ -491,7 +491,7 @@ int Mob::MonkSpecialAttack(Mob *other, uint8 unchecked_type)
reuse = KickReuseTime;
break;
default:
Log.Out(Logs::Detail, Logs::Attack, "Invalid special attack type %d attempted", unchecked_type);
Log(Logs::Detail, Logs::Attack, "Invalid special attack type %d attempted", unchecked_type);
return (1000); /* nice long delay for them, the caller depends on this! */
}
@@ -629,7 +629,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.Out(Logs::Detail, Logs::Combat, "Throwing attack canceled. Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime());
Log(Logs::Detail, Logs::Combat, "Throwing attack canceled. Timer not up. Attack %d, ranged %d", 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;
@@ -641,12 +641,12 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) {
const EQEmu::ItemInstance* Ammo = m_inv[EQEmu::inventory::slotAmmo];
if (!RangeWeapon || !RangeWeapon->IsClassCommon()) {
Log.Out(Logs::Detail, Logs::Combat, "Ranged attack canceled. Missing or invalid ranged weapon (%d) in slot %d", GetItemIDAt(EQEmu::inventory::slotRange), EQEmu::inventory::slotRange);
Log(Logs::Detail, Logs::Combat, "Ranged attack canceled. Missing or invalid ranged weapon (%d) in slot %d", GetItemIDAt(EQEmu::inventory::slotRange), EQEmu::inventory::slotRange);
Message(0, "Error: Rangeweapon: GetItem(%i)==0, you have no bow!", GetItemIDAt(EQEmu::inventory::slotRange));
return;
}
if (!Ammo || !Ammo->IsClassCommon()) {
Log.Out(Logs::Detail, Logs::Combat, "Ranged attack canceled. Missing or invalid ammo item (%d) in slot %d", GetItemIDAt(EQEmu::inventory::slotAmmo), EQEmu::inventory::slotAmmo);
Log(Logs::Detail, Logs::Combat, "Ranged attack canceled. Missing or invalid ammo item (%d) in slot %d", GetItemIDAt(EQEmu::inventory::slotAmmo), EQEmu::inventory::slotAmmo);
Message(0, "Error: Ammo: GetItem(%i)==0, you have no ammo!", GetItemIDAt(EQEmu::inventory::slotAmmo));
return;
}
@@ -655,17 +655,17 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) {
const EQEmu::ItemData* AmmoItem = Ammo->GetItem();
if (RangeItem->ItemType != EQEmu::item::ItemTypeBow) {
Log.Out(Logs::Detail, Logs::Combat, "Ranged attack canceled. Ranged item is not a bow. type %d.", RangeItem->ItemType);
Log(Logs::Detail, Logs::Combat, "Ranged attack canceled. Ranged item is not a bow. type %d.", RangeItem->ItemType);
Message(0, "Error: Rangeweapon: Item %d is not a bow.", RangeWeapon->GetID());
return;
}
if (AmmoItem->ItemType != EQEmu::item::ItemTypeArrow) {
Log.Out(Logs::Detail, Logs::Combat, "Ranged attack canceled. Ammo item is not an arrow. type %d.", AmmoItem->ItemType);
Log(Logs::Detail, Logs::Combat, "Ranged attack canceled. Ammo item is not an arrow. type %d.", AmmoItem->ItemType);
Message(0, "Error: Ammo: type %d != %d, you have the wrong type of ammo!", AmmoItem->ItemType, EQEmu::item::ItemTypeArrow);
return;
}
Log.Out(Logs::Detail, Logs::Combat, "Shooting %s with bow %s (%d) and arrow %s (%d)", other->GetName(), RangeItem->Name, RangeItem->ID, AmmoItem->Name, AmmoItem->ID);
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);
//look for ammo in inventory if we only have 1 left...
if(Ammo->GetCharges() == 1) {
@@ -692,7 +692,7 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) {
Ammo = baginst;
ammo_slot = m_inv.CalcSlotId(r, i);
found = true;
Log.Out(Logs::Detail, Logs::Combat, "Using ammo from quiver stack at slot %d. %d in stack.", ammo_slot, Ammo->GetCharges());
Log(Logs::Detail, Logs::Combat, "Using ammo from quiver stack at slot %d. %d in stack.", ammo_slot, Ammo->GetCharges());
break;
}
}
@@ -707,17 +707,17 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) {
if (aslot != INVALID_INDEX) {
ammo_slot = aslot;
Ammo = m_inv[aslot];
Log.Out(Logs::Detail, Logs::Combat, "Using ammo from inventory stack at slot %d. %d in stack.", ammo_slot, Ammo->GetCharges());
Log(Logs::Detail, Logs::Combat, "Using ammo from inventory stack at slot %d. %d in stack.", ammo_slot, Ammo->GetCharges());
}
}
}
float range = RangeItem->Range + AmmoItem->Range + GetRangeDistTargetSizeMod(GetTarget());
Log.Out(Logs::Detail, Logs::Combat, "Calculated bow range to be %.1f", range);
Log(Logs::Detail, Logs::Combat, "Calculated bow range to be %.1f", range);
range *= range;
float dist = DistanceSquared(m_Position, other->GetPosition());
if(dist > range) {
Log.Out(Logs::Detail, Logs::Combat, "Ranged attack out of range... client should catch this. (%f > %f).\n", dist, range);
Log(Logs::Detail, Logs::Combat, "Ranged attack out of range... client should catch this. (%f > %f).\n", dist, range);
Message_StringID(13,TARGET_OUT_OF_RANGE);//Client enforces range and sends the message, this is a backup just incase.
return;
}
@@ -745,9 +745,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.Out(Logs::Detail, Logs::Combat, "Consumed one arrow from slot %d", ammo_slot);
Log(Logs::Detail, Logs::Combat, "Consumed one arrow from slot %d", ammo_slot);
} else {
Log.Out(Logs::Detail, Logs::Combat, "Endless Quiver prevented ammo consumption.");
Log(Logs::Detail, Logs::Combat, "Endless Quiver prevented ammo consumption.");
}
CheckIncreaseSkill(EQEmu::skills::SkillArchery, GetTarget(), -15);
@@ -807,7 +807,7 @@ void Mob::DoArcheryAttackDmg(Mob *other, const EQEmu::ItemInstance *RangeWeapon,
SendItemAnimation(other, AmmoItem, EQEmu::skills::SkillArchery);
}
Log.Out(Logs::Detail, Logs::Combat, "Ranged attack hit %s.", other->GetName());
Log(Logs::Detail, Logs::Combat, "Ranged attack hit %s.", other->GetName());
uint32 hate = 0;
int TotalDmg = 0;
@@ -838,12 +838,14 @@ void Mob::DoArcheryAttackDmg(Mob *other, const EQEmu::ItemInstance *RangeWeapon,
int MaxDmg = WDmg + ADmg;
hate = ((WDmg + ADmg));
if (RuleB(Combat, ProjectileDmgOnImpact))
Log.Out(Logs::Detail, Logs::Combat, "Bow and Arrow DMG %d, Max Damage %d.", WDmg,
if (RuleB(Combat, ProjectileDmgOnImpact)) {
Log(Logs::Detail, Logs::Combat, "Bow and Arrow DMG %d, Max Damage %d.", WDmg,
MaxDmg);
else
Log.Out(Logs::Detail, Logs::Combat, "Bow DMG %d, Arrow DMG %d, Max Damage %d.", WDmg,
}
else {
Log(Logs::Detail, Logs::Combat, "Bow DMG %d, Arrow DMG %d, Max Damage %d.", WDmg,
ADmg, MaxDmg);
}
if (MaxDmg == 0)
MaxDmg = 1;
@@ -958,7 +960,6 @@ void Mob::ProjectileAttack()
{
if (!HasProjectileAttack())
return;
;
Mob *target = nullptr;
bool disable = true;
@@ -1085,7 +1086,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.Out(Logs::Detail, Logs::Combat, "Archery canceled. Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime());
Log(Logs::Detail, Logs::Combat, "Archery canceled. Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime());
return;
}
@@ -1221,7 +1222,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.Out(Logs::Detail, Logs::Combat, "Throwing attack canceled. Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime());
Log(Logs::Detail, Logs::Combat, "Throwing attack canceled. Timer not up. Attack %d, ranged %d", 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;
@@ -1231,19 +1232,19 @@ void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51
const EQEmu::ItemInstance* RangeWeapon = m_inv[EQEmu::inventory::slotRange];
if (!RangeWeapon || !RangeWeapon->IsClassCommon()) {
Log.Out(Logs::Detail, Logs::Combat, "Ranged attack canceled. Missing or invalid ranged weapon (%d) in slot %d", GetItemIDAt(EQEmu::inventory::slotRange), EQEmu::inventory::slotRange);
Log(Logs::Detail, Logs::Combat, "Ranged attack canceled. Missing or invalid ranged weapon (%d) in slot %d", GetItemIDAt(EQEmu::inventory::slotRange), EQEmu::inventory::slotRange);
Message(0, "Error: Rangeweapon: GetItem(%i)==0, you have nothing to throw!", GetItemIDAt(EQEmu::inventory::slotRange));
return;
}
const EQEmu::ItemData* item = RangeWeapon->GetItem();
if (item->ItemType != EQEmu::item::ItemTypeLargeThrowing && item->ItemType != EQEmu::item::ItemTypeSmallThrowing) {
Log.Out(Logs::Detail, Logs::Combat, "Ranged attack canceled. Ranged item %d is not a throwing weapon. type %d.", item->ItemType);
Log(Logs::Detail, Logs::Combat, "Ranged attack canceled. Ranged item %d is not a throwing weapon. type %d.", item->ItemType);
Message(0, "Error: Rangeweapon: GetItem(%i)==0, you have nothing useful to throw!", GetItemIDAt(EQEmu::inventory::slotRange));
return;
}
Log.Out(Logs::Detail, Logs::Combat, "Throwing %s (%d) at %s", item->Name, item->ID, other->GetName());
Log(Logs::Detail, Logs::Combat, "Throwing %s (%d) at %s", item->Name, item->ID, other->GetName());
if(RangeWeapon->GetCharges() == 1) {
//first check ammo
@@ -1252,7 +1253,7 @@ void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51
//more in the ammo slot, use it
RangeWeapon = AmmoItem;
ammo_slot = EQEmu::inventory::slotAmmo;
Log.Out(Logs::Detail, Logs::Combat, "Using ammo from ammo slot, stack at slot %d. %d in stack.", ammo_slot, RangeWeapon->GetCharges());
Log(Logs::Detail, Logs::Combat, "Using ammo from ammo slot, stack at slot %d. %d in stack.", ammo_slot, RangeWeapon->GetCharges());
} else {
//look through our inventory for more
int32 aslot = m_inv.HasItem(item->ID, 1, invWherePersonal);
@@ -1260,17 +1261,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.Out(Logs::Detail, Logs::Combat, "Using ammo from inventory slot, stack at slot %d. %d in stack.", ammo_slot, RangeWeapon->GetCharges());
Log(Logs::Detail, Logs::Combat, "Using ammo from inventory slot, stack at slot %d. %d in stack.", ammo_slot, RangeWeapon->GetCharges());
}
}
}
float range = item->Range + GetRangeDistTargetSizeMod(other);
Log.Out(Logs::Detail, Logs::Combat, "Calculated bow range to be %.1f", range);
Log(Logs::Detail, Logs::Combat, "Calculated bow range to be %.1f", range);
range *= range;
float dist = DistanceSquared(m_Position, other->GetPosition());
if(dist > range) {
Log.Out(Logs::Detail, Logs::Combat, "Throwing attack out of range... client should catch this. (%f > %f).\n", dist, range);
Log(Logs::Detail, Logs::Combat, "Throwing attack out of range... client should catch this. (%f > %f).\n", dist, range);
Message_StringID(13,TARGET_OUT_OF_RANGE);//Client enforces range and sends the message, this is a backup just incase.
return;
}
@@ -1336,7 +1337,7 @@ void Mob::DoThrowingAttackDmg(Mob *other, const EQEmu::ItemInstance *RangeWeapon
SendItemAnimation(other, AmmoItem, EQEmu::skills::SkillThrowing);
}
Log.Out(Logs::Detail, Logs::Combat, "Throwing attack hit %s.", other->GetName());
Log(Logs::Detail, Logs::Combat, "Throwing attack hit %s.", other->GetName());
int WDmg = 0;
@@ -1374,7 +1375,7 @@ void Mob::DoThrowingAttackDmg(Mob *other, const EQEmu::ItemInstance *RangeWeapon
DoAttack(other, my_hit);
TotalDmg = my_hit.damage_done;
Log.Out(Logs::Detail, Logs::Combat, "Item DMG %d. Hit for damage %d", WDmg, TotalDmg);
Log(Logs::Detail, Logs::Combat, "Item DMG %d. Hit for damage %d", WDmg, TotalDmg);
} else {
TotalDmg = DMG_INVULNERABLE;
}
+17 -16
View File
@@ -488,7 +488,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
if(!target_zone) {
#ifdef SPELL_EFFECT_SPAM
Log.Out(Logs::General, Logs::None, "Succor/Evacuation Spell In Same Zone.");
Log(Logs::General, Logs::None, "Succor/Evacuation Spell In Same Zone.");
#endif
if(IsClient())
CastToClient()->MovePC(zone->GetZoneID(), zone->GetInstanceID(), x, y, z, heading, 0, EvacToSafeCoords);
@@ -497,7 +497,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
}
else {
#ifdef SPELL_EFFECT_SPAM
Log.Out(Logs::General, Logs::None, "Succor/Evacuation Spell To Another Zone.");
Log(Logs::General, Logs::None, "Succor/Evacuation Spell To Another Zone.");
#endif
if(IsClient())
CastToClient()->MovePC(target_zone, x, y, z, heading);
@@ -709,7 +709,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.Out(Logs::Detail, Logs::Combat, "Stunned. We had %d percent resist chance.", stun_resist);
Log(Logs::Detail, Logs::Combat, "Stunned. We had %d percent resist chance.", stun_resist);
if (caster && caster->IsClient())
effect_value += effect_value*caster->GetFocusEffect(focusFcStunTimeMod, spell_id)/100;
@@ -719,7 +719,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
if (IsClient())
Message_StringID(MT_Stun, SHAKE_OFF_STUN);
Log.Out(Logs::Detail, Logs::Combat, "Stun Resisted. We had %d percent resist chance.", stun_resist);
Log(Logs::Detail, Logs::Combat, "Stun Resisted. We had %d percent resist chance.", stun_resist);
}
}
break;
@@ -1660,7 +1660,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
if (IsCorpse() && CastToCorpse()->IsPlayerCorpse()) {
if(caster)
Log.Out(Logs::Detail, Logs::Spells, " corpse being rezzed using spell %i by %s",
Log(Logs::Detail, Logs::Spells, " corpse being rezzed using spell %i by %s",
spell_id, caster->GetName());
CastToCorpse()->CastRezz(spell_id, caster);
@@ -1783,7 +1783,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
}
else {
Message_StringID(4, TARGET_NOT_FOUND);
Log.Out(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);
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);
}
}
@@ -3072,12 +3072,13 @@ int Mob::CalcSpellEffectValue(uint16 spell_id, int effect_id, int caster_level,
spells[spell_id].effectid[effect_id] != SE_ChangeFrenzyRad &&
spells[spell_id].effectid[effect_id] != SE_Harmony &&
spells[spell_id].effectid[effect_id] != SE_CurrentMana &&
spells[spell_id].effectid[effect_id] != SE_ManaRegen_v2) {
spells[spell_id].effectid[effect_id] != SE_ManaRegen_v2 &&
spells[spell_id].effectid[effect_id] != SE_AddFaction) {
int oval = effect_value;
int mod = ApplySpellEffectiveness(spell_id, instrument_mod, true, caster_id);
effect_value = effect_value * mod / 10;
Log.Out(Logs::Detail, Logs::Spells, "Effect value %d altered with bard modifier of %d to yeild %d",
Log(Logs::Detail, Logs::Spells, "Effect value %d altered with bard modifier of %d to yeild %d",
oval, mod, effect_value);
}
@@ -3140,7 +3141,7 @@ snare has both of them negative, yet their range should work the same:
updownsign = 1;
}
Log.Out(Logs::Detail, Logs::Spells, "CSEV: spell %d, formula %d, base %d, max %d, lvl %d. Up/Down %d",
Log(Logs::Detail, Logs::Spells, "CSEV: spell %d, formula %d, base %d, max %d, lvl %d. Up/Down %d",
spell_id, formula, base, max, caster_level, updownsign);
switch(formula)
@@ -3362,7 +3363,7 @@ snare has both of them negative, yet their range should work the same:
result = ubase * (caster_level * (formula - 2000) + 1);
}
else
Log.Out(Logs::General, Logs::None, "Unknown spell effect value forumula %d", formula);
Log(Logs::General, Logs::None, "Unknown spell effect value forumula %d", formula);
}
}
@@ -3387,7 +3388,7 @@ snare has both of them negative, yet their range should work the same:
if (base < 0 && result > 0)
result *= -1;
Log.Out(Logs::Detail, Logs::Spells, "Result: %d (orig %d), cap %d %s", result, oresult, max, (base < 0 && result > 0)?"Inverted due to negative base":"");
Log(Logs::Detail, Logs::Spells, "Result: %d (orig %d), cap %d %s", result, oresult, max, (base < 0 && result > 0)?"Inverted due to negative base":"");
return result;
}
@@ -3414,12 +3415,12 @@ void Mob::BuffProcess()
--buffs[buffs_i].ticsremaining;
if (buffs[buffs_i].ticsremaining < 0) {
Log.Out(Logs::Detail, Logs::Spells, "Buff %d in slot %d has expired. Fading.", buffs[buffs_i].spellid, buffs_i);
Log(Logs::Detail, Logs::Spells, "Buff %d in slot %d has expired. Fading.", buffs[buffs_i].spellid, buffs_i);
BuffFadeBySlot(buffs_i);
}
else
{
Log.Out(Logs::Detail, Logs::Spells, "Buff %d in slot %d has %d tics remaining.", buffs[buffs_i].spellid, buffs_i, buffs[buffs_i].ticsremaining);
Log(Logs::Detail, Logs::Spells, "Buff %d in slot %d has %d tics remaining.", buffs[buffs_i].spellid, buffs_i, buffs[buffs_i].ticsremaining);
}
}
else if (IsClient() && !(CastToClient()->ClientVersionBit() & EQEmu::versions::bit_SoFAndLater))
@@ -3760,7 +3761,7 @@ void Mob::BuffFadeBySlot(int slot, bool iRecalcBonuses)
if (IsClient() && !CastToClient()->IsDead())
CastToClient()->MakeBuffFadePacket(buffs[slot].spellid, slot);
Log.Out(Logs::Detail, Logs::Spells, "Fading buff %d from slot %d", buffs[slot].spellid, slot);
Log(Logs::Detail, Logs::Spells, "Fading buff %d from slot %d", buffs[slot].spellid, slot);
if(spells[buffs[slot].spellid].viral_targets > 0) {
bool last_virus = true;
@@ -4789,7 +4790,7 @@ int16 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo
return 0;
break;
default:
Log.Out(Logs::General, Logs::Normal, "CalcFocusEffect: unknown limit spelltype %d",
Log(Logs::General, Logs::Normal, "CalcFocusEffect: unknown limit spelltype %d",
focus_spell.base[i]);
}
break;
@@ -5146,7 +5147,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.Out(Logs::General, Logs::Normal, "CalcFocusEffect: unknown effectid %d",
Log(Logs::General, Logs::Normal, "CalcFocusEffect: unknown effectid %d",
focus_spell.effectid[i]);
#endif
}
+185 -181
View File
File diff suppressed because it is too large Load Diff
+130 -126
View File
@@ -75,7 +75,7 @@ bool TaskManager::LoadTaskSets() {
MAXTASKSETS, MAXTASKS);
auto results = database.QueryDatabase(query);
if (!results.Success()) {
Log.Out(Logs::General, Logs::Error, "[TASKS]Error in TaskManager::LoadTaskSets: %s", results.ErrorMessage().c_str());
Log(Logs::General, Logs::Error, "[TASKS]Error in TaskManager::LoadTaskSets: %s", results.ErrorMessage().c_str());
return false;
}
@@ -84,7 +84,7 @@ bool TaskManager::LoadTaskSets() {
int taskID = atoi(row[1]);
TaskSets[taskSet].push_back(taskID);
Log.Out(Logs::General, Logs::Tasks, "[GLOBALLOAD] Adding TaskID %4i to TaskSet %4i", taskID, taskSet);
Log(Logs::General, Logs::Tasks, "[GLOBALLOAD] Adding TaskID %4i to TaskSet %4i", taskID, taskSet);
}
return true;
@@ -92,7 +92,7 @@ bool TaskManager::LoadTaskSets() {
bool TaskManager::LoadSingleTask(int TaskID) {
Log.Out(Logs::General, Logs::Tasks, "[GLOBALLOAD] TaskManager::LoadSingleTask(%i)", TaskID);
Log(Logs::General, Logs::Tasks, "[GLOBALLOAD] TaskManager::LoadSingleTask(%i)", TaskID);
if((TaskID <= 0) || (TaskID >= MAXTASKS)) return false;
@@ -116,21 +116,21 @@ bool TaskManager::LoadSingleTask(int TaskID) {
void TaskManager::ReloadGoalLists() {
if(!GoalListManager.LoadLists())
Log.Out(Logs::Detail, Logs::Tasks,"TaskManager::LoadTasks LoadLists failed");
Log(Logs::Detail, Logs::Tasks,"TaskManager::LoadTasks LoadLists failed");
}
bool TaskManager::LoadTasks(int singleTask) {
// If TaskID !=0, then just load the task specified.
Log.Out(Logs::General, Logs::Tasks, "[GLOBALLOAD] TaskManager::LoadTasks Called");
Log(Logs::General, Logs::Tasks, "[GLOBALLOAD] TaskManager::LoadTasks Called");
std::string query;
if(singleTask == 0) {
if(!GoalListManager.LoadLists())
Log.Out(Logs::Detail, Logs::Tasks,"TaskManager::LoadTasks LoadLists failed");
Log(Logs::Detail, Logs::Tasks,"TaskManager::LoadTasks LoadLists failed");
if(!LoadTaskSets())
Log.Out(Logs::Detail, Logs::Tasks,"TaskManager::LoadTasks LoadTaskSets failed");
Log(Logs::Detail, Logs::Tasks,"TaskManager::LoadTasks LoadTaskSets failed");
query = StringFormat("SELECT `id`, `duration`, `title`, `description`, `reward`, "
"`rewardid`, `cashreward`, `xpreward`, `rewardmethod`, "
@@ -147,7 +147,7 @@ bool TaskManager::LoadTasks(int singleTask) {
auto results = database.QueryDatabase(query);
if (!results.Success()) {
Log.Out(Logs::General, Logs::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str());
Log(Logs::General, Logs::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str());
return false;
}
@@ -156,7 +156,7 @@ bool TaskManager::LoadTasks(int singleTask) {
if((taskID <= 0) || (taskID >= MAXTASKS)) {
// This shouldn't happen, as the SELECT is bounded by MAXTASKS
Log.Out(Logs::General, Logs::Error, "[TASKS]Task ID %i out of range while loading tasks from database", taskID);
Log(Logs::General, Logs::Error, "[TASKS]Task ID %i out of range while loading tasks from database", taskID);
continue;
}
@@ -180,11 +180,11 @@ bool TaskManager::LoadTasks(int singleTask) {
Tasks[taskID]->SequenceMode = ActivitiesSequential;
Tasks[taskID]->LastStep = 0;
Log.Out(Logs::General, Logs::Tasks, "[GLOBALLOAD] TaskID: %5i, Duration: %8i, StartZone: %3i Reward: %s MinLevel %i MaxLevel %i Repeatable: %s",
Log(Logs::General, Logs::Tasks, "[GLOBALLOAD] TaskID: %5i, Duration: %8i, StartZone: %3i Reward: %s MinLevel %i MaxLevel %i Repeatable: %s",
taskID, Tasks[taskID]->Duration, Tasks[taskID]->StartZone, Tasks[taskID]->Reward,
Tasks[taskID]->MinLevel, Tasks[taskID]->MaxLevel,
Tasks[taskID]->Repeatable ? "Yes" : "No");
Log.Out(Logs::General, Logs::Tasks, "[GLOBALLOAD] Title: %s", Tasks[taskID]->Title);
Log(Logs::General, Logs::Tasks, "[GLOBALLOAD] Title: %s", Tasks[taskID]->Title);
}
@@ -204,7 +204,7 @@ bool TaskManager::LoadTasks(int singleTask) {
"ORDER BY taskid, activityid ASC", singleTask, MAXACTIVITIESPERTASK);
results = database.QueryDatabase(query);
if (!results.Success()) {
Log.Out(Logs::General, Logs::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str());
Log(Logs::General, Logs::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str());
return false;
}
@@ -216,13 +216,13 @@ 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.Out(Logs::General, Logs::Error, "[TASKS]Task or Activity ID (%i, %i) out of range while loading "
Log(Logs::General, Logs::Error, "[TASKS]Task or Activity ID (%i, %i) out of range while loading "
"activities from database", taskID, activityID);
continue;
}
if(Tasks[taskID]==nullptr) {
Log.Out(Logs::General, Logs::Error, "[TASKS]Activity for non-existent task (%i, %i) while loading activities from database", taskID, activityID);
Log(Logs::General, Logs::Error, "[TASKS]Activity for non-existent task (%i, %i) while loading activities from database", taskID, activityID);
continue;
}
@@ -239,7 +239,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.Out(Logs::General, Logs::Error, "[TASKS]Activities for Task %i are not sequential starting at 0. Not loading task.", taskID, activityID);
Log(Logs::General, Logs::Error, "[TASKS]Activities for Task %i are not sequential starting at 0. Not loading task.", taskID, activityID);
Tasks[taskID] = nullptr;
continue;
}
@@ -274,7 +274,7 @@ bool TaskManager::LoadTasks(int singleTask) {
Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].ZoneID = atoi(row[11]);
Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Optional = atoi(row[12]);
Log.Out(Logs::General, Logs::Tasks, "[GLOBALLOAD] Activity Slot %2i: ID %i for Task %5i. Type: %3i, GoalID: %8i, "
Log(Logs::General, Logs::Tasks, "[GLOBALLOAD] Activity Slot %2i: ID %i for Task %5i. Type: %3i, GoalID: %8i, "
"GoalMethod: %i, GoalCount: %3i, ZoneID:%3i",
Tasks[taskID]->ActivityCount, activityID, taskID,
Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Type,
@@ -283,9 +283,9 @@ bool TaskManager::LoadTasks(int singleTask) {
Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].GoalCount,
Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].ZoneID);
Log.Out(Logs::General, Logs::Tasks, "[GLOBALLOAD] Text1: %s", Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Text1);
Log.Out(Logs::General, Logs::Tasks, "[GLOBALLOAD] Text2: %s", Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Text2);
Log.Out(Logs::General, Logs::Tasks, "[GLOBALLOAD] Text3: %s", Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Text3);
Log(Logs::General, Logs::Tasks, "[GLOBALLOAD] Text1: %s", Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Text1);
Log(Logs::General, Logs::Tasks, "[GLOBALLOAD] Text2: %s", Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Text2);
Log(Logs::General, Logs::Tasks, "[GLOBALLOAD] Text3: %s", Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Text3);
Tasks[taskID]->ActivityCount++;
}
@@ -307,7 +307,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) {
int characterID = c->CharacterID();
Log.Out(Logs::Detail, Logs::Tasks,"TaskManager::SaveClientState for character ID %d", characterID);
Log(Logs::Detail, Logs::Tasks,"TaskManager::SaveClientState for character ID %d", characterID);
if(state->ActiveTaskCount > 0) {
for(int task=0; task<MAXACTIVETASKS; task++) {
@@ -317,16 +317,18 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) {
if(state->ActiveTasks[task].Updated) {
Log.Out(Logs::General, Logs::Tasks, "[CLIENTSAVE] TaskManager::SaveClientState for character ID %d, Updating TaskIndex %i TaskID %i", characterID, task, taskID);
Log(Logs::General, Logs::Tasks, "[CLIENTSAVE] TaskManager::SaveClientState for character ID %d, Updating TaskIndex %i TaskID %i", characterID, task, taskID);
std::string query = StringFormat("REPLACE INTO character_tasks (charid, taskid, slot, acceptedtime) "
"VALUES (%i, %i, %i, %i)",
characterID, taskID, task, state->ActiveTasks[task].AcceptedTime);
auto results = database.QueryDatabase(query);
if(!results.Success())
Log.Out(Logs::General, Logs::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str());
else
if (!results.Success()) {
Log(Logs::General, Logs::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str());
}
else {
state->ActiveTasks[task].Updated = false;
}
}
@@ -339,7 +341,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) {
if(!state->ActiveTasks[task].Activity[activityIndex].Updated)
continue;
Log.Out(Logs::General, Logs::Tasks, "[CLIENTSAVE] TaskManager::SaveClientSate for character ID %d, Updating Activity %i, %i",
Log(Logs::General, Logs::Tasks, "[CLIENTSAVE] TaskManager::SaveClientSate for character ID %d, Updating Activity %i, %i",
characterID, task, activityIndex);
if(updatedActivityCount==0)
@@ -359,11 +361,11 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) {
if(updatedActivityCount == 0)
continue;
Log.Out(Logs::General, Logs::Tasks, "[CLIENTSAVE] Executing query %s", query.c_str());
Log(Logs::General, Logs::Tasks, "[CLIENTSAVE] Executing query %s", query.c_str());
auto results = database.QueryDatabase(query);
if(!results.Success()) {
Log.Out(Logs::General, Logs::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str());
Log(Logs::General, Logs::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str());
continue;
}
@@ -384,7 +386,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) {
for(unsigned int i=state->LastCompletedTaskLoaded; i<state->CompletedTasks.size(); i++) {
Log.Out(Logs::General, Logs::Tasks, "[CLIENTSAVE] TaskManager::SaveClientState Saving Completed Task at slot %i", i);
Log(Logs::General, Logs::Tasks, "[CLIENTSAVE] TaskManager::SaveClientState Saving Completed Task at slot %i", i);
int taskID = state->CompletedTasks[i].TaskID;
if((taskID <= 0) || (taskID >= MAXTASKS) || (Tasks[taskID] == nullptr))
@@ -397,7 +399,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) {
std::string query = StringFormat(completedTaskQuery, characterID, state->CompletedTasks[i].CompletedTime, taskID, -1);
auto results = database.QueryDatabase(query);
if(!results.Success()) {
Log.Out(Logs::General, Logs::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str());
Log(Logs::General, Logs::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str());
continue;
}
@@ -414,7 +416,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) {
query = StringFormat(completedTaskQuery, characterID, state->CompletedTasks[i].CompletedTime, taskID, j);
results = database.QueryDatabase(query);
if(!results.Success())
Log.Out(Logs::General, Logs::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str());
Log(Logs::General, Logs::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str());
}
@@ -460,14 +462,14 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) {
state->ActiveTaskCount = 0;
Log.Out(Logs::General, Logs::Tasks, "[CLIENTLOAD] TaskManager::LoadClientState for character ID %d", characterID);
Log(Logs::General, Logs::Tasks, "[CLIENTLOAD] TaskManager::LoadClientState for character ID %d", characterID);
std::string query = StringFormat("SELECT `taskid`, `slot`, `acceptedtime` "
"FROM `character_tasks` "
"WHERE `charid` = %i ORDER BY acceptedtime", characterID);
auto results = database.QueryDatabase(query);
if (!results.Success()) {
Log.Out(Logs::General, Logs::Error, "[TASKS]Error in TaskManager::LoadClientState load Tasks: %s", results.ErrorMessage().c_str());
Log(Logs::General, Logs::Error, "[TASKS]Error in TaskManager::LoadClientState load Tasks: %s", results.ErrorMessage().c_str());
return false;
}
@@ -476,17 +478,17 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) {
int slot = atoi(row[1]);
if((taskID<0) || (taskID>=MAXTASKS)) {
Log.Out(Logs::General, Logs::Error, "[TASKS]Task ID %i out of range while loading character tasks from database", taskID);
Log(Logs::General, Logs::Error, "[TASKS]Task ID %i out of range while loading character tasks from database", taskID);
continue;
}
if((slot<0) || (slot>=MAXACTIVETASKS)) {
Log.Out(Logs::General, Logs::Error, "[TASKS] Slot %i out of range while loading character tasks from database", slot);
Log(Logs::General, Logs::Error, "[TASKS] Slot %i out of range while loading character tasks from database", slot);
continue;
}
if(state->ActiveTasks[slot].TaskID != TASKSLOTEMPTY) {
Log.Out(Logs::General, Logs::Error, "[TASKS] Slot %i for Task %is is already occupied.", slot, taskID);
Log(Logs::General, Logs::Error, "[TASKS] Slot %i for Task %is is already occupied.", slot, taskID);
continue;
}
@@ -502,11 +504,11 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) {
++state->ActiveTaskCount;
Log.Out(Logs::General, Logs::Tasks, "[CLIENTLOAD] TaskManager::LoadClientState. Char: %i Task ID %i, Accepted Time: %8X", characterID, taskID, acceptedtime);
Log(Logs::General, Logs::Tasks, "[CLIENTLOAD] TaskManager::LoadClientState. Char: %i Task ID %i, Accepted Time: %8X", characterID, taskID, acceptedtime);
}
// Load Activities
Log.Out(Logs::General, Logs::Tasks, "[CLIENTLOAD] LoadClientState. Loading activities for character ID %d", characterID);
Log(Logs::General, Logs::Tasks, "[CLIENTLOAD] LoadClientState. Loading activities for character ID %d", characterID);
query = StringFormat("SELECT `taskid`, `activityid`, `donecount`, `completed` "
"FROM `character_activities` "
@@ -514,20 +516,20 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) {
"ORDER BY `taskid` ASC, `activityid` ASC", characterID);
results = database.QueryDatabase(query);
if (!results.Success()){
Log.Out(Logs::General, Logs::Error, "[TASKS]Error in TaskManager::LoadClientState load Activities: %s", results.ErrorMessage().c_str());
Log(Logs::General, Logs::Error, "[TASKS]Error in TaskManager::LoadClientState load Activities: %s", results.ErrorMessage().c_str());
return false;
}
for (auto row = results.begin(); row != results.end(); ++row) {
int taskID = atoi(row[0]);
if((taskID<0) || (taskID>=MAXTASKS)) {
Log.Out(Logs::General, Logs::Error, "[TASKS]Task ID %i out of range while loading character activities from database", taskID);
Log(Logs::General, Logs::Error, "[TASKS]Task ID %i out of range while loading character activities from database", taskID);
continue;
}
int activityID = atoi(row[1]);
if((activityID<0) || (activityID>=MAXACTIVITIESPERTASK)) {
Log.Out(Logs::General, Logs::Error, "[TASKS]Activity ID %i out of range while loading character activities from database", activityID);
Log(Logs::General, Logs::Error, "[TASKS]Activity ID %i out of range while loading character activities from database", activityID);
continue;
}
@@ -541,7 +543,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) {
}
if(activeTaskIndex == -1) {
Log.Out(Logs::General, Logs::Error, "[TASKS]Activity %i found for task %i which client does not have.", activityID, taskID);
Log(Logs::General, Logs::Error, "[TASKS]Activity %i found for task %i which client does not have.", activityID, taskID);
continue;
}
@@ -556,7 +558,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) {
state->ActiveTasks[activeTaskIndex].Activity[activityID].Updated = false;
Log.Out(Logs::General, Logs::Tasks, "[CLIENTLOAD] TaskManager::LoadClientState. Char: %i Task ID %i, ActivityID: %i, DoneCount: %i, Completed: %i", characterID, taskID, activityID, doneCount, completed);
Log(Logs::General, Logs::Tasks, "[CLIENTLOAD] TaskManager::LoadClientState. Char: %i Task ID %i, ActivityID: %i, DoneCount: %i, Completed: %i", characterID, taskID, activityID, doneCount, completed);
}
@@ -567,7 +569,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) {
characterID);
results = database.QueryDatabase(query);
if (!results.Success()) {
Log.Out(Logs::General, Logs::Error, "[TASKS]Error in TaskManager::LoadClientState load completed tasks: %s", results.ErrorMessage().c_str());
Log(Logs::General, Logs::Error, "[TASKS]Error in TaskManager::LoadClientState load completed tasks: %s", results.ErrorMessage().c_str());
return false;
}
@@ -583,7 +585,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) {
int taskID = atoi(row[0]);
if((taskID <= 0) || (taskID >=MAXTASKS)) {
Log.Out(Logs::General, Logs::Error, "[TASKS]Task ID %i out of range while loading completed tasks from database", taskID);
Log(Logs::General, Logs::Error, "[TASKS]Task ID %i out of range while loading completed tasks from database", taskID);
continue;
}
@@ -593,7 +595,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) {
// completed.
int activityID = atoi(row[1]);
if((activityID<-1) || (activityID>=MAXACTIVITIESPERTASK)) {
Log.Out(Logs::General, Logs::Error, "[TASKS]Activity ID %i out of range while loading completed tasks from database", activityID);
Log(Logs::General, Logs::Error, "[TASKS]Activity ID %i out of range while loading completed tasks from database", activityID);
continue;
}
@@ -634,14 +636,16 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) {
"ORDER BY `taskid` ASC",
characterID, MAXTASKS);
results = database.QueryDatabase(query);
if (!results.Success())
Log.Out(Logs::General, Logs::Error, "[TASKS]Error in TaskManager::LoadClientState load enabled tasks: %s", results.ErrorMessage().c_str());
else
for (auto row = results.begin(); row != results.end(); ++row) {
if (!results.Success()) {
Log(Logs::General, Logs::Error, "[TASKS]Error in TaskManager::LoadClientState load enabled tasks: %s", results.ErrorMessage().c_str());
}
else {
for (auto row = results.begin(); row != results.end(); ++row) {
int taskID = atoi(row[0]);
state->EnabledTasks.push_back(taskID);
Log.Out(Logs::General, Logs::Tasks, "[CLIENTLOAD] Adding TaskID %i to enabled tasks", taskID);
Log(Logs::General, Logs::Tasks, "[CLIENTLOAD] Adding TaskID %i to enabled tasks", taskID);
}
}
// Check that there is an entry in the client task state for every activity in each task
// This should only break if a ServerOP adds or deletes activites for a task that players already
@@ -653,7 +657,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) {
c->Message(13, "Active Task Slot %i, references a task (%i), that does not exist. "
"Removing from memory. Contact a GM to resolve this.",i, taskID);
Log.Out(Logs::General, Logs::Error, "[TASKS]Character %i has task %i which does not exist.", characterID, taskID);
Log(Logs::General, Logs::Error, "[TASKS]Character %i has task %i which does not exist.", characterID, taskID);
state->ActiveTasks[i].TaskID=TASKSLOTEMPTY;
continue;
@@ -665,7 +669,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) {
"Removing from memory. Contact a GM to resolve this.",
taskID, Tasks[taskID]->Title);
Log.Out(Logs::General, Logs::Error, "[TASKS]Fatal error in character %i task state. Activity %i for "
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.", characterID, j, taskID);
state->ActiveTasks[i].TaskID=TASKSLOTEMPTY;
break;
@@ -677,7 +681,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) {
if(state->ActiveTasks[i].TaskID != TASKSLOTEMPTY)
state->UnlockActivities(characterID, i);
Log.Out(Logs::General, Logs::Tasks, "[CLIENTLOAD] LoadClientState for Character ID %d DONE!", characterID);
Log(Logs::General, Logs::Tasks, "[CLIENTLOAD] LoadClientState for Character ID %d DONE!", characterID);
return true;
}
@@ -711,9 +715,9 @@ void ClientTaskState::EnableTask(int characterID, int taskCount, int *tasks) {
}
}
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] New enabled task list ");
Log(Logs::General, Logs::Tasks, "[UPDATE] New enabled task list ");
for(unsigned int i=0; i<EnabledTasks.size(); i++)
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] %i", EnabledTasks[i]);
Log(Logs::General, Logs::Tasks, "[UPDATE] %i", EnabledTasks[i]);
if(tasksEnabled.empty() )
return;
@@ -726,11 +730,11 @@ void ClientTaskState::EnableTask(int characterID, int taskCount, int *tasks) {
std::string query = queryStream.str();
if (tasksEnabled.size()) {
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Executing query %s", query.c_str());
Log(Logs::General, Logs::Tasks, "[UPDATE] Executing query %s", query.c_str());
database.QueryDatabase(query);
}
else {
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] EnableTask called for characterID: %u .. but, no tasks exist", characterID);
Log(Logs::General, Logs::Tasks, "[UPDATE] EnableTask called for characterID: %u .. but, no tasks exist", characterID);
}
}
@@ -762,9 +766,9 @@ void ClientTaskState::DisableTask(int charID, int taskCount, int *taskList) {
}
}
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] New enabled task list ");
Log(Logs::General, Logs::Tasks, "[UPDATE] New enabled task list ");
for(unsigned int i=0; i<EnabledTasks.size(); i++)
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] %i", EnabledTasks[i]);
Log(Logs::General, Logs::Tasks, "[UPDATE] %i", EnabledTasks[i]);
if(tasksDisabled.empty())
return;
@@ -780,11 +784,11 @@ void ClientTaskState::DisableTask(int charID, int taskCount, int *taskList) {
std::string query = queryStream.str();
if (tasksDisabled.size()) {
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Executing query %s", query.c_str());
Log(Logs::General, Logs::Tasks, "[UPDATE] Executing query %s", query.c_str());
database.QueryDatabase(query);
}
else {
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] DisableTask called for characterID: %u .. but, no tasks exist", charID);
Log(Logs::General, Logs::Tasks, "[UPDATE] DisableTask called for characterID: %u .. but, no tasks exist", charID);
}
}
@@ -939,7 +943,7 @@ void TaskManager::TaskSetSelector(Client *c, ClientTaskState *state, Mob *mob, i
int TaskListIndex = 0;
int PlayerLevel = c->GetLevel();
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] TaskSetSelector called for taskset %i. EnableTaskSize is %i", TaskSetID,
Log(Logs::General, Logs::Tasks, "[UPDATE] TaskSetSelector called for taskset %i. EnableTaskSize is %i", TaskSetID,
state->EnabledTasks.size());
if((TaskSetID<=0) || (TaskSetID>=MAXTASKSETS)) return;
@@ -949,7 +953,7 @@ void TaskManager::TaskSetSelector(Client *c, ClientTaskState *state, Mob *mob, i
if(TaskSets[TaskSetID][0] == 0) {
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] TaskSets[%i][0] == 0. All Tasks in Set enabled.", TaskSetID);
Log(Logs::General, Logs::Tasks, "[UPDATE] TaskSets[%i][0] == 0. All Tasks in Set enabled.", TaskSetID);
auto Iterator = TaskSets[TaskSetID].begin();
while((Iterator != TaskSets[TaskSetID].end()) && (TaskListIndex < MAXCHOOSERENTRIES)) {
@@ -972,7 +976,7 @@ void TaskManager::TaskSetSelector(Client *c, ClientTaskState *state, Mob *mob, i
while((EnabledTaskIndex < state->EnabledTasks.size()) && (TaskSetIndex < TaskSets[TaskSetID].size()) &&
(TaskListIndex < MAXCHOOSERENTRIES)) {
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Comparing EnabledTasks[%i] (%i) with TaskSets[%i][%i] (%i)",
Log(Logs::General, Logs::Tasks, "[UPDATE] Comparing EnabledTasks[%i] (%i) with TaskSets[%i][%i] (%i)",
EnabledTaskIndex, state->EnabledTasks[EnabledTaskIndex], TaskSetID, TaskSetIndex,
TaskSets[TaskSetID][TaskSetIndex]);
@@ -1012,7 +1016,7 @@ void TaskManager::SendTaskSelector(Client *c, Mob *mob, int TaskCount, int *Task
return;
}
// Titanium OpCode: 0x5e7c
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] TaskSelector for %i Tasks", TaskCount);
Log(Logs::General, Logs::Tasks, "[UPDATE] TaskSelector for %i Tasks", TaskCount);
char *Ptr;
int PlayerLevel = c->GetLevel();
@@ -1136,7 +1140,7 @@ void TaskManager::SendTaskSelector(Client *c, Mob *mob, int TaskCount, int *Task
void TaskManager::SendTaskSelectorNew(Client *c, Mob *mob, int TaskCount, int *TaskList) {
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] TaskSelector for %i Tasks", TaskCount);
Log(Logs::General, Logs::Tasks, "[UPDATE] TaskSelector for %i Tasks", TaskCount);
int PlayerLevel = c->GetLevel();
@@ -1304,7 +1308,7 @@ int ClientTaskState::GetActiveTaskID(int index) {
static void DeleteCompletedTaskFromDatabase(int charID, int taskID) {
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] DeleteCompletedTasksFromDatabase. CharID = %i, TaskID = %i", charID, taskID);
Log(Logs::General, Logs::Tasks, "[UPDATE] DeleteCompletedTasksFromDatabase. CharID = %i, TaskID = %i", charID, taskID);
const std::string query = StringFormat("DELETE FROM completed_tasks WHERE charid=%i AND taskid = %i", charID, taskID);
auto results = database.QueryDatabase(query);
@@ -1312,7 +1316,7 @@ static void DeleteCompletedTaskFromDatabase(int charID, int taskID) {
return;
}
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Delete query %s", query.c_str());
Log(Logs::General, Logs::Tasks, "[UPDATE] Delete query %s", query.c_str());
}
bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) {
@@ -1326,7 +1330,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) {
// On loading the client state, all activities that are not completed, are
// marked as hidden. For Sequential (non-stepped) mode, we mark the first
// activity as active if not complete.
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] CharID: %i Task: %i Sequence mode is %i",
Log(Logs::General, Logs::Tasks, "[UPDATE] CharID: %i Task: %i Sequence mode is %i",
CharID, ActiveTasks[TaskIndex].TaskID, Task->SequenceMode);
if(Task->SequenceMode == ActivitiesSequential) {
@@ -1348,7 +1352,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) {
}
if(AllActivitiesComplete && RuleB(TaskSystem, RecordCompletedTasks)) {
if(RuleB(TasksSystem, KeepOneRecordPerCompletedTask)) {
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] KeepOneRecord enabled");
Log(Logs::General, Logs::Tasks, "[UPDATE] KeepOneRecord enabled");
auto Iterator = CompletedTasks.begin();
int ErasedElements = 0;
while(Iterator != CompletedTasks.end()) {
@@ -1360,7 +1364,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) {
else
++Iterator;
}
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Erased Element count is %i", ErasedElements);
Log(Logs::General, Logs::Tasks, "[UPDATE] Erased Element count is %i", ErasedElements);
if(ErasedElements) {
LastCompletedTaskLoaded -= ErasedElements;
DeleteCompletedTaskFromDatabase(CharID, ActiveTasks[TaskIndex].TaskID);
@@ -1377,7 +1381,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) {
CompletedTasks.push_back(cti);
}
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Returning sequential task, AllActivitiesComplete is %i", AllActivitiesComplete);
Log(Logs::General, Logs::Tasks, "[UPDATE] Returning sequential task, AllActivitiesComplete is %i", AllActivitiesComplete);
return AllActivitiesComplete;
}
@@ -1386,7 +1390,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) {
bool CurrentStepComplete = true;
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Current Step is %i, Last Step is %i", ActiveTasks[TaskIndex].CurrentStep, Task->LastStep);
Log(Logs::General, Logs::Tasks, "[UPDATE] Current Step is %i, Last Step is %i", ActiveTasks[TaskIndex].CurrentStep, Task->LastStep);
// If CurrentStep is -1, this is the first call to this method since loading the
// client state. Unlock all activities with a step number of 0
if(ActiveTasks[TaskIndex].CurrentStep == -1) {
@@ -1421,7 +1425,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) {
// If we are only keeping one completed record per task, and the player has done
// the same task again, erase the previous completed entry for this task.
if(RuleB(TasksSystem, KeepOneRecordPerCompletedTask)) {
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] KeepOneRecord enabled");
Log(Logs::General, Logs::Tasks, "[UPDATE] KeepOneRecord enabled");
auto Iterator = CompletedTasks.begin();
int ErasedElements = 0;
while(Iterator != CompletedTasks.end()) {
@@ -1433,7 +1437,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) {
else
++Iterator;
}
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Erased Element count is %i", ErasedElements);
Log(Logs::General, Logs::Tasks, "[UPDATE] Erased Element count is %i", ErasedElements);
if(ErasedElements) {
LastCompletedTaskLoaded -= ErasedElements;
DeleteCompletedTaskFromDatabase(CharID, ActiveTasks[TaskIndex].TaskID);
@@ -1483,7 +1487,7 @@ bool ClientTaskState::UpdateTasksByNPC(Client *c, int ActivityType, int NPCTypeI
int Ret = false;
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] ClientTaskState::UpdateTasks for NPCTypeID: %d", NPCTypeID);
Log(Logs::General, Logs::Tasks, "[UPDATE] ClientTaskState::UpdateTasks for NPCTypeID: %d", NPCTypeID);
// If the client has no tasks, there is nothing further to check.
@@ -1505,7 +1509,7 @@ bool ClientTaskState::UpdateTasksByNPC(Client *c, int ActivityType, int NPCTypeI
if(Task->Activity[j].Type != ActivityType) continue;
// Is there a zone restriction on the activity ?
if((Task->Activity[j].ZoneID >0) && (Task->Activity[j].ZoneID != (int)zone->GetZoneID())) {
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Char: %s Task: %i, Activity %i, Activity type %i for NPC %i failed zone check",
Log(Logs::General, Logs::Tasks, "[UPDATE] Char: %s Task: %i, Activity %i, Activity type %i for NPC %i failed zone check",
c->GetName(), ActiveTasks[i].TaskID, j, ActivityType, NPCTypeID);
continue;
}
@@ -1526,7 +1530,7 @@ bool ClientTaskState::UpdateTasksByNPC(Client *c, int ActivityType, int NPCTypeI
continue;
}
// We found an active task to kill this type of NPC, so increment the done count
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Calling increment done count ByNPC");
Log(Logs::General, Logs::Tasks, "[UPDATE] Calling increment done count ByNPC");
IncrementDoneCount(c, Task, i, j);
Ret = true;
}
@@ -1605,7 +1609,7 @@ void ClientTaskState::UpdateTasksForItem(Client *c, ActivityType Type, int ItemI
// If the client has no tasks, there is nothing further to check.
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] ClientTaskState::UpdateTasksForItem(%d,%d)", Type, ItemID);
Log(Logs::General, Logs::Tasks, "[UPDATE] ClientTaskState::UpdateTasksForItem(%d,%d)", Type, ItemID);
if(ActiveTaskCount == 0) return;
@@ -1625,7 +1629,7 @@ void ClientTaskState::UpdateTasksForItem(Client *c, ActivityType Type, int ItemI
if(Task->Activity[j].Type != (int)Type) continue;
// Is there a zone restriction on the activity ?
if((Task->Activity[j].ZoneID >0) && (Task->Activity[j].ZoneID != (int)zone->GetZoneID())) {
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Char: %s Activity type %i for Item %i failed zone check",
Log(Logs::General, Logs::Tasks, "[UPDATE] Char: %s Activity type %i for Item %i failed zone check",
c->GetName(), Type, ItemID);
continue;
}
@@ -1646,7 +1650,7 @@ void ClientTaskState::UpdateTasksForItem(Client *c, ActivityType Type, int ItemI
continue;
}
// We found an active task related to this item, so increment the done count
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Calling increment done count ForItem");
Log(Logs::General, Logs::Tasks, "[UPDATE] Calling increment done count ForItem");
IncrementDoneCount(c, Task, i, j, Count);
}
}
@@ -1658,7 +1662,7 @@ void ClientTaskState::UpdateTasksOnExplore(Client *c, int ExploreID) {
// If the client has no tasks, there is nothing further to check.
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] ClientTaskState::UpdateTasksOnExplore(%i)", ExploreID);
Log(Logs::General, Logs::Tasks, "[UPDATE] ClientTaskState::UpdateTasksOnExplore(%i)", ExploreID);
if(ActiveTaskCount == 0) return;
for(int i=0; i<MAXACTIVETASKS; i++) {
@@ -1676,7 +1680,7 @@ void ClientTaskState::UpdateTasksOnExplore(Client *c, int ExploreID) {
// We are only interested in explore activities
if(Task->Activity[j].Type != ActivityExplore) continue;
if((Task->Activity[j].ZoneID >0) && (Task->Activity[j].ZoneID != (int)zone->GetZoneID())) {
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Char: %s Explore exploreid %i failed zone check",
Log(Logs::General, Logs::Tasks, "[UPDATE] Char: %s Explore exploreid %i failed zone check",
c->GetName(), ExploreID);
continue;
}
@@ -1698,7 +1702,7 @@ void ClientTaskState::UpdateTasksOnExplore(Client *c, int ExploreID) {
}
// We found an active task to explore this area, so set done count to goal count
// (Only a goal count of 1 makes sense for explore activities?)
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Increment on explore");
Log(Logs::General, Logs::Tasks, "[UPDATE] Increment on explore");
IncrementDoneCount(c, Task, i, j,
Task->Activity[j].GoalCount - ActiveTasks[i].Activity[j].DoneCount);
@@ -1712,7 +1716,7 @@ bool ClientTaskState::UpdateTasksOnDeliver(Client *c, std::list<EQEmu::ItemInsta
bool Ret = false;
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] ClientTaskState::UpdateTasksForOnDeliver(%d)", NPCTypeID);
Log(Logs::General, Logs::Tasks, "[UPDATE] ClientTaskState::UpdateTasksForOnDeliver(%d)", NPCTypeID);
if(ActiveTaskCount == 0) return false;
@@ -1733,7 +1737,7 @@ bool ClientTaskState::UpdateTasksOnDeliver(Client *c, std::list<EQEmu::ItemInsta
(Task->Activity[j].Type != ActivityGiveCash)) continue;
// Is there a zone restriction on the activity ?
if((Task->Activity[j].ZoneID >0) && (Task->Activity[j].ZoneID != (int)zone->GetZoneID())) {
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Char: %s Deliver activity failed zone check (current zone %i, need zone %i",
Log(Logs::General, Logs::Tasks, "[UPDATE] Char: %s Deliver activity failed zone check (current zone %i, need zone %i",
c->GetName(), zone->GetZoneID(), Task->Activity[j].ZoneID);
continue;
}
@@ -1742,7 +1746,7 @@ bool ClientTaskState::UpdateTasksOnDeliver(Client *c, std::list<EQEmu::ItemInsta
// Is the activity related to these items ?
//
if((Task->Activity[j].Type == ActivityGiveCash) && Cash) {
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Increment on GiveCash");
Log(Logs::General, Logs::Tasks, "[UPDATE] Increment on GiveCash");
IncrementDoneCount(c, Task, i, j, Cash);
Ret = true;
}
@@ -1764,7 +1768,7 @@ bool ClientTaskState::UpdateTasksOnDeliver(Client *c, std::list<EQEmu::ItemInsta
continue;
}
// We found an active task related to this item, so increment the done count
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Increment on GiveItem");
Log(Logs::General, Logs::Tasks, "[UPDATE] Increment on GiveItem");
IncrementDoneCount(c, Task, i, j, k->GetCharges() <= 0 ? 1 : k->GetCharges());
Ret = true;
}
@@ -1779,7 +1783,7 @@ void ClientTaskState::UpdateTasksOnTouch(Client *c, int ZoneID) {
// If the client has no tasks, there is nothing further to check.
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] ClientTaskState::UpdateTasksOnTouch(%i)", ZoneID);
Log(Logs::General, Logs::Tasks, "[UPDATE] ClientTaskState::UpdateTasksOnTouch(%i)", ZoneID);
if(ActiveTaskCount == 0) return;
for(int i=0; i<MAXACTIVETASKS; i++) {
@@ -1798,13 +1802,13 @@ void ClientTaskState::UpdateTasksOnTouch(Client *c, int ZoneID) {
if(Task->Activity[j].Type != ActivityTouch) continue;
if(Task->Activity[j].GoalMethod != METHODSINGLEID) continue;
if(Task->Activity[j].ZoneID != ZoneID) {
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Char: %s Touch activity failed zone check",
Log(Logs::General, Logs::Tasks, "[UPDATE] Char: %s Touch activity failed zone check",
c->GetName());
continue;
}
// We found an active task to zone into this zone, so set done count to goal count
// (Only a goal count of 1 makes sense for touch activities?)
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Increment on Touch");
Log(Logs::General, Logs::Tasks, "[UPDATE] Increment on Touch");
IncrementDoneCount(c, Task, i, j,
Task->Activity[j].GoalCount - ActiveTasks[i].Activity[j].DoneCount);
}
@@ -1814,7 +1818,7 @@ void ClientTaskState::UpdateTasksOnTouch(Client *c, int ZoneID) {
}
void ClientTaskState::IncrementDoneCount(Client *c, TaskInformation* Task, int TaskIndex, int ActivityID, int Count, bool ignore_quest_update) {
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] IncrementDoneCount");
Log(Logs::General, Logs::Tasks, "[UPDATE] IncrementDoneCount");
ActiveTasks[TaskIndex].Activity[ActivityID].DoneCount += Count;
@@ -1831,7 +1835,7 @@ void ClientTaskState::IncrementDoneCount(Client *c, TaskInformation* Task, int T
ActiveTasks[TaskIndex].Activity[ActivityID].Updated=true;
// Have we reached the goal count for this activity ?
if(ActiveTasks[TaskIndex].Activity[ActivityID].DoneCount >= Task->Activity[ActivityID].GoalCount) {
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Done (%i) = Goal (%i) for Activity %i",
Log(Logs::General, Logs::Tasks, "[UPDATE] Done (%i) = Goal (%i) for Activity %i",
ActiveTasks[TaskIndex].Activity[ActivityID].DoneCount,
Task->Activity[ActivityID].GoalCount,
ActivityID);
@@ -1840,7 +1844,7 @@ void ClientTaskState::IncrementDoneCount(Client *c, TaskInformation* Task, int T
ActiveTasks[TaskIndex].Activity[ActivityID].State = ActivityCompleted;
// Unlock subsequent activities for this task
bool TaskComplete = UnlockActivities(c->CharacterID(), TaskIndex);
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] TaskCompleted is %i", TaskComplete);
Log(Logs::General, Logs::Tasks, "[UPDATE] TaskCompleted is %i", TaskComplete);
// and by the 'Task Stage Completed' message
c->SendTaskActivityComplete(ActiveTasks[TaskIndex].TaskID, ActivityID, TaskIndex);
// Send the updated task/activity list to the client
@@ -2017,7 +2021,7 @@ bool ClientTaskState::IsTaskActive(int TaskID) {
void ClientTaskState::FailTask(Client *c, int TaskID) {
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] FailTask %i, ActiveTaskCount is %i", TaskID, ActiveTaskCount);
Log(Logs::General, Logs::Tasks, "[UPDATE] FailTask %i, ActiveTaskCount is %i", TaskID, ActiveTaskCount);
if(ActiveTaskCount == 0) return;
for(int i=0; i<MAXACTIVETASKS; i++) {
@@ -2035,7 +2039,7 @@ void ClientTaskState::FailTask(Client *c, int TaskID) {
bool ClientTaskState::IsTaskActivityActive(int TaskID, int ActivityID) {
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] ClientTaskState IsTaskActivityActive(%i, %i).", TaskID, ActivityID);
Log(Logs::General, Logs::Tasks, "[UPDATE] ClientTaskState IsTaskActivityActive(%i, %i).", TaskID, ActivityID);
// Quick sanity check
if(ActivityID<0) return false;
if(ActiveTaskCount == 0) return false;
@@ -2060,7 +2064,7 @@ bool ClientTaskState::IsTaskActivityActive(int TaskID, int ActivityID) {
// The ActivityID is out of range
if(ActivityID >= Task->ActivityCount) return false;
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] ClientTaskState IsTaskActivityActive(%i, %i). State is %i ", TaskID, ActivityID,
Log(Logs::General, Logs::Tasks, "[UPDATE] ClientTaskState IsTaskActivityActive(%i, %i). State is %i ", TaskID, ActivityID,
ActiveTasks[ActiveTaskIndex].Activity[ActivityID].State);
@@ -2071,7 +2075,7 @@ bool ClientTaskState::IsTaskActivityActive(int TaskID, int ActivityID) {
void ClientTaskState::UpdateTaskActivity(Client *c, int TaskID, int ActivityID, int Count, bool ignore_quest_update /*= false*/)
{
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] ClientTaskState UpdateTaskActivity(%i, %i, %i).", TaskID, ActivityID, Count);
Log(Logs::General, Logs::Tasks, "[UPDATE] ClientTaskState UpdateTaskActivity(%i, %i, %i).", TaskID, ActivityID, Count);
// Quick sanity check
if((ActivityID<0) || (ActiveTaskCount==0)) return;
@@ -2098,14 +2102,14 @@ void ClientTaskState::UpdateTaskActivity(Client *c, int TaskID, int ActivityID,
// The Activity is not currently active
if(ActiveTasks[ActiveTaskIndex].Activity[ActivityID].State != ActivityActive) return;
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Increment done count on UpdateTaskActivity");
Log(Logs::General, Logs::Tasks, "[UPDATE] Increment done count on UpdateTaskActivity");
IncrementDoneCount(c, Task, ActiveTaskIndex, ActivityID, Count, ignore_quest_update);
}
void ClientTaskState::ResetTaskActivity(Client *c, int TaskID, int ActivityID) {
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] ClientTaskState UpdateTaskActivity(%i, %i, 0).", TaskID, ActivityID);
Log(Logs::General, Logs::Tasks, "[UPDATE] ClientTaskState UpdateTaskActivity(%i, %i, 0).", TaskID, ActivityID);
// Quick sanity check
if((ActivityID<0) || (ActiveTaskCount==0)) return;
@@ -2133,7 +2137,7 @@ void ClientTaskState::ResetTaskActivity(Client *c, int TaskID, int ActivityID) {
// The Activity is not currently active
if(ActiveTasks[ActiveTaskIndex].Activity[ActivityID].State != ActivityActive) return;
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] ResetTaskActivityCount");
Log(Logs::General, Logs::Tasks, "[UPDATE] ResetTaskActivityCount");
ActiveTasks[ActiveTaskIndex].Activity[ActivityID].DoneCount = 0;
@@ -2199,7 +2203,7 @@ int ClientTaskState::IsTaskCompleted(int TaskID) {
if(!(RuleB(TaskSystem, RecordCompletedTasks))) return -1;
for(unsigned int i=0; i<CompletedTasks.size(); i++) {
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Comparing completed task %i with %i", CompletedTasks[i].TaskID, TaskID);
Log(Logs::General, Logs::Tasks, "[UPDATE] Comparing completed task %i with %i", CompletedTasks[i].TaskID, TaskID);
if(CompletedTasks[i].TaskID == TaskID) return 1;
}
@@ -2301,7 +2305,7 @@ void Client::SendTaskComplete(int TaskIndex) {
void ClientTaskState::SendTaskHistory(Client *c, int TaskIndex) {
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Task History Requested for Completed Task Index %i", TaskIndex);
Log(Logs::General, Logs::Tasks, "[UPDATE] Task History Requested for Completed Task Index %i", TaskIndex);
// We only sent the most recent 50 completed tasks, so we need to offset the Index the client sent to us.
@@ -2428,7 +2432,7 @@ void Client::SendTaskFailed(int TaskID, int TaskIndex) {
//tac->unknown5 = 0x00000001;
tac->unknown5 = 0; // 0 for task complete or failed.
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] TaskFailed");
Log(Logs::General, Logs::Tasks, "[UPDATE] TaskFailed");
QueuePacket(outapp);
safe_delete(outapp);
@@ -2449,7 +2453,7 @@ void TaskManager::SendCompletedTasksToClient(Client *c, ClientTaskState *State)
if(State->CompletedTasks.size() > 50)
FirstTaskToSend = State->CompletedTasks.size() - 50;
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Completed Task Count: %i, First Task to send is %i, Last is %i",
Log(Logs::General, Logs::Tasks, "[UPDATE] Completed Task Count: %i, First Task to send is %i, Last is %i",
State->CompletedTasks.size(), FirstTaskToSend, LastTaskToSend);
/*
for(iterator=State->CompletedTasks.begin(); iterator!=State->CompletedTasks.end(); iterator++) {
@@ -2706,12 +2710,12 @@ void TaskManager::SendActiveTasksToClient(Client *c, bool TaskComplete) {
int StartTime = c->GetTaskStartTime(TaskIndex);
SendActiveTaskDescription(c, TaskID, TaskIndex, StartTime, Tasks[TaskID]->Duration, false);
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] SendActiveTasksToClient: Task %i, Activities: %i", TaskID, GetActivityCount(TaskID));
Log(Logs::General, Logs::Tasks, "[UPDATE] SendActiveTasksToClient: Task %i, Activities: %i", TaskID, GetActivityCount(TaskID));
int Sequence = 0;
for(int Activity=0; Activity<GetActivityCount(TaskID); Activity++) {
if(c->GetTaskActivityState(TaskIndex, Activity) != ActivityHidden) {
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Long: %i, %i, %i Complete=%i", TaskID, Activity, TaskIndex, TaskComplete);
Log(Logs::General, Logs::Tasks, "[UPDATE] Long: %i, %i, %i Complete=%i", TaskID, Activity, TaskIndex, TaskComplete);
if(Activity==GetActivityCount(TaskID)-1)
SendTaskActivityLong(c, TaskID, Activity, TaskIndex,
Tasks[TaskID]->Activity[Activity].Optional,
@@ -2721,7 +2725,7 @@ void TaskManager::SendActiveTasksToClient(Client *c, bool TaskComplete) {
Tasks[TaskID]->Activity[Activity].Optional, 0);
}
else {
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Short: %i, %i, %i", TaskID, Activity, TaskIndex);
Log(Logs::General, Logs::Tasks, "[UPDATE] Short: %i, %i, %i", TaskID, Activity, TaskIndex);
SendTaskActivityShort(c, TaskID, Activity, TaskIndex);
}
Sequence++;
@@ -2742,13 +2746,13 @@ void TaskManager::SendSingleActiveTaskToClient(Client *c, int TaskIndex, bool Ta
int StartTime = c->GetTaskStartTime(TaskIndex);
SendActiveTaskDescription(c, TaskID, TaskIndex, StartTime, Tasks[TaskID]->Duration, BringUpTaskJournal);
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] SendSingleActiveTasksToClient: Task %i, Activities: %i", TaskID, GetActivityCount(TaskID));
Log(Logs::General, Logs::Tasks, "[UPDATE] SendSingleActiveTasksToClient: Task %i, Activities: %i", TaskID, GetActivityCount(TaskID));
int Sequence = 0;
for(int Activity=0; Activity<GetActivityCount(TaskID); Activity++) {
if(c->GetTaskActivityState(TaskIndex, Activity) != ActivityHidden) {
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Long: %i, %i, %i Complete=%i", TaskID, Activity, TaskIndex, TaskComplete);
Log(Logs::General, Logs::Tasks, "[UPDATE] Long: %i, %i, %i Complete=%i", TaskID, Activity, TaskIndex, TaskComplete);
if(Activity==GetActivityCount(TaskID)-1)
SendTaskActivityLong(c, TaskID, Activity, TaskIndex,
Tasks[TaskID]->Activity[Activity].Optional, TaskComplete);
@@ -2757,7 +2761,7 @@ void TaskManager::SendSingleActiveTaskToClient(Client *c, int TaskIndex, bool Ta
Tasks[TaskID]->Activity[Activity].Optional, 0);
}
else {
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Short: %i, %i, %i", TaskID, Activity, TaskIndex);
Log(Logs::General, Logs::Tasks, "[UPDATE] Short: %i, %i, %i", TaskID, Activity, TaskIndex);
SendTaskActivityShort(c, TaskID, Activity, TaskIndex);
}
Sequence++;
@@ -2944,7 +2948,7 @@ void ClientTaskState::CancelTask(Client *c, int SequenceNumber, bool RemoveFromD
cts->SequenceNumber = SequenceNumber;
cts->unknown4 = 0x00000002;
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] CancelTask");
Log(Logs::General, Logs::Tasks, "[UPDATE] CancelTask");
c->QueuePacket(outapp);
safe_delete(outapp);
@@ -2956,24 +2960,24 @@ void ClientTaskState::CancelTask(Client *c, int SequenceNumber, bool RemoveFromD
void ClientTaskState::RemoveTask(Client *c, int sequenceNumber) {
int characterID = c->CharacterID();
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] ClientTaskState Cancel Task %i ", sequenceNumber);
Log(Logs::General, Logs::Tasks, "[UPDATE] ClientTaskState Cancel Task %i ", sequenceNumber);
std::string query = StringFormat("DELETE FROM character_activities WHERE charid=%i AND taskid = %i",
characterID, ActiveTasks[sequenceNumber].TaskID);
auto results = database.QueryDatabase(query);
if(!results.Success()) {
Log.Out(Logs::General, Logs::Error, "[TASKS] Error in CientTaskState::CancelTask %s", results.ErrorMessage().c_str());
Log(Logs::General, Logs::Error, "[TASKS] Error in CientTaskState::CancelTask %s", results.ErrorMessage().c_str());
return;
}
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] CancelTask: %s", query.c_str());
Log(Logs::General, Logs::Tasks, "[UPDATE] CancelTask: %s", query.c_str());
query = StringFormat("DELETE FROM character_tasks WHERE charid=%i AND taskid = %i",
characterID, ActiveTasks[sequenceNumber].TaskID);
results = database.QueryDatabase(query);
if(!results.Success())
Log.Out(Logs::General, Logs::Error, "[TASKS] Error in CientTaskState::CancelTask %s", results.ErrorMessage().c_str());
Log(Logs::General, Logs::Error, "[TASKS] Error in CientTaskState::CancelTask %s", results.ErrorMessage().c_str());
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] CancelTask: %s", query.c_str());
Log(Logs::General, Logs::Tasks, "[UPDATE] CancelTask: %s", query.c_str());
ActiveTasks[sequenceNumber].TaskID = TASKSLOTEMPTY;
ActiveTaskCount--;
@@ -3020,7 +3024,7 @@ void ClientTaskState::AcceptNewTask(Client *c, int TaskID, int NPCID, bool enfor
//
int FreeSlot = -1;
for(int i=0; i<MAXACTIVETASKS; i++) {
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] ClientTaskState Looking for free slot in slot %i, found TaskID of %i",
Log(Logs::General, Logs::Tasks, "[UPDATE] ClientTaskState Looking for free slot in slot %i, found TaskID of %i",
i, ActiveTasks[i].TaskID);
if(ActiveTasks[i].TaskID == 0) {
FreeSlot = i;
@@ -3075,11 +3079,11 @@ void ClientTaskState::ProcessTaskProximities(Client *c, float X, float Y, float
if((LastX==X) && (LastY==Y) && (LastZ==Z)) return;
Log.Out(Logs::General, Logs::Tasks, "[PROXIMITY] Checking proximities for Position %8.3f, %8.3f, %8.3f", X, Y, Z);
Log(Logs::General, Logs::Tasks, "[PROXIMITY] Checking proximities for Position %8.3f, %8.3f, %8.3f", X, Y, Z);
int ExploreID = taskmanager->ProximityManager.CheckProximities(X, Y, Z);
if(ExploreID > 0) {
Log.Out(Logs::General, Logs::Tasks, "[PROXIMITY] Position %8.3f, %8.3f, %8.3f is within proximity %i", X, Y, Z, ExploreID);
Log(Logs::General, Logs::Tasks, "[PROXIMITY] Position %8.3f, %8.3f, %8.3f is within proximity %i", X, Y, Z, ExploreID);
UpdateTasksOnExplore(c, ExploreID);
}
}
@@ -3103,7 +3107,7 @@ TaskGoalListManager::~TaskGoalListManager() {
bool TaskGoalListManager::LoadLists() {
Log.Out(Logs::General, Logs::Tasks, "[GLOBALLOAD] TaskGoalListManager::LoadLists Called");
Log(Logs::General, Logs::Tasks, "[GLOBALLOAD] TaskGoalListManager::LoadLists Called");
for(int i=0; i< NumberOfLists; i++)
safe_delete_array(TaskGoalLists[i].GoalItemEntries);
@@ -3122,7 +3126,7 @@ bool TaskGoalListManager::LoadLists() {
}
NumberOfLists = results.RowCount();
Log.Out(Logs::General, Logs::Tasks, "[GLOBALLOAD] Database returned a count of %i lists", NumberOfLists);
Log(Logs::General, Logs::Tasks, "[GLOBALLOAD] Database returned a count of %i lists", NumberOfLists);
TaskGoalLists = new TaskGoalList_Struct[NumberOfLists];
@@ -3235,7 +3239,7 @@ std::vector<int> TaskGoalListManager::GetListContents(int ListID) {
bool TaskGoalListManager::IsInList(int ListID, int Entry) {
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] TaskGoalListManager::IsInList(%i, %i)", ListID, Entry);
Log(Logs::General, Logs::Tasks, "[UPDATE] TaskGoalListManager::IsInList(%i, %i)", ListID, Entry);
int ListIndex = GetListByID(ListID);
@@ -3255,7 +3259,7 @@ bool TaskGoalListManager::IsInList(int ListID, int Entry) {
else if(Entry < TaskGoalLists[ListIndex].GoalItemEntries[MiddleEntry])
LastEntry = MiddleEntry - 1;
else {
Log.Out(Logs::General, Logs::Tasks, "[UPDATE] TaskGoalListManager::IsInList(%i, %i) returning true", ListIndex, Entry);
Log(Logs::General, Logs::Tasks, "[UPDATE] TaskGoalListManager::IsInList(%i, %i) returning true", ListIndex, Entry);
return true;
}
@@ -3278,7 +3282,7 @@ TaskProximityManager::~TaskProximityManager() {
bool TaskProximityManager::LoadProximities(int zoneID) {
TaskProximity proximity;
Log.Out(Logs::General, Logs::Tasks, "[GLOBALLOAD] TaskProximityManager::LoadProximities Called for zone %i", zoneID);
Log(Logs::General, Logs::Tasks, "[GLOBALLOAD] TaskProximityManager::LoadProximities Called for zone %i", zoneID);
TaskProximities.clear();
std::string query = StringFormat("SELECT `exploreid`, `minx`, `maxx`, "
@@ -3312,7 +3316,7 @@ int TaskProximityManager::CheckProximities(float X, float Y, float Z) {
TaskProximity* P = &TaskProximities[i];
Log.Out(Logs::General, Logs::Tasks, "[PROXIMITY] Checking %8.3f, %8.3f, %8.3f against %8.3f, %8.3f, %8.3f, %8.3f, %8.3f, %8.3f",
Log(Logs::General, Logs::Tasks, "[PROXIMITY] Checking %8.3f, %8.3f, %8.3f against %8.3f, %8.3f, %8.3f, %8.3f, %8.3f, %8.3f",
X, Y, Z, P->MinX, P->MaxX, P->MinY, P->MaxY, P->MinZ, P->MaxZ);
if(X < P->MinX || X > P->MaxX || Y < P->MinY || Y > P->MaxY ||
+1 -1
View File
@@ -349,7 +349,7 @@ void Client::EnableTitle(int titleSet) {
CharacterID(), titleSet);
auto results = database.QueryDatabase(query);
if(!results.Success())
Log.Out(Logs::General, Logs::Error, "Error in EnableTitle query for titleset %i and charid %i", titleSet, CharacterID());
Log(Logs::General, Logs::Error, "Error in EnableTitle query for titleset %i and charid %i", titleSet, CharacterID());
}
+33 -33
View File
@@ -42,7 +42,7 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme
{
if (!user || !in_augment)
{
Log.Out(Logs::General, Logs::Error, "Client or AugmentItem_Struct not set in Object::HandleAugmentation");
Log(Logs::General, Logs::Error, "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.Out(Logs::General, Logs::Error, "Player tried to augment an item without a container set.");
Log(Logs::General, Logs::Error, "Player tried to augment an item without a container set.");
user->Message(13, "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.Out(Logs::General, Logs::Error, "Player tried to remove an augment without a solvent or distiller.");
Log(Logs::General, Logs::Error, "Player tried to remove an augment without a solvent or distiller.");
user->Message(13, "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.Out(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);
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);
user->Message(13, "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.Out(Logs::General, Logs::Error, "Client or NewCombine_Struct not set in Object::HandleCombine");
Log(Logs::General, Logs::Error, "Client or NewCombine_Struct not set in Object::HandleCombine");
return;
}
@@ -427,7 +427,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.Out(Logs::General, Logs::Error, "Replace container combine executed in a world container.");
Log(Logs::General, Logs::Error, "Replace container combine executed in a world container.");
}
else
user->DeleteItemInInventory(in_combine->container_slot, 0, true);
@@ -453,7 +453,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.Out(Logs::General, Logs::Error, "Unknown recipe for HandleAutoCombine: %u\n", rac->recipe_id);
Log(Logs::General, Logs::Error, "Unknown recipe for HandleAutoCombine: %u\n", rac->recipe_id);
user->QueuePacket(outapp);
safe_delete(outapp);
return;
@@ -482,14 +482,14 @@ void Object::HandleAutoCombine(Client* user, const RecipeAutoCombine_Struct* rac
}
if(results.RowCount() < 1) {
Log.Out(Logs::General, Logs::Error, "Error in HandleAutoCombine: no components returned");
Log(Logs::General, Logs::Error, "Error in HandleAutoCombine: no components returned");
user->QueuePacket(outapp);
safe_delete(outapp);
return;
}
if(results.RowCount() > 10) {
Log.Out(Logs::General, Logs::Error, "Error in HandleAutoCombine: too many components returned (%u)", results.RowCount());
Log(Logs::General, Logs::Error, "Error in HandleAutoCombine: too many components returned (%u)", results.RowCount());
user->QueuePacket(outapp);
safe_delete(outapp);
return;
@@ -700,7 +700,7 @@ void Client::TradeskillSearchResults(const std::string &query, unsigned long obj
return; //search gave no results... not an error
if(results.ColumnCount() != 6) {
Log.Out(Logs::General, Logs::Error, "Error in TradeskillSearchResults query '%s': Invalid column count in result", query.c_str());
Log(Logs::General, Logs::Error, "Error in TradeskillSearchResults query '%s': Invalid column count in result", query.c_str());
return;
}
@@ -750,12 +750,12 @@ void Client::SendTradeskillDetails(uint32 recipe_id) {
}
if(results.RowCount() < 1) {
Log.Out(Logs::General, Logs::Error, "Error in SendTradeskillDetails: no components returned");
Log(Logs::General, Logs::Error, "Error in SendTradeskillDetails: no components returned");
return;
}
if(results.RowCount() > 10) {
Log.Out(Logs::General, Logs::Error, "Error in SendTradeskillDetails: too many components returned (%u)", results.RowCount());
Log(Logs::General, Logs::Error, "Error in SendTradeskillDetails: too many components returned (%u)", results.RowCount());
return;
}
@@ -934,7 +934,7 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) {
//handle caps
if(spec->nofail) {
chance = 100; //cannot fail.
Log.Out(Logs::Detail, Logs::Tradeskills, "...This combine cannot fail.");
Log(Logs::Detail, Logs::Tradeskills, "...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.
@@ -954,8 +954,8 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) {
chance = 95;
}
Log.Out(Logs::Detail, Logs::Tradeskills, "...Current skill: %d , Trivial: %d , Success chance: %f percent", user_skill , spec->trivial , chance);
Log.Out(Logs::Detail, Logs::Tradeskills, "...Bonusstat: %d , INT: %d , WIS: %d , DEX: %d , STR: %d", bonusstat , GetINT() , GetWIS() , GetDEX() , GetSTR());
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());
float res = zone->random.Real(0, 99);
int aa_chance = 0;
@@ -974,7 +974,7 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) {
Message_StringID(4, TRADESKILL_SUCCEED, spec->name.c_str());
Log.Out(Logs::Detail, Logs::Tradeskills, "Tradeskill success");
Log(Logs::Detail, Logs::Tradeskills, "Tradeskill success");
itr = spec->onsuccess.begin();
while(itr != spec->onsuccess.end() && !spec->quest) {
@@ -1006,7 +1006,7 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) {
Message_StringID(MT_Emote,TRADESKILL_FAILED);
Log.Out(Logs::Detail, Logs::Tradeskills, "Tradeskill failed");
Log(Logs::Detail, Logs::Tradeskills, "Tradeskill failed");
if (this->GetGroup())
{
entity_list.MessageGroup(this,true,MT_Skills,"%s was unsuccessful in %s tradeskill attempt.",GetName(),this->GetGender() == 0 ? "his" : this->GetGender() == 1 ? "her" : "its");
@@ -1085,9 +1085,9 @@ void Client::CheckIncreaseTradeskill(int16 bonusstat, int16 stat_modifier, float
NotifyNewTitlesAvailable();
}
Log.Out(Logs::Detail, Logs::Tradeskills, "...skillup_modifier: %f , success_modifier: %d , stat modifier: %d", skillup_modifier , success_modifier , stat_modifier);
Log.Out(Logs::Detail, Logs::Tradeskills, "...Stage1 chance was: %f percent", chance_stage1);
Log.Out(Logs::Detail, Logs::Tradeskills, "...Stage2 chance was: %f percent. 0 percent means stage1 failed", chance_stage2);
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);
}
bool ZoneDatabase::GetTradeRecipe(const EQEmu::ItemInstance* container, uint8 c_type, uint32 some_id,
@@ -1140,8 +1140,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.Out(Logs::General, Logs::Error, "Error in GetTradeRecipe search, query: %s", query.c_str());
Log.Out(Logs::General, Logs::Error, "Error in GetTradeRecipe search, error: %s", results.ErrorMessage().c_str());
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());
return false;
}
@@ -1162,7 +1162,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.Out(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());
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());
break;
}
}
@@ -1174,8 +1174,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.Out(Logs::General, Logs::Error, "Error in GetTradeRecipe, re-query: %s", query.c_str());
Log.Out(Logs::General, Logs::Error, "Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str());
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());
return false;
}
}
@@ -1200,18 +1200,18 @@ bool ZoneDatabase::GetTradeRecipe(const EQEmu::ItemInstance* container, uint8 c_
"AND tre.item_id = %u;", buf2.c_str(), containerId);
results = QueryDatabase(query);
if (!results.Success()) {
Log.Out(Logs::General, Logs::Error, "Error in GetTradeRecipe, re-query: %s", query.c_str());
Log.Out(Logs::General, Logs::Error, "Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str());
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());
return false;
}
if(results.RowCount() == 0) { //Recipe contents matched more than 1 recipe, but not in this container
Log.Out(Logs::General, Logs::Error, "Combine error: Incorrect container is being used!");
Log(Logs::General, Logs::Error, "Combine error: Incorrect container is being used!");
return false;
}
if (results.RowCount() > 1) //Recipe contents matched more than 1 recipe in this container
Log.Out(Logs::General, Logs::Error, "Combine error: Recipe is not unique! %u matches found for container %u. Continuing with first recipe match.", results.RowCount(), containerId);
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);
}
@@ -1282,8 +1282,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.Out(Logs::General, Logs::Error, "Error in GetTradeRecipe, query: %s", query.c_str());
Log.Out(Logs::General, Logs::Error, "Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str());
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());
return false;
}
@@ -1318,7 +1318,7 @@ bool ZoneDatabase::GetTradeRecipe(uint32 recipe_id, uint8 c_type, uint32 some_id
}
if(results.RowCount() < 1 && !spec->quest) {
Log.Out(Logs::General, Logs::Error, "Error in GetTradeRecept success: no success items returned");
Log(Logs::General, Logs::Error, "Error in GetTradeRecept success: no success items returned");
return false;
}
@@ -1385,7 +1385,7 @@ void Client::LearnRecipe(uint32 recipeID)
}
if (results.RowCount() != 1) {
Log.Out(Logs::General, Logs::Normal, "Client::LearnRecipe - RecipeID: %d had %d occurences.", recipeID, results.RowCount());
Log(Logs::General, Logs::Normal, "Client::LearnRecipe - RecipeID: %d had %d occurences.", recipeID, results.RowCount());
return;
}
+62 -62
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.Out(Logs::General, Logs::None, "Programming error: NPC's should not call Trade::AddEntity()");
Log(Logs::General, Logs::None, "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.Out(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);
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);
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.Out(Logs::Detail, Logs::Trading, "%s added item '%s' to trade slot %i", owner->GetName(), inst->GetItem()->Name, trade_slot_id);
Log(Logs::Detail, Logs::Trading, "%s added item '%s' to trade slot %i", owner->GetName(), inst->GetItem()->Name, trade_slot_id);
client->PutItemInInventory(trade_slot_id, *inst);
client->DeleteItemInInventory(EQEmu::inventory::slotCursor);
@@ -297,7 +297,7 @@ void Trade::LogTrade()
void Trade::DumpTrade()
{
Mob* with = With();
Log.Out(Logs::Detail, Logs::Trading, "Dumping trade data: '%s' in TradeState %i with '%s'",
Log(Logs::Detail, Logs::Trading, "Dumping trade data: '%s' in TradeState %i with '%s'",
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.Out(Logs::Detail, Logs::Trading, "Item %i (Charges=%i, Slot=%i, IsBag=%s)",
Log(Logs::Detail, Logs::Trading, "Item %i (Charges=%i, Slot=%i, IsBag=%s)",
inst->GetItem()->ID, inst->GetCharges(),
i, ((inst->IsClassBag()) ? "True" : "False"));
@@ -316,7 +316,7 @@ void Trade::DumpTrade()
for (uint8 j = EQEmu::inventory::containerBegin; j < EQEmu::inventory::ContainerCount; j++) {
inst = trader->GetInv().GetItem(i, j);
if (inst) {
Log.Out(Logs::Detail, Logs::Trading, "\tBagItem %i (Charges=%i, Slot=%i)",
Log(Logs::Detail, Logs::Trading, "\tBagItem %i (Charges=%i, Slot=%i)",
inst->GetItem()->ID, inst->GetCharges(),
EQEmu::InventoryProfile::CalcSlotId(i, j));
}
@@ -325,7 +325,7 @@ void Trade::DumpTrade()
}
}
Log.Out(Logs::Detail, Logs::Trading, "\tpp:%i, gp:%i, sp:%i, cp:%i", pp, gp, sp, cp);
Log(Logs::Detail, Logs::Trading, "\tpp:%i, gp:%i, sp:%i, cp:%i", pp, gp, sp, cp);
}
@@ -369,7 +369,7 @@ void Client::ResetTrade() {
break;
if (partial_inst->GetID() != inst->GetID()) {
Log.Out(Logs::Detail, Logs::None, "[CLIENT] Client::ResetTrade() - an incompatible location reference was returned by Inventory::FindFreeSlotForTradeItem()");
Log(Logs::Detail, Logs::None, "[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.Out(Logs::Detail, Logs::Trading, "Finishing trade with client %s", other->GetName());
Log(Logs::Detail, Logs::Trading, "Finishing trade with client %s", 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.Out(Logs::Detail, Logs::Trading, "Giving container %s (%d) in slot %d to %s", inst->GetItem()->Name, inst->GetItem()->ID, trade_slot, other->GetName());
Log(Logs::Detail, Logs::Trading, "Giving container %s (%d) in slot %d to %s", 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.Out(Logs::Detail, Logs::Trading, "Container %s (%d) successfully transferred, deleting from trade slot.", inst->GetItem()->Name, inst->GetItem()->ID);
Log(Logs::Detail, Logs::Trading, "Container %s (%d) successfully transferred, deleting from trade slot.", inst->GetItem()->Name, inst->GetItem()->ID);
if (qs_log) {
auto detail = new QSTradeItems_Struct;
@@ -553,17 +553,17 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st
}
}
else {
Log.Out(Logs::Detail, Logs::Trading, "Transfer of container %s (%d) to %s failed, returning to giver.", inst->GetItem()->Name, inst->GetItem()->ID, other->GetName());
Log(Logs::Detail, Logs::Trading, "Transfer of container %s (%d) to %s failed, returning to giver.", inst->GetItem()->Name, inst->GetItem()->ID, other->GetName());
PushItemOnCursor(*inst, true);
}
}
else {
Log.Out(Logs::Detail, Logs::Trading, "%s's inventory is full, returning container %s (%d) to giver.", other->GetName(), inst->GetItem()->Name, inst->GetItem()->ID);
Log(Logs::Detail, Logs::Trading, "%s's inventory is full, returning container %s (%d) to giver.", other->GetName(), inst->GetItem()->Name, inst->GetItem()->ID);
PushItemOnCursor(*inst, true);
}
}
else {
Log.Out(Logs::Detail, Logs::Trading, "Container %s (%d) is NoDrop, returning to giver.", inst->GetItem()->Name, inst->GetItem()->ID);
Log(Logs::Detail, Logs::Trading, "Container %s (%d) is NoDrop, returning to giver.", inst->GetItem()->Name, inst->GetItem()->ID);
PushItemOnCursor(*inst, true);
}
@@ -589,7 +589,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st
break;
if (partial_inst->GetID() != inst->GetID()) {
Log.Out(Logs::Detail, Logs::Trading, "[CLIENT] Client::ResetTrade() - an incompatible location reference was returned by Inventory::FindFreeSlotForTradeItem()");
Log(Logs::Detail, Logs::Trading, "[CLIENT] Client::ResetTrade() - an incompatible location reference was returned by Inventory::FindFreeSlotForTradeItem()");
break;
}
@@ -607,10 +607,10 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st
inst->SetCharges(0);
}
Log.Out(Logs::Detail, Logs::Trading, "Transferring partial stack %s (%d) in slot %d to %s", inst->GetItem()->Name, inst->GetItem()->ID, trade_slot, other->GetName());
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());
if (other->PutItemInInventory(partial_slot, *partial_inst, true)) {
Log.Out(Logs::Detail, Logs::Trading, "Partial stack %s (%d) successfully transferred, deleting %i charges from trade slot.",
Log(Logs::Detail, Logs::Trading, "Partial stack %s (%d) successfully transferred, deleting %i charges from trade slot.",
inst->GetItem()->Name, inst->GetItem()->ID, (old_charges - inst->GetCharges()));
if (qs_log) {
auto detail = new QSTradeItems_Struct;
@@ -636,7 +636,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st
}
}
else {
Log.Out(Logs::Detail, Logs::Trading, "Transfer of partial stack %s (%d) to %s failed, returning %i charges to trade slot.",
Log(Logs::Detail, Logs::Trading, "Transfer of partial stack %s (%d) to %s failed, returning %i charges to trade slot.",
inst->GetItem()->Name, inst->GetItem()->ID, other->GetName(), (old_charges - inst->GetCharges()));
inst->SetCharges(old_charges);
@@ -711,7 +711,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st
const EQEmu::ItemInstance* inst = m_inv[trade_slot];
if (inst) {
Log.Out(Logs::Detail, Logs::Trading, "Giving item %s (%d) in slot %d to %s", inst->GetItem()->Name, inst->GetItem()->ID, trade_slot, other->GetName());
Log(Logs::Detail, Logs::Trading, "Giving item %s (%d) in slot %d to %s", 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) {
@@ -719,7 +719,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.Out(Logs::Detail, Logs::Trading, "Item %s (%d) successfully transferred, deleting from trade slot.", inst->GetItem()->Name, inst->GetItem()->ID);
Log(Logs::Detail, Logs::Trading, "Item %s (%d) successfully transferred, deleting from trade slot.", inst->GetItem()->Name, inst->GetItem()->ID);
if (qs_log) {
auto detail = new QSTradeItems_Struct;
@@ -773,17 +773,17 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st
}
}
else {
Log.Out(Logs::Detail, Logs::Trading, "Transfer of Item %s (%d) to %s failed, returning to giver.", inst->GetItem()->Name, inst->GetItem()->ID, other->GetName());
Log(Logs::Detail, Logs::Trading, "Transfer of Item %s (%d) to %s failed, returning to giver.", inst->GetItem()->Name, inst->GetItem()->ID, other->GetName());
PushItemOnCursor(*inst, true);
}
}
else {
Log.Out(Logs::Detail, Logs::Trading, "%s's inventory is full, returning item %s (%d) to giver.", other->GetName(), inst->GetItem()->Name, inst->GetItem()->ID);
Log(Logs::Detail, Logs::Trading, "%s's inventory is full, returning item %s (%d) to giver.", other->GetName(), inst->GetItem()->Name, inst->GetItem()->ID);
PushItemOnCursor(*inst, true);
}
}
else {
Log.Out(Logs::Detail, Logs::Trading, "Item %s (%d) is NoDrop, returning to giver.", inst->GetItem()->Name, inst->GetItem()->ID);
Log(Logs::Detail, Logs::Trading, "Item %s (%d) is NoDrop, returning to giver.", inst->GetItem()->Name, inst->GetItem()->ID);
PushItemOnCursor(*inst, true);
}
@@ -1176,7 +1176,7 @@ void Client::SendTraderItem(uint32 ItemID, uint16 Quantity) {
const EQEmu::ItemData* item = database.GetItem(ItemID);
if(!item){
Log.Out(Logs::Detail, Logs::Trading, "Bogus item deleted in Client::SendTraderItem!\n");
Log(Logs::Detail, Logs::Trading, "Bogus item deleted in Client::SendTraderItem!\n");
return;
}
@@ -1235,10 +1235,10 @@ void Client::BulkSendTraderInventory(uint32 char_id) {
safe_delete(inst);
}
else
Log.Out(Logs::Detail, Logs::Trading, "Client::BulkSendTraderInventory nullptr inst pointer");
Log(Logs::Detail, Logs::Trading, "Client::BulkSendTraderInventory nullptr inst pointer");
}
else
Log.Out(Logs::Detail, Logs::Trading, "Client::BulkSendTraderInventory nullptr item pointer or item is NODROP %8X",item);
Log(Logs::Detail, Logs::Trading, "Client::BulkSendTraderInventory nullptr item pointer or item is NODROP %8X",item);
}
safe_delete(TraderItems);
}
@@ -1261,7 +1261,7 @@ uint32 Client::FindTraderItemSerialNumber(int32 ItemID) {
}
}
}
Log.Out(Logs::Detail, Logs::Trading, "Client::FindTraderItemSerialNumber Couldn't find item! Item ID %i", ItemID);
Log(Logs::Detail, Logs::Trading, "Client::FindTraderItemSerialNumber Couldn't find item! Item ID %i", ItemID);
return 0;
}
@@ -1284,7 +1284,7 @@ EQEmu::ItemInstance* Client::FindTraderItemBySerialNumber(int32 SerialNumber){
}
}
}
Log.Out(Logs::Detail, Logs::Trading, "Client::FindTraderItemBySerialNumber Couldn't find item! Serial No. was %i", SerialNumber);
Log(Logs::Detail, Logs::Trading, "Client::FindTraderItemBySerialNumber Couldn't find item! Serial No. was %i", SerialNumber);
return nullptr;
}
@@ -1341,7 +1341,7 @@ uint16 Client::FindTraderItem(int32 SerialNumber, uint16 Quantity){
}
}
}
Log.Out(Logs::Detail, Logs::Trading, "Could NOT find a match for Item: %i with a quantity of: %i on Trader: %s\n",
Log(Logs::Detail, Logs::Trading, "Could NOT find a match for Item: %i with a quantity of: %i on Trader: %s\n",
SerialNumber , Quantity, this->GetName());
return 0;
@@ -1352,7 +1352,7 @@ void Client::NukeTraderItem(uint16 Slot,int16 Charges,uint16 Quantity,Client* Cu
if(!Customer)
return;
Log.Out(Logs::Detail, Logs::Trading, "NukeTraderItem(Slot %i, Charges %i, Quantity %i", Slot, Charges, Quantity);
Log(Logs::Detail, Logs::Trading, "NukeTraderItem(Slot %i, Charges %i, Quantity %i", Slot, Charges, Quantity);
if(Quantity < Charges)
{
@@ -1439,7 +1439,7 @@ void Client::FindAndNukeTraderItem(int32 SerialNumber, uint16 Quantity, Client*
if (!item)
{
Log.Out(Logs::Detail, Logs::Trading, "Could not find Item: %i on Trader: %s", SerialNumber, Quantity, this->GetName());
Log(Logs::Detail, Logs::Trading, "Could not find Item: %i on Trader: %s", SerialNumber, Quantity, this->GetName());
return;
}
@@ -1450,7 +1450,7 @@ void Client::FindAndNukeTraderItem(int32 SerialNumber, uint16 Quantity, Client*
if (!Stackable)
Quantity = (Charges > 0) ? Charges : 1;
Log.Out(Logs::Detail, Logs::Trading, "FindAndNuke %s, Charges %i, Quantity %i", item->GetItem()->Name, Charges, Quantity);
Log(Logs::Detail, Logs::Trading, "FindAndNuke %s, Charges %i, Quantity %i", item->GetItem()->Name, Charges, Quantity);
if (Charges <= Quantity || (Charges <= 0 && Quantity==1) || !Stackable)
{
@@ -1492,7 +1492,7 @@ void Client::FindAndNukeTraderItem(int32 SerialNumber, uint16 Quantity, Client*
}
}
Log.Out(Logs::Detail, Logs::Trading, "Could NOT find a match for Item: %i with a quantity of: %i on Trader: %s\n",SerialNumber,
Log(Logs::Detail, Logs::Trading, "Could NOT find a match for Item: %i with a quantity of: %i on Trader: %s\n",SerialNumber,
Quantity,this->GetName());
}
@@ -1592,7 +1592,7 @@ void Client::BuyTraderItem(TraderBuy_Struct* tbs, Client* Trader, const EQApplic
BuyItem = Trader->FindTraderItemBySerialNumber(tbs->ItemID);
if(!BuyItem) {
Log.Out(Logs::Detail, Logs::Trading, "Unable to find item on trader.");
Log(Logs::Detail, Logs::Trading, "Unable to find item on trader.");
TradeRequestFailed(app);
safe_delete(outapp);
return;
@@ -1600,7 +1600,7 @@ void Client::BuyTraderItem(TraderBuy_Struct* tbs, Client* Trader, const EQApplic
tbs->Price = BuyItem->GetPrice();
Log.Out(Logs::Detail, Logs::Trading, "Buyitem: Name: %s, IsStackable: %i, Requested Quantity: %i, Charges on Item %i",
Log(Logs::Detail, Logs::Trading, "Buyitem: Name: %s, IsStackable: %i, Requested Quantity: %i, Charges on Item %i",
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())
@@ -1618,12 +1618,12 @@ void Client::BuyTraderItem(TraderBuy_Struct* tbs, Client* Trader, const EQApplic
outtbs->Quantity = tbs->Quantity;
}
Log.Out(Logs::Detail, Logs::Trading, "Actual quantity that will be traded is %i", outtbs->Quantity);
Log(Logs::Detail, Logs::Trading, "Actual quantity that will be traded is %i", outtbs->Quantity);
if((tbs->Price * outtbs->Quantity) <= 0) {
Message(13, "Internal error. Aborting trade. Please report this to the ServerOP. Error code is 1");
Trader->Message(13, "Internal error. Aborting trade. Please report this to the ServerOP. Error code is 1");
Log.Out(Logs::General, Logs::Error, "Bazaar: Zero price transaction between %s and %s aborted."
Log(Logs::General, Logs::Error, "Bazaar: Zero price transaction between %s and %s aborted."
"Item: %s, Charges: %i, TBS: Qty %i, Price: %i",
GetName(), Trader->GetName(),
BuyItem->GetItem()->Name, BuyItem->GetCharges(), tbs->Quantity, tbs->Price);
@@ -1661,7 +1661,7 @@ void Client::BuyTraderItem(TraderBuy_Struct* tbs, Client* Trader, const EQApplic
return;
}
Log.Out(Logs::Detail, Logs::Trading, "Customer Paid: %d in Copper", TotalCost);
Log(Logs::Detail, Logs::Trading, "Customer Paid: %d in Copper", TotalCost);
uint32 platinum = TotalCost / 1000;
TotalCost -= (platinum * 1000);
@@ -1673,7 +1673,7 @@ void Client::BuyTraderItem(TraderBuy_Struct* tbs, Client* Trader, const EQApplic
Trader->AddMoneyToPP(copper, silver, gold, platinum, true);
Log.Out(Logs::Detail, Logs::Trading, "Trader Received: %d Platinum, %d Gold, %d Silver, %d Copper", platinum, gold, silver, copper);
Log(Logs::Detail, Logs::Trading, "Trader Received: %d Platinum, %d Gold, %d Silver, %d Copper", platinum, gold, silver, copper);
ReturnTraderReq(app, outtbs->Quantity, ItemID);
@@ -1932,7 +1932,7 @@ void Client::SendBazaarResults(uint32 TraderID, uint32 Class_, uint32 Race, uint
return;
}
Log.Out(Logs::Detail, Logs::Trading, "SRCH: %s", query.c_str());
Log(Logs::Detail, Logs::Trading, "SRCH: %s", query.c_str());
int Size = 0;
uint32 ID = 0;
@@ -1977,7 +1977,7 @@ void Client::SendBazaarResults(uint32 TraderID, uint32 Class_, uint32 Race, uint
ID = Trader2->GetID();
VARSTRUCT_ENCODE_TYPE(uint32, bufptr, ID);
} else {
Log.Out(Logs::Detail, Logs::Trading, "Unable to find trader: %i\n", atoi(row[1]));
Log(Logs::Detail, Logs::Trading, "Unable to find trader: %i\n", atoi(row[1]));
VARSTRUCT_ENCODE_TYPE(uint32, bufptr, 0);
}
Cost = atoi(row[5]);
@@ -2067,7 +2067,7 @@ static void UpdateTraderCustomerItemsAdded(uint32 CustomerID, TraderCharges_Stru
if(inst->IsStackable())
inst->SetMerchantCount(gis->Charges[i]);
Log.Out(Logs::Detail, Logs::Trading, "Sending price update for %s, Serial No. %i with %i charges",
Log(Logs::Detail, Logs::Trading, "Sending price update for %s, Serial No. %i with %i charges",
item->Name, gis->SerialNumber[i], gis->Charges[i]);
Customer->SendItemPacket(30, inst, ItemPacketMerchant); // MainCursor?
@@ -2113,7 +2113,7 @@ static void UpdateTraderCustomerPriceChanged(uint32 CustomerID, TraderCharges_St
tdis->ItemID = gis->SerialNumber[i];
}
tdis->ItemID = gis->SerialNumber[i];
Log.Out(Logs::Detail, Logs::Trading, "Telling customer to remove item %i with %i charges and S/N %i",
Log(Logs::Detail, Logs::Trading, "Telling customer to remove item %i with %i charges and S/N %i",
ItemID, Charges, gis->SerialNumber[i]);
@@ -2125,7 +2125,7 @@ static void UpdateTraderCustomerPriceChanged(uint32 CustomerID, TraderCharges_St
return;
}
Log.Out(Logs::Detail, Logs::Trading, "Sending price updates to customer %s", Customer->GetName());
Log(Logs::Detail, Logs::Trading, "Sending price updates to customer %s", Customer->GetName());
EQEmu::ItemInstance* inst = database.CreateItem(item);
@@ -2151,7 +2151,7 @@ static void UpdateTraderCustomerPriceChanged(uint32 CustomerID, TraderCharges_St
inst->SetMerchantSlot(gis->SerialNumber[i]);
Log.Out(Logs::Detail, Logs::Trading, "Sending price update for %s, Serial No. %i with %i charges",
Log(Logs::Detail, Logs::Trading, "Sending price update for %s, Serial No. %i with %i charges",
item->Name, gis->SerialNumber[i], gis->Charges[i]);
Customer->SendItemPacket(30, inst, ItemPacketMerchant); // MainCursor??
@@ -2167,7 +2167,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) {
//
TraderPriceUpdate_Struct* tpus = (TraderPriceUpdate_Struct*)app->pBuffer;
Log.Out(Logs::Detail, Logs::Trading, "Received Price Update for %s, Item Serial No. %i, New Price %i",
Log(Logs::Detail, Logs::Trading, "Received Price Update for %s, Item Serial No. %i, New Price %i",
GetName(), tpus->SerialNumber, tpus->NewPrice);
// Pull the items this Trader currently has for sale from the trader table.
@@ -2175,7 +2175,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) {
TraderCharges_Struct* gis = database.LoadTraderItemWithCharges(CharacterID());
if(!gis) {
Log.Out(Logs::Detail, Logs::None, "[CLIENT] Error retrieving Trader items details to update price.");
Log(Logs::Detail, Logs::None, "[CLIENT] Error retrieving Trader items details to update price.");
return;
}
@@ -2195,7 +2195,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.Out(Logs::Detail, Logs::Trading, "ItemID is %i, Charges is %i", gis->ItemID[i], gis->Charges[i]);
Log(Logs::Detail, Logs::Trading, "ItemID is %i, Charges is %i", gis->ItemID[i], gis->Charges[i]);
IDOfItemToUpdate = gis->ItemID[i];
@@ -2221,7 +2221,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) {
return ;
}
Log.Out(Logs::Detail, Logs::Trading, "Unable to find item to update price for. Rechecking trader satchels");
Log(Logs::Detail, Logs::Trading, "Unable to find item to update price for. Rechecking trader satchels");
// Find what is in their Trader Satchels
GetItems_Struct* newgis=GetTraderItems();
@@ -2234,7 +2234,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) {
if((newgis->Items[i] > 0) && (newgis->SerialNumber[i] == tpus->SerialNumber)) {
Log.Out(Logs::Detail, Logs::Trading, "Found new Item to Add, ItemID is %i, Charges is %i", newgis->Items[i],
Log(Logs::Detail, Logs::Trading, "Found new Item to Add, ItemID is %i, Charges is %i", newgis->Items[i],
newgis->Charges[i]);
IDOfItemToAdd = newgis->Items[i];
@@ -2252,7 +2252,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) {
if(!IDOfItemToAdd || !item) {
Log.Out(Logs::Detail, Logs::Trading, "Item not found in Trader Satchels either.");
Log(Logs::Detail, Logs::Trading, "Item not found in Trader Satchels either.");
tpus->SubAction = BazaarPriceChange_Fail;
QueuePacket(app);
Trader_EndTrader();
@@ -2297,7 +2297,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) {
gis->SerialNumber[i] = newgis->SerialNumber[i];
gis->ItemCost[i] = tpus->NewPrice;
Log.Out(Logs::Detail, Logs::Trading, "Adding new item for %s. ItemID %i, SerialNumber %i, Charges %i, Price: %i, Slot %i",
Log(Logs::Detail, Logs::Trading, "Adding new item for %s. ItemID %i, SerialNumber %i, Charges %i, Price: %i, Slot %i",
GetName(), newgis->Items[i], newgis->SerialNumber[i], newgis->Charges[i],
tpus->NewPrice, i);
}
@@ -2343,7 +2343,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) {
QueuePacket(app);
if(OldPrice == tpus->NewPrice) {
Log.Out(Logs::Detail, Logs::Trading, "The new price is the same as the old one.");
Log(Logs::Detail, Logs::Trading, "The new price is the same as the old one.");
safe_delete(gis);
return;
}
@@ -2364,7 +2364,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.Out(Logs::Detail, Logs::None, "[CLIENT] Client::SendBuyerResults %s\n", searchString);
Log(Logs::Detail, Logs::None, "[CLIENT] Client::SendBuyerResults %s\n", searchString);
auto escSearchString = new char[strlen(searchString) * 2 + 1];
database.DoEscapeString(escSearchString, searchString, strlen(searchString));
@@ -2612,7 +2612,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) {
Quantity = i;
break;
}
Log.Out(Logs::General, Logs::Error, "Unexpected error while moving item from seller to buyer.");
Log(Logs::General, Logs::Error, "Unexpected error while moving item from seller to buyer.");
Message(13, "Internal error while processing transaction.");
return;
}
@@ -2620,7 +2620,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) {
EQEmu::ItemInstance* ItemToTransfer = m_inv.PopItem(SellerSlot);
if(!ItemToTransfer || !Buyer->MoveItemToInventory(ItemToTransfer, true)) {
Log.Out(Logs::General, Logs::Error, "Unexpected error while moving item from seller to buyer.");
Log(Logs::General, Logs::Error, "Unexpected error while moving item from seller to buyer.");
Message(13, "Internal error while processing transaction.");
if(ItemToTransfer)
@@ -2658,7 +2658,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) {
int16 SellerSlot = m_inv.HasItem(ItemID, 1, invWhereWorn|invWherePersonal|invWhereCursor);
if (SellerSlot == INVALID_INDEX) {
Log.Out(Logs::General, Logs::Error, "Unexpected error while moving item from seller to buyer.");
Log(Logs::General, Logs::Error, "Unexpected error while moving item from seller to buyer.");
Message(13, "Internal error while processing transaction.");
return;
}
@@ -2666,7 +2666,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) {
EQEmu::ItemInstance* ItemToTransfer = m_inv.PopItem(SellerSlot);
if(!ItemToTransfer) {
Log.Out(Logs::General, Logs::Error, "Unexpected error while moving item from seller to buyer.");
Log(Logs::General, Logs::Error, "Unexpected error while moving item from seller to buyer.");
Message(13, "Internal error while processing transaction.");
return;
}
@@ -2678,7 +2678,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) {
QuantityMoved += ItemToTransfer->GetCharges();
if(!Buyer->MoveItemToInventory(ItemToTransfer, true)) {
Log.Out(Logs::General, Logs::Error, "Unexpected error while moving item from seller to buyer.");
Log(Logs::General, Logs::Error, "Unexpected error while moving item from seller to buyer.");
Message(13, "Internal error while processing transaction.");
safe_delete(ItemToTransfer);
return;
@@ -2713,7 +2713,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) {
ItemToTransfer->SetCharges(QuantityToRemoveFromStack);
if(!Buyer->MoveItemToInventory(ItemToTransfer, true)) {
Log.Out(Logs::General, Logs::Error, "Unexpected error while moving item from seller to buyer.");
Log(Logs::General, Logs::Error, "Unexpected error while moving item from seller to buyer.");
Message(13, "Internal error while processing transaction.");
safe_delete(ItemToTransfer);
return;
@@ -2948,11 +2948,11 @@ void Client::UpdateBuyLine(const EQApplicationPacket *app) {
bool LoreConflict = CheckLoreConflict(item);
Log.Out(Logs::Detail, Logs::Trading, "UpdateBuyLine: Char: %s BuySlot: %i ItemID %i %s Quantity %i Toggle: %i Price %i ItemCount %i LoreConflict %i",
Log(Logs::Detail, Logs::Trading, "UpdateBuyLine: Char: %s BuySlot: %i ItemID %i %s Quantity %i Toggle: %i Price %i ItemCount %i LoreConflict %i",
GetName(), BuySlot, ItemID, item->Name, Quantity, ToggleOnOff, Price, ItemCount, LoreConflict);
if((item->NoDrop != 0) && !LoreConflict && (Quantity > 0) && HasMoney(Quantity * Price) && ToggleOnOff && (ItemCount == 0)) {
Log.Out(Logs::Detail, Logs::Trading, "Adding to database");
Log(Logs::Detail, Logs::Trading, "Adding to database");
database.AddBuyLine(CharacterID(), BuySlot, ItemID, ItemName, Quantity, Price);
QueuePacket(app);
}
+3 -3
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.Out(Logs::General, Logs::Error, "Details request for invalid tribute %lu", (unsigned long)tribute_id);
Log(Logs::General, Logs::Error, "Details request for invalid tribute %lu", (unsigned long)tribute_id);
return;
}
TributeData &td = tribute_list[tribute_id];
@@ -413,14 +413,14 @@ bool ZoneDatabase::LoadTributes() {
uint32 id = atoul(row[0]);
if(tribute_list.count(id) != 1) {
Log.Out(Logs::General, Logs::Error, "Error in LoadTributes: unknown tribute %lu in tribute_levels", (unsigned long)id);
Log(Logs::General, Logs::Error, "Error in LoadTributes: unknown tribute %lu in tribute_levels", (unsigned long)id);
continue;
}
TributeData &cur = tribute_list[id];
if(cur.tier_count >= MAX_TRIBUTE_TIERS) {
Log.Out(Logs::General, Logs::Error, "Error in LoadTributes: on tribute %lu: more tiers defined than permitted", (unsigned long)id);
Log(Logs::General, Logs::Error, "Error in LoadTributes: on tribute %lu: more tiers defined than permitted", (unsigned long)id);
continue;
}
+206 -203
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemu.org)
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemu.org)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/global_define.h"
#ifdef _EQDEBUG
@@ -40,7 +40,7 @@ struct wp_distance
};
void NPC::AI_SetRoambox(float iDist, float iRoamDist, uint32 iDelay, uint32 iMinDelay) {
AI_SetRoambox(iDist, GetX()+iRoamDist, GetX()-iRoamDist, GetY()+iRoamDist, GetY()-iRoamDist, iDelay, iMinDelay);
AI_SetRoambox(iDist, GetX() + iRoamDist, GetX() - iRoamDist, GetY() + iRoamDist, GetY() - iRoamDist, iDelay, iMinDelay);
}
void NPC::AI_SetRoambox(float iDist, float iMaxX, float iMinX, float iMaxY, float iMinY, uint32 iDelay, uint32 iMinDelay) {
@@ -60,64 +60,64 @@ void NPC::DisplayWaypointInfo(Client *c) {
GetGrid(),
GetSp2(),
GetCurWp(),
GetMaxWp() );
GetMaxWp());
std::vector<wplist>::iterator cur, end;
cur = Waypoints.begin();
end = Waypoints.end();
for(; cur != end; ++cur) {
c->Message(0,"Waypoint %d: (%.2f,%.2f,%.2f,%.2f) pause %d",
cur->index,
cur->x,
cur->y,
cur->z,
cur->heading,
cur->pause );
for (; cur != end; ++cur) {
c->Message(0, "Waypoint %d: (%.2f,%.2f,%.2f,%.2f) pause %d",
cur->index,
cur->x,
cur->y,
cur->z,
cur->heading,
cur->pause);
}
}
void NPC::StopWandering()
{ // stops a mob from wandering, takes him off grid and sends him back to spawn point
roamer=false;
roamer = false;
CastToNPC()->SetGrid(0);
SendPosition();
Log.Out(Logs::Detail, Logs::Pathing, "Stop Wandering requested.");
Log(Logs::Detail, Logs::Pathing, "Stop Wandering requested.");
return;
}
void NPC::ResumeWandering()
{ // causes wandering to continue - overrides waypoint pause timer and PauseWandering()
if(!IsNPC())
if (!IsNPC())
return;
if (GetGrid() != 0)
{
if (GetGrid() < 0)
{ // we were paused by a quest
AI_walking_timer->Disable();
SetGrid( 0 - GetGrid());
if (cur_wp==-1)
SetGrid(0 - GetGrid());
if (cur_wp == -1)
{ // got here by a MoveTo()
cur_wp=save_wp;
cur_wp = save_wp;
UpdateWaypoint(cur_wp); // have him head to last destination from here
}
Log.Out(Logs::Detail, Logs::Pathing, "Resume Wandering requested. Grid %d, wp %d", GetGrid(), cur_wp);
Log(Logs::Detail, Logs::Pathing, "Resume Wandering requested. Grid %d, wp %d", GetGrid(), cur_wp);
}
else if (AI_walking_timer->Enabled())
{ // we are at a waypoint paused normally
Log.Out(Logs::Detail, Logs::Pathing, "Resume Wandering on timed pause. Grid %d, wp %d", GetGrid(), cur_wp);
Log(Logs::Detail, Logs::Pathing, "Resume Wandering on timed pause. Grid %d, wp %d", GetGrid(), cur_wp);
AI_walking_timer->Trigger(); // disable timer to end pause now
}
else
{
Log.Out(Logs::General, Logs::Error, "NPC not paused - can't resume wandering: %lu", (unsigned long)GetNPCTypeID());
Log(Logs::General, Logs::Error, "NPC not paused - can't resume wandering: %lu", (unsigned long)GetNPCTypeID());
return;
}
if (m_CurrentWayPoint.x == GetX() && m_CurrentWayPoint.y == GetY())
{ // are we we at a waypoint? if so, trigger event and start to next
char temp[100];
itoa(cur_wp,temp,10); //do this before updating to next waypoint
itoa(cur_wp, temp, 10); //do this before updating to next waypoint
CalculateNewWaypoint();
SetAppearance(eaStanding, false);
parse->EventNPC(EVENT_WAYPOINT_DEPART, this, nullptr, temp, 0);
@@ -125,7 +125,7 @@ void NPC::ResumeWandering()
}
else
{
Log.Out(Logs::General, Logs::Error, "NPC not on grid - can't resume wandering: %lu", (unsigned long)GetNPCTypeID());
Log(Logs::General, Logs::Error, "NPC not on grid - can't resume wandering: %lu", (unsigned long)GetNPCTypeID());
}
return;
}
@@ -137,18 +137,19 @@ void NPC::PauseWandering(int pausetime)
if (GetGrid() != 0)
{
DistractedFromGrid = true;
Log.Out(Logs::Detail, Logs::Pathing, "Paused Wandering requested. Grid %d. Resuming in %d ms (0=not until told)", GetGrid(), pausetime);
Log(Logs::Detail, Logs::Pathing, "Paused Wandering requested. Grid %d. Resuming in %d ms (0=not until told)", GetGrid(), pausetime);
SendPosition();
if (pausetime<1)
{ // negative grid number stops him dead in his tracks until ResumeWandering()
SetGrid( 0 - GetGrid());
SetGrid(0 - GetGrid());
}
else
{ // specified waiting time, he'll resume after that
AI_walking_timer->Start(pausetime*1000); // set the timer
AI_walking_timer->Start(pausetime * 1000); // set the timer
}
} else {
Log.Out(Logs::General, Logs::Error, "NPC not on grid - can't pause wandering: %lu", (unsigned long)GetNPCTypeID());
}
else {
Log(Logs::General, Logs::Error, "NPC not on grid - can't pause wandering: %lu", (unsigned long)GetNPCTypeID());
}
return;
}
@@ -159,48 +160,48 @@ void NPC::MoveTo(const glm::vec4& position, bool saveguardspot)
{ // he is on a grid
if (GetGrid() < 0)
{ // currently stopped by a quest command
SetGrid( 0 - GetGrid()); // get him moving again
Log.Out(Logs::Detail, Logs::AI, "MoveTo during quest wandering. Canceling quest wandering and going back to grid %d when MoveTo is done.", GetGrid());
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());
}
AI_walking_timer->Disable(); // disable timer in case he is paused at a wp
if (cur_wp>=0)
if (cur_wp >= 0)
{ // we've not already done a MoveTo()
save_wp=cur_wp; // save the current waypoint
cur_wp=-1; // flag this move as quest controlled
save_wp = cur_wp; // save the current waypoint
cur_wp = -1; // flag this move as quest controlled
}
Log.Out(Logs::Detail, Logs::AI, "MoveTo %s, pausing regular grid wandering. Grid %d, save_wp %d",to_string(static_cast<glm::vec3>(position)).c_str(), -GetGrid(), save_wp);
Log(Logs::Detail, Logs::AI, "MoveTo %s, pausing regular grid wandering. Grid %d, save_wp %d", to_string(static_cast<glm::vec3>(position)).c_str(), -GetGrid(), save_wp);
}
else
{ // not on a grid
roamer=true;
save_wp=0;
cur_wp=-2; // flag as quest controlled w/no grid
Log.Out(Logs::Detail, Logs::AI, "MoveTo %s without a grid.", to_string(static_cast<glm::vec3>(position)).c_str());
roamer = true;
save_wp = 0;
cur_wp = -2; // flag as quest controlled w/no grid
Log(Logs::Detail, Logs::AI, "MoveTo %s without a grid.", to_string(static_cast<glm::vec3>(position)).c_str());
}
if (saveguardspot)
{
m_GuardPoint = position;
if(m_GuardPoint.w == 0)
m_GuardPoint.w = 0.0001; //hack to make IsGuarding simpler
if (m_GuardPoint.w == 0)
m_GuardPoint.w = 0.0001; //hack to make IsGuarding simpler
if(m_GuardPoint.w == -1)
m_GuardPoint.w = this->CalculateHeadingToTarget(position.x, position.y);
if (m_GuardPoint.w == -1)
m_GuardPoint.w = this->CalculateHeadingToTarget(position.x, position.y);
Log.Out(Logs::Detail, Logs::AI, "Setting guard position to %s", to_string(static_cast<glm::vec3>(m_GuardPoint)).c_str());
Log(Logs::Detail, Logs::AI, "Setting guard position to %s", to_string(static_cast<glm::vec3>(m_GuardPoint)).c_str());
}
m_CurrentWayPoint = position;
cur_wp_pause = 0;
pLastFightingDelayMoving = 0;
if(AI_walking_timer->Enabled())
if (AI_walking_timer->Enabled())
AI_walking_timer->Start(100);
}
void NPC::UpdateWaypoint(int wp_index)
{
if(wp_index >= static_cast<int>(Waypoints.size())) {
Log.Out(Logs::Detail, Logs::AI, "Update to waypoint %d failed. Not found.", wp_index);
if (wp_index >= static_cast<int>(Waypoints.size())) {
Log(Logs::Detail, Logs::AI, "Update to waypoint %d failed. Not found.", wp_index);
return;
}
std::vector<wplist>::iterator cur;
@@ -209,14 +210,14 @@ void NPC::UpdateWaypoint(int wp_index)
m_CurrentWayPoint = glm::vec4(cur->x, cur->y, cur->z, cur->heading);
cur_wp_pause = cur->pause;
Log.Out(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);
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);
//fix up pathing Z
if(zone->HasMap() && RuleB(Map, FixPathingZAtWaypoints) && !IsBoat())
if (zone->HasMap() && RuleB(Map, FixPathingZAtWaypoints) && !IsBoat())
{
if(!RuleB(Watermap, CheckForWaterAtWaypoints) || !zone->HasWaterMap() ||
(zone->HasWaterMap() && !zone->watermap->InWater(glm::vec3(m_CurrentWayPoint))))
if (!RuleB(Watermap, CheckForWaterAtWaypoints) || !zone->HasWaterMap() ||
(zone->HasWaterMap() && !zone->watermap->InWater(glm::vec3(m_CurrentWayPoint))))
{
glm::vec3 dest(m_CurrentWayPoint.x, m_CurrentWayPoint.y, m_CurrentWayPoint.z);
@@ -239,7 +240,7 @@ void NPC::CalculateNewWaypoint()
if (cur_wp == 0)
reached_beginning = true;
switch(wandertype)
switch (wandertype)
{
case 0: //circle
{
@@ -254,7 +255,7 @@ void NPC::CalculateNewWaypoint()
std::list<wplist> closest;
GetClosestWaypoint(closest, 10, glm::vec3(GetPosition()));
auto iter = closest.begin();
if(closest.size() != 0)
if (closest.size() != 0)
{
iter = closest.begin();
std::advance(iter, zone->random.Int(0, closest.size() - 1));
@@ -266,18 +267,18 @@ void NPC::CalculateNewWaypoint()
case 2: //random
{
cur_wp = zone->random.Int(0, Waypoints.size() - 1);
if(cur_wp == old_wp)
if (cur_wp == old_wp)
{
if(cur_wp == (Waypoints.size() - 1))
if (cur_wp == (Waypoints.size() - 1))
{
if(cur_wp > 0)
if (cur_wp > 0)
{
cur_wp--;
}
}
else if(cur_wp == 0)
else if (cur_wp == 0)
{
if((Waypoints.size() - 1) > 0)
if ((Waypoints.size() - 1) > 0)
{
cur_wp++;
}
@@ -288,11 +289,11 @@ void NPC::CalculateNewWaypoint()
}
case 3: //patrol
{
if(reached_end)
if (reached_end)
patrol = 1;
else if(reached_beginning)
else if (reached_beginning)
patrol = 0;
if(patrol == 1)
if (patrol == 1)
cur_wp = cur_wp - 1;
else
cur_wp = cur_wp + 1;
@@ -311,9 +312,9 @@ void NPC::CalculateNewWaypoint()
GetClosestWaypoint(closest, 5, glm::vec3(GetPosition()));
auto iter = closest.begin();
while(iter != closest.end())
while (iter != closest.end())
{
if(CheckLosFN((*iter).x, (*iter).y, (*iter).z, GetSize()))
if (CheckLosFN((*iter).x, (*iter).y, (*iter).z, GetSize()))
{
++iter;
}
@@ -323,7 +324,7 @@ void NPC::CalculateNewWaypoint()
}
}
if(closest.size() != 0)
if (closest.size() != 0)
{
iter = closest.begin();
std::advance(iter, zone->random.Int(0, closest.size() - 1));
@@ -352,9 +353,9 @@ bool wp_distance_pred(const wp_distance& left, const wp_distance& right)
void NPC::GetClosestWaypoint(std::list<wplist> &wp_list, int count, const glm::vec3& location)
{
wp_list.clear();
if(Waypoints.size() <= count)
if (Waypoints.size() <= count)
{
for(int i = 0; i < Waypoints.size(); ++i)
for (int i = 0; i < Waypoints.size(); ++i)
{
wp_list.push_back(Waypoints[i]);
}
@@ -362,7 +363,7 @@ void NPC::GetClosestWaypoint(std::list<wplist> &wp_list, int count, const glm::v
}
std::list<wp_distance> distances;
for(int i = 0; i < Waypoints.size(); ++i)
for (int i = 0; i < Waypoints.size(); ++i)
{
float cur_x = (Waypoints[i].x - location.x);
cur_x *= cur_x;
@@ -381,7 +382,7 @@ void NPC::GetClosestWaypoint(std::list<wplist> &wp_list, int count, const glm::v
});
auto iter = distances.begin();
for(int i = 0; i < count; ++i)
for (int i = 0; i < count; ++i)
{
wp_list.push_back(Waypoints[(*iter).index]);
++iter;
@@ -401,41 +402,41 @@ void NPC::SetWaypointPause()
switch (pausetype)
{
case 0: //Random Half
AI_walking_timer->Start((cur_wp_pause - zone->random.Int(0, cur_wp_pause-1)/2)*1000);
break;
case 1: //Full
AI_walking_timer->Start(cur_wp_pause*1000);
break;
case 2: //Random Full
AI_walking_timer->Start(zone->random.Int(0, cur_wp_pause-1)*1000);
break;
case 0: //Random Half
AI_walking_timer->Start((cur_wp_pause - zone->random.Int(0, cur_wp_pause - 1) / 2) * 1000);
break;
case 1: //Full
AI_walking_timer->Start(cur_wp_pause * 1000);
break;
case 2: //Random Full
AI_walking_timer->Start(zone->random.Int(0, cur_wp_pause - 1) * 1000);
break;
}
}
}
void NPC::SaveGuardSpot(bool iClearGuardSpot) {
if (iClearGuardSpot) {
Log.Out(Logs::Detail, Logs::AI, "Clearing guard order.");
Log(Logs::Detail, Logs::AI, "Clearing guard order.");
m_GuardPoint = glm::vec4();
}
else {
m_GuardPoint = m_Position;
if(m_GuardPoint.w == 0)
if (m_GuardPoint.w == 0)
m_GuardPoint.w = 0.0001; //hack to make IsGuarding simpler
Log.Out(Logs::Detail, Logs::AI, "Setting guard position to %s", to_string(static_cast<glm::vec3>(m_GuardPoint)).c_str());
Log(Logs::Detail, Logs::AI, "Setting guard position to %s", to_string(static_cast<glm::vec3>(m_GuardPoint)).c_str());
}
}
void NPC::NextGuardPosition() {
if (!CalculateNewPosition2(m_GuardPoint.x, m_GuardPoint.y, m_GuardPoint.z, GetMovespeed())) {
SetHeading(m_GuardPoint.w);
Log.Out(Logs::Detail, Logs::AI, "Unable to move to next guard position. Probably rooted.");
Log(Logs::Detail, Logs::AI, "Unable to move to next guard position. Probably rooted.");
}
else if((m_Position.x == m_GuardPoint.x) && (m_Position.y == m_GuardPoint.y) && (m_Position.z == m_GuardPoint.z))
else if ((m_Position.x == m_GuardPoint.x) && (m_Position.y == m_GuardPoint.y) && (m_Position.z == m_GuardPoint.z))
{
if(moved)
if (moved)
{
moved = false;
SetCurrentSpeed(0);
@@ -444,19 +445,19 @@ void NPC::NextGuardPosition() {
}
float Mob::CalculateDistance(float x, float y, float z) {
return (float)sqrtf( ((m_Position.x-x)*(m_Position.x-x)) + ((m_Position.y-y)*(m_Position.y-y)) + ((m_Position.z-z)*(m_Position.z-z)) );
return (float)sqrtf(((m_Position.x - x)*(m_Position.x - x)) + ((m_Position.y - y)*(m_Position.y - y)) + ((m_Position.z - z)*(m_Position.z - z)));
}
float Mob::CalculateHeadingToTarget(float in_x, float in_y) {
float angle;
if (in_x-m_Position.x > 0)
angle = - 90 + atan((float)(in_y-m_Position.y) / (float)(in_x-m_Position.x)) * 180 / M_PI;
else if (in_x-m_Position.x < 0)
angle = + 90 + atan((float)(in_y-m_Position.y) / (float)(in_x-m_Position.x)) * 180 / M_PI;
if (in_x - m_Position.x > 0)
angle = -90 + atan((float)(in_y - m_Position.y) / (float)(in_x - m_Position.x)) * 180 / M_PI;
else if (in_x - m_Position.x < 0)
angle = +90 + atan((float)(in_y - m_Position.y) / (float)(in_x - m_Position.x)) * 180 / M_PI;
else // Added?
{
if (in_y-m_Position.y > 0)
if (in_y - m_Position.y > 0)
angle = 0;
else
angle = 180;
@@ -465,28 +466,29 @@ float Mob::CalculateHeadingToTarget(float in_x, float in_y) {
angle += 360;
if (angle > 360)
angle -= 360;
return (256*(360-angle)/360.0f);
return (256 * (360 - angle) / 360.0f);
}
bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, int speed, bool checkZ) {
if(GetID()==0)
if (GetID() == 0)
return true;
if(speed <= 0)
if (speed <= 0)
{
SetCurrentSpeed(0);
return true;
}
if ((m_Position.x-x == 0) && (m_Position.y-y == 0)) {//spawn is at target coords
if(m_Position.z-z != 0) {
if ((m_Position.x - x == 0) && (m_Position.y - y == 0)) {//spawn is at target coords
if (m_Position.z - z != 0) {
m_Position.z = z;
Log.Out(Logs::Detail, Logs::AI, "Calc Position2 (%.3f, %.3f, %.3f): Jumping pure Z.", x, y, z);
Log(Logs::Detail, Logs::AI, "Calc Position2 (%.3f, %.3f, %.3f): Jumping pure Z.", x, y, z);
return true;
}
return false;
} else if ((std::abs(m_Position.x - x) < 0.1) && (std::abs(m_Position.y - y) < 0.1)) {
if(IsNPC()) {
}
else if ((std::abs(m_Position.x - x) < 0.1) && (std::abs(m_Position.y - y) < 0.1)) {
if (IsNPC()) {
entity_list.ProcessMove(CastToNPC(), x, y, z);
}
@@ -498,12 +500,12 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, int speed, boo
bool send_update = false;
int compare_steps = 20;
if(tar_ndx < compare_steps && m_TargetLocation.x==x && m_TargetLocation.y==y) {
if (tar_ndx < compare_steps && m_TargetLocation.x == x && m_TargetLocation.y == y) {
float new_x = m_Position.x + m_TargetV.x*tar_vector;
float new_y = m_Position.y + m_TargetV.y*tar_vector;
float new_z = m_Position.z + m_TargetV.z*tar_vector;
if(IsNPC()) {
if (IsNPC()) {
entity_list.ProcessMove(CastToNPC(), new_x, new_y, new_z);
}
@@ -513,28 +515,28 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, int speed, boo
uint8 NPCFlyMode = 0;
if(IsNPC()) {
if(CastToNPC()->GetFlyMode() == 1 || CastToNPC()->GetFlyMode() == 2)
if (IsNPC()) {
if (CastToNPC()->GetFlyMode() == 1 || CastToNPC()->GetFlyMode() == 2)
NPCFlyMode = 1;
}
//fix up pathing Z
if(!NPCFlyMode && checkZ && zone->HasMap() && RuleB(Map, FixPathingZWhenMoving))
if (!NPCFlyMode && checkZ && zone->HasMap() && RuleB(Map, FixPathingZWhenMoving))
{
if(!RuleB(Watermap, CheckForWaterWhenMoving) || !zone->HasWaterMap() ||
(zone->HasWaterMap() && !zone->watermap->InWater(glm::vec3(m_Position))))
if (!RuleB(Watermap, CheckForWaterWhenMoving) || !zone->HasWaterMap() ||
(zone->HasWaterMap() && !zone->watermap->InWater(glm::vec3(m_Position))))
{
glm::vec3 dest(m_Position.x, m_Position.y, m_Position.z);
float newz = zone->zonemap->FindBestZ(dest, nullptr) + 2.0f;
if ((newz > -2000) &&
std::abs(newz - dest.z) < RuleR(Map, FixPathingZMaxDeltaMoving)) // Sanity check.
std::abs(newz - dest.z) < RuleR(Map, FixPathingZMaxDeltaMoving)) // Sanity check.
{
if ((std::abs(x - m_Position.x) < 0.5) &&
(std::abs(y - m_Position.y) < 0.5)) {
(std::abs(y - m_Position.y) < 0.5)) {
if (std::abs(z - m_Position.z) <=
RuleR(Map, FixPathingZMaxDeltaMoving))
RuleR(Map, FixPathingZMaxDeltaMoving))
m_Position.z = z;
else
m_Position.z = newz + 1;
@@ -552,15 +554,16 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, int speed, boo
if (tar_ndx>50) {
tar_ndx--;
} else {
tar_ndx=0;
}
else {
tar_ndx = 0;
}
m_TargetLocation = glm::vec3(x, y, z);
float nx = this->m_Position.x;
float ny = this->m_Position.y;
float nz = this->m_Position.z;
// float nh = this->heading;
// float nh = this->heading;
m_TargetV.x = x - nx;
m_TargetV.y = y - ny;
@@ -568,39 +571,39 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, int speed, boo
SetCurrentSpeed((int8)speed);
pRunAnimSpeed = speed;
#ifdef BOTS
if(IsClient() || IsBot())
if (IsClient() || IsBot())
#else
if(IsClient())
if (IsClient())
#endif
{
animation = speed / 2;
}
// --------------------------------------------------------------------------
// 2: get unit vector
// --------------------------------------------------------------------------
float mag = sqrtf (m_TargetV.x*m_TargetV.x + m_TargetV.y*m_TargetV.y + m_TargetV.z*m_TargetV.z);
float mag = sqrtf(m_TargetV.x*m_TargetV.x + m_TargetV.y*m_TargetV.y + m_TargetV.z*m_TargetV.z);
tar_vector = (float)speed / mag;
// mob move fix
int numsteps = (int) ( mag * 16.0f / (float)speed + 0.5f);
// mob move fix
int numsteps = (int)(mag * 16.0f / (float)speed + 0.5f);
// mob move fix
// mob move fix
if (numsteps<20)
{
if (numsteps>1)
{
tar_vector=1.0f ;
m_TargetV.x = m_TargetV.x/(float)numsteps;
m_TargetV.y = m_TargetV.y/(float)numsteps;
m_TargetV.z = m_TargetV.z/(float)numsteps;
tar_vector = 1.0f;
m_TargetV.x = m_TargetV.x / (float)numsteps;
m_TargetV.y = m_TargetV.y / (float)numsteps;
m_TargetV.z = m_TargetV.z / (float)numsteps;
float new_x = m_Position.x + m_TargetV.x;
float new_y = m_Position.y + m_TargetV.y;
float new_z = m_Position.z + m_TargetV.z;
if(IsNPC()) {
if (IsNPC()) {
entity_list.ProcessMove(CastToNPC(), new_x, new_y, new_z);
}
@@ -612,7 +615,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, int speed, boo
}
else
{
if(IsNPC()) {
if (IsNPC()) {
entity_list.ProcessMove(CastToNPC(), x, y, z);
}
@@ -623,9 +626,9 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, int speed, boo
}
else {
tar_vector/=16.0f;
tar_vector /= 16.0f;
float dur = Timer::GetCurrentTime() - pLastChange;
if(dur < 1.0f) {
if (dur < 1.0f) {
dur = 1.0f;
}
tar_vector = (tar_vector * AImovement_duration) / 100.0f;
@@ -633,7 +636,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, int speed, boo
float new_x = m_Position.x + m_TargetV.x*tar_vector;
float new_y = m_Position.y + m_TargetV.y*tar_vector;
float new_z = m_Position.z + m_TargetV.z*tar_vector;
if(IsNPC()) {
if (IsNPC()) {
entity_list.ProcessMove(CastToNPC(), new_x, new_y, new_z);
}
@@ -645,23 +648,23 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, int speed, boo
uint8 NPCFlyMode = 0;
if(IsNPC()) {
if(CastToNPC()->GetFlyMode() == 1 || CastToNPC()->GetFlyMode() == 2)
if (IsNPC()) {
if (CastToNPC()->GetFlyMode() == 1 || CastToNPC()->GetFlyMode() == 2)
NPCFlyMode = 1;
}
//fix up pathing Z
if(!NPCFlyMode && checkZ && zone->HasMap() && RuleB(Map, FixPathingZWhenMoving)) {
if (!NPCFlyMode && checkZ && zone->HasMap() && RuleB(Map, FixPathingZWhenMoving)) {
if(!RuleB(Watermap, CheckForWaterWhenMoving) || !zone->HasWaterMap() ||
(zone->HasWaterMap() && !zone->watermap->InWater(glm::vec3(m_Position))))
if (!RuleB(Watermap, CheckForWaterWhenMoving) || !zone->HasWaterMap() ||
(zone->HasWaterMap() && !zone->watermap->InWater(glm::vec3(m_Position))))
{
glm::vec3 dest(m_Position.x, m_Position.y, m_Position.z);
float newz = zone->zonemap->FindBestZ(dest, nullptr);
if ((newz > -2000) &&
std::abs(newz - dest.z) < RuleR(Map, FixPathingZMaxDeltaMoving)) // Sanity check.
std::abs(newz - dest.z) < RuleR(Map, FixPathingZMaxDeltaMoving)) // Sanity check.
{
if (std::abs(x - m_Position.x) < 0.5 && std::abs(y - m_Position.y) < 0.5) {
if (std::abs(z - m_Position.z) <= RuleR(Map, FixPathingZMaxDeltaMoving))
@@ -670,13 +673,13 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, int speed, boo
m_Position.z = newz + 1;
}
else
m_Position.z = newz+1;
}
m_Position.z = newz + 1;
}
}
}
SetMoving(true);
moved=true;
moved = true;
m_Delta = glm::vec4(m_Position.x - nx, m_Position.y - ny, m_Position.z - nz, 0.0f);
@@ -700,7 +703,7 @@ bool Mob::CalculateNewPosition2(float x, float y, float z, int speed, bool check
}
bool Mob::CalculateNewPosition(float x, float y, float z, int speed, bool checkZ, bool calcHeading) {
if(GetID()==0)
if (GetID() == 0)
return true;
float nx = m_Position.x;
@@ -710,15 +713,15 @@ bool Mob::CalculateNewPosition(float x, float y, float z, int speed, bool checkZ
// if NPC is rooted
if (speed == 0) {
SetHeading(CalculateHeadingToTarget(x, y));
if(moved){
if (moved) {
SetCurrentSpeed(0);
moved=false;
moved = false;
}
Log.Out(Logs::Detail, Logs::AI, "Rooted while calculating new position to (%.3f, %.3f, %.3f)", x, y, z);
Log(Logs::Detail, Logs::AI, "Rooted while calculating new position to (%.3f, %.3f, %.3f)", x, y, z);
return true;
}
float old_test_vector=test_vector;
float old_test_vector = test_vector;
m_TargetV.x = x - nx;
m_TargetV.y = y - ny;
m_TargetV.z = z - nz;
@@ -726,62 +729,62 @@ bool Mob::CalculateNewPosition(float x, float y, float z, int speed, bool checkZ
if (m_TargetV.x == 0 && m_TargetV.y == 0)
return false;
SetCurrentSpeed((int8)(speed)); //*NPC_RUNANIM_RATIO);
//speed *= NPC_SPEED_MULTIPLIER;
//speed *= NPC_SPEED_MULTIPLIER;
Log.Out(Logs::Detail, Logs::AI, "Calculating new position to (%.3f, %.3f, %.3f) vector (%.3f, %.3f, %.3f) rate %.3f RAS %d", x, y, z, m_TargetV.x, m_TargetV.y, m_TargetV.z, speed, pRunAnimSpeed);
Log(Logs::Detail, Logs::AI, "Calculating new position to (%.3f, %.3f, %.3f) vector (%.3f, %.3f, %.3f) rate %.3f RAS %d", x, y, z, m_TargetV.x, m_TargetV.y, m_TargetV.z, speed, pRunAnimSpeed);
// --------------------------------------------------------------------------
// 2: get unit vector
// --------------------------------------------------------------------------
test_vector=sqrtf (x*x + y*y + z*z);
tar_vector = speed / sqrtf (m_TargetV.x*m_TargetV.x + m_TargetV.y*m_TargetV.y + m_TargetV.z*m_TargetV.z);
test_vector = sqrtf(x*x + y*y + z*z);
tar_vector = speed / sqrtf(m_TargetV.x*m_TargetV.x + m_TargetV.y*m_TargetV.y + m_TargetV.z*m_TargetV.z);
m_Position.w = CalculateHeadingToTarget(x, y);
if (tar_vector >= 1.0) {
if(IsNPC()) {
if (IsNPC()) {
entity_list.ProcessMove(CastToNPC(), x, y, z);
}
m_Position.x = x;
m_Position.y = y;
m_Position.z = z;
Log.Out(Logs::Detail, Logs::AI, "Close enough, jumping to waypoint");
Log(Logs::Detail, Logs::AI, "Close enough, jumping to waypoint");
}
else {
float new_x = m_Position.x + m_TargetV.x*tar_vector;
float new_y = m_Position.y + m_TargetV.y*tar_vector;
float new_z = m_Position.z + m_TargetV.z*tar_vector;
if(IsNPC()) {
if (IsNPC()) {
entity_list.ProcessMove(CastToNPC(), new_x, new_y, new_z);
}
m_Position.x = new_x;
m_Position.y = new_y;
m_Position.z = new_z;
Log.Out(Logs::Detail, Logs::AI, "Next position (%.3f, %.3f, %.3f)", m_Position.x, m_Position.y, m_Position.z);
Log(Logs::Detail, Logs::AI, "Next position (%.3f, %.3f, %.3f)", m_Position.x, m_Position.y, m_Position.z);
}
uint8 NPCFlyMode = 0;
if(IsNPC()) {
if(CastToNPC()->GetFlyMode() == 1 || CastToNPC()->GetFlyMode() == 2)
if (IsNPC()) {
if (CastToNPC()->GetFlyMode() == 1 || CastToNPC()->GetFlyMode() == 2)
NPCFlyMode = 1;
}
//fix up pathing Z
if(!NPCFlyMode && checkZ && zone->HasMap() && RuleB(Map, FixPathingZWhenMoving))
if (!NPCFlyMode && checkZ && zone->HasMap() && RuleB(Map, FixPathingZWhenMoving))
{
if(!RuleB(Watermap, CheckForWaterWhenMoving) || !zone->HasWaterMap() ||
if (!RuleB(Watermap, CheckForWaterWhenMoving) || !zone->HasWaterMap() ||
(zone->HasWaterMap() && !zone->watermap->InWater(glm::vec3(m_Position))))
{
glm::vec3 dest(m_Position.x, m_Position.y, m_Position.z);
float newz = zone->zonemap->FindBestZ(dest, nullptr) + 2.0f;
Log.Out(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);
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);
if ((newz > -2000) &&
std::abs(newz - dest.z) < RuleR(Map, FixPathingZMaxDeltaMoving)) // Sanity check.
std::abs(newz - dest.z) < RuleR(Map, FixPathingZMaxDeltaMoving)) // Sanity check.
{
if (std::abs(x - m_Position.x) < 0.5 && std::abs(y - m_Position.y) < 0.5) {
if (std::abs(z - m_Position.z) <= RuleR(Map, FixPathingZMaxDeltaMoving))
@@ -790,16 +793,16 @@ bool Mob::CalculateNewPosition(float x, float y, float z, int speed, bool checkZ
m_Position.z = newz + 1;
}
else
m_Position.z = newz+1;
m_Position.z = newz + 1;
}
}
}
//OP_MobUpdate
if((old_test_vector!=test_vector) || tar_ndx>20){ //send update
tar_ndx=0;
if ((old_test_vector != test_vector) || tar_ndx>20) { //send update
tar_ndx = 0;
this->SetMoving(true);
moved=true;
moved = true;
m_Delta = glm::vec4(m_Position.x - nx, m_Position.y - ny, m_Position.z - nz, 0.0f);
SendPosUpdate();
}
@@ -827,7 +830,7 @@ void NPC::AssignWaypoints(int32 grid)
// Retrieve the wander and pause types for this grid
std::string query = StringFormat("SELECT `type`, `type2` FROM `grid` WHERE `id` = %i AND `zoneid` = %i", grid,
zone->GetZoneID());
zone->GetZoneID());
auto results = database.QueryDatabase(query);
if (!results.Success()) {
return;
@@ -843,10 +846,10 @@ void NPC::AssignWaypoints(int32 grid)
SetGrid(grid); // Assign grid number
// Retrieve all waypoints for this grid
// Retrieve all waypoints for this grid
query = StringFormat("SELECT `x`,`y`,`z`,`pause`,`heading` "
"FROM grid_entries WHERE `gridid` = %i AND `zoneid` = %i "
"ORDER BY `number`", grid, zone->GetZoneID());
"FROM grid_entries WHERE `gridid` = %i AND `zoneid` = %i "
"ORDER BY `number`", grid, zone->GetZoneID());
results = database.QueryDatabase(query);
if (!results.Success()) {
return;
@@ -863,10 +866,10 @@ void NPC::AssignWaypoints(int32 grid)
newwp.y = atof(row[1]);
newwp.z = atof(row[2]);
if(zone->HasMap() && RuleB(Map, FixPathingZWhenLoading) )
if (zone->HasMap() && RuleB(Map, FixPathingZWhenLoading))
{
auto positon = glm::vec3(newwp.x,newwp.y,newwp.z);
if(!RuleB(Watermap, CheckWaypointsInWaterWhenLoading) || !zone->HasWaterMap() ||
auto positon = glm::vec3(newwp.x, newwp.y, newwp.z);
if (!RuleB(Watermap, CheckWaypointsInWaterWhenLoading) || !zone->HasWaterMap() ||
(zone->HasWaterMap() && !zone->watermap->InWater(positon)))
{
glm::vec3 dest(newwp.x, newwp.y, newwp.z);
@@ -893,32 +896,32 @@ void NPC::AssignWaypoints(int32 grid)
}
void Mob::SendTo(float new_x, float new_y, float new_z) {
if(IsNPC()) {
if (IsNPC()) {
entity_list.ProcessMove(CastToNPC(), new_x, new_y, new_z);
}
m_Position.x = new_x;
m_Position.y = new_y;
m_Position.z = new_z;
Log.Out(Logs::Detail, Logs::AI, "Sent To (%.3f, %.3f, %.3f)", new_x, new_y, new_z);
Log(Logs::Detail, Logs::AI, "Sent To (%.3f, %.3f, %.3f)", new_x, new_y, new_z);
if(flymode == FlyMode1)
if (flymode == FlyMode1)
return;
//fix up pathing Z, this shouldent be needed IF our waypoints
//are corrected instead
if(zone->HasMap() && RuleB(Map, FixPathingZOnSendTo) )
if (zone->HasMap() && RuleB(Map, FixPathingZOnSendTo))
{
if(!RuleB(Watermap, CheckForWaterOnSendTo) || !zone->HasWaterMap() ||
if (!RuleB(Watermap, CheckForWaterOnSendTo) || !zone->HasWaterMap() ||
(zone->HasWaterMap() && !zone->watermap->InWater(glm::vec3(m_Position))))
{
glm::vec3 dest(m_Position.x, m_Position.y, m_Position.z);
float newz = zone->zonemap->FindBestZ(dest, nullptr);
Log.Out(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);
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);
if( (newz > -2000) && std::abs(newz - dest.z) < RuleR(Map, FixPathingZMaxDeltaSendTo)) // Sanity check.
if ((newz > -2000) && std::abs(newz - dest.z) < RuleR(Map, FixPathingZMaxDeltaSendTo)) // Sanity check.
m_Position.z = newz + 1;
}
}
@@ -927,7 +930,7 @@ void Mob::SendTo(float new_x, float new_y, float new_z) {
}
void Mob::SendToFixZ(float new_x, float new_y, float new_z) {
if(IsNPC()) {
if (IsNPC()) {
entity_list.ProcessMove(CastToNPC(), new_x, new_y, new_z + 0.1);
}
@@ -938,18 +941,18 @@ void Mob::SendToFixZ(float new_x, float new_y, float new_z) {
//fix up pathing Z, this shouldent be needed IF our waypoints
//are corrected instead
if(zone->HasMap() && RuleB(Map, FixPathingZOnSendTo))
if (zone->HasMap() && RuleB(Map, FixPathingZOnSendTo))
{
if(!RuleB(Watermap, CheckForWaterOnSendTo) || !zone->HasWaterMap() ||
if (!RuleB(Watermap, CheckForWaterOnSendTo) || !zone->HasWaterMap() ||
(zone->HasWaterMap() && !zone->watermap->InWater(glm::vec3(m_Position))))
{
glm::vec3 dest(m_Position.x, m_Position.y, m_Position.z);
float newz = zone->zonemap->FindBestZ(dest, nullptr);
Log.Out(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);
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);
if( (newz > -2000) && std::abs(newz-dest.z) < RuleR(Map, FixPathingZMaxDeltaSendTo)) // Sanity check.
if ((newz > -2000) && std::abs(newz - dest.z) < RuleR(Map, FixPathingZMaxDeltaSendTo)) // Sanity check.
m_Position.z = newz + 1;
}
}
@@ -993,7 +996,7 @@ bool ZoneDatabase::GetWaypoints(uint32 grid, uint16 zoneid, uint32 num, wplist*
return false;
std::string query = StringFormat("SELECT x, y, z, pause, heading FROM grid_entries "
"WHERE gridid = %i AND number = %i AND zoneid = %i", grid, num, zoneid);
"WHERE gridid = %i AND number = %i AND zoneid = %i", grid, num, zoneid);
auto results = QueryDatabase(query);
if (!results.Success()) {
return false;
@@ -1040,7 +1043,7 @@ void ZoneDatabase::ModifyGrid(Client *client, bool remove, uint32 id, uint8 type
if (!remove)
{
std::string query = StringFormat("INSERT INTO grid(id, zoneid, type, type2) "
"VALUES (%i, %i, %i, %i)", id, zoneid, type, type2);
"VALUES (%i, %i, %i, %i)", id, zoneid, type, type2);
auto results = QueryDatabase(query);
if (!results.Success()) {
return;
@@ -1062,8 +1065,8 @@ void ZoneDatabase::ModifyGrid(Client *client, bool remove, uint32 id, uint8 type
void ZoneDatabase::AddWP(Client *client, uint32 gridid, uint32 wpnum, const glm::vec4& position, uint32 pause, uint16 zoneid)
{
std::string query = StringFormat("INSERT INTO grid_entries (gridid, zoneid, `number`, x, y, z, pause, heading) "
"VALUES (%i, %i, %i, %f, %f, %f, %i, %f)",
gridid, zoneid, wpnum, position.x, position.y, position.z, pause, position.w);
"VALUES (%i, %i, %i, %f, %f, %f, %i, %f)",
gridid, zoneid, wpnum, position.x, position.y, position.z, pause, position.w);
auto results = QueryDatabase(query);
if (!results.Success()) {
return;
@@ -1084,10 +1087,10 @@ void ZoneDatabase::AddWP(Client *client, uint32 gridid, uint32 wpnum, const glm:
void ZoneDatabase::DeleteWaypoint(Client *client, uint32 grid_num, uint32 wp_num, uint16 zoneid)
{
std::string query = StringFormat("DELETE FROM grid_entries WHERE "
"gridid = %i AND zoneid = %i AND `number` = %i",
grid_num, zoneid, wp_num);
"gridid = %i AND zoneid = %i AND `number` = %i",
grid_num, zoneid, wp_num);
auto results = QueryDatabase(query);
if(!results.Success()) {
if (!results.Success()) {
return;
}
}
@@ -1106,7 +1109,7 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *client, uint32 spawn2id, const glm::v
uint32 next_wp_num; // The waypoint number we should be assigning to the new waypoint
bool createdNewGrid; // Did we create a new grid in this function?
// See what grid number our spawn is assigned
// See what grid number our spawn is assigned
std::string query = StringFormat("SELECT pathgrid FROM spawn2 WHERE id = %i", spawn2id);
auto results = QueryDatabase(query);
if (!results.Success()) {
@@ -1124,11 +1127,11 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *client, uint32 spawn2id, const glm::v
{ // Our spawn doesn't have a grid assigned to it -- we need to create a new grid and assign it to the spawn
createdNewGrid = true;
grid_num = GetFreeGrid(zoneid);
if(grid_num == 0) // There are no grids for the current zone -- create Grid #1
if (grid_num == 0) // There are no grids for the current zone -- create Grid #1
grid_num = 1;
query = StringFormat("INSERT INTO grid SET id = '%i', zoneid = %i, type ='%i', type2 = '%i'",
grid_num, zoneid, type1, type2);
grid_num, zoneid, type1, type2);
QueryDatabase(query);
query = StringFormat("UPDATE spawn2 SET pathgrid = '%i' WHERE id = '%i'", grid_num, spawn2id);
@@ -1142,22 +1145,22 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *client, uint32 spawn2id, const glm::v
query = StringFormat("SELECT max(`number`) FROM grid_entries WHERE zoneid = '%i' AND gridid = '%i'", zoneid, grid_num);
results = QueryDatabase(query);
if(!results.Success()) { // Query error
if (!results.Success()) { // Query error
return 0;
}
row = results.begin();
if(row[0] != 0)
if (row[0] != 0)
next_wp_num = atoi(row[0]) + 1;
else // No waypoints in this grid yet
next_wp_num = 1;
query = StringFormat("INSERT INTO grid_entries(gridid, zoneid, `number`, x, y, z, pause, heading) "
"VALUES (%i, %i, %i, %f, %f, %f, %i, %f)",
grid_num, zoneid, next_wp_num, position.x, position.y, position.z, pause, position.w);
"VALUES (%i, %i, %i, %f, %f, %f, %i, %f)",
grid_num, zoneid, next_wp_num, position.x, position.y, position.z, pause, position.w);
results = QueryDatabase(query);
return createdNewGrid? grid_num: 0;
return createdNewGrid ? grid_num : 0;
}
uint32 ZoneDatabase::GetFreeGrid(uint16 zoneid) {
@@ -1180,7 +1183,7 @@ uint32 ZoneDatabase::GetFreeGrid(uint16 zoneid) {
int ZoneDatabase::GetHighestWaypoint(uint32 zoneid, uint32 gridid) {
std::string query = StringFormat("SELECT COALESCE(MAX(number), 0) FROM grid_entries "
"WHERE zoneid = %i AND gridid = %i", zoneid, gridid);
"WHERE zoneid = %i AND gridid = %i", zoneid, gridid);
auto results = QueryDatabase(query);
if (!results.Success()) {
return 0;
@@ -1201,4 +1204,4 @@ void NPC::SaveGuardSpotCharm()
void NPC::RestoreGuardSpotCharm()
{
m_GuardPoint = m_GuardPointSaved;
}
}
+434 -430
View File
File diff suppressed because it is too large Load Diff
+78 -75
View File
@@ -88,7 +88,7 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) {
return false;
}
Log.Out(Logs::General, Logs::Status, "Booting %s (%d:%d)", zonename, iZoneID, iInstanceID);
Log(Logs::General, Logs::Status, "Booting %s (%d:%d)", zonename, iZoneID, iInstanceID);
numclients = 0;
zone = new Zone(iZoneID, iInstanceID, zonename);
@@ -113,13 +113,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.Out(Logs::General, Logs::Status, "General logging level: %i", zone->loglevelvar);
Log(Logs::General, Logs::Status, "General logging level: %i", zone->loglevelvar);
zone->merchantvar = log_levels[1];
Log.Out(Logs::General, Logs::Status, "Merchant logging level: %i", zone->merchantvar);
Log(Logs::General, Logs::Status, "Merchant logging level: %i", zone->merchantvar);
zone->tradevar = log_levels[2];
Log.Out(Logs::General, Logs::Status, "Trade logging level: %i", zone->tradevar);
Log(Logs::General, Logs::Status, "Trade logging level: %i", zone->tradevar);
zone->lootvar = log_levels[3];
Log.Out(Logs::General, Logs::Status, "Loot logging level: %i", zone->lootvar);
Log(Logs::General, Logs::Status, "Loot logging level: %i", zone->lootvar);
}
else {
zone->loglevelvar = uint8(tmp_i); //continue supporting only command logging (for now)
@@ -140,15 +140,15 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) {
delete pack;
}
Log.Out(Logs::General, Logs::Normal, "---- Zone server %s, listening on port:%i ----", zonename, ZoneConfig::get()->ZonePort);
Log.Out(Logs::General, Logs::Status, "Zone Bootup: %s (%i: %i)", zonename, iZoneID, iInstanceID);
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);
parse->Init();
UpdateWindowTitle();
zone->GetTimeSync();
/* Set Logging */
Log.StartFileLogs(StringFormat("%s_version_%u_inst_id_%u_port_%u", zone->GetShortName(), zone->GetInstanceVersion(), zone->GetInstanceID(), ZoneConfig::get()->ZonePort));
LogSys.StartFileLogs(StringFormat("%s_version_%u_inst_id_%u_port_%u", zone->GetShortName(), zone->GetInstanceVersion(), zone->GetInstanceID(), ZoneConfig::get()->ZonePort));
return true;
}
@@ -163,12 +163,12 @@ bool Zone::LoadZoneObjects()
zoneid, instanceversion);
auto results = database.QueryDatabase(query);
if (!results.Success()) {
Log.Out(Logs::General, Logs::Error, "Error Loading Objects from DB: %s",
Log(Logs::General, Logs::Error, "Error Loading Objects from DB: %s",
results.ErrorMessage().c_str());
return false;
}
Log.Out(Logs::General, Logs::Status, "Loading Objects from DB...");
Log(Logs::General, Logs::Status, "Loading Objects from DB...");
for (auto row = results.begin(); row != results.end(); ++row) {
if (atoi(row[9]) == 0) {
// Type == 0 - Static Object
@@ -287,7 +287,7 @@ bool Zone::LoadGroundSpawns() {
memset(&groundspawn, 0, sizeof(groundspawn));
int gsindex=0;
Log.Out(Logs::General, Logs::Status, "Loading Ground Spawns from DB...");
Log(Logs::General, Logs::Status, "Loading Ground Spawns from DB...");
database.LoadGroundSpawns(zoneid, GetInstanceVersion(), &groundspawn);
uint32 ix=0;
char* name = nullptr;
@@ -406,7 +406,7 @@ uint32 Zone::GetTempMerchantQuantity(uint32 NPCID, uint32 Slot) {
}
void Zone::LoadTempMerchantData() {
Log.Out(Logs::General, Logs::Status, "Loading Temporary Merchant Lists...");
Log(Logs::General, Logs::Status, "Loading Temporary Merchant Lists...");
std::string query = StringFormat(
"SELECT "
"DISTINCT ml.npcid, "
@@ -476,7 +476,7 @@ void Zone::LoadNewMerchantData(uint32 merchantid) {
}
void Zone::GetMerchantDataForZoneLoad() {
Log.Out(Logs::General, Logs::Status, "Loading Merchant Lists...");
Log(Logs::General, Logs::Status, "Loading Merchant Lists...");
std::string query = StringFormat(
"SELECT "
"DISTINCT ml.merchantid, "
@@ -499,7 +499,7 @@ void Zone::GetMerchantDataForZoneLoad() {
std::map<uint32, std::list<MerchantList> >::iterator cur;
uint32 npcid = 0;
if (results.RowCount() == 0) {
Log.Out(Logs::General, Logs::None, "No Merchant Data found for %s.", GetShortName());
Log(Logs::General, Logs::None, "No Merchant Data found for %s.", GetShortName());
return;
}
for (auto row = results.begin(); row != results.end(); ++row) {
@@ -548,8 +548,9 @@ void Zone::LoadMercTemplates(){
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);
if (!results.Success())
Log.Out(Logs::General, Logs::Error, "Error in ZoneDatabase::LoadMercTemplates()");
if (!results.Success()) {
Log(Logs::General, Logs::Error, "Error in ZoneDatabase::LoadMercTemplates()");
}
else {
for (auto row = results.begin(); row != results.end(); ++row) {
MercStanceInfo tempMercStanceInfo;
@@ -572,7 +573,7 @@ void Zone::LoadMercTemplates(){
"ORDER BY MTyp.race_id, MS.class_id, MTyp.proficiency_id;";
results = database.QueryDatabase(query);
if (!results.Success()) {
Log.Out(Logs::General, Logs::Error, "Error in ZoneDatabase::LoadMercTemplates()");
Log(Logs::General, Logs::Error, "Error in ZoneDatabase::LoadMercTemplates()");
return;
}
@@ -616,7 +617,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.Out(Logs::General, Logs::Error, "Error in ZoneDatabase::LoadEXPLevelMods()");
Log(Logs::General, Logs::Error, "Error in ZoneDatabase::LoadEXPLevelMods()");
return;
}
@@ -640,7 +641,7 @@ void Zone::LoadMercSpells(){
"ORDER BY msl.class_id, msl.proficiency_id, msle.spell_type, msle.minlevel, msle.slot;";
auto results = database.QueryDatabase(query);
if (!results.Success()) {
Log.Out(Logs::General, Logs::Error, "Error in Zone::LoadMercSpells()");
Log(Logs::General, Logs::Error, "Error in Zone::LoadMercSpells()");
return;
}
@@ -661,7 +662,7 @@ void Zone::LoadMercSpells(){
merc_spells_list[classid].push_back(tempMercSpellEntry);
}
Log.Out(Logs::General, Logs::Mercenaries, "Loaded %i merc spells.", merc_spells_list[1].size() + merc_spells_list[2].size() + merc_spells_list[9].size() + merc_spells_list[12].size());
Log(Logs::General, Logs::Mercenaries, "Loaded %i merc spells.", merc_spells_list[1].size() + merc_spells_list[2].size() + merc_spells_list[9].size() + merc_spells_list[12].size());
}
@@ -700,11 +701,11 @@ void Zone::Shutdown(bool quite)
}
zone->ldon_trap_entry_list.clear();
Log.Out(Logs::General, Logs::Status, "Zone Shutdown: %s (%i)", zone->GetShortName(), zone->GetZoneID());
Log(Logs::General, Logs::Status, "Zone Shutdown: %s (%i)", zone->GetShortName(), zone->GetZoneID());
petition_list.ClearPetitions();
zone->SetZoneHasCurrentTime(false);
if (!quite)
Log.Out(Logs::General, Logs::Normal, "Zone shutdown: going to sleep");
Log(Logs::General, Logs::Normal, "Zone shutdown: going to sleep");
is_zone_loaded = false;
zone->ResetAuth();
@@ -713,24 +714,24 @@ void Zone::Shutdown(bool quite)
parse->ReloadQuests(true);
UpdateWindowTitle();
Log.CloseFileLogs();
LogSys.CloseFileLogs();
}
void Zone::LoadZoneDoors(const char* zone, int16 version)
{
Log.Out(Logs::General, Logs::Status, "Loading doors for %s ...", zone);
Log(Logs::General, Logs::Status, "Loading doors for %s ...", zone);
uint32 maxid;
int32 count = database.GetDoorsCount(&maxid, zone, version);
if(count < 1) {
Log.Out(Logs::General, Logs::Status, "... No doors loaded.");
Log(Logs::General, Logs::Status, "... No doors loaded.");
return;
}
auto dlist = new Door[count];
if(!database.LoadDoors(count, dlist, zone, version)) {
Log.Out(Logs::General, Logs::Error, "... Failed to load doors.");
Log(Logs::General, Logs::Error, "... Failed to load doors.");
delete[] dlist;
return;
}
@@ -740,7 +741,7 @@ void Zone::LoadZoneDoors(const char* zone, int16 version)
for(r = 0; r < count; r++, d++) {
auto newdoor = new Doors(d);
entity_list.AddDoor(newdoor);
Log.Out(Logs::Detail, Logs::Doors, "Door Add to Entity List, index: %u db id: %u, door_id %u", r, dlist[r].db_id, dlist[r].door_id);
Log(Logs::Detail, Logs::Doors, "Door Add to Entity List, index: %u db id: %u, door_id %u", r, dlist[r].db_id, dlist[r].door_id);
}
delete[] dlist;
}
@@ -791,13 +792,15 @@ 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.Out(Logs::General, Logs::None, "Graveyard ID is %i.", graveyard_id());
Log(Logs::General, Logs::None, "Graveyard ID is %i.", 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.Out(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());
else
Log.Out(Logs::General, Logs::Error, "Unable to load the graveyard id %i for zone %s.", graveyard_id(), short_name);
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());
}
else {
Log(Logs::General, Logs::Error, "Unable to load the graveyard id %i for zone %s.", graveyard_id(), short_name);
}
}
if (long_name == 0) {
long_name = strcpy(new char[18], "Long zone missing");
@@ -805,7 +808,7 @@ 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.Out(Logs::General, Logs::None, "The next weather check for zone: %s will be in %i seconds.", short_name, Weather_Timer->GetRemainingTime()/1000);
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;
@@ -892,59 +895,59 @@ bool Zone::Init(bool iStaticZone) {
zone->watermap = WaterMap::LoadWaterMapfile(zone->map_name);
zone->pathing = PathManager::LoadPathFile(zone->map_name);
Log.Out(Logs::General, Logs::Status, "Loading spawn conditions...");
Log(Logs::General, Logs::Status, "Loading spawn conditions...");
if(!spawn_conditions.LoadSpawnConditions(short_name, instanceid)) {
Log.Out(Logs::General, Logs::Error, "Loading spawn conditions failed, continuing without them.");
Log(Logs::General, Logs::Error, "Loading spawn conditions failed, continuing without them.");
}
Log.Out(Logs::General, Logs::Status, "Loading static zone points...");
Log(Logs::General, Logs::Status, "Loading static zone points...");
if (!database.LoadStaticZonePoints(&zone_point_list, short_name, GetInstanceVersion())) {
Log.Out(Logs::General, Logs::Error, "Loading static zone points failed.");
Log(Logs::General, Logs::Error, "Loading static zone points failed.");
return false;
}
Log.Out(Logs::General, Logs::Status, "Loading spawn groups...");
Log(Logs::General, Logs::Status, "Loading spawn groups...");
if (!database.LoadSpawnGroups(short_name, GetInstanceVersion(), &spawn_group_list)) {
Log.Out(Logs::General, Logs::Error, "Loading spawn groups failed.");
Log(Logs::General, Logs::Error, "Loading spawn groups failed.");
return false;
}
Log.Out(Logs::General, Logs::Status, "Loading spawn2 points...");
Log(Logs::General, Logs::Status, "Loading spawn2 points...");
if (!database.PopulateZoneSpawnList(zoneid, spawn2_list, GetInstanceVersion()))
{
Log.Out(Logs::General, Logs::Error, "Loading spawn2 points failed.");
Log(Logs::General, Logs::Error, "Loading spawn2 points failed.");
return false;
}
Log.Out(Logs::General, Logs::Status, "Loading player corpses...");
Log(Logs::General, Logs::Status, "Loading player corpses...");
if (!database.LoadCharacterCorpses(zoneid, instanceid)) {
Log.Out(Logs::General, Logs::Error, "Loading player corpses failed.");
Log(Logs::General, Logs::Error, "Loading player corpses failed.");
return false;
}
Log.Out(Logs::General, Logs::Status, "Loading traps...");
Log(Logs::General, Logs::Status, "Loading traps...");
if (!database.LoadTraps(short_name, GetInstanceVersion()))
{
Log.Out(Logs::General, Logs::Error, "Loading traps failed.");
Log(Logs::General, Logs::Error, "Loading traps failed.");
return false;
}
Log.Out(Logs::General, Logs::Status, "Loading adventure flavor text...");
Log(Logs::General, Logs::Status, "Loading adventure flavor text...");
LoadAdventureFlavor();
Log.Out(Logs::General, Logs::Status, "Loading ground spawns...");
Log(Logs::General, Logs::Status, "Loading ground spawns...");
if (!LoadGroundSpawns())
{
Log.Out(Logs::General, Logs::Error, "Loading ground spawns failed. continuing.");
Log(Logs::General, Logs::Error, "Loading ground spawns failed. continuing.");
}
Log.Out(Logs::General, Logs::Status, "Loading World Objects from DB...");
Log(Logs::General, Logs::Status, "Loading World Objects from DB...");
if (!LoadZoneObjects())
{
Log.Out(Logs::General, Logs::Error, "Loading World Objects failed. continuing.");
Log(Logs::General, Logs::Error, "Loading World Objects failed. continuing.");
}
Log.Out(Logs::General, Logs::Status, "Flushing old respawn timers...");
Log(Logs::General, Logs::Status, "Flushing old respawn timers...");
database.QueryDatabase("DELETE FROM `respawn_times` WHERE (`start` + `duration`) < UNIX_TIMESTAMP(NOW())");
//load up the zone's doors (prints inside)
@@ -983,10 +986,10 @@ bool Zone::Init(bool iStaticZone) {
petition_list.ClearPetitions();
petition_list.ReadDatabase();
Log.Out(Logs::General, Logs::Status, "Loading timezone data...");
Log(Logs::General, Logs::Status, "Loading timezone data...");
zone->zone_time.setEQTimeZone(database.GetZoneTZ(zoneid, GetInstanceVersion()));
Log.Out(Logs::General, Logs::Status, "Init Finished: ZoneID = %d, Time Offset = %d", zoneid, zone->zone_time.getEQTimeZone());
Log(Logs::General, Logs::Status, "Init Finished: ZoneID = %d, Time Offset = %d", zoneid, zone->zone_time.getEQTimeZone());
LoadTickItems();
@@ -997,32 +1000,32 @@ bool Zone::Init(bool iStaticZone) {
}
void Zone::ReloadStaticData() {
Log.Out(Logs::General, Logs::Status, "Reloading Zone Static Data...");
Log(Logs::General, Logs::Status, "Reloading Zone Static Data...");
Log.Out(Logs::General, Logs::Status, "Reloading static zone points...");
Log(Logs::General, Logs::Status, "Reloading static zone points...");
zone_point_list.Clear();
if (!database.LoadStaticZonePoints(&zone_point_list, GetShortName(), GetInstanceVersion())) {
Log.Out(Logs::General, Logs::Error, "Loading static zone points failed.");
Log(Logs::General, Logs::Error, "Loading static zone points failed.");
}
Log.Out(Logs::General, Logs::Status, "Reloading traps...");
Log(Logs::General, Logs::Status, "Reloading traps...");
entity_list.RemoveAllTraps();
if (!database.LoadTraps(GetShortName(), GetInstanceVersion()))
{
Log.Out(Logs::General, Logs::Error, "Reloading traps failed.");
Log(Logs::General, Logs::Error, "Reloading traps failed.");
}
Log.Out(Logs::General, Logs::Status, "Reloading ground spawns...");
Log(Logs::General, Logs::Status, "Reloading ground spawns...");
if (!LoadGroundSpawns())
{
Log.Out(Logs::General, Logs::Error, "Reloading ground spawns failed. continuing.");
Log(Logs::General, Logs::Error, "Reloading ground spawns failed. continuing.");
}
entity_list.RemoveAllObjects();
Log.Out(Logs::General, Logs::Status, "Reloading World Objects from DB...");
Log(Logs::General, Logs::Status, "Reloading World Objects from DB...");
if (!LoadZoneObjects())
{
Log.Out(Logs::General, Logs::Error, "Reloading World Objects failed. continuing.");
Log(Logs::General, Logs::Error, "Reloading World Objects failed. continuing.");
}
entity_list.RemoveAllDoors();
@@ -1038,7 +1041,7 @@ void Zone::ReloadStaticData() {
if (!LoadZoneCFG(zone->GetShortName(), zone->GetInstanceVersion(), true)) // try loading the zone name...
LoadZoneCFG(zone->GetFileName(), zone->GetInstanceVersion()); // if that fails, try the file name, then load defaults
Log.Out(Logs::General, Logs::Status, "Zone Static Data Reloaded.");
Log(Logs::General, Logs::Status, "Zone Static Data Reloaded.");
}
bool Zone::LoadZoneCFG(const char* filename, uint16 instance_id, bool DontLoadDefault)
@@ -1050,7 +1053,7 @@ bool Zone::LoadZoneCFG(const char* filename, uint16 instance_id, bool DontLoadDe
if(!database.GetZoneCFG(database.GetZoneID(filename), 0, &newzone_data, can_bind,
can_combat, can_levitate, can_castoutdoor, is_city, is_hotzone, allow_mercs, zone_type, default_ruleset, &map_name))
{
Log.Out(Logs::General, Logs::Error, "Error loading the Zone Config.");
Log(Logs::General, Logs::Error, "Error loading the Zone Config.");
return false;
}
}
@@ -1065,7 +1068,7 @@ bool Zone::LoadZoneCFG(const char* filename, uint16 instance_id, bool DontLoadDe
if(!database.GetZoneCFG(database.GetZoneID(filename), 0, &newzone_data, can_bind,
can_combat, can_levitate, can_castoutdoor, is_city, is_hotzone, allow_mercs, zone_type, default_ruleset, &map_name))
{
Log.Out(Logs::General, Logs::Error, "Error loading the Zone Config.");
Log(Logs::General, Logs::Error, "Error loading the Zone Config.");
return false;
}
}
@@ -1076,7 +1079,7 @@ bool Zone::LoadZoneCFG(const char* filename, uint16 instance_id, bool DontLoadDe
strcpy(newzone_data.zone_long_name, GetLongName());
strcpy(newzone_data.zone_short_name2, GetShortName());
Log.Out(Logs::General, Logs::Status, "Successfully loaded Zone Config.");
Log(Logs::General, Logs::Status, "Successfully loaded Zone Config.");
return true;
}
@@ -1379,11 +1382,11 @@ void Zone::ChangeWeather()
weathertimer = weatherTimerRule*1000;
Weather_Timer->Start(weathertimer);
}
Log.Out(Logs::General, Logs::None, "The next weather check for zone: %s will be in %i seconds.", zone->GetShortName(), Weather_Timer->GetRemainingTime()/1000);
Log(Logs::General, Logs::None, "The next weather check for zone: %s will be in %i seconds.", zone->GetShortName(), Weather_Timer->GetRemainingTime()/1000);
}
else
{
Log.Out(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);
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);
this->weatherSend();
if (zone->weather_intensity == 0)
{
@@ -1471,7 +1474,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.Out(Logs::General, Logs::None, "Error in Zone::Repop: database.PopulateZoneSpawnList failed");
Log(Logs::General, Logs::None, "Error in Zone::Repop: database.PopulateZoneSpawnList failed");
initgrids_timer.Start();
@@ -1493,7 +1496,7 @@ void Zone::Repop(uint32 delay) {
quest_manager.ClearAllTimers();
if (!database.PopulateZoneSpawnList(zoneid, spawn2_list, GetInstanceVersion(), delay))
Log.Out(Logs::General, Logs::None, "Error in Zone::Repop: database.PopulateZoneSpawnList failed");
Log(Logs::General, Logs::None, "Error in Zone::Repop: database.PopulateZoneSpawnList failed");
initgrids_timer.Start();
@@ -1541,7 +1544,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.Out(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);
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);
worldserver.SendPacket(pack);
/* Set Time Localization Flag */
@@ -1550,7 +1553,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.Out(Logs::General, Logs::Zone_Server, "Setting zone localized time...");
Log(Logs::General, Logs::Zone_Server, "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));
@@ -1604,8 +1607,8 @@ ZonePoint* Zone::GetClosestZonePoint(const glm::vec3& location, uint32 to, Clien
{
if(client)
client->CheatDetected(MQZoneUnknownDest, location.x, location.y, location.z); // Someone is trying to use /zone
Log.Out(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.Out(Logs::General, Logs::Status, "<Real Zone Points>. %s", to_string(location).c_str());
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());
}
if(closest_dist > max_distance2)
@@ -1881,7 +1884,7 @@ void Zone::LoadBlockedSpells(uint32 zoneid)
blocked_spells = new ZoneSpellsBlocked[totalBS];
if(!database.LoadBlockedSpells(totalBS, blocked_spells, zoneid))
{
Log.Out(Logs::General, Logs::Error, "... Failed to load blocked spells.");
Log(Logs::General, Logs::Error, "... Failed to load blocked spells.");
ClearBlockedSpells();
}
}
+3 -3
View File
@@ -280,13 +280,13 @@ public:
if (message.find("\n") != std::string::npos){
auto message_split = SplitString(message, '\n');
entity_list.MessageStatus(0, 80, Log.GetGMSayColorFromCategory(log_category), "%s", message_split[0].c_str());
entity_list.MessageStatus(0, 80, LogSys.GetGMSayColorFromCategory(log_category), "%s", message_split[0].c_str());
for (size_t iter = 1; iter < message_split.size(); ++iter) {
entity_list.MessageStatus(0, 80, Log.GetGMSayColorFromCategory(log_category), "--- %s", message_split[iter].c_str());
entity_list.MessageStatus(0, 80, LogSys.GetGMSayColorFromCategory(log_category), "--- %s", message_split[iter].c_str());
}
}
else{
entity_list.MessageStatus(0, 80, Log.GetGMSayColorFromCategory(log_category), "%s", message.c_str());
entity_list.MessageStatus(0, 80, LogSys.GetGMSayColorFromCategory(log_category), "%s", message.c_str());
}
}
+51 -51
View File
@@ -197,7 +197,7 @@ bool ZoneDatabase::GetZoneCFG(uint32 zoneid, uint16 instance_id, NewZone_Struct
//not in the DB yet:
zone_data->gravity = atof(row[56]);
Log.Out(Logs::General, Logs::Debug, "Zone Gravity is %f", zone_data->gravity);
Log(Logs::General, Logs::Debug, "Zone Gravity is %f", zone_data->gravity);
allow_mercs = true;
int bindable = 0;
@@ -471,7 +471,7 @@ void ZoneDatabase::GetEventLogs(const char* name,char* target,uint32 account_id,
void ZoneDatabase::LoadWorldContainer(uint32 parentid, EQEmu::ItemInstance* container)
{
if (!container) {
Log.Out(Logs::General, Logs::Error, "Programming error: LoadWorldContainer passed nullptr pointer");
Log(Logs::General, Logs::Error, "Programming error: LoadWorldContainer passed nullptr pointer");
return;
}
@@ -479,7 +479,7 @@ void ZoneDatabase::LoadWorldContainer(uint32 parentid, EQEmu::ItemInstance* cont
"FROM object_contents WHERE parentid = %i", parentid);
auto results = QueryDatabase(query);
if (!results.Success()) {
Log.Out(Logs::General, Logs::Error, "Error in DB::LoadWorldContainer: %s", results.ErrorMessage().c_str());
Log(Logs::General, Logs::Error, "Error in DB::LoadWorldContainer: %s", results.ErrorMessage().c_str());
return;
}
@@ -544,7 +544,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.Out(Logs::General, Logs::Error, "Error in ZoneDatabase::SaveWorldContainer: %s", results.ErrorMessage().c_str());
Log(Logs::General, Logs::Error, "Error in ZoneDatabase::SaveWorldContainer: %s", results.ErrorMessage().c_str());
}
@@ -556,7 +556,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.Out(Logs::General, Logs::Error, "Error in ZoneDatabase::DeleteWorldContainer: %s", results.ErrorMessage().c_str());
Log(Logs::General, Logs::Error, "Error in ZoneDatabase::DeleteWorldContainer: %s", results.ErrorMessage().c_str());
}
@@ -568,14 +568,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.Out(Logs::Detail, Logs::Trading, "Failed to load trader information!\n");
Log(Logs::Detail, Logs::Trading, "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.Out(Logs::Detail, Logs::Trading, "Bad Slot number when trying to load trader information!\n");
Log(Logs::Detail, Logs::Trading, "Bad Slot number when trying to load trader information!\n");
continue;
}
@@ -593,13 +593,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.Out(Logs::Detail, Logs::Trading, "Failed to load trader information!\n");
Log(Logs::Detail, Logs::Trading, "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.Out(Logs::Detail, Logs::Trading, "Bad Slot number when trying to load trader information!\n");
Log(Logs::Detail, Logs::Trading, "Bad Slot number when trying to load trader information!\n");
continue;
}
@@ -619,7 +619,7 @@ EQEmu::ItemInstance* ZoneDatabase::LoadSingleTraderItem(uint32 CharID, int Seria
return nullptr;
if (results.RowCount() == 0) {
Log.Out(Logs::Detail, Logs::Trading, "Bad result from query\n"); fflush(stdout);
Log(Logs::Detail, Logs::Trading, "Bad result from query\n"); fflush(stdout);
return nullptr;
}
@@ -632,7 +632,7 @@ EQEmu::ItemInstance* ZoneDatabase::LoadSingleTraderItem(uint32 CharID, int Seria
const EQEmu::ItemData *item = database.GetItem(ItemID);
if(!item) {
Log.Out(Logs::Detail, Logs::Trading, "Unable to create item\n");
Log(Logs::Detail, Logs::Trading, "Unable to create item\n");
fflush(stdout);
return nullptr;
}
@@ -642,7 +642,7 @@ EQEmu::ItemInstance* ZoneDatabase::LoadSingleTraderItem(uint32 CharID, int Seria
EQEmu::ItemInstance* inst = database.CreateItem(item);
if(!inst) {
Log.Out(Logs::Detail, Logs::Trading, "Unable to create item instance\n");
Log(Logs::Detail, Logs::Trading, "Unable to create item instance\n");
fflush(stdout);
return nullptr;
}
@@ -664,25 +664,25 @@ void ZoneDatabase::SaveTraderItem(uint32 CharID, uint32 ItemID, uint32 SerialNum
CharID, ItemID, SerialNumber, Charges, ItemCost, Slot);
auto results = QueryDatabase(query);
if (!results.Success())
Log.Out(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());
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());
}
void ZoneDatabase::UpdateTraderItemCharges(int CharID, uint32 SerialNumber, int32 Charges) {
Log.Out(Logs::Detail, Logs::Trading, "ZoneDatabase::UpdateTraderItemCharges(%i, %i, %i)", CharID, SerialNumber, Charges);
Log(Logs::Detail, Logs::Trading, "ZoneDatabase::UpdateTraderItemCharges(%i, %i, %i)", 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.Out(Logs::Detail, Logs::None, "[CLIENT] Failed to update charges for trader item: %i for char_id: %i, the error was: %s\n",
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());
}
void ZoneDatabase::UpdateTraderItemPrice(int CharID, uint32 ItemID, uint32 Charges, uint32 NewPrice) {
Log.Out(Logs::Detail, Logs::Trading, "ZoneDatabase::UpdateTraderPrice(%i, %i, %i, %i)", CharID, ItemID, Charges, NewPrice);
Log(Logs::Detail, Logs::Trading, "ZoneDatabase::UpdateTraderPrice(%i, %i, %i, %i)", CharID, ItemID, Charges, NewPrice);
const EQEmu::ItemData *item = database.GetItem(ItemID);
@@ -690,12 +690,12 @@ void ZoneDatabase::UpdateTraderItemPrice(int CharID, uint32 ItemID, uint32 Charg
return;
if(NewPrice == 0) {
Log.Out(Logs::Detail, Logs::Trading, "Removing Trader items from the DB for CharID %i, ItemID %i", CharID, ItemID);
Log(Logs::Detail, Logs::Trading, "Removing Trader items from the DB for CharID %i, ItemID %i", 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.Out(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());
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());
return;
}
@@ -706,7 +706,7 @@ void ZoneDatabase::UpdateTraderItemPrice(int CharID, uint32 ItemID, uint32 Charg
NewPrice, CharID, ItemID, Charges);
auto results = QueryDatabase(query);
if (!results.Success())
Log.Out(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());
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());
return;
}
@@ -716,7 +716,7 @@ void ZoneDatabase::UpdateTraderItemPrice(int CharID, uint32 ItemID, uint32 Charg
NewPrice, CharID, ItemID);
auto results = QueryDatabase(query);
if (!results.Success())
Log.Out(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());
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());
}
void ZoneDatabase::DeleteTraderItem(uint32 char_id){
@@ -725,7 +725,7 @@ void ZoneDatabase::DeleteTraderItem(uint32 char_id){
const std::string query = "DELETE FROM trader";
auto results = QueryDatabase(query);
if (!results.Success())
Log.Out(Logs::Detail, Logs::None, "[CLIENT] Failed to delete all trader items data, the error was: %s\n", results.ErrorMessage().c_str());
Log(Logs::Detail, Logs::None, "[CLIENT] Failed to delete all trader items data, the error was: %s\n", results.ErrorMessage().c_str());
return;
}
@@ -733,7 +733,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.Out(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());
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());
}
void ZoneDatabase::DeleteTraderItem(uint32 CharID,uint16 SlotID) {
@@ -741,7 +741,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.Out(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());
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());
}
void ZoneDatabase::DeleteBuyLines(uint32 CharID) {
@@ -750,7 +750,7 @@ void ZoneDatabase::DeleteBuyLines(uint32 CharID) {
const std::string query = "DELETE FROM buyer";
auto results = QueryDatabase(query);
if (!results.Success())
Log.Out(Logs::Detail, Logs::None, "[CLIENT] Failed to delete all buyer items data, the error was: %s\n",results.ErrorMessage().c_str());
Log(Logs::Detail, Logs::None, "[CLIENT] Failed to delete all buyer items data, the error was: %s\n",results.ErrorMessage().c_str());
return;
}
@@ -758,7 +758,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.Out(Logs::Detail, Logs::None, "[CLIENT] Failed to delete buyer item data for charid: %i, the error was: %s\n",CharID,results.ErrorMessage().c_str());
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());
}
@@ -767,7 +767,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.Out(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());
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());
}
@@ -775,7 +775,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.Out(Logs::Detail, Logs::None, "[CLIENT] Failed to delete buyslot %i for charid: %i, the error was: %s\n", BuySlot, CharID, results.ErrorMessage().c_str());
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());
}
@@ -788,7 +788,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.Out(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());
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());
}
@@ -1288,7 +1288,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.Out(Logs::General, Logs::None, "ZoneDatabase::SaveCharacterLanguage for character ID: %i, lang_id:%u value:%u done", character_id, lang_id, value);
Log(Logs::General, Logs::None, "ZoneDatabase::SaveCharacterLanguage for character ID: %i, lang_id:%u value:%u done", character_id, lang_id, value);
return true;
}
@@ -1300,13 +1300,13 @@ 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.Out(Logs::General, Logs::None, "ZoneDatabase::SaveCharacterBindPoint for character ID: %i zone_id: %u "
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",
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.Out(Logs::General, Logs::None, "ERROR Bind Home Save: %s. %s", results.ErrorMessage().c_str(),
Log(Logs::General, Logs::None, "ERROR Bind Home Save: %s. %s", results.ErrorMessage().c_str(),
query.c_str());
return true;
@@ -1318,20 +1318,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.Out(Logs::General, Logs::None, "ZoneDatabase::SaveCharacterMaterialColor for character ID: %i, slot_id: %u color: %u done", character_id, slot_id, color);
Log(Logs::General, Logs::None, "ZoneDatabase::SaveCharacterMaterialColor for character ID: %i, slot_id: %u color: %u 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.Out(Logs::General, Logs::None, "ZoneDatabase::SaveCharacterSkill for character ID: %i, skill_id:%u value:%u done", character_id, skill_id, value);
Log(Logs::General, Logs::None, "ZoneDatabase::SaveCharacterSkill for character ID: %i, skill_id:%u value:%u 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.Out(Logs::General, Logs::None, "ZoneDatabase::SaveCharacterDisc for character ID: %i, slot:%u disc_id:%u done", character_id, slot_id, disc_id);
Log(Logs::General, Logs::None, "ZoneDatabase::SaveCharacterDisc for character ID: %i, slot:%u disc_id:%u done", character_id, slot_id, disc_id);
return true;
}
@@ -1343,7 +1343,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.Out(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);
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);
}
}
return true;
@@ -1355,7 +1355,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.Out(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);
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);
return true;
}
@@ -1427,7 +1427,7 @@ bool ZoneDatabase::SaveCharacterInventorySnapshot(uint32 character_id){
character_id
);
auto results = database.QueryDatabase(query);
Log.Out(Logs::General, Logs::None, "ZoneDatabase::SaveCharacterInventorySnapshot %i (%s)", character_id, (results.Success() ? "pass" : "fail"));
Log(Logs::General, Logs::None, "ZoneDatabase::SaveCharacterInventorySnapshot %i (%s)", character_id, (results.Success() ? "pass" : "fail"));
return results.Success();
}
@@ -1722,7 +1722,7 @@ bool ZoneDatabase::SaveCharacterData(uint32 character_id, uint32 account_id, Pla
m_epp->last_invsnapshot_time
);
auto results = database.QueryDatabase(query);
Log.Out(Logs::General, Logs::None, "ZoneDatabase::SaveCharacterData %i, done... Took %f seconds", character_id, ((float)(std::clock() - t)) / CLOCKS_PER_SEC);
Log(Logs::General, Logs::None, "ZoneDatabase::SaveCharacterData %i, done... Took %f seconds", character_id, ((float)(std::clock() - t)) / CLOCKS_PER_SEC);
return true;
}
@@ -1763,7 +1763,7 @@ bool ZoneDatabase::SaveCharacterCurrency(uint32 character_id, PlayerProfile_Stru
pp->currentEbonCrystals,
pp->careerEbonCrystals);
auto results = database.QueryDatabase(query);
Log.Out(Logs::General, Logs::None, "Saving Currency for character ID: %i, done", character_id);
Log(Logs::General, Logs::None, "Saving Currency for character ID: %i, done", character_id);
return true;
}
@@ -1772,7 +1772,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.Out(Logs::General, Logs::None, "Saving AA for character ID: %u, aa_id: %u current_level: %u", character_id, aa_id, current_level);
Log(Logs::General, Logs::None, "Saving AA for character ID: %u, aa_id: %u current_level: %u", character_id, aa_id, current_level);
return true;
}
@@ -1859,7 +1859,7 @@ const NPCType* ZoneDatabase::LoadNPCTypesData(uint32 npc_type_id, bool bulk_load
std::string where_condition = "";
if (bulk_load){
Log.Out(Logs::General, Logs::Debug, "Performing bulk NPC Types load");
Log(Logs::General, Logs::Debug, "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 "
@@ -2547,7 +2547,7 @@ void ZoneDatabase::SaveMercBuffs(Merc *merc) {
std::string query = StringFormat("DELETE FROM merc_buffs WHERE MercId = %u", merc->GetMercID());
auto results = database.QueryDatabase(query);
if(!results.Success()) {
Log.Out(Logs::General, Logs::Error, "Error While Deleting Merc Buffs before save: %s", results.ErrorMessage().c_str());
Log(Logs::General, Logs::Error, "Error While Deleting Merc Buffs before save: %s", results.ErrorMessage().c_str());
return;
}
@@ -2573,7 +2573,7 @@ void ZoneDatabase::SaveMercBuffs(Merc *merc) {
buffs[buffCount].caston_z, buffs[buffCount].ExtraDIChance);
results = database.QueryDatabase(query);
if(!results.Success()) {
Log.Out(Logs::General, Logs::Error, "Error Saving Merc Buffs: %s", results.ErrorMessage().c_str());
Log(Logs::General, Logs::Error, "Error Saving Merc Buffs: %s", results.ErrorMessage().c_str());
break;
}
}
@@ -2592,7 +2592,7 @@ void ZoneDatabase::LoadMercBuffs(Merc *merc) {
merc->GetMercID());
auto results = database.QueryDatabase(query);
if(!results.Success()) {
Log.Out(Logs::General, Logs::Error, "Error Loading Merc Buffs: %s", results.ErrorMessage().c_str());
Log(Logs::General, Logs::Error, "Error Loading Merc Buffs: %s", results.ErrorMessage().c_str());
return;
}
@@ -2637,7 +2637,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.Out(Logs::General, Logs::Error, "Error Loading Merc Buffs: %s", results.ErrorMessage().c_str());
Log(Logs::General, Logs::Error, "Error Loading Merc Buffs: %s", results.ErrorMessage().c_str());
}
@@ -2653,14 +2653,14 @@ bool ZoneDatabase::DeleteMerc(uint32 merc_id) {
auto results = database.QueryDatabase(query);
if(!results.Success())
{
Log.Out(Logs::General, Logs::Error, "Error Deleting Merc Buffs: %s", results.ErrorMessage().c_str());
Log(Logs::General, Logs::Error, "Error Deleting Merc Buffs: %s", results.ErrorMessage().c_str());
}
query = StringFormat("DELETE FROM mercs WHERE MercID = '%u'", merc_id);
results = database.QueryDatabase(query);
if(!results.Success())
{
Log.Out(Logs::General, Logs::Error, "Error Deleting Merc: %s", results.ErrorMessage().c_str());
Log(Logs::General, Logs::Error, "Error Deleting Merc: %s", results.ErrorMessage().c_str());
return false;
}
@@ -2678,7 +2678,7 @@ void ZoneDatabase::LoadMercEquipment(Merc *merc) {
merc->GetLevel(), merc->GetLevel());
auto results = database.QueryDatabase(query);
if(!results.Success()) {
Log.Out(Logs::General, Logs::Error, "Error Loading Merc Inventory: %s", results.ErrorMessage().c_str());
Log(Logs::General, Logs::Error, "Error Loading Merc Inventory: %s", results.ErrorMessage().c_str());
return;
}
@@ -2889,7 +2889,7 @@ int32 ZoneDatabase::GetBlockedSpellsCount(uint32 zoneid)
bool ZoneDatabase::LoadBlockedSpells(int32 blockedSpellsCount, ZoneSpellsBlocked* into, uint32 zoneid)
{
Log.Out(Logs::General, Logs::Status, "Loading Blocked Spells from database...");
Log(Logs::General, Logs::Status, "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);
@@ -3980,7 +3980,7 @@ Corpse* ZoneDatabase::SummonBuriedCharacterCorpses(uint32 char_id, uint32 dest_z
corpse->SetDecayTimer(RuleI(Character, CorpseDecayTimeMS));
corpse->Spawn();
if (!UnburyCharacterCorpse(corpse->GetCorpseDBID(), dest_zone_id, dest_instance_id, position))
Log.Out(Logs::General, Logs::Error, "Unable to unbury a summoned player corpse for character id %u.", char_id);
Log(Logs::General, Logs::Error, "Unable to unbury a summoned player corpse for character id %u.", char_id);
}
return corpse;
@@ -4019,7 +4019,7 @@ bool ZoneDatabase::SummonAllCharacterCorpses(uint32 char_id, uint32 dest_zone_id
++CorpseCount;
}
else{
Log.Out(Logs::General, Logs::Error, "Unable to construct a player corpse for character id %u.", char_id);
Log(Logs::General, Logs::Error, "Unable to construct a player corpse for character id %u.", char_id);
}
}
+23 -23
View File
@@ -44,12 +44,12 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) {
zoning = true;
if (app->size != sizeof(ZoneChange_Struct)) {
Log.Out(Logs::General, Logs::None, "Wrong size: OP_ZoneChange, size=%d, expected %d", app->size, sizeof(ZoneChange_Struct));
Log(Logs::General, Logs::None, "Wrong size: OP_ZoneChange, size=%d, expected %d", app->size, sizeof(ZoneChange_Struct));
return;
}
#if EQDEBUG >= 5
Log.Out(Logs::General, Logs::None, "Zone request from %s", GetName());
Log(Logs::General, Logs::None, "Zone request from %s", GetName());
DumpPacket(app);
#endif
ZoneChange_Struct* zc=(ZoneChange_Struct*)app->pBuffer;
@@ -97,7 +97,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) {
CheatDetected(MQZone, zc->x, zc->y, zc->z);
Message(13, "Invalid unsolicited zone request.");
Log.Out(Logs::General, Logs::Error, "Zoning %s: Invalid unsolicited zone request to zone id '%d'.", GetName(), target_zone_id);
Log(Logs::General, Logs::Error, "Zoning %s: Invalid unsolicited zone request to zone id '%d'.", 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.Out(Logs::General, Logs::Error, "Zoning %s: Invalid unsolicited zone request to zone id '%d'.", GetName(), target_zone_id);
Log(Logs::General, Logs::Error, "Zoning %s: Invalid unsolicited zone request to zone id '%d'.", GetName(), target_zone_id);
CheatDetected(MQGate, zc->x, zc->y, zc->z);
SendZoneCancel(zc);
return;
@@ -160,7 +160,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) {
if(target_zone_name == nullptr) {
//invalid zone...
Message(13, "Invalid target zone ID.");
Log.Out(Logs::General, Logs::Error, "Zoning %s: Unable to get zone name for zone id '%d'.", GetName(), target_zone_id);
Log(Logs::General, Logs::Error, "Zoning %s: Unable to get zone name for zone id '%d'.", 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(13, "Invalid target zone while getting safe points.");
Log.Out(Logs::General, Logs::Error, "Zoning %s: Unable to get safe coordinates for zone '%s'.", GetName(), target_zone_name);
Log(Logs::General, Logs::Error, "Zoning %s: Unable to get safe coordinates for zone '%s'.", 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.Out(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);
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);
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.
CheatDetected(MQZoneUnknownDest, 0.0, 0.0, 0.0);
Log.Out(Logs::General, Logs::Error, "Zoning %s: Invalid unsolicited zone request to zone id '%s'. Not near a zone point.", GetName(), target_zone_name);
Log(Logs::General, Logs::Error, "Zoning %s: Invalid unsolicited zone request to zone id '%s'. 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.Out(Logs::General, Logs::Error, "Zoning %s: Rules prevent this char from zoning into '%s'", GetName(), target_zone_name);
Log(Logs::General, Logs::Error, "Zoning %s: Rules prevent this char from zoning into '%s'", GetName(), target_zone_name);
SendZoneError(zc, myerror);
}
}
@@ -312,7 +312,7 @@ void Client::SendZoneCancel(ZoneChange_Struct *zc) {
void Client::SendZoneError(ZoneChange_Struct *zc, int8 err)
{
Log.Out(Logs::General, Logs::Error, "Zone %i is not available because target wasn't found or character insufficent level", zc->zoneID);
Log(Logs::General, Logs::Error, "Zone %i is not available because target wasn't found or character insufficent level", zc->zoneID);
SetPortExemption(true);
@@ -347,7 +347,7 @@ void Client::DoZoneSuccess(ZoneChange_Struct *zc, uint16 zone_id, uint32 instanc
if(this->GetPet())
entity_list.RemoveFromHateLists(this->GetPet());
Log.Out(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);
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);
//set the player's coordinates in the new zone so they have them
//when they zone into it
@@ -470,7 +470,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.Out(Logs::General, Logs::Error, "Client::ProcessMovePC received a reguest to perform an unsupported client zone operation.");
Log(Logs::General, Logs::Error, "Client::ProcessMovePC received a reguest to perform an unsupported client zone operation.");
break;
}
}
@@ -531,7 +531,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.Out(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",
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",
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:
@@ -540,7 +540,7 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z
SetHeading(heading);
break;
case Rewind:
Log.Out(Logs::General, Logs::None, "%s has requested a /rewind from %f, %f, %f, to %f, %f, %f in %s", GetName(),
Log(Logs::General, Logs::None, "%s has requested a /rewind from %f, %f, %f, to %f, %f, %f in %s", 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);
@@ -548,7 +548,7 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z
SetHeading(heading);
break;
default:
Log.Out(Logs::General, Logs::Error, "Client::ZonePC() received a reguest to perform an unsupported client zone operation.");
Log(Logs::General, Logs::Error, "Client::ZonePC() received a reguest to perform an unsupported client zone operation.");
ReadyToZone = false;
break;
}
@@ -684,7 +684,7 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z
safe_delete(outapp);
}
Log.Out(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);
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);
//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.
@@ -774,7 +774,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.Out(Logs::General, Logs::Error, "MySQL Error while trying to set zone flag for %s: %s", GetName(), results.ErrorMessage().c_str());
Log(Logs::General, Logs::Error, "MySQL Error while trying to set zone flag for %s: %s", GetName(), results.ErrorMessage().c_str());
}
void Client::ClearZoneFlag(uint32 zone_id) {
@@ -787,7 +787,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.Out(Logs::General, Logs::Error, "MySQL Error while trying to clear zone flag for %s: %s", GetName(), results.ErrorMessage().c_str());
Log(Logs::General, Logs::Error, "MySQL Error while trying to clear zone flag for %s: %s", GetName(), results.ErrorMessage().c_str());
}
@@ -797,7 +797,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.Out(Logs::General, Logs::Error, "MySQL Error while trying to load zone flags for %s: %s", GetName(), results.ErrorMessage().c_str());
Log(Logs::General, Logs::Error, "MySQL Error while trying to load zone flags for %s: %s", GetName(), results.ErrorMessage().c_str());
return;
}
@@ -860,23 +860,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.Out(Logs::Detail, Logs::None, "[CLIENT] Unable to query zone info for ourself '%s'", zone->GetShortName());
Log(Logs::Detail, Logs::None, "[CLIENT] Unable to query zone info for ourself '%s'", zone->GetShortName());
return(false);
}
if(GetLevel() < minlevel) {
Log.Out(Logs::Detail, Logs::None, "[CLIENT] Character does not meet min level requirement (%d < %d)!", GetLevel(), minlevel);
Log(Logs::Detail, Logs::None, "[CLIENT] Character does not meet min level requirement (%d < %d)!", GetLevel(), minlevel);
return(false);
}
if(Admin() < minstatus) {
Log.Out(Logs::Detail, Logs::None, "[CLIENT] Character does not meet min status requirement (%d < %d)!", Admin(), minstatus);
Log(Logs::Detail, Logs::None, "[CLIENT] Character does not meet min status requirement (%d < %d)!", 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.Out(Logs::Detail, Logs::None, "[CLIENT] Character does not have the flag to be in this zone (%s)!", flag_needed);
Log(Logs::Detail, Logs::None, "[CLIENT] Character does not have the flag to be in this zone (%s)!", flag_needed);
return(false);
}
}