Draupner
07-09-2004, 02:54 PM
Heres the code for adding seperate xp bonuses to each zone. It defaults at 100 which is no bonus. For 2x experience rate set it to 200 for that particular zone.
Source this into your database
alter table zone add column xpmod int(4) NOT NULL default 100;
database.cpp Line 3295
int32 Database::SetZoneXPBonus(int32 zoneid) {
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
if (RunQuery(query, MakeAnyLenString(&query, "select distinct xpmod from zone where zoneidnumber=%i", zoneid), errbuf, &result)) {
safe_delete_array(query);
if (mysql_num_rows(result) == 1) {
row = mysql_fetch_row(result);
int32 ret = 0;
if (row[0])
ret = atoi(row[0]);
mysql_free_result(result);
return ret;
}
mysql_free_result(result);
}
else {
cerr << "Error in GetZoneXPBonus Query '" << query << "' " << errbuf << endl;
safe_delete_array(query);
return 0;
}
return 0;
}
database.h Line 206
int32 SetZoneXPBonus(int32);
Client.cpp
Replace
int32 exp = GetEXP() + (int32)((zone->GetEXPMod()) * (add_exp - add_aaxp));
with
int32 exp = GetEXP() + (int32)((zone->GetEXPMod()) * (database.SetZoneXPBonus(zone->GetZoneID())/100) * (add_exp - add_aaxp));
Source this into your database
alter table zone add column xpmod int(4) NOT NULL default 100;
database.cpp Line 3295
int32 Database::SetZoneXPBonus(int32 zoneid) {
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
if (RunQuery(query, MakeAnyLenString(&query, "select distinct xpmod from zone where zoneidnumber=%i", zoneid), errbuf, &result)) {
safe_delete_array(query);
if (mysql_num_rows(result) == 1) {
row = mysql_fetch_row(result);
int32 ret = 0;
if (row[0])
ret = atoi(row[0]);
mysql_free_result(result);
return ret;
}
mysql_free_result(result);
}
else {
cerr << "Error in GetZoneXPBonus Query '" << query << "' " << errbuf << endl;
safe_delete_array(query);
return 0;
}
return 0;
}
database.h Line 206
int32 SetZoneXPBonus(int32);
Client.cpp
Replace
int32 exp = GetEXP() + (int32)((zone->GetEXPMod()) * (add_exp - add_aaxp));
with
int32 exp = GetEXP() + (int32)((zone->GetEXPMod()) * (database.SetZoneXPBonus(zone->GetZoneID())/100) * (add_exp - add_aaxp));