mirror of
https://github.com/EQEmu/Server.git
synced 2026-09-04 10:26:37 +00:00
[Performance] Reworked how all log calls are made in the source, see changelog.txt for more details
This commit is contained in:
+33
-33
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user