From 6d8b96068d97428e66b66c9f94164663a8754ec1 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 17 Sep 2017 09:55:42 -0500 Subject: [PATCH] Add model/race offset to FixZ calc (KLS) --- changelog.txt | 18 ++++++++ zone/mob.h | 1 + zone/waypoints.cpp | 109 ++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 127 insertions(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index 9568f8392..9d3535d62 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,6 +1,24 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 9/17/2017 == +Akkadius: Add model/race offset to FixZ calc (KLS) +Akkadius: Fix 95% of food/water consumption issues, if there are additional modifiers for race/class combos - those will need to be applied + +Stages should be put in place if not already: +https://wiki.project1999.com/Food_and_drink#Stages_of_Hunger_and_Thirst + +Values stored in the database are 0-6000, previously we capped it at 6000 but previous math would have normal values in the 60k+ range in order for food to be consumed at a reasonable rate. We are now using more native logic where 1 = 1 minute, following logic: + +(Minutes) +0 - 5 - This is a snack. +6 - 20 - This is a meal. +21 - 30 - This is a hearty meal. +31 - 40 - This is a banquet size meal. +41 - 50 - This meal is a feast! +51 - 60 - This is an enduring meal! +61 - X - This is a miraculous meal! + == 7/14/2017 == Akkadius: HP Update tuning - HP Updates are now forced when a client is targeted Akkadius: Client position updates should be smoother (granted the client has a good connection) diff --git a/zone/mob.h b/zone/mob.h index 1e6ae6194..270836f89 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -950,6 +950,7 @@ public: float GetGroundZ(float new_x, float new_y, float z_offset=0.0); void SendTo(float new_x, float new_y, float new_z); void SendToFixZ(float new_x, float new_y, float new_z); + float GetZOffset() const; void FixZ(); void NPCSpecialAttacks(const char* parse, int permtag, bool reset = true, bool remove = false); inline uint32 DontHealMeBefore() const { return pDontHealMeBefore; } diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index c1997af59..4efefe198 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -850,7 +850,7 @@ void Mob::FixZ() { { /* Any more than 5 in the offset makes NPC's hop/snap to ceiling in small corridors */ float new_z = this->FindGroundZ(m_Position.x, m_Position.y, 5); - new_z += (this->GetSize() / 1.55); + new_z += this->GetZOffset(); auto duration = timer.elapsed(); @@ -884,6 +884,113 @@ void Mob::FixZ() { } } +float Mob::GetZOffset() const { + float offset = 3.125f; + + switch (race) { + case 436: + offset = 0.577f; + break; + case 430: + offset = 0.5f; + break; + case 432: + offset = 1.9f; + break; + case 435: + offset = 0.93f; + break; + case 450: + offset = 0.938f; + break; + case 479: + offset = 0.8f; + break; + case 451: + offset = 0.816f; + break; + case 437: + offset = 0.527f; + break; + case 439: + offset = 1.536f; + break; + case 415: + offset = 1.0f; + break; + case 438: + offset = 0.776f; + break; + case 452: + offset = 0.776f; + break; + case 441: + offset = 0.816f; + break; + case 440: + offset = 0.938f; + break; + case 468: + offset = 1.0f; + break; + case 459: + offset = 1.0f; + break; + case 462: + offset = 1.5f; + break; + case 530: + offset = 1.2f; + break; + case 549: + offset = 0.5f; + break; + case 548: + offset = 0.5f; + break; + case 547: + offset = 0.5f; + break; + case 604: + offset = 1.2f; + break; + case 653: + offset = 5.9f; + break; + case 658: + offset = 4.0f; + break; + case 323: + offset = 5.0f; + break; + case 663: + offset = 5.0f; + break; + case 664: + offset = 4.0f; + break; + case 703: + offset = 9.0f; + break; + case 688: + offset = 5.0f; + break; + case 669: + offset = 7.0f; + break; + case 687: + offset = 2.0f; + break; + case 686: + offset = 2.0f; + break; + default: + offset = 3.125f; + } + + return 0.2 * GetSize() * offset; +} + int ZoneDatabase::GetHighestGrid(uint32 zoneid) { std::string query = StringFormat("SELECT COALESCE(MAX(id), 0) FROM grid WHERE zoneid = %i", zoneid);