mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-20 05:01:29 +00:00
Merge fix
This commit is contained in:
commit
fc7623b690
@ -1,6 +1,24 @@
|
|||||||
EQEMu Changelog (Started on Sept 24, 2003 15:50)
|
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 ==
|
== 7/14/2017 ==
|
||||||
Akkadius: HP Update tuning - HP Updates are now forced when a client is targeted
|
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)
|
Akkadius: Client position updates should be smoother (granted the client has a good connection)
|
||||||
|
|||||||
@ -88,6 +88,7 @@ enum LogCategory {
|
|||||||
Headless_Client,
|
Headless_Client,
|
||||||
HP_Update,
|
HP_Update,
|
||||||
FixZ,
|
FixZ,
|
||||||
|
Food,
|
||||||
MaxCategoryID /* Don't Remove this*/
|
MaxCategoryID /* Don't Remove this*/
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -140,7 +141,8 @@ static const char* LogCategoryName[LogCategory::MaxCategoryID] = {
|
|||||||
"Client Login",
|
"Client Login",
|
||||||
"Headless Client",
|
"Headless Client",
|
||||||
"HP Update",
|
"HP Update",
|
||||||
"FixZ"
|
"FixZ",
|
||||||
|
"Food"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -23,6 +23,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
|
#include "../common/string_util.h"
|
||||||
#include "../common/eqemu_logsys.h"
|
#include "../common/eqemu_logsys.h"
|
||||||
#include "../common/queue.h"
|
#include "../common/queue.h"
|
||||||
#include "../common/timer.h"
|
#include "../common/timer.h"
|
||||||
@ -104,6 +105,12 @@ WebInterfaceList web_interface;
|
|||||||
|
|
||||||
void CatchSignal(int sig_num);
|
void CatchSignal(int sig_num);
|
||||||
|
|
||||||
|
inline void UpdateWindowTitle(std::string new_title) {
|
||||||
|
#ifdef _WINDOWS
|
||||||
|
SetConsoleTitle(new_title.c_str());
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
RegisterExecutablePlatform(ExePlatformWorld);
|
RegisterExecutablePlatform(ExePlatformWorld);
|
||||||
LogSys.LoadLogSettingsDefaults();
|
LogSys.LoadLogSettingsDefaults();
|
||||||
@ -527,8 +534,7 @@ int main(int argc, char** argv) {
|
|||||||
database.PurgeExpiredInstances();
|
database.PurgeExpiredInstances();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EQTimeTimer.Check())
|
if (EQTimeTimer.Check()) {
|
||||||
{
|
|
||||||
TimeOfDay_Struct tod;
|
TimeOfDay_Struct tod;
|
||||||
zoneserver_list.worldclock.GetCurrentEQTimeOfDay(time(0), &tod);
|
zoneserver_list.worldclock.GetCurrentEQTimeOfDay(time(0), &tod);
|
||||||
if (!database.SaveTime(tod.minute, tod.hour, tod.day, tod.month, tod.year))
|
if (!database.SaveTime(tod.minute, tod.hour, tod.day, tod.month, tod.year))
|
||||||
@ -545,6 +551,9 @@ int main(int argc, char** argv) {
|
|||||||
if (InterserverTimer.Check()) {
|
if (InterserverTimer.Check()) {
|
||||||
InterserverTimer.Start();
|
InterserverTimer.Start();
|
||||||
database.ping();
|
database.ping();
|
||||||
|
|
||||||
|
std::string window_title = StringFormat("World: %s Clients: %i", Config->LongName.c_str(), client_list.GetClientCount());
|
||||||
|
UpdateWindowTitle(window_title);
|
||||||
}
|
}
|
||||||
|
|
||||||
EQ::EventLoop::Get().Process();
|
EQ::EventLoop::Get().Process();
|
||||||
@ -563,17 +572,4 @@ int main(int argc, char** argv) {
|
|||||||
void CatchSignal(int sig_num) {
|
void CatchSignal(int sig_num) {
|
||||||
Log(Logs::General, Logs::World_Server, "Caught signal %d", sig_num);
|
Log(Logs::General, Logs::World_Server, "Caught signal %d", sig_num);
|
||||||
RunLoops = false;
|
RunLoops = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateWindowTitle(char* iNewTitle) {
|
|
||||||
#ifdef _WINDOWS
|
|
||||||
char tmp[500];
|
|
||||||
if (iNewTitle) {
|
|
||||||
snprintf(tmp, sizeof(tmp), "World: %s", iNewTitle);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
snprintf(tmp, sizeof(tmp), "World");
|
|
||||||
}
|
|
||||||
SetConsoleTitle(tmp);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
@ -31,7 +31,6 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
void CatchSignal(int sig_num);
|
void CatchSignal(int sig_num);
|
||||||
void UpdateWindowTitle(char* iNewTitle);
|
|
||||||
|
|
||||||
#define EQ_WORLD_PORT 9000 //mandated by the client
|
#define EQ_WORLD_PORT 9000 //mandated by the client
|
||||||
#define LOGIN_PORT 5997
|
#define LOGIN_PORT 5997
|
||||||
|
|||||||
@ -1262,6 +1262,7 @@ int Client::DoDamageCaps(int base_damage)
|
|||||||
return std::min(cap, base_damage);
|
return std::min(cap, base_damage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// other is the defender, this is the attacker
|
||||||
void Mob::DoAttack(Mob *other, DamageHitInfo &hit, ExtraAttackOptions *opts)
|
void Mob::DoAttack(Mob *other, DamageHitInfo &hit, ExtraAttackOptions *opts)
|
||||||
{
|
{
|
||||||
if (!other)
|
if (!other)
|
||||||
@ -1288,6 +1289,20 @@ void Mob::DoAttack(Mob *other, DamageHitInfo &hit, ExtraAttackOptions *opts)
|
|||||||
|
|
||||||
if (hit.damage_done >= 0) {
|
if (hit.damage_done >= 0) {
|
||||||
if (other->CheckHitChance(this, hit)) {
|
if (other->CheckHitChance(this, hit)) {
|
||||||
|
if (IsNPC() && other->IsClient() && other->animation > 0 && GetLevel() >= 5 && BehindMob(other, GetX(), GetY())) {
|
||||||
|
// ~ 12% chance
|
||||||
|
if (zone->random.Roll(12)) {
|
||||||
|
int stun_resist2 = other->spellbonuses.FrontalStunResist + other->itembonuses.FrontalStunResist + other->aabonuses.FrontalStunResist;
|
||||||
|
int stun_resist = other->spellbonuses.StunResist + other->itembonuses.StunResist + other->aabonuses.StunResist;
|
||||||
|
if (zone->random.Roll(stun_resist2)) {
|
||||||
|
other->Message_StringID(MT_Stun, AVOID_STUNNING_BLOW);
|
||||||
|
} else if (zone->random.Roll(stun_resist)) {
|
||||||
|
other->Message_StringID(MT_Stun, SHAKE_OFF_STUN);
|
||||||
|
} else {
|
||||||
|
other->Stun(3000); // yuck -- 3 seconds
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
other->MeleeMitigation(this, hit, opts);
|
other->MeleeMitigation(this, hit, opts);
|
||||||
if (hit.damage_done > 0) {
|
if (hit.damage_done > 0) {
|
||||||
ApplyDamageTable(hit);
|
ApplyDamageTable(hit);
|
||||||
|
|||||||
@ -124,6 +124,7 @@ Client::Client(EQStreamInterface* ieqs)
|
|||||||
camp_timer(29000),
|
camp_timer(29000),
|
||||||
process_timer(100),
|
process_timer(100),
|
||||||
stamina_timer(40000),
|
stamina_timer(40000),
|
||||||
|
consume_food_timer(60000),
|
||||||
zoneinpacket_timer(1000),
|
zoneinpacket_timer(1000),
|
||||||
linkdead_timer(RuleI(Zone,ClientLinkdeadMS)),
|
linkdead_timer(RuleI(Zone,ClientLinkdeadMS)),
|
||||||
dead_timer(2000),
|
dead_timer(2000),
|
||||||
@ -658,13 +659,18 @@ bool Client::Save(uint8 iCommitNow) {
|
|||||||
m_pp.tribute_time_remaining = 0xFFFFFFFF; m_pp.tribute_active = 0;
|
m_pp.tribute_time_remaining = 0xFFFFFFFF; m_pp.tribute_active = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_pp.hunger_level < 0)
|
||||||
|
m_pp.hunger_level = 0;
|
||||||
|
|
||||||
|
if (m_pp.thirst_level < 0)
|
||||||
|
m_pp.thirst_level = 0;
|
||||||
|
|
||||||
p_timers.Store(&database);
|
p_timers.Store(&database);
|
||||||
|
|
||||||
database.SaveCharacterTribute(this->CharacterID(), &m_pp);
|
database.SaveCharacterTribute(this->CharacterID(), &m_pp);
|
||||||
SaveTaskState(); /* Save Character Task */
|
SaveTaskState(); /* Save Character Task */
|
||||||
|
|
||||||
m_pp.hunger_level = EQEmu::Clamp(m_pp.hunger_level, 0, 50000);
|
Log(Logs::General, Logs::Food, "Client::Save - hunger_level: %i thirst_level: %i", m_pp.hunger_level, m_pp.thirst_level);
|
||||||
m_pp.thirst_level = EQEmu::Clamp(m_pp.thirst_level, 0, 50000);
|
|
||||||
|
|
||||||
// perform snapshot before SaveCharacterData() so that m_epp will contain the updated time
|
// perform snapshot before SaveCharacterData() so that m_epp will contain the updated time
|
||||||
if (RuleB(Character, ActiveInvSnapshots) && time(nullptr) >= GetNextInvSnapshotTime()) {
|
if (RuleB(Character, ActiveInvSnapshots) && time(nullptr) >= GetNextInvSnapshotTime()) {
|
||||||
@ -8585,50 +8591,63 @@ void Client::SetConsumption(int32 in_hunger, int32 in_thirst)
|
|||||||
|
|
||||||
void Client::Consume(const EQEmu::ItemData *item, uint8 type, int16 slot, bool auto_consume)
|
void Client::Consume(const EQEmu::ItemData *item, uint8 type, int16 slot, bool auto_consume)
|
||||||
{
|
{
|
||||||
if(!item) { return; }
|
if(!item) { return; }
|
||||||
|
|
||||||
uint32 cons_mod = 180;
|
/*
|
||||||
|
Spell Bonuses 2 digit form - 10, 20, 25 etc. (10%, 20%, 25%)
|
||||||
|
AA Bonus Ranks, 110, 125, 150 etc. (10%, 25%, 50%)
|
||||||
|
*/
|
||||||
|
|
||||||
int32 metabolism_bonus = spellbonuses.Metabolism + itembonuses.Metabolism + aabonuses.Metabolism;
|
float aa_bonus = ((float) aabonuses.Metabolism - 100) / 100;
|
||||||
|
float item_bonus = (float) itembonuses.Metabolism / 100;
|
||||||
|
float spell_bonus = (float) spellbonuses.Metabolism / 100;
|
||||||
|
|
||||||
if (metabolism_bonus)
|
float metabolism_mod = 1 + spell_bonus + item_bonus + aa_bonus;
|
||||||
cons_mod = cons_mod * metabolism_bonus * RuleI(Character, ConsumptionMultiplier) / 10000;
|
|
||||||
else
|
|
||||||
cons_mod = cons_mod * RuleI(Character, ConsumptionMultiplier) / 100;
|
|
||||||
|
|
||||||
if (type == EQEmu::item::ItemTypeFood)
|
Log(Logs::General, Logs::Food, "Client::Consume() Metabolism bonuses spell_bonus: (%.2f) item_bonus: (%.2f) aa_bonus: (%.2f) final: (%.2f)",
|
||||||
{
|
spell_bonus,
|
||||||
int hchange = item->CastTime_ * cons_mod;
|
item_bonus,
|
||||||
hchange = mod_food_value(item, hchange);
|
aa_bonus,
|
||||||
|
metabolism_mod
|
||||||
|
);
|
||||||
|
|
||||||
if(hchange < 0) { return; }
|
if (type == EQEmu::item::ItemTypeFood) {
|
||||||
|
int hunger_change = item->CastTime_ * metabolism_mod;
|
||||||
|
hunger_change = mod_food_value(item, hunger_change);
|
||||||
|
|
||||||
|
if(hunger_change < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_pp.hunger_level += hunger_change;
|
||||||
|
|
||||||
|
Log(Logs::General, Logs::Food, "Consuming food, points added to hunger_level: %i - current_hunger: %i", hunger_change, m_pp.hunger_level);
|
||||||
|
|
||||||
m_pp.hunger_level += hchange;
|
|
||||||
DeleteItemInInventory(slot, 1, false);
|
DeleteItemInInventory(slot, 1, false);
|
||||||
|
|
||||||
if(!auto_consume) //no message if the client consumed for us
|
if(!auto_consume) //no message if the client consumed for us
|
||||||
entity_list.MessageClose_StringID(this, true, 50, 0, EATING_MESSAGE, GetName(), item->Name);
|
entity_list.MessageClose_StringID(this, true, 50, 0, EATING_MESSAGE, GetName(), item->Name);
|
||||||
|
|
||||||
#if EQDEBUG >= 5
|
Log(Logs::General, Logs::Food, "Eating from slot: %i", (int)slot);
|
||||||
Log(Logs::General, Logs::None, "Eating from slot:%i", (int)slot);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
int thirst_change = item->CastTime_ * metabolism_mod;
|
||||||
int tchange = item->CastTime_ * cons_mod;
|
thirst_change = mod_drink_value(item, thirst_change);
|
||||||
tchange = mod_drink_value(item, tchange);
|
|
||||||
|
|
||||||
if(tchange < 0) { return; }
|
if(thirst_change < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_pp.thirst_level += thirst_change;
|
||||||
|
|
||||||
m_pp.thirst_level += tchange;
|
|
||||||
DeleteItemInInventory(slot, 1, false);
|
DeleteItemInInventory(slot, 1, false);
|
||||||
|
|
||||||
|
Log(Logs::General, Logs::Food, "Consuming drink, points added to thirst_level: %i current_thirst: %i", thirst_change, m_pp.thirst_level);
|
||||||
|
|
||||||
if(!auto_consume) //no message if the client consumed for us
|
if(!auto_consume) //no message if the client consumed for us
|
||||||
entity_list.MessageClose_StringID(this, true, 50, 0, DRINKING_MESSAGE, GetName(), item->Name);
|
entity_list.MessageClose_StringID(this, true, 50, 0, DRINKING_MESSAGE, GetName(), item->Name);
|
||||||
|
|
||||||
#if EQDEBUG >= 5
|
Log(Logs::General, Logs::Food, "Drinking from slot: %i", (int)slot);
|
||||||
Log(Logs::General, Logs::None, "Drinking from slot:%i", (int)slot);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1351,7 +1351,7 @@ private:
|
|||||||
uint32 GetClassHPFactor();
|
uint32 GetClassHPFactor();
|
||||||
void DoHPRegen();
|
void DoHPRegen();
|
||||||
void DoManaRegen();
|
void DoManaRegen();
|
||||||
void DoStaminaUpdate();
|
void DoStaminaHungerUpdate();
|
||||||
void CalcRestState();
|
void CalcRestState();
|
||||||
|
|
||||||
uint32 pLastUpdate;
|
uint32 pLastUpdate;
|
||||||
@ -1459,6 +1459,7 @@ private:
|
|||||||
Timer camp_timer;
|
Timer camp_timer;
|
||||||
Timer process_timer;
|
Timer process_timer;
|
||||||
Timer stamina_timer;
|
Timer stamina_timer;
|
||||||
|
Timer consume_food_timer;
|
||||||
Timer zoneinpacket_timer;
|
Timer zoneinpacket_timer;
|
||||||
Timer linkdead_timer;
|
Timer linkdead_timer;
|
||||||
Timer dead_timer;
|
Timer dead_timer;
|
||||||
|
|||||||
@ -8686,6 +8686,8 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/*
|
||||||
//This is food/drink - consume it
|
//This is food/drink - consume it
|
||||||
if (item->ItemType == EQEmu::item::ItemTypeFood && m_pp.hunger_level < 5000)
|
if (item->ItemType == EQEmu::item::ItemTypeFood && m_pp.hunger_level < 5000)
|
||||||
{
|
{
|
||||||
@ -8707,19 +8709,21 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app)
|
|||||||
//CheckIncreaseSkill(ALCOHOL_TOLERANCE, nullptr, 25);
|
//CheckIncreaseSkill(ALCOHOL_TOLERANCE, nullptr, 25);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_pp.hunger_level > 6000)
|
|
||||||
m_pp.hunger_level = 6000;
|
|
||||||
if (m_pp.thirst_level > 6000)
|
|
||||||
m_pp.thirst_level = 6000;
|
|
||||||
|
|
||||||
EQApplicationPacket *outapp2 = nullptr;
|
EQApplicationPacket *outapp2 = nullptr;
|
||||||
outapp2 = new EQApplicationPacket(OP_Stamina, sizeof(Stamina_Struct));
|
outapp2 = new EQApplicationPacket(OP_Stamina, sizeof(Stamina_Struct));
|
||||||
Stamina_Struct* sta = (Stamina_Struct*)outapp2->pBuffer;
|
Stamina_Struct* sta = (Stamina_Struct*)outapp2->pBuffer;
|
||||||
|
|
||||||
|
if (m_pp.hunger_level > 6000)
|
||||||
|
sta->food = 6000;
|
||||||
|
if (m_pp.thirst_level > 6000)
|
||||||
|
sta->water = 6000;
|
||||||
|
|
||||||
sta->food = m_pp.hunger_level;
|
sta->food = m_pp.hunger_level;
|
||||||
sta->water = m_pp.thirst_level;
|
sta->water = m_pp.thirst_level;
|
||||||
|
|
||||||
QueuePacket(outapp2);
|
QueuePacket(outapp2);
|
||||||
safe_delete(outapp2);
|
safe_delete(outapp2);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -38,6 +38,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "../common/data_verification.h"
|
||||||
#include "../common/rulesys.h"
|
#include "../common/rulesys.h"
|
||||||
#include "../common/skills.h"
|
#include "../common/skills.h"
|
||||||
#include "../common/spdat.h"
|
#include "../common/spdat.h"
|
||||||
@ -523,6 +524,11 @@ bool Client::Process() {
|
|||||||
DoEnduranceUpkeep();
|
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) {
|
if (tic_timer.Check() && !dead) {
|
||||||
CalcMaxHP();
|
CalcMaxHP();
|
||||||
CalcMaxMana();
|
CalcMaxMana();
|
||||||
@ -533,7 +539,7 @@ bool Client::Process() {
|
|||||||
DoManaRegen();
|
DoManaRegen();
|
||||||
DoEnduranceRegen();
|
DoEnduranceRegen();
|
||||||
BuffProcess();
|
BuffProcess();
|
||||||
DoStaminaUpdate();
|
DoStaminaHungerUpdate();
|
||||||
|
|
||||||
if (tribute_timer.Check()) {
|
if (tribute_timer.Check()) {
|
||||||
ToggleTribute(true); //re-activate the tribute.
|
ToggleTribute(true); //re-activate the tribute.
|
||||||
@ -1833,28 +1839,33 @@ void Client::DoManaRegen() {
|
|||||||
CheckManaEndUpdate();
|
CheckManaEndUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Client::DoStaminaHungerUpdate() {
|
||||||
void Client::DoStaminaUpdate() {
|
|
||||||
if(!stamina_timer.Check())
|
if(!stamina_timer.Check())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto outapp = new EQApplicationPacket(OP_Stamina, sizeof(Stamina_Struct));
|
auto outapp = new EQApplicationPacket(OP_Stamina, sizeof(Stamina_Struct));
|
||||||
Stamina_Struct* sta = (Stamina_Struct*)outapp->pBuffer;
|
Stamina_Struct* sta = (Stamina_Struct*)outapp->pBuffer;
|
||||||
|
|
||||||
if(zone->GetZoneID() != 151) {
|
Log(Logs::General, Logs::Food, "Client::DoStaminaHungerUpdate() hunger_level: %i thirst_level: %i before loss", m_pp.hunger_level, m_pp.thirst_level);
|
||||||
int loss = RuleI(Character, FoodLossPerUpdate);
|
|
||||||
if (m_pp.hunger_level > 0)
|
if (zone->GetZoneID() != 151) {
|
||||||
m_pp.hunger_level-=loss;
|
|
||||||
if (m_pp.thirst_level > 0)
|
|
||||||
m_pp.thirst_level-=loss;
|
|
||||||
sta->food = m_pp.hunger_level > 6000 ? 6000 : m_pp.hunger_level;
|
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 {
|
else {
|
||||||
// No auto food/drink consumption in the Bazaar
|
// No auto food/drink consumption in the Bazaar
|
||||||
sta->food = 6000;
|
sta->food = 6000;
|
||||||
sta->water = 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);
|
FastQueuePacket(&outapp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -6953,7 +6953,7 @@ void command_bestz(Client *c, const Seperator *sep) {
|
|||||||
|
|
||||||
float best_z = zone->zonemap->FindBestZ(me, &hit);
|
float best_z = zone->zonemap->FindBestZ(me, &hit);
|
||||||
|
|
||||||
if (best_z != -999999)
|
if (best_z != BEST_Z_INVALID)
|
||||||
{
|
{
|
||||||
c->Message(0, "Z is %.3f at (%.3f, %.3f).", best_z, me.x, me.y);
|
c->Message(0, "Z is %.3f at (%.3f, %.3f).", best_z, me.x, me.y);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -648,7 +648,7 @@ void EntityList::AddNPC(NPC *npc, bool SendSpawnPacket, bool dontqueue)
|
|||||||
|
|
||||||
parse->EventNPC(EVENT_SPAWN, npc, nullptr, "", 0);
|
parse->EventNPC(EVENT_SPAWN, npc, nullptr, "", 0);
|
||||||
|
|
||||||
npc->FixZ();
|
npc->FixZ(1);
|
||||||
|
|
||||||
uint16 emoteid = npc->GetEmoteID();
|
uint16 emoteid = npc->GetEmoteID();
|
||||||
if (emoteid != 0)
|
if (emoteid != 0)
|
||||||
|
|||||||
@ -151,7 +151,7 @@ void Mob::CalculateNewFearpoint()
|
|||||||
ranx = GetX()+zone->random.Int(0, ran-1)-zone->random.Int(0, ran-1);
|
ranx = GetX()+zone->random.Int(0, ran-1)-zone->random.Int(0, ran-1);
|
||||||
rany = GetY()+zone->random.Int(0, ran-1)-zone->random.Int(0, ran-1);
|
rany = GetY()+zone->random.Int(0, ran-1)-zone->random.Int(0, ran-1);
|
||||||
ranz = FindGroundZ(ranx,rany);
|
ranz = FindGroundZ(ranx,rany);
|
||||||
if (ranz == -999999)
|
if (ranz == BEST_Z_INVALID)
|
||||||
continue;
|
continue;
|
||||||
float fdist = ranz - GetZ();
|
float fdist = ranz - GetZ();
|
||||||
if (fdist >= -12 && fdist <= 12 && CheckCoordLosNoZLeaps(GetX(),GetY(),GetZ(),ranx,rany,ranz))
|
if (fdist >= -12 && fdist <= 12 && CheckCoordLosNoZLeaps(GetX(),GetY(),GetZ(),ranx,rany,ranz))
|
||||||
|
|||||||
@ -3439,7 +3439,7 @@ void Mob::SetTarget(Mob* mob) {
|
|||||||
|
|
||||||
float Mob::FindGroundZ(float new_x, float new_y, float z_offset)
|
float Mob::FindGroundZ(float new_x, float new_y, float z_offset)
|
||||||
{
|
{
|
||||||
float ret = -999999;
|
float ret = BEST_Z_INVALID;
|
||||||
if (zone->zonemap != nullptr)
|
if (zone->zonemap != nullptr)
|
||||||
{
|
{
|
||||||
glm::vec3 me;
|
glm::vec3 me;
|
||||||
@ -3448,7 +3448,7 @@ float Mob::FindGroundZ(float new_x, float new_y, float z_offset)
|
|||||||
me.z = m_Position.z + z_offset;
|
me.z = m_Position.z + z_offset;
|
||||||
glm::vec3 hit;
|
glm::vec3 hit;
|
||||||
float best_z = zone->zonemap->FindBestZ(me, &hit);
|
float best_z = zone->zonemap->FindBestZ(me, &hit);
|
||||||
if (best_z != -999999)
|
if (best_z != BEST_Z_INVALID)
|
||||||
{
|
{
|
||||||
ret = best_z;
|
ret = best_z;
|
||||||
}
|
}
|
||||||
@ -3459,7 +3459,7 @@ float Mob::FindGroundZ(float new_x, float new_y, float z_offset)
|
|||||||
// Copy of above function that isn't protected to be exported to Perl::Mob
|
// Copy of above function that isn't protected to be exported to Perl::Mob
|
||||||
float Mob::GetGroundZ(float new_x, float new_y, float z_offset)
|
float Mob::GetGroundZ(float new_x, float new_y, float z_offset)
|
||||||
{
|
{
|
||||||
float ret = -999999;
|
float ret = BEST_Z_INVALID;
|
||||||
if (zone->zonemap != 0)
|
if (zone->zonemap != 0)
|
||||||
{
|
{
|
||||||
glm::vec3 me;
|
glm::vec3 me;
|
||||||
@ -3468,7 +3468,7 @@ float Mob::GetGroundZ(float new_x, float new_y, float z_offset)
|
|||||||
me.z = m_Position.z+z_offset;
|
me.z = m_Position.z+z_offset;
|
||||||
glm::vec3 hit;
|
glm::vec3 hit;
|
||||||
float best_z = zone->zonemap->FindBestZ(me, &hit);
|
float best_z = zone->zonemap->FindBestZ(me, &hit);
|
||||||
if (best_z != -999999)
|
if (best_z != BEST_Z_INVALID)
|
||||||
{
|
{
|
||||||
ret = best_z;
|
ret = best_z;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1222,7 +1222,7 @@ protected:
|
|||||||
glm::vec4 m_Position;
|
glm::vec4 m_Position;
|
||||||
/* Used to determine when an NPC has traversed so many units - to send a zone wide pos update */
|
/* Used to determine when an NPC has traversed so many units - to send a zone wide pos update */
|
||||||
glm::vec4 last_major_update_position;
|
glm::vec4 last_major_update_position;
|
||||||
uint16 animation;
|
int animation; // this is really what MQ2 calls SpeedRun just packed like (int)(SpeedRun * 40.0f)
|
||||||
float base_size;
|
float base_size;
|
||||||
float size;
|
float size;
|
||||||
float runspeed;
|
float runspeed;
|
||||||
|
|||||||
@ -1531,7 +1531,7 @@ void NPC::AI_DoMovement() {
|
|||||||
|
|
||||||
Log(Logs::Detail, Logs::AI, "Roam Box: d=%.3f (%.3f->%.3f,%.3f->%.3f): Go To (%.3f,%.3f)",
|
Log(Logs::Detail, Logs::AI, "Roam Box: d=%.3f (%.3f->%.3f,%.3f->%.3f): Go To (%.3f,%.3f)",
|
||||||
roambox_distance, roambox_min_x, roambox_max_x, roambox_min_y, roambox_max_y, roambox_movingto_x, roambox_movingto_y);
|
roambox_distance, roambox_min_x, roambox_max_x, roambox_min_y, roambox_max_y, roambox_movingto_x, roambox_movingto_y);
|
||||||
|
|
||||||
float new_z = this->FindGroundZ(m_Position.x, m_Position.y, 5) + GetModelOffset();
|
float new_z = this->FindGroundZ(m_Position.x, m_Position.y, 5) + GetModelOffset();
|
||||||
|
|
||||||
if (!CalculateNewPosition(roambox_movingto_x, roambox_movingto_y, new_z, walksp, true))
|
if (!CalculateNewPosition(roambox_movingto_x, roambox_movingto_y, new_z, walksp, true))
|
||||||
|
|||||||
@ -277,8 +277,9 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
|
|||||||
caster->SetMana(0);
|
caster->SetMana(0);
|
||||||
} else if (spell_id == 2755 && caster) //Lifeburn
|
} else if (spell_id == 2755 && caster) //Lifeburn
|
||||||
{
|
{
|
||||||
dmg = -1 * caster->GetHP(); // just your current HP or should it be Max HP?
|
dmg = caster->GetHP(); // just your current HP
|
||||||
caster->SetHP(dmg / 4); // 2003 patch notes say ~ 1/4 HP. Should this be 1/4 your current HP or do 3/4 max HP dmg? Can it kill you?
|
caster->SetHP(dmg / 4); // 2003 patch notes say ~ 1/4 HP. Should this be 1/4 your current HP or do 3/4 max HP dmg? Can it kill you?
|
||||||
|
dmg = -dmg;
|
||||||
}
|
}
|
||||||
|
|
||||||
//do any AAs apply to these spells?
|
//do any AAs apply to these spells?
|
||||||
|
|||||||
@ -757,7 +757,8 @@ void Mob::SendToFixZ(float new_x, float new_y, float new_z) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mob::FixZ() {
|
void Mob::FixZ(int32 z_find_offset /*= 5*/)
|
||||||
|
{
|
||||||
|
|
||||||
BenchTimer timer;
|
BenchTimer timer;
|
||||||
timer.reset();
|
timer.reset();
|
||||||
@ -770,7 +771,6 @@ void Mob::FixZ() {
|
|||||||
/* Any more than 5 in the offset makes NPC's hop/snap to ceiling in small corridors */
|
/* 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);
|
float new_z = this->FindGroundZ(m_Position.x, m_Position.y, 5);
|
||||||
new_z += GetModelOffset();
|
new_z += GetModelOffset();
|
||||||
|
|
||||||
auto duration = timer.elapsed();
|
auto duration = timer.elapsed();
|
||||||
|
|
||||||
Log(
|
Log(
|
||||||
@ -785,7 +785,7 @@ void Mob::FixZ() {
|
|||||||
duration
|
duration
|
||||||
);
|
);
|
||||||
|
|
||||||
if ((new_z > -2000) && new_z != -999999) {
|
if ((new_z > -2000) && new_z != BEST_Z_INVALID) {
|
||||||
if (RuleB(Map, MobZVisualDebug))
|
if (RuleB(Map, MobZVisualDebug))
|
||||||
this->SendAppearanceEffect(78, 0, 0, 0, 0);
|
this->SendAppearanceEffect(78, 0, 0, 0, 0);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user