mirror of
https://github.com/EQEmu/Server.git
synced 2026-09-04 02:06:50 +00:00
Implement zone based gravity, required SQL DB change
- To test `zone` table `gravity` values, change the value and use #zheader <zoneshortname> to test
This commit is contained in:
+117
-67
@@ -97,90 +97,140 @@ bool ZoneDatabase::GetZoneCFG(uint32 zoneid, uint16 instance_id, NewZone_Struct
|
||||
*map_filename = new char[100];
|
||||
zone_data->zone_id = zoneid;
|
||||
|
||||
std::string query = StringFormat("SELECT ztype, fog_red, fog_green, fog_blue, fog_minclip, fog_maxclip, " // 5
|
||||
"fog_red2, fog_green2, fog_blue2, fog_minclip2, fog_maxclip2, " // 5
|
||||
"fog_red3, fog_green3, fog_blue3, fog_minclip3, fog_maxclip3, " // 5
|
||||
"fog_red4, fog_green4, fog_blue4, fog_minclip4, fog_maxclip4, " // 5
|
||||
"fog_density, sky, zone_exp_multiplier, safe_x, safe_y, safe_z, underworld, " // 7
|
||||
"minclip, maxclip, time_type, canbind, cancombat, canlevitate, " // 6
|
||||
"castoutdoor, hotzone, ruleset, suspendbuffs, map_file_name, short_name, " // 6
|
||||
"rain_chance1, rain_chance2, rain_chance3, rain_chance4, " // 4
|
||||
"rain_duration1, rain_duration2, rain_duration3, rain_duration4, " // 4
|
||||
"snow_chance1, snow_chance2, snow_chance3, snow_chance4, " // 4
|
||||
"snow_duration1, snow_duration2, snow_duration3, snow_duration4 " // 4
|
||||
"FROM zone WHERE zoneidnumber = %i AND version = %i", zoneid, instance_id);
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
strcpy(*map_filename, "default");
|
||||
std::string query = StringFormat(
|
||||
"SELECT "
|
||||
"ztype, " // 0
|
||||
"fog_red, " // 1
|
||||
"fog_green, " // 2
|
||||
"fog_blue, " // 3
|
||||
"fog_minclip, " // 4
|
||||
"fog_maxclip, " // 5
|
||||
"fog_red2, " // 6
|
||||
"fog_green2, " // 7
|
||||
"fog_blue2, " // 8
|
||||
"fog_minclip2, " // 9
|
||||
"fog_maxclip2, " // 10
|
||||
"fog_red3, " // 11
|
||||
"fog_green3, " // 12
|
||||
"fog_blue3, " // 13
|
||||
"fog_minclip3, " // 14
|
||||
"fog_maxclip3, " // 15
|
||||
"fog_red4, " // 16
|
||||
"fog_green4, " // 17
|
||||
"fog_blue4, " // 18
|
||||
"fog_minclip4, " // 19
|
||||
"fog_maxclip4, " // 20
|
||||
"fog_density, " // 21
|
||||
"sky, " // 22
|
||||
"zone_exp_multiplier, " // 23
|
||||
"safe_x, " // 24
|
||||
"safe_y, " // 25
|
||||
"safe_z, " // 26
|
||||
"underworld, " // 27
|
||||
"minclip, " // 28
|
||||
"maxclip, " // 29
|
||||
"time_type, " // 30
|
||||
"canbind, " // 31
|
||||
"cancombat, " // 32
|
||||
"canlevitate, " // 33
|
||||
"castoutdoor, " // 34
|
||||
"hotzone, " // 35
|
||||
"ruleset, " // 36
|
||||
"suspendbuffs, " // 37
|
||||
"map_file_name, " // 38
|
||||
"short_name, " // 39
|
||||
"rain_chance1, " // 40
|
||||
"rain_chance2, " // 41
|
||||
"rain_chance3, " // 42
|
||||
"rain_chance4, " // 43
|
||||
"rain_duration1, " // 44
|
||||
"rain_duration2, " // 45
|
||||
"rain_duration3, " // 46
|
||||
"rain_duration4, " // 47
|
||||
"snow_chance1, " // 48
|
||||
"snow_chance2, " // 49
|
||||
"snow_chance3, " // 50
|
||||
"snow_chance4, " // 51
|
||||
"snow_duration1, " // 52
|
||||
"snow_duration2, " // 53
|
||||
"snow_duration3, " // 54
|
||||
"snow_duration4, " // 55
|
||||
"gravity " // 56
|
||||
"FROM zone WHERE zoneidnumber = %i AND version = %i",
|
||||
zoneid, instance_id);
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
strcpy(*map_filename, "default");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (results.RowCount() == 0) {
|
||||
strcpy(*map_filename, "default");
|
||||
return false;
|
||||
}
|
||||
strcpy(*map_filename, "default");
|
||||
return false;
|
||||
}
|
||||
|
||||
auto row = results.begin();
|
||||
auto row = results.begin();
|
||||
|
||||
memset(zone_data, 0, sizeof(NewZone_Struct));
|
||||
zone_data->ztype = atoi(row[0]);
|
||||
zone_type = zone_data->ztype;
|
||||
memset(zone_data, 0, sizeof(NewZone_Struct));
|
||||
zone_data->ztype = atoi(row[0]);
|
||||
zone_type = zone_data->ztype;
|
||||
|
||||
int index;
|
||||
for(index = 0; index < 4; index++) {
|
||||
zone_data->fog_red[index]=atoi(row[1 + index * 5]);
|
||||
zone_data->fog_green[index]=atoi(row[2 + index * 5]);
|
||||
zone_data->fog_blue[index]=atoi(row[3 + index * 5]);
|
||||
zone_data->fog_minclip[index]=atof(row[4 + index * 5]);
|
||||
zone_data->fog_maxclip[index]=atof(row[5 + index * 5]);
|
||||
}
|
||||
int index;
|
||||
for (index = 0; index < 4; index++) {
|
||||
zone_data->fog_red[index] = atoi(row[1 + index * 5]);
|
||||
zone_data->fog_green[index] = atoi(row[2 + index * 5]);
|
||||
zone_data->fog_blue[index] = atoi(row[3 + index * 5]);
|
||||
zone_data->fog_minclip[index] = atof(row[4 + index * 5]);
|
||||
zone_data->fog_maxclip[index] = atof(row[5 + index * 5]);
|
||||
}
|
||||
|
||||
zone_data->fog_density = atof(row[21]);
|
||||
zone_data->sky=atoi(row[22]);
|
||||
zone_data->zone_exp_multiplier=atof(row[23]);
|
||||
zone_data->safe_x=atof(row[24]);
|
||||
zone_data->safe_y=atof(row[25]);
|
||||
zone_data->safe_z=atof(row[26]);
|
||||
zone_data->underworld=atof(row[27]);
|
||||
zone_data->minclip=atof(row[28]);
|
||||
zone_data->maxclip=atof(row[29]);
|
||||
zone_data->time_type=atoi(row[30]);
|
||||
zone_data->fog_density = atof(row[21]);
|
||||
zone_data->sky = atoi(row[22]);
|
||||
zone_data->zone_exp_multiplier = atof(row[23]);
|
||||
zone_data->safe_x = atof(row[24]);
|
||||
zone_data->safe_y = atof(row[25]);
|
||||
zone_data->safe_z = atof(row[26]);
|
||||
zone_data->underworld = atof(row[27]);
|
||||
zone_data->minclip = atof(row[28]);
|
||||
zone_data->maxclip = atof(row[29]);
|
||||
zone_data->time_type = atoi(row[30]);
|
||||
|
||||
//not in the DB yet:
|
||||
zone_data->gravity = 0.4;
|
||||
allow_mercs = true;
|
||||
//not in the DB yet:
|
||||
zone_data->gravity = atof(row[56]);
|
||||
Log.Out(Logs::General, Logs::Debug, "Zone Gravity is %f", zone_data->gravity);
|
||||
allow_mercs = true;
|
||||
|
||||
int bindable = 0;
|
||||
bindable = atoi(row[31]);
|
||||
int bindable = 0;
|
||||
bindable = atoi(row[31]);
|
||||
|
||||
can_bind = bindable == 0? false: true;
|
||||
is_city = bindable == 2? true: false;
|
||||
can_combat = atoi(row[32]) == 0? false: true;
|
||||
can_levitate = atoi(row[33]) == 0? false: true;
|
||||
can_castoutdoor = atoi(row[34]) == 0? false: true;
|
||||
is_hotzone = atoi(row[35]) == 0? false: true;
|
||||
can_bind = bindable == 0 ? false : true;
|
||||
is_city = bindable == 2 ? true : false;
|
||||
can_combat = atoi(row[32]) == 0 ? false : true;
|
||||
can_levitate = atoi(row[33]) == 0 ? false : true;
|
||||
can_castoutdoor = atoi(row[34]) == 0 ? false : true;
|
||||
is_hotzone = atoi(row[35]) == 0 ? false : true;
|
||||
|
||||
|
||||
ruleset = atoi(row[36]);
|
||||
zone_data->SuspendBuffs = atoi(row[37]);
|
||||
ruleset = atoi(row[36]);
|
||||
zone_data->SuspendBuffs = atoi(row[37]);
|
||||
|
||||
char *file = row[38];
|
||||
if(file)
|
||||
strcpy(*map_filename, file);
|
||||
else
|
||||
strcpy(*map_filename, row[39]);
|
||||
char *file = row[38];
|
||||
if (file)
|
||||
strcpy(*map_filename, file);
|
||||
else
|
||||
strcpy(*map_filename, row[39]);
|
||||
|
||||
for(index = 0; index < 4; index++)
|
||||
zone_data->rain_chance[index]=atoi(row[40 + index]);
|
||||
for (index = 0; index < 4; index++)
|
||||
zone_data->rain_chance[index] = atoi(row[40 + index]);
|
||||
|
||||
for(index = 0; index < 4; index++)
|
||||
zone_data->rain_duration[index]=atoi(row[44 + index]);
|
||||
for (index = 0; index < 4; index++)
|
||||
zone_data->rain_duration[index] = atoi(row[44 + index]);
|
||||
|
||||
for(index = 0; index < 4; index++)
|
||||
zone_data->snow_chance[index]=atoi(row[48 + index]);
|
||||
for (index = 0; index < 4; index++)
|
||||
zone_data->snow_chance[index] = atoi(row[48 + index]);
|
||||
|
||||
for(index = 0; index < 4; index++)
|
||||
zone_data->snow_duration[index]=atof(row[52 + index]);
|
||||
for (index = 0; index < 4; index++)
|
||||
zone_data->snow_duration[index] = atof(row[52 + index]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user