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:
Akkadius 2015-02-12 22:09:17 -06:00
parent fd45e8d21d
commit a544c681c7
6 changed files with 126 additions and 68 deletions

View File

@ -1,5 +1,9 @@
EQEMu Changelog (Started on Sept 24, 2003 15:50)
-------------------------------------------------------
== 02/12/2015 ==
Akkadius: Implement zone based gravity, required SQL DB change
- To test `zone` table `gravity` values, change the value and use #zheader <zoneshortname> to test
== 02/11/2015 ==
Trevius: (RoF+) Bandolier no longer displays a Treasure Chest Icon when no Bandoliers are set.

View File

@ -30,7 +30,7 @@
Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt
*/
#define CURRENT_BINARY_DATABASE_VERSION 9076
#define CURRENT_BINARY_DATABASE_VERSION 9077
#define COMPILE_DATE __DATE__
#define COMPILE_TIME __TIME__
#ifndef WIN32

View File

@ -330,6 +330,7 @@
9074|2015_02_01_logsys_packet_logs.sql|SELECT * FROM `logsys_categories` WHERE `log_category_description` LIKE 'Packet: Server -> Client'|empty|
9075|2015_02_02_logsys_packet_logs_with_dump.sql|SELECT * FROM `logsys_categories` WHERE `log_category_description` LIKE 'Packet: Server -> Client With Dump'|empty|
9076|2015_02_04_average_coin.sql|SHOW COLUMNS FROM `loottable` WHERE Field = 'avgcoin'|contains|smallint
9077|2015_02_12_zone_gravity.sql|SHOW COLUMNS FROM `zone` LIKE 'gravity'|empty|
# Upgrade conditions:
# This won't be needed after this system is implemented, but it is used database that are not

View File

@ -655,6 +655,8 @@ bool ZoneDatabase::LoadDoors(int32 iDoorCount, Door *into, const char *zone_name
into[rowIndex].db_id = atoi(row[0]);
into[rowIndex].door_id = atoi(row[1]);
Log.Out(Logs::Detail, Logs::Doors, "Door Load: db id: %u, door_id %u", into[rowIndex].db_id, into[rowIndex].door_id);
strn0cpy(into[rowIndex].zone_name,row[2],32);
strn0cpy(into[rowIndex].door_name,row[3],32);

View File

@ -735,6 +735,7 @@ void Zone::LoadZoneDoors(const char* zone, int16 version)
for(r = 0; r < count; r++, d++) {
Doors* newdoor = new Doors(d);
entity_list.AddDoor(newdoor);
Log.Out(Logs::Detail, Logs::Doors, "Door Add to Entity List, index: %u db id: %u, door_id %u", r, dlist[r].db_id, dlist[r].door_id);
}
delete[] dlist;
}

View File

@ -97,18 +97,67 @@ 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);
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");
@ -147,7 +196,8 @@ bool ZoneDatabase::GetZoneCFG(uint32 zoneid, uint16 instance_id, NewZone_Struct
zone_data->time_type = atoi(row[30]);
//not in the DB yet:
zone_data->gravity = 0.4;
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;