mirror of
https://github.com/EQEmu/Server.git
synced 2026-02-22 14:42:24 +00:00
Tweaks to log.out to filter messages at detail level not just cat level before formatting the message, tweaks to pathing, nearly where i want it but not entirely there.
This commit is contained in:
parent
14d8683227
commit
1d055b5364
@ -123,26 +123,21 @@ void EQEmuLogSys::LoadLogSettingsDefaults()
|
||||
|
||||
std::string EQEmuLogSys::FormatOutMessageString(uint16 log_category, const std::string &in_message)
|
||||
{
|
||||
std::string category_string;
|
||||
if (log_category > 0 && Logs::LogCategoryName[log_category])
|
||||
category_string = StringFormat("[%s] ", Logs::LogCategoryName[log_category]);
|
||||
return StringFormat("%s%s", category_string.c_str(), in_message.c_str());
|
||||
std::string ret;
|
||||
ret.push_back('[');
|
||||
ret.append(Logs::LogCategoryName[log_category]);
|
||||
ret.push_back(']');
|
||||
ret.push_back(' ');
|
||||
ret.append(in_message);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void EQEmuLogSys::ProcessGMSay(uint16 debug_level, uint16 log_category, const std::string &message)
|
||||
{
|
||||
/* Check if category enabled for process */
|
||||
if (log_settings[log_category].log_to_gmsay == 0)
|
||||
return;
|
||||
|
||||
/* Enabling Netcode based GMSay output creates a feedback loop that ultimately ends in a crash */
|
||||
if (log_category == Logs::LogCategory::Netcode)
|
||||
return;
|
||||
|
||||
/* Make sure the message inbound is at a debug level we're set at */
|
||||
if (log_settings[log_category].log_to_gmsay < debug_level)
|
||||
return;
|
||||
|
||||
/* Check to see if the process that actually ran this is zone */
|
||||
if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone)
|
||||
on_log_gmsay_hook(log_category, message);
|
||||
@ -160,14 +155,6 @@ void EQEmuLogSys::ProcessLogWrite(uint16 debug_level, uint16 log_category, const
|
||||
crash_log.close();
|
||||
}
|
||||
|
||||
/* Check if category enabled for process */
|
||||
if (log_settings[log_category].log_to_file == 0)
|
||||
return;
|
||||
|
||||
/* Make sure the message inbound is at a debug level we're set at */
|
||||
if (log_settings[log_category].log_to_file < debug_level)
|
||||
return;
|
||||
|
||||
char time_stamp[80];
|
||||
EQEmuLogSys::SetCurrentTimeStamp(time_stamp);
|
||||
|
||||
@ -246,13 +233,6 @@ uint16 EQEmuLogSys::GetGMSayColorFromCategory(uint16 log_category) {
|
||||
|
||||
void EQEmuLogSys::ProcessConsoleMessage(uint16 debug_level, uint16 log_category, const std::string &message)
|
||||
{
|
||||
/* Check if category enabled for process */
|
||||
if (log_settings[log_category].log_to_console == 0)
|
||||
return;
|
||||
|
||||
/* Make sure the message inbound is at a debug level we're set at */
|
||||
if (log_settings[log_category].log_to_console < debug_level)
|
||||
return;
|
||||
|
||||
#ifdef _WINDOWS
|
||||
HANDLE console_handle;
|
||||
@ -273,20 +253,32 @@ void EQEmuLogSys::ProcessConsoleMessage(uint16 debug_level, uint16 log_category,
|
||||
|
||||
void EQEmuLogSys::Out(Logs::DebugLevel debug_level, uint16 log_category, std::string message, ...)
|
||||
{
|
||||
const bool log_to_console = log_settings[log_category].log_to_console > 0;
|
||||
const bool log_to_file = log_settings[log_category].log_to_file > 0;
|
||||
const bool log_to_gmsay = log_settings[log_category].log_to_gmsay > 0;
|
||||
const bool nothing_to_log = !log_to_console && !log_to_file && !log_to_gmsay;
|
||||
bool log_to_console = true;
|
||||
if (log_settings[log_category].log_to_console < debug_level) {
|
||||
log_to_console = false;
|
||||
}
|
||||
|
||||
if (nothing_to_log) return;
|
||||
bool log_to_file = true;
|
||||
if (log_settings[log_category].log_to_file < debug_level) {
|
||||
log_to_file = false;
|
||||
}
|
||||
|
||||
bool log_to_gmsay = true;
|
||||
if (log_settings[log_category].log_to_gmsay < debug_level) {
|
||||
log_to_gmsay = false;
|
||||
}
|
||||
|
||||
const bool nothing_to_log = !log_to_console && !log_to_file && !log_to_gmsay;
|
||||
if (nothing_to_log)
|
||||
return;
|
||||
|
||||
va_list args;
|
||||
va_start(args, message);
|
||||
std::string output_message = vStringFormat(message.c_str(), args);
|
||||
va_end(args);
|
||||
|
||||
|
||||
std::string output_debug_message = EQEmuLogSys::FormatOutMessageString(log_category, output_message);
|
||||
|
||||
|
||||
if (log_to_console) EQEmuLogSys::ProcessConsoleMessage(debug_level, log_category, output_debug_message);
|
||||
if (log_to_gmsay) EQEmuLogSys::ProcessGMSay(debug_level, log_category, output_debug_message);
|
||||
if (log_to_file) EQEmuLogSys::ProcessLogWrite(debug_level, log_category, output_debug_message);
|
||||
|
||||
41
zone/mob.cpp
41
zone/mob.cpp
@ -108,7 +108,8 @@ Mob::Mob(const char* in_name,
|
||||
m_TargetLocation(glm::vec3()),
|
||||
m_TargetV(glm::vec3()),
|
||||
flee_timer(FLEE_CHECK_TIMER),
|
||||
m_Position(position)
|
||||
m_Position(position),
|
||||
m_pos_update_timer(3000)
|
||||
{
|
||||
targeted = 0;
|
||||
tar_ndx=0;
|
||||
@ -119,7 +120,8 @@ Mob::Mob(const char* in_name,
|
||||
SetMoving(false);
|
||||
moved=false;
|
||||
m_RewindLocation = glm::vec3();
|
||||
move_tic_count = 0;
|
||||
m_pos_update_heading = INVALID_POS_HEADING;
|
||||
m_pos_update_speed = 0;
|
||||
|
||||
_egnode = nullptr;
|
||||
name[0]=0;
|
||||
@ -1372,39 +1374,34 @@ void Mob::SendPosition()
|
||||
EQApplicationPacket* app = new EQApplicationPacket(OP_ClientUpdate, sizeof(PlayerPositionUpdateServer_Struct));
|
||||
PlayerPositionUpdateServer_Struct* spu = (PlayerPositionUpdateServer_Struct*)app->pBuffer;
|
||||
MakeSpawnUpdateNoDelta(spu);
|
||||
move_tic_count = 0;
|
||||
m_pos_update_heading = INVALID_POS_HEADING;
|
||||
m_pos_update_speed = 0;
|
||||
entity_list.QueueClients(this, app, true);
|
||||
safe_delete(app);
|
||||
}
|
||||
|
||||
// this one is for mobs on the move, with deltas - this makes them walk
|
||||
void Mob::SendPosUpdate(uint8 iSendToSelf) {
|
||||
EQApplicationPacket* app = new EQApplicationPacket(OP_ClientUpdate, sizeof(PlayerPositionUpdateServer_Struct));
|
||||
PlayerPositionUpdateServer_Struct* spu = (PlayerPositionUpdateServer_Struct*)app->pBuffer;
|
||||
EQApplicationPacket app(OP_ClientUpdate, sizeof(PlayerPositionUpdateServer_Struct));
|
||||
PlayerPositionUpdateServer_Struct* spu = (PlayerPositionUpdateServer_Struct*)app.pBuffer;
|
||||
MakeSpawnUpdate(spu);
|
||||
|
||||
if (iSendToSelf == 2) {
|
||||
if (IsClient()) {
|
||||
CastToClient()->FastQueuePacket(&app,false);
|
||||
}
|
||||
if (IsClient() && iSendToSelf) {
|
||||
CastToClient()->QueuePacket(&app,false);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(move_tic_count == RuleI(Zone, NPCPositonUpdateTicCount))
|
||||
if (m_pos_update_heading == INVALID_POS_HEADING ||
|
||||
m_pos_update_timer.Check() ||
|
||||
m_pos_update_speed != pRunAnimSpeed ||
|
||||
abs(m_pos_update_heading - GetHeading()) > INVALID_POS_HEADING_EPS)
|
||||
{
|
||||
entity_list.QueueClients(this, app, (iSendToSelf == 0), false);
|
||||
move_tic_count = 0;
|
||||
}
|
||||
else if(move_tic_count % 2 == 0)
|
||||
{
|
||||
entity_list.QueueCloseClients(this, app, (iSendToSelf == 0), 700, nullptr, false);
|
||||
move_tic_count++;
|
||||
}
|
||||
else {
|
||||
move_tic_count++;
|
||||
m_pos_update_speed = pRunAnimSpeed;
|
||||
m_pos_update_heading = GetHeading();
|
||||
entity_list.QueueCloseClients(this, &app, (iSendToSelf == 0), 1000, nullptr, false);
|
||||
m_pos_update_timer.Start();
|
||||
}
|
||||
}
|
||||
safe_delete(app);
|
||||
}
|
||||
|
||||
// this is for SendPosition()
|
||||
@ -1444,7 +1441,7 @@ void Mob::MakeSpawnUpdate(PlayerPositionUpdateServer_Struct* spu) {
|
||||
if(this->IsClient())
|
||||
spu->animation = animation;
|
||||
else
|
||||
spu->animation = pRunAnimSpeed;//animation;
|
||||
spu->animation = pRunAnimSpeed;
|
||||
spu->delta_heading = NewFloatToEQ13(m_Delta.w);
|
||||
}
|
||||
|
||||
|
||||
@ -32,6 +32,8 @@
|
||||
char* strn0cpy(char* dest, const char* source, uint32 size);
|
||||
|
||||
#define MAX_SPECIAL_ATTACK_PARAMS 8
|
||||
#define INVALID_POS_HEADING -99999.0
|
||||
#define INVALID_POS_HEADING_EPS 0.01
|
||||
|
||||
class EGNode;
|
||||
class Client;
|
||||
@ -1286,12 +1288,13 @@ protected:
|
||||
int32 GetItemFactionBonus(uint32 pFactionID);
|
||||
void ClearItemFactionBonuses();
|
||||
|
||||
void CalculateFearPosition();
|
||||
uint32 move_tic_count;
|
||||
|
||||
bool flee_mode;
|
||||
Timer flee_timer;
|
||||
|
||||
Timer m_pos_update_timer;
|
||||
float m_pos_update_heading;
|
||||
uint8 m_pos_update_speed;
|
||||
|
||||
bool pAIControlled;
|
||||
bool roamer;
|
||||
bool logging_enabled;
|
||||
|
||||
@ -19,18 +19,24 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
|
||||
if (to == from)
|
||||
return to;
|
||||
|
||||
if (DistanceSquaredNoZ(m_Position, glm::vec4(ToX, ToY, ToZ, 0.0f)) < 100.0f) {
|
||||
return to;
|
||||
}
|
||||
|
||||
if (!m_pathing_route.Active() || !m_pathing_route.DestinationValid(to)) {
|
||||
m_pathing_route = zone->pathing.FindRoute(from, to);
|
||||
|
||||
auto &nodes = m_pathing_route.GetNodesEdit();
|
||||
auto &last_node = nodes[nodes.size() - 1];
|
||||
if (DistanceSquared(glm::vec4(last_node.position, 1.0f), glm::vec4(ToX, ToY, ToZ, 0.0f)) > 100.0f) {
|
||||
auto dist = DistanceSquared(glm::vec4(last_node.position, 1.0f), glm::vec4(ToX, ToY, ToZ, 0.0f));
|
||||
if (dist > 10000.0f) {
|
||||
auto flag_temp = last_node.flag;
|
||||
last_node.flag = NavigationPolyFlagPortal;
|
||||
|
||||
PathfindingNode end;
|
||||
end.position.x = ToX;
|
||||
end.position.y = ToY;
|
||||
end.position.z = ToZ;
|
||||
end.flag = flag_temp;
|
||||
nodes.push_back(end);
|
||||
}
|
||||
else if (dist > 100.0f) {
|
||||
PathfindingNode end;
|
||||
end.position.x = ToX;
|
||||
end.position.y = ToY;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user