mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-10 10:50:24 +00:00
Fix 95% of food/water consumption issues, if there are additional modifiers for race/class combos - those will need to be applied
Mods properly calculated 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!
This commit is contained in:
+21
-10
@@ -38,6 +38,7 @@
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "../common/data_verification.h"
|
||||
#include "../common/rulesys.h"
|
||||
#include "../common/skills.h"
|
||||
#include "../common/spdat.h"
|
||||
@@ -523,6 +524,11 @@ bool Client::Process() {
|
||||
DoEnduranceUpkeep();
|
||||
}
|
||||
|
||||
if (consume_food_timer.Check()) {
|
||||
m_pp.hunger_level = m_pp.hunger_level - 1;
|
||||
m_pp.thirst_level = m_pp.thirst_level - 1;
|
||||
}
|
||||
|
||||
if (tic_timer.Check() && !dead) {
|
||||
CalcMaxHP();
|
||||
CalcMaxMana();
|
||||
@@ -533,7 +539,7 @@ bool Client::Process() {
|
||||
DoManaRegen();
|
||||
DoEnduranceRegen();
|
||||
BuffProcess();
|
||||
DoStaminaUpdate();
|
||||
DoStaminaHungerUpdate();
|
||||
|
||||
if (tribute_timer.Check()) {
|
||||
ToggleTribute(true); //re-activate the tribute.
|
||||
@@ -1828,28 +1834,33 @@ void Client::DoManaRegen() {
|
||||
CheckManaEndUpdate();
|
||||
}
|
||||
|
||||
|
||||
void Client::DoStaminaUpdate() {
|
||||
void Client::DoStaminaHungerUpdate() {
|
||||
if(!stamina_timer.Check())
|
||||
return;
|
||||
|
||||
auto outapp = new EQApplicationPacket(OP_Stamina, sizeof(Stamina_Struct));
|
||||
Stamina_Struct* sta = (Stamina_Struct*)outapp->pBuffer;
|
||||
|
||||
if(zone->GetZoneID() != 151) {
|
||||
int loss = RuleI(Character, FoodLossPerUpdate);
|
||||
if (m_pp.hunger_level > 0)
|
||||
m_pp.hunger_level-=loss;
|
||||
if (m_pp.thirst_level > 0)
|
||||
m_pp.thirst_level-=loss;
|
||||
Log(Logs::General, Logs::Food, "Client::DoStaminaHungerUpdate() hunger_level: %i thirst_level: %i before loss", m_pp.hunger_level, m_pp.thirst_level);
|
||||
|
||||
if (zone->GetZoneID() != 151) {
|
||||
sta->food = m_pp.hunger_level > 6000 ? 6000 : m_pp.hunger_level;
|
||||
sta->water = m_pp.thirst_level> 6000 ? 6000 : m_pp.thirst_level;
|
||||
sta->water = m_pp.thirst_level > 6000 ? 6000 : m_pp.thirst_level;
|
||||
}
|
||||
else {
|
||||
// No auto food/drink consumption in the Bazaar
|
||||
sta->food = 6000;
|
||||
sta->water = 6000;
|
||||
}
|
||||
|
||||
Log(Logs::General, Logs::Food,
|
||||
"Client::DoStaminaHungerUpdate() Current hunger_level: %i = (%i minutes left) thirst_level: %i = (%i minutes left) - after loss",
|
||||
m_pp.hunger_level,
|
||||
m_pp.hunger_level,
|
||||
m_pp.thirst_level,
|
||||
m_pp.thirst_level
|
||||
);
|
||||
|
||||
FastQueuePacket(&outapp);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user