View Single Post
  #1  
Old 07-09-2004, 02:54 PM
Draupner
Hill Giant
 
Join Date: Jul 2004
Location: In my basement
Posts: 131
Default XP bonuses per zone

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
Code:
alter table zone add column xpmod int(4) NOT NULL default 100;
database.cpp Line 3295
Code:
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
Code:
int32   SetZoneXPBonus(int32);
Client.cpp

Replace
Code:
 
int32 exp = GetEXP() + (int32)((zone->GetEXPMod()) *  (add_exp - add_aaxp));
with
Code:
int32 exp = GetEXP() + (int32)((zone->GetEXPMod()) * (database.SetZoneXPBonus(zone->GetZoneID())/100) * (add_exp - add_aaxp));
Reply With Quote