From 2d84029b37e5ea20684ea93a8ae50d7bec24ecdb Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 7 Sep 2018 23:54:40 -0400 Subject: [PATCH] Add FastRegen* to zone table --- common/eq_packet_structs.h | 5 ++++- common/patches/rof.cpp | 6 +++--- common/patches/rof2.cpp | 6 +++--- common/patches/rof_structs.h | 6 +++--- common/patches/sod.cpp | 7 ++++--- common/patches/sod_structs.h | 6 +++--- common/patches/sof.cpp | 6 +++--- common/patches/sof_structs.h | 6 +++--- common/patches/uf.cpp | 6 +++--- common/patches/uf_structs.h | 6 +++--- common/ruletypes.h | 3 --- common/version.h | 2 +- utils/sql/db_update_manifest.txt | 1 + utils/sql/git/required/2018_09_07_FastRegen.sql | 3 +++ zone/bot.cpp | 6 +++--- zone/client_mods.cpp | 9 +++------ zone/merc.cpp | 6 +++--- zone/zonedb.cpp | 9 ++++++++- 18 files changed, 54 insertions(+), 45 deletions(-) create mode 100644 utils/sql/git/required/2018_09_07_FastRegen.sql diff --git a/common/eq_packet_structs.h b/common/eq_packet_structs.h index a35c264e0..c4cbea4fb 100644 --- a/common/eq_packet_structs.h +++ b/common/eq_packet_structs.h @@ -376,7 +376,10 @@ struct NewZone_Struct { /*0692*/ uint8 unknown692[8]; /*0700*/ float fog_density; /*0704*/ uint32 SuspendBuffs; -/*0704*/ +/*0708*/ uint32 FastRegenHP; +/*0712*/ uint32 FastRegenMana; +/*0716*/ uint32 FastRegenEndurance; +/*0720*/ }; /* diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index 6faabf88c..4364c9cb1 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -1811,6 +1811,9 @@ namespace RoF OUT(zone_id); OUT(zone_instance); OUT(SuspendBuffs); + OUT(FastRegenHP); + OUT(FastRegenMana); + OUT(FastRegenEndurance); eq->FogDensity = emu->fog_density; @@ -1827,9 +1830,6 @@ namespace RoF eq->unknown893 = 0; eq->fall_damage = 0; // 0 = Fall Damage on, 1 = Fall Damage off eq->unknown895 = 0; - eq->unknown896 = 180; - eq->unknown900 = 180; - eq->unknown904 = 180; eq->unknown908 = 2; eq->unknown912 = 2; eq->unknown932 = -1; // Set from PoK Example diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index 9cba1d0b4..99909cb16 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -1880,6 +1880,9 @@ namespace RoF2 OUT(zone_id); OUT(zone_instance); OUT(SuspendBuffs); + OUT(FastRegenHP); + OUT(FastRegenMana); + OUT(FastRegenEndurance); eq->FogDensity = emu->fog_density; @@ -1903,9 +1906,6 @@ namespace RoF2 eq->bNoFear = 0; eq->fall_damage = 0; // 0 = Fall Damage on, 1 = Fall Damage off eq->unknown895 = 0; - eq->FastRegenHP = 180; - eq->FastRegenMana = 180; - eq->FastRegenEndurance = 180; eq->CanPlaceCampsite = 2; eq->CanPlaceGuildBanner = 2; eq->FishingRelated = -1; // Set from PoK Example diff --git a/common/patches/rof_structs.h b/common/patches/rof_structs.h index dcc5e4ccc..885a9aa80 100644 --- a/common/patches/rof_structs.h +++ b/common/patches/rof_structs.h @@ -588,9 +588,9 @@ struct NewZone_Struct { /*0893*/ uint8 unknown893; // Seen 0 - 00 /*0894*/ uint8 fall_damage; // 0 = Fall Damage on, 1 = Fall Damage off /*0895*/ uint8 unknown895; // Seen 0 - 00 -/*0896*/ uint32 unknown896; // Seen 180 -/*0900*/ uint32 unknown900; // Seen 180 -/*0904*/ uint32 unknown904; // Seen 180 +/*0896*/ uint32 FastRegenHP; // Seen 180 +/*0900*/ uint32 FastRegenMana; // Seen 180 +/*0904*/ uint32 FastRegenEndurance; // Seen 180 /*0908*/ uint32 unknown908; // Seen 2 /*0912*/ uint32 unknown912; // Seen 2 /*0916*/ float FogDensity; // Most zones have this set to 0.33 Blightfire had 0.16 diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index 425341af7..772dcc178 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -1341,6 +1341,10 @@ namespace SoD OUT(zone_id); OUT(zone_instance); OUT(SuspendBuffs); + OUT(FastRegenHP); + OUT(FastRegenMana); + OUT(FastRegenEndurance); + /*fill in some unknowns with observed values, hopefully it will help */ eq->unknown800 = -1; eq->unknown844 = 600; @@ -1354,9 +1358,6 @@ namespace SoD eq->unknown893 = 0; eq->fall_damage = 0; // 0 = Fall Damage on, 1 = Fall Damage off eq->unknown895 = 0; - eq->unknown896 = 180; - eq->unknown900 = 180; - eq->unknown904 = 180; eq->unknown908 = 2; eq->unknown912 = 2; eq->FogDensity = emu->fog_density; diff --git a/common/patches/sod_structs.h b/common/patches/sod_structs.h index 80d0faae9..57e37c957 100644 --- a/common/patches/sod_structs.h +++ b/common/patches/sod_structs.h @@ -456,9 +456,9 @@ struct NewZone_Struct { /*0893*/ uint8 unknown893; //seen 0 - 00 /*0894*/ uint8 fall_damage; // 0 = Fall Damage on, 1 = Fall Damage off /*0895*/ uint8 unknown895; //seen 0 - 00 -/*0896*/ uint32 unknown896; //seen 180 -/*0900*/ uint32 unknown900; //seen 180 -/*0904*/ uint32 unknown904; //seen 180 +/*0896*/ uint32 FastRegenHP; //seen 180 +/*0900*/ uint32 FastRegenMana; //seen 180 +/*0904*/ uint32 FastRegenEndurance; //seen 180 /*0908*/ uint32 unknown908; //seen 2 /*0912*/ uint32 unknown912; //seen 2 /*0916*/ float FogDensity; //Of about 10 or so zones tested, all but one have this set to 0.33 Blightfire had 0.16 diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index 7051a5eeb..85f326edb 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -1020,6 +1020,9 @@ namespace SoF OUT(zone_id); OUT(zone_instance); OUT(SuspendBuffs); + OUT(FastRegenHP); + OUT(FastRegenMana); + OUT(FastRegenEndurance); /*fill in some unknowns with observed values, hopefully it will help */ eq->unknown796 = -1; @@ -1034,9 +1037,6 @@ namespace SoF eq->unknown889 = 0; eq->fall_damage = 0; // 0 = Fall Damage on, 1 = Fall Damage off eq->unknown891 = 0; - eq->unknown892 = 180; - eq->unknown896 = 180; - eq->unknown900 = 180; eq->unknown904 = 2; eq->unknown908 = 2; diff --git a/common/patches/sof_structs.h b/common/patches/sof_structs.h index a312b48a8..527341c93 100644 --- a/common/patches/sof_structs.h +++ b/common/patches/sof_structs.h @@ -460,9 +460,9 @@ struct NewZone_Struct { /*0893*/ uint8 unknown889; //seen 0 - 00 /*0894*/ uint8 fall_damage; // 0 = Fall Damage on, 1 = Fall Damage off /*0895*/ uint8 unknown891; //seen 0 - 00 -/*0892*/ uint32 unknown892; //seen 180 -/*0896*/ uint32 unknown896; //seen 180 -/*0900*/ uint32 unknown900; //seen 180 +/*0892*/ uint32 FastRegenHP; //seen 180 +/*0896*/ uint32 FastRegenMana; //seen 180 +/*0900*/ uint32 FastRegenEndurance; //seen 180 /*0904*/ uint32 unknown904; //seen 2 /*0908*/ uint32 unknown908; //seen 2 /*0912*/ diff --git a/common/patches/uf.cpp b/common/patches/uf.cpp index 869685e47..840c6fcd7 100644 --- a/common/patches/uf.cpp +++ b/common/patches/uf.cpp @@ -1565,6 +1565,9 @@ namespace UF OUT(zone_id); OUT(zone_instance); OUT(SuspendBuffs); + OUT(FastRegenHP); + OUT(FastRegenMana); + OUT(FastRegenEndurance); eq->FogDensity = emu->fog_density; @@ -1581,9 +1584,6 @@ namespace UF eq->unknown893 = 0; eq->fall_damage = 0; // 0 = Fall Damage on, 1 = Fall Damage off eq->unknown895 = 0; - eq->unknown896 = 180; - eq->unknown900 = 180; - eq->unknown904 = 180; eq->unknown908 = 2; eq->unknown912 = 2; diff --git a/common/patches/uf_structs.h b/common/patches/uf_structs.h index 02361cf1f..fe58b73b2 100644 --- a/common/patches/uf_structs.h +++ b/common/patches/uf_structs.h @@ -456,9 +456,9 @@ struct NewZone_Struct { /*0893*/ uint8 unknown893; //seen 0 - 00 /*0894*/ uint8 fall_damage; // 0 = Fall Damage on, 1 = Fall Damage off /*0895*/ uint8 unknown895; //seen 0 - 00 -/*0896*/ uint32 unknown896; //seen 180 -/*0900*/ uint32 unknown900; //seen 180 -/*0904*/ uint32 unknown904; //seen 180 +/*0896*/ uint32 FastRegenHP; //seen 180 +/*0900*/ uint32 FastRegenMana; //seen 180 +/*0904*/ uint32 FastRegenEndurance; //seen 180 /*0908*/ uint32 unknown908; //seen 2 /*0912*/ uint32 unknown912; //seen 2 /*0916*/ float FogDensity; //Of about 10 or so zones tested, all but one have this set to 0.33 Blightfire had 0.16 diff --git a/common/ruletypes.h b/common/ruletypes.h index 3e6965150..c2f11c1c3 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -94,9 +94,6 @@ RULE_INT(Character, SkillUpModifier, 100) //skill ups are at 100% RULE_BOOL(Character, SharedBankPlat, false) //off by default to prevent duping for now RULE_BOOL(Character, BindAnywhere, false) RULE_BOOL(Character, RestRegenEnabled, true) // Enable OOC Regen -RULE_INT(Character, RestRegenHP, 180) // seconds until full from 0. this is actually zone setable, but most or all zones are 180 -RULE_INT(Character, RestRegenMana, 180) // seconds until full from 0. this is actually zone setable, but most or all zones are 180 -RULE_INT(Character, RestRegenEnd, 180) // seconds until full from 0. this is actually zone setable, but most or all zones are 180 RULE_INT(Character, RestRegenTimeToActivate, 30) // Time in seconds for rest state regen to kick in. RULE_INT(Character, RestRegenRaidTimeToActivate, 300) // Time in seconds for rest state regen to kick in with a raid target. RULE_INT(Character, KillsPerGroupLeadershipAA, 250) // Number of dark blues or above per Group Leadership AA diff --git a/common/version.h b/common/version.h index b95c8ec1d..a6ea279c5 100644 --- a/common/version.h +++ b/common/version.h @@ -30,7 +30,7 @@ Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt */ -#define CURRENT_BINARY_DATABASE_VERSION 9125 +#define CURRENT_BINARY_DATABASE_VERSION 9126 #ifdef BOTS #define CURRENT_BINARY_BOTS_DATABASE_VERSION 9019 #else diff --git a/utils/sql/db_update_manifest.txt b/utils/sql/db_update_manifest.txt index 22a593176..fc2fb2391 100644 --- a/utils/sql/db_update_manifest.txt +++ b/utils/sql/db_update_manifest.txt @@ -379,6 +379,7 @@ 9123|2018_07_07_data_buckets.sql|SHOW TABLES LIKE 'data_buckets'|empty| 9124|2018_07_09_tasks.sql|SHOW COLUMNS FROM `tasks` LIKE 'type'|empty| 9125|2018_07_20_task_emote.sql|SHOW COLUMNS FROM `tasks` LIKE 'completion_emote'|empty| +9126|2018_09_07_FastRegen.sql|SHOW COLUMNS FROM `zone` LIKE 'FastRegenHP'|empty| # Upgrade conditions: # This won't be needed after this system is implemented, but it is used database that are not diff --git a/utils/sql/git/required/2018_09_07_FastRegen.sql b/utils/sql/git/required/2018_09_07_FastRegen.sql new file mode 100644 index 000000000..de44b147d --- /dev/null +++ b/utils/sql/git/required/2018_09_07_FastRegen.sql @@ -0,0 +1,3 @@ +ALTER TABLE `zone` ADD `FastRegenHP` INT NOT NULL DEFAULT '180'; +ALTER TABLE `zone` ADD `FastRegenMana` INT NOT NULL DEFAULT '180'; +ALTER TABLE `zone` ADD `FastRegenEndurance` INT NOT NULL DEFAULT '180'; diff --git a/zone/bot.cpp b/zone/bot.cpp index 4c982d7ac..8ba9ea36c 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -7021,9 +7021,9 @@ void Bot::CalcRestState() { } } - RestRegenHP = 6 * (GetMaxHP() / RuleI(Character, RestRegenHP)); - RestRegenMana = 6 * (GetMaxMana() / RuleI(Character, RestRegenMana)); - RestRegenEndurance = 6 * (GetMaxEndurance() / RuleI(Character, RestRegenEnd)); + RestRegenHP = 6 * (GetMaxHP() / zone->newzone_data.FastRegenHP); + RestRegenMana = 6 * (GetMaxMana() / zone->newzone_data.FastRegenMana)); + RestRegenEndurance = 6 * (GetMaxEndurance() / zone->newzone_data.FastRegenEndurance); } int32 Bot::LevelRegen() { diff --git a/zone/client_mods.cpp b/zone/client_mods.cpp index f342fff9f..39c37c874 100644 --- a/zone/client_mods.cpp +++ b/zone/client_mods.cpp @@ -290,9 +290,8 @@ int32 Client::CalcHPRegen(bool bCombat) // another check for IsClient && !(base + item_regen) && Cur_HP <= 0 do --base; do later if (!bCombat && CanFastRegen() && (IsSitting() || CanMedOnHorse())) { - auto fast_mod = RuleI(Character, RestRegenHP); // TODO: this is actually zone based auto max_hp = GetMaxHP(); - int fast_regen = 6 * (max_hp / fast_mod); + int fast_regen = 6 * (max_hp / zone->newzone_data.FastRegenHP); if (base < fast_regen) // weird, but what the client is doing base = fast_regen; } @@ -1296,9 +1295,8 @@ int32 Client::CalcManaRegen(bool bCombat) regen = regen * 100.0f * AreaManaRegen * 0.01f + 0.5f; if (!bCombat && CanFastRegen() && (IsSitting() || CanMedOnHorse())) { - auto fast_mod = RuleI(Character, RestRegenMana); // TODO: this is actually zone based auto max_mana = GetMaxMana(); - int fast_regen = 6 * (max_mana / fast_mod); + int fast_regen = 6 * (max_mana / zone->newzone_data.FastRegenMana); if (regen < fast_regen) // weird, but what the client is doing regen = fast_regen; } @@ -2264,9 +2262,8 @@ int32 Client::CalcEnduranceRegen(bool bCombat) int regen = base; if (!bCombat && CanFastRegen() && (IsSitting() || CanMedOnHorse())) { - auto fast_mod = RuleI(Character, RestRegenEnd); // TODO: this is actually zone based auto max_end = GetMaxEndurance(); - int fast_regen = 6 * (max_end / fast_mod); + int fast_regen = 6 * (max_end / zone->newzone_data.FastRegenEndurance); if (aa_regen < fast_regen) // weird, but what the client is doing aa_regen = fast_regen; } diff --git a/zone/merc.cpp b/zone/merc.cpp index a4b331fff..42a7f0290 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -1174,11 +1174,11 @@ void Merc::CalcRestState() { } } - RestRegenHP = 6 * (GetMaxHP() / RuleI(Character, RestRegenHP)); + RestRegenHP = 6 * (GetMaxHP() / zone->newzone_data.FastRegenHP); - RestRegenMana = 6 * (GetMaxMana() / RuleI(Character, RestRegenMana)); + RestRegenMana = 6 * (GetMaxMana() / zone->newzone_data.FastRegenMana); - RestRegenEndurance = 6 * (GetMaxEndurance() / RuleI(Character, RestRegenEnd)); + RestRegenEndurance = 6 * (GetMaxEndurance() / zone->newzone_data.FastRegenEndurance); } bool Merc::HasSkill(EQEmu::skills::SkillType skill_id) const { diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index f79288126..59a85b79b 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -143,7 +143,10 @@ bool ZoneDatabase::GetZoneCFG(uint32 zoneid, uint16 instance_id, NewZone_Struct "snow_duration2, " // 53 "snow_duration3, " // 54 "snow_duration4, " // 55 - "gravity " // 56 + "gravity, " // 56 + "FastRegenHP, " // 57 + "FastRegenMana, " // 58 + "FastRegenEndurance, " // 59 "FROM zone WHERE zoneidnumber = %i AND version = %i", zoneid, instance_id); auto results = QueryDatabase(query); @@ -188,6 +191,10 @@ bool ZoneDatabase::GetZoneCFG(uint32 zoneid, uint16 instance_id, NewZone_Struct Log(Logs::General, Logs::Debug, "Zone Gravity is %f", zone_data->gravity); allow_mercs = true; + zone_data->FastRegenHP = atoi(row[57]); + zone_data->FastRegenMana = atoi(row[58]); + zone_data->FastRegenEndurance = atoi(row[59]); + int bindable = 0; bindable = atoi(row[31]);