mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-19 13:28:25 +00:00
Changed zone process window title format, example: 'crushbone :: clients: 6 inst_id: 1 inst_ver: 0 :: port: 7015'
Most of the following changes are QueryServ related, fully implemented its original functionality to be able to offload
intensive or metric based logging to a remote server process that could exist on another server entirely
Implemented Player Event Logging Types (Go to table `qs_player_events`):
1 = Player_Log_Quest,
2 = Player_Log_Zoning,
3 = Player_Log_Deaths,
4 = Player_Log_Connect_State,
5 = Player_Log_Levels,
6 = Player_Log_Keyring_Addition,
7 = Player_Log_QGlobal_Update,
8 = Player_Log_Task_Updates,
9 = Player_Log_AA_Purchases,
10 = Player_Log_Trade_Skill_Events,
11 = Player_Log_Issued_Commands,
12 = Player_Log_Money_Transactions,
13 = Player_Log_Alternate_Currency_Transactions,
- All QueryServ logging will be implemented with a front end in EoC 2.0 very soon
Changed all QS Error related logging to 'QUERYSERV__ERROR'
(Natedog) (Crash Fix) Legacy MySQL bug revert for loading AA's COALESCE( from COALESCE (
Implemented Perl Quest objects (LUA still needed to be exported):
- quest::qs_send_query("MySQL query") - Will send a raw query to the QueryServ process, useful for custom logging
- quest::qs_player_event(char_id, event_desc); - Will process a quest type event to table `qs_player_events`
Added MySQL Tables:
- `qs_player_aa_rate_hourly`
- `qs_player_events`
- Source table structures from:
- utils\sql\git\queryserv\required\08_23_2014_player_events_and_player_aa_rate_hourly
To get the complete QueryServ schema, source from here:
- utils\sql\git\queryserv\required\Complete_QueryServ_Table_Structures.sql
Added rules for each logging type, source rules here with them enabled by default:
- utils\sql\git\queryserv\required\Complete_QueryServ_Rules_Enabled.sql
Spawn related logging cleanup
General code cleanup
Added queryserv.cpp and queryserv.h with QueryServ class
This commit is contained in:
+63
-60
@@ -22,6 +22,9 @@
|
||||
#include "../common/string_util.h"
|
||||
#include "../common/rulesys.h"
|
||||
#include "quest_parser_collection.h"
|
||||
#include "queryserv.h"
|
||||
|
||||
extern QueryServ* QServ;
|
||||
|
||||
|
||||
static uint32 MaxBankedGroupLeadershipPoints(int Level)
|
||||
@@ -212,7 +215,6 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) {
|
||||
return; // Must be invalid class/race
|
||||
}
|
||||
|
||||
|
||||
if ((set_exp + set_aaxp) > (m_pp.exp+m_pp.expAA)) {
|
||||
if (isrezzexp)
|
||||
this->Message_StringID(MT_Experience, REZ_REGAIN);
|
||||
@@ -288,6 +290,14 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) {
|
||||
//Message(15, "You have gained %d skill points!!", m_pp.aapoints - last_unspentAA);
|
||||
char val1[20]={0};
|
||||
Message_StringID(MT_Experience, GAIN_ABILITY_POINT,ConvertArray(m_pp.aapoints, val1),m_pp.aapoints == 1 ? "" : "(s)"); //You have gained an ability point! You now have %1 ability point%2.
|
||||
|
||||
/* QS: PlayerLogAARate */
|
||||
if (RuleB(QueryServ, PlayerLogAARate)){
|
||||
int add_points = (m_pp.aapoints - last_unspentAA);
|
||||
std::string query = StringFormat("INSERT INTO `qs_player_aa_rate_hourly` (char_id, aa_count, hour_time) VALUES (%i, %i, UNIX_TIMESTAMP() - MOD(UNIX_TIMESTAMP(), 3600)) ON DUPLICATE KEY UPDATE `aa_count` = `aa_count` + %i", this->CharacterID(), add_points, add_points);
|
||||
QServ->SendQuery(query.c_str());
|
||||
}
|
||||
|
||||
//Message(15, "You now have %d skill points available to spend.", m_pp.aapoints);
|
||||
}
|
||||
|
||||
@@ -299,12 +309,10 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) {
|
||||
if(check_level > maxlevel) {
|
||||
check_level = maxlevel;
|
||||
|
||||
if(RuleB(Character, KeepLevelOverMax))
|
||||
{
|
||||
if(RuleB(Character, KeepLevelOverMax)) {
|
||||
set_exp = GetEXPForLevel(GetLevel()+1);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
set_exp = GetEXPForLevel(maxlevel);
|
||||
}
|
||||
}
|
||||
@@ -314,8 +322,7 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) {
|
||||
if(MaxLevel){
|
||||
if(GetLevel() >= MaxLevel){
|
||||
uint32 expneeded = GetEXPForLevel(MaxLevel);
|
||||
if(set_exp > expneeded)
|
||||
{
|
||||
if(set_exp > expneeded) {
|
||||
set_exp = expneeded;
|
||||
}
|
||||
}
|
||||
@@ -327,11 +334,11 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) {
|
||||
if (GetLevel() == check_level-1){
|
||||
Message_StringID(MT_Experience, GAIN_LEVEL,ConvertArray(check_level,val1));
|
||||
SendLevelAppearance();
|
||||
//Message(15, "You have gained a level! Welcome to level %i!", check_level);
|
||||
/* Message(15, "You have gained a level! Welcome to level %i!", check_level); */
|
||||
}
|
||||
if (GetLevel() == check_level){
|
||||
Message_StringID(MT_Experience, LOSE_LEVEL,ConvertArray(check_level,val1));
|
||||
//Message(15, "You lost a level! You are now level %i!", check_level);
|
||||
/* Message(15, "You lost a level! You are now level %i!", check_level); */
|
||||
}
|
||||
else
|
||||
Message(15, "Welcome to level %i!", check_level);
|
||||
@@ -352,8 +359,7 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) {
|
||||
//If were at max level then stop gaining experience if we make it to the cap
|
||||
if(GetLevel() == maxlevel - 1){
|
||||
uint32 expneeded = GetEXPForLevel(maxlevel);
|
||||
if(set_exp > expneeded)
|
||||
{
|
||||
if(set_exp > expneeded) {
|
||||
set_exp = expneeded;
|
||||
}
|
||||
}
|
||||
@@ -405,15 +411,13 @@ void Client::SetLevel(uint8 set_level, bool command)
|
||||
|
||||
level = set_level;
|
||||
|
||||
if(IsRaidGrouped())
|
||||
{
|
||||
if(IsRaidGrouped()) {
|
||||
Raid *r = this->GetRaid();
|
||||
if(r){
|
||||
r->UpdateLevel(GetName(), set_level);
|
||||
}
|
||||
}
|
||||
if(set_level > m_pp.level2)
|
||||
{
|
||||
if(set_level > m_pp.level2) {
|
||||
if(m_pp.level2 == 0)
|
||||
m_pp.points += 5;
|
||||
else
|
||||
@@ -423,6 +427,18 @@ void Client::SetLevel(uint8 set_level, bool command)
|
||||
}
|
||||
if(set_level > m_pp.level) {
|
||||
parse->EventPlayer(EVENT_LEVEL_UP, this, "", 0);
|
||||
/* QS: PlayerLogLevels */
|
||||
if (RuleB(QueryServ, PlayerLogLevels)){
|
||||
std::string event_desc = StringFormat("Leveled UP :: to Level:%i from Level:%i in zoneid:%i instid:%i", set_level, m_pp.level, this->GetZoneID(), this->GetInstanceID());
|
||||
QServ->PlayerLogEvent(Player_Log_Levels, this->CharacterID(), event_desc);
|
||||
}
|
||||
}
|
||||
else if (set_level < m_pp.level){
|
||||
/* QS: PlayerLogLevels */
|
||||
if (RuleB(QueryServ, PlayerLogLevels)){
|
||||
std::string event_desc = StringFormat("Leveled DOWN :: to Level:%i from Level:%i in zoneid:%i instid:%i", set_level, m_pp.level, this->GetZoneID(), this->GetInstanceID());
|
||||
QServ->PlayerLogEvent(Player_Log_Levels, this->CharacterID(), event_desc);
|
||||
}
|
||||
}
|
||||
|
||||
m_pp.level = set_level;
|
||||
@@ -432,34 +448,34 @@ void Client::SetLevel(uint8 set_level, bool command)
|
||||
lu->exp = 0;
|
||||
}
|
||||
else {
|
||||
float tmpxp = (float) ( (float) m_pp.exp - GetEXPForLevel( GetLevel() )) /
|
||||
( (float) GetEXPForLevel(GetLevel()+1) - GetEXPForLevel(GetLevel()));
|
||||
float tmpxp = (float) ( (float) m_pp.exp - GetEXPForLevel( GetLevel() )) / ( (float) GetEXPForLevel(GetLevel()+1) - GetEXPForLevel(GetLevel()));
|
||||
lu->exp = (uint32)(330.0f * tmpxp);
|
||||
}
|
||||
QueuePacket(outapp);
|
||||
safe_delete(outapp);
|
||||
this->SendAppearancePacket(AT_WhoLevel, set_level); // who level change
|
||||
|
||||
LogFile->write(EQEMuLog::Normal,"Setting Level for %s to %i", GetName(), set_level);
|
||||
LogFile->write(EQEMuLog::Normal,"Setting Level for %s to %i", GetName(), set_level);
|
||||
|
||||
CalcBonuses();
|
||||
if(!RuleB(Character, HealOnLevel))
|
||||
{
|
||||
|
||||
if(!RuleB(Character, HealOnLevel)) {
|
||||
int mhp = CalcMaxHP();
|
||||
if(GetHP() > mhp)
|
||||
SetHP(mhp);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
SetHP(CalcMaxHP()); // Why not, lets give them a free heal
|
||||
}
|
||||
|
||||
DoTributeUpdate();
|
||||
DoTributeUpdate();
|
||||
SendHPUpdate();
|
||||
SetMana(CalcMaxMana());
|
||||
UpdateWho();
|
||||
if(GetMerc())
|
||||
UpdateMercLevel();
|
||||
|
||||
if(GetMerc())
|
||||
UpdateMercLevel();
|
||||
|
||||
Save();
|
||||
}
|
||||
|
||||
@@ -508,23 +524,13 @@ uint32 Client::GetEXPForLevel(uint16 check_level)
|
||||
uint32 finalxp = uint32(base * mod);
|
||||
finalxp = mod_client_xp_for_level(finalxp, check_level);
|
||||
|
||||
return(finalxp);
|
||||
return finalxp;
|
||||
}
|
||||
|
||||
void Client::AddLevelBasedExp(uint8 exp_percentage, uint8 max_level) {
|
||||
|
||||
if (exp_percentage > 100)
|
||||
{
|
||||
exp_percentage = 100;
|
||||
}
|
||||
|
||||
if (!max_level || GetLevel() < max_level)
|
||||
{
|
||||
max_level = GetLevel();
|
||||
}
|
||||
|
||||
uint32 newexp = GetEXP() + ((GetEXPForLevel(max_level + 1) - GetEXPForLevel(max_level)) * exp_percentage / 100);
|
||||
|
||||
void Client::AddLevelBasedExp(uint8 exp_percentage, uint8 max_level) {
|
||||
if (exp_percentage > 100) { exp_percentage = 100; }
|
||||
if (!max_level || GetLevel() < max_level) { max_level = GetLevel(); }
|
||||
uint32 newexp = GetEXP() + ((GetEXPForLevel(max_level + 1) - GetEXPForLevel(max_level)) * exp_percentage / 100);
|
||||
SetEXP(newexp, GetAAXP());
|
||||
}
|
||||
|
||||
@@ -666,28 +672,25 @@ void Client::SendLeadershipEXPUpdate() {
|
||||
}
|
||||
|
||||
uint32 Client::GetCharMaxLevelFromQGlobal() {
|
||||
QGlobalCache *char_c = nullptr;
|
||||
char_c = this->GetQGlobals();
|
||||
|
||||
QGlobalCache *char_c = nullptr;
|
||||
char_c = this->GetQGlobals();
|
||||
std::list<QGlobal> globalMap;
|
||||
uint32 ntype = 0;
|
||||
|
||||
std::list<QGlobal> globalMap;
|
||||
uint32 ntype = 0;
|
||||
if(char_c) {
|
||||
QGlobalCache::Combine(globalMap, char_c->GetBucket(), ntype, this->CharacterID(), zone->GetZoneID());
|
||||
}
|
||||
|
||||
if(char_c)
|
||||
{
|
||||
QGlobalCache::Combine(globalMap, char_c->GetBucket(), ntype, this->CharacterID(), zone->GetZoneID());
|
||||
}
|
||||
std::list<QGlobal>::iterator iter = globalMap.begin();
|
||||
uint32 gcount = 0;
|
||||
while(iter != globalMap.end()) {
|
||||
if((*iter).name.compare("CharMaxLevel") == 0){
|
||||
return atoi((*iter).value.c_str());
|
||||
}
|
||||
++iter;
|
||||
++gcount;
|
||||
}
|
||||
|
||||
std::list<QGlobal>::iterator iter = globalMap.begin();
|
||||
uint32 gcount = 0;
|
||||
while(iter != globalMap.end())
|
||||
{
|
||||
if((*iter).name.compare("CharMaxLevel") == 0){
|
||||
return atoi((*iter).value.c_str());
|
||||
}
|
||||
++iter;
|
||||
++gcount;
|
||||
}
|
||||
|
||||
return false; // Default is false
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user