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) 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 == == 02/11/2015 ==
Trevius: (RoF+) Bandolier no longer displays a Treasure Chest Icon when no Bandoliers are set. 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 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_DATE __DATE__
#define COMPILE_TIME __TIME__ #define COMPILE_TIME __TIME__
#ifndef WIN32 #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| 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| 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 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: # Upgrade conditions:
# This won't be needed after this system is implemented, but it is used database that are not # 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].db_id = atoi(row[0]);
into[rowIndex].door_id = atoi(row[1]); 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].zone_name,row[2],32);
strn0cpy(into[rowIndex].door_name,row[3],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++) { for(r = 0; r < count; r++, d++) {
Doors* newdoor = new Doors(d); Doors* newdoor = new Doors(d);
entity_list.AddDoor(newdoor); 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; delete[] dlist;
} }

View File

@ -97,18 +97,67 @@ bool ZoneDatabase::GetZoneCFG(uint32 zoneid, uint16 instance_id, NewZone_Struct
*map_filename = new char[100]; *map_filename = new char[100];
zone_data->zone_id = zoneid; zone_data->zone_id = zoneid;
std::string query = StringFormat("SELECT ztype, fog_red, fog_green, fog_blue, fog_minclip, fog_maxclip, " // 5 std::string query = StringFormat(
"fog_red2, fog_green2, fog_blue2, fog_minclip2, fog_maxclip2, " // 5 "SELECT "
"fog_red3, fog_green3, fog_blue3, fog_minclip3, fog_maxclip3, " // 5 "ztype, " // 0
"fog_red4, fog_green4, fog_blue4, fog_minclip4, fog_maxclip4, " // 5 "fog_red, " // 1
"fog_density, sky, zone_exp_multiplier, safe_x, safe_y, safe_z, underworld, " // 7 "fog_green, " // 2
"minclip, maxclip, time_type, canbind, cancombat, canlevitate, " // 6 "fog_blue, " // 3
"castoutdoor, hotzone, ruleset, suspendbuffs, map_file_name, short_name, " // 6 "fog_minclip, " // 4
"rain_chance1, rain_chance2, rain_chance3, rain_chance4, " // 4 "fog_maxclip, " // 5
"rain_duration1, rain_duration2, rain_duration3, rain_duration4, " // 4 "fog_red2, " // 6
"snow_chance1, snow_chance2, snow_chance3, snow_chance4, " // 4 "fog_green2, " // 7
"snow_duration1, snow_duration2, snow_duration3, snow_duration4 " // 4 "fog_blue2, " // 8
"FROM zone WHERE zoneidnumber = %i AND version = %i", zoneid, instance_id); "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); auto results = QueryDatabase(query);
if (!results.Success()) { if (!results.Success()) {
strcpy(*map_filename, "default"); strcpy(*map_filename, "default");
@ -127,60 +176,61 @@ bool ZoneDatabase::GetZoneCFG(uint32 zoneid, uint16 instance_id, NewZone_Struct
zone_type = zone_data->ztype; zone_type = zone_data->ztype;
int index; int index;
for(index = 0; index < 4; index++) { for (index = 0; index < 4; index++) {
zone_data->fog_red[index]=atoi(row[1 + index * 5]); zone_data->fog_red[index] = atoi(row[1 + index * 5]);
zone_data->fog_green[index]=atoi(row[2 + 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_blue[index] = atoi(row[3 + index * 5]);
zone_data->fog_minclip[index]=atof(row[4 + 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_maxclip[index] = atof(row[5 + index * 5]);
} }
zone_data->fog_density = atof(row[21]); zone_data->fog_density = atof(row[21]);
zone_data->sky=atoi(row[22]); zone_data->sky = atoi(row[22]);
zone_data->zone_exp_multiplier=atof(row[23]); zone_data->zone_exp_multiplier = atof(row[23]);
zone_data->safe_x=atof(row[24]); zone_data->safe_x = atof(row[24]);
zone_data->safe_y=atof(row[25]); zone_data->safe_y = atof(row[25]);
zone_data->safe_z=atof(row[26]); zone_data->safe_z = atof(row[26]);
zone_data->underworld=atof(row[27]); zone_data->underworld = atof(row[27]);
zone_data->minclip=atof(row[28]); zone_data->minclip = atof(row[28]);
zone_data->maxclip=atof(row[29]); zone_data->maxclip = atof(row[29]);
zone_data->time_type=atoi(row[30]); zone_data->time_type = atoi(row[30]);
//not in the DB yet: //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; allow_mercs = true;
int bindable = 0; int bindable = 0;
bindable = atoi(row[31]); bindable = atoi(row[31]);
can_bind = bindable == 0? false: true; can_bind = bindable == 0 ? false : true;
is_city = bindable == 2? true: false; is_city = bindable == 2 ? true : false;
can_combat = atoi(row[32]) == 0? false: true; can_combat = atoi(row[32]) == 0 ? false : true;
can_levitate = atoi(row[33]) == 0? false: true; can_levitate = atoi(row[33]) == 0 ? false : true;
can_castoutdoor = atoi(row[34]) == 0? false: true; can_castoutdoor = atoi(row[34]) == 0 ? false : true;
is_hotzone = atoi(row[35]) == 0? false: true; is_hotzone = atoi(row[35]) == 0 ? false : true;
ruleset = atoi(row[36]); ruleset = atoi(row[36]);
zone_data->SuspendBuffs = atoi(row[37]); zone_data->SuspendBuffs = atoi(row[37]);
char *file = row[38]; char *file = row[38];
if(file) if (file)
strcpy(*map_filename, file); strcpy(*map_filename, file);
else else
strcpy(*map_filename, row[39]); strcpy(*map_filename, row[39]);
for(index = 0; index < 4; index++) for (index = 0; index < 4; index++)
zone_data->rain_chance[index]=atoi(row[40 + index]); zone_data->rain_chance[index] = atoi(row[40 + index]);
for(index = 0; index < 4; index++) for (index = 0; index < 4; index++)
zone_data->rain_duration[index]=atoi(row[44 + index]); zone_data->rain_duration[index] = atoi(row[44 + index]);
for(index = 0; index < 4; index++) for (index = 0; index < 4; index++)
zone_data->snow_chance[index]=atoi(row[48 + index]); zone_data->snow_chance[index] = atoi(row[48 + index]);
for(index = 0; index < 4; index++) for (index = 0; index < 4; index++)
zone_data->snow_duration[index]=atof(row[52 + index]); zone_data->snow_duration[index] = atof(row[52 + index]);
return true; return true;
} }