mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-22 20:33:01 +00:00
Compare commits
1 Commits
wp
..
login-proxy
| Author | SHA1 | Date | |
|---|---|---|---|
| 79caacd8a3 |
+7
-2
@@ -259,6 +259,7 @@ ENDIF(EQEMU_ENABLE_BOTS)
|
||||
OPTION(EQEMU_BUILD_SERVER "Build the game server." ON)
|
||||
OPTION(EQEMU_BUILD_LOGIN "Build the login server." OFF)
|
||||
OPTION(EQEMU_BUILD_HC "Build the headless client." OFF)
|
||||
OPTION(EQEMU_BUILD_LP "Build the login lookup proxy." OFF)
|
||||
OPTION(EQEMU_BUILD_TESTS "Build utility tests." OFF)
|
||||
OPTION(EQEMU_BUILD_PERL "Build Perl parser." ON)
|
||||
OPTION(EQEMU_BUILD_LUA "Build Lua parser." ON)
|
||||
@@ -360,10 +361,10 @@ INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/libs/format")
|
||||
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/libs/recast/detour/include")
|
||||
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/libs/recast/recast/include")
|
||||
|
||||
IF(EQEMU_BUILD_SERVER OR EQEMU_BUILD_LOGIN OR EQEMU_BUILD_TESTS OR EQEMU_BUILD_HC)
|
||||
IF(EQEMU_BUILD_SERVER OR EQEMU_BUILD_LOGIN OR EQEMU_BUILD_TESTS OR EQEMU_BUILD_HC OR EQEMU_BUILD_LP)
|
||||
ADD_SUBDIRECTORY(common)
|
||||
ADD_SUBDIRECTORY(libs)
|
||||
ENDIF(EQEMU_BUILD_SERVER OR EQEMU_BUILD_LOGIN OR EQEMU_BUILD_TESTS OR EQEMU_BUILD_HC)
|
||||
ENDIF(EQEMU_BUILD_SERVER OR EQEMU_BUILD_LOGIN OR EQEMU_BUILD_TESTS OR EQEMU_BUILD_HC OR EQEMU_BUILD_LP)
|
||||
IF(EQEMU_BUILD_SERVER)
|
||||
ADD_SUBDIRECTORY(shared_memory)
|
||||
ADD_SUBDIRECTORY(world)
|
||||
@@ -380,6 +381,10 @@ IF(EQEMU_BUILD_HC)
|
||||
ADD_SUBDIRECTORY(hc)
|
||||
ENDIF(EQEMU_BUILD_HC)
|
||||
|
||||
IF(EQEMU_BUILD_LP)
|
||||
ADD_SUBDIRECTORY(lp)
|
||||
ENDIF(EQEMU_BUILD_LP)
|
||||
|
||||
IF(EQEMU_BUILD_TESTS)
|
||||
ADD_SUBDIRECTORY(tests)
|
||||
ENDIF(EQEMU_BUILD_TESTS)
|
||||
|
||||
@@ -1,24 +1,6 @@
|
||||
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)
|
||||
|
||||
@@ -88,7 +88,6 @@ enum LogCategory {
|
||||
Headless_Client,
|
||||
HP_Update,
|
||||
FixZ,
|
||||
Food,
|
||||
MaxCategoryID /* Don't Remove this*/
|
||||
};
|
||||
|
||||
@@ -141,8 +140,7 @@ static const char* LogCategoryName[LogCategory::MaxCategoryID] = {
|
||||
"Client Login",
|
||||
"Headless Client",
|
||||
"HP Update",
|
||||
"FixZ",
|
||||
"Food"
|
||||
"FixZ"
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -151,7 +151,6 @@ RULE_BOOL(Character, UseOldBindWound, false) // Uses the original bind wound beh
|
||||
RULE_BOOL(Character, GrantHoTTOnCreate, false) // Grant Health of Target's Target leadership AA on character creation
|
||||
RULE_BOOL(Character, UseOldConSystem, false) // Grant Health of Target's Target leadership AA on character creation
|
||||
RULE_BOOL(Character, OPClientUpdateVisualDebug, false) // Shows a pulse and forward directional particle each time the client sends its position to server
|
||||
RULE_BOOL(Character, AllowCrossClassTrainers, false)
|
||||
RULE_CATEGORY_END()
|
||||
|
||||
RULE_CATEGORY(Mercs)
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
|
||||
|
||||
SET(lp_sources
|
||||
main.cpp
|
||||
)
|
||||
|
||||
SET(hc_headers
|
||||
)
|
||||
|
||||
FIND_PACKAGE(OpenSSL REQUIRED)
|
||||
|
||||
INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR})
|
||||
|
||||
ADD_EXECUTABLE(lp ${lp_sources} ${lp_headers})
|
||||
|
||||
INSTALL(TARGETS lp RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
|
||||
|
||||
TARGET_LINK_LIBRARIES(lp ${SERVER_LIBS} ${OPENSSL_LIBRARIES})
|
||||
|
||||
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
|
||||
+176
@@ -0,0 +1,176 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <openssl/des.h>
|
||||
#include <memory>
|
||||
|
||||
#include "../common/eqemu_logsys.h"
|
||||
#include "../common/json_config.h"
|
||||
#include "../common/net/daybreak_connection.h"
|
||||
#include "../common/net/dns.h"
|
||||
#include "../common/event/event_loop.h"
|
||||
#include "../common/event/timer.h"
|
||||
|
||||
EQEmuLogSys LogSys;
|
||||
|
||||
const char* eqcrypt_block(const char *buffer_in, size_t buffer_in_sz, char* buffer_out, bool enc) {
|
||||
DES_key_schedule k;
|
||||
DES_cblock v;
|
||||
|
||||
memset(&k, 0, sizeof(DES_key_schedule));
|
||||
memset(&v, 0, sizeof(DES_cblock));
|
||||
|
||||
if (!enc && buffer_in_sz && buffer_in_sz % 8 != 0) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
DES_ncbc_encrypt((const unsigned char*)buffer_in, (unsigned char*)buffer_out, (long)buffer_in_sz, &k, &v, enc);
|
||||
return buffer_out;
|
||||
}
|
||||
|
||||
bool connected = false;
|
||||
bool running = true;
|
||||
std::unique_ptr<EQ::Net::DaybreakConnectionManager> m_login_connection_manager;
|
||||
std::shared_ptr<EQ::Net::DaybreakConnection> m_login_connection;
|
||||
std::string m_user;
|
||||
std::string m_pass;
|
||||
|
||||
void LoginSendSessionReady()
|
||||
{
|
||||
EQ::Net::DynamicPacket p;
|
||||
p.PutUInt16(0, 1); //OP_SessionReady
|
||||
p.PutUInt32(2, 2);
|
||||
|
||||
m_login_connection->QueuePacket(p);
|
||||
}
|
||||
|
||||
void LoginSendLogin()
|
||||
{
|
||||
size_t buffer_len = m_user.length() + m_pass.length() + 2;
|
||||
std::unique_ptr<char[]> buffer(new char[buffer_len]);
|
||||
|
||||
strcpy(&buffer[0], m_user.c_str());
|
||||
strcpy(&buffer[m_user.length() + 1], m_pass.c_str());
|
||||
|
||||
size_t encrypted_len = buffer_len;
|
||||
|
||||
if (encrypted_len % 8 > 0) {
|
||||
encrypted_len = ((encrypted_len / 8) + 1) * 8;
|
||||
}
|
||||
|
||||
EQ::Net::DynamicPacket p;
|
||||
p.Resize(12 + encrypted_len);
|
||||
p.PutUInt16(0, 2); //OP_Login
|
||||
p.PutUInt32(2, 3);
|
||||
|
||||
eqcrypt_block(&buffer[0], buffer_len, (char*)p.Data() + 12, true);
|
||||
|
||||
m_login_connection->QueuePacket(p);
|
||||
}
|
||||
|
||||
void LoginProcessLoginResponse(const EQ::Net::Packet & p)
|
||||
{
|
||||
auto encrypt_size = p.Length() - 12;
|
||||
if (encrypt_size % 8 > 0) {
|
||||
encrypt_size = (encrypt_size / 8) * 8;
|
||||
}
|
||||
|
||||
std::unique_ptr<char[]> decrypted(new char[encrypt_size]);
|
||||
|
||||
eqcrypt_block((char*)p.Data() + 12, encrypt_size, &decrypted[0], false);
|
||||
|
||||
EQ::Net::StaticPacket sp(&decrypted[0], encrypt_size);
|
||||
auto response_error = sp.GetUInt16(1);
|
||||
|
||||
if (response_error > 101) {
|
||||
printf("Error logging in response code: %u\n", response_error);
|
||||
m_login_connection->Close();
|
||||
}
|
||||
else {
|
||||
auto m_dbid = sp.GetUInt32(8);
|
||||
|
||||
printf("Logged in successfully with dbid %u", m_dbid);
|
||||
m_login_connection->Close();
|
||||
}
|
||||
}
|
||||
|
||||
void LoginOnNewConnection(std::shared_ptr<EQ::Net::DaybreakConnection> connection)
|
||||
{
|
||||
m_login_connection = connection;
|
||||
}
|
||||
|
||||
void LoginOnStatusChange(std::shared_ptr<EQ::Net::DaybreakConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to)
|
||||
{
|
||||
if (to == EQ::Net::StatusConnected) {
|
||||
connected = true;
|
||||
LoginSendSessionReady();
|
||||
}
|
||||
|
||||
if (to == EQ::Net::StatusDisconnected) {
|
||||
running = false;
|
||||
}
|
||||
}
|
||||
|
||||
void LoginOnPacketRecv(std::shared_ptr<EQ::Net::DaybreakConnection> conn, const EQ::Net::Packet &p) {
|
||||
auto opcode = p.GetUInt16(0);
|
||||
switch (opcode) {
|
||||
case 0x0017: //OP_ChatMessage
|
||||
LoginSendLogin();
|
||||
break;
|
||||
case 0x0018:
|
||||
LoginProcessLoginResponse(p);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
LogSys.LoadLogSettingsDefaults();
|
||||
|
||||
if (argc != 3) {
|
||||
printf("Usage: lp [username] [password]\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
m_user = argv[1];
|
||||
m_pass = argv[2];
|
||||
|
||||
std::string address;
|
||||
int port;
|
||||
EQ::Timer t(5000U, false, [&](EQ::Timer *timer) {
|
||||
if (!connected) {
|
||||
printf("Connection failure.\n");
|
||||
running = false;
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
auto config = EQ::JsonConfigFile::Load("eqhost.json");
|
||||
address = config.GetVariableString("login", "address", "login.eqemulator.net");
|
||||
port = config.GetVariableInt("login", "port", 5999);
|
||||
}
|
||||
catch (std::exception) {
|
||||
printf("Unable to parse eqhost.json\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
EQ::Net::DNSLookup(address, port, false, [&](const std::string &addr) {
|
||||
if (addr.empty()) {
|
||||
printf("DNS Error for %s\n", address.c_str());
|
||||
running = false;
|
||||
return;
|
||||
}
|
||||
|
||||
m_login_connection_manager.reset(new EQ::Net::DaybreakConnectionManager());
|
||||
|
||||
m_login_connection_manager->OnNewConnection(std::bind(&LoginOnNewConnection, std::placeholders::_1));
|
||||
m_login_connection_manager->OnConnectionStateChange(std::bind(&LoginOnStatusChange, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
|
||||
m_login_connection_manager->OnPacketRecv(std::bind(&LoginOnPacketRecv, std::placeholders::_1, std::placeholders::_2));
|
||||
|
||||
m_login_connection_manager->Connect(addr, port);
|
||||
});
|
||||
|
||||
while (running) {
|
||||
EQ::EventLoop::Get().Process();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
+16
-12
@@ -23,7 +23,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#include <stdlib.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include "../common/string_util.h"
|
||||
#include "../common/eqemu_logsys.h"
|
||||
#include "../common/queue.h"
|
||||
#include "../common/timer.h"
|
||||
@@ -105,12 +104,6 @@ WebInterfaceList web_interface;
|
||||
|
||||
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) {
|
||||
RegisterExecutablePlatform(ExePlatformWorld);
|
||||
LogSys.LoadLogSettingsDefaults();
|
||||
@@ -534,7 +527,8 @@ int main(int argc, char** argv) {
|
||||
database.PurgeExpiredInstances();
|
||||
}
|
||||
|
||||
if (EQTimeTimer.Check()) {
|
||||
if (EQTimeTimer.Check())
|
||||
{
|
||||
TimeOfDay_Struct tod;
|
||||
zoneserver_list.worldclock.GetCurrentEQTimeOfDay(time(0), &tod);
|
||||
if (!database.SaveTime(tod.minute, tod.hour, tod.day, tod.month, tod.year))
|
||||
@@ -551,9 +545,6 @@ int main(int argc, char** argv) {
|
||||
if (InterserverTimer.Check()) {
|
||||
InterserverTimer.Start();
|
||||
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();
|
||||
@@ -572,4 +563,17 @@ int main(int argc, char** argv) {
|
||||
void CatchSignal(int sig_num) {
|
||||
Log(Logs::General, Logs::World_Server, "Caught signal %d", sig_num);
|
||||
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,6 +31,7 @@
|
||||
#endif
|
||||
|
||||
void CatchSignal(int sig_num);
|
||||
void UpdateWindowTitle(char* iNewTitle);
|
||||
|
||||
#define EQ_WORLD_PORT 9000 //mandated by the client
|
||||
#define LOGIN_PORT 5997
|
||||
|
||||
@@ -1262,7 +1262,6 @@ int Client::DoDamageCaps(int 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)
|
||||
{
|
||||
if (!other)
|
||||
@@ -1289,20 +1288,6 @@ void Mob::DoAttack(Mob *other, DamageHitInfo &hit, ExtraAttackOptions *opts)
|
||||
|
||||
if (hit.damage_done >= 0) {
|
||||
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);
|
||||
if (hit.damage_done > 0) {
|
||||
ApplyDamageTable(hit);
|
||||
|
||||
+27
-46
@@ -124,7 +124,6 @@ Client::Client(EQStreamInterface* ieqs)
|
||||
camp_timer(29000),
|
||||
process_timer(100),
|
||||
stamina_timer(40000),
|
||||
consume_food_timer(60000),
|
||||
zoneinpacket_timer(1000),
|
||||
linkdead_timer(RuleI(Zone,ClientLinkdeadMS)),
|
||||
dead_timer(2000),
|
||||
@@ -659,18 +658,13 @@ bool Client::Save(uint8 iCommitNow) {
|
||||
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);
|
||||
|
||||
database.SaveCharacterTribute(this->CharacterID(), &m_pp);
|
||||
SaveTaskState(); /* Save Character Task */
|
||||
|
||||
Log(Logs::General, Logs::Food, "Client::Save - hunger_level: %i thirst_level: %i", m_pp.hunger_level, m_pp.thirst_level);
|
||||
m_pp.hunger_level = EQEmu::Clamp(m_pp.hunger_level, 0, 50000);
|
||||
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
|
||||
if (RuleB(Character, ActiveInvSnapshots) && time(nullptr) >= GetNextInvSnapshotTime()) {
|
||||
@@ -8591,63 +8585,50 @@ void Client::SetConsumption(int32 in_hunger, int32 in_thirst)
|
||||
|
||||
void Client::Consume(const EQEmu::ItemData *item, uint8 type, int16 slot, bool auto_consume)
|
||||
{
|
||||
if(!item) { return; }
|
||||
if(!item) { return; }
|
||||
|
||||
/*
|
||||
Spell Bonuses 2 digit form - 10, 20, 25 etc. (10%, 20%, 25%)
|
||||
AA Bonus Ranks, 110, 125, 150 etc. (10%, 25%, 50%)
|
||||
*/
|
||||
uint32 cons_mod = 180;
|
||||
|
||||
float aa_bonus = ((float) aabonuses.Metabolism - 100) / 100;
|
||||
float item_bonus = (float) itembonuses.Metabolism / 100;
|
||||
float spell_bonus = (float) spellbonuses.Metabolism / 100;
|
||||
int32 metabolism_bonus = spellbonuses.Metabolism + itembonuses.Metabolism + aabonuses.Metabolism;
|
||||
|
||||
float metabolism_mod = 1 + spell_bonus + item_bonus + aa_bonus;
|
||||
if (metabolism_bonus)
|
||||
cons_mod = cons_mod * metabolism_bonus * RuleI(Character, ConsumptionMultiplier) / 10000;
|
||||
else
|
||||
cons_mod = cons_mod * RuleI(Character, ConsumptionMultiplier) / 100;
|
||||
|
||||
Log(Logs::General, Logs::Food, "Client::Consume() Metabolism bonuses spell_bonus: (%.2f) item_bonus: (%.2f) aa_bonus: (%.2f) final: (%.2f)",
|
||||
spell_bonus,
|
||||
item_bonus,
|
||||
aa_bonus,
|
||||
metabolism_mod
|
||||
);
|
||||
if (type == EQEmu::item::ItemTypeFood)
|
||||
{
|
||||
int hchange = item->CastTime_ * cons_mod;
|
||||
hchange = mod_food_value(item, hchange);
|
||||
|
||||
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);
|
||||
if(hchange < 0) { return; }
|
||||
|
||||
m_pp.hunger_level += hchange;
|
||||
DeleteItemInInventory(slot, 1, false);
|
||||
|
||||
if(!auto_consume) //no message if the client consumed for us
|
||||
entity_list.MessageClose_StringID(this, true, 50, 0, EATING_MESSAGE, GetName(), item->Name);
|
||||
|
||||
Log(Logs::General, Logs::Food, "Eating from slot: %i", (int)slot);
|
||||
|
||||
#if EQDEBUG >= 5
|
||||
Log(Logs::General, Logs::None, "Eating from slot:%i", (int)slot);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
int thirst_change = item->CastTime_ * metabolism_mod;
|
||||
thirst_change = mod_drink_value(item, thirst_change);
|
||||
else
|
||||
{
|
||||
int tchange = item->CastTime_ * cons_mod;
|
||||
tchange = mod_drink_value(item, tchange);
|
||||
|
||||
if(thirst_change < 0)
|
||||
return;
|
||||
|
||||
m_pp.thirst_level += thirst_change;
|
||||
if(tchange < 0) { return; }
|
||||
|
||||
m_pp.thirst_level += tchange;
|
||||
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
|
||||
entity_list.MessageClose_StringID(this, true, 50, 0, DRINKING_MESSAGE, GetName(), item->Name);
|
||||
|
||||
Log(Logs::General, Logs::Food, "Drinking from slot: %i", (int)slot);
|
||||
|
||||
#if EQDEBUG >= 5
|
||||
Log(Logs::General, Logs::None, "Drinking from slot:%i", (int)slot);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -1351,7 +1351,7 @@ private:
|
||||
uint32 GetClassHPFactor();
|
||||
void DoHPRegen();
|
||||
void DoManaRegen();
|
||||
void DoStaminaHungerUpdate();
|
||||
void DoStaminaUpdate();
|
||||
void CalcRestState();
|
||||
|
||||
uint32 pLastUpdate;
|
||||
@@ -1459,7 +1459,6 @@ private:
|
||||
Timer camp_timer;
|
||||
Timer process_timer;
|
||||
Timer stamina_timer;
|
||||
Timer consume_food_timer;
|
||||
Timer zoneinpacket_timer;
|
||||
Timer linkdead_timer;
|
||||
Timer dead_timer;
|
||||
|
||||
+8
-12
@@ -5750,10 +5750,10 @@ void Client::Handle_OP_FindPersonRequest(const EQApplicationPacket *app)
|
||||
glm::vec3 End(target->GetX(), target->GetY(), target->GetZ() + (target->GetSize() < 6.0 ? 6 : target->GetSize()) * HEAD_POSITION);
|
||||
|
||||
bool partial = false;
|
||||
bool stuck = false;
|
||||
auto pathlist = zone->pathing->FindRoute(Start, End, partial, stuck);
|
||||
bool error = false;
|
||||
auto pathlist = zone->pathing->FindRoute(Start, End, partial, error);
|
||||
|
||||
if (pathlist.empty() || partial)
|
||||
if (pathlist.empty() || error || partial)
|
||||
{
|
||||
EQApplicationPacket outapp(OP_FindPersonReply, 0);
|
||||
QueuePacket(&outapp);
|
||||
@@ -8686,8 +8686,6 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app)
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
/*
|
||||
//This is food/drink - consume it
|
||||
if (item->ItemType == EQEmu::item::ItemTypeFood && m_pp.hunger_level < 5000)
|
||||
{
|
||||
@@ -8709,21 +8707,19 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app)
|
||||
//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;
|
||||
outapp2 = new EQApplicationPacket(OP_Stamina, sizeof(Stamina_Struct));
|
||||
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->water = m_pp.thirst_level;
|
||||
|
||||
QueuePacket(outapp2);
|
||||
safe_delete(outapp2);
|
||||
*/
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+19
-36
@@ -38,7 +38,6 @@
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "../common/data_verification.h"
|
||||
#include "../common/rulesys.h"
|
||||
#include "../common/skills.h"
|
||||
#include "../common/spdat.h"
|
||||
@@ -524,11 +523,6 @@ 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();
|
||||
@@ -539,7 +533,7 @@ bool Client::Process() {
|
||||
DoManaRegen();
|
||||
DoEnduranceRegen();
|
||||
BuffProcess();
|
||||
DoStaminaHungerUpdate();
|
||||
DoStaminaUpdate();
|
||||
|
||||
if (tribute_timer.Check()) {
|
||||
ToggleTribute(true); //re-activate the tribute.
|
||||
@@ -1533,11 +1527,9 @@ void Client::OPGMTraining(const EQApplicationPacket *app)
|
||||
return;
|
||||
|
||||
//you can only use your own trainer, client enforces this, but why trust it
|
||||
if (!RuleB(Character, AllowCrossClassTrainers)) {
|
||||
int trains_class = pTrainer->GetClass() - (WARRIORGM - WARRIOR);
|
||||
if (GetClass() != trains_class)
|
||||
return;
|
||||
}
|
||||
int trains_class = pTrainer->GetClass() - (WARRIORGM - WARRIOR);
|
||||
if(GetClass() != trains_class)
|
||||
return;
|
||||
|
||||
//you have to be somewhat close to a trainer to be properly using them
|
||||
if(DistanceSquared(m_Position,pTrainer->GetPosition()) > USE_NPC_RANGE2)
|
||||
@@ -1588,11 +1580,9 @@ void Client::OPGMEndTraining(const EQApplicationPacket *app)
|
||||
return;
|
||||
|
||||
//you can only use your own trainer, client enforces this, but why trust it
|
||||
if (!RuleB(Character, AllowCrossClassTrainers)) {
|
||||
int trains_class = pTrainer->GetClass() - (WARRIORGM - WARRIOR);
|
||||
if (GetClass() != trains_class)
|
||||
return;
|
||||
}
|
||||
int trains_class = pTrainer->GetClass() - (WARRIORGM - WARRIOR);
|
||||
if(GetClass() != trains_class)
|
||||
return;
|
||||
|
||||
//you have to be somewhat close to a trainer to be properly using them
|
||||
if(DistanceSquared(m_Position, pTrainer->GetPosition()) > USE_NPC_RANGE2)
|
||||
@@ -1619,11 +1609,9 @@ void Client::OPGMTrainSkill(const EQApplicationPacket *app)
|
||||
return;
|
||||
|
||||
//you can only use your own trainer, client enforces this, but why trust it
|
||||
if (!RuleB(Character, AllowCrossClassTrainers)) {
|
||||
int trains_class = pTrainer->GetClass() - (WARRIORGM - WARRIOR);
|
||||
if (GetClass() != trains_class)
|
||||
return;
|
||||
}
|
||||
int trains_class = pTrainer->GetClass() - (WARRIORGM - WARRIOR);
|
||||
if(GetClass() != trains_class)
|
||||
return;
|
||||
|
||||
//you have to be somewhat close to a trainer to be properly using them
|
||||
if(DistanceSquared(m_Position, pTrainer->GetPosition()) > USE_NPC_RANGE2)
|
||||
@@ -1839,33 +1827,28 @@ void Client::DoManaRegen() {
|
||||
CheckManaEndUpdate();
|
||||
}
|
||||
|
||||
void Client::DoStaminaHungerUpdate() {
|
||||
|
||||
void Client::DoStaminaUpdate() {
|
||||
if(!stamina_timer.Check())
|
||||
return;
|
||||
|
||||
auto outapp = new EQApplicationPacket(OP_Stamina, sizeof(Stamina_Struct));
|
||||
Stamina_Struct* sta = (Stamina_Struct*)outapp->pBuffer;
|
||||
|
||||
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) {
|
||||
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;
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -6953,7 +6953,7 @@ void command_bestz(Client *c, const Seperator *sep) {
|
||||
|
||||
float best_z = zone->zonemap->FindBestZ(me, &hit);
|
||||
|
||||
if (best_z != BEST_Z_INVALID)
|
||||
if (best_z != -999999)
|
||||
{
|
||||
c->Message(0, "Z is %.3f at (%.3f, %.3f).", best_z, me.x, me.y);
|
||||
}
|
||||
|
||||
+1
-1
@@ -151,7 +151,7 @@ void Mob::CalculateNewFearpoint()
|
||||
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);
|
||||
ranz = FindGroundZ(ranx,rany);
|
||||
if (ranz == BEST_Z_INVALID)
|
||||
if (ranz == -999999)
|
||||
continue;
|
||||
float fdist = ranz - GetZ();
|
||||
if (fdist >= -12 && fdist <= 12 && CheckCoordLosNoZLeaps(GetX(),GetY(),GetZ(),ranx,rany,ranz))
|
||||
|
||||
+5
-12
@@ -445,7 +445,7 @@ Mob::Mob(const char* in_name,
|
||||
AssistAggro = false;
|
||||
npc_assist_cap = 0;
|
||||
|
||||
PathRecalcTimer.reset(new Timer(500));
|
||||
PathRecalcTimer.reset(new Timer(1500));
|
||||
PathingLoopCount = 0;
|
||||
}
|
||||
|
||||
@@ -1240,13 +1240,6 @@ void Mob::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho)
|
||||
|
||||
ns->spawn.flymode = 0;
|
||||
}
|
||||
|
||||
if (RuleB(Character, AllowCrossClassTrainers) && ForWho) {
|
||||
if (ns->spawn.class_ >= WARRIORGM && ns->spawn.class_ <= BERSERKERGM) {
|
||||
int trainer_class = WARRIORGM + (ForWho->GetClass() - 1);
|
||||
ns->spawn.class_ = trainer_class;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Mob::CreateDespawnPacket(EQApplicationPacket* app, bool Decay)
|
||||
@@ -3439,7 +3432,7 @@ void Mob::SetTarget(Mob* mob) {
|
||||
|
||||
float Mob::FindGroundZ(float new_x, float new_y, float z_offset)
|
||||
{
|
||||
float ret = BEST_Z_INVALID;
|
||||
float ret = -999999;
|
||||
if (zone->zonemap != nullptr)
|
||||
{
|
||||
glm::vec3 me;
|
||||
@@ -3448,7 +3441,7 @@ float Mob::FindGroundZ(float new_x, float new_y, float z_offset)
|
||||
me.z = m_Position.z + z_offset;
|
||||
glm::vec3 hit;
|
||||
float best_z = zone->zonemap->FindBestZ(me, &hit);
|
||||
if (best_z != BEST_Z_INVALID)
|
||||
if (best_z != -999999)
|
||||
{
|
||||
ret = best_z;
|
||||
}
|
||||
@@ -3459,7 +3452,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
|
||||
float Mob::GetGroundZ(float new_x, float new_y, float z_offset)
|
||||
{
|
||||
float ret = BEST_Z_INVALID;
|
||||
float ret = -999999;
|
||||
if (zone->zonemap != 0)
|
||||
{
|
||||
glm::vec3 me;
|
||||
@@ -3468,7 +3461,7 @@ float Mob::GetGroundZ(float new_x, float new_y, float z_offset)
|
||||
me.z = m_Position.z+z_offset;
|
||||
glm::vec3 hit;
|
||||
float best_z = zone->zonemap->FindBestZ(me, &hit);
|
||||
if (best_z != BEST_Z_INVALID)
|
||||
if (best_z != -999999)
|
||||
{
|
||||
ret = best_z;
|
||||
}
|
||||
|
||||
+1
-2
@@ -1222,7 +1222,7 @@ protected:
|
||||
glm::vec4 m_Position;
|
||||
/* Used to determine when an NPC has traversed so many units - to send a zone wide pos update */
|
||||
glm::vec4 last_major_update_position;
|
||||
int animation; // this is really what MQ2 calls SpeedRun just packed like (int)(SpeedRun * 40.0f)
|
||||
uint16 animation;
|
||||
float base_size;
|
||||
float size;
|
||||
float runspeed;
|
||||
@@ -1264,7 +1264,6 @@ protected:
|
||||
void CalculateNewFearpoint();
|
||||
float FindGroundZ(float new_x, float new_y, float z_offset=0.0);
|
||||
glm::vec3 UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &WaypointChange, bool &NodeReached);
|
||||
glm::vec3 HandleStuckPath(const glm::vec3 &To, const glm::vec3 &From);
|
||||
|
||||
virtual float GetSympatheticProcChances(uint16 spell_id, int16 ProcRateMod, int32 ItemProcRate = 0);
|
||||
int16 GetSympatheticSpellProcRate(uint16 spell_id);
|
||||
|
||||
+1
-1
@@ -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)",
|
||||
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();
|
||||
|
||||
if (!CalculateNewPosition(roambox_movingto_x, roambox_movingto_y, new_z, walksp, true))
|
||||
|
||||
@@ -29,7 +29,7 @@ public:
|
||||
IPathfinder() { }
|
||||
virtual ~IPathfinder() { }
|
||||
|
||||
virtual IPath FindRoute(const glm::vec3 &start, const glm::vec3 &end, bool &partial, bool &stuck) = 0;
|
||||
virtual IPath FindRoute(const glm::vec3 &start, const glm::vec3 &end, bool &partial, bool &error) = 0;
|
||||
virtual glm::vec3 GetRandomLocation() = 0;
|
||||
virtual void DebugCommand(Client *c, const Seperator *sep) = 0;
|
||||
|
||||
|
||||
@@ -33,12 +33,16 @@ PathfinderNavmesh::~PathfinderNavmesh()
|
||||
Clear();
|
||||
}
|
||||
|
||||
IPathfinder::IPath PathfinderNavmesh::FindRoute(const glm::vec3 &start, const glm::vec3 &end, bool &partial, bool &stuck)
|
||||
IPathfinder::IPath PathfinderNavmesh::FindRoute(const glm::vec3 &start, const glm::vec3 &end, bool &partial, bool &error)
|
||||
{
|
||||
partial = false;
|
||||
error = false;
|
||||
|
||||
if (!m_impl->nav_mesh) {
|
||||
return IPath();
|
||||
error = true;
|
||||
IPath Route;
|
||||
Route.push_back(end);
|
||||
return Route;
|
||||
}
|
||||
|
||||
if (!m_impl->query) {
|
||||
@@ -70,7 +74,10 @@ IPathfinder::IPath PathfinderNavmesh::FindRoute(const glm::vec3 &start, const gl
|
||||
m_impl->query->findNearestPoly(&dest_location[0], &ext[0], &filter, &end_ref, 0);
|
||||
|
||||
if (!start_ref || !end_ref) {
|
||||
return IPath();
|
||||
error = true;
|
||||
IPath Route;
|
||||
Route.push_back(end);
|
||||
return Route;
|
||||
}
|
||||
|
||||
int npoly = 0;
|
||||
@@ -82,11 +89,6 @@ IPathfinder::IPath PathfinderNavmesh::FindRoute(const glm::vec3 &start, const gl
|
||||
if (path[npoly - 1] != end_ref) {
|
||||
m_impl->query->closestPointOnPoly(path[npoly - 1], &dest_location[0], &epos[0], 0);
|
||||
partial = true;
|
||||
|
||||
auto dist = DistanceSquared(epos, current_location);
|
||||
if (dist < 10.0f) {
|
||||
stuck = true;
|
||||
}
|
||||
}
|
||||
|
||||
float straight_path[2048 * 3];
|
||||
@@ -100,7 +102,10 @@ IPathfinder::IPath PathfinderNavmesh::FindRoute(const glm::vec3 &start, const gl
|
||||
straight_path_polys, &n_straight_polys, 2048, DT_STRAIGHTPATH_AREA_CROSSINGS);
|
||||
|
||||
if (dtStatusFailed(status)) {
|
||||
return IPath();
|
||||
error = true;
|
||||
IPath Route;
|
||||
Route.push_back(end);
|
||||
return Route;
|
||||
}
|
||||
|
||||
if (n_straight_polys) {
|
||||
@@ -287,11 +292,11 @@ void PathfinderNavmesh::Load(const std::string &path)
|
||||
void PathfinderNavmesh::ShowPath(Client * c, const glm::vec3 &start, const glm::vec3 &end)
|
||||
{
|
||||
bool partial = false;
|
||||
bool stuck = false;
|
||||
auto path = FindRoute(start, end, partial, stuck);
|
||||
bool error = false;
|
||||
auto path = FindRoute(start, end, partial, error);
|
||||
std::vector<FindPerson_Point> points;
|
||||
|
||||
if (!partial) {
|
||||
if (!partial && !error) {
|
||||
FindPerson_Point p;
|
||||
for (auto &node : path)
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ public:
|
||||
PathfinderNavmesh(const std::string &path);
|
||||
virtual ~PathfinderNavmesh();
|
||||
|
||||
virtual IPath FindRoute(const glm::vec3 &start, const glm::vec3 &end, bool &partial, bool &stuck);
|
||||
virtual IPath FindRoute(const glm::vec3 &start, const glm::vec3 &end, bool &partial, bool &error);
|
||||
virtual glm::vec3 GetRandomLocation();
|
||||
virtual void DebugCommand(Client *c, const Seperator *sep);
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#include "pathfinder_null.h"
|
||||
|
||||
IPathfinder::IPath PathfinderNull::FindRoute(const glm::vec3 &start, const glm::vec3 &end, bool &partial, bool &stuck)
|
||||
IPathfinder::IPath PathfinderNull::FindRoute(const glm::vec3 &start, const glm::vec3 &end, bool &partial, bool &error)
|
||||
{
|
||||
error = false;
|
||||
partial = false;
|
||||
stuck = false;
|
||||
IPath ret;
|
||||
ret.push_back(start);
|
||||
ret.push_back(end);
|
||||
|
||||
@@ -8,7 +8,7 @@ public:
|
||||
PathfinderNull() { }
|
||||
virtual ~PathfinderNull() { }
|
||||
|
||||
virtual IPath FindRoute(const glm::vec3 &start, const glm::vec3 &end, bool &partial, bool &stuck);
|
||||
virtual IPath FindRoute(const glm::vec3 &start, const glm::vec3 &end, bool &partial, bool &error);
|
||||
virtual glm::vec3 GetRandomLocation();
|
||||
virtual void DebugCommand(Client *c, const Seperator *sep) { }
|
||||
};
|
||||
@@ -114,19 +114,21 @@ PathfinderWaypoint::~PathfinderWaypoint()
|
||||
{
|
||||
}
|
||||
|
||||
IPathfinder::IPath PathfinderWaypoint::FindRoute(const glm::vec3 &start, const glm::vec3 &end, bool &partial, bool &stuck)
|
||||
IPathfinder::IPath PathfinderWaypoint::FindRoute(const glm::vec3 &start, const glm::vec3 &end, bool &partial, bool &error)
|
||||
{
|
||||
stuck = false;
|
||||
partial = false;
|
||||
error = false;
|
||||
std::vector<RTreeValue> result_start_n;
|
||||
m_impl->Tree.query(boost::geometry::index::nearest(Point(start.x, start.y, start.z), 1), std::back_inserter(result_start_n));
|
||||
if (result_start_n.size() == 0) {
|
||||
error = true;
|
||||
return IPath();
|
||||
}
|
||||
|
||||
std::vector<RTreeValue> result_end_n;
|
||||
m_impl->Tree.query(boost::geometry::index::nearest(Point(end.x, end.y, end.z), 1), std::back_inserter(result_end_n));
|
||||
if (result_end_n.size() == 0) {
|
||||
error = true;
|
||||
return IPath();
|
||||
}
|
||||
|
||||
@@ -181,7 +183,11 @@ IPathfinder::IPath PathfinderWaypoint::FindRoute(const glm::vec3 &start, const g
|
||||
return Route;
|
||||
}
|
||||
|
||||
return IPath();
|
||||
error = true;
|
||||
IPath Route;
|
||||
Route.push_front(start);
|
||||
Route.push_back(glm::vec3(nearest_start.first.get<0>(), nearest_start.first.get<1>(), nearest_start.first.get<2>()));
|
||||
return Route;
|
||||
}
|
||||
|
||||
glm::vec3 PathfinderWaypoint::GetRandomLocation()
|
||||
@@ -395,8 +401,8 @@ void PathfinderWaypoint::ShowNodes()
|
||||
void PathfinderWaypoint::ShowPath(Client *c, const glm::vec3 &start, const glm::vec3 &end)
|
||||
{
|
||||
bool partial = false;
|
||||
bool stuck = false;
|
||||
auto path = FindRoute(start, end, partial, stuck);
|
||||
bool error = false;
|
||||
auto path = FindRoute(start, end, partial, error);
|
||||
std::vector<FindPerson_Point> points;
|
||||
|
||||
FindPerson_Point p;
|
||||
|
||||
@@ -11,7 +11,7 @@ public:
|
||||
PathfinderWaypoint(const std::string &path);
|
||||
virtual ~PathfinderWaypoint();
|
||||
|
||||
virtual IPath FindRoute(const glm::vec3 &start, const glm::vec3 &end, bool &partial, bool &stuck);
|
||||
virtual IPath FindRoute(const glm::vec3 &start, const glm::vec3 &end, bool &partial, bool &error);
|
||||
virtual glm::vec3 GetRandomLocation();
|
||||
virtual void DebugCommand(Client *c, const Seperator *sep);
|
||||
|
||||
|
||||
+24
-33
@@ -40,18 +40,20 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
|
||||
|
||||
if (Route.empty()) {
|
||||
bool partial = false;
|
||||
bool stuck = false;
|
||||
Route = zone->pathing->FindRoute(From, To, partial, stuck);
|
||||
bool error = false;
|
||||
Route = zone->pathing->FindRoute(From, To, partial, error);
|
||||
AdjustRoute(Route, flymode, GetModelOffset());
|
||||
|
||||
PathingDestination = To;
|
||||
WaypointChanged = true;
|
||||
NodeReached = false;
|
||||
if (stuck) {
|
||||
return HandleStuckPath(To, From);
|
||||
if (partial && Route.size() <= 2) {
|
||||
//We are stuck
|
||||
Route.clear();
|
||||
Teleport(To);
|
||||
return To;
|
||||
}
|
||||
|
||||
if (Route.empty()) {
|
||||
else if (error || Route.empty()) {
|
||||
return To;
|
||||
}
|
||||
else {
|
||||
@@ -64,19 +66,19 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
|
||||
if (!SameDestination) {
|
||||
//We had a route but our target position moved too much
|
||||
bool partial = false;
|
||||
bool stuck = false;
|
||||
Route = zone->pathing->FindRoute(From, To, partial, stuck);
|
||||
bool error = false;
|
||||
Route = zone->pathing->FindRoute(From, To, partial, error);
|
||||
AdjustRoute(Route, flymode, GetModelOffset());
|
||||
|
||||
PathingDestination = To;
|
||||
WaypointChanged = true;
|
||||
NodeReached = false;
|
||||
|
||||
if (stuck) {
|
||||
return HandleStuckPath(To, From);
|
||||
}
|
||||
|
||||
if (Route.empty()) {
|
||||
if (partial && Route.size() <= 2) {
|
||||
Route.clear();
|
||||
Teleport(To);
|
||||
return To;
|
||||
} else if (error || Route.empty()) {
|
||||
return To;
|
||||
}
|
||||
else {
|
||||
@@ -131,17 +133,19 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
|
||||
|
||||
if (Route.empty()) {
|
||||
bool partial = false;
|
||||
bool stuck = false;
|
||||
Route = zone->pathing->FindRoute(From, To, partial, stuck);
|
||||
bool error = false;
|
||||
Route = zone->pathing->FindRoute(From, To, partial, error);
|
||||
AdjustRoute(Route, flymode, GetModelOffset());
|
||||
PathingDestination = To;
|
||||
WaypointChanged = true;
|
||||
|
||||
if (stuck) {
|
||||
return HandleStuckPath(To, From);
|
||||
}
|
||||
|
||||
if(Route.empty()) {
|
||||
if (partial && Route.size() <= 2) {
|
||||
//We are stuck
|
||||
Route.clear();
|
||||
Teleport(To);
|
||||
return To;
|
||||
}
|
||||
else if (error || Route.empty()) {
|
||||
return To;
|
||||
}
|
||||
else {
|
||||
@@ -183,19 +187,6 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
|
||||
return To;
|
||||
}
|
||||
|
||||
glm::vec3 Mob::HandleStuckPath(const glm::vec3 &To, const glm::vec3 &From)
|
||||
{
|
||||
bool partial = false;
|
||||
bool stuck = false;
|
||||
auto r = zone->pathing->FindRoute(To, From, partial, stuck);
|
||||
Route.clear();
|
||||
|
||||
auto final_node = r.back();
|
||||
Route.push_back(final_node);
|
||||
AdjustRoute(Route, flymode, GetModelOffset());
|
||||
return (*Route.begin()).pos;
|
||||
}
|
||||
|
||||
void CullPoints(std::vector<FindPerson_Point> &points) {
|
||||
if (!zone->HasMap()) {
|
||||
return;
|
||||
|
||||
@@ -277,9 +277,8 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
|
||||
caster->SetMana(0);
|
||||
} else if (spell_id == 2755 && caster) //Lifeburn
|
||||
{
|
||||
dmg = caster->GetHP(); // just your current HP
|
||||
dmg = -1 * caster->GetHP(); // just your current HP or should it be Max 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?
|
||||
dmg = -dmg;
|
||||
}
|
||||
|
||||
//do any AAs apply to these spells?
|
||||
|
||||
+3
-3
@@ -757,8 +757,7 @@ void Mob::SendToFixZ(float new_x, float new_y, float new_z) {
|
||||
}
|
||||
}
|
||||
|
||||
void Mob::FixZ()
|
||||
{
|
||||
void Mob::FixZ() {
|
||||
|
||||
BenchTimer timer;
|
||||
timer.reset();
|
||||
@@ -771,6 +770,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 += GetModelOffset();
|
||||
|
||||
auto duration = timer.elapsed();
|
||||
|
||||
Log(
|
||||
@@ -785,7 +785,7 @@ void Mob::FixZ()
|
||||
duration
|
||||
);
|
||||
|
||||
if ((new_z > -2000) && new_z != BEST_Z_INVALID) {
|
||||
if ((new_z > -2000) && new_z != -999999) {
|
||||
if (RuleB(Map, MobZVisualDebug))
|
||||
this->SendAppearanceEffect(78, 0, 0, 0, 0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user