Ok finnaly heres the source code.
client_process.cpp line 5251
before // try to send all packets that weren't send before
add
Code:
database.UpdateTimersClientConnected(CharacterID());
database.h line 124
add
Code:
bool AATimerTest(int32 charid, int32 ability);
database.cpp line 2213
after #ifdef ZONE
add
Code:
bool Database::AATimerTest(int32 charid, int32 ability){
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
if (RunQuery(query, MakeAnyLenString(&query, "SELECT begin-end from aa_timers WHERE charid=%i AND ability=%i", charid, ability), errbuf, &result)) {
while( ( row = mysql_fetch_row(result) ) ){
LogFile->write(EQEMuLog::Error, "Database::AATimerTest begin-end=%i for ability: %i and charid: %i",atoi(row[0]),ability,charid);
if(atoi(row[0]) >= 0){
LogFile->write(EQEMuLog::Error, "Database::AATimerTest begin <= end");
return false;
}
else{
return true;
LogFile->write(EQEMuLog::Error, "Database::AATimerTest begin >= end");
}
}
mysql_free_result(result);
}
else
LogFile->write(EQEMuLog::Error, "Database::AATimerTest query '%s' %s", query, errbuf);
safe_delete_array(query);
}
and right before that function
where it has
void Database::UpdateTimersClientConnected(int32 charid)
change that function to
Code:
void Database::UpdateTimersClientConnected(int32 charid){
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
if (!RunQuery(query, MakeAnyLenString(&query, "update aa_timers set begin=UNIX_TIMESTAMP(now()) where charid=%i",charid), errbuf)) {
LogFile->write(EQEMuLog::Error, "UpdateAATimers query '%s' %s", query, errbuf);
}
safe_delete_array(query);
}
client.cpp line 3271
after int targ;
add
Code:
if(database.AATimerTest(CastToClient()->character_id,activate) == 0){
client.cpp line 4955 (about)
after safe_delete(outapp);
add
Code:
}
else
CastToClient()->Message(0,"You cannot cast this spell at this time.");
And i think thats about it i might have forgotten something i dont think i did let me know if it works for you guys too i've tested it on my server and it works so if it doesnt work on yours.
if(code != "works)"{
Message(1,"I probly forgot something.");
}
else if (code == "works"){
Message(1,"enjoy ");
}
and branks
Quote:
also either of you happen to have a link to a decent code optimization tutorial or anything as i think i know enough to start working on good habbits and i still get nervous about tampering with the constantly run processes.
|
I dont know, i'm 17 and i taught myself everything i know. I believe you might be able to edit the aa timers in game by just messing with the db a little i'm not sure how it works i can look into it i hadent really thought of changing it much but i dont think it would be impossible.
**EDIT** dont emptry your aa_timers table it bugs you, also the errors you get in zone.exe mean nothign they're for me to debugg.
**EDIT** UPDATE THIS PLEASE
new AATimerTest function should be
Code:
bool Database::AATimerTest(int32 charid, int32 ability){
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
if (RunQuery(query, MakeAnyLenString(&query, "SELECT begin-end from aa_timers WHERE charid=%i AND ability=%i", charid, ability), errbuf, &result)) {
while( ( row = mysql_fetch_row(result) ) ){
LogFile->write(EQEMuLog::Error, "Database::AATimerTest begin-end=%i for ability: %i and charid: %i",atoi(row[0]),ability,charid);
if(atoi(row[0]) >= 0){
LogFile->write(EQEMuLog::Error, "Database::AATimerTest begin <= end");
return false;
}
else if(row[0] == "NULL"){
time_t timestamp=time(NULL);
UpdateAATimers(charid,timestamp,timestamp,ability);
return true;
}
else{
LogFile->write(EQEMuLog::Error, "Database::AATimerTest begin >= end");
}
}
mysql_free_result(result);
}
else{
LogFile->write(EQEMuLog::Error, "Database::AATimerTest query '%s' %s", query, errbuf);
}
safe_delete_array(query);
}
it was found to be not adding new timers under certian conditions, with the help of Branks we came up with this it solved his problem he created when he emptied his aa_timer table.