Log in

View Full Version : XP bonuses per zone


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));

Xabob
07-09-2004, 03:25 PM
Once again man you are a god and are in deserve of Jr Dev

Draupner
07-09-2004, 04:12 PM
Thanks for that comment Xabob, knowing that I'm making peoples servers a more enjoyable experience to play on is why I make these fixes/additions and makes it more enjoyable to continue making them.

Richardo
07-09-2004, 04:46 PM
Roxor

Draupner
07-09-2004, 04:46 PM
<3 Rich

Richardo
07-09-2004, 04:48 PM
<3