mirror of
https://github.com/EQEmu/Server.git
synced 2026-12-03 10:12:17 +00:00
Merge branch 'build' into feature/remove_boost
This commit is contained in:
2754 files changed
+66424
-490313
No files matched your search
+8
-18
@@ -1,12 +1,13 @@
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 3.2)
|
||||
|
||||
SET(zone_sources
|
||||
aa.cpp
|
||||
aa_ability.cpp
|
||||
aggro.cpp
|
||||
aggromanager.cpp
|
||||
aura.cpp
|
||||
api_service.cpp
|
||||
attack.cpp
|
||||
aura.cpp
|
||||
beacon.cpp
|
||||
bonuses.cpp
|
||||
bot.cpp
|
||||
@@ -78,6 +79,7 @@ SET(zone_sources
|
||||
horse.cpp
|
||||
inventory.cpp
|
||||
loottables.cpp
|
||||
main.cpp
|
||||
map.cpp
|
||||
merc.cpp
|
||||
mob.cpp
|
||||
@@ -86,7 +88,6 @@ SET(zone_sources
|
||||
mob_movement_manager.cpp
|
||||
mob_info.cpp
|
||||
mod_functions.cpp
|
||||
net.cpp
|
||||
npc.cpp
|
||||
npc_ai.cpp
|
||||
npc_scale_manager.cpp
|
||||
@@ -140,12 +141,14 @@ SET(zone_sources
|
||||
zone.cpp
|
||||
zone_config.cpp
|
||||
zonedb.cpp
|
||||
zoning.cpp)
|
||||
zoning.cpp
|
||||
)
|
||||
|
||||
SET(zone_headers
|
||||
aa.h
|
||||
aa_ability.h
|
||||
aggromanager.h
|
||||
api_service.h
|
||||
aura.h
|
||||
basic_functions.h
|
||||
beacon.h
|
||||
@@ -158,7 +161,7 @@ SET(zone_headers
|
||||
command.h
|
||||
common.h
|
||||
corpse.h
|
||||
data_bucket.h
|
||||
data_bucket.h
|
||||
doors.h
|
||||
embparser.h
|
||||
embperl.h
|
||||
@@ -207,7 +210,6 @@ SET(zone_headers
|
||||
merc.h
|
||||
mob.h
|
||||
mob_movement_manager.h
|
||||
net.h
|
||||
npc.h
|
||||
npc_ai.h
|
||||
npc_scale_manager.h
|
||||
@@ -247,10 +249,6 @@ SET(zone_headers
|
||||
zonedb.h
|
||||
zonedump.h)
|
||||
|
||||
IF(EQEMU_DEPOP_INVALIDATES_CACHE)
|
||||
ADD_DEFINITIONS(-DDEPOP_INVALIDATES_NPC_TYPES_CACHE)
|
||||
ENDIF(EQEMU_DEPOP_INVALIDATES_CACHE)
|
||||
|
||||
ADD_EXECUTABLE(zone ${zone_sources} ${zone_headers})
|
||||
|
||||
INSTALL(TARGETS zone RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
|
||||
@@ -259,12 +257,4 @@ ADD_DEFINITIONS(-DZONE)
|
||||
|
||||
TARGET_LINK_LIBRARIES(zone ${SERVER_LIBS})
|
||||
|
||||
IF(EQEMU_BUILD_PERL)
|
||||
TARGET_LINK_LIBRARIES(zone ${PERL_LIBRARY})
|
||||
ENDIF()
|
||||
|
||||
IF(EQEMU_BUILD_LUA)
|
||||
TARGET_LINK_LIBRARIES(zone luabind ${LUA_LIBRARY})
|
||||
ENDIF(EQEMU_BUILD_LUA)
|
||||
|
||||
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
|
||||
+27
-27
@@ -57,8 +57,8 @@ void Mob::TemporaryPets(uint16 spell_id, Mob *targ, const char *name_override, u
|
||||
PetRecord record;
|
||||
if (!database.GetPoweredPetEntry(spells[spell_id].teleport_zone, act_power, &record))
|
||||
{
|
||||
Log(Logs::General, Logs::Error, "Unknown swarm pet spell id: %d, check pets table", spell_id);
|
||||
Message(13, "Unable to find data for pet %s", spells[spell_id].teleport_zone);
|
||||
LogError("Unknown swarm pet spell id: {}, check pets table", spell_id);
|
||||
Message(Chat::Red, "Unable to find data for pet %s", spells[spell_id].teleport_zone);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ void Mob::TemporaryPets(uint16 spell_id, Mob *targ, const char *name_override, u
|
||||
const NPCType *npc_type = database.LoadNPCTypesData(pet.npc_id);
|
||||
if (npc_type == nullptr) {
|
||||
//log write
|
||||
Log(Logs::General, Logs::Error, "Unknown npc type for swarm pet spell id: %d", spell_id);
|
||||
LogError("Unknown npc type for swarm pet spell id: [{}]", spell_id);
|
||||
Message(0, "Unable to find pet!");
|
||||
return;
|
||||
}
|
||||
@@ -183,7 +183,7 @@ void Mob::TypesTemporaryPets(uint32 typesid, Mob *targ, const char *name_overrid
|
||||
const NPCType *npc_type = database.LoadNPCTypesData(typesid);
|
||||
if(npc_type == nullptr) {
|
||||
//log write
|
||||
Log(Logs::General, Logs::Error, "Unknown npc type for swarm pet type id: %d", typesid);
|
||||
LogError("Unknown npc type for swarm pet type id: [{}]", typesid);
|
||||
Message(0,"Unable to find pet!");
|
||||
return;
|
||||
}
|
||||
@@ -489,7 +489,7 @@ void Client::ResetAA() {
|
||||
database.DeleteCharacterLeadershipAAs(CharacterID());
|
||||
// undefined for these clients
|
||||
if (ClientVersionBit() & EQEmu::versions::maskTitaniumAndEarlier)
|
||||
Kick();
|
||||
Kick("AA Reset on client that doesn't support it");
|
||||
}
|
||||
|
||||
void Client::SendClearAA()
|
||||
@@ -1091,7 +1091,7 @@ void Client::FinishAlternateAdvancementPurchase(AA::Rank *rank, bool ignore_cost
|
||||
SendAlternateAdvancementStats();
|
||||
|
||||
if(rank->prev) {
|
||||
Message_StringID(15, AA_IMPROVE,
|
||||
MessageString(Chat::Yellow, AA_IMPROVE,
|
||||
std::to_string(rank->title_sid).c_str(),
|
||||
std::to_string(rank->prev->current_value).c_str(),
|
||||
std::to_string(cost).c_str(),
|
||||
@@ -1104,7 +1104,7 @@ void Client::FinishAlternateAdvancementPurchase(AA::Rank *rank, bool ignore_cost
|
||||
}
|
||||
}
|
||||
else {
|
||||
Message_StringID(15, AA_GAIN_ABILITY,
|
||||
MessageString(Chat::Yellow, AA_GAIN_ABILITY,
|
||||
std::to_string(rank->title_sid).c_str(),
|
||||
std::to_string(cost).c_str(),
|
||||
cost == 1 ? std::to_string(AA_POINT).c_str() : std::to_string(AA_POINTS).c_str());
|
||||
@@ -1179,11 +1179,11 @@ void Client::ActivateAlternateAdvancementAbility(int rank_id, int target_id) {
|
||||
uint32 aaremain_sec = aaremain % 60;
|
||||
|
||||
if(aaremain_hr >= 1) {
|
||||
Message(13, "You can use this ability again in %u hour(s) %u minute(s) %u seconds",
|
||||
Message(Chat::Red, "You can use this ability again in %u hour(s) %u minute(s) %u seconds",
|
||||
aaremain_hr, aaremain_min, aaremain_sec);
|
||||
}
|
||||
else {
|
||||
Message(13, "You can use this ability again in %u minute(s) %u seconds",
|
||||
Message(Chat::Red, "You can use this ability again in %u minute(s) %u seconds",
|
||||
aaremain_min, aaremain_sec);
|
||||
}
|
||||
|
||||
@@ -1200,7 +1200,7 @@ void Client::ActivateAlternateAdvancementAbility(int rank_id, int target_id) {
|
||||
CommonBreakInvisible();
|
||||
|
||||
if (spells[rank->spell].sneak && (!hidden || (hidden && (Timer::GetCurrentTime() - tmHidden) < 4000))) {
|
||||
Message_StringID(MT_SpellFailure, SNEAK_RESTRICT);
|
||||
MessageString(Chat::SpellFailure, SNEAK_RESTRICT);
|
||||
return;
|
||||
}
|
||||
//
|
||||
@@ -1214,7 +1214,7 @@ void Client::ActivateAlternateAdvancementAbility(int rank_id, int target_id) {
|
||||
SetAppearance(eaStanding, false);
|
||||
|
||||
if (GetAppearance() != eaStanding) {
|
||||
Message_StringID(MT_SpellFailure, STAND_TO_CAST);
|
||||
MessageString(Chat::SpellFailure, STAND_TO_CAST);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1562,17 +1562,17 @@ bool Mob::CanPurchaseAlternateAdvancementRank(AA::Rank *rank, bool check_price,
|
||||
}
|
||||
|
||||
void Zone::LoadAlternateAdvancement() {
|
||||
Log(Logs::General, Logs::Status, "Loading Alternate Advancement Data...");
|
||||
LogInfo("Loading Alternate Advancement Data");
|
||||
if(!database.LoadAlternateAdvancementAbilities(aa_abilities,
|
||||
aa_ranks))
|
||||
{
|
||||
aa_abilities.clear();
|
||||
aa_ranks.clear();
|
||||
Log(Logs::General, Logs::Status, "Failed to load Alternate Advancement Data");
|
||||
LogInfo("Failed to load Alternate Advancement Data");
|
||||
return;
|
||||
}
|
||||
|
||||
Log(Logs::General, Logs::Status, "Processing Alternate Advancement Data...");
|
||||
LogInfo("Processing Alternate Advancement Data");
|
||||
for(const auto &ability : aa_abilities) {
|
||||
ability.second->first = GetAlternateAdvancementRank(ability.second->first_rank_id);
|
||||
|
||||
@@ -1623,13 +1623,13 @@ void Zone::LoadAlternateAdvancement() {
|
||||
}
|
||||
}
|
||||
|
||||
Log(Logs::General, Logs::Status, "Loaded Alternate Advancement Data");
|
||||
LogInfo("Loaded Alternate Advancement Data");
|
||||
}
|
||||
|
||||
bool ZoneDatabase::LoadAlternateAdvancementAbilities(std::unordered_map<int, std::unique_ptr<AA::Ability>> &abilities,
|
||||
std::unordered_map<int, std::unique_ptr<AA::Rank>> &ranks)
|
||||
{
|
||||
Log(Logs::General, Logs::Status, "Loading Alternate Advancement Abilities...");
|
||||
LogInfo("Loading Alternate Advancement Abilities");
|
||||
abilities.clear();
|
||||
std::string query = "SELECT id, name, category, classes, races, deities, drakkin_heritage, status, type, charges, "
|
||||
"grant_only, first_rank_id FROM aa_ability WHERE enabled = 1";
|
||||
@@ -1655,13 +1655,13 @@ bool ZoneDatabase::LoadAlternateAdvancementAbilities(std::unordered_map<int, std
|
||||
abilities[ability->id] = std::unique_ptr<AA::Ability>(ability);
|
||||
}
|
||||
} else {
|
||||
Log(Logs::General, Logs::Error, "Failed to load Alternate Advancement Abilities");
|
||||
LogError("Failed to load Alternate Advancement Abilities");
|
||||
return false;
|
||||
}
|
||||
|
||||
Log(Logs::General, Logs::Status, "Loaded %d Alternate Advancement Abilities", (int)abilities.size());
|
||||
LogInfo("Loaded [{}] Alternate Advancement Abilities", (int)abilities.size());
|
||||
|
||||
Log(Logs::General, Logs::Status, "Loading Alternate Advancement Ability Ranks...");
|
||||
LogInfo("Loading Alternate Advancement Ability Ranks");
|
||||
ranks.clear();
|
||||
query = "SELECT id, upper_hotkey_sid, lower_hotkey_sid, title_sid, desc_sid, cost, level_req, spell, spell_type, recast_time, "
|
||||
"next_id, expansion FROM aa_ranks";
|
||||
@@ -1690,13 +1690,13 @@ bool ZoneDatabase::LoadAlternateAdvancementAbilities(std::unordered_map<int, std
|
||||
ranks[rank->id] = std::unique_ptr<AA::Rank>(rank);
|
||||
}
|
||||
} else {
|
||||
Log(Logs::General, Logs::Error, "Failed to load Alternate Advancement Ability Ranks");
|
||||
LogError("Failed to load Alternate Advancement Ability Ranks");
|
||||
return false;
|
||||
}
|
||||
|
||||
Log(Logs::General, Logs::Status, "Loaded %d Alternate Advancement Ability Ranks", (int)ranks.size());
|
||||
LogInfo("Loaded [{}] Alternate Advancement Ability Ranks", (int)ranks.size());
|
||||
|
||||
Log(Logs::General, Logs::Status, "Loading Alternate Advancement Ability Rank Effects...");
|
||||
LogInfo("Loading Alternate Advancement Ability Rank Effects");
|
||||
query = "SELECT rank_id, slot, effect_id, base1, base2 FROM aa_rank_effects";
|
||||
results = QueryDatabase(query);
|
||||
if(results.Success()) {
|
||||
@@ -1717,13 +1717,13 @@ bool ZoneDatabase::LoadAlternateAdvancementAbilities(std::unordered_map<int, std
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Log(Logs::General, Logs::Error, "Failed to load Alternate Advancement Ability Rank Effects");
|
||||
LogError("Failed to load Alternate Advancement Ability Rank Effects");
|
||||
return false;
|
||||
}
|
||||
|
||||
Log(Logs::General, Logs::Status, "Loaded Alternate Advancement Ability Rank Effects");
|
||||
LogInfo("Loaded Alternate Advancement Ability Rank Effects");
|
||||
|
||||
Log(Logs::General, Logs::Status, "Loading Alternate Advancement Ability Rank Prereqs...");
|
||||
LogInfo("Loading Alternate Advancement Ability Rank Prereqs");
|
||||
query = "SELECT rank_id, aa_id, points FROM aa_rank_prereqs";
|
||||
results = QueryDatabase(query);
|
||||
if(results.Success()) {
|
||||
@@ -1742,11 +1742,11 @@ bool ZoneDatabase::LoadAlternateAdvancementAbilities(std::unordered_map<int, std
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Log(Logs::General, Logs::Error, "Failed to load Alternate Advancement Ability Rank Prereqs");
|
||||
LogError("Failed to load Alternate Advancement Ability Rank Prereqs");
|
||||
return false;
|
||||
}
|
||||
|
||||
Log(Logs::General, Logs::Status, "Loaded Alternate Advancement Ability Rank Prereqs");
|
||||
LogInfo("Loaded Alternate Advancement Ability Rank Prereqs");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
+52
-43
@@ -52,12 +52,12 @@ void EntityList::CheckClientAggro(Client *around)
|
||||
void EntityList::DescribeAggro(Client *towho, NPC *from_who, float d, bool verbose) {
|
||||
float d2 = d*d;
|
||||
|
||||
towho->Message(0, "Describing aggro for %s", from_who->GetName());
|
||||
towho->Message(Chat::White, "Describing aggro for %s", from_who->GetName());
|
||||
|
||||
bool engaged = from_who->IsEngaged();
|
||||
if(engaged) {
|
||||
Mob *top = from_who->GetHateTop();
|
||||
towho->Message(0, ".. I am currently fighting with %s", top == nullptr?"(nullptr)":top->GetName());
|
||||
towho->Message(Chat::White, ".. I am currently fighting with %s", top == nullptr?"(nullptr)":top->GetName());
|
||||
}
|
||||
bool check_npcs = from_who->WillAggroNPCs();
|
||||
|
||||
@@ -77,7 +77,7 @@ void EntityList::DescribeAggro(Client *towho, NPC *from_who, float d, bool verbo
|
||||
if(!database.GetFactionName(my_primary, namebuf, sizeof(namebuf)))
|
||||
strcpy(namebuf, "(Unknown)");
|
||||
}
|
||||
towho->Message(0, ".. I am on faction %s (%d)\n", namebuf, my_primary);
|
||||
towho->Message(Chat::White, ".. I am on faction %s (%d)\n", namebuf, my_primary);
|
||||
}
|
||||
|
||||
for (auto it = mob_list.begin(); it != mob_list.end(); ++it) {
|
||||
@@ -91,11 +91,11 @@ void EntityList::DescribeAggro(Client *towho, NPC *from_who, float d, bool verbo
|
||||
if (engaged) {
|
||||
uint32 amm = from_who->GetHateAmount(mob);
|
||||
if (amm == 0)
|
||||
towho->Message(0, "... %s is not on my hate list.", mob->GetName());
|
||||
towho->Message(Chat::White, "... %s is not on my hate list.", mob->GetName());
|
||||
else
|
||||
towho->Message(0, "... %s is on my hate list with value %lu", mob->GetName(), (unsigned long)amm);
|
||||
towho->Message(Chat::White, "... %s is on my hate list with value %lu", mob->GetName(), (unsigned long)amm);
|
||||
} else if (!check_npcs && mob->IsNPC()) {
|
||||
towho->Message(0, "... %s is an NPC and my npc_aggro is disabled.", mob->GetName());
|
||||
towho->Message(Chat::White, "... %s is an NPC and my npc_aggro is disabled.", mob->GetName());
|
||||
} else {
|
||||
from_who->DescribeAggro(towho, mob, verbose);
|
||||
}
|
||||
@@ -114,13 +114,13 @@ void NPC::DescribeAggro(Client *towho, Mob *mob, bool verbose) {
|
||||
if(( t1 > iAggroRange)
|
||||
|| ( t2 > iAggroRange)
|
||||
|| ( t3 > iAggroRange) ) {
|
||||
towho->Message(0, "...%s is out of range (fast). distances (%.3f,%.3f,%.3f), range %.3f", mob->GetName(),
|
||||
towho->Message(Chat::White, "...%s is out of range (fast). distances (%.3f,%.3f,%.3f), range %.3f", mob->GetName(),
|
||||
t1, t2, t3, iAggroRange);
|
||||
return;
|
||||
}
|
||||
|
||||
if(mob->IsInvisible(this)) {
|
||||
towho->Message(0, "...%s is invisible to me. ", mob->GetName());
|
||||
towho->Message(Chat::White, "...%s is invisible to me. ", mob->GetName());
|
||||
return;
|
||||
}
|
||||
if((mob->IsClient() &&
|
||||
@@ -131,13 +131,13 @@ void NPC::DescribeAggro(Client *towho, Mob *mob, bool verbose) {
|
||||
)
|
||||
))
|
||||
{
|
||||
towho->Message(0, "...%s is my owner. ", mob->GetName());
|
||||
towho->Message(Chat::White, "...%s is my owner. ", mob->GetName());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(mob == GetOwner()) {
|
||||
towho->Message(0, "...%s a GM or is not connected. ", mob->GetName());
|
||||
towho->Message(Chat::White, "...%s a GM or is not connected. ", mob->GetName());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ void NPC::DescribeAggro(Client *towho, Mob *mob, bool verbose) {
|
||||
|
||||
float iAggroRange2 = iAggroRange*iAggroRange;
|
||||
if( dist2 > iAggroRange2 ) {
|
||||
towho->Message(0, "...%s is out of range. %.3f > %.3f ", mob->GetName(),
|
||||
towho->Message(Chat::White, "...%s is out of range. %.3f > %.3f ", mob->GetName(),
|
||||
dist2, iAggroRange2);
|
||||
return;
|
||||
}
|
||||
@@ -154,14 +154,14 @@ void NPC::DescribeAggro(Client *towho, Mob *mob, bool verbose) {
|
||||
{
|
||||
if (GetLevel() < RuleI(Aggro, MinAggroLevel) && mob->GetLevelCon(GetLevel()) == CON_GRAY && GetBodyType() != 3)
|
||||
{
|
||||
towho->Message(0, "...%s is red to me (basically)", mob->GetName(), dist2, iAggroRange2);
|
||||
towho->Message(Chat::White, "...%s is red to me (basically)", mob->GetName(), dist2, iAggroRange2);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(GetINT() > RuleI(Aggro, IntAggroThreshold) && mob->GetLevelCon(GetLevel()) == CON_GRAY ) {
|
||||
towho->Message(0, "...%s is red to me (basically)", mob->GetName(),
|
||||
towho->Message(Chat::White, "...%s is red to me (basically)", mob->GetName(),
|
||||
dist2, iAggroRange2);
|
||||
return;
|
||||
}
|
||||
@@ -178,9 +178,9 @@ void NPC::DescribeAggro(Client *towho, Mob *mob, bool verbose) {
|
||||
mob_primary = own->GetPrimaryFaction();
|
||||
|
||||
if(mob_primary == 0) {
|
||||
towho->Message(0, "...%s has no primary faction", mob->GetName());
|
||||
towho->Message(Chat::White, "...%s has no primary faction", mob->GetName());
|
||||
} else if(mob_primary < 0) {
|
||||
towho->Message(0, "...%s is on special faction %d", mob->GetName(), mob_primary);
|
||||
towho->Message(Chat::White, "...%s is on special faction %d", mob->GetName(), mob_primary);
|
||||
} else {
|
||||
char namebuf[256];
|
||||
if(!database.GetFactionName(mob_primary, namebuf, sizeof(namebuf)))
|
||||
@@ -193,22 +193,22 @@ void NPC::DescribeAggro(Client *towho, Mob *mob, bool verbose) {
|
||||
struct NPCFaction* fac = *cur;
|
||||
if ((int32)fac->factionID == mob_primary) {
|
||||
if (fac->npc_value > 0) {
|
||||
towho->Message(0, "...%s is on ALLY faction %s (%d) with %d", mob->GetName(), namebuf, mob_primary, fac->npc_value);
|
||||
towho->Message(Chat::White, "...%s is on ALLY faction %s (%d) with %d", mob->GetName(), namebuf, mob_primary, fac->npc_value);
|
||||
res = true;
|
||||
break;
|
||||
} else if (fac->npc_value < 0) {
|
||||
towho->Message(0, "...%s is on ENEMY faction %s (%d) with %d", mob->GetName(), namebuf, mob_primary, fac->npc_value);
|
||||
towho->Message(Chat::White, "...%s is on ENEMY faction %s (%d) with %d", mob->GetName(), namebuf, mob_primary, fac->npc_value);
|
||||
res = true;
|
||||
break;
|
||||
} else {
|
||||
towho->Message(0, "...%s is on NEUTRAL faction %s (%d) with 0", mob->GetName(), namebuf, mob_primary);
|
||||
towho->Message(Chat::White, "...%s is on NEUTRAL faction %s (%d) with 0", mob->GetName(), namebuf, mob_primary);
|
||||
res = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!res) {
|
||||
towho->Message(0, "...%s is on faction %s (%d), which I have no entry for.", mob->GetName(), namebuf, mob_primary);
|
||||
towho->Message(Chat::White, "...%s is on faction %s (%d), which I have no entry for.", mob->GetName(), namebuf, mob_primary);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -222,18 +222,18 @@ void NPC::DescribeAggro(Client *towho, Mob *mob, bool verbose) {
|
||||
||
|
||||
fv == FACTION_THREATENLY
|
||||
)) {
|
||||
towho->Message(0, "...%s faction not low enough. value='%s'", mob->GetName(), FactionValueToString(fv));
|
||||
towho->Message(Chat::White, "...%s faction not low enough. value='%s'", mob->GetName(), FactionValueToString(fv));
|
||||
return;
|
||||
}
|
||||
if(fv == FACTION_THREATENLY) {
|
||||
towho->Message(0, "...%s threatening to me, so they only have a %d chance per check of attacking.", mob->GetName());
|
||||
towho->Message(Chat::White, "...%s threatening to me, so they only have a %d chance per check of attacking.", mob->GetName());
|
||||
}
|
||||
|
||||
if(!CheckLosFN(mob)) {
|
||||
towho->Message(0, "...%s is out of sight.", mob->GetName());
|
||||
towho->Message(Chat::White, "...%s is out of sight.", mob->GetName());
|
||||
}
|
||||
|
||||
towho->Message(0, "...%s meets all conditions, I should be attacking them.", mob->GetName());
|
||||
towho->Message(Chat::White, "...%s meets all conditions, I should be attacking them.", mob->GetName());
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -251,9 +251,17 @@ bool Mob::CheckWillAggro(Mob *mob) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Mob *ownr = mob->GetOwner();
|
||||
if(ownr && ownr->IsClient() && !ownr->CastToClient()->ClientFinishedLoading())
|
||||
/**
|
||||
* Pets shouldn't scan for aggro
|
||||
*/
|
||||
if (this->GetOwner()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Mob *pet_owner = mob->GetOwner();
|
||||
if (pet_owner && pet_owner->IsClient()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
float iAggroRange = GetAggroRange();
|
||||
|
||||
@@ -286,9 +294,7 @@ bool Mob::CheckWillAggro(Mob *mob) {
|
||||
|
||||
// Don't aggro new clients if we are already engaged unless PROX_AGGRO is set
|
||||
if (IsEngaged() && (!GetSpecialAbility(PROX_AGGRO) || (GetSpecialAbility(PROX_AGGRO) && !CombatRange(mob)))) {
|
||||
Log(Logs::Moderate, Logs::Aggro,
|
||||
"%s is in combat, and does not have prox_aggro, or does and is out of combat range with %s",
|
||||
GetName(), mob->GetName());
|
||||
LogAggro("[{}] is in combat, and does not have prox_aggro, or does and is out of combat range with [{}]", GetName(), mob->GetName());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -348,7 +354,7 @@ bool Mob::CheckWillAggro(Mob *mob) {
|
||||
{
|
||||
//FatherNiwtit: make sure we can see them. last since it is very expensive
|
||||
if(CheckLosFN(mob)) {
|
||||
Log(Logs::Detail, Logs::Aggro, "Check aggro for %s target %s.", GetName(), mob->GetName());
|
||||
LogAggro("Check aggro for [{}] target [{}]", GetName(), mob->GetName());
|
||||
return( mod_will_aggro(mob, this) );
|
||||
}
|
||||
}
|
||||
@@ -380,18 +386,18 @@ bool Mob::CheckWillAggro(Mob *mob) {
|
||||
{
|
||||
//FatherNiwtit: make sure we can see them. last since it is very expensive
|
||||
if(CheckLosFN(mob)) {
|
||||
Log(Logs::Detail, Logs::Aggro, "Check aggro for %s target %s.", GetName(), mob->GetName());
|
||||
LogAggro("Check aggro for [{}] target [{}]", GetName(), mob->GetName());
|
||||
return( mod_will_aggro(mob, this) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Log(Logs::Detail, Logs::Aggro, "Is In zone?:%d\n", mob->InZone());
|
||||
Log(Logs::Detail, Logs::Aggro, "Dist^2: %f\n", dist2);
|
||||
Log(Logs::Detail, Logs::Aggro, "Range^2: %f\n", iAggroRange2);
|
||||
Log(Logs::Detail, Logs::Aggro, "Faction: %d\n", fv);
|
||||
Log(Logs::Detail, Logs::Aggro, "Int: %d\n", GetINT());
|
||||
Log(Logs::Detail, Logs::Aggro, "Con: %d\n", GetLevelCon(mob->GetLevel()));
|
||||
LogAggro("Is In zone?:[{}]\n", mob->InZone());
|
||||
LogAggro("Dist^2: [{}]\n", dist2);
|
||||
LogAggro("Range^2: [{}]\n", iAggroRange2);
|
||||
LogAggro("Faction: [{}]\n", fv);
|
||||
LogAggro("Int: [{}]\n", GetINT());
|
||||
LogAggro("Con: [{}]\n", GetLevelCon(mob->GetLevel()));
|
||||
|
||||
return(false);
|
||||
}
|
||||
@@ -511,7 +517,7 @@ void EntityList::AIYellForHelp(Mob* sender, Mob* attacker) {
|
||||
//Father Nitwit: make sure we can see them.
|
||||
if(mob->CheckLosFN(sender)) {
|
||||
#if (EQDEBUG>=5)
|
||||
Log(Logs::General, Logs::None, "AIYellForHelp(\"%s\",\"%s\") %s attacking %s Dist %f Z %f",
|
||||
LogDebug("AIYellForHelp(\"[{}]\",\"[{}]\") [{}] attacking [{}] Dist [{}] Z [{}]",
|
||||
sender->GetName(), attacker->GetName(), mob->GetName(),
|
||||
attacker->GetName(), DistanceSquared(mob->GetPosition(),
|
||||
sender->GetPosition()), std::abs(sender->GetZ()+mob->GetZ()));
|
||||
@@ -727,6 +733,7 @@ type', in which case, the answer is yes.
|
||||
}
|
||||
|
||||
#ifdef BOTS
|
||||
// this is HIGHLY inefficient
|
||||
bool HasRuleDefined = false;
|
||||
bool IsBotAttackAllowed = false;
|
||||
IsBotAttackAllowed = Bot::IsBotAttackAllowed(mob1, mob2, HasRuleDefined);
|
||||
@@ -741,7 +748,7 @@ type', in which case, the answer is yes.
|
||||
}
|
||||
while( reverse++ == 0 );
|
||||
|
||||
Log(Logs::General, Logs::None, "Mob::IsAttackAllowed: don't have a rule for this - %s vs %s\n", this->GetName(), target->GetName());
|
||||
LogDebug("Mob::IsAttackAllowed: don't have a rule for this - [{}] vs [{}]\n", this->GetName(), target->GetName());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -881,7 +888,7 @@ bool Mob::IsBeneficialAllowed(Mob *target)
|
||||
}
|
||||
while( reverse++ == 0 );
|
||||
|
||||
Log(Logs::General, Logs::None, "Mob::IsBeneficialAllowed: don't have a rule for this - %s to %s\n", this->GetName(), target->GetName());
|
||||
LogDebug("Mob::IsBeneficialAllowed: don't have a rule for this - [{}] to [{}]\n", this->GetName(), target->GetName());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -964,11 +971,13 @@ bool Mob::CombatRange(Mob* other)
|
||||
}
|
||||
|
||||
//Father Nitwit's LOS code
|
||||
bool Mob::CheckLosFN(Mob* other) {
|
||||
bool Mob::CheckLosFN(Mob *other)
|
||||
{
|
||||
bool Result = false;
|
||||
|
||||
if(other)
|
||||
if (other) {
|
||||
Result = CheckLosFN(other->GetX(), other->GetY(), other->GetZ(), other->GetSize());
|
||||
}
|
||||
|
||||
SetLastLosState(Result);
|
||||
|
||||
@@ -1000,7 +1009,7 @@ bool Mob::CheckLosFN(float posX, float posY, float posZ, float mobSize) {
|
||||
oloc.z = posZ + (mobSize==0.0?LOS_DEFAULT_HEIGHT:mobSize)/2 * SEE_POSITION;
|
||||
|
||||
#if LOSDEBUG>=5
|
||||
Log(Logs::General, Logs::None, "LOS from (%.2f, %.2f, %.2f) to (%.2f, %.2f, %.2f) sizes: (%.2f, %.2f)", myloc.x, myloc.y, myloc.z, oloc.x, oloc.y, oloc.z, GetSize(), mobSize);
|
||||
LogDebug("LOS from ([{}], [{}], [{}]) to ([{}], [{}], [{}]) sizes: ([{}], [{}])", myloc.x, myloc.y, myloc.z, oloc.x, oloc.y, oloc.z, GetSize(), mobSize);
|
||||
#endif
|
||||
return zone->zonemap->CheckLoS(myloc, oloc);
|
||||
}
|
||||
@@ -1022,7 +1031,7 @@ bool Mob::CheckLosFN(glm::vec3 posWatcher, float sizeWatcher, glm::vec3 posTarge
|
||||
posTarget.z += (sizeTarget == 0.0f ? LOS_DEFAULT_HEIGHT : sizeTarget) / 2 * SEE_POSITION;
|
||||
|
||||
#if LOSDEBUG>=5
|
||||
Log(Logs::General, Logs::None, "LOS from (%.2f, %.2f, %.2f) to (%.2f, %.2f, %.2f) sizes: (%.2f, %.2f) [static]", posWatcher.x, posWatcher.y, posWatcher.z, posTarget.x, posTarget.y, posTarget.z, sizeWatcher, sizeTarget);
|
||||
LogDebug("LOS from ([{}], [{}], [{}]) to ([{}], [{}], [{}]) sizes: ([{}], [{}]) [static]", posWatcher.x, posWatcher.y, posWatcher.z, posTarget.x, posTarget.y, posTarget.z, sizeWatcher, sizeTarget);
|
||||
#endif
|
||||
return zone->zonemap->CheckLoS(posWatcher, posTarget);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,918 @@
|
||||
/**
|
||||
* EQEmulator: Everquest Server Emulator
|
||||
* Copyright (C) 2001-2019 EQEmulator Development Team (https://github.com/EQEmu/Server)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
* are required to give you total support for your newly bought product;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
#include "../common/net/websocket_server.h"
|
||||
#include "../common/eqemu_logsys.h"
|
||||
#include "zonedb.h"
|
||||
#include "client.h"
|
||||
#include "entity.h"
|
||||
#include "corpse.h"
|
||||
#include "api_service.h"
|
||||
#include "npc.h"
|
||||
#include "object.h"
|
||||
#include "zone.h"
|
||||
#include "doors.h"
|
||||
#include <iostream>
|
||||
|
||||
extern Zone *zone;
|
||||
|
||||
/**
|
||||
* @param connection
|
||||
* @param username
|
||||
* @param password
|
||||
* @return
|
||||
*/
|
||||
EQ::Net::WebsocketLoginStatus CheckLogin(
|
||||
EQ::Net::WebsocketServerConnection *connection,
|
||||
const std::string &username,
|
||||
const std::string &password
|
||||
)
|
||||
{
|
||||
EQ::Net::WebsocketLoginStatus ret;
|
||||
ret.logged_in = false;
|
||||
|
||||
|
||||
std::string prefix = "eqemu";
|
||||
|
||||
ret.account_id = database.CheckLogin(username.c_str(), password.c_str(), prefix.c_str());
|
||||
|
||||
if (ret.account_id == 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
char account_name[64];
|
||||
database.GetAccountName(static_cast<uint32>(ret.account_id), account_name);
|
||||
ret.account_name = account_name;
|
||||
ret.logged_in = true;
|
||||
ret.status = database.CheckStatus(ret.account_id);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param connection
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
Json::Value ApiGetPacketStatistics(EQ::Net::WebsocketServerConnection *connection, Json::Value params)
|
||||
{
|
||||
if (zone->GetZoneID() == 0) {
|
||||
throw EQ::Net::WebsocketException("Zone must be loaded to invoke this call");
|
||||
}
|
||||
|
||||
Json::Value response;
|
||||
auto &list = entity_list.GetClientList();
|
||||
|
||||
for (auto &iter : list) {
|
||||
auto client = iter.second;
|
||||
auto connection = client->Connection();
|
||||
auto opts = connection->GetManager()->GetOptions();
|
||||
auto eqs_stats = connection->GetStats();
|
||||
auto &stats = eqs_stats.DaybreakStats;
|
||||
auto now = EQ::Net::Clock::now();
|
||||
auto sec_since_stats_reset = std::chrono::duration_cast<std::chrono::duration<double>>(
|
||||
now - stats.created
|
||||
).count();
|
||||
|
||||
Json::Value row;
|
||||
|
||||
row["client_id"] = client->GetID();
|
||||
row["client_name"] = client->GetCleanName();
|
||||
row["seconds_since_reset"] = sec_since_stats_reset;
|
||||
row["sent_bytes"] = stats.sent_bytes;
|
||||
row["receive_bytes"] = stats.recv_bytes;
|
||||
row["min_ping"] = stats.min_ping;
|
||||
row["max_ping"] = stats.max_ping;
|
||||
row["last_ping"] = stats.last_ping;
|
||||
row["average_ping"] = stats.avg_ping;
|
||||
row["realtime_receive_packets"] = stats.recv_packets;
|
||||
row["realtime_sent_packets"] = stats.sent_packets;
|
||||
row["sync_recv_packets"] = stats.sync_recv_packets;
|
||||
row["sync_sent_packets"] = stats.sync_sent_packets;
|
||||
row["sync_remote_recv_packets"] = stats.sync_remote_recv_packets;
|
||||
row["sync_remote_sent_packets"] = stats.sync_remote_sent_packets;
|
||||
row["packet_loss_in"] = (100.0 * (1.0 - static_cast<double>(stats.sync_recv_packets) /
|
||||
static_cast<double>(stats.sync_remote_sent_packets)));
|
||||
row["packet_loss_out"] = (100.0 * (1.0 - static_cast<double>(stats.sync_remote_recv_packets) /
|
||||
static_cast<double>(stats.sync_sent_packets)));
|
||||
row["resent_packets"] = stats.resent_packets;
|
||||
row["resent_fragments"] = stats.resent_fragments;
|
||||
row["resent_non_fragments"] = stats.resent_full;
|
||||
row["dropped_datarate_packets"] = stats.dropped_datarate_packets;
|
||||
|
||||
Json::Value sent_packet_types;
|
||||
|
||||
for (auto i = 0; i < _maxEmuOpcode; ++i) {
|
||||
auto count = eqs_stats.SentCount[i];
|
||||
if (count > 0) {
|
||||
sent_packet_types[OpcodeNames[i]] = count;
|
||||
}
|
||||
}
|
||||
|
||||
Json::Value receive_packet_types;
|
||||
|
||||
for (auto i = 0; i < _maxEmuOpcode; ++i) {
|
||||
auto count = eqs_stats.RecvCount[i];
|
||||
if (count > 0) {
|
||||
receive_packet_types[OpcodeNames[i]] = count;
|
||||
}
|
||||
}
|
||||
|
||||
row["sent_packet_types"] = sent_packet_types;
|
||||
row["receive_packet_types"] = receive_packet_types;
|
||||
|
||||
response.append(row);
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
Json::Value ApiGetOpcodeList(EQ::Net::WebsocketServerConnection *connection, Json::Value params)
|
||||
{
|
||||
if (zone->GetZoneID() == 0) {
|
||||
throw EQ::Net::WebsocketException("Zone must be loaded to invoke this call");
|
||||
}
|
||||
|
||||
Json::Value response;
|
||||
for (auto i = 0; i < _maxEmuOpcode; ++i) {
|
||||
Json::Value row = OpcodeNames[i];
|
||||
|
||||
response.append(row);
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
Json::Value ApiGetNpcListDetail(EQ::Net::WebsocketServerConnection *connection, Json::Value params)
|
||||
{
|
||||
if (zone->GetZoneID() == 0) {
|
||||
throw EQ::Net::WebsocketException("Zone must be loaded to invoke this call");
|
||||
}
|
||||
|
||||
Json::Value response;
|
||||
auto &list = entity_list.GetNPCList();
|
||||
|
||||
for (auto &iter : list) {
|
||||
auto npc = iter.second;
|
||||
Json::Value row;
|
||||
|
||||
/**
|
||||
* Main
|
||||
*/
|
||||
row["id"] = npc->GetID();
|
||||
row["clean_name"] = npc->GetCleanName();
|
||||
row["x"] = npc->GetX();
|
||||
row["y"] = npc->GetY();
|
||||
row["z"] = npc->GetZ();
|
||||
row["heading"] = npc->GetHeading();
|
||||
|
||||
/**
|
||||
* Rest
|
||||
*/
|
||||
row["accuracy_rating"] = npc->GetAccuracyRating();
|
||||
row["ai_has_spells"] = npc->AI_HasSpells();
|
||||
row["ai_has_spells_effects"] = npc->AI_HasSpellsEffects();
|
||||
row["ammo_id_file"] = npc->GetAmmoIDfile();
|
||||
row["attack_delay"] = npc->GetAttackDelay();
|
||||
row["attack_speed"] = npc->GetAttackSpeed();
|
||||
row["avoidance_rating"] = npc->GetAvoidanceRating();
|
||||
row["base_damage"] = npc->GetBaseDamage();
|
||||
row["combat_event"] = npc->GetCombatEvent();
|
||||
row["copper"] = npc->GetCopper();
|
||||
row["count_loot"] = npc->CountLoot();
|
||||
row["drops_global_loot"] = npc->DropsGlobalLoot();
|
||||
row["gold"] = npc->GetGold();
|
||||
row["grid"] = npc->GetGrid();
|
||||
row["has_private_corpse"] = npc->HasPrivateCorpse();
|
||||
row["is_animal"] = npc->IsAnimal();
|
||||
row["is_guarding"] = npc->IsGuarding();
|
||||
row["is_ldon_locked"] = npc->IsLDoNLocked();
|
||||
row["is_ldon_trap_detected"] = npc->IsLDoNTrapDetected();
|
||||
row["is_ldon_trapped"] = npc->IsLDoNTrapped();
|
||||
row["is_merchant_open"] = npc->IsMerchantOpen();
|
||||
row["is_not_targetable_with_hotkey"] = npc->IsNotTargetableWithHotkey();
|
||||
row["is_proximity_set"] = npc->IsProximitySet();
|
||||
row["is_taunting"] = npc->IsTaunting();
|
||||
row["ldon_locked_skill"] = npc->GetLDoNLockedSkill();
|
||||
row["ldon_trap_spell_id"] = npc->GetLDoNTrapSpellID();
|
||||
row["ldon_trap_type"] = npc->GetLDoNTrapType();
|
||||
row["loottable_id"] = npc->GetLoottableID();
|
||||
row["max_dmg"] = npc->GetMaxDMG();
|
||||
row["max_wp"] = npc->GetMaxWp();
|
||||
row["min_damage"] = npc->GetMinDamage();
|
||||
row["min_dmg"] = npc->GetMinDMG();
|
||||
row["npc_spells_effects_id"] = npc->GetNPCSpellsEffectsID();
|
||||
row["npc_spells_id"] = npc->GetNPCSpellsID();
|
||||
row["npchp_regen"] = npc->GetNPCHPRegen();
|
||||
row["num_merc_types"] = npc->GetNumMercTypes();
|
||||
row["num_mercs"] = npc->GetNumMercs();
|
||||
row["number_of_attacks"] = npc->GetNumberOfAttacks();
|
||||
row["pet_spell_id"] = npc->GetPetSpellID();
|
||||
row["platinum"] = npc->GetPlatinum();
|
||||
row["prim_skill"] = npc->GetPrimSkill();
|
||||
|
||||
if (npc->IsProximitySet()) {
|
||||
row["proximity_max_x"] = npc->GetProximityMaxX();
|
||||
row["proximity_max_y"] = npc->GetProximityMaxY();
|
||||
row["proximity_max_z"] = npc->GetProximityMaxZ();
|
||||
row["proximity_min_x"] = npc->GetProximityMinX();
|
||||
row["proximity_min_y"] = npc->GetProximityMinY();
|
||||
row["proximity_min_z"] = npc->GetProximityMinZ();
|
||||
}
|
||||
|
||||
row["ranged_skill"] = npc->GetRangedSkill();
|
||||
row["raw_ac"] = npc->GetRawAC();
|
||||
row["sec_skill"] = npc->GetSecSkill();
|
||||
row["silver"] = npc->GetSilver();
|
||||
row["slow_mitigation"] = npc->GetSlowMitigation();
|
||||
row["spawn_group_id"] = npc->GetSpawnGroupId();
|
||||
row["swarm_owner"] = npc->GetSwarmOwner();
|
||||
row["swarm_target"] = npc->GetSwarmTarget();
|
||||
row["waypoint_max"] = npc->GetWaypointMax();
|
||||
row["will_aggro_npcs"] = npc->WillAggroNPCs();
|
||||
|
||||
response.append(row);
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
Json::Value ApiGetDoorListDetail(EQ::Net::WebsocketServerConnection *connection, Json::Value params)
|
||||
{
|
||||
if (zone->GetZoneID() == 0) {
|
||||
throw EQ::Net::WebsocketException("Zone must be loaded to invoke this call");
|
||||
}
|
||||
|
||||
Json::Value response;
|
||||
auto &door_list = entity_list.GetDoorsList();
|
||||
|
||||
for (auto itr : door_list) {
|
||||
Doors *door = itr.second;
|
||||
|
||||
Json::Value row;
|
||||
|
||||
row["door_name"] = door->GetDoorName();
|
||||
row["client_version_mask"] = door->GetClientVersionMask();
|
||||
row["disable_timer"] = door->GetDisableTimer();
|
||||
row["door_db_id"] = door->GetDoorDBID();
|
||||
row["door_id"] = door->GetDoorID();
|
||||
row["door_param"] = door->GetDoorParam();
|
||||
row["entity_id"] = door->GetEntityID();
|
||||
row["guild_id"] = door->GetGuildID();
|
||||
row["incline"] = door->GetIncline();
|
||||
row["invert_state"] = door->GetInvertState();
|
||||
row["is_door"] = door->IsDoor();
|
||||
row["is_door_open"] = door->IsDoorOpen();
|
||||
row["is_ldon_door"] = door->IsLDoNDoor();
|
||||
row["key_item"] = door->GetKeyItem();
|
||||
row["lockpick"] = door->GetLockpick();
|
||||
row["no_keyring"] = door->GetNoKeyring();
|
||||
row["open_type"] = door->GetOpenType();
|
||||
row["size"] = door->GetSize();
|
||||
row["trigger_door_id"] = door->GetTriggerDoorID();
|
||||
row["trigger_type"] = door->GetTriggerType();
|
||||
row["x"] = door->GetX();
|
||||
row["y"] = door->GetY();
|
||||
row["z"] = door->GetZ();
|
||||
|
||||
response.append(row);
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
Json::Value ApiGetCorpseListDetail(EQ::Net::WebsocketServerConnection *connection, Json::Value params)
|
||||
{
|
||||
if (zone->GetZoneID() == 0) {
|
||||
throw EQ::Net::WebsocketException("Zone must be loaded to invoke this call");
|
||||
}
|
||||
|
||||
Json::Value response;
|
||||
auto &corpse_list = entity_list.GetCorpseList();
|
||||
|
||||
for (auto itr : corpse_list) {
|
||||
auto corpse = itr.second;
|
||||
|
||||
Json::Value row;
|
||||
|
||||
row["char_id"] = corpse->GetCharID();
|
||||
row["copper"] = corpse->GetCopper();
|
||||
row["corpse_dbid"] = corpse->GetCorpseDBID();
|
||||
row["count_items"] = corpse->CountItems();
|
||||
row["decay_time"] = corpse->GetDecayTime();
|
||||
row["gold"] = corpse->GetGold();
|
||||
row["is_become_npc_corpse"] = corpse->IsBecomeNPCCorpse();
|
||||
row["is_being_looted"] = corpse->IsBeingLooted();
|
||||
row["is_corpse"] = corpse->IsCorpse();
|
||||
row["is_locked"] = corpse->IsLocked();
|
||||
row["is_npc_corpse"] = corpse->IsNPCCorpse();
|
||||
row["is_player_corpse"] = corpse->IsPlayerCorpse();
|
||||
row["is_rezzed"] = corpse->IsRezzed();
|
||||
row["owner_name"] = corpse->GetOwnerName();
|
||||
row["platinum"] = corpse->GetPlatinum();
|
||||
row["player_kill_item"] = corpse->GetPlayerKillItem();
|
||||
row["rez_exp"] = corpse->GetRezExp();
|
||||
row["rez_time"] = corpse->GetRezTime();
|
||||
row["silver"] = corpse->GetSilver();
|
||||
|
||||
response.append(row);
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
Json::Value ApiGetObjectListDetail(EQ::Net::WebsocketServerConnection *connection, Json::Value params)
|
||||
{
|
||||
if (zone->GetZoneID() == 0) {
|
||||
throw EQ::Net::WebsocketException("Zone must be loaded to invoke this call");
|
||||
}
|
||||
|
||||
Json::Value response;
|
||||
auto &list = entity_list.GetObjectList();
|
||||
|
||||
for (auto &iter : list) {
|
||||
auto object = iter.second;
|
||||
|
||||
Json::Value row;
|
||||
|
||||
row["display_name"] = object->GetDisplayName();
|
||||
row["dbid"] = object->GetDBID();
|
||||
row["heading_data"] = object->GetHeadingData();
|
||||
row["icon"] = object->GetIcon();
|
||||
row["is_ground_spawn"] = object->IsGroundSpawn();
|
||||
row["item_id"] = object->GetItemID();
|
||||
row["model_name"] = object->GetModelName();
|
||||
row["size"] = object->GetSize();
|
||||
row["solid_type"] = object->GetSolidType();
|
||||
row["tilt_x"] = object->GetTiltX();
|
||||
row["tilt_y"] = object->GetTiltY();
|
||||
row["type"] = object->GetType();
|
||||
row["x"] = object->GetX();
|
||||
row["y"] = object->GetY();
|
||||
row["z"] = object->GetZ();
|
||||
|
||||
response.append(row);
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
Json::Value ApiGetMobListDetail(EQ::Net::WebsocketServerConnection *connection, Json::Value params)
|
||||
{
|
||||
if (zone->GetZoneID() == 0) {
|
||||
throw EQ::Net::WebsocketException("Zone must be loaded to invoke this call");
|
||||
}
|
||||
|
||||
Json::Value response;
|
||||
auto &list = entity_list.GetMobList();
|
||||
|
||||
for (auto &iter : list) {
|
||||
auto mob = iter.second;
|
||||
|
||||
Json::Value row;
|
||||
|
||||
/**
|
||||
* Main
|
||||
*/
|
||||
row["id"] = mob->GetID();
|
||||
row["clean_name"] = mob->GetCleanName();
|
||||
row["x"] = mob->GetX();
|
||||
row["y"] = mob->GetY();
|
||||
row["z"] = mob->GetZ();
|
||||
row["heading"] = mob->GetHeading();
|
||||
|
||||
/**
|
||||
* Rest
|
||||
*/
|
||||
row["ac"] = mob->GetAC();
|
||||
row["ac_softcap"] = mob->GetACSoftcap();
|
||||
row["ac_sum"] = mob->ACSum();
|
||||
row["active_light_type"] = mob->GetActiveLightType();
|
||||
row["aggro_range"] = mob->GetAggroRange();
|
||||
row["allow_beneficial"] = mob->GetAllowBeneficial();
|
||||
row["animation"] = mob->GetAnimation();
|
||||
row["assist_range"] = mob->GetAssistRange();
|
||||
row["aura_slots"] = mob->GetAuraSlots();
|
||||
row["base_fear_speed"] = mob->GetBaseFearSpeed();
|
||||
row["base_runspeed"] = mob->GetBaseRunspeed();
|
||||
row["base_size"] = mob->GetBaseSize();
|
||||
row["base_walkspeed"] = mob->GetBaseWalkspeed();
|
||||
row["beard"] = mob->GetBeard();
|
||||
row["beard_color"] = mob->GetBeardColor();
|
||||
row["best_melee_skill"] = mob->GetBestMeleeSkill();
|
||||
row["calc_fear_resist_chance"] = mob->CalcFearResistChance();
|
||||
row["calc_resist_chance_bonus"] = mob->CalcResistChanceBonus();
|
||||
row["can_block_spell"] = mob->CanBlockSpell();
|
||||
row["can_facestab"] = mob->CanFacestab();
|
||||
row["casted_spell_inv_slot"] = mob->GetCastedSpellInvSlot();
|
||||
row["casting_spell_id"] = mob->CastingSpellID();
|
||||
row["charmed"] = mob->Charmed();
|
||||
row["check_last_los_state"] = mob->CheckLastLosState();
|
||||
row["class"] = mob->GetClass();
|
||||
row["class_level_factor"] = mob->GetClassLevelFactor();
|
||||
row["class_race_ac_bonus"] = mob->GetClassRaceACBonus();
|
||||
row["compute_defense"] = mob->compute_defense();
|
||||
row["count_dispellable_buffs"] = mob->CountDispellableBuffs();
|
||||
row["cripp_blow_chance"] = mob->GetCrippBlowChance();
|
||||
row["cur_wp"] = mob->GetCurWp();
|
||||
row["cwp"] = mob->GetCWP();
|
||||
row["cwpp"] = mob->GetCWPP();
|
||||
row["divine_aura"] = mob->DivineAura();
|
||||
row["do_casting_checks"] = mob->DoCastingChecks();
|
||||
row["dont_buff_me_before"] = mob->DontBuffMeBefore();
|
||||
row["dont_cure_me_before"] = mob->DontCureMeBefore();
|
||||
row["dont_dot_me_before"] = mob->DontDotMeBefore();
|
||||
row["dont_heal_me_before"] = mob->DontHealMeBefore();
|
||||
row["dont_root_me_before"] = mob->DontRootMeBefore();
|
||||
row["dont_snare_me_before"] = mob->DontSnareMeBefore();
|
||||
row["drakkin_details"] = mob->GetDrakkinDetails();
|
||||
row["drakkin_heritage"] = mob->GetDrakkinHeritage();
|
||||
row["drakkin_tattoo"] = mob->GetDrakkinTattoo();
|
||||
row["emote_id"] = mob->GetEmoteID();
|
||||
row["equipment_light_type"] = mob->GetEquipmentLightType();
|
||||
row["eye_color1"] = mob->GetEyeColor1();
|
||||
row["eye_color2"] = mob->GetEyeColor2();
|
||||
row["fear_speed"] = mob->GetFearSpeed();
|
||||
row["flurry_chance"] = mob->GetFlurryChance();
|
||||
row["follow_can_run"] = mob->GetFollowCanRun();
|
||||
row["follow_distance"] = mob->GetFollowDistance();
|
||||
row["follow_id"] = mob->GetFollowID();
|
||||
row["gender"] = mob->GetGender();
|
||||
row["hair_color"] = mob->GetHairColor();
|
||||
row["hair_style"] = mob->GetHairStyle();
|
||||
row["has_active_song"] = mob->HasActiveSong();
|
||||
row["has_assist_aggro"] = mob->HasAssistAggro();
|
||||
row["has_died"] = mob->HasDied();
|
||||
row["has_disc_buff"] = mob->HasDiscBuff();
|
||||
row["has_endur_upkeep"] = mob->HasEndurUpkeep();
|
||||
row["has_free_aura_slots"] = mob->HasFreeAuraSlots();
|
||||
row["has_free_trap_slots"] = mob->HasFreeTrapSlots();
|
||||
row["has_mgb"] = mob->HasMGB();
|
||||
row["has_numhits"] = mob->HasNumhits();
|
||||
row["has_pet"] = mob->HasPet();
|
||||
row["has_pet_affinity"] = mob->HasPetAffinity();
|
||||
row["has_primary_aggro"] = mob->HasPrimaryAggro();
|
||||
row["has_project_illusion"] = mob->HasProjectIllusion();
|
||||
row["has_projectile_attack"] = mob->HasProjectileAttack();
|
||||
row["has_shield_equiped"] = mob->HasShieldEquiped();
|
||||
row["has_special_abilities"] = mob->HasSpecialAbilities();
|
||||
row["has_tar_reflection"] = mob->HasTargetReflection();
|
||||
row["has_temp_pets_active"] = mob->HasTempPetsActive();
|
||||
row["has_two_hand_blunt_equiped"] = mob->HasTwoHandBluntEquiped();
|
||||
row["has_two_hander_equipped"] = mob->HasTwoHanderEquipped();
|
||||
row["has_virus"] = mob->HasVirus();
|
||||
row["hate_summon"] = mob->HateSummon();
|
||||
row["helm_texture"] = mob->GetHelmTexture();
|
||||
row["hp"] = mob->GetHP();
|
||||
row["improved_taunt"] = mob->ImprovedTaunt();
|
||||
row["innate_light_type"] = mob->GetInnateLightType();
|
||||
row["is_ai_controlled"] = mob->IsAIControlled();
|
||||
row["is_amnesiad"] = mob->IsAmnesiad();
|
||||
row["is_animation"] = mob->IsAnimation();
|
||||
row["is_blind"] = mob->IsBlind();
|
||||
row["is_casting"] = mob->IsCasting();
|
||||
row["is_charmed"] = mob->IsCharmed();
|
||||
row["is_destructible_object"] = mob->IsDestructibleObject();
|
||||
row["is_engaged"] = mob->IsEngaged();
|
||||
row["is_enraged"] = mob->IsEnraged();
|
||||
row["is_familiar"] = mob->IsFamiliar();
|
||||
row["is_feared"] = mob->IsFeared();
|
||||
row["is_findable"] = mob->IsFindable();
|
||||
row["is_focused"] = mob->IsFocused();
|
||||
row["is_g_held"] = mob->IsGHeld();
|
||||
row["is_grouped"] = mob->IsGrouped();
|
||||
row["is_held"] = mob->IsHeld();
|
||||
row["is_looting"] = mob->IsLooting();
|
||||
row["is_melee_disabled"] = mob->IsMeleeDisabled();
|
||||
row["is_mezzed"] = mob->IsMezzed();
|
||||
row["is_moved"] = mob->IsMoved();
|
||||
row["is_moving"] = mob->IsMoving();
|
||||
row["is_no_cast"] = mob->IsNoCast();
|
||||
row["is_off_hand_atk"] = mob->IsOffHandAtk();
|
||||
row["is_pet_owner_client"] = mob->IsPetOwnerClient();
|
||||
row["is_pet_regroup"] = mob->IsPetRegroup();
|
||||
row["is_pet_stop"] = mob->IsPetStop();
|
||||
row["is_pseudo_rooted"] = mob->IsPseudoRooted();
|
||||
row["is_raid_grouped"] = mob->IsRaidGrouped();
|
||||
row["is_rare_spawn"] = mob->IsRareSpawn();
|
||||
row["is_roamer"] = mob->IsRoamer();
|
||||
row["is_rooted"] = mob->IsRooted();
|
||||
row["is_running"] = mob->IsRunning();
|
||||
row["is_silenced"] = mob->IsSilenced();
|
||||
row["is_stunned"] = mob->IsStunned();
|
||||
row["is_tar_lock_pet"] = mob->IsTargetLockPet();
|
||||
row["is_tarable"] = mob->IsTargetable();
|
||||
row["is_tared"] = mob->IsTargeted();
|
||||
row["is_temp_pet"] = mob->IsTempPet();
|
||||
row["is_trackable"] = mob->IsTrackable();
|
||||
row["item_hp_bonuses"] = mob->GetItemHPBonuses();
|
||||
row["last_name"] = mob->GetLastName();
|
||||
row["level"] = mob->GetLevel();
|
||||
row["luclin_face"] = mob->GetLuclinFace();
|
||||
row["mana"] = mob->GetMana();
|
||||
row["mana_percent"] = mob->GetManaPercent();
|
||||
row["mana_ratio"] = mob->GetManaRatio();
|
||||
row["max_hp"] = mob->GetMaxHP();
|
||||
row["max_mana"] = mob->GetMaxMana();
|
||||
row["melee_mitigation"] = mob->GetMeleeMitigation();
|
||||
row["mitigation_ac"] = mob->GetMitigationAC();
|
||||
row["movespeed"] = mob->GetMovespeed();
|
||||
row["name"] = mob->GetName();
|
||||
row["next_hp_event"] = mob->GetNextHPEvent();
|
||||
row["next_inc_hp_event"] = mob->GetNextIncHPEvent();
|
||||
row["npc_assist_cap"] = mob->NPCAssistCap();
|
||||
row["npc_type_id"] = mob->GetNPCTypeID();
|
||||
row["orig_level"] = mob->GetOrigLevel();
|
||||
row["orig_name"] = mob->GetOrigName();
|
||||
row["owner_id"] = mob->GetOwnerID();
|
||||
row["pet_id"] = mob->GetPetID();
|
||||
row["pet_power"] = mob->GetPetPower();
|
||||
row["pet_tar_lock_id"] = mob->GetPetTargetLockID();
|
||||
row["qglobal"] = mob->GetQglobal();
|
||||
row["race"] = mob->GetRace();
|
||||
row["run_anim_speed"] = mob->GetRunAnimSpeed();
|
||||
row["sanctuary"] = mob->Sanctuary();
|
||||
row["see_hide"] = mob->SeeHide();
|
||||
row["see_improved_hide"] = mob->SeeImprovedHide();
|
||||
row["see_invisible"] = mob->SeeInvisible();
|
||||
row["see_invisible_undead"] = mob->SeeInvisibleUndead();
|
||||
row["size"] = mob->GetSize();
|
||||
row["slow_mitigation"] = mob->GetSlowMitigation();
|
||||
row["snared_amount"] = mob->GetSnaredAmount();
|
||||
row["spawned"] = mob->Spawned();
|
||||
row["spell_hp_bonuses"] = mob->GetSpellHPBonuses();
|
||||
row["spell_light_type"] = mob->GetSpellLightType();
|
||||
row["spell_power_distance_mod"] = mob->GetSpellPowerDistanceMod();
|
||||
row["spell_x"] = mob->GetSpellX();
|
||||
row["spell_y"] = mob->GetSpellY();
|
||||
row["spell_z"] = mob->GetSpellZ();
|
||||
row["tar_ring_x"] = mob->GetTargetRingX();
|
||||
row["tar_ring_y"] = mob->GetTargetRingY();
|
||||
row["tar_ring_z"] = mob->GetTargetRingZ();
|
||||
row["temp_pet_count"] = mob->GetTempPetCount();
|
||||
row["texture"] = mob->GetTexture();
|
||||
row["trap_slots"] = mob->GetTrapSlots();
|
||||
row["try_death_save"] = mob->TryDeathSave();
|
||||
row["try_divine_save"] = mob->TryDivineSave();
|
||||
row["try_spell_on_death"] = mob->TrySpellOnDeath();
|
||||
row["update_active_light"] = mob->UpdateActiveLight();
|
||||
row["wander_type"] = mob->GetWanderType();
|
||||
|
||||
response.append(row);
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
Json::Value ApiGetClientListDetail(EQ::Net::WebsocketServerConnection *connection, Json::Value params)
|
||||
{
|
||||
if (zone->GetZoneID() == 0) {
|
||||
throw EQ::Net::WebsocketException("Zone must be loaded to invoke this call");
|
||||
}
|
||||
|
||||
Json::Value response;
|
||||
auto &list = entity_list.GetClientList();
|
||||
|
||||
for (auto &iter : list) {
|
||||
auto client = iter.second;
|
||||
|
||||
Json::Value row;
|
||||
|
||||
/**
|
||||
* Main
|
||||
*/
|
||||
row["id"] = client->GetID();
|
||||
row["clean_name"] = client->GetCleanName();
|
||||
row["x"] = client->GetX();
|
||||
row["y"] = client->GetY();
|
||||
row["z"] = client->GetZ();
|
||||
row["heading"] = client->GetHeading();
|
||||
|
||||
/**
|
||||
* Rest
|
||||
*/
|
||||
row["aa_percent"] = client->GetAAPercent();
|
||||
row["aa_points"] = client->GetAAPoints();
|
||||
row["aaxp"] = client->GetAAXP();
|
||||
row["account_age"] = client->GetAccountAge();
|
||||
row["account_creation"] = client->GetAccountCreation();
|
||||
row["account_id"] = client->AccountID();
|
||||
row["account_name"] = client->AccountName();
|
||||
row["act_agi"] = client->GetActAGI();
|
||||
row["act_cha"] = client->GetActCHA();
|
||||
row["act_dex"] = client->GetActDEX();
|
||||
row["act_int"] = client->GetActINT();
|
||||
row["act_sta"] = client->GetActSTA();
|
||||
row["act_str"] = client->GetActSTR();
|
||||
row["act_wis"] = client->GetActWIS();
|
||||
row["active_task_count"] = client->GetActiveTaskCount();
|
||||
row["admin"] = client->Admin();
|
||||
row["aggro_count"] = client->GetAggroCount();
|
||||
row["aggro_meter_available"] = client->AggroMeterAvailable();
|
||||
row["all_money"] = client->GetAllMoney();
|
||||
row["anon"] = client->GetAnon();
|
||||
row["atk_rating"] = client->GetATKRating();
|
||||
row["auto_attack_enabled"] = client->AutoAttackEnabled();
|
||||
row["auto_fire_enabled"] = client->AutoFireEnabled();
|
||||
row["auto_split_enabled"] = client->AutoSplitEnabled();
|
||||
row["base_agi"] = client->GetBaseAGI();
|
||||
row["base_beard"] = client->GetBaseBeard();
|
||||
row["base_beard_color"] = client->GetBaseBeardColor();
|
||||
row["base_cha"] = client->GetBaseCHA();
|
||||
row["base_class"] = client->GetBaseClass();
|
||||
row["base_corrup"] = client->GetBaseCorrup();
|
||||
row["base_details"] = client->GetBaseDetails();
|
||||
row["base_dex"] = client->GetBaseDEX();
|
||||
row["base_eye_color"] = client->GetBaseEyeColor();
|
||||
row["base_face"] = client->GetBaseFace();
|
||||
row["base_gender"] = client->GetBaseGender();
|
||||
row["base_hair_color"] = client->GetBaseHairColor();
|
||||
row["base_hair_style"] = client->GetBaseHairStyle();
|
||||
row["base_heritage"] = client->GetBaseHeritage();
|
||||
row["base_hp"] = client->GetBaseHP();
|
||||
row["base_int"] = client->GetBaseINT();
|
||||
row["base_ph_r"] = client->GetBasePhR();
|
||||
row["base_race"] = client->GetBaseRace();
|
||||
row["base_sta"] = client->GetBaseSTA();
|
||||
row["base_str"] = client->GetBaseSTR();
|
||||
row["base_tattoo"] = client->GetBaseTattoo();
|
||||
row["base_wis"] = client->GetBaseWIS();
|
||||
row["become_npc_level"] = client->GetBecomeNPCLevel();
|
||||
row["boat_id"] = client->GetBoatID();
|
||||
row["buyer_welcome_message"] = client->GetBuyerWelcomeMessage();
|
||||
row["calc_atk"] = client->CalcATK();
|
||||
row["calc_base_mana"] = client->CalcBaseMana();
|
||||
row["calc_current_weight"] = client->CalcCurrentWeight();
|
||||
row["calc_endurance_regen_cap"] = client->CalcEnduranceRegenCap();
|
||||
row["calc_hp_regen_cap"] = client->CalcHPRegenCap();
|
||||
row["calc_mana_regen_cap"] = client->CalcManaRegenCap();
|
||||
row["calc_max_mana"] = client->CalcMaxMana();
|
||||
row["can_fast_regen"] = client->CanFastRegen();
|
||||
row["can_fish"] = client->CanFish();
|
||||
row["can_med_on_horse"] = client->CanMedOnHorse();
|
||||
row["carried_money"] = client->GetCarriedMoney();
|
||||
row["char_max_level_from_bucket"] = client->GetCharMaxLevelFromBucket();
|
||||
row["char_max_level_from_q_global"] = client->GetCharMaxLevelFromQGlobal();
|
||||
row["character_id"] = client->CharacterID();
|
||||
row["check_can_unsuspend_merc"] = client->CheckCanUnsuspendMerc();
|
||||
row["check_double_attack"] = client->CheckDoubleAttack();
|
||||
row["check_double_ranged_attack"] = client->CheckDoubleRangedAttack();
|
||||
row["check_dual_wield"] = client->CheckDualWield();
|
||||
row["check_trade_non_droppable"] = client->CheckTradeNonDroppable();
|
||||
row["check_triple_attack"] = client->CheckTripleAttack();
|
||||
row["client_max_level"] = client->GetClientMaxLevel();
|
||||
row["client_version_bit"] = client->ClientVersionBit();
|
||||
row["connected"] = client->Connected();
|
||||
row["copper"] = client->GetCopper();
|
||||
row["corpse_count"] = client->GetCorpseCount();
|
||||
row["duel_tar"] = client->GetDuelTarget();
|
||||
row["ebon_crystals"] = client->GetEbonCrystals();
|
||||
row["endurance"] = client->GetEndurance();
|
||||
row["endurance_percent"] = client->GetEndurancePercent();
|
||||
row["exp"] = client->GetEXP();
|
||||
row["face"] = client->GetFace();
|
||||
row["feigned"] = client->GetFeigned();
|
||||
row["gm"] = client->GetGM();
|
||||
row["gm_speed"] = client->GetGMSpeed();
|
||||
row["gold"] = client->GetGold();
|
||||
row["group_exp"] = client->GetGroupEXP();
|
||||
row["group_leadership_aa_health_enhancement"] = client->GroupLeadershipAAHealthEnhancement();
|
||||
row["group_leadership_aa_health_regeneration"] = client->GroupLeadershipAAHealthRegeneration();
|
||||
row["group_leadership_aa_mana_enhancement"] = client->GroupLeadershipAAManaEnhancement();
|
||||
row["group_leadership_aa_offense_enhancement"] = client->GroupLeadershipAAOffenseEnhancement();
|
||||
row["group_points"] = client->GetGroupPoints();
|
||||
row["guild_id"] = client->GuildID();
|
||||
row["guild_rank"] = client->GuildRank();
|
||||
row["has_adventure_data"] = client->HasAdventureData();
|
||||
row["hide_me"] = client->GetHideMe();
|
||||
row["horse_id"] = client->GetHorseId();
|
||||
row["hunger"] = client->GetHunger();
|
||||
row["hungry"] = client->Hungry();
|
||||
row["in_zone"] = client->InZone();
|
||||
row["instance_id"] = client->GetInstanceID();
|
||||
row["interrogate_inv_state"] = client->GetInterrogateInvState();
|
||||
row["ip"] = client->GetIP();
|
||||
row["is_become_npc"] = client->IsBecomeNPC();
|
||||
row["is_buyer"] = client->IsBuyer();
|
||||
row["is_dead"] = client->IsDead();
|
||||
row["is_dragging_corpse"] = client->IsDraggingCorpse();
|
||||
row["is_dueling"] = client->IsDueling();
|
||||
row["is_guild_banker"] = client->IsGuildBanker();
|
||||
row["is_hovering_for_respawn"] = client->IsHoveringForRespawn();
|
||||
row["is_in_a_guild"] = client->IsInAGuild();
|
||||
row["is_ld"] = client->IsLD();
|
||||
row["is_leadership_exp_on"] = client->IsLeadershipEXPOn();
|
||||
row["is_lfp"] = client->IsLFP();
|
||||
row["is_medding"] = client->IsMedding();
|
||||
row["is_on_adventure"] = client->IsOnAdventure();
|
||||
row["is_rezz_pending"] = client->IsRezzPending();
|
||||
row["is_sitting"] = client->IsSitting();
|
||||
row["is_starved"] = client->IsStarved();
|
||||
row["is_tracking"] = client->IsTracking();
|
||||
row["is_trader"] = client->IsTrader();
|
||||
row["is_unconscious"] = client->IsUnconscious();
|
||||
row["ldon_losses"] = client->GetLDoNLosses();
|
||||
row["ldon_wins"] = client->GetLDoNWins();
|
||||
row["last_inv_snapshot_time"] = client->GetLastInvSnapshotTime();
|
||||
row["last_name"] = client->GetLastName();
|
||||
row["level2"] = client->GetLevel2();
|
||||
row["level_regen"] = client->LevelRegen();
|
||||
row["ls_account_id"] = client->LSAccountID();
|
||||
row["max_endurance"] = client->GetMaxEndurance();
|
||||
row["max_x_tars"] = client->GetMaxXTargets();
|
||||
row["merc_id"] = client->GetMercID();
|
||||
row["merc_only_or_no_group"] = client->MercOnlyOrNoGroup();
|
||||
row["merc_slot"] = client->GetMercSlot();
|
||||
row["next_inv_snapshot_time"] = client->GetNextInvSnapshotTime();
|
||||
row["num_mercs"] = client->GetNumMercs();
|
||||
row["pending_adventure_create"] = client->GetPendingAdventureCreate();
|
||||
row["pending_adventure_door_click"] = client->GetPendingAdventureDoorClick();
|
||||
row["pending_adventure_leave"] = client->GetPendingAdventureLeave();
|
||||
row["pending_adventure_request"] = client->GetPendingAdventureRequest();
|
||||
row["pending_guild_invitation"] = client->GetPendingGuildInvitation();
|
||||
row["platinum"] = client->GetPlatinum();
|
||||
row["port"] = client->GetPort();
|
||||
row["primary_skill_value"] = client->GetPrimarySkillValue();
|
||||
row["proximity_x"] = client->ProximityX();
|
||||
row["proximity_y"] = client->ProximityY();
|
||||
row["proximity_z"] = client->ProximityZ();
|
||||
row["pvp_points"] = client->GetPVPPoints();
|
||||
row["radiant_crystals"] = client->GetRadiantCrystals();
|
||||
row["raid_exp"] = client->GetRaidEXP();
|
||||
row["raid_points"] = client->GetRaidPoints();
|
||||
row["raw_item_ac"] = client->GetRawItemAC();
|
||||
row["required_aa_experience"] = client->GetRequiredAAExperience();
|
||||
row["revoked"] = client->GetRevoked();
|
||||
row["run_mode"] = client->GetRunMode();
|
||||
row["save_currency"] = client->SaveCurrency();
|
||||
row["save_task_state"] = client->SaveTaskState();
|
||||
row["silver"] = client->GetSilver();
|
||||
row["skill_points"] = client->GetSkillPoints();
|
||||
row["spent_aa"] = client->GetSpentAA();
|
||||
row["tgb"] = client->TGB();
|
||||
row["thirst"] = client->GetThirst();
|
||||
row["thirsty"] = client->Thirsty();
|
||||
row["total_atk"] = client->GetTotalATK();
|
||||
row["total_seconds_played"] = client->GetTotalSecondsPlayed();
|
||||
row["weight"] = client->GetWeight();
|
||||
row["wid"] = client->GetWID();
|
||||
row["x_tarting_available"] = client->XTargettingAvailable();
|
||||
|
||||
response.append(row);
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
Json::Value ApiGetZoneAttributes(EQ::Net::WebsocketServerConnection *connection, Json::Value params)
|
||||
{
|
||||
if (zone->GetZoneID() == 0) {
|
||||
throw EQ::Net::WebsocketException("Zone must be loaded to invoke this call");
|
||||
}
|
||||
|
||||
Json::Value response;
|
||||
Json::Value row;
|
||||
|
||||
row["aggro_limit_reached"] = zone->AggroLimitReached();
|
||||
row["allow_mercs"] = zone->AllowMercs();
|
||||
row["buff_timers_suspended"] = zone->BuffTimersSuspended();
|
||||
row["can_bind"] = zone->CanBind();
|
||||
row["can_cast_outdoor"] = zone->CanCastOutdoor();
|
||||
row["can_do_combat"] = zone->CanDoCombat();
|
||||
row["can_levitate"] = zone->CanLevitate();
|
||||
row["count_auth"] = zone->CountAuth();
|
||||
row["count_spawn2"] = zone->CountSpawn2();
|
||||
row["file_name"] = zone->GetFileName();
|
||||
row["graveyard_id"] = zone->graveyard_id();
|
||||
row["graveyard_zoneid"] = zone->graveyard_zoneid();
|
||||
row["has_graveyard"] = zone->HasGraveyard();
|
||||
row["has_map"] = zone->HasMap();
|
||||
row["has_water_map"] = zone->HasWaterMap();
|
||||
row["has_weather"] = zone->HasWeather();
|
||||
row["instance_id"] = zone->GetInstanceID();
|
||||
row["instance_version"] = zone->GetInstanceVersion();
|
||||
row["instant_grids"] = zone->InstantGrids();
|
||||
row["is_city"] = zone->IsCity();
|
||||
row["is_hotzone"] = zone->IsHotzone();
|
||||
row["is_instance_persistent"] = zone->IsInstancePersistent();
|
||||
row["is_pvp_zone"] = zone->IsPVPZone();
|
||||
row["is_static_zone"] = zone->IsStaticZone();
|
||||
row["is_ucs_server_available"] = zone->IsUCSServerAvailable();
|
||||
row["long_name"] = zone->GetLongName();
|
||||
row["max_clients"] = zone->GetMaxClients();
|
||||
row["mobs_aggro_count"] = zone->MobsAggroCount();
|
||||
row["save_zone_cfg"] = zone->SaveZoneCFG();
|
||||
row["short_name"] = zone->GetShortName();
|
||||
row["total_blocked_spells"] = zone->GetZoneTotalBlockedSpells();
|
||||
row["zone_id"] = zone->GetZoneID();
|
||||
row["zone_type"] = zone->GetZoneType();
|
||||
|
||||
response.append(row);
|
||||
return response;
|
||||
}
|
||||
|
||||
Json::Value ApiGetLogsysCategories(EQ::Net::WebsocketServerConnection *connection, Json::Value params)
|
||||
{
|
||||
if (zone->GetZoneID() == 0) {
|
||||
throw EQ::Net::WebsocketException("Zone must be loaded to invoke this call");
|
||||
}
|
||||
|
||||
Json::Value response;
|
||||
|
||||
for (int i = 1; i < Logs::LogCategory::MaxCategoryID; i++) {
|
||||
Json::Value row;
|
||||
|
||||
row["log_category_id"] = i;
|
||||
row["log_category_description"] = Logs::LogCategoryName[i];
|
||||
row["log_to_console"] = LogSys.log_settings[i].log_to_console;
|
||||
row["log_to_file"] = LogSys.log_settings[i].log_to_file;
|
||||
row["log_to_gmsay"] = LogSys.log_settings[i].log_to_gmsay;
|
||||
|
||||
response.append(row);
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
Json::Value ApiSetLoggingLevel(EQ::Net::WebsocketServerConnection *connection, Json::Value params)
|
||||
{
|
||||
if (zone->GetZoneID() == 0) {
|
||||
throw EQ::Net::WebsocketException("Zone must be loaded to invoke this call");
|
||||
}
|
||||
|
||||
Json::Value response;
|
||||
|
||||
auto logging_category = params[0].asInt();
|
||||
auto logging_level = params[1].asInt();
|
||||
|
||||
response["status"] = "Category doesn't exist";
|
||||
|
||||
LogInfo("Logging category is [{}] and level is [{}]",
|
||||
logging_category,
|
||||
logging_level
|
||||
);
|
||||
|
||||
if (logging_category < Logs::LogCategory::MaxCategoryID &&
|
||||
logging_category > Logs::LogCategory::None
|
||||
) {
|
||||
LogSys.log_settings[logging_category].log_to_console = logging_level;
|
||||
response["status"] = "Category log level updated";
|
||||
}
|
||||
|
||||
if (logging_level > 0) {
|
||||
LogSys.log_settings[logging_category].is_category_enabled = 1;
|
||||
}
|
||||
else {
|
||||
LogSys.log_settings[logging_category].is_category_enabled = 0;
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
void RegisterApiLogEvent(std::unique_ptr<EQ::Net::WebsocketServer> &server)
|
||||
{
|
||||
LogSys.SetConsoleHandler(
|
||||
[&](uint16 debug_level, uint16 log_category, const std::string &msg) {
|
||||
Json::Value data;
|
||||
data["debug_level"] = debug_level;
|
||||
data["log_category"] = log_category;
|
||||
data["msg"] = msg;
|
||||
server->DispatchEvent(EQ::Net::SubscriptionEventLog, data, 50);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
void RegisterApiService(std::unique_ptr<EQ::Net::WebsocketServer> &server)
|
||||
{
|
||||
server->SetLoginHandler(CheckLogin);
|
||||
server->SetMethodHandler("get_packet_statistics", &ApiGetPacketStatistics, 50);
|
||||
server->SetMethodHandler("get_opcode_list", &ApiGetOpcodeList, 50);
|
||||
server->SetMethodHandler("get_npc_list_detail", &ApiGetNpcListDetail, 50);
|
||||
server->SetMethodHandler("get_door_list_detail", &ApiGetDoorListDetail, 50);
|
||||
server->SetMethodHandler("get_corpse_list_detail", &ApiGetCorpseListDetail, 50);
|
||||
server->SetMethodHandler("get_object_list_detail", &ApiGetObjectListDetail, 50);
|
||||
server->SetMethodHandler("get_mob_list_detail", &ApiGetMobListDetail, 50);
|
||||
server->SetMethodHandler("get_client_list_detail", &ApiGetClientListDetail, 50);
|
||||
server->SetMethodHandler("get_zone_attributes", &ApiGetZoneAttributes, 50);
|
||||
server->SetMethodHandler("get_logsys_categories", &ApiGetLogsysCategories, 50);
|
||||
server->SetMethodHandler("set_logging_level", &ApiSetLoggingLevel, 50);
|
||||
|
||||
RegisterApiLogEvent(server);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* EQEmulator: Everquest Server Emulator
|
||||
* Copyright (C) 2001-2019 EQEmulator Development Team (https://github.com/EQEmu/Server)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
* are required to give you total support for your newly bought product;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include "../common/net/websocket_server.h"
|
||||
|
||||
void RegisterApiService(std::unique_ptr<EQ::Net::WebsocketServer> &server);
|
||||
+136
-160
@@ -34,6 +34,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#include "lua_parser.h"
|
||||
#include "fastmath.h"
|
||||
#include "mob.h"
|
||||
#include "npc.h"
|
||||
|
||||
|
||||
#include <assert.h>
|
||||
@@ -391,7 +392,7 @@ bool Mob::AvoidDamage(Mob *other, DamageHitInfo &hit)
|
||||
if (hit.hand != EQEmu::invslot::slotRange && (CanThisClassRiposte() || IsEnraged()) && InFront && !ImmuneRipo) {
|
||||
if (IsEnraged()) {
|
||||
hit.damage_done = DMG_RIPOSTED;
|
||||
Log(Logs::Detail, Logs::Combat, "I am enraged, riposting frontal attack.");
|
||||
LogCombat("I am enraged, riposting frontal attack");
|
||||
return true;
|
||||
}
|
||||
if (IsClient())
|
||||
@@ -848,10 +849,10 @@ int Mob::ACSum()
|
||||
auto over_cap = ac - softcap;
|
||||
ac = softcap + (over_cap * returns);
|
||||
}
|
||||
Log(Logs::Detail, Logs::Combat, "ACSum ac %d softcap %d returns %f", ac, softcap, returns);
|
||||
LogCombat("ACSum ac [{}] softcap [{}] returns [{}]", ac, softcap, returns);
|
||||
}
|
||||
else {
|
||||
Log(Logs::Detail, Logs::Combat, "ACSum ac %d", ac);
|
||||
LogCombat("ACSum ac [{}]", ac);
|
||||
}
|
||||
return ac;
|
||||
}
|
||||
@@ -1311,14 +1312,14 @@ void Mob::DoAttack(Mob *other, DamageHitInfo &hit, ExtraAttackOptions *opts)
|
||||
{
|
||||
if (!other)
|
||||
return;
|
||||
Log(Logs::Detail, Logs::Combat, "%s::DoAttack vs %s base %d min %d offense %d tohit %d skill %d", GetName(),
|
||||
LogCombat("[{}]::DoAttack vs [{}] base [{}] min [{}] offense [{}] tohit [{}] skill [{}]", GetName(),
|
||||
other->GetName(), hit.base_damage, hit.min_damage, hit.offense, hit.tohit, hit.skill);
|
||||
|
||||
// check to see if we hit..
|
||||
if (other->AvoidDamage(this, hit)) {
|
||||
int strike_through = itembonuses.StrikeThrough + spellbonuses.StrikeThrough + aabonuses.StrikeThrough;
|
||||
if (strike_through && zone->random.Roll(strike_through)) {
|
||||
Message_StringID(MT_StrikeThrough,
|
||||
MessageString(Chat::StrikeThrough,
|
||||
STRIKETHROUGH_STRING); // You strike through your opponents defenses!
|
||||
hit.damage_done = 1; // set to one, we will check this to continue
|
||||
}
|
||||
@@ -1328,7 +1329,7 @@ void Mob::DoAttack(Mob *other, DamageHitInfo &hit, ExtraAttackOptions *opts)
|
||||
//if (IsDead())
|
||||
return;
|
||||
}
|
||||
Log(Logs::Detail, Logs::Combat, "Avoided/strikethrough damage with code %d", hit.damage_done);
|
||||
LogCombat("Avoided/strikethrough damage with code [{}]", hit.damage_done);
|
||||
}
|
||||
|
||||
if (hit.damage_done >= 0) {
|
||||
@@ -1339,9 +1340,9 @@ void Mob::DoAttack(Mob *other, DamageHitInfo &hit, ExtraAttackOptions *opts)
|
||||
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);
|
||||
other->MessageString(Chat::Stun, AVOID_STUNNING_BLOW);
|
||||
} else if (zone->random.Roll(stun_resist)) {
|
||||
other->Message_StringID(MT_Stun, SHAKE_OFF_STUN);
|
||||
other->MessageString(Chat::Stun, SHAKE_OFF_STUN);
|
||||
} else {
|
||||
other->Stun(3000); // yuck -- 3 seconds
|
||||
}
|
||||
@@ -1352,10 +1353,10 @@ void Mob::DoAttack(Mob *other, DamageHitInfo &hit, ExtraAttackOptions *opts)
|
||||
ApplyDamageTable(hit);
|
||||
CommonOutgoingHitSuccess(other, hit, opts);
|
||||
}
|
||||
Log(Logs::Detail, Logs::Combat, "Final damage after all reductions: %d", hit.damage_done);
|
||||
LogCombat("Final damage after all reductions: [{}]", hit.damage_done);
|
||||
}
|
||||
else {
|
||||
Log(Logs::Detail, Logs::Combat, "Attack missed. Damage set to 0.");
|
||||
LogCombat("Attack missed. Damage set to 0");
|
||||
hit.damage_done = 0;
|
||||
}
|
||||
}
|
||||
@@ -1368,14 +1369,14 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b
|
||||
{
|
||||
if (!other) {
|
||||
SetTarget(nullptr);
|
||||
Log(Logs::General, Logs::Error, "A null Mob object was passed to Client::Attack() for evaluation!");
|
||||
LogError("A null Mob object was passed to Client::Attack() for evaluation!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!GetTarget())
|
||||
SetTarget(other);
|
||||
|
||||
Log(Logs::Detail, Logs::Combat, "Attacking %s with hand %d %s", other ? other->GetName() : "(nullptr)", Hand, bRiposte ? "(this is a riposte)" : "");
|
||||
LogCombat("Attacking [{}] with hand [{}] [{}]", other ? other->GetName() : "(nullptr)", Hand, bRiposte ? "(this is a riposte)" : "");
|
||||
|
||||
//SetAttackTimer();
|
||||
if (
|
||||
@@ -1385,13 +1386,13 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b
|
||||
|| (GetHP() < 0)
|
||||
|| (!IsAttackAllowed(other))
|
||||
) {
|
||||
Log(Logs::Detail, Logs::Combat, "Attack canceled, invalid circumstances.");
|
||||
LogCombat("Attack cancelled, invalid circumstances");
|
||||
return false; // Only bards can attack while casting
|
||||
}
|
||||
|
||||
if (DivineAura() && !GetGM()) {//cant attack while invulnerable unless your a gm
|
||||
Log(Logs::Detail, Logs::Combat, "Attack canceled, Divine Aura is in effect.");
|
||||
Message_StringID(MT_DefaultText, DIVINE_AURA_NO_ATK); //You can't attack while invulnerable!
|
||||
LogCombat("Attack cancelled, Divine Aura is in effect");
|
||||
MessageString(Chat::DefaultText, DIVINE_AURA_NO_ATK); //You can't attack while invulnerable
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1410,20 +1411,20 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b
|
||||
|
||||
if (weapon != nullptr) {
|
||||
if (!weapon->IsWeapon()) {
|
||||
Log(Logs::Detail, Logs::Combat, "Attack canceled, Item %s (%d) is not a weapon.", weapon->GetItem()->Name, weapon->GetID());
|
||||
LogCombat("Attack cancelled, Item [{}] ([{}]) is not a weapon", weapon->GetItem()->Name, weapon->GetID());
|
||||
return(false);
|
||||
}
|
||||
Log(Logs::Detail, Logs::Combat, "Attacking with weapon: %s (%d)", weapon->GetItem()->Name, weapon->GetID());
|
||||
LogCombat("Attacking with weapon: [{}] ([{}])", weapon->GetItem()->Name, weapon->GetID());
|
||||
}
|
||||
else {
|
||||
Log(Logs::Detail, Logs::Combat, "Attacking without a weapon.");
|
||||
LogCombat("Attacking without a weapon");
|
||||
}
|
||||
|
||||
DamageHitInfo my_hit;
|
||||
// calculate attack_skill and skillinuse depending on hand and weapon
|
||||
// also send Packet to near clients
|
||||
my_hit.skill = AttackAnimation(Hand, weapon);
|
||||
Log(Logs::Detail, Logs::Combat, "Attacking with %s in slot %d using skill %d", weapon ? weapon->GetItem()->Name : "Fist", Hand, my_hit.skill);
|
||||
LogCombat("Attacking with [{}] in slot [{}] using skill [{}]", weapon ? weapon->GetItem()->Name : "Fist", Hand, my_hit.skill);
|
||||
|
||||
// Now figure out damage
|
||||
my_hit.damage_done = 1;
|
||||
@@ -1491,7 +1492,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b
|
||||
|
||||
// damage = mod_client_damage(damage, skillinuse, Hand, weapon, other);
|
||||
|
||||
Log(Logs::Detail, Logs::Combat, "Damage calculated: base %d min damage %d skill %d", my_hit.base_damage, my_hit.min_damage, my_hit.skill);
|
||||
LogCombat("Damage calculated: base [{}] min damage [{}] skill [{}]", my_hit.base_damage, my_hit.min_damage, my_hit.skill);
|
||||
|
||||
int hit_chance_bonus = 0;
|
||||
my_hit.offense = offense(my_hit.skill); // we need this a few times
|
||||
@@ -1614,20 +1615,20 @@ bool Client::Death(Mob* killerMob, int32 damage, uint16 spell, EQEmu::skills::Sk
|
||||
if (killerMob && killerMob->IsClient() && (spell != SPELL_UNKNOWN) && damage > 0) {
|
||||
char val1[20] = { 0 };
|
||||
|
||||
entity_list.MessageClose_StringID(
|
||||
entity_list.MessageCloseString(
|
||||
this, /* Sender */
|
||||
false, /* Skip Sender */
|
||||
RuleI(Range, DamageMessages),
|
||||
MT_NonMelee, /* 283 */
|
||||
Chat::NonMelee, /* 283 */
|
||||
HIT_NON_MELEE, /* %1 hit %2 for %3 points of non-melee damage. */
|
||||
killerMob->GetCleanName(), /* Message1 */
|
||||
GetCleanName(), /* Message2 */
|
||||
ConvertArray(damage, val1)/* Message3 */
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
int exploss = 0;
|
||||
Log(Logs::Detail, Logs::Combat, "Fatal blow dealt by %s with %d damage, spell %d, skill %d", killerMob ? killerMob->GetName() : "Unknown", damage, spell, attack_skill);
|
||||
LogCombat("Fatal blow dealt by [{}] with [{}] damage, spell [{}], skill [{}]", killerMob ? killerMob->GetName() : "Unknown", damage, spell, attack_skill);
|
||||
|
||||
/*
|
||||
#1: Send death packet to everyone
|
||||
@@ -1900,7 +1901,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool
|
||||
{
|
||||
if (!other) {
|
||||
SetTarget(nullptr);
|
||||
Log(Logs::General, Logs::Error, "A null Mob object was passed to NPC::Attack() for evaluation!");
|
||||
LogError("A null Mob object was passed to NPC::Attack() for evaluation!");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1913,12 +1914,12 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool
|
||||
//Check that we can attack before we calc heading and face our target
|
||||
if (!IsAttackAllowed(other)) {
|
||||
if (this->GetOwnerID())
|
||||
this->Say_StringID(NOT_LEGAL_TARGET);
|
||||
this->SayString(NOT_LEGAL_TARGET);
|
||||
if (other) {
|
||||
if (other->IsClient())
|
||||
other->CastToClient()->RemoveXTarget(this, false);
|
||||
RemoveFromHateList(other);
|
||||
Log(Logs::Detail, Logs::Combat, "I am not allowed to attack %s", other->GetName());
|
||||
LogCombat("I am not allowed to attack [{}]", other->GetName());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -1948,10 +1949,10 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool
|
||||
//We dont factor much from the weapon into the attack.
|
||||
//Just the skill type so it doesn't look silly using punching animations and stuff while wielding weapons
|
||||
if (weapon) {
|
||||
Log(Logs::Detail, Logs::Combat, "Attacking with weapon: %s (%d) (too bad im not using it for much)", weapon->Name, weapon->ID);
|
||||
LogCombat("Attacking with weapon: [{}] ([{}]) (too bad im not using it for much)", weapon->Name, weapon->ID);
|
||||
|
||||
if (Hand == EQEmu::invslot::slotSecondary && weapon->ItemType == EQEmu::item::ItemTypeShield) {
|
||||
Log(Logs::Detail, Logs::Combat, "Attack with shield canceled.");
|
||||
if (Hand == EQEmu::invslot::slotSecondary && !weapon->IsType1HWeapon()) {
|
||||
LogCombat("Attack with non-weapon cancelled");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2053,7 +2054,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool
|
||||
|
||||
other->AddToHateList(this, hate);
|
||||
|
||||
Log(Logs::Detail, Logs::Combat, "Final damage against %s: %d", other->GetName(), my_hit.damage_done);
|
||||
LogCombat("Final damage against [{}]: [{}]", other->GetName(), my_hit.damage_done);
|
||||
|
||||
if (other->IsClient() && IsPet() && GetOwner()->IsClient()) {
|
||||
//pets do half damage to clients in pvp
|
||||
@@ -2110,7 +2111,7 @@ void NPC::Damage(Mob* other, int32 damage, uint16 spell_id, EQEmu::skills::Skill
|
||||
//handle EVENT_ATTACK. Resets after we have not been attacked for 12 seconds
|
||||
if (attacked_timer.Check())
|
||||
{
|
||||
Log(Logs::Detail, Logs::Combat, "Triggering EVENT_ATTACK due to attack by %s", other ? other->GetName() : "nullptr");
|
||||
LogCombat("Triggering EVENT_ATTACK due to attack by [{}]", other ? other->GetName() : "nullptr");
|
||||
parse->EventNPC(EVENT_ATTACK, this, other, "", 0);
|
||||
}
|
||||
attacked_timer.Start(CombatEventTimer_expire);
|
||||
@@ -2128,7 +2129,7 @@ void NPC::Damage(Mob* other, int32 damage, uint16 spell_id, EQEmu::skills::Skill
|
||||
{
|
||||
if (IsLDoNTrapped())
|
||||
{
|
||||
Message_StringID(13, LDON_ACCIDENT_SETOFF2);
|
||||
MessageString(Chat::Red, LDON_ACCIDENT_SETOFF2);
|
||||
SpellFinished(GetLDoNTrapSpellID(), other, EQEmu::spells::CastingSlot::Item, 0, -1, spells[GetLDoNTrapSpellID()].ResistDiff, false);
|
||||
SetLDoNTrapSpellID(0);
|
||||
SetLDoNTrapped(false);
|
||||
@@ -2148,7 +2149,7 @@ void NPC::Damage(Mob* other, int32 damage, uint16 spell_id, EQEmu::skills::Skill
|
||||
|
||||
bool NPC::Death(Mob* killer_mob, int32 damage, uint16 spell, EQEmu::skills::SkillType attack_skill)
|
||||
{
|
||||
Log(Logs::Detail, Logs::Combat, "Fatal blow dealt by %s with %d damage, spell %d, skill %d",
|
||||
LogCombat("Fatal blow dealt by [{}] with [{}] damage, spell [{}], skill [{}]",
|
||||
((killer_mob) ? (killer_mob->GetName()) : ("[nullptr]")), damage, spell, attack_skill);
|
||||
|
||||
Mob *oos = nullptr;
|
||||
@@ -2168,16 +2169,16 @@ bool NPC::Death(Mob* killer_mob, int32 damage, uint16 spell, EQEmu::skills::Skil
|
||||
if (killer_mob->IsClient() && (spell != SPELL_UNKNOWN) && damage > 0) {
|
||||
char val1[20] = { 0 };
|
||||
|
||||
entity_list.MessageClose_StringID(
|
||||
entity_list.MessageCloseString(
|
||||
this, /* Sender */
|
||||
false, /* Skip Sender */
|
||||
RuleI(Range, DamageMessages),
|
||||
MT_NonMelee, /* 283 */
|
||||
Chat::NonMelee, /* 283 */
|
||||
HIT_NON_MELEE, /* %1 hit %2 for %3 points of non-melee damage. */
|
||||
killer_mob->GetCleanName(), /* Message1 */
|
||||
GetCleanName(), /* Message2 */
|
||||
ConvertArray(damage, val1) /* Message3 */
|
||||
);
|
||||
);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -2796,7 +2797,7 @@ void Mob::DamageShield(Mob* attacker, bool spell_ds) {
|
||||
if (DS == 0 && rev_ds == 0)
|
||||
return;
|
||||
|
||||
Log(Logs::Detail, Logs::Combat, "Applying Damage Shield of value %d to %s", DS, attacker->GetName());
|
||||
LogCombat("Applying Damage Shield of value [{}] to [{}]", DS, attacker->GetName());
|
||||
|
||||
//invert DS... spells yield negative values for a true damage shield
|
||||
if (DS < 0) {
|
||||
@@ -2842,7 +2843,7 @@ void Mob::DamageShield(Mob* attacker, bool spell_ds) {
|
||||
rev_ds_spell_id = spellbonuses.ReverseDamageShieldSpellID;
|
||||
|
||||
if (rev_ds < 0) {
|
||||
Log(Logs::Detail, Logs::Combat, "Applying Reverse Damage Shield of value %d to %s", rev_ds, attacker->GetName());
|
||||
LogCombat("Applying Reverse Damage Shield of value [{}] to [{}]", rev_ds, attacker->GetName());
|
||||
attacker->Damage(this, -rev_ds, rev_ds_spell_id, EQEmu::skills::SkillAbjuration/*hackish*/, false); //"this" (us) will get the hate, etc. not sure how this works on Live, but it'll works for now, and tanks will love us for this
|
||||
//do we need to send a damage packet here also?
|
||||
}
|
||||
@@ -3052,16 +3053,14 @@ int32 Mob::ReduceDamage(int32 damage)
|
||||
int damage_to_reduce = damage * spellbonuses.MeleeThresholdGuard[0] / 100;
|
||||
if (damage_to_reduce >= buffs[slot].melee_rune)
|
||||
{
|
||||
Log(Logs::Detail, Logs::Spells, "Mob::ReduceDamage SE_MeleeThresholdGuard %d damage negated, %d"
|
||||
" damage remaining, fading buff.", damage_to_reduce, buffs[slot].melee_rune);
|
||||
LogSpells("Mob::ReduceDamage SE_MeleeThresholdGuard [{}] damage negated, [{}] damage remaining, fading buff", damage_to_reduce, buffs[slot].melee_rune);
|
||||
damage -= buffs[slot].melee_rune;
|
||||
if (!TryFadeEffect(slot))
|
||||
BuffFadeBySlot(slot);
|
||||
}
|
||||
else
|
||||
{
|
||||
Log(Logs::Detail, Logs::Spells, "Mob::ReduceDamage SE_MeleeThresholdGuard %d damage negated, %d"
|
||||
" damage remaining.", damage_to_reduce, buffs[slot].melee_rune);
|
||||
LogSpells("Mob::ReduceDamage SE_MeleeThresholdGuard [{}] damage negated, [{}] damage remaining", damage_to_reduce, buffs[slot].melee_rune);
|
||||
buffs[slot].melee_rune = (buffs[slot].melee_rune - damage_to_reduce);
|
||||
damage -= damage_to_reduce;
|
||||
}
|
||||
@@ -3079,16 +3078,14 @@ int32 Mob::ReduceDamage(int32 damage)
|
||||
|
||||
if (spellbonuses.MitigateMeleeRune[3] && (damage_to_reduce >= buffs[slot].melee_rune))
|
||||
{
|
||||
Log(Logs::Detail, Logs::Spells, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d"
|
||||
" damage remaining, fading buff.", damage_to_reduce, buffs[slot].melee_rune);
|
||||
LogSpells("Mob::ReduceDamage SE_MitigateMeleeDamage [{}] damage negated, [{}] damage remaining, fading buff", damage_to_reduce, buffs[slot].melee_rune);
|
||||
damage -= buffs[slot].melee_rune;
|
||||
if (!TryFadeEffect(slot))
|
||||
BuffFadeBySlot(slot);
|
||||
}
|
||||
else
|
||||
{
|
||||
Log(Logs::Detail, Logs::Spells, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d"
|
||||
" damage remaining.", damage_to_reduce, buffs[slot].melee_rune);
|
||||
LogSpells("Mob::ReduceDamage SE_MitigateMeleeDamage [{}] damage negated, [{}] damage remaining", damage_to_reduce, buffs[slot].melee_rune);
|
||||
|
||||
if (spellbonuses.MitigateMeleeRune[3])
|
||||
buffs[slot].melee_rune = (buffs[slot].melee_rune - damage_to_reduce);
|
||||
@@ -3205,16 +3202,14 @@ int32 Mob::AffectMagicalDamage(int32 damage, uint16 spell_id, const bool iBuffTi
|
||||
|
||||
if (spellbonuses.MitigateSpellRune[3] && (damage_to_reduce >= buffs[slot].magic_rune))
|
||||
{
|
||||
Log(Logs::Detail, Logs::Spells, "Mob::ReduceDamage SE_MitigateSpellDamage %d damage negated, %d"
|
||||
" damage remaining, fading buff.", damage_to_reduce, buffs[slot].magic_rune);
|
||||
LogSpells("Mob::ReduceDamage SE_MitigateSpellDamage [{}] damage negated, [{}] damage remaining, fading buff", damage_to_reduce, buffs[slot].magic_rune);
|
||||
damage -= buffs[slot].magic_rune;
|
||||
if (!TryFadeEffect(slot))
|
||||
BuffFadeBySlot(slot);
|
||||
}
|
||||
else
|
||||
{
|
||||
Log(Logs::Detail, Logs::Spells, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d"
|
||||
" damage remaining.", damage_to_reduce, buffs[slot].magic_rune);
|
||||
LogSpells("Mob::ReduceDamage SE_MitigateMeleeDamage [{}] damage negated, [{}] damage remaining", damage_to_reduce, buffs[slot].magic_rune);
|
||||
|
||||
if (spellbonuses.MitigateSpellRune[3])
|
||||
buffs[slot].magic_rune = (buffs[slot].magic_rune - damage_to_reduce);
|
||||
@@ -3369,13 +3364,13 @@ void Mob::CommonDamage(Mob* attacker, int &damage, const uint16 spell_id, const
|
||||
ignore_invul = spell_id == 982 || spells[spell_id].cast_not_standing; // cazic touch
|
||||
|
||||
if (!ignore_invul && (GetInvul() || DivineAura())) {
|
||||
Log(Logs::Detail, Logs::Combat, "Avoiding %d damage due to invulnerability.", damage);
|
||||
LogCombat("Avoiding [{}] damage due to invulnerability", damage);
|
||||
damage = DMG_INVULNERABLE;
|
||||
}
|
||||
|
||||
// this should actually happen MUCH sooner, need to investigate though -- good enough for now
|
||||
if ((skill_used == EQEmu::skills::SkillArchery || skill_used == EQEmu::skills::SkillThrowing) && GetSpecialAbility(IMMUNE_RANGED_ATTACKS)) {
|
||||
Log(Logs::Detail, Logs::Combat, "Avoiding %d damage due to IMMUNE_RANGED_ATTACKS.", damage);
|
||||
LogCombat("Avoiding [{}] damage due to IMMUNE_RANGED_ATTACKS", damage);
|
||||
damage = DMG_INVULNERABLE;
|
||||
}
|
||||
|
||||
@@ -3419,12 +3414,12 @@ void Mob::CommonDamage(Mob* attacker, int &damage, const uint16 spell_id, const
|
||||
int healed = damage;
|
||||
|
||||
healed = attacker->GetActSpellHealing(spell_id, healed);
|
||||
Log(Logs::Detail, Logs::Combat, "Applying lifetap heal of %d to %s", healed, attacker->GetName());
|
||||
LogCombat("Applying lifetap heal of [{}] to [{}]", healed, attacker->GetName());
|
||||
attacker->HealDamage(healed);
|
||||
|
||||
//we used to do a message to the client, but its gone now.
|
||||
// emote goes with every one ... even npcs
|
||||
entity_list.MessageClose(this, true, RuleI(Range, SpellMessages), MT_Emote, "%s beams a smile at %s", attacker->GetCleanName(), this->GetCleanName());
|
||||
entity_list.MessageClose(this, true, RuleI(Range, SpellMessages), Chat::Emote, "%s beams a smile at %s", attacker->GetCleanName(), this->GetCleanName());
|
||||
}
|
||||
} //end `if there is some damage being done and theres anattacker person involved`
|
||||
|
||||
@@ -3435,17 +3430,17 @@ void Mob::CommonDamage(Mob* attacker, int &damage, const uint16 spell_id, const
|
||||
if (pet && !pet->IsFamiliar() && !pet->GetSpecialAbility(IMMUNE_AGGRO) && !pet->IsEngaged() && attacker && attacker != this && !attacker->IsCorpse() && !pet->IsGHeld() && !attacker->IsTrap())
|
||||
{
|
||||
if (!pet->IsHeld()) {
|
||||
Log(Logs::Detail, Logs::Aggro, "Sending pet %s into battle due to attack.", pet->GetName());
|
||||
LogAggro("Sending pet [{}] into battle due to attack", pet->GetName());
|
||||
pet->AddToHateList(attacker, 1, 0, true, false, false, spell_id);
|
||||
pet->SetTarget(attacker);
|
||||
Message_StringID(10, PET_ATTACKING, pet->GetCleanName(), attacker->GetCleanName());
|
||||
MessageString(Chat::NPCQuestSay, PET_ATTACKING, pet->GetCleanName(), attacker->GetCleanName());
|
||||
}
|
||||
}
|
||||
|
||||
//see if any runes want to reduce this damage
|
||||
if (spell_id == SPELL_UNKNOWN) {
|
||||
damage = ReduceDamage(damage);
|
||||
Log(Logs::Detail, Logs::Combat, "Melee Damage reduced to %d", damage);
|
||||
LogCombat("Melee Damage reduced to [{}]", damage);
|
||||
damage = ReduceAllDamage(damage);
|
||||
TryTriggerThreshHold(damage, SE_TriggerMeleeThreshold, attacker);
|
||||
|
||||
@@ -3458,7 +3453,7 @@ void Mob::CommonDamage(Mob* attacker, int &damage, const uint16 spell_id, const
|
||||
damage = AffectMagicalDamage(damage, spell_id, iBuffTic, attacker);
|
||||
if (origdmg != damage && attacker && attacker->IsClient()) {
|
||||
if (attacker->CastToClient()->GetFilter(FilterDamageShields) != FilterHide)
|
||||
attacker->Message(15, "The Spellshield absorbed %d of %d points of damage", origdmg - damage, origdmg);
|
||||
attacker->Message(Chat::Yellow, "The Spellshield absorbed %d of %d points of damage", origdmg - damage, origdmg);
|
||||
}
|
||||
if (damage == 0 && attacker && origdmg != damage && IsClient()) {
|
||||
//Kayen: Probably need to add a filter for this - Not sure if this msg is correct but there should be a message for spell negate/runes.
|
||||
@@ -3505,16 +3500,16 @@ void Mob::CommonDamage(Mob* attacker, int &damage, const uint16 spell_id, const
|
||||
|
||||
//fade mez if we are mezzed
|
||||
if (IsMezzed() && attacker) {
|
||||
Log(Logs::Detail, Logs::Combat, "Breaking mez due to attack.");
|
||||
entity_list.MessageClose_StringID(
|
||||
LogCombat("Breaking mez due to attack");
|
||||
entity_list.MessageCloseString(
|
||||
this, /* Sender */
|
||||
true, /* Skip Sender */
|
||||
RuleI(Range, SpellMessages),
|
||||
MT_WornOff, /* 284 */
|
||||
Chat::SpellWornOff, /* 284 */
|
||||
HAS_BEEN_AWAKENED, // %1 has been awakened by %2.
|
||||
GetCleanName(), /* Message1 */
|
||||
attacker->GetCleanName() /* Message2 */
|
||||
);
|
||||
);
|
||||
BuffFadeByEffect(SE_Mez);
|
||||
}
|
||||
|
||||
@@ -3563,13 +3558,13 @@ void Mob::CommonDamage(Mob* attacker, int &damage, const uint16 spell_id, const
|
||||
else {
|
||||
// stun resist passed!
|
||||
if (IsClient())
|
||||
Message_StringID(MT_Stun, SHAKE_OFF_STUN);
|
||||
MessageString(Chat::Stun, SHAKE_OFF_STUN);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// stun resist 2 passed!
|
||||
if (IsClient())
|
||||
Message_StringID(MT_Stun, AVOID_STUNNING_BLOW);
|
||||
MessageString(Chat::Stun, AVOID_STUNNING_BLOW);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -3592,7 +3587,7 @@ void Mob::CommonDamage(Mob* attacker, int &damage, const uint16 spell_id, const
|
||||
//increment chances of interrupting
|
||||
if (IsCasting()) { //shouldnt interrupt on regular spell damage
|
||||
attacked_count++;
|
||||
Log(Logs::Detail, Logs::Combat, "Melee attack while casting. Attack count %d", attacked_count);
|
||||
LogCombat("Melee attack while casting. Attack count [{}]", attacked_count);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3649,7 +3644,7 @@ void Mob::CommonDamage(Mob* attacker, int &damage, const uint16 spell_id, const
|
||||
if (((spell_id != SPELL_UNKNOWN) || (FromDamageShield)) && damage>0) {
|
||||
//special crap for spell damage, looks hackish to me
|
||||
char val1[20] = { 0 };
|
||||
owner->Message_StringID(MT_NonMelee, OTHER_HIT_NONMELEE, GetCleanName(), ConvertArray(damage, val1));
|
||||
owner->MessageString(Chat::NonMelee, OTHER_HIT_NONMELEE, GetCleanName(), ConvertArray(damage, val1));
|
||||
}
|
||||
else {
|
||||
if (damage > 0) {
|
||||
@@ -3679,19 +3674,19 @@ void Mob::CommonDamage(Mob* attacker, int &damage, const uint16 spell_id, const
|
||||
char val1[20] = { 0 };
|
||||
if (FromDamageShield) {
|
||||
if (attacker->CastToClient()->GetFilter(FilterDamageShields) != FilterHide)
|
||||
attacker->Message_StringID(MT_DS, OTHER_HIT_NONMELEE, GetCleanName(), ConvertArray(damage, val1));
|
||||
attacker->MessageString(Chat::DamageShield, OTHER_HIT_NONMELEE, GetCleanName(), ConvertArray(damage, val1));
|
||||
}
|
||||
else {
|
||||
entity_list.MessageClose_StringID(
|
||||
entity_list.MessageCloseString(
|
||||
this, /* Sender */
|
||||
true, /* Skip Sender */
|
||||
RuleI(Range, SpellMessages),
|
||||
MT_NonMelee, /* 283 */
|
||||
Chat::NonMelee, /* 283 */
|
||||
HIT_NON_MELEE, /* %1 hit %2 for %3 points of non-melee damage. */
|
||||
attacker->GetCleanName(), /* Message1 */
|
||||
GetCleanName(), /* Message2 */
|
||||
ConvertArray(damage, val1) /* Message3 */
|
||||
);
|
||||
);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -3753,22 +3748,22 @@ void Mob::CommonDamage(Mob* attacker, int &damage, const uint16 spell_id, const
|
||||
// So we can see our dot dmg like live shows it.
|
||||
if (spell_id != SPELL_UNKNOWN && damage > 0 && attacker && attacker != this && attacker->IsClient()) {
|
||||
//might filter on (attack_skill>200 && attack_skill<250), but I dont think we need it
|
||||
attacker->FilteredMessage_StringID(attacker, MT_DoTDamage, FilterDOT,
|
||||
attacker->FilteredMessageString(attacker, Chat::DotDamage, FilterDOT,
|
||||
YOUR_HIT_DOT, GetCleanName(), itoa(damage), spells[spell_id].name);
|
||||
|
||||
/* older clients don't have the below String ID, but it will be filtered */
|
||||
entity_list.FilteredMessageClose_StringID(
|
||||
entity_list.FilteredMessageCloseString(
|
||||
attacker, /* Sender */
|
||||
true, /* Skip Sender */
|
||||
RuleI(Range, SpellMessages),
|
||||
MT_DoTDamage, /* Type: 325 */
|
||||
Chat::DotDamage, /* Type: 325 */
|
||||
FilterDOT, /* FilterType: 19 */
|
||||
OTHER_HIT_DOT, /* MessageFormat: %1 has taken %2 damage from %3 by %4. */
|
||||
GetCleanName(), /* Message1 */
|
||||
itoa(damage), /* Message2 */
|
||||
attacker->GetCleanName(), /* Message3 */
|
||||
spells[spell_id].name /* Message4 */
|
||||
);
|
||||
);
|
||||
}
|
||||
} //end packet sending
|
||||
|
||||
@@ -3791,42 +3786,42 @@ void Mob::HealDamage(uint32 amount, Mob *caster, uint16 spell_id)
|
||||
// message to caster
|
||||
if (caster->IsClient() && caster == this) {
|
||||
if (caster->CastToClient()->ClientVersionBit() & EQEmu::versions::maskSoFAndLater)
|
||||
FilteredMessage_StringID(caster, MT_NonMelee, FilterHealOverTime,
|
||||
FilteredMessageString(caster, Chat::NonMelee, FilterHealOverTime,
|
||||
HOT_HEAL_SELF, itoa(acthealed), spells[spell_id].name);
|
||||
else
|
||||
FilteredMessage_StringID(caster, MT_NonMelee, FilterHealOverTime,
|
||||
FilteredMessageString(caster, Chat::NonMelee, FilterHealOverTime,
|
||||
YOU_HEALED, GetCleanName(), itoa(acthealed));
|
||||
}
|
||||
else if (caster->IsClient() && caster != this) {
|
||||
if (caster->CastToClient()->ClientVersionBit() & EQEmu::versions::maskSoFAndLater)
|
||||
caster->FilteredMessage_StringID(caster, MT_NonMelee, FilterHealOverTime,
|
||||
caster->FilteredMessageString(caster, Chat::NonMelee, FilterHealOverTime,
|
||||
HOT_HEAL_OTHER, GetCleanName(), itoa(acthealed),
|
||||
spells[spell_id].name);
|
||||
else
|
||||
caster->FilteredMessage_StringID(caster, MT_NonMelee, FilterHealOverTime,
|
||||
caster->FilteredMessageString(caster, Chat::NonMelee, FilterHealOverTime,
|
||||
YOU_HEAL, GetCleanName(), itoa(acthealed));
|
||||
}
|
||||
// message to target
|
||||
if (IsClient() && caster != this) {
|
||||
if (CastToClient()->ClientVersionBit() & EQEmu::versions::maskSoFAndLater)
|
||||
FilteredMessage_StringID(this, MT_NonMelee, FilterHealOverTime,
|
||||
FilteredMessageString(this, Chat::NonMelee, FilterHealOverTime,
|
||||
HOT_HEALED_OTHER, caster->GetCleanName(),
|
||||
itoa(acthealed), spells[spell_id].name);
|
||||
else
|
||||
FilteredMessage_StringID(this, MT_NonMelee, FilterHealOverTime,
|
||||
FilteredMessageString(this, Chat::NonMelee, FilterHealOverTime,
|
||||
YOU_HEALED, caster->GetCleanName(), itoa(acthealed));
|
||||
}
|
||||
}
|
||||
else { // normal heals
|
||||
FilteredMessage_StringID(caster, MT_NonMelee, FilterSpellDamage,
|
||||
FilteredMessageString(caster, Chat::NonMelee, FilterSpellDamage,
|
||||
YOU_HEALED, caster->GetCleanName(), itoa(acthealed));
|
||||
if (caster != this)
|
||||
caster->FilteredMessage_StringID(caster, MT_NonMelee, FilterSpellDamage,
|
||||
caster->FilteredMessageString(caster, Chat::NonMelee, FilterSpellDamage,
|
||||
YOU_HEAL, GetCleanName(), itoa(acthealed));
|
||||
}
|
||||
}
|
||||
else {
|
||||
Message(MT_NonMelee, "You have been healed for %d points of damage.", acthealed);
|
||||
Message(Chat::NonMelee, "You have been healed for %d points of damage.", acthealed);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3861,7 +3856,7 @@ float Mob::GetProcChances(float ProcBonus, uint16 hand)
|
||||
ProcChance += ProcChance * ProcBonus / 100.0f;
|
||||
}
|
||||
|
||||
Log(Logs::Detail, Logs::Combat, "Proc chance %.2f (%.2f from bonuses)", ProcChance, ProcBonus);
|
||||
LogCombat("Proc chance [{}] ([{}] from bonuses)", ProcChance, ProcBonus);
|
||||
return ProcChance;
|
||||
}
|
||||
|
||||
@@ -3880,7 +3875,7 @@ float Mob::GetDefensiveProcChances(float &ProcBonus, float &ProcChance, uint16 h
|
||||
ProcBonus += static_cast<float>(myagi) * RuleR(Combat, DefProcPerMinAgiContrib) / 100.0f;
|
||||
ProcChance = ProcChance + (ProcChance * ProcBonus);
|
||||
|
||||
Log(Logs::Detail, Logs::Combat, "Defensive Proc chance %.2f (%.2f from bonuses)", ProcChance, ProcBonus);
|
||||
LogCombat("Defensive Proc chance [{}] ([{}] from bonuses)", ProcChance, ProcBonus);
|
||||
return ProcChance;
|
||||
}
|
||||
|
||||
@@ -3889,7 +3884,7 @@ void Mob::TryDefensiveProc(Mob *on, uint16 hand) {
|
||||
|
||||
if (!on) {
|
||||
SetTarget(nullptr);
|
||||
Log(Logs::General, Logs::Error, "A null Mob object was passed to Mob::TryDefensiveProc for evaluation!");
|
||||
LogError("A null Mob object was passed to Mob::TryDefensiveProc for evaluation!");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3929,17 +3924,17 @@ void Mob::TryDefensiveProc(Mob *on, uint16 hand) {
|
||||
void Mob::TryWeaponProc(const EQEmu::ItemInstance* weapon_g, Mob *on, uint16 hand) {
|
||||
if (!on) {
|
||||
SetTarget(nullptr);
|
||||
Log(Logs::General, Logs::Error, "A null Mob object was passed to Mob::TryWeaponProc for evaluation!");
|
||||
LogError("A null Mob object was passed to Mob::TryWeaponProc for evaluation!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IsAttackAllowed(on)) {
|
||||
Log(Logs::Detail, Logs::Combat, "Preventing procing off of unattackable things.");
|
||||
LogCombat("Preventing procing off of unattackable things");
|
||||
return;
|
||||
}
|
||||
|
||||
if (DivineAura()) {
|
||||
Log(Logs::Detail, Logs::Combat, "Procs canceled, Divine Aura is in effect.");
|
||||
LogCombat("Procs cancelled, Divine Aura is in effect");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3986,22 +3981,19 @@ void Mob::TryWeaponProc(const EQEmu::ItemInstance *inst, const EQEmu::ItemData *
|
||||
static_cast<float>(weapon->ProcRate)) / 100.0f;
|
||||
if (zone->random.Roll(WPC)) { // 255 dex = 0.084 chance of proc. No idea what this number should be really.
|
||||
if (weapon->Proc.Level2 > ourlevel) {
|
||||
Log(Logs::Detail, Logs::Combat,
|
||||
"Tried to proc (%s), but our level (%d) is lower than required (%d)",
|
||||
LogCombat("Tried to proc ([{}]), but our level ([{}]) is lower than required ([{}])",
|
||||
weapon->Name, ourlevel, weapon->Proc.Level2);
|
||||
if (IsPet()) {
|
||||
Mob *own = GetOwner();
|
||||
if (own)
|
||||
own->Message_StringID(13, PROC_PETTOOLOW);
|
||||
own->MessageString(Chat::Red, PROC_PETTOOLOW);
|
||||
}
|
||||
else {
|
||||
Message_StringID(13, PROC_TOOLOW);
|
||||
MessageString(Chat::Red, PROC_TOOLOW);
|
||||
}
|
||||
}
|
||||
else {
|
||||
Log(Logs::Detail, Logs::Combat,
|
||||
"Attacking weapon (%s) successfully procing spell %d (%.2f percent chance)",
|
||||
weapon->Name, weapon->Proc.Effect, WPC * 100);
|
||||
LogCombat("Attacking weapon ([{}]) successfully procing spell [{}] ([{}] percent chance)", weapon->Name, weapon->Proc.Effect, WPC * 100);
|
||||
ExecWeaponProc(inst, weapon->Proc.Effect, on);
|
||||
proced = true;
|
||||
}
|
||||
@@ -4029,10 +4021,10 @@ void Mob::TryWeaponProc(const EQEmu::ItemInstance *inst, const EQEmu::ItemData *
|
||||
if (IsPet()) {
|
||||
Mob *own = GetOwner();
|
||||
if (own)
|
||||
own->Message_StringID(13, PROC_PETTOOLOW);
|
||||
own->MessageString(Chat::Red, PROC_PETTOOLOW);
|
||||
}
|
||||
else {
|
||||
Message_StringID(13, PROC_TOOLOW);
|
||||
MessageString(Chat::Red, PROC_TOOLOW);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -4081,15 +4073,11 @@ void Mob::TrySpellProc(const EQEmu::ItemInstance *inst, const EQEmu::ItemData *w
|
||||
// Perma procs (AAs)
|
||||
if (PermaProcs[i].spellID != SPELL_UNKNOWN) {
|
||||
if (zone->random.Roll(PermaProcs[i].chance)) { // TODO: Do these get spell bonus?
|
||||
Log(Logs::Detail, Logs::Combat,
|
||||
"Permanent proc %d procing spell %d (%d percent chance)",
|
||||
i, PermaProcs[i].spellID, PermaProcs[i].chance);
|
||||
LogCombat("Permanent proc [{}] procing spell [{}] ([{}] percent chance)", i, PermaProcs[i].spellID, PermaProcs[i].chance);
|
||||
ExecWeaponProc(nullptr, PermaProcs[i].spellID, on);
|
||||
}
|
||||
else {
|
||||
Log(Logs::Detail, Logs::Combat,
|
||||
"Permanent proc %d failed to proc %d (%d percent chance)",
|
||||
i, PermaProcs[i].spellID, PermaProcs[i].chance);
|
||||
LogCombat("Permanent proc [{}] failed to proc [{}] ([{}] percent chance)", i, PermaProcs[i].spellID, PermaProcs[i].chance);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4097,18 +4085,14 @@ void Mob::TrySpellProc(const EQEmu::ItemInstance *inst, const EQEmu::ItemData *w
|
||||
if (SpellProcs[i].spellID != SPELL_UNKNOWN) {
|
||||
float chance = ProcChance * (static_cast<float>(SpellProcs[i].chance) / 100.0f);
|
||||
if (zone->random.Roll(chance)) {
|
||||
Log(Logs::Detail, Logs::Combat,
|
||||
"Spell proc %d procing spell %d (%.2f percent chance)",
|
||||
i, SpellProcs[i].spellID, chance);
|
||||
LogCombat("Spell proc [{}] procing spell [{}] ([{}] percent chance)", i, SpellProcs[i].spellID, chance);
|
||||
SendBeginCast(SpellProcs[i].spellID, 0);
|
||||
ExecWeaponProc(nullptr, SpellProcs[i].spellID, on, SpellProcs[i].level_override);
|
||||
CheckNumHitsRemaining(NumHit::OffensiveSpellProcs, 0,
|
||||
SpellProcs[i].base_spellID);
|
||||
}
|
||||
else {
|
||||
Log(Logs::Detail, Logs::Combat,
|
||||
"Spell proc %d failed to proc %d (%.2f percent chance)",
|
||||
i, SpellProcs[i].spellID, chance);
|
||||
LogCombat("Spell proc [{}] failed to proc [{}] ([{}] percent chance)", i, SpellProcs[i].spellID, chance);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4117,17 +4101,13 @@ void Mob::TrySpellProc(const EQEmu::ItemInstance *inst, const EQEmu::ItemData *w
|
||||
if (RangedProcs[i].spellID != SPELL_UNKNOWN) {
|
||||
float chance = ProcChance * (static_cast<float>(RangedProcs[i].chance) / 100.0f);
|
||||
if (zone->random.Roll(chance)) {
|
||||
Log(Logs::Detail, Logs::Combat,
|
||||
"Ranged proc %d procing spell %d (%.2f percent chance)",
|
||||
i, RangedProcs[i].spellID, chance);
|
||||
LogCombat("Ranged proc [{}] procing spell [{}] ([{}] percent chance)", i, RangedProcs[i].spellID, chance);
|
||||
ExecWeaponProc(nullptr, RangedProcs[i].spellID, on);
|
||||
CheckNumHitsRemaining(NumHit::OffensiveSpellProcs, 0,
|
||||
RangedProcs[i].base_spellID);
|
||||
}
|
||||
else {
|
||||
Log(Logs::Detail, Logs::Combat,
|
||||
"Ranged proc %d failed to proc %d (%.2f percent chance)",
|
||||
i, RangedProcs[i].spellID, chance);
|
||||
LogCombat("Ranged proc [{}] failed to proc [{}] ([{}] percent chance)", i, RangedProcs[i].spellID, chance);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4182,16 +4162,16 @@ void Mob::TryPetCriticalHit(Mob *defender, DamageHitInfo &hit)
|
||||
hit.damage_done += 5;
|
||||
hit.damage_done = (hit.damage_done * critMod) / 100;
|
||||
|
||||
entity_list.FilteredMessageClose_StringID(
|
||||
entity_list.FilteredMessageCloseString(
|
||||
this, /* Sender */
|
||||
false, /* Skip Sender */
|
||||
RuleI(Range, CriticalDamage),
|
||||
MT_CritMelee, /* Type: 301 */
|
||||
Chat::MeleeCrit, /* Type: 301 */
|
||||
FilterMeleeCrits, /* FilterType: 12 */
|
||||
CRITICAL_HIT, /* MessageFormat: %1 scores a critical hit! (%2) */
|
||||
GetCleanName(), /* Message1 */
|
||||
itoa(hit.damage_done + hit.min_damage) /* Message2 */
|
||||
);
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -4242,29 +4222,29 @@ void Mob::TryCriticalHit(Mob *defender, DamageHitInfo &hit, ExtraAttackOptions *
|
||||
|
||||
/* Female */
|
||||
if (GetGender() == 1) {
|
||||
entity_list.FilteredMessageClose_StringID(
|
||||
entity_list.FilteredMessageCloseString(
|
||||
this, /* Sender */
|
||||
false, /* Skip Sender */
|
||||
RuleI(Range, CriticalDamage),
|
||||
MT_CritMelee, /* Type: 301 */
|
||||
Chat::MeleeCrit, /* Type: 301 */
|
||||
FilterMeleeCrits, /* FilterType: 12 */
|
||||
FEMALE_SLAYUNDEAD, /* MessageFormat: %1's holy blade cleanses her target!(%2) */
|
||||
GetCleanName(), /* Message1 */
|
||||
itoa(hit.damage_done + hit.min_damage) /* Message2 */
|
||||
);
|
||||
);
|
||||
}
|
||||
/* Males and Neuter */
|
||||
else {
|
||||
entity_list.FilteredMessageClose_StringID(
|
||||
entity_list.FilteredMessageCloseString(
|
||||
this, /* Sender */
|
||||
false, /* Skip Sender */
|
||||
RuleI(Range, CriticalDamage),
|
||||
MT_CritMelee, /* Type: 301 */
|
||||
Chat::MeleeCrit, /* Type: 301 */
|
||||
FilterMeleeCrits, /* FilterType: 12 */
|
||||
MALE_SLAYUNDEAD, /* MessageFormat: %1's holy blade cleanses his target!(%2) */
|
||||
GetCleanName(), /* Message1 */
|
||||
itoa(hit.damage_done + hit.min_damage) /* Message2 */
|
||||
);
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -4322,9 +4302,7 @@ void Mob::TryCriticalHit(Mob *defender, DamageHitInfo &hit, ExtraAttackOptions *
|
||||
}
|
||||
|
||||
hit.damage_done = hit.damage_done * crit_mod / 100;
|
||||
Log(Logs::Detail, Logs::Combat,
|
||||
"Crit success roll %d dex chance %d og dmg %d crit_mod %d new dmg %d", roll, dex_bonus,
|
||||
og_damage, crit_mod, hit.damage_done);
|
||||
LogCombat("Crit success roll [{}] dex chance [{}] og dmg [{}] crit_mod [{}] new dmg [{}]", roll, dex_bonus, og_damage, crit_mod, hit.damage_done);
|
||||
|
||||
// step 3: check deadly strike
|
||||
if (GetClass() == ROGUE && hit.skill == EQEmu::skills::SkillThrowing) {
|
||||
@@ -4339,16 +4317,16 @@ void Mob::TryCriticalHit(Mob *defender, DamageHitInfo &hit, ExtraAttackOptions *
|
||||
}
|
||||
hit.damage_done = hit.damage_done * 200 / 100;
|
||||
|
||||
entity_list.FilteredMessageClose_StringID(
|
||||
entity_list.FilteredMessageCloseString(
|
||||
this, /* Sender */
|
||||
false, /* Skip Sender */
|
||||
RuleI(Range, CriticalDamage),
|
||||
MT_CritMelee, /* Type: 301 */
|
||||
Chat::MeleeCrit, /* Type: 301 */
|
||||
FilterMeleeCrits, /* FilterType: 12 */
|
||||
DEADLY_STRIKE, /* MessageFormat: %1 scores a Deadly Strike!(%2) */
|
||||
GetCleanName(), /* Message1 */
|
||||
itoa(hit.damage_done + hit.min_damage) /* Message2 */
|
||||
);
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -4365,18 +4343,18 @@ void Mob::TryCriticalHit(Mob *defender, DamageHitInfo &hit, ExtraAttackOptions *
|
||||
|
||||
if (IsBerserk() || berserk) {
|
||||
hit.damage_done += og_damage * 119 / 100;
|
||||
Log(Logs::Detail, Logs::Combat, "Crip damage %d", hit.damage_done);
|
||||
LogCombat("Crip damage [{}]", hit.damage_done);
|
||||
|
||||
entity_list.FilteredMessageClose_StringID(
|
||||
entity_list.FilteredMessageCloseString(
|
||||
this, /* Sender */
|
||||
false, /* Skip Sender */
|
||||
RuleI(Range, CriticalDamage),
|
||||
MT_CritMelee, /* Type: 301 */
|
||||
Chat::MeleeCrit, /* Type: 301 */
|
||||
FilterMeleeCrits, /* FilterType: 12 */
|
||||
CRIPPLING_BLOW, /* MessageFormat: %1 lands a Crippling Blow!(%2) */
|
||||
GetCleanName(), /* Message1 */
|
||||
itoa(hit.damage_done + hit.min_damage) /* Message2 */
|
||||
);
|
||||
);
|
||||
|
||||
// Crippling blows also have a chance to stun
|
||||
// Kayen: Crippling Blow would cause a chance to interrupt for npcs < 55, with a
|
||||
@@ -4389,16 +4367,16 @@ void Mob::TryCriticalHit(Mob *defender, DamageHitInfo &hit, ExtraAttackOptions *
|
||||
}
|
||||
|
||||
/* Normal Critical hit message */
|
||||
entity_list.FilteredMessageClose_StringID(
|
||||
entity_list.FilteredMessageCloseString(
|
||||
this, /* Sender */
|
||||
false, /* Skip Sender */
|
||||
RuleI(Range, CriticalDamage),
|
||||
MT_CritMelee, /* Type: 301 */
|
||||
Chat::MeleeCrit, /* Type: 301 */
|
||||
FilterMeleeCrits, /* FilterType: 12 */
|
||||
CRITICAL_HIT, /* MessageFormat: %1 scores a critical hit! (%2) */
|
||||
GetCleanName(), /* Message1 */
|
||||
itoa(hit.damage_done + hit.min_damage) /* Message2 */
|
||||
);
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4426,15 +4404,15 @@ bool Mob::TryFinishingBlow(Mob *defender, int &damage)
|
||||
(ProcChance >= zone->random.Int(1, 1000))) {
|
||||
|
||||
/* Finishing Blow Critical Message */
|
||||
entity_list.FilteredMessageClose_StringID(
|
||||
entity_list.FilteredMessageCloseString(
|
||||
this, /* Sender */
|
||||
false, /* Skip Sender */
|
||||
RuleI(Range, CriticalDamage),
|
||||
MT_CritMelee, /* Type: 301 */
|
||||
Chat::MeleeCrit, /* Type: 301 */
|
||||
FilterMeleeCrits, /* FilterType: 12 */
|
||||
FINISHING_BLOW, /* MessageFormat: %1 scores a Finishing Blow!!) */
|
||||
GetCleanName() /* Message1 */
|
||||
);
|
||||
);
|
||||
|
||||
damage = FB_Dmg;
|
||||
return true;
|
||||
@@ -4445,14 +4423,14 @@ bool Mob::TryFinishingBlow(Mob *defender, int &damage)
|
||||
|
||||
void Mob::DoRiposte(Mob *defender)
|
||||
{
|
||||
Log(Logs::Detail, Logs::Combat, "Preforming a riposte");
|
||||
LogCombat("Preforming a riposte");
|
||||
|
||||
if (!defender)
|
||||
return;
|
||||
|
||||
// so ahhh the angle you can riposte is larger than the angle you can hit :P
|
||||
if (!defender->IsFacingMob(this)) {
|
||||
defender->Message_StringID(MT_TooFarAway, CANT_SEE_TARGET);
|
||||
defender->MessageString(Chat::TooFarAway, CANT_SEE_TARGET);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4465,8 +4443,7 @@ void Mob::DoRiposte(Mob *defender)
|
||||
defender->itembonuses.DoubleRiposte;
|
||||
|
||||
if (DoubleRipChance && zone->random.Roll(DoubleRipChance)) {
|
||||
Log(Logs::Detail, Logs::Combat,
|
||||
"Preforming a double riposted from SE_DoubleRiposte (%d percent chance)", DoubleRipChance);
|
||||
LogCombat("Preforming a double riposted from SE_DoubleRiposte ([{}] percent chance)", DoubleRipChance);
|
||||
defender->Attack(this, EQEmu::invslot::slotPrimary, true);
|
||||
if (HasDied())
|
||||
return;
|
||||
@@ -4477,9 +4454,7 @@ void Mob::DoRiposte(Mob *defender)
|
||||
|
||||
// Live AA - Double Riposte
|
||||
if (DoubleRipChance && zone->random.Roll(DoubleRipChance)) {
|
||||
Log(Logs::Detail, Logs::Combat,
|
||||
"Preforming a double riposted from SE_GiveDoubleRiposte base1 == 0 (%d percent chance)",
|
||||
DoubleRipChance);
|
||||
LogCombat("Preforming a double riposted from SE_GiveDoubleRiposte base1 == 0 ([{}] percent chance)", DoubleRipChance);
|
||||
defender->Attack(this, EQEmu::invslot::slotPrimary, true);
|
||||
if (HasDied())
|
||||
return;
|
||||
@@ -4491,8 +4466,7 @@ void Mob::DoRiposte(Mob *defender)
|
||||
DoubleRipChance = defender->aabonuses.GiveDoubleRiposte[1];
|
||||
|
||||
if (DoubleRipChance && zone->random.Roll(DoubleRipChance)) {
|
||||
Log(Logs::Detail, Logs::Combat, "Preforming a return SPECIAL ATTACK (%d percent chance)",
|
||||
DoubleRipChance);
|
||||
LogCombat("Preforming a return SPECIAL ATTACK ([{}] percent chance)", DoubleRipChance);
|
||||
|
||||
if (defender->GetClass() == MONK)
|
||||
defender->MonkSpecialAttack(this, defender->aabonuses.GiveDoubleRiposte[2]);
|
||||
@@ -4513,7 +4487,9 @@ void Mob::ApplyMeleeDamageMods(uint16 skill, int &damage, Mob *defender, ExtraAt
|
||||
if (defender->IsClient() && defender->GetClass() == WARRIOR)
|
||||
dmgbonusmod -= 5;
|
||||
// 168 defensive
|
||||
dmgbonusmod += (defender->spellbonuses.MeleeMitigationEffect + itembonuses.MeleeMitigationEffect + aabonuses.MeleeMitigationEffect);
|
||||
dmgbonusmod += (defender->spellbonuses.MeleeMitigationEffect +
|
||||
defender->itembonuses.MeleeMitigationEffect +
|
||||
defender->aabonuses.MeleeMitigationEffect);
|
||||
}
|
||||
|
||||
damage += damage * dmgbonusmod / 100;
|
||||
@@ -4713,7 +4689,7 @@ void Mob::TrySkillProc(Mob *on, uint16 skill, uint16 ReuseTime, bool Success, ui
|
||||
|
||||
if (!on) {
|
||||
SetTarget(nullptr);
|
||||
Log(Logs::General, Logs::Error, "A null Mob object was passed to Mob::TrySkillProc for evaluation!");
|
||||
LogError("A null Mob object was passed to Mob::TrySkillProc for evaluation!");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4944,13 +4920,13 @@ bool Mob::TryRootFadeByDamage(int buffslot, Mob* attacker) {
|
||||
|
||||
if (!TryFadeEffect(spellbonuses.Root[1])) {
|
||||
BuffFadeBySlot(spellbonuses.Root[1]);
|
||||
Log(Logs::Detail, Logs::Combat, "Spell broke root! BreakChance percent chance");
|
||||
LogCombat("Spell broke root! BreakChance percent chance");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Log(Logs::Detail, Logs::Combat, "Spell did not break root. BreakChance percent chance");
|
||||
LogCombat("Spell did not break root. BreakChance percent chance");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -5039,7 +5015,7 @@ void Mob::CommonOutgoingHitSuccess(Mob* defender, DamageHitInfo &hit, ExtraAttac
|
||||
else if (GetClass() == RANGER && GetLevel() > 50) { // no double dmg on headshot
|
||||
if ((defender->IsNPC() && !defender->IsMoving() && !defender->IsRooted()) || !RuleB(Combat, ArcheryBonusRequiresStationary)) {
|
||||
hit.damage_done *= 2;
|
||||
Message_StringID(MT_CritMelee, BOW_DOUBLE_DAMAGE);
|
||||
MessageString(Chat::MeleeCrit, BOW_DOUBLE_DAMAGE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5126,19 +5102,19 @@ void Mob::CommonBreakInvisibleFromCombat()
|
||||
{
|
||||
//break invis when you attack
|
||||
if (invisible) {
|
||||
Log(Logs::Detail, Logs::Combat, "Removing invisibility due to melee attack.");
|
||||
LogCombat("Removing invisibility due to melee attack");
|
||||
BuffFadeByEffect(SE_Invisibility);
|
||||
BuffFadeByEffect(SE_Invisibility2);
|
||||
invisible = false;
|
||||
}
|
||||
if (invisible_undead) {
|
||||
Log(Logs::Detail, Logs::Combat, "Removing invisibility vs. undead due to melee attack.");
|
||||
LogCombat("Removing invisibility vs. undead due to melee attack");
|
||||
BuffFadeByEffect(SE_InvisVsUndead);
|
||||
BuffFadeByEffect(SE_InvisVsUndead2);
|
||||
invisible_undead = false;
|
||||
}
|
||||
if (invisible_animals) {
|
||||
Log(Logs::Detail, Logs::Combat, "Removing invisibility vs. animals due to melee attack.");
|
||||
LogCombat("Removing invisibility vs. animals due to melee attack");
|
||||
BuffFadeByEffect(SE_InvisVsAnimals);
|
||||
invisible_animals = false;
|
||||
}
|
||||
@@ -5344,7 +5320,7 @@ void Client::DoAttackRounds(Mob *target, int hand, bool IsFromSpell)
|
||||
Attack(target, hand, false, false, IsFromSpell);
|
||||
if (zone->random.Roll(flurrychance))
|
||||
Attack(target, hand, false, false, IsFromSpell);
|
||||
Message_StringID(MT_NPCFlurry, YOU_FLURRY);
|
||||
MessageString(Chat::NPCFlurry, YOU_FLURRY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+11
-15
@@ -7,7 +7,7 @@
|
||||
|
||||
Aura::Aura(NPCType *type_data, Mob *owner, AuraRecord &record)
|
||||
: NPC(type_data, 0, owner->GetPosition(), GravityBehavior::Flying), spell_id(record.spell_id), distance(record.distance),
|
||||
remove_timer(record.duration), movement_timer(100), process_timer(100), aura_id(-1)
|
||||
remove_timer(record.duration), movement_timer(100), process_timer(1000), aura_id(-1)
|
||||
{
|
||||
GiveNPCTypeData(type_data); // we will delete this later on
|
||||
m_owner = owner->GetID();
|
||||
@@ -710,14 +710,14 @@ void Mob::MakeAura(uint16 spell_id)
|
||||
|
||||
AuraRecord record;
|
||||
if (!database.GetAuraEntry(spell_id, record)) {
|
||||
Message(13, "Unable to find data for aura %s", spells[spell_id].name);
|
||||
Log(Logs::General, Logs::Error, "Unable to find data for aura %d, check auras table.", spell_id);
|
||||
Message(Chat::Red, "Unable to find data for aura %s", spells[spell_id].name);
|
||||
LogError("Unable to find data for aura [{}], check auras table", spell_id);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IsValidSpell(record.spell_id)) {
|
||||
Message(13, "Casted spell (%d) is not valid for aura %s", record.spell_id, spells[spell_id].name);
|
||||
Log(Logs::General, Logs::Error, "Casted spell (%d) is not valid for aura %d, check auras table.",
|
||||
Message(Chat::Red, "Casted spell (%d) is not valid for aura %s", record.spell_id, spells[spell_id].name);
|
||||
LogError("Casted spell ([{}]) is not valid for aura [{}], check auras table",
|
||||
record.spell_id, spell_id);
|
||||
return;
|
||||
}
|
||||
@@ -744,10 +744,8 @@ void Mob::MakeAura(uint16 spell_id)
|
||||
|
||||
const auto base = database.LoadNPCTypesData(record.npc_type);
|
||||
if (base == nullptr) {
|
||||
Message(13, "Unable to load NPC data for aura %s", spells[spell_id].teleport_zone);
|
||||
Log(Logs::General, Logs::Error,
|
||||
"Unable to load NPC data for aura %s (NPC ID %d), check auras and npc_types tables.",
|
||||
spells[spell_id].teleport_zone, record.npc_type);
|
||||
Message(Chat::Red, "Unable to load NPC data for aura %s", spells[spell_id].teleport_zone);
|
||||
LogError("Unable to load NPC data for aura [{}] (NPC ID [{}]), check auras and npc_types tables", spells[spell_id].teleport_zone, record.npc_type);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -841,10 +839,10 @@ void Mob::AddTrap(Aura *aura, AuraRecord &record)
|
||||
bool Mob::CanSpawnAura(bool trap)
|
||||
{
|
||||
if (trap && !HasFreeTrapSlots()) {
|
||||
Message_StringID(MT_SpellFailure, NO_MORE_TRAPS);
|
||||
MessageString(Chat::SpellFailure, NO_MORE_TRAPS);
|
||||
return false;
|
||||
} else if (!trap && !HasFreeAuraSlots()) {
|
||||
Message_StringID(MT_SpellFailure, NO_MORE_AURAS);
|
||||
MessageString(Chat::SpellFailure, NO_MORE_AURAS);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -878,8 +876,6 @@ void Mob::RemoveAllAuras()
|
||||
}
|
||||
|
||||
trap_mgr.count = 0;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void Mob::RemoveAura(int spawn_id, bool skip_strip, bool expired)
|
||||
@@ -891,7 +887,7 @@ void Mob::RemoveAura(int spawn_id, bool skip_strip, bool expired)
|
||||
aura.aura->Depop(skip_strip);
|
||||
if (expired && IsClient()) {
|
||||
CastToClient()->SendColoredText(
|
||||
CC_Yellow, StringFormat("%s has expired.", aura.name)); // TODO: verify color
|
||||
Chat::Yellow, StringFormat("%s has expired.", aura.name)); // TODO: verify color
|
||||
// need to update client UI too
|
||||
auto app = new EQApplicationPacket(OP_UpdateAura, sizeof(AuraDestory_Struct));
|
||||
auto ads = (AuraDestory_Struct *)app->pBuffer;
|
||||
@@ -920,7 +916,7 @@ void Mob::RemoveAura(int spawn_id, bool skip_strip, bool expired)
|
||||
aura.aura->Depop(skip_strip);
|
||||
if (expired && IsClient())
|
||||
CastToClient()->SendColoredText(
|
||||
CC_Yellow, StringFormat("%s has expired.", aura.name)); // TODO: verify color
|
||||
Chat::Yellow, StringFormat("%s has expired.", aura.name)); // TODO: verify color
|
||||
while (trap_mgr.count - 1 > i) {
|
||||
i++;
|
||||
aura.spawn_id = trap_mgr.auras[i].spawn_id;
|
||||
|
||||
+1
-1
@@ -56,7 +56,7 @@ Beacon::Beacon(Mob *at_mob, int lifetime)
|
||||
:Mob
|
||||
(
|
||||
nullptr, nullptr, 0, 0, 0, INVISIBLE_MAN, 0, BT_NoTarget, 0, 0, 0, 0, 0, at_mob->GetPosition(), 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, EQEmu::TintProfile(), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, EQEmu::TintProfile(), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
),
|
||||
remove_timer(lifetime),
|
||||
spell_timer(0)
|
||||
|
||||
+30
-7
@@ -663,7 +663,7 @@ void Mob::ApplyAABonuses(const AA::Rank &rank, StatBonuses *newbon)
|
||||
effect == SE_StackingCommand_Overwrite)
|
||||
continue;
|
||||
|
||||
Log(Logs::Detail, Logs::AA, "Applying Effect %d from AA %u in slot %d (base1: %d, base2: %d) on %s",
|
||||
LogAA("Applying Effect [{}] from AA [{}] in slot [{}] (base1: [{}], base2: [{}]) on [{}]",
|
||||
effect, rank.id, slot, base1, base2, GetCleanName());
|
||||
|
||||
uint8 focus = IsFocusEffect(0, 0, true, effect);
|
||||
@@ -1205,8 +1205,12 @@ void Mob::ApplyAABonuses(const AA::Rank &rank, StatBonuses *newbon)
|
||||
break;
|
||||
}
|
||||
|
||||
case SE_CastingLevel2:
|
||||
case SE_CastingLevel: {
|
||||
newbon->adjusted_casting_skill += base1;
|
||||
break;
|
||||
}
|
||||
|
||||
case SE_CastingLevel2: {
|
||||
newbon->effective_casting_level += base1;
|
||||
break;
|
||||
}
|
||||
@@ -1472,6 +1476,17 @@ void Mob::ApplyAABonuses(const AA::Rank &rank, StatBonuses *newbon)
|
||||
newbon->trap_slots += base1;
|
||||
break;
|
||||
|
||||
case SE_ForageSkill:
|
||||
newbon->GrantForage += base1;
|
||||
// we need to grant a skill point here
|
||||
// I'd rather not do this here, but whatever, probably fine
|
||||
if (IsClient()) {
|
||||
auto client = CastToClient();
|
||||
if (client->GetRawSkill(EQEmu::skills::SkillType::SkillForage) == 0)
|
||||
client->SetSkill(EQEmu::skills::SkillType::SkillForage, 1);
|
||||
}
|
||||
break;
|
||||
|
||||
// to do
|
||||
case SE_PetDiscipline:
|
||||
break;
|
||||
@@ -1479,8 +1494,6 @@ void Mob::ApplyAABonuses(const AA::Rank &rank, StatBonuses *newbon)
|
||||
break;
|
||||
case SE_BandolierSlots:
|
||||
break;
|
||||
case SE_ForageSkill:
|
||||
break;
|
||||
case SE_SecondaryForte:
|
||||
break;
|
||||
case SE_ExtendedShielding:
|
||||
@@ -1524,7 +1537,7 @@ void Mob::ApplyAABonuses(const AA::Rank &rank, StatBonuses *newbon)
|
||||
break;
|
||||
|
||||
default:
|
||||
Log(Logs::Detail, Logs::AA, "SPA %d not accounted for in AA %s (%d)", effect, rank.base_ability->name.c_str(), rank.id);
|
||||
LogAA("SPA [{}] not accounted for in AA [{}] ([{}])", effect, rank.base_ability->name.c_str(), rank.id);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1905,8 +1918,13 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses *ne
|
||||
break;
|
||||
}
|
||||
|
||||
case SE_CastingLevel2:
|
||||
case SE_CastingLevel: // Brilliance of Ro
|
||||
{
|
||||
new_bonus->adjusted_casting_skill += effect_value;
|
||||
break;
|
||||
}
|
||||
|
||||
case SE_CastingLevel2:
|
||||
{
|
||||
new_bonus->effective_casting_level += effect_value;
|
||||
break;
|
||||
@@ -3841,8 +3859,13 @@ void Mob::NegateSpellsBonuses(uint16 spell_id)
|
||||
aabonuses.Corrup = effect_value;
|
||||
break;
|
||||
|
||||
case SE_CastingLevel2:
|
||||
case SE_CastingLevel: // Brilliance of Ro
|
||||
spellbonuses.adjusted_casting_skill = effect_value;
|
||||
aabonuses.adjusted_casting_skill = effect_value;
|
||||
itembonuses.adjusted_casting_skill = effect_value;
|
||||
break;
|
||||
|
||||
case SE_CastingLevel2:
|
||||
spellbonuses.effective_casting_level = effect_value;
|
||||
aabonuses.effective_casting_level = effect_value;
|
||||
itembonuses.effective_casting_level = effect_value;
|
||||
|
||||
+243
-211
File diff suppressed because it is too large.
Load diff
+48
-111
@@ -29,7 +29,6 @@
|
||||
#include "groups.h"
|
||||
#include "corpse.h"
|
||||
#include "zonedb.h"
|
||||
#include "bot_database.h"
|
||||
#include "string_ids.h"
|
||||
#include "../common/misc_functions.h"
|
||||
#include "../common/global_define.h"
|
||||
@@ -54,91 +53,7 @@ const int MaxDisciplineTimer = 10;
|
||||
const int DisciplineReuseStart = MaxSpellTimer + 1;
|
||||
const int MaxTimer = MaxSpellTimer + MaxDisciplineTimer;
|
||||
|
||||
enum BotStanceType {
|
||||
BotStancePassive,
|
||||
BotStanceBalanced,
|
||||
BotStanceEfficient,
|
||||
BotStanceReactive,
|
||||
BotStanceAggressive,
|
||||
BotStanceBurn,
|
||||
BotStanceBurnAE,
|
||||
BotStanceUnknown,
|
||||
MaxStances = BotStanceUnknown
|
||||
};
|
||||
|
||||
#define BOT_STANCE_COUNT 8
|
||||
#define VALIDBOTSTANCE(x) ((x >= (int)BotStancePassive && x <= (int)BotStanceBurnAE) ? ((BotStanceType)x) : (BotStanceUnknown))
|
||||
|
||||
static const std::string bot_stance_name[BOT_STANCE_COUNT] = {
|
||||
"Passive", // 0
|
||||
"Balanced", // 1
|
||||
"Efficient", // 2
|
||||
"Reactive", // 3
|
||||
"Aggressive", // 4
|
||||
"Burn", // 5
|
||||
"BurnAE", // 6
|
||||
"Unknown" // 7
|
||||
};
|
||||
|
||||
static const char* GetBotStanceName(int stance_id) { return bot_stance_name[VALIDBOTSTANCE(stance_id)].c_str(); }
|
||||
|
||||
#define VALIDBOTEQUIPSLOT(x) ((x >= EQEmu::invslot::EQUIPMENT_BEGIN && x <= EQEmu::invslot::EQUIPMENT_END) ? (x) : (EQEmu::invslot::EQUIPMENT_COUNT))
|
||||
|
||||
static const std::string bot_equip_slot_name[EQEmu::invslot::EQUIPMENT_COUNT + 1] =
|
||||
{
|
||||
"Charm", // slotCharm
|
||||
"Ear 1", // slotEar1
|
||||
"Head", // slotHead
|
||||
"Face", // slotFace
|
||||
"Ear 2", // slotEar2
|
||||
"Neck", // slotNeck
|
||||
"Shoulders", // slotShoulders
|
||||
"Arms", // slotArms
|
||||
"Back", // slotBack
|
||||
"Wrist 1", // slotWrist1
|
||||
"Wrist 2", // slotWrist2
|
||||
"Range", // slotRange
|
||||
"Hands", // slotHands
|
||||
"Primary", // slotPrimary
|
||||
"Secondary", // slotSecondary
|
||||
"Finger 1", // slotFinger1
|
||||
"Finger 2", // slotFinger2
|
||||
"Chest", // slotChest
|
||||
"Legs", // slotLegs
|
||||
"Feet", // slotFeet
|
||||
"Waist", // slotWaist
|
||||
"Power Source", // slotPowerSource
|
||||
"Ammo", // slotAmmo
|
||||
"Unknown"
|
||||
};
|
||||
|
||||
static const char* GetBotEquipSlotName(int slot_id) { return bot_equip_slot_name[VALIDBOTEQUIPSLOT(slot_id)].c_str(); }
|
||||
|
||||
enum SpellTypeIndex {
|
||||
SpellType_NukeIndex,
|
||||
SpellType_HealIndex,
|
||||
SpellType_RootIndex,
|
||||
SpellType_BuffIndex,
|
||||
SpellType_EscapeIndex,
|
||||
SpellType_PetIndex,
|
||||
SpellType_LifetapIndex,
|
||||
SpellType_SnareIndex,
|
||||
SpellType_DOTIndex,
|
||||
SpellType_DispelIndex,
|
||||
SpellType_InCombatBuffIndex,
|
||||
SpellType_MezIndex,
|
||||
SpellType_CharmIndex,
|
||||
SpellType_SlowIndex,
|
||||
SpellType_DebuffIndex,
|
||||
SpellType_CureIndex,
|
||||
SpellType_ResurrectIndex,
|
||||
SpellType_HateReduxIndex,
|
||||
SpellType_InCombatBuffSongIndex,
|
||||
SpellType_OutOfCombatBuffSongIndex,
|
||||
SpellType_PreCombatBuffIndex,
|
||||
SpellType_PreCombatBuffSongIndex,
|
||||
MaxSpellTypes
|
||||
};
|
||||
|
||||
// nHSND negative Healer/Slower/Nuker/Doter
|
||||
// pH positive Healer
|
||||
@@ -228,29 +143,35 @@ public:
|
||||
BotRoleRaidHealer
|
||||
};
|
||||
|
||||
enum EqExpansions { // expansions are off..EQ should be '0'
|
||||
ExpansionNone,
|
||||
ExpansionEQ,
|
||||
ExpansionRoK,
|
||||
ExpansionSoV,
|
||||
ExpansionSoL,
|
||||
ExpansionPoP,
|
||||
ExpansionLoY,
|
||||
ExpansionLDoN,
|
||||
ExpansionGoD,
|
||||
ExpansionOoW,
|
||||
ExpansionDoN,
|
||||
ExpansionDoDH,
|
||||
ExpansionPoR,
|
||||
ExpansionTSS,
|
||||
ExpansionSoF,
|
||||
ExpansionSoD,
|
||||
ExpansionUF,
|
||||
ExpansionHoT,
|
||||
ExpansionVoA,
|
||||
ExpansionRoF
|
||||
enum SpellTypeIndex : uint32 {
|
||||
spellTypeIndexNuke,
|
||||
spellTypeIndexHeal,
|
||||
spellTypeIndexRoot,
|
||||
spellTypeIndexBuff,
|
||||
spellTypeIndexEscape,
|
||||
spellTypeIndexPet,
|
||||
spellTypeIndexLifetap,
|
||||
spellTypeIndexSnare,
|
||||
spellTypeIndexDot,
|
||||
spellTypeIndexDispel,
|
||||
spellTypeIndexInCombatBuff,
|
||||
spellTypeIndexMez,
|
||||
spellTypeIndexCharm,
|
||||
spellTypeIndexSlow,
|
||||
spellTypeIndexDebuff,
|
||||
spellTypeIndexCure,
|
||||
spellTypeIndexResurrect,
|
||||
spellTypeIndexHateRedux,
|
||||
spellTypeIndexInCombatBuffSong,
|
||||
spellTypeIndexOutOfCombatBuffSong,
|
||||
spellTypeIndexPreCombatBuff,
|
||||
spellTypeIndexPreCombatBuffSong
|
||||
};
|
||||
|
||||
static const uint32 SPELL_TYPE_FIRST = spellTypeIndexNuke;
|
||||
static const uint32 SPELL_TYPE_LAST = spellTypeIndexPreCombatBuffSong;
|
||||
static const uint32 SPELL_TYPE_COUNT = SPELL_TYPE_LAST + 1;
|
||||
|
||||
// Class Constructors
|
||||
Bot(NPCType *npcTypeData, Client* botOwner);
|
||||
Bot(uint32 botID, uint32 botOwnerCharacterID, uint32 botSpellsID, double totalPlayTime, uint32 lastZoneId, NPCType *npcTypeData);
|
||||
@@ -349,7 +270,12 @@ public:
|
||||
bool GetNeedsHateRedux(Mob *tar);
|
||||
bool HasOrMayGetAggro();
|
||||
void SetDefaultBotStance();
|
||||
|
||||
void SetSurname(std::string bot_surname);
|
||||
void SetTitle(std::string bot_title);
|
||||
void SetSuffix(std::string bot_suffix);
|
||||
std::string GetSurname() { return _surname; }
|
||||
std::string GetTitle() { return _title; }
|
||||
std::string GetSuffix() { return _suffix; }
|
||||
inline virtual int32 GetMaxStat();
|
||||
inline virtual int32 GetMaxResist();
|
||||
inline virtual int32 GetMaxSTR();
|
||||
@@ -519,7 +445,7 @@ public:
|
||||
virtual bool IsBot() const { return true; }
|
||||
bool GetRangerAutoWeaponSelect() { return _rangerAutoWeaponSelect; }
|
||||
BotRoleType GetBotRole() { return _botRole; }
|
||||
BotStanceType GetBotStance() { return _botStance; }
|
||||
EQEmu::constants::StanceType GetBotStance() { return _botStance; }
|
||||
uint8 GetChanceToCastBySpellType(uint32 spellType);
|
||||
|
||||
bool IsGroupHealer() { return m_CastingRoles.GroupHealer; }
|
||||
@@ -633,7 +559,12 @@ public:
|
||||
// void SetBotOwnerCharacterID(uint32 botOwnerCharacterID) { _botOwnerCharacterID = botOwnerCharacterID; }
|
||||
void SetRangerAutoWeaponSelect(bool enable) { GetClass() == RANGER ? _rangerAutoWeaponSelect = enable : _rangerAutoWeaponSelect = false; }
|
||||
void SetBotRole(BotRoleType botRole) { _botRole = botRole; }
|
||||
void SetBotStance(BotStanceType botStance) { _botStance = ((botStance != BotStanceUnknown) ? (botStance) : (BotStancePassive)); }
|
||||
void SetBotStance(EQEmu::constants::StanceType botStance) {
|
||||
if (botStance >= EQEmu::constants::stancePassive && botStance <= EQEmu::constants::stanceBurnAE)
|
||||
_botStance = botStance;
|
||||
else
|
||||
_botStance = EQEmu::constants::stancePassive;
|
||||
}
|
||||
void SetSpellRecastTimer(int timer_index, int32 recast_delay);
|
||||
void SetDisciplineRecastTimer(int timer_index, int32 recast_delay);
|
||||
void SetAltOutOfCombatBehavior(bool behavior_flag) { _altoutofcombatbehavior = behavior_flag;}
|
||||
@@ -724,11 +655,14 @@ private:
|
||||
uint32 _guildId;
|
||||
uint8 _guildRank;
|
||||
std::string _guildName;
|
||||
std::string _surname;
|
||||
std::string _title;
|
||||
std::string _suffix;
|
||||
uint32 _lastZoneId;
|
||||
bool _rangerAutoWeaponSelect;
|
||||
BotRoleType _botRole;
|
||||
BotStanceType _botStance;
|
||||
BotStanceType _baseBotStance;
|
||||
EQEmu::constants::StanceType _botStance;
|
||||
EQEmu::constants::StanceType _baseBotStance;
|
||||
unsigned int RestRegenHP;
|
||||
unsigned int RestRegenMana;
|
||||
unsigned int RestRegenEndurance;
|
||||
@@ -792,6 +726,9 @@ private:
|
||||
bool LoadPet(); // Load and spawn bot pet if there is one
|
||||
bool SavePet(); // Save and depop bot pet if there is one
|
||||
bool DeletePet();
|
||||
|
||||
public:
|
||||
static uint8 spell_casting_chances[SPELL_TYPE_COUNT][PLAYER_CLASS_COUNT][EQEmu::constants::STANCE_TYPE_COUNT][cntHSND];
|
||||
};
|
||||
|
||||
#endif // BOTS
|
||||
|
||||
+583
-180
File diff suppressed because it is too large.
Load diff
@@ -614,8 +614,11 @@ void bot_subcommand_bot_report(Client *c, const Seperator *sep);
|
||||
void bot_subcommand_bot_spawn(Client *c, const Seperator *sep);
|
||||
void bot_subcommand_bot_stance(Client *c, const Seperator *sep);
|
||||
void bot_subcommand_bot_stop_melee_level(Client *c, const Seperator *sep);
|
||||
void bot_subcommand_bot_suffix(Client *c, const Seperator *sep);
|
||||
void bot_subcommand_bot_summon(Client *c, const Seperator *sep);
|
||||
void bot_subcommand_bot_surname(Client *c, const Seperator *sep);
|
||||
void bot_subcommand_bot_tattoo(Client *c, const Seperator *sep);
|
||||
void bot_subcommand_bot_title(Client *c, const Seperator *sep);
|
||||
void bot_subcommand_bot_toggle_archer(Client *c, const Seperator *sep);
|
||||
void bot_subcommand_bot_toggle_helm(Client *c, const Seperator *sep);
|
||||
void bot_subcommand_bot_update(Client *c, const Seperator *sep);
|
||||
@@ -652,6 +655,7 @@ void bot_subcommand_inventory_give(Client *c, const Seperator *sep);
|
||||
void bot_subcommand_inventory_list(Client *c, const Seperator *sep);
|
||||
void bot_subcommand_inventory_remove(Client *c, const Seperator *sep);
|
||||
void bot_subcommand_inventory_window(Client *c, const Seperator *sep);
|
||||
void bot_subcommand_pet_get_lost(Client *c, const Seperator *sep);
|
||||
void bot_subcommand_pet_remove(Client *c, const Seperator *sep);
|
||||
void bot_subcommand_pet_set_type(Client *c, const Seperator *sep);
|
||||
void bot_subcommand_portal(Client *c, const Seperator *sep);
|
||||
|
||||
+253
-171
File diff suppressed because it is too large.
Load diff
+9
-16
@@ -22,17 +22,15 @@
|
||||
|
||||
#ifdef BOTS
|
||||
|
||||
#include "../common/dbcore.h"
|
||||
#include "../common/eq_packet_structs.h"
|
||||
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
|
||||
class Bot;
|
||||
struct BotsAvailableList;
|
||||
class Client;
|
||||
struct BotsAvailableList;
|
||||
struct InspectMessage_Struct;
|
||||
|
||||
namespace EQEmu
|
||||
{
|
||||
@@ -41,16 +39,12 @@ namespace EQEmu
|
||||
}
|
||||
|
||||
|
||||
class BotDatabase : public DBcore
|
||||
class BotDatabase
|
||||
{
|
||||
public:
|
||||
BotDatabase();
|
||||
BotDatabase(const char* host, const char* user, const char* passwd, const char* database, uint32 port);
|
||||
virtual ~BotDatabase();
|
||||
|
||||
bool Connect(const char* host, const char* user, const char* passwd, const char* database, uint32 port);
|
||||
|
||||
bool LoadBotCommandSettings(std::map<std::string, std::pair<uint8, std::vector<std::string>>> &bot_command_settings);
|
||||
bool UpdateInjectedBotCommandSettings(const std::vector<std::pair<std::string, uint8>> &injected);
|
||||
bool UpdateOrphanedBotCommandSettings(const std::vector<std::string> &orphaned);
|
||||
bool LoadBotSpellCastingChances();
|
||||
|
||||
|
||||
@@ -58,7 +52,7 @@ public:
|
||||
bool QueryNameAvailablity(const std::string& bot_name, bool& available_flag);
|
||||
bool QueryBotCount(const uint32 owner_id, uint32& bot_count);
|
||||
bool LoadQuestableSpawnCount(const uint32 owner_id, int& spawn_count);
|
||||
bool LoadBotsList(const uint32 owner_id, std::list<BotsAvailableList>& bots_list);
|
||||
bool LoadBotsList(const uint32 owner_id, std::list<BotsAvailableList>& bots_list, bool ByAccount = false);
|
||||
|
||||
bool LoadOwnerID(const std::string& bot_name, uint32& owner_id);
|
||||
bool LoadOwnerID(const uint32 bot_id, uint32& owner_id);
|
||||
@@ -147,8 +141,9 @@ public:
|
||||
bool SaveStopMeleeLevel(const uint32 owner_id, const uint32 bot_id, const uint8 sml_value);
|
||||
|
||||
bool LoadOwnerOptions(Client *owner);
|
||||
bool SaveOwnerOptionDeathMarquee(const uint32 owner_id, const bool flag);
|
||||
|
||||
bool SaveOwnerOption(const uint32 owner_id, size_t type, const bool flag);
|
||||
bool SaveOwnerOption(const uint32 owner_id, const std::pair<size_t, size_t> type, const std::pair<bool, bool> flag);
|
||||
|
||||
/* Bot bot-group functions */
|
||||
bool QueryBotGroupExistence(const std::string& botgroup_name, bool& extant_flag);
|
||||
|
||||
@@ -296,8 +291,6 @@ public:
|
||||
std::string query;
|
||||
};
|
||||
|
||||
extern BotDatabase botdb;
|
||||
|
||||
#endif
|
||||
|
||||
#endif // BOTS
|
||||
@@ -32,6 +32,8 @@ struct BotsAvailableList {
|
||||
uint8 Level;
|
||||
uint16 Race;
|
||||
uint8 Gender;
|
||||
char Owner[64];
|
||||
uint32 Owner_ID;
|
||||
};
|
||||
|
||||
struct BotGroup {
|
||||
|
||||
+88
-89
@@ -192,25 +192,24 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint32 iSpellTypes) {
|
||||
else {
|
||||
float hpRatioToCast = 0.0f;
|
||||
|
||||
switch(this->GetBotStance())
|
||||
{
|
||||
case BotStanceEfficient:
|
||||
case BotStanceAggressive:
|
||||
hpRatioToCast = isPrimaryHealer?90.0f:50.0f;
|
||||
break;
|
||||
case BotStanceBalanced:
|
||||
hpRatioToCast = isPrimaryHealer?95.0f:75.0f;
|
||||
break;
|
||||
case BotStanceReactive:
|
||||
hpRatioToCast = isPrimaryHealer?100.0f:90.0f;
|
||||
break;
|
||||
case BotStanceBurn:
|
||||
case BotStanceBurnAE:
|
||||
hpRatioToCast = isPrimaryHealer?75.0f:25.0f;
|
||||
break;
|
||||
default:
|
||||
hpRatioToCast = isPrimaryHealer?100.0f:0.0f;
|
||||
break;
|
||||
switch(this->GetBotStance()) {
|
||||
case EQEmu::constants::stanceEfficient:
|
||||
case EQEmu::constants::stanceAggressive:
|
||||
hpRatioToCast = isPrimaryHealer?90.0f:50.0f;
|
||||
break;
|
||||
case EQEmu::constants::stanceBalanced:
|
||||
hpRatioToCast = isPrimaryHealer?95.0f:75.0f;
|
||||
break;
|
||||
case EQEmu::constants::stanceReactive:
|
||||
hpRatioToCast = isPrimaryHealer?100.0f:90.0f;
|
||||
break;
|
||||
case EQEmu::constants::stanceBurn:
|
||||
case EQEmu::constants::stanceBurnAE:
|
||||
hpRatioToCast = isPrimaryHealer?75.0f:25.0f;
|
||||
break;
|
||||
default:
|
||||
hpRatioToCast = isPrimaryHealer?100.0f:0.0f;
|
||||
break;
|
||||
}
|
||||
|
||||
//If we're at specified mana % or below, don't heal as hybrid
|
||||
@@ -381,23 +380,22 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint32 iSpellTypes) {
|
||||
{
|
||||
float manaRatioToCast = 75.0f;
|
||||
|
||||
switch(this->GetBotStance())
|
||||
{
|
||||
case BotStanceEfficient:
|
||||
manaRatioToCast = 90.0f;
|
||||
break;
|
||||
case BotStanceBalanced:
|
||||
case BotStanceAggressive:
|
||||
manaRatioToCast = 75.0f;
|
||||
break;
|
||||
case BotStanceReactive:
|
||||
case BotStanceBurn:
|
||||
case BotStanceBurnAE:
|
||||
manaRatioToCast = 50.0f;
|
||||
break;
|
||||
default:
|
||||
manaRatioToCast = 75.0f;
|
||||
break;
|
||||
switch(this->GetBotStance()) {
|
||||
case EQEmu::constants::stanceEfficient:
|
||||
manaRatioToCast = 90.0f;
|
||||
break;
|
||||
case EQEmu::constants::stanceBalanced:
|
||||
case EQEmu::constants::stanceAggressive:
|
||||
manaRatioToCast = 75.0f;
|
||||
break;
|
||||
case EQEmu::constants::stanceReactive:
|
||||
case EQEmu::constants::stanceBurn:
|
||||
case EQEmu::constants::stanceBurnAE:
|
||||
manaRatioToCast = 50.0f;
|
||||
break;
|
||||
default:
|
||||
manaRatioToCast = 75.0f;
|
||||
break;
|
||||
}
|
||||
|
||||
//If we're at specified mana % or below, don't rune as enchanter
|
||||
@@ -461,25 +459,24 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint32 iSpellTypes) {
|
||||
{
|
||||
float manaRatioToCast = 75.0f;
|
||||
|
||||
switch(this->GetBotStance())
|
||||
{
|
||||
case BotStanceEfficient:
|
||||
manaRatioToCast = 90.0f;
|
||||
break;
|
||||
case BotStanceBalanced:
|
||||
manaRatioToCast = 75.0f;
|
||||
break;
|
||||
case BotStanceReactive:
|
||||
case BotStanceAggressive:
|
||||
manaRatioToCast = 50.0f;
|
||||
break;
|
||||
case BotStanceBurn:
|
||||
case BotStanceBurnAE:
|
||||
manaRatioToCast = 25.0f;
|
||||
break;
|
||||
default:
|
||||
manaRatioToCast = 50.0f;
|
||||
break;
|
||||
switch(this->GetBotStance()) {
|
||||
case EQEmu::constants::stanceEfficient:
|
||||
manaRatioToCast = 90.0f;
|
||||
break;
|
||||
case EQEmu::constants::stanceBalanced:
|
||||
manaRatioToCast = 75.0f;
|
||||
break;
|
||||
case EQEmu::constants::stanceReactive:
|
||||
case EQEmu::constants::stanceAggressive:
|
||||
manaRatioToCast = 50.0f;
|
||||
break;
|
||||
case EQEmu::constants::stanceBurn:
|
||||
case EQEmu::constants::stanceBurnAE:
|
||||
manaRatioToCast = 25.0f;
|
||||
break;
|
||||
default:
|
||||
manaRatioToCast = 50.0f;
|
||||
break;
|
||||
}
|
||||
|
||||
//If we're at specified mana % or below, don't nuke as cleric or enchanter
|
||||
@@ -1137,7 +1134,7 @@ bool Bot::AI_PursueCastCheck() {
|
||||
|
||||
AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting.
|
||||
|
||||
Log(Logs::Detail, Logs::AI, "Bot Engaged (pursuing) autocast check triggered. Trying to cast offensive spells.");
|
||||
LogAI("Bot Engaged (pursuing) autocast check triggered. Trying to cast offensive spells");
|
||||
|
||||
if(!AICastSpell(GetTarget(), 100, SpellType_Snare)) {
|
||||
if(!AICastSpell(GetTarget(), 100, SpellType_Lifetap)) {
|
||||
@@ -1165,7 +1162,7 @@ bool Bot::AI_IdleCastCheck() {
|
||||
|
||||
if (AIautocastspell_timer->Check(false)) {
|
||||
#if BotAI_DEBUG_Spells >= 25
|
||||
Log(Logs::Detail, Logs::AI, "Bot Non-Engaged autocast check triggered: %s", this->GetCleanName());
|
||||
LogAI("Bot Non-Engaged autocast check triggered: [{}]", this->GetCleanName());
|
||||
#endif
|
||||
AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting.
|
||||
|
||||
@@ -1310,10 +1307,10 @@ bool Bot::AI_EngagedCastCheck() {
|
||||
AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting.
|
||||
|
||||
uint8 botClass = GetClass();
|
||||
BotStanceType botStance = GetBotStance();
|
||||
EQEmu::constants::StanceType botStance = GetBotStance();
|
||||
bool mayGetAggro = HasOrMayGetAggro();
|
||||
|
||||
Log(Logs::Detail, Logs::AI, "Engaged autocast check triggered (BOTS). Trying to cast healing spells then maybe offensive spells.");
|
||||
LogAI("Engaged autocast check triggered (BOTS). Trying to cast healing spells then maybe offensive spells");
|
||||
|
||||
if(botClass == CLERIC) {
|
||||
if(!AICastSpell(GetTarget(), GetChanceToCastBySpellType(SpellType_Escape), SpellType_Escape)) {
|
||||
@@ -1563,11 +1560,11 @@ bool Bot::AIHealRotation(Mob* tar, bool useFastHeals) {
|
||||
}
|
||||
|
||||
#if BotAI_DEBUG_Spells >= 10
|
||||
Log(Logs::Detail, Logs::AI, "Bot::AIHealRotation: heal spellid = %u, fastheals = %c, casterlevel = %u",
|
||||
LogAI("Bot::AIHealRotation: heal spellid = [{}], fastheals = [{}], casterlevel = [{}]",
|
||||
botSpell.SpellId, ((useFastHeals) ? ('T') : ('F')), GetLevel());
|
||||
#endif
|
||||
#if BotAI_DEBUG_Spells >= 25
|
||||
Log(Logs::Detail, Logs::AI, "Bot::AIHealRotation: target = %s, current_time = %u, donthealmebefore = %u", tar->GetCleanName(), Timer::GetCurrentTime(), tar->DontHealMeBefore());
|
||||
LogAI("Bot::AIHealRotation: target = [{}], current_time = [{}], donthealmebefore = [{}]", tar->GetCleanName(), Timer::GetCurrentTime(), tar->DontHealMeBefore());
|
||||
#endif
|
||||
|
||||
// If there is still no spell id, then there isn't going to be one so we are done
|
||||
@@ -2573,79 +2570,79 @@ bool Bot::CheckDisciplineRecastTimers(Bot *caster, int timer_index) {
|
||||
|
||||
uint8 Bot::GetChanceToCastBySpellType(uint32 spellType)
|
||||
{
|
||||
uint8 spell_type_index = MaxSpellTypes;
|
||||
uint8 spell_type_index = SPELL_TYPE_COUNT;
|
||||
switch (spellType) {
|
||||
case SpellType_Nuke:
|
||||
spell_type_index = SpellType_NukeIndex;
|
||||
spell_type_index = spellTypeIndexNuke;
|
||||
break;
|
||||
case SpellType_Heal:
|
||||
spell_type_index = SpellType_HealIndex;
|
||||
spell_type_index = spellTypeIndexHeal;
|
||||
break;
|
||||
case SpellType_Root:
|
||||
spell_type_index = SpellType_RootIndex;
|
||||
spell_type_index = spellTypeIndexRoot;
|
||||
break;
|
||||
case SpellType_Buff:
|
||||
spell_type_index = SpellType_BuffIndex;
|
||||
spell_type_index = spellTypeIndexBuff;
|
||||
break;
|
||||
case SpellType_Escape:
|
||||
spell_type_index = SpellType_EscapeIndex;
|
||||
spell_type_index = spellTypeIndexEscape;
|
||||
break;
|
||||
case SpellType_Pet:
|
||||
spell_type_index = SpellType_PetIndex;
|
||||
spell_type_index = spellTypeIndexPet;
|
||||
break;
|
||||
case SpellType_Lifetap:
|
||||
spell_type_index = SpellType_LifetapIndex;
|
||||
spell_type_index = spellTypeIndexLifetap;
|
||||
break;
|
||||
case SpellType_Snare:
|
||||
spell_type_index = SpellType_SnareIndex;
|
||||
spell_type_index = spellTypeIndexSnare;
|
||||
break;
|
||||
case SpellType_DOT:
|
||||
spell_type_index = SpellType_DOTIndex;
|
||||
spell_type_index = spellTypeIndexDot;
|
||||
break;
|
||||
case SpellType_Dispel:
|
||||
spell_type_index = SpellType_DispelIndex;
|
||||
spell_type_index = spellTypeIndexDispel;
|
||||
break;
|
||||
case SpellType_InCombatBuff:
|
||||
spell_type_index = SpellType_InCombatBuffIndex;
|
||||
spell_type_index = spellTypeIndexInCombatBuff;
|
||||
break;
|
||||
case SpellType_Mez:
|
||||
spell_type_index = SpellType_MezIndex;
|
||||
spell_type_index = spellTypeIndexMez;
|
||||
break;
|
||||
case SpellType_Charm:
|
||||
spell_type_index = SpellType_CharmIndex;
|
||||
spell_type_index = spellTypeIndexCharm;
|
||||
break;
|
||||
case SpellType_Slow:
|
||||
spell_type_index = SpellType_SlowIndex;
|
||||
spell_type_index = spellTypeIndexSlow;
|
||||
break;
|
||||
case SpellType_Debuff:
|
||||
spell_type_index = SpellType_DebuffIndex;
|
||||
spell_type_index = spellTypeIndexDebuff;
|
||||
break;
|
||||
case SpellType_Cure:
|
||||
spell_type_index = SpellType_CureIndex;
|
||||
spell_type_index = spellTypeIndexCure;
|
||||
break;
|
||||
case SpellType_Resurrect:
|
||||
spell_type_index = SpellType_ResurrectIndex;
|
||||
spell_type_index = spellTypeIndexResurrect;
|
||||
break;
|
||||
case SpellType_HateRedux:
|
||||
spell_type_index = SpellType_HateReduxIndex;
|
||||
spell_type_index = spellTypeIndexHateRedux;
|
||||
break;
|
||||
case SpellType_InCombatBuffSong:
|
||||
spell_type_index = SpellType_InCombatBuffSongIndex;
|
||||
spell_type_index = spellTypeIndexInCombatBuffSong;
|
||||
break;
|
||||
case SpellType_OutOfCombatBuffSong:
|
||||
spell_type_index = SpellType_OutOfCombatBuffSongIndex;
|
||||
spell_type_index = spellTypeIndexOutOfCombatBuffSong;
|
||||
break;
|
||||
case SpellType_PreCombatBuff:
|
||||
spell_type_index = SpellType_PreCombatBuffIndex;
|
||||
spell_type_index = spellTypeIndexPreCombatBuff;
|
||||
break;
|
||||
case SpellType_PreCombatBuffSong:
|
||||
spell_type_index = SpellType_PreCombatBuffSongIndex;
|
||||
spell_type_index = spellTypeIndexPreCombatBuffSong;
|
||||
break;
|
||||
default:
|
||||
spell_type_index = MaxSpellTypes;
|
||||
spell_type_index = SPELL_TYPE_COUNT;
|
||||
break;
|
||||
}
|
||||
if (spell_type_index >= MaxSpellTypes)
|
||||
if (spell_type_index >= SPELL_TYPE_COUNT)
|
||||
return 0;
|
||||
|
||||
uint8 class_index = GetClass();
|
||||
@@ -2653,11 +2650,13 @@ uint8 Bot::GetChanceToCastBySpellType(uint32 spellType)
|
||||
return 0;
|
||||
--class_index;
|
||||
|
||||
uint8 stance_index = (uint8)GetBotStance();
|
||||
if (stance_index >= MaxStances)
|
||||
EQEmu::constants::StanceType stance_type = GetBotStance();
|
||||
if (stance_type < EQEmu::constants::stancePassive || stance_type > EQEmu::constants::stanceBurnAE)
|
||||
return 0;
|
||||
|
||||
uint8 stance_index = EQEmu::constants::ConvertStanceTypeToIndex(stance_type);
|
||||
uint8 type_index = nHSND;
|
||||
|
||||
if (HasGroup()) {
|
||||
if (IsGroupHealer()/* || IsRaidHealer()*/)
|
||||
type_index |= pH;
|
||||
@@ -2669,7 +2668,7 @@ uint8 Bot::GetChanceToCastBySpellType(uint32 spellType)
|
||||
type_index |= pD;
|
||||
}
|
||||
|
||||
return botdb.GetSpellCastingChance(spell_type_index, class_index, stance_index, type_index);
|
||||
return database.botdb.GetSpellCastingChance(spell_type_index, class_index, stance_index, type_index);
|
||||
}
|
||||
|
||||
#endif
|
||||
+310
-284
File diff suppressed because it is too large.
Load diff
+30
-35
@@ -90,23 +90,6 @@ public:
|
||||
bool ack_req;
|
||||
};
|
||||
|
||||
enum { //Type arguments to the Message* routines.
|
||||
//all not explicitly listed are the same grey color
|
||||
clientMessageWhite0 = 0,
|
||||
clientMessageLoot = 2, //dark green
|
||||
clientMessageTradeskill = 4, //light blue
|
||||
clientMessageTell = 5, //magenta
|
||||
clientMessageWhite = 7,
|
||||
clientMessageWhite2 = 10,
|
||||
clientMessageLightGrey = 12,
|
||||
clientMessageError = 13, //red
|
||||
clientMessageGreen = 14,
|
||||
clientMessageYellow = 15,
|
||||
clientMessageBlue = 16,
|
||||
clientMessageGroup = 18, //cyan
|
||||
clientMessageWhite3 = 20,
|
||||
};
|
||||
|
||||
#define SPELLBAR_UNLOCK 0x2bc
|
||||
enum { //scribing argument to MemorizeSpell
|
||||
memSpellUnknown = -1, // this modifies some state data
|
||||
@@ -295,11 +278,11 @@ public:
|
||||
void SendBazaarWelcome();
|
||||
void DyeArmor(EQEmu::TintProfile* dye);
|
||||
uint8 SlotConvert(uint8 slot,bool bracer=false);
|
||||
void Message_StringID(uint32 type, uint32 string_id, uint32 distance = 0);
|
||||
void Message_StringID(uint32 type, uint32 string_id, const char* message,const char* message2=0,const char* message3=0,const char* message4=0,const char* message5=0,const char* message6=0,const char* message7=0,const char* message8=0,const char* message9=0, uint32 distance = 0);
|
||||
void MessageString(uint32 type, uint32 string_id, uint32 distance = 0);
|
||||
void MessageString(uint32 type, uint32 string_id, const char* message,const char* message2=0,const char* message3=0,const char* message4=0,const char* message5=0,const char* message6=0,const char* message7=0,const char* message8=0,const char* message9=0, uint32 distance = 0);
|
||||
bool FilteredMessageCheck(Mob *sender, eqFilterType filter);
|
||||
void FilteredMessage_StringID(Mob *sender, uint32 type, eqFilterType filter, uint32 string_id);
|
||||
void FilteredMessage_StringID(Mob *sender, uint32 type, eqFilterType filter,
|
||||
void FilteredMessageString(Mob *sender, uint32 type, eqFilterType filter, uint32 string_id);
|
||||
void FilteredMessageString(Mob *sender, uint32 type, eqFilterType filter,
|
||||
uint32 string_id, const char *message1, const char *message2 = nullptr,
|
||||
const char *message3 = nullptr, const char *message4 = nullptr,
|
||||
const char *message5 = nullptr, const char *message6 = nullptr,
|
||||
@@ -338,11 +321,9 @@ public:
|
||||
void QueuePacket(const EQApplicationPacket* app, bool ack_req = true, CLIENT_CONN_STATUS = CLIENT_CONNECTINGALL, eqFilterType filter=FilterNone);
|
||||
void FastQueuePacket(EQApplicationPacket** app, bool ack_req = true, CLIENT_CONN_STATUS = CLIENT_CONNECTINGALL);
|
||||
void ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_skill, const char* orig_message, const char* targetname=nullptr);
|
||||
void ChannelMessageSend(const char* from, const char* to, uint8 chan_num, uint8 language, const char* message, ...);
|
||||
void ChannelMessageSend(const char* from, const char* to, uint8 chan_num, uint8 language, uint8 lang_skill, const char* message, ...);
|
||||
void Message(uint32 type, const char* message, ...);
|
||||
void FilteredMessage(Mob *sender, uint32 type, eqFilterType filter, const char* message, ...);
|
||||
void QuestJournalledMessage(const char *npcname, const char* message);
|
||||
void VoiceMacroReceived(uint32 Type, char *Target, uint32 MacroNumber);
|
||||
void SendSound();
|
||||
void LearnRecipe(uint32 recipeID);
|
||||
@@ -373,9 +354,9 @@ public:
|
||||
inline bool ClientDataLoaded() const { return client_data_loaded; }
|
||||
inline bool Connected() const { return (client_state == CLIENT_CONNECTED); }
|
||||
inline bool InZone() const { return (client_state == CLIENT_CONNECTED || client_state == CLIENT_LINKDEAD); }
|
||||
inline void Kick() { client_state = CLIENT_KICKED; }
|
||||
inline void Disconnect() { eqs->Close(); client_state = DISCONNECTED; }
|
||||
inline bool IsLD() const { return (bool) (client_state == CLIENT_LINKDEAD); }
|
||||
void Kick(const std::string &reason);
|
||||
void WorldKick();
|
||||
inline uint8 GetAnon() const { return m_pp.anon; }
|
||||
inline PlayerProfile_Struct& GetPP() { return m_pp; }
|
||||
@@ -781,6 +762,8 @@ public:
|
||||
void UnmemSpell(int slot, bool update_client = true);
|
||||
void UnmemSpellBySpellID(int32 spell_id);
|
||||
void UnmemSpellAll(bool update_client = true);
|
||||
uint16 FindMemmedSpellBySlot(int slot);
|
||||
int MemmedCount();
|
||||
void ScribeSpell(uint16 spell_id, int slot, bool update_client = true);
|
||||
void UnscribeSpell(int slot, bool update_client = true);
|
||||
void UnscribeSpellAll(bool update_client = true);
|
||||
@@ -791,7 +774,9 @@ public:
|
||||
uint32 GetCharMaxLevelFromQGlobal();
|
||||
uint32 GetCharMaxLevelFromBucket();
|
||||
|
||||
inline bool IsStanding() const {return (playeraction == 0);}
|
||||
inline bool IsSitting() const {return (playeraction == 1);}
|
||||
inline bool IsCrouching() const {return (playeraction == 2);}
|
||||
inline bool IsBecomeNPC() const { return npcflag; }
|
||||
inline uint8 GetBecomeNPCLevel() const { return npclevel; }
|
||||
inline void SetBecomeNPC(bool flag) { npcflag = flag; }
|
||||
@@ -1307,6 +1292,9 @@ public:
|
||||
|
||||
uint32 trapid; //ID of trap player has triggered. This is cleared when the player leaves the trap's radius, or it despawns.
|
||||
|
||||
void SetLastPositionBeforeBulkUpdate(glm::vec4 in_last_position_before_bulk_update);
|
||||
glm::vec4 &GetLastPositionBeforeBulkUpdate();
|
||||
|
||||
protected:
|
||||
friend class Mob;
|
||||
void CalcItemBonuses(StatBonuses* newbon);
|
||||
@@ -1411,6 +1399,7 @@ private:
|
||||
uint32 WID;
|
||||
uint32 account_id;
|
||||
char account_name[30];
|
||||
char loginserver[64];
|
||||
uint32 lsaccountid;
|
||||
char lskey[30];
|
||||
int16 admin;
|
||||
@@ -1515,6 +1504,7 @@ private:
|
||||
Timer forget_timer; // our 2 min everybody forgets you timer
|
||||
Timer autosave_timer;
|
||||
Timer client_scan_npc_aggro_timer;
|
||||
Timer client_zone_wide_full_position_update_timer;
|
||||
Timer tribute_timer;
|
||||
|
||||
Timer proximity_timer;
|
||||
@@ -1537,6 +1527,7 @@ private:
|
||||
Timer position_update_timer; /* Timer used when client hasn't updated within a 10 second window */
|
||||
|
||||
glm::vec3 m_Proximity;
|
||||
glm::vec4 last_position_before_bulk_update;
|
||||
|
||||
void BulkSendInventoryItems();
|
||||
|
||||
@@ -1636,22 +1627,26 @@ private:
|
||||
int client_max_level;
|
||||
|
||||
#ifdef BOTS
|
||||
struct BotOwnerOptions {
|
||||
bool death_marquee;
|
||||
};
|
||||
|
||||
|
||||
BotOwnerOptions bot_owner_options;
|
||||
|
||||
const BotOwnerOptions DefaultBotOwnerOptions = {
|
||||
false // death_marquee
|
||||
};
|
||||
|
||||
|
||||
public:
|
||||
void SetBotOptionDeathMarquee(bool flag) { bot_owner_options.death_marquee = flag; }
|
||||
enum BotOwnerOption : size_t {
|
||||
booDeathMarquee,
|
||||
booStatsUpdate,
|
||||
booSpawnMessageSay,
|
||||
booSpawnMessageTell,
|
||||
booSpawnMessageClassSpecific,
|
||||
_booCount
|
||||
};
|
||||
|
||||
bool GetBotOptionDeathMarquee() const { return bot_owner_options.death_marquee; }
|
||||
bool GetBotOption(BotOwnerOption boo) const;
|
||||
void SetBotOption(BotOwnerOption boo, bool flag = true);
|
||||
|
||||
private:
|
||||
bool bot_owner_options[_booCount];
|
||||
|
||||
private:
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@@ -576,7 +576,7 @@ int32 Client::CalcMaxMana()
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
Log(Logs::Detail, Logs::Spells, "Invalid Class '%c' in CalcMaxMana", GetCasterClass());
|
||||
LogSpells("Invalid Class [{}] in CalcMaxMana", GetCasterClass());
|
||||
max_mana = 0;
|
||||
break;
|
||||
}
|
||||
@@ -594,7 +594,7 @@ int32 Client::CalcMaxMana()
|
||||
current_mana = curMana_cap;
|
||||
}
|
||||
}
|
||||
Log(Logs::Detail, Logs::Spells, "Client::CalcMaxMana() called for %s - returning %d", GetName(), max_mana);
|
||||
LogSpells("Client::CalcMaxMana() called for [{}] - returning [{}]", GetName(), max_mana);
|
||||
return max_mana;
|
||||
}
|
||||
|
||||
@@ -678,13 +678,13 @@ int32 Client::CalcBaseMana()
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
Log(Logs::General, Logs::None, "Invalid Class '%c' in CalcMaxMana", GetCasterClass());
|
||||
LogDebug("Invalid Class [{}] in CalcMaxMana", GetCasterClass());
|
||||
max_m = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#if EQDEBUG >= 11
|
||||
Log(Logs::General, Logs::None, "Client::CalcBaseMana() called for %s - returning %d", GetName(), max_m);
|
||||
LogDebug("Client::CalcBaseMana() called for [{}] - returning [{}]", GetName(), max_m);
|
||||
#endif
|
||||
return max_m;
|
||||
}
|
||||
@@ -1597,8 +1597,9 @@ uint32 Mob::GetInstrumentMod(uint16 spell_id) const
|
||||
effectmod = 10;
|
||||
if (!nocap && effectmod > effectmodcap) // if the cap is calculated to be 0 using new rules, no cap.
|
||||
effectmod = effectmodcap;
|
||||
Log(Logs::Detail, Logs::Spells, "%s::GetInstrumentMod() spell=%d mod=%d modcap=%d\n", GetName(), spell_id,
|
||||
effectmod, effectmodcap);
|
||||
|
||||
LogSpells("[{}]::GetInstrumentMod() spell=[{}] mod=[{}] modcap=[{}]\n", GetName(), spell_id, effectmod, effectmodcap);
|
||||
|
||||
return effectmod;
|
||||
}
|
||||
|
||||
|
||||
+751
-743
File diff suppressed because it is too large.
Load diff
+61
-63
@@ -241,12 +241,12 @@ bool Client::Process() {
|
||||
if (RuleB(Character, ActiveInvSnapshots) && time(nullptr) >= GetNextInvSnapshotTime()) {
|
||||
if (database.SaveCharacterInvSnapshot(CharacterID())) {
|
||||
SetNextInvSnapshot(RuleI(Character, InvSnapshotMinIntervalM));
|
||||
Log(Logs::Moderate, Logs::Inventory, "Successful inventory snapshot taken of %s - setting next interval for %i minute%s.",
|
||||
LogInventory("Successful inventory snapshot taken of [{}] - setting next interval for [{}] minute[{}]",
|
||||
GetName(), RuleI(Character, InvSnapshotMinIntervalM), (RuleI(Character, InvSnapshotMinIntervalM) == 1 ? "" : "s"));
|
||||
}
|
||||
else {
|
||||
SetNextInvSnapshot(RuleI(Character, InvSnapshotMinRetryM));
|
||||
Log(Logs::Moderate, Logs::Inventory, "Failed to take inventory snapshot of %s - retrying in %i minute%s.",
|
||||
LogInventory("Failed to take inventory snapshot of [{}] - retrying in [{}] minute[{}]",
|
||||
GetName(), RuleI(Character, InvSnapshotMinRetryM), (RuleI(Character, InvSnapshotMinRetryM) == 1 ? "" : "s"));
|
||||
}
|
||||
}
|
||||
@@ -378,10 +378,10 @@ bool Client::Process() {
|
||||
}
|
||||
|
||||
if (!CombatRange(auto_attack_target)) {
|
||||
Message_StringID(MT_TooFarAway, TARGET_TOO_FAR);
|
||||
MessageString(Chat::TooFarAway, TARGET_TOO_FAR);
|
||||
}
|
||||
else if (auto_attack_target == this) {
|
||||
Message_StringID(MT_TooFarAway, TRY_ATTACKING_SOMEONE);
|
||||
MessageString(Chat::TooFarAway, TRY_ATTACKING_SOMEONE);
|
||||
}
|
||||
else if (!los_status || !los_status_facing) {
|
||||
//you can't see your target
|
||||
@@ -401,11 +401,11 @@ bool Client::Process() {
|
||||
|
||||
if (GetClass() == WARRIOR || GetClass() == BERSERKER) {
|
||||
if (!dead && !IsBerserk() && GetHPRatio() < RuleI(Combat, BerserkerFrenzyStart)) {
|
||||
entity_list.MessageClose_StringID(this, false, 200, 0, BERSERK_START, GetName());
|
||||
entity_list.MessageCloseString(this, false, 200, 0, BERSERK_START, GetName());
|
||||
berserk = true;
|
||||
}
|
||||
if (IsBerserk() && GetHPRatio() > RuleI(Combat, BerserkerFrenzyEnd)) {
|
||||
entity_list.MessageClose_StringID(this, false, 200, 0, BERSERK_END, GetName());
|
||||
entity_list.MessageCloseString(this, false, 200, 0, BERSERK_END, GetName());
|
||||
berserk = false;
|
||||
}
|
||||
}
|
||||
@@ -416,11 +416,11 @@ bool Client::Process() {
|
||||
// Range check
|
||||
if (!CombatRange(auto_attack_target)) {
|
||||
// this is a duplicate message don't use it.
|
||||
//Message_StringID(MT_TooFarAway,TARGET_TOO_FAR);
|
||||
//MessageString(Chat::TooFarAway,TARGET_TOO_FAR);
|
||||
}
|
||||
// Don't attack yourself
|
||||
else if (auto_attack_target == this) {
|
||||
//Message_StringID(MT_TooFarAway,TRY_ATTACKING_SOMEONE);
|
||||
//MessageString(Chat::TooFarAway,TRY_ATTACKING_SOMEONE);
|
||||
}
|
||||
else if (!los_status || !los_status_facing)
|
||||
{
|
||||
@@ -465,7 +465,8 @@ bool Client::Process() {
|
||||
{
|
||||
if (!CombatRange(shield_target))
|
||||
{
|
||||
entity_list.MessageClose_StringID(this, false, 100, 0,
|
||||
entity_list.MessageCloseString(
|
||||
this, false, 100, 0,
|
||||
END_SHIELDING, GetCleanName(), shield_target->GetCleanName());
|
||||
for (int y = 0; y < 2; y++)
|
||||
{
|
||||
@@ -558,11 +559,10 @@ bool Client::Process() {
|
||||
|
||||
if (client_state != CLIENT_LINKDEAD && !eqs->CheckState(ESTABLISHED)) {
|
||||
OnDisconnect(true);
|
||||
Log(Logs::General, Logs::Zone_Server, "Client linkdead: %s", name);
|
||||
LogInfo("Client linkdead: {}", name);
|
||||
|
||||
if (GetGM()) {
|
||||
if (GetMerc())
|
||||
{
|
||||
if (Admin() > 100) {
|
||||
if (GetMerc()) {
|
||||
GetMerc()->Save();
|
||||
GetMerc()->Depop();
|
||||
}
|
||||
@@ -592,8 +592,8 @@ bool Client::Process() {
|
||||
// only if client is not feigned
|
||||
if (zone->CanDoCombat() && ret && !GetFeigned() && client_scan_npc_aggro_timer.Check()) {
|
||||
int npc_scan_count = 0;
|
||||
for (auto it = close_mobs.begin(); it != close_mobs.end(); ++it) {
|
||||
Mob *mob = it->first;
|
||||
for (auto & close_mob : close_mobs) {
|
||||
Mob *mob = close_mob.first;
|
||||
|
||||
if (!mob)
|
||||
continue;
|
||||
@@ -604,9 +604,10 @@ bool Client::Process() {
|
||||
if (mob->CheckWillAggro(this) && !mob->CheckAggro(this)) {
|
||||
mob->AddToHateList(this, 25);
|
||||
}
|
||||
|
||||
npc_scan_count++;
|
||||
}
|
||||
Log(Logs::General, Logs::Aggro, "Checking Reverse Aggro (client->npc) scanned_npcs (%i)", npc_scan_count);
|
||||
LogAggro("Checking Reverse Aggro (client->npc) scanned_npcs ([{}])", npc_scan_count);
|
||||
}
|
||||
|
||||
if (client_state != CLIENT_LINKDEAD && (client_state == CLIENT_ERROR || client_state == DISCONNECTED || client_state == CLIENT_KICKED || !eqs->CheckState(ESTABLISHED)))
|
||||
@@ -708,7 +709,7 @@ void Client::OnDisconnect(bool hard_disconnect) {
|
||||
Mob *Other = trade->With();
|
||||
if(Other)
|
||||
{
|
||||
Log(Logs::Detail, Logs::Trading, "Client disconnected during a trade. Returning their items.");
|
||||
LogTrading("Client disconnected during a trade. Returning their items");
|
||||
FinishTrade(this);
|
||||
|
||||
if(Other->IsClient())
|
||||
@@ -740,7 +741,7 @@ void Client::BulkSendInventoryItems()
|
||||
if(inst) {
|
||||
bool is_arrow = (inst->GetItem()->ItemType == EQEmu::item::ItemTypeArrow) ? true : false;
|
||||
int16 free_slot_id = m_inv.FindFreeSlot(inst->IsClassBag(), true, inst->GetItem()->Size, is_arrow);
|
||||
Log(Logs::Detail, Logs::Inventory, "Incomplete Trade Transaction: Moving %s from slot %i to %i", inst->GetItem()->Name, slot_id, free_slot_id);
|
||||
LogInventory("Incomplete Trade Transaction: Moving [{}] from slot [{}] to [{}]", inst->GetItem()->Name, slot_id, free_slot_id);
|
||||
PutItemInInventory(free_slot_id, *inst, false);
|
||||
database.SaveInventory(character_id, nullptr, slot_id);
|
||||
safe_delete(inst);
|
||||
@@ -769,7 +770,7 @@ void Client::BulkSendInventoryItems()
|
||||
inst->Serialize(ob, slot_id);
|
||||
|
||||
if (ob.tellp() == last_pos)
|
||||
Log(Logs::General, Logs::Inventory, "Serialization failed on item slot %d during BulkSendInventoryItems. Item skipped.", slot_id);
|
||||
LogInventory("Serialization failed on item slot [{}] during BulkSendInventoryItems. Item skipped", slot_id);
|
||||
|
||||
last_pos = ob.tellp();
|
||||
}
|
||||
@@ -783,7 +784,7 @@ void Client::BulkSendInventoryItems()
|
||||
inst->Serialize(ob, slot_id);
|
||||
|
||||
if (ob.tellp() == last_pos)
|
||||
Log(Logs::General, Logs::Inventory, "Serialization failed on item slot %d during BulkSendInventoryItems. Item skipped.", slot_id);
|
||||
LogInventory("Serialization failed on item slot [{}] during BulkSendInventoryItems. Item skipped", slot_id);
|
||||
|
||||
last_pos = ob.tellp();
|
||||
}
|
||||
@@ -797,7 +798,7 @@ void Client::BulkSendInventoryItems()
|
||||
inst->Serialize(ob, slot_id);
|
||||
|
||||
if (ob.tellp() == last_pos)
|
||||
Log(Logs::General, Logs::Inventory, "Serialization failed on item slot %d during BulkSendInventoryItems. Item skipped.", slot_id);
|
||||
LogInventory("Serialization failed on item slot [{}] during BulkSendInventoryItems. Item skipped", slot_id);
|
||||
|
||||
last_pos = ob.tellp();
|
||||
}
|
||||
@@ -885,7 +886,7 @@ void Client::BulkSendMerchantInventory(int merchant_id, int npcid) {
|
||||
// Account for merchant lists with gaps.
|
||||
if (ml.slot >= i) {
|
||||
if (ml.slot > i)
|
||||
Log(Logs::General, Logs::None, "(WARNING) Merchantlist contains gap at slot %d. Merchant: %d, NPC: %d", i, merchant_id, npcid);
|
||||
LogDebug("(WARNING) Merchantlist contains gap at slot [{}]. Merchant: [{}], NPC: [{}]", i, merchant_id, npcid);
|
||||
i = ml.slot + 1;
|
||||
}
|
||||
}
|
||||
@@ -950,9 +951,9 @@ void Client::BulkSendMerchantInventory(int merchant_id, int npcid) {
|
||||
sprintf(handy_id, "%i", greet_id);
|
||||
|
||||
if (greet_id != MERCHANT_GREETING)
|
||||
Message_StringID(10, GENERIC_STRINGID_SAY, merch->GetCleanName(), handy_id, this->GetName(), handyitem->Name);
|
||||
MessageString(Chat::NPCQuestSay, GENERIC_STRINGID_SAY, merch->GetCleanName(), handy_id, this->GetName(), handyitem->Name);
|
||||
else
|
||||
Message_StringID(10, GENERIC_STRINGID_SAY, merch->GetCleanName(), handy_id, this->GetName());
|
||||
MessageString(Chat::NPCQuestSay, GENERIC_STRINGID_SAY, merch->GetCleanName(), handy_id, this->GetName());
|
||||
}
|
||||
|
||||
// safe_delete_array(cpi);
|
||||
@@ -975,7 +976,7 @@ uint8 Client::WithCustomer(uint16 NewCustomer){
|
||||
Client* c = entity_list.GetClientByID(CustomerID);
|
||||
|
||||
if(!c) {
|
||||
Log(Logs::Detail, Logs::Trading, "Previous customer has gone away.");
|
||||
LogTrading("Previous customer has gone away");
|
||||
CustomerID = NewCustomer;
|
||||
return 1;
|
||||
}
|
||||
@@ -987,8 +988,8 @@ void Client::OPRezzAnswer(uint32 Action, uint32 SpellID, uint16 ZoneID, uint16 I
|
||||
{
|
||||
if(PendingRezzXP < 0) {
|
||||
// pendingrezexp is set to -1 if we are not expecting an OP_RezzAnswer
|
||||
Log(Logs::Detail, Logs::Spells, "Unexpected OP_RezzAnswer. Ignoring it.");
|
||||
Message(13, "You have already been resurrected.\n");
|
||||
LogSpells("Unexpected OP_RezzAnswer. Ignoring it");
|
||||
Message(Chat::Red, "You have already been resurrected.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -997,7 +998,7 @@ void Client::OPRezzAnswer(uint32 Action, uint32 SpellID, uint16 ZoneID, uint16 I
|
||||
// Mark the corpse as rezzed in the database, just in case the corpse has buried, or the zone the
|
||||
// corpse is in has shutdown since the rez spell was cast.
|
||||
database.MarkCorpseAsRezzed(PendingRezzDBID);
|
||||
Log(Logs::Detail, Logs::Spells, "Player %s got a %i Rezz, spellid %i in zone%i, instance id %i",
|
||||
LogSpells("Player [{}] got a [{}] Rezz, spellid [{}] in zone[{}], instance id [{}]",
|
||||
this->name, (uint16)spells[SpellID].base[0],
|
||||
SpellID, ZoneID, InstanceID);
|
||||
|
||||
@@ -1042,7 +1043,7 @@ void Client::OPTGB(const EQApplicationPacket *app)
|
||||
|
||||
uint32 tgb_flag = *(uint32 *)app->pBuffer;
|
||||
if(tgb_flag == 2)
|
||||
Message_StringID(0, TGB() ? TGB_ON : TGB_OFF);
|
||||
MessageString(Chat::White, TGB() ? TGB_ON : TGB_OFF);
|
||||
else
|
||||
tgb = tgb_flag;
|
||||
}
|
||||
@@ -1051,7 +1052,7 @@ void Client::OPMemorizeSpell(const EQApplicationPacket* app)
|
||||
{
|
||||
if(app->size != sizeof(MemorizeSpell_Struct))
|
||||
{
|
||||
Log(Logs::General, Logs::Error, "Wrong size on OP_MemorizeSpell. Got: %i, Expected: %i", app->size, sizeof(MemorizeSpell_Struct));
|
||||
LogError("Wrong size on OP_MemorizeSpell. Got: [{}], Expected: [{}]", app->size, sizeof(MemorizeSpell_Struct));
|
||||
DumpPacket(app);
|
||||
return;
|
||||
}
|
||||
@@ -1060,7 +1061,7 @@ void Client::OPMemorizeSpell(const EQApplicationPacket* app)
|
||||
|
||||
if(!IsValidSpell(memspell->spell_id))
|
||||
{
|
||||
Message(13, "Unexpected error: spell id out of range");
|
||||
Message(Chat::Red, "Unexpected error: spell id out of range");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1071,8 +1072,8 @@ void Client::OPMemorizeSpell(const EQApplicationPacket* app)
|
||||
)
|
||||
{
|
||||
char val1[20]={0};
|
||||
Message_StringID(13,SPELL_LEVEL_TO_LOW,ConvertArray(spells[memspell->spell_id].classes[GetClass()-1],val1),spells[memspell->spell_id].name);
|
||||
//Message(13, "Unexpected error: Class cant use this spell at your level!");
|
||||
MessageString(Chat::Red,SPELL_LEVEL_TO_LOW,ConvertArray(spells[memspell->spell_id].classes[GetClass()-1],val1),spells[memspell->spell_id].name);
|
||||
//Message(Chat::Red, "Unexpected error: Class cant use this spell at your level!");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1086,7 +1087,7 @@ void Client::OPMemorizeSpell(const EQApplicationPacket* app)
|
||||
const EQEmu::ItemData* item = inst->GetItem();
|
||||
|
||||
if (RuleB(Character, RestrictSpellScribing) && !item->IsEquipable(GetRace(), GetClass())) {
|
||||
Message_StringID(13, CANNOT_USE_ITEM);
|
||||
MessageString(Chat::Red, CANNOT_USE_ITEM);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1438,7 +1439,7 @@ void Client::OPMoveCoin(const EQApplicationPacket* app)
|
||||
}
|
||||
else{
|
||||
if (to_bucket == &m_pp.platinum_shared || from_bucket == &m_pp.platinum_shared){
|
||||
this->Message(13, "::: WARNING! ::: SHARED BANK IS DISABLED AND YOUR PLATINUM WILL BE DESTROYED IF YOU PUT IT HERE");
|
||||
this->Message(Chat::Red, "::: WARNING! ::: SHARED BANK IS DISABLED AND YOUR PLATINUM WILL BE DESTROYED IF YOU PUT IT HERE");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1454,8 +1455,8 @@ void Client::OPMoveCoin(const EQApplicationPacket* app)
|
||||
with->trade->state = Trading;
|
||||
|
||||
Client* recipient = trader->CastToClient();
|
||||
recipient->Message(15, "%s adds some coins to the trade.", GetName());
|
||||
recipient->Message(15, "The total trade is: %i PP, %i GP, %i SP, %i CP",
|
||||
recipient->Message(Chat::Yellow, "%s adds some coins to the trade.", GetName());
|
||||
recipient->Message(Chat::Yellow, "The total trade is: %i PP, %i GP, %i SP, %i CP",
|
||||
trade->pp, trade->gp,
|
||||
trade->sp, trade->cp
|
||||
);
|
||||
@@ -1525,7 +1526,7 @@ void Client::OPGMTraining(const EQApplicationPacket *app)
|
||||
// welcome message
|
||||
if (pTrainer && pTrainer->IsNPC())
|
||||
{
|
||||
pTrainer->Say_StringID(zone->random.Int(1204, 1207), GetCleanName());
|
||||
pTrainer->SayString(zone->random.Int(1204, 1207), GetCleanName());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1554,7 +1555,7 @@ void Client::OPGMEndTraining(const EQApplicationPacket *app)
|
||||
// goodbye message
|
||||
if (pTrainer->IsNPC())
|
||||
{
|
||||
pTrainer->Say_StringID(zone->random.Int(1208, 1211), GetCleanName());
|
||||
pTrainer->SayString(zone->random.Int(1208, 1211), GetCleanName());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1610,12 +1611,12 @@ void Client::OPGMTrainSkill(const EQApplicationPacket *app)
|
||||
EQEmu::skills::SkillType skill = (EQEmu::skills::SkillType)gmskill->skill_id;
|
||||
|
||||
if(!CanHaveSkill(skill)) {
|
||||
Log(Logs::Detail, Logs::Skills, "Tried to train skill %d, which is not allowed.", skill);
|
||||
LogSkills("Tried to train skill [{}], which is not allowed", skill);
|
||||
return;
|
||||
}
|
||||
|
||||
if(MaxSkill(skill) == 0) {
|
||||
Log(Logs::Detail, Logs::Skills, "Tried to train skill %d, but training is not allowed at this level.", skill);
|
||||
LogSkills("Tried to train skill [{}], but training is not allowed at this level", skill);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1644,7 +1645,7 @@ void Client::OPGMTrainSkill(const EQApplicationPacket *app)
|
||||
case EQEmu::skills::SkillJewelryMaking:
|
||||
case EQEmu::skills::SkillPottery:
|
||||
if(skilllevel >= RuleI(Skills, MaxTrainTradeskills)) {
|
||||
Message_StringID(13, MORE_SKILLED_THAN_I, pTrainer->GetCleanName());
|
||||
MessageString(Chat::Red, MORE_SKILLED_THAN_I, pTrainer->GetCleanName());
|
||||
return;
|
||||
}
|
||||
break;
|
||||
@@ -1654,7 +1655,7 @@ void Client::OPGMTrainSkill(const EQApplicationPacket *app)
|
||||
case EQEmu::skills::SkillSpecializeDivination:
|
||||
case EQEmu::skills::SkillSpecializeEvocation:
|
||||
if(skilllevel >= RuleI(Skills, MaxTrainSpecializations)) {
|
||||
Message_StringID(13, MORE_SKILLED_THAN_I, pTrainer->GetCleanName());
|
||||
MessageString(Chat::Red, MORE_SKILLED_THAN_I, pTrainer->GetCleanName());
|
||||
return;
|
||||
}
|
||||
default:
|
||||
@@ -1665,7 +1666,7 @@ void Client::OPGMTrainSkill(const EQApplicationPacket *app)
|
||||
if (skilllevel >= MaxSkillValue)
|
||||
{
|
||||
// Don't allow training over max skill level
|
||||
Message_StringID(13, MORE_SKILLED_THAN_I, pTrainer->GetCleanName());
|
||||
MessageString(Chat::Red, MORE_SKILLED_THAN_I, pTrainer->GetCleanName());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1675,7 +1676,7 @@ void Client::OPGMTrainSkill(const EQApplicationPacket *app)
|
||||
if (skilllevel >= MaxSpecSkill)
|
||||
{
|
||||
// Restrict specialization training to follow the rules
|
||||
Message_StringID(13, MORE_SKILLED_THAN_I, pTrainer->GetCleanName());
|
||||
MessageString(Chat::Red, MORE_SKILLED_THAN_I, pTrainer->GetCleanName());
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1800,8 +1801,7 @@ void Client::DoStaminaHungerUpdate()
|
||||
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);
|
||||
LogFood("Client::DoStaminaHungerUpdate() hunger_level: [{}] thirst_level: [{}] before loss", m_pp.hunger_level, m_pp.thirst_level);
|
||||
|
||||
if (zone->GetZoneID() != 151 && !GetGM()) {
|
||||
int loss = RuleI(Character, FoodLossPerUpdate);
|
||||
@@ -1822,9 +1822,7 @@ void Client::DoStaminaHungerUpdate()
|
||||
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",
|
||||
LogFood("Client::DoStaminaHungerUpdate() Current hunger_level: [{}] = ([{}] minutes left) thirst_level: [{}] = ([{}] minutes left) - after loss",
|
||||
m_pp.hunger_level, m_pp.hunger_level, m_pp.thirst_level, m_pp.thirst_level);
|
||||
|
||||
FastQueuePacket(&outapp);
|
||||
@@ -1918,7 +1916,7 @@ void Client::DoTracking()
|
||||
Mob *m = entity_list.GetMob(TrackingID);
|
||||
|
||||
if (!m || m->IsCorpse()) {
|
||||
Message_StringID(MT_Skills, TRACK_LOST_TARGET);
|
||||
MessageString(Chat::Skills, TRACK_LOST_TARGET);
|
||||
TrackingID = 0;
|
||||
return;
|
||||
}
|
||||
@@ -1929,23 +1927,23 @@ void Client::DoTracking()
|
||||
RelativeHeading += 512;
|
||||
|
||||
if (RelativeHeading > 480)
|
||||
Message_StringID(MT_Skills, TRACK_STRAIGHT_AHEAD, m->GetCleanName());
|
||||
MessageString(Chat::Skills, TRACK_STRAIGHT_AHEAD, m->GetCleanName());
|
||||
else if (RelativeHeading > 416)
|
||||
Message_StringID(MT_Skills, TRACK_AHEAD_AND_TO, m->GetCleanName(), "left");
|
||||
MessageString(Chat::Skills, TRACK_AHEAD_AND_TO, m->GetCleanName(), "left");
|
||||
else if (RelativeHeading > 352)
|
||||
Message_StringID(MT_Skills, TRACK_TO_THE, m->GetCleanName(), "left");
|
||||
MessageString(Chat::Skills, TRACK_TO_THE, m->GetCleanName(), "left");
|
||||
else if (RelativeHeading > 288)
|
||||
Message_StringID(MT_Skills, TRACK_BEHIND_AND_TO, m->GetCleanName(), "left");
|
||||
MessageString(Chat::Skills, TRACK_BEHIND_AND_TO, m->GetCleanName(), "left");
|
||||
else if (RelativeHeading > 224)
|
||||
Message_StringID(MT_Skills, TRACK_BEHIND_YOU, m->GetCleanName());
|
||||
MessageString(Chat::Skills, TRACK_BEHIND_YOU, m->GetCleanName());
|
||||
else if (RelativeHeading > 160)
|
||||
Message_StringID(MT_Skills, TRACK_BEHIND_AND_TO, m->GetCleanName(), "right");
|
||||
MessageString(Chat::Skills, TRACK_BEHIND_AND_TO, m->GetCleanName(), "right");
|
||||
else if (RelativeHeading > 96)
|
||||
Message_StringID(MT_Skills, TRACK_TO_THE, m->GetCleanName(), "right");
|
||||
MessageString(Chat::Skills, TRACK_TO_THE, m->GetCleanName(), "right");
|
||||
else if (RelativeHeading > 32)
|
||||
Message_StringID(MT_Skills, TRACK_AHEAD_AND_TO, m->GetCleanName(), "right");
|
||||
MessageString(Chat::Skills, TRACK_AHEAD_AND_TO, m->GetCleanName(), "right");
|
||||
else if (RelativeHeading >= 0)
|
||||
Message_StringID(MT_Skills, TRACK_STRAIGHT_AHEAD, m->GetCleanName());
|
||||
MessageString(Chat::Skills, TRACK_STRAIGHT_AHEAD, m->GetCleanName());
|
||||
}
|
||||
|
||||
void Client::HandleRespawnFromHover(uint32 Option)
|
||||
@@ -2003,7 +2001,7 @@ void Client::HandleRespawnFromHover(uint32 Option)
|
||||
{
|
||||
if (PendingRezzXP < 0 || PendingRezzSpellID == 0)
|
||||
{
|
||||
Log(Logs::Detail, Logs::Spells, "Unexpected Rezz from hover request.");
|
||||
LogSpells("Unexpected Rezz from hover request");
|
||||
return;
|
||||
}
|
||||
SetHP(GetMaxHP() / 5);
|
||||
@@ -2037,10 +2035,10 @@ void Client::HandleRespawnFromHover(uint32 Option)
|
||||
|
||||
if (corpse && corpse->IsCorpse())
|
||||
{
|
||||
Log(Logs::Detail, Logs::Spells, "Hover Rez in zone %s for corpse %s",
|
||||
LogSpells("Hover Rez in zone [{}] for corpse [{}]",
|
||||
zone->GetShortName(), PendingRezzCorpseName.c_str());
|
||||
|
||||
Log(Logs::Detail, Logs::Spells, "Found corpse. Marking corpse as rezzed.");
|
||||
LogSpells("Found corpse. Marking corpse as rezzed");
|
||||
|
||||
corpse->IsRezzed(true);
|
||||
corpse->CompleteResurrection();
|
||||
|
||||
+2775
-1812
File diff suppressed because it is too large.
Load diff
@@ -77,6 +77,7 @@ void command_crashtest(Client *c, const Seperator *sep);
|
||||
void command_cvs(Client *c, const Seperator *sep);
|
||||
void command_d1(Client *c, const Seperator *sep);
|
||||
void command_damage(Client *c, const Seperator *sep);
|
||||
void command_databuckets(Client *c, const Seperator *sep);
|
||||
void command_date(Client *c, const Seperator *sep);
|
||||
void command_dbspawn2(Client *c, const Seperator *sep);
|
||||
void command_delacct(Client *c, const Seperator *sep);
|
||||
@@ -179,8 +180,10 @@ void command_mysqltest(Client *c, const Seperator *sep);
|
||||
void command_mystats(Client *c, const Seperator *sep);
|
||||
void command_name(Client *c, const Seperator *sep);
|
||||
void command_netstats(Client *c, const Seperator *sep);
|
||||
void command_network(Client *c, const Seperator *sep);
|
||||
void command_npccast(Client *c, const Seperator *sep);
|
||||
void command_npcedit(Client *c, const Seperator *sep);
|
||||
void command_npceditmass(Client *c, const Seperator *sep);
|
||||
void command_npcemote(Client *c, const Seperator *sep);
|
||||
void command_npcloot(Client *c, const Seperator *sep);
|
||||
void command_npcsay(Client *c, const Seperator *sep);
|
||||
@@ -210,6 +213,7 @@ void command_permagender(Client *c, const Seperator *sep);
|
||||
void command_permarace(Client *c, const Seperator *sep);
|
||||
void command_petitioninfo(Client *c, const Seperator *sep);
|
||||
void command_picklock(Client *c, const Seperator *sep);
|
||||
void command_profanity(Client *c, const Seperator *sep);
|
||||
|
||||
#ifdef EQPROFILE
|
||||
void command_profiledump(Client *c, const Seperator *sep);
|
||||
@@ -245,6 +249,7 @@ void command_repopclose(Client *c, const Seperator *sep);
|
||||
void command_resetaa(Client* c,const Seperator *sep);
|
||||
void command_resetaa_timer(Client *c, const Seperator *sep);
|
||||
void command_revoke(Client *c, const Seperator *sep);
|
||||
void command_roambox(Client *c, const Seperator *sep);
|
||||
void command_rules(Client *c, const Seperator *sep);
|
||||
void command_save(Client *c, const Seperator *sep);
|
||||
void command_scale(Client *c, const Seperator *sep);
|
||||
@@ -284,6 +289,7 @@ void command_showzonegloballoot(Client *c, const Seperator *sep);
|
||||
void command_shutdown(Client *c, const Seperator *sep);
|
||||
void command_size(Client *c, const Seperator *sep);
|
||||
void command_spawn(Client *c, const Seperator *sep);
|
||||
void command_spawneditmass(Client *c, const Seperator *sep);
|
||||
void command_spawnfix(Client *c, const Seperator *sep);
|
||||
void command_spawnstatus(Client *c, const Seperator *sep);
|
||||
void command_spellinfo(Client *c, const Seperator *sep);
|
||||
|
||||
@@ -272,6 +272,31 @@ enum class LootRequestType : uint8 {
|
||||
AllowedPVPDefined,
|
||||
};
|
||||
|
||||
namespace Journal {
|
||||
enum class SpeakMode : uint8 {
|
||||
Raw = 0, // this just uses the raw message
|
||||
Say = 1, // prints with "%1 says,%2 '%3'" if in another language else "%1 says '%2'"
|
||||
Shout = 2, // prints with "%1 shouts,%2 '%3'" if in another language else "%1 shouts '%2'"
|
||||
EmoteAlt = 3, // prints "%2", this should just be the same as raw ...
|
||||
Emote = 4, // prints "%1 %2" if message doesn't start with "\" or "@", else "%1%2"
|
||||
Group = 5 // prints "%1 tells the group,%2 '%3'"
|
||||
};
|
||||
|
||||
enum class Mode : uint8 {
|
||||
None = 0,
|
||||
Log1 = 1, // 1 and 2 log to journal
|
||||
Log2 = 2, // our current code uses 2
|
||||
};
|
||||
|
||||
struct Options {
|
||||
SpeakMode speak_mode;
|
||||
Mode journal_mode;
|
||||
int8 language;
|
||||
uint32 message_type;
|
||||
uint32 target_spawn_id; // who the message is talking to (limits journaling)
|
||||
};
|
||||
};
|
||||
|
||||
//this is our internal representation of the BUFF struct, can put whatever we want in it
|
||||
struct Buffs_Struct {
|
||||
uint16 spellid;
|
||||
@@ -363,6 +388,7 @@ struct StatBonuses {
|
||||
int32 skillmod[EQEmu::skills::HIGHEST_SKILL + 1];
|
||||
int32 skillmodmax[EQEmu::skills::HIGHEST_SKILL + 1];
|
||||
int effective_casting_level;
|
||||
int adjusted_casting_skill; // SPA 112 for fizzles
|
||||
int reflect_chance; // chance to reflect incoming spell
|
||||
uint32 singingMod;
|
||||
uint32 Amplification; // stacks with singingMod
|
||||
@@ -558,6 +584,7 @@ struct StatBonuses {
|
||||
int16 FeignedCastOnChance; // Percent Value
|
||||
bool PetCommands[PET_MAXCOMMANDS]; // SPA 267
|
||||
int FeignedMinionChance; // SPA 281 base1 = chance, just like normal FD
|
||||
int GrantForage; // affects max skill of forage as well as granting non-forage classes forage
|
||||
int aura_slots;
|
||||
int trap_slots;
|
||||
bool hunger; // Song of Sustenance -- min caps to 3500
|
||||
|
||||
+35
-32
@@ -152,7 +152,8 @@ Corpse::Corpse(NPC* in_npc, ItemList* in_itemlist, uint32 in_npctypeid, const NP
|
||||
in_npc->GetDeity(),in_npc->GetLevel(),in_npc->GetNPCTypeID(),in_npc->GetSize(),0,
|
||||
in_npc->GetPosition(), in_npc->GetInnateLightType(), in_npc->GetTexture(),in_npc->GetHelmTexture(),
|
||||
0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,EQEmu::TintProfile(),0xff,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
|
||||
0,0,0,0,0,0,0,0,0,0,EQEmu::TintProfile(),0xff,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
(*in_npctypedata)->use_model),
|
||||
corpse_decay_timer(in_decaytime),
|
||||
corpse_rez_timer(0),
|
||||
corpse_delay_timer(RuleI(NPC, CorpseUnlockTimer)),
|
||||
@@ -258,6 +259,7 @@ Corpse::Corpse(Client* client, int32 in_rezexp) : Mob (
|
||||
0, // uint8 in_bracertexture,
|
||||
0, // uint8 in_handtexture,
|
||||
0, // uint8 in_legtexture,
|
||||
0,
|
||||
0 // uint8 in_feettexture,
|
||||
),
|
||||
corpse_decay_timer(RuleI(Character, CorpseDecayTimeMS)),
|
||||
@@ -484,6 +486,7 @@ EQEmu::TintProfile(),
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0),
|
||||
corpse_decay_timer(RuleI(Character, CorpseDecayTimeMS)),
|
||||
corpse_rez_timer(RuleI(Character, CorpseResTimeMS)),
|
||||
@@ -800,7 +803,7 @@ bool Corpse::Process() {
|
||||
spc->zone_id = zone->graveyard_zoneid();
|
||||
worldserver.SendPacket(pack);
|
||||
safe_delete(pack);
|
||||
Log(Logs::General, Logs::None, "Moved %s player corpse to the designated graveyard in zone %s.", this->GetName(), database.GetZoneName(zone->graveyard_zoneid()));
|
||||
LogDebug("Moved [{}] player corpse to the designated graveyard in zone [{}]", this->GetName(), database.GetZoneName(zone->graveyard_zoneid()));
|
||||
corpse_db_id = 0;
|
||||
}
|
||||
|
||||
@@ -830,10 +833,10 @@ bool Corpse::Process() {
|
||||
Save();
|
||||
player_corpse_depop = true;
|
||||
corpse_db_id = 0;
|
||||
Log(Logs::General, Logs::None, "Tagged %s player corpse has buried.", this->GetName());
|
||||
LogDebug("Tagged [{}] player corpse has buried", this->GetName());
|
||||
}
|
||||
else {
|
||||
Log(Logs::General, Logs::Error, "Unable to bury %s player corpse.", this->GetName());
|
||||
LogError("Unable to bury [{}] player corpse", this->GetName());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -886,14 +889,14 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a
|
||||
|
||||
if(IsPlayerCorpse() && !corpse_db_id) { // really should try to resave in this case
|
||||
// SendLootReqErrorPacket(client, 0);
|
||||
client->Message(13, "Warning: Corpse's dbid = 0! Corpse will not survive zone shutdown!");
|
||||
client->Message(Chat::Red, "Warning: Corpse's dbid = 0! Corpse will not survive zone shutdown!");
|
||||
std::cout << "Error: PlayerCorpse::MakeLootRequestPackets: dbid = 0!" << std::endl;
|
||||
// return;
|
||||
}
|
||||
|
||||
if(is_locked && client->Admin() < 100) {
|
||||
SendLootReqErrorPacket(client, LootResponse::SomeoneElse);
|
||||
client->Message(13, "Error: Corpse locked by GM.");
|
||||
client->Message(Chat::Red, "Error: Corpse locked by GM.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -940,7 +943,7 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a
|
||||
|
||||
}
|
||||
|
||||
Log(Logs::Moderate, Logs::Inventory, "MakeLootRequestPackets() LootRequestType %u for %s", loot_request_type, client->GetName());
|
||||
LogInventory("MakeLootRequestPackets() LootRequestType [{}] for [{}]", (int) loot_request_type, client->GetName());
|
||||
|
||||
if (loot_request_type == LootRequestType::Forbidden) {
|
||||
SendLootReqErrorPacket(client, LootResponse::NotAtThisTime);
|
||||
@@ -957,7 +960,7 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a
|
||||
loot_coin = (tmp[0] == 1 && tmp[1] == '\0');
|
||||
|
||||
if (loot_request_type == LootRequestType::GMPeek || loot_request_type == LootRequestType::GMAllowed) {
|
||||
client->Message(15, "This corpse contains %u platinum, %u gold, %u silver and %u copper.",
|
||||
client->Message(Chat::Yellow, "This corpse contains %u platinum, %u gold, %u silver and %u copper.",
|
||||
GetPlatinum(), GetGold(), GetSilver(), GetCopper());
|
||||
|
||||
auto outapp = new EQApplicationPacket(OP_MoneyOnCorpse, sizeof(moneyOnCorpseStruct));
|
||||
@@ -1024,15 +1027,15 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a
|
||||
if (pkitem->RecastDelay)
|
||||
pkinst->SetRecastTimestamp(timestamps.count(pkitem->RecastType) ? timestamps.at(pkitem->RecastType) : 0);
|
||||
|
||||
Log(Logs::Detail, Logs::Inventory, "MakeLootRequestPackets() Slot %u, Item '%s'", EQEmu::invslot::CORPSE_BEGIN, pkitem->Name);
|
||||
LogInventory("MakeLootRequestPackets() Slot [{}], Item [{}]", EQEmu::invslot::CORPSE_BEGIN, pkitem->Name);
|
||||
|
||||
client->SendItemPacket(EQEmu::invslot::CORPSE_BEGIN, pkinst, ItemPacketLoot);
|
||||
safe_delete(pkinst);
|
||||
}
|
||||
else {
|
||||
Log(Logs::General, Logs::Inventory, "MakeLootRequestPackets() PlayerKillItem %i not found", pkitemid);
|
||||
LogInventory("MakeLootRequestPackets() PlayerKillItem [{}] not found", pkitemid);
|
||||
|
||||
client->Message(CC_Red, "PlayerKillItem (id: %i) could not be found!", pkitemid);
|
||||
client->Message(Chat::Red, "PlayerKillItem (id: %i) could not be found!", pkitemid);
|
||||
}
|
||||
|
||||
client->QueuePacket(app);
|
||||
@@ -1080,7 +1083,7 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a
|
||||
if (item->RecastDelay)
|
||||
inst->SetRecastTimestamp(timestamps.count(item->RecastType) ? timestamps.at(item->RecastType) : 0);
|
||||
|
||||
Log(Logs::Moderate, Logs::Inventory, "MakeLootRequestPackets() Slot %i, Item '%s'", loot_slot, item->Name);
|
||||
LogInventory("MakeLootRequestPackets() Slot [{}], Item [{}]", loot_slot, item->Name);
|
||||
|
||||
client->SendItemPacket(loot_slot, inst, ItemPacketLoot);
|
||||
safe_delete(inst);
|
||||
@@ -1104,7 +1107,7 @@ void Corpse::LootItem(Client *client, const EQApplicationPacket *app)
|
||||
|
||||
auto lootitem = (LootingItem_Struct *)app->pBuffer;
|
||||
|
||||
Log(Logs::Moderate, Logs::Inventory, "LootItem() LootRequestType %u, Slot %u for %s", loot_request_type, lootitem->slot_id, client->GetName());
|
||||
LogInventory("LootItem() LootRequestType [{}], Slot [{}] for [{}]", (int) loot_request_type, lootitem->slot_id, client->GetName());
|
||||
|
||||
if (loot_request_type < LootRequestType::GMAllowed) { // LootRequestType::Forbidden and LootRequestType::GMPeek
|
||||
client->QueuePacket(app);
|
||||
@@ -1126,7 +1129,7 @@ void Corpse::LootItem(Client *client, const EQApplicationPacket *app)
|
||||
|
||||
/* To prevent item loss for a player using 'Loot All' who doesn't have inventory space for all their items. */
|
||||
if (RuleB(Character, CheckCursorEmptyWhenLooting) && !client->GetInv().CursorEmpty()) {
|
||||
client->Message(13, "You may not loot an item while you have an item on your cursor.");
|
||||
client->Message(Chat::Red, "You may not loot an item while you have an item on your cursor.");
|
||||
client->QueuePacket(app);
|
||||
SendEndLootErrorPacket(client);
|
||||
/* Unlock corpse for others */
|
||||
@@ -1143,7 +1146,7 @@ void Corpse::LootItem(Client *client, const EQApplicationPacket *app)
|
||||
|
||||
if (IsPlayerCorpse() && !CanPlayerLoot(client->CharacterID()) && !become_npc &&
|
||||
(char_id != client->CharacterID() && client->Admin() < 150)) {
|
||||
client->Message(13, "Error: This is a player corpse and you dont own it.");
|
||||
client->Message(Chat::Red, "Error: This is a player corpse and you dont own it.");
|
||||
client->QueuePacket(app);
|
||||
SendEndLootErrorPacket(client);
|
||||
return;
|
||||
@@ -1152,13 +1155,13 @@ void Corpse::LootItem(Client *client, const EQApplicationPacket *app)
|
||||
if (is_locked && client->Admin() < 100) {
|
||||
client->QueuePacket(app);
|
||||
SendLootReqErrorPacket(client, LootResponse::SomeoneElse);
|
||||
client->Message(13, "Error: Corpse locked by GM.");
|
||||
client->Message(Chat::Red, "Error: Corpse locked by GM.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (IsPlayerCorpse() && (char_id != client->CharacterID()) && CanPlayerLoot(client->CharacterID()) &&
|
||||
GetPlayerKillItem() == 0) {
|
||||
client->Message(13, "Error: You cannot loot any more items from this corpse.");
|
||||
client->Message(Chat::Red, "Error: You cannot loot any more items from this corpse.");
|
||||
client->QueuePacket(app);
|
||||
SendEndLootErrorPacket(client);
|
||||
ResetLooter();
|
||||
@@ -1198,7 +1201,7 @@ void Corpse::LootItem(Client *client, const EQApplicationPacket *app)
|
||||
|
||||
if (client && inst) {
|
||||
if (client->CheckLoreConflict(item)) {
|
||||
client->Message_StringID(0, LOOT_LORE_ERROR);
|
||||
client->MessageString(Chat::White, LOOT_LORE_ERROR);
|
||||
client->QueuePacket(app);
|
||||
SendEndLootErrorPacket(client);
|
||||
ResetLooter();
|
||||
@@ -1211,7 +1214,7 @@ void Corpse::LootItem(Client *client, const EQApplicationPacket *app)
|
||||
EQEmu::ItemInstance *itm = inst->GetAugment(i);
|
||||
if (itm) {
|
||||
if (client->CheckLoreConflict(itm->GetItem())) {
|
||||
client->Message_StringID(0, LOOT_LORE_ERROR);
|
||||
client->MessageString(Chat::White, LOOT_LORE_ERROR);
|
||||
client->QueuePacket(app);
|
||||
SendEndLootErrorPacket(client);
|
||||
ResetLooter();
|
||||
@@ -1233,7 +1236,7 @@ void Corpse::LootItem(Client *client, const EQApplicationPacket *app)
|
||||
args.push_back(this);
|
||||
if (parse->EventPlayer(EVENT_LOOT, client, buf, 0, &args) != 0) {
|
||||
lootitem->auto_loot = -1;
|
||||
client->Message_StringID(CC_Red, LOOT_NOT_ALLOWED, inst->GetItem()->Name);
|
||||
client->MessageString(Chat::Red, LOOT_NOT_ALLOWED, inst->GetItem()->Name);
|
||||
client->QueuePacket(app);
|
||||
delete inst;
|
||||
return;
|
||||
@@ -1309,18 +1312,18 @@ void Corpse::LootItem(Client *client, const EQApplicationPacket *app)
|
||||
|
||||
linker.GenerateLink();
|
||||
|
||||
client->Message_StringID(MT_LootMessages, LOOTED_MESSAGE, linker.Link().c_str());
|
||||
client->MessageString(Chat::Loot, LOOTED_MESSAGE, linker.Link().c_str());
|
||||
|
||||
if (!IsPlayerCorpse()) {
|
||||
Group *g = client->GetGroup();
|
||||
if (g != nullptr) {
|
||||
g->GroupMessage_StringID(client, MT_LootMessages, OTHER_LOOTED_MESSAGE,
|
||||
g->GroupMessageString(client, Chat::Loot, OTHER_LOOTED_MESSAGE,
|
||||
client->GetName(), linker.Link().c_str());
|
||||
}
|
||||
else {
|
||||
Raid *r = client->GetRaid();
|
||||
if (r != nullptr) {
|
||||
r->RaidMessage_StringID(client, MT_LootMessages, OTHER_LOOTED_MESSAGE,
|
||||
r->RaidMessageString(client, Chat::Loot, OTHER_LOOTED_MESSAGE,
|
||||
client->GetName(), linker.Link().c_str());
|
||||
}
|
||||
}
|
||||
@@ -1368,7 +1371,7 @@ void Corpse::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) {
|
||||
|
||||
void Corpse::QueryLoot(Client* to) {
|
||||
int x = 0, y = 0; // x = visible items, y = total items
|
||||
to->Message(0, "Coin: %ip, %ig, %is, %ic", platinum, gold, silver, copper);
|
||||
to->Message(Chat::White, "Coin: %ip, %ig, %is, %ic", platinum, gold, silver, copper);
|
||||
|
||||
ItemList::iterator cur,end;
|
||||
cur = itemlist.begin();
|
||||
@@ -1402,19 +1405,19 @@ void Corpse::QueryLoot(Client* to) {
|
||||
const EQEmu::ItemData* item = database.GetItem(sitem->item_id);
|
||||
|
||||
if (item)
|
||||
to->Message(0, "LootSlot: %i Item: %s (%d), Count: %i", sitem->lootslot, item->Name, item->ID, sitem->charges);
|
||||
to->Message(Chat::White, "LootSlot: %i Item: %s (%d), Count: %i", sitem->lootslot, item->Name, item->ID, sitem->charges);
|
||||
else
|
||||
to->Message(0, "Error: 0x%04x", sitem->item_id);
|
||||
to->Message(Chat::White, "Error: 0x%04x", sitem->item_id);
|
||||
|
||||
y++;
|
||||
}
|
||||
}
|
||||
|
||||
if (IsPlayerCorpse()) {
|
||||
to->Message(0, "%i visible %s (%i total) on %s (DBID: %i).", x, x==1?"item":"items", y, this->GetName(), this->GetCorpseDBID());
|
||||
to->Message(Chat::White, "%i visible %s (%i total) on %s (DBID: %i).", x, x==1?"item":"items", y, this->GetName(), this->GetCorpseDBID());
|
||||
}
|
||||
else {
|
||||
to->Message(0, "%i %s on %s.", y, y==1?"item":"items", this->GetName());
|
||||
to->Message(Chat::White, "%i %s on %s.", y, y==1?"item":"items", this->GetName());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1423,7 +1426,7 @@ bool Corpse::Summon(Client* client, bool spell, bool CheckDistance) {
|
||||
if (!spell) {
|
||||
if (this->GetCharID() == client->CharacterID()) {
|
||||
if (IsLocked() && client->Admin() < 100) {
|
||||
client->Message(13, "That corpse is locked by a GM.");
|
||||
client->Message(Chat::Red, "That corpse is locked by a GM.");
|
||||
return false;
|
||||
}
|
||||
if (!CheckDistance || (DistanceSquaredNoZ(m_Position, client->GetPosition()) <= dist2)) {
|
||||
@@ -1431,7 +1434,7 @@ bool Corpse::Summon(Client* client, bool spell, bool CheckDistance) {
|
||||
is_corpse_changed = true;
|
||||
}
|
||||
else {
|
||||
client->Message(0, "Corpse is too far away.");
|
||||
client->Message(Chat::White, "Corpse is too far away.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1446,14 +1449,14 @@ bool Corpse::Summon(Client* client, bool spell, bool CheckDistance) {
|
||||
is_corpse_changed = true;
|
||||
}
|
||||
else {
|
||||
client->Message(0, "Corpse is too far away.");
|
||||
client->Message(Chat::White, "Corpse is too far away.");
|
||||
return false;
|
||||
}
|
||||
consented = true;
|
||||
}
|
||||
}
|
||||
if(!consented) {
|
||||
client->Message(0, "You do not have permission to move this corpse.");
|
||||
client->Message(Chat::White, "You do not have permission to move this corpse.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
+13
-13
@@ -171,7 +171,7 @@ void Doors::HandleClick(Client* sender, uint8 trigger) {
|
||||
if (RuleI(Adventure, ItemIDToEnablePorts) != 0) {
|
||||
if (!sender->KeyRingCheck(RuleI(Adventure, ItemIDToEnablePorts))) {
|
||||
if (sender->GetInv().HasItem(RuleI(Adventure, ItemIDToEnablePorts)) == INVALID_INDEX) {
|
||||
sender->Message_StringID(13, DUNGEON_SEALED);
|
||||
sender->MessageString(Chat::Red, DUNGEON_SEALED);
|
||||
safe_delete(outapp);
|
||||
return;
|
||||
} else {
|
||||
@@ -267,7 +267,7 @@ void Doors::HandleClick(Client* sender, uint8 trigger) {
|
||||
strcpy(door_message, "Door is locked by an unknown guild");
|
||||
}
|
||||
|
||||
sender->Message(4, door_message);
|
||||
sender->Message(Chat::LightBlue, door_message);
|
||||
safe_delete(outapp);
|
||||
return;
|
||||
}
|
||||
@@ -275,13 +275,13 @@ void Doors::HandleClick(Client* sender, uint8 trigger) {
|
||||
/**
|
||||
* Key required
|
||||
*/
|
||||
sender->Message(4, "This is locked...");
|
||||
sender->Message(Chat::LightBlue, "This is locked...");
|
||||
|
||||
/**
|
||||
* GM can always open locks
|
||||
*/
|
||||
if (sender->GetGM()) {
|
||||
sender->Message_StringID(4, DOORS_GM);
|
||||
sender->MessageString(Chat::LightBlue, DOORS_GM);
|
||||
|
||||
if (!IsDoorOpen() || (open_type == 58)) {
|
||||
move_door_packet->action = static_cast<uint8>(invert_state == 0 ? OPEN_DOOR : OPEN_INVDOOR);
|
||||
@@ -306,7 +306,7 @@ void Doors::HandleClick(Client* sender, uint8 trigger) {
|
||||
sender->KeyRingAdd(player_key);
|
||||
}
|
||||
|
||||
sender->Message(4, "You got it open!");
|
||||
sender->Message(Chat::LightBlue, "You got it open!");
|
||||
|
||||
if (!IsDoorOpen() || (open_type == 58)) {
|
||||
move_door_packet->action = static_cast<uint8>(invert_state == 0 ? OPEN_DOOR : OPEN_INVDOOR);
|
||||
@@ -325,7 +325,7 @@ void Doors::HandleClick(Client* sender, uint8 trigger) {
|
||||
float player_pick_lock_skill = sender->GetSkill(EQEmu::skills::SkillPickLock);
|
||||
sender->CheckIncreaseSkill(EQEmu::skills::SkillPickLock, nullptr, 1);
|
||||
|
||||
Log(Logs::General, Logs::Skills, "Client has lockpicks: skill=%f", player_pick_lock_skill);
|
||||
LogSkills("Client has lockpicks: skill=[{}]", player_pick_lock_skill);
|
||||
|
||||
if (GetLockpick() <= player_pick_lock_skill) {
|
||||
if (!IsDoorOpen()) {
|
||||
@@ -333,19 +333,19 @@ void Doors::HandleClick(Client* sender, uint8 trigger) {
|
||||
} else {
|
||||
move_door_packet->action = static_cast<uint8>(invert_state == 0 ? CLOSE_DOOR : CLOSE_INVDOOR);
|
||||
}
|
||||
sender->Message_StringID(4, DOORS_SUCCESSFUL_PICK);
|
||||
sender->MessageString(Chat::LightBlue, DOORS_SUCCESSFUL_PICK);
|
||||
} else {
|
||||
sender->Message_StringID(4, DOORS_INSUFFICIENT_SKILL);
|
||||
sender->MessageString(Chat::LightBlue, DOORS_INSUFFICIENT_SKILL);
|
||||
safe_delete(outapp);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
sender->Message_StringID(4, DOORS_NO_PICK);
|
||||
sender->MessageString(Chat::LightBlue, DOORS_NO_PICK);
|
||||
safe_delete(outapp);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
sender->Message_StringID(4, DOORS_CANT_PICK);
|
||||
sender->MessageString(Chat::LightBlue, DOORS_CANT_PICK);
|
||||
safe_delete(outapp);
|
||||
return;
|
||||
}
|
||||
@@ -361,14 +361,14 @@ void Doors::HandleClick(Client* sender, uint8 trigger) {
|
||||
*/
|
||||
if (sender->KeyRingCheck(required_key_item)) {
|
||||
player_key = required_key_item;
|
||||
sender->Message(4, "You got it open!"); // more debug spam
|
||||
sender->Message(Chat::LightBlue, "You got it open!"); // more debug spam
|
||||
if (!IsDoorOpen() || (open_type == 58)) {
|
||||
move_door_packet->action = static_cast<uint8>(invert_state == 0 ? OPEN_DOOR : OPEN_INVDOOR);
|
||||
} else {
|
||||
move_door_packet->action = static_cast<uint8>(invert_state == 0 ? CLOSE_DOOR : CLOSE_INVDOOR);
|
||||
}
|
||||
} else {
|
||||
sender->Message_StringID(4, DOORS_LOCKED);
|
||||
sender->MessageString(Chat::LightBlue, DOORS_LOCKED);
|
||||
safe_delete(outapp);
|
||||
return;
|
||||
}
|
||||
@@ -679,7 +679,7 @@ int32 ZoneDatabase::GetDoorsDBCountPlusOne(const char *zone_name, int16 version)
|
||||
}
|
||||
|
||||
bool ZoneDatabase::LoadDoors(int32 door_count, Door *into, const char *zone_name, int16 version) {
|
||||
Log(Logs::General, Logs::Status, "Loading Doors from database...");
|
||||
LogInfo("Loading Doors from database");
|
||||
|
||||
std::string query = StringFormat(
|
||||
" SELECT "
|
||||
|
||||
+25
-23
@@ -122,11 +122,12 @@ int32 Mob::GetActSpellDamage(uint16 spell_id, int32 value, Mob* target) {
|
||||
else if (IsNPC() && CastToNPC()->GetSpellScale())
|
||||
value = int(static_cast<float>(value) * CastToNPC()->GetSpellScale() / 100.0f);
|
||||
|
||||
entity_list.MessageClose_StringID(this, true, 100, MT_SpellCrits,
|
||||
OTHER_CRIT_BLAST, GetName(), itoa(-value));
|
||||
entity_list.MessageCloseString(
|
||||
this, true, 100, Chat::SpellCrit,
|
||||
OTHER_CRIT_BLAST, GetName(), itoa(-value));
|
||||
|
||||
if (IsClient())
|
||||
Message_StringID(MT_SpellCrits, YOU_CRIT_BLAST, itoa(-value));
|
||||
MessageString(Chat::SpellCrit, YOU_CRIT_BLAST, itoa(-value));
|
||||
|
||||
return value;
|
||||
}
|
||||
@@ -306,11 +307,12 @@ int32 Mob::GetActSpellHealing(uint16 spell_id, int32 value, Mob* target) {
|
||||
value = int(static_cast<float>(value) * CastToNPC()->GetHealScale() / 100.0f);
|
||||
|
||||
if (Critical) {
|
||||
entity_list.MessageClose_StringID(this, true, 100, MT_SpellCrits,
|
||||
OTHER_CRIT_HEAL, GetName(), itoa(value));
|
||||
entity_list.MessageCloseString(
|
||||
this, true, 100, Chat::SpellCrit,
|
||||
OTHER_CRIT_HEAL, GetName(), itoa(value));
|
||||
|
||||
if (IsClient())
|
||||
Message_StringID(MT_SpellCrits, YOU_CRIT_HEAL, itoa(value));
|
||||
MessageString(Chat::SpellCrit, YOU_CRIT_HEAL, itoa(value));
|
||||
}
|
||||
|
||||
return value;
|
||||
@@ -432,13 +434,13 @@ bool Client::TrainDiscipline(uint32 itemid) {
|
||||
//get the item info
|
||||
const EQEmu::ItemData *item = database.GetItem(itemid);
|
||||
if(item == nullptr) {
|
||||
Message(13, "Unable to find the tome you turned in!");
|
||||
Log(Logs::General, Logs::Error, "Unable to find turned in tome id %lu\n", (unsigned long)itemid);
|
||||
Message(Chat::Red, "Unable to find the tome you turned in!");
|
||||
LogError("Unable to find turned in tome id [{}]\n", (unsigned long)itemid);
|
||||
return(false);
|
||||
}
|
||||
|
||||
if (!item->IsClassCommon() || item->ItemType != EQEmu::item::ItemTypeSpell) {
|
||||
Message(13, "Invalid item type, you cannot learn from this item.");
|
||||
Message(Chat::Red, "Invalid item type, you cannot learn from this item.");
|
||||
//summon them the item back...
|
||||
SummonItem(itemid);
|
||||
return(false);
|
||||
@@ -462,7 +464,7 @@ bool Client::TrainDiscipline(uint32 itemid) {
|
||||
item->Name[5] == ':' &&
|
||||
item->Name[6] == ' '
|
||||
)) {
|
||||
Message(13, "This item is not a tome.");
|
||||
Message(Chat::Red, "This item is not a tome.");
|
||||
//summon them the item back...
|
||||
SummonItem(itemid);
|
||||
return(false);
|
||||
@@ -470,7 +472,7 @@ bool Client::TrainDiscipline(uint32 itemid) {
|
||||
|
||||
int myclass = GetClass();
|
||||
if(myclass == WIZARD || myclass == ENCHANTER || myclass == MAGICIAN || myclass == NECROMANCER) {
|
||||
Message(13, "Your class cannot learn from this tome.");
|
||||
Message(Chat::Red, "Your class cannot learn from this tome.");
|
||||
//summon them the item back...
|
||||
SummonItem(itemid);
|
||||
return(false);
|
||||
@@ -480,7 +482,7 @@ bool Client::TrainDiscipline(uint32 itemid) {
|
||||
//can we use the item?
|
||||
uint32 cbit = 1 << (myclass-1);
|
||||
if(!(item->Classes & cbit)) {
|
||||
Message(13, "Your class cannot learn from this tome.");
|
||||
Message(Chat::Red, "Your class cannot learn from this tome.");
|
||||
//summon them the item back...
|
||||
SummonItem(itemid);
|
||||
return(false);
|
||||
@@ -488,7 +490,7 @@ bool Client::TrainDiscipline(uint32 itemid) {
|
||||
|
||||
uint32 spell_id = item->Scroll.Effect;
|
||||
if(!IsValidSpell(spell_id)) {
|
||||
Message(13, "This tome contains invalid knowledge.");
|
||||
Message(Chat::Red, "This tome contains invalid knowledge.");
|
||||
return(false);
|
||||
}
|
||||
|
||||
@@ -496,14 +498,14 @@ bool Client::TrainDiscipline(uint32 itemid) {
|
||||
const SPDat_Spell_Struct &spell = spells[spell_id];
|
||||
uint8 level_to_use = spell.classes[myclass - 1];
|
||||
if(level_to_use == 255) {
|
||||
Message(13, "Your class cannot learn from this tome.");
|
||||
Message(Chat::Red, "Your class cannot learn from this tome.");
|
||||
//summon them the item back...
|
||||
SummonItem(itemid);
|
||||
return(false);
|
||||
}
|
||||
|
||||
if(level_to_use > GetLevel()) {
|
||||
Message(13, "You must be at least level %d to learn this discipline.", level_to_use);
|
||||
Message(Chat::Red, "You must be at least level %d to learn this discipline.", level_to_use);
|
||||
//summon them the item back...
|
||||
SummonItem(itemid);
|
||||
return(false);
|
||||
@@ -513,7 +515,7 @@ bool Client::TrainDiscipline(uint32 itemid) {
|
||||
int r;
|
||||
for(r = 0; r < MAX_PP_DISCIPLINES; r++) {
|
||||
if(m_pp.disciplines.values[r] == spell_id) {
|
||||
Message(13, "You already know this discipline.");
|
||||
Message(Chat::Red, "You already know this discipline.");
|
||||
//summon them the item back...
|
||||
SummonItem(itemid);
|
||||
return(false);
|
||||
@@ -525,7 +527,7 @@ bool Client::TrainDiscipline(uint32 itemid) {
|
||||
return(true);
|
||||
}
|
||||
}
|
||||
Message(13, "You have learned too many disciplines and can learn no more.");
|
||||
Message(Chat::Red, "You have learned too many disciplines and can learn no more.");
|
||||
return(false);
|
||||
}
|
||||
|
||||
@@ -537,7 +539,7 @@ void Client::TrainDiscBySpellID(int32 spell_id)
|
||||
m_pp.disciplines.values[i] = spell_id;
|
||||
database.SaveCharacterDisc(this->CharacterID(), i, spell_id);
|
||||
SendDisciplineUpdate();
|
||||
Message(15, "You have learned a new combat ability!");
|
||||
Message(Chat::Yellow, "You have learned a new combat ability!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -581,7 +583,7 @@ bool Client::UseDiscipline(uint32 spell_id, uint32 target) {
|
||||
|
||||
//make sure we can use it..
|
||||
if(!IsValidSpell(spell_id)) {
|
||||
Message(13, "This tome contains invalid knowledge.");
|
||||
Message(Chat::Red, "This tome contains invalid knowledge.");
|
||||
return(false);
|
||||
}
|
||||
|
||||
@@ -589,13 +591,13 @@ bool Client::UseDiscipline(uint32 spell_id, uint32 target) {
|
||||
const SPDat_Spell_Struct &spell = spells[spell_id];
|
||||
uint8 level_to_use = spell.classes[GetClass() - 1];
|
||||
if(level_to_use == 255) {
|
||||
Message(13, "Your class cannot learn from this tome.");
|
||||
Message(Chat::Red, "Your class cannot learn from this tome.");
|
||||
//should summon them a new one...
|
||||
return(false);
|
||||
}
|
||||
|
||||
if(level_to_use > GetLevel()) {
|
||||
Message_StringID(13, DISC_LEVEL_USE_ERROR);
|
||||
MessageString(Chat::Red, DISC_LEVEL_USE_ERROR);
|
||||
//should summon them a new one...
|
||||
return(false);
|
||||
}
|
||||
@@ -607,7 +609,7 @@ bool Client::UseDiscipline(uint32 spell_id, uint32 target) {
|
||||
|
||||
// sneak attack discs require you to be hidden for 4 seconds before use
|
||||
if (spell.sneak && (!hidden || (hidden && (Timer::GetCurrentTime() - tmHidden) < 4000))) {
|
||||
Message_StringID(MT_SpellFailure, SNEAK_RESTRICT);
|
||||
MessageString(Chat::SpellFailure, SNEAK_RESTRICT);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -621,7 +623,7 @@ bool Client::UseDiscipline(uint32 spell_id, uint32 target) {
|
||||
/*char val1[20]={0};*/ //unused
|
||||
/*char val2[20]={0};*/ //unused
|
||||
uint32 remain = p_timers.GetRemainingTime(DiscTimer);
|
||||
//Message_StringID(0, DISCIPLINE_CANUSEIN, ConvertArray((remain)/60,val1), ConvertArray(remain%60,val2));
|
||||
//MessageString(Chat::White, DISCIPLINE_CANUSEIN, ConvertArray((remain)/60,val1), ConvertArray(remain%60,val2));
|
||||
Message(0, "You can use this discipline in %d minutes %d seconds.", ((remain)/60), (remain%60));
|
||||
return(false);
|
||||
}
|
||||
|
||||
+5
-13
@@ -145,7 +145,7 @@ void PerlembParser::ReloadQuests() {
|
||||
perl = nullptr;
|
||||
}
|
||||
|
||||
Log(Logs::General, Logs::Status, "Error re-initializing perlembed: %s", e.what());
|
||||
LogInfo("Error re-initializing perlembed: [{}]", e.what());
|
||||
throw e.what();
|
||||
}
|
||||
|
||||
@@ -1046,7 +1046,7 @@ void PerlembParser::ExportMobVariables(bool isPlayerQuest, bool isGlobalPlayerQu
|
||||
if (mob && npcmob && mob->IsClient()) {
|
||||
Client* client = mob->CastToClient();
|
||||
|
||||
fac = client->GetFactionLevel(client->CharacterID(), npcmob->GetID(), client->GetRace(),
|
||||
fac = client->GetFactionLevel(client->CharacterID(), npcmob->GetID(), client->GetFactionRace(),
|
||||
client->GetClass(), client->GetDeity(), npcmob->GetPrimaryFaction(), npcmob);
|
||||
}
|
||||
}
|
||||
@@ -1099,10 +1099,6 @@ void PerlembParser::ExportZoneVariables(std::string &package_name) {
|
||||
}
|
||||
}
|
||||
|
||||
#define HASITEM_FIRST 0
|
||||
#define HASITEM_LAST 29 // this includes worn plus 8 base slots
|
||||
#define HASITEM_ISNULLITEM(item) ((item==-1) || (item==0))
|
||||
|
||||
void PerlembParser::ExportItemVariables(std::string &package_name, Mob *mob) {
|
||||
if(mob && mob->IsClient())
|
||||
{
|
||||
@@ -1111,11 +1107,11 @@ void PerlembParser::ExportItemVariables(std::string &package_name, Mob *mob) {
|
||||
//start with an empty hash
|
||||
perl->eval(std::string("%").append(hashname).append(" = ();").c_str());
|
||||
|
||||
for(int slot = HASITEM_FIRST; slot <= HASITEM_LAST; slot++)
|
||||
for(int slot = EQEmu::invslot::EQUIPMENT_BEGIN; slot <= EQEmu::invslot::GENERAL_END; slot++)
|
||||
{
|
||||
char *hi_decl=nullptr;
|
||||
int itemid = mob->CastToClient()->GetItemIDAt(slot);
|
||||
if(!HASITEM_ISNULLITEM(itemid))
|
||||
if(itemid != -1 && itemid != 0)
|
||||
{
|
||||
MakeAnyLenString(&hi_decl, "push (@{$%s{%d}},%d);", hashname.c_str(), itemid, slot);
|
||||
perl->eval(hi_decl);
|
||||
@@ -1129,7 +1125,7 @@ void PerlembParser::ExportItemVariables(std::string &package_name, Mob *mob) {
|
||||
perl->eval(std::string("%").append(hashname).append(" = ();").c_str());
|
||||
char *hi_decl = nullptr;
|
||||
int itemid = mob->CastToClient()->GetItemIDAt(EQEmu::invslot::slotCursor);
|
||||
if(!HASITEM_ISNULLITEM(itemid)) {
|
||||
if(itemid != -1 && itemid != 0) {
|
||||
MakeAnyLenString(&hi_decl, "push (@{$%s{%d}},%d);",hashname.c_str(), itemid, EQEmu::invslot::slotCursor);
|
||||
perl->eval(hi_decl);
|
||||
safe_delete_array(hi_decl);
|
||||
@@ -1137,10 +1133,6 @@ void PerlembParser::ExportItemVariables(std::string &package_name, Mob *mob) {
|
||||
}
|
||||
}
|
||||
|
||||
#undef HASITEM_FIRST
|
||||
#undef HASITEM_LAST
|
||||
#undef HASITEM_ISNULLITEM
|
||||
|
||||
void PerlembParser::ExportEventVariables(std::string &package_name, QuestEventID event, uint32 objid, const char * data,
|
||||
NPC* npcmob, EQEmu::ItemInstance* item_inst, Mob* mob, uint32 extradata, std::vector<EQEmu::Any> *extra_pointers)
|
||||
{
|
||||
|
||||
+51
-54
@@ -155,12 +155,31 @@ XS(XS__say); // prototype to pass -Wmissing-prototypes
|
||||
XS(XS__say) {
|
||||
dXSARGS;
|
||||
|
||||
if (items == 1)
|
||||
quest_manager.say(SvPV_nolen(ST(0)));
|
||||
else if (items == 2)
|
||||
quest_manager.say(SvPV_nolen(ST(0)), (int) SvIV(ST(1)));
|
||||
else
|
||||
Perl_croak(aTHX_ "Usage: quest::say(string message, int language_id])");
|
||||
Journal::Options opts;
|
||||
// we currently default to these
|
||||
opts.speak_mode = Journal::SpeakMode::Say;
|
||||
opts.journal_mode = Journal::Mode::Log2;
|
||||
opts.language = 0;
|
||||
opts.message_type = Chat::NPCQuestSay;
|
||||
if (items == 0 || items > 5) {
|
||||
Perl_croak(aTHX_ "Usage: quest::say(string message, [int language_id], [int message_type], [int speak_mode], [int journal_mode])");
|
||||
} else if (items == 2) {
|
||||
opts.language = (int)SvIV(ST(1));
|
||||
} else if (items == 3) {
|
||||
opts.language = (int)SvIV(ST(1));
|
||||
opts.message_type = (int)SvIV(ST(2));
|
||||
} else if (items == 4) {
|
||||
opts.language = (int)SvIV(ST(1));
|
||||
opts.message_type = (int)SvIV(ST(2));
|
||||
opts.speak_mode = (Journal::SpeakMode)SvIV(ST(3));
|
||||
} else if (items == 5) {
|
||||
opts.language = (int)SvIV(ST(1));
|
||||
opts.message_type = (int)SvIV(ST(2));
|
||||
opts.speak_mode = (Journal::SpeakMode)SvIV(ST(3));
|
||||
opts.journal_mode = (Journal::Mode)SvIV(ST(4));
|
||||
}
|
||||
|
||||
quest_manager.say(SvPV_nolen(ST(0)), opts);
|
||||
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
@@ -207,8 +226,7 @@ XS(XS__spawn);
|
||||
XS(XS__spawn) {
|
||||
dXSARGS;
|
||||
if (items != 6)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: quest::spawn(int npc_type_id, int grid_id, int int_unused, float x, float y, float z)");
|
||||
Perl_croak(aTHX_ "Usage: quest::spawn(int npc_type_id, int grid_id, int int_unused, float x, float y, float z)");
|
||||
|
||||
uint16 RETVAL;
|
||||
dXSTARG;
|
||||
@@ -230,8 +248,7 @@ XS(XS__spawn2);
|
||||
XS(XS__spawn2) {
|
||||
dXSARGS;
|
||||
if (items != 7)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: quest::spawn2(int npc_type_id, int grid_id, int int_unused, float x, float y, float z, float heading)");
|
||||
Perl_croak(aTHX_ "Usage: quest::spawn2(int npc_type_id, int grid_id, int int_unused, float x, float y, float z, float heading)");
|
||||
|
||||
uint16 RETVAL;
|
||||
dXSTARG;
|
||||
@@ -253,8 +270,7 @@ XS(XS__unique_spawn);
|
||||
XS(XS__unique_spawn) {
|
||||
dXSARGS;
|
||||
if (items != 6 && items != 7)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: quest::unique_spawn(int npc_type_id, int grid_id, int int_unused, float x, float y, float z, [float heading])");
|
||||
Perl_croak(aTHX_ "Usage: quest::unique_spawn(int npc_type_id, int grid_id, int int_unused, float x, float y, float z, [float heading])");
|
||||
|
||||
uint16 RETVAL;
|
||||
dXSTARG;
|
||||
@@ -1296,8 +1312,7 @@ XS(XS__targlobal);
|
||||
XS(XS__targlobal) {
|
||||
dXSARGS;
|
||||
if (items != 6)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: quest::targlobal(stirng key, string value, string duration, int npc_id, int chararacter_id, int zone_id)");
|
||||
Perl_croak(aTHX_ "Usage: quest::targlobal(stirng key, string value, string duration, int npc_id, int chararacter_id, int zone_id)");
|
||||
|
||||
char *key = (char *) SvPV_nolen(ST(0));
|
||||
char *str_value = (char *) SvPV_nolen(ST(1));
|
||||
@@ -1392,8 +1407,7 @@ XS(XS__moveto);
|
||||
XS(XS__moveto) {
|
||||
dXSARGS;
|
||||
if (items != 3 && items != 4 && items != 5)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: quest::moveto(float x, float y, float z, [float heading], [bool save_guard_location])");
|
||||
Perl_croak(aTHX_ "Usage: quest::moveto(float x, float y, float z, [float heading], [bool save_guard_location])");
|
||||
|
||||
float x = (float) SvNV(ST(0));
|
||||
float y = (float) SvNV(ST(1));
|
||||
@@ -1542,8 +1556,7 @@ XS(XS__set_proximity);
|
||||
XS(XS__set_proximity) {
|
||||
dXSARGS;
|
||||
if (items != 4 && items != 6 && items != 7)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: quest::set_proximity(float min_x, float max_x, float min_y, float max_y, [float min_z], [float max_z], [say])");
|
||||
Perl_croak(aTHX_ "Usage: quest::set_proximity(float min_x, float max_x, float min_y, float max_y, [float min_z], [float max_z], [say])");
|
||||
|
||||
float min_x = (float) SvNV(ST(0));
|
||||
float max_x = (float) SvNV(ST(1));
|
||||
@@ -1624,8 +1637,7 @@ XS(XS__spawn_condition);
|
||||
XS(XS__spawn_condition) {
|
||||
dXSARGS;
|
||||
if (items < 3 || items > 4)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: quest::spawn_condition(string zone_short, [int instance_id], uint16 condition_id, int16 value)");
|
||||
Perl_croak(aTHX_ "Usage: quest::spawn_condition(string zone_short, [int instance_id], uint16 condition_id, int16 value)");
|
||||
|
||||
if (items == 3) {
|
||||
char *zone_short = (char *) SvPV_nolen(ST(0));
|
||||
@@ -1682,8 +1694,7 @@ XS(XS__toggle_spawn_event);
|
||||
XS(XS__toggle_spawn_event) {
|
||||
dXSARGS;
|
||||
if (items != 4)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: quest::toggle_spawn_event(uint32 event_id, [bool is_enabled = false], [bool is_strict = false], [bool reset_base = false])");
|
||||
Perl_croak(aTHX_ "Usage: quest::toggle_spawn_event(uint32 event_id, [bool is_enabled = false], [bool is_strict = false], [bool reset_base = false])");
|
||||
|
||||
uint32 event_id = (int) SvIV(ST(0));
|
||||
bool is_enabled = ((int) SvIV(ST(1))) == 0 ? false : true;
|
||||
@@ -1744,8 +1755,7 @@ XS(XS__summonburiedplayercorpse);
|
||||
XS(XS__summonburiedplayercorpse) {
|
||||
dXSARGS;
|
||||
if (items != 5)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: quest::summonburiedplayercorpse(uint32 char_id, float dest_x, float dest_y, float dest_z, float dest_heading)");
|
||||
Perl_croak(aTHX_ "Usage: quest::summonburiedplayercorpse(uint32 char_id, float dest_x, float dest_y, float dest_z, float dest_heading)");
|
||||
|
||||
bool RETVAL;
|
||||
uint32 char_id = (int) SvIV(ST(0));
|
||||
@@ -1762,8 +1772,7 @@ XS(XS__summonallplayercorpses);
|
||||
XS(XS__summonallplayercorpses) {
|
||||
dXSARGS;
|
||||
if (items != 5)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: quest::summonallplayercorpses(int char_id, float dest_x, float dest_y, float dest_z, float dest_heading)");
|
||||
Perl_croak(aTHX_ "Usage: quest::summonallplayercorpses(int char_id, float dest_x, float dest_y, float dest_z, float dest_heading)");
|
||||
|
||||
bool RETVAL;
|
||||
uint32 char_id = (int) SvIV(ST(0));
|
||||
@@ -2019,8 +2028,7 @@ XS(XS__playerfeature);
|
||||
XS(XS__playerfeature) {
|
||||
dXSARGS;
|
||||
if (items != 2)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: quest::playerfeature(string feature [race|gender|texture|helm|haircolor|beardcolor|eyecolor1|eyecolor2|hair|face|beard|heritage|tatoo|details|size], int setting)");
|
||||
Perl_croak(aTHX_ "Usage: quest::playerfeature(string feature [race|gender|texture|helm|haircolor|beardcolor|eyecolor1|eyecolor2|hair|face|beard|heritage|tatoo|details|size], int setting)");
|
||||
|
||||
char *str_value = (char *) SvPV_nolen(ST(0));
|
||||
int int_value = (int) SvIV(ST(1));
|
||||
@@ -2034,8 +2042,7 @@ XS(XS__npcfeature);
|
||||
XS(XS__npcfeature) {
|
||||
dXSARGS;
|
||||
if (items != 2)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: quest::npcfeature(string feature [race|gender|texture|helm|haircolor|beardcolor|eyecolor1|eyecolor2|hair|face|beard|heritage|tatoo|details|size], int value)");
|
||||
Perl_croak(aTHX_ "Usage: quest::npcfeature(string feature [race|gender|texture|helm|haircolor|beardcolor|eyecolor1|eyecolor2|hair|face|beard|heritage|tatoo|details|size], int value)");
|
||||
|
||||
char *str_value = (char *) SvPV_nolen(ST(0));
|
||||
int int_value = (int) SvIV(ST(1));
|
||||
@@ -2262,8 +2269,7 @@ XS(XS__updatetaskactivity) {
|
||||
}
|
||||
quest_manager.updatetaskactivity(task_id, activity_id, count, ignore_quest_update);
|
||||
} else {
|
||||
Perl_croak(aTHX_
|
||||
"Usage: quest::updatetaskactivity(int task_id, int activity_id, [int count], [bool ignore_quest_update = false])");
|
||||
Perl_croak(aTHX_ "Usage: quest::updatetaskactivity(int task_id, int activity_id, [int count], [bool ignore_quest_update = false])");
|
||||
}
|
||||
|
||||
XSRETURN_EMPTY;
|
||||
@@ -2551,8 +2557,7 @@ XS(XS__popup) {
|
||||
int duration = 0;
|
||||
|
||||
if ((items < 2) || (items > 5))
|
||||
Perl_croak(aTHX_
|
||||
"Usage: quest::popup(string window_title, string message, int popup_id, int buttons, int duration)");
|
||||
Perl_croak(aTHX_ "Usage: quest::popup(string window_title, string message, int popup_id, int buttons, int duration)");
|
||||
|
||||
if (items >= 3)
|
||||
popup_id = (int) SvIV(ST(2));
|
||||
@@ -2633,8 +2638,7 @@ XS(XS__CreateGroundObject);
|
||||
XS(XS__CreateGroundObject) {
|
||||
dXSARGS;
|
||||
if (items != 5 && items != 6)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: quest::creategroundobject(int item_id, float x, float y, float z, float heading, [uint32 decay_time-ms = 300000])");
|
||||
Perl_croak(aTHX_ "Usage: quest::creategroundobject(int item_id, float x, float y, float z, float heading, [uint32 decay_time-ms = 300000])");
|
||||
|
||||
int item_id = (int) SvIV(ST(0));
|
||||
float x = (float) SvNV(ST(1));
|
||||
@@ -2657,8 +2661,7 @@ XS(XS__CreateGroundObjectFromModel);
|
||||
XS(XS__CreateGroundObjectFromModel) {
|
||||
dXSARGS;
|
||||
if (items < 5 || items > 7)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: quest::creategroundobjectfrommodel(string model_name, float x, float y, float z, float heading, [int object_type], [uint32 decay_time-ms = 300000])");
|
||||
Perl_croak(aTHX_ "Usage: quest::creategroundobjectfrommodel(string model_name, float x, float y, float z, float heading, [int object_type], [uint32 decay_time-ms = 300000])");
|
||||
|
||||
char *modelname = (char *) SvPV_nolen(ST(0));
|
||||
float x = (float) SvNV(ST(1));
|
||||
@@ -2683,8 +2686,7 @@ XS(XS__CreateDoor);
|
||||
XS(XS__CreateDoor) {
|
||||
dXSARGS;
|
||||
if (items < 5 || items > 7)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: quest::createdoor(string model_name, float x, float y, float z, float heading, [int object_type = 58], [int size = 100])");
|
||||
Perl_croak(aTHX_ "Usage: quest::createdoor(string model_name, float x, float y, float z, float heading, [int object_type = 58], [int size = 100])");
|
||||
|
||||
char *modelname = (char *) SvPV_nolen(ST(0));
|
||||
float x = (float) SvNV(ST(1));
|
||||
@@ -3013,8 +3015,7 @@ XS(XS__MovePCInstance);
|
||||
XS(XS__MovePCInstance) {
|
||||
dXSARGS;
|
||||
if (items != 5 && items != 6)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: quest::MovePCInstance(int zone_id, int instance_id, float x, float y, float z, [float heading])");
|
||||
Perl_croak(aTHX_ "Usage: quest::MovePCInstance(int zone_id, int instance_id, float x, float y, float z, [float heading])");
|
||||
|
||||
int zone_id = (int) SvIV(ST(0));
|
||||
int instanceid = (int) SvIV(ST(1));
|
||||
@@ -3267,8 +3268,7 @@ XS(XS__wearchange);
|
||||
XS(XS__wearchange) {
|
||||
dXSARGS;
|
||||
if (items < 2)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: quest::wearchange(uint8 slot, uint16 texture_id, [uint32 hero_forge_model_id = 0], [uint32 elite_material_id = 0])");
|
||||
Perl_croak(aTHX_ "Usage: quest::wearchange(uint8 slot, uint16 texture_id, [uint32 hero_forge_model_id = 0], [uint32 elite_material_id = 0])");
|
||||
|
||||
uint8 slot = (int) SvUV(ST(0));
|
||||
uint16 texture_id = (int) SvUV(ST(1));
|
||||
@@ -3516,8 +3516,7 @@ XS(XS__crosszonesetentityvariablebynpctypeid) {
|
||||
dXSARGS;
|
||||
|
||||
if (items != 3)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: quest::crosszonesetentityvariablebynpctypeid(int npc_type_id, string key, string value)");
|
||||
Perl_croak(aTHX_ "Usage: quest::crosszonesetentityvariablebynpctypeid(int npc_type_id, string key, string value)");
|
||||
|
||||
if (items == 3) {
|
||||
uint32 npc_type_id = (uint32) SvIV(ST(0));
|
||||
@@ -3534,8 +3533,7 @@ XS(XS__crosszonesetentityvariablebyclientname) {
|
||||
dXSARGS;
|
||||
|
||||
if (items != 3)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: quest::crosszonesetentityvariablebyclientname(string client_name, string key, string value)");
|
||||
Perl_croak(aTHX_ "Usage: quest::crosszonesetentityvariablebyclientname(string client_name, string key, string value)");
|
||||
|
||||
if (items == 3) {
|
||||
const char *client_name = (const char *) SvPV_nolen(ST(0));
|
||||
@@ -3567,8 +3565,7 @@ XS(XS__worldwidemarquee);
|
||||
XS(XS__worldwidemarquee) {
|
||||
dXSARGS;
|
||||
if (items != 6)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: quest::worldwidemarquee(uint32 color_id, uint32 priority, uint32 fade_in, uint32 fade_out, uint32 duration, string message)");
|
||||
Perl_croak(aTHX_ "Usage: quest::worldwidemarquee(uint32 color_id, uint32 priority, uint32 fade_in, uint32 fade_out, uint32 duration, string message)");
|
||||
|
||||
if (items == 6) {
|
||||
uint32 color_id = (uint32) SvIV(ST(0));
|
||||
@@ -3599,11 +3596,11 @@ XS(XS__debug) {
|
||||
return;
|
||||
|
||||
if (debug_level == Logs::General) {
|
||||
Log(Logs::General, Logs::QuestDebug, log_message);
|
||||
Log(Logs::General, Logs::QuestDebug, log_message.c_str());
|
||||
} else if (debug_level == Logs::Moderate) {
|
||||
Log(Logs::Moderate, Logs::QuestDebug, log_message);
|
||||
Log(Logs::Moderate, Logs::QuestDebug, log_message.c_str());
|
||||
} else if (debug_level == Logs::Detail) {
|
||||
Log(Logs::Detail, Logs::QuestDebug, log_message);
|
||||
Log(Logs::Detail, Logs::QuestDebug, log_message.c_str());
|
||||
}
|
||||
}
|
||||
XSRETURN_EMPTY;
|
||||
@@ -3728,7 +3725,7 @@ EXTERN_C XS(boot_quest) {
|
||||
file[255] = '\0';
|
||||
|
||||
if (items != 1)
|
||||
Log(Logs::General, Logs::Error, "boot_quest does not take any arguments.");
|
||||
LogError("boot_quest does not take any arguments");
|
||||
|
||||
char buf[128]; //shouldent have any function names longer than this.
|
||||
|
||||
|
||||
+5
-5
@@ -140,12 +140,12 @@ void Embperl::DoInit() {
|
||||
catch(const char *err)
|
||||
{
|
||||
//remember... lasterr() is no good if we crap out here, in construction
|
||||
Log(Logs::General, Logs::Quests, "perl error: %s", err);
|
||||
LogQuests("perl error: [{}]", err);
|
||||
throw "failed to install eval_file hook";
|
||||
}
|
||||
|
||||
#ifdef EMBPERL_IO_CAPTURE
|
||||
Log(Logs::General, Logs::Quests, "Tying perl output to eqemu logs");
|
||||
LogQuests("Tying perl output to eqemu logs");
|
||||
//make a tieable class to capture IO and pass it into EQEMuLog
|
||||
eval_pv(
|
||||
"package EQEmuIO; "
|
||||
@@ -170,7 +170,7 @@ void Embperl::DoInit() {
|
||||
,FALSE
|
||||
);
|
||||
|
||||
Log(Logs::General, Logs::Quests, "Loading perlemb plugins.");
|
||||
LogQuests("Loading perlemb plugins");
|
||||
try
|
||||
{
|
||||
std::string perl_command;
|
||||
@@ -179,7 +179,7 @@ void Embperl::DoInit() {
|
||||
}
|
||||
catch(const char *err)
|
||||
{
|
||||
Log(Logs::General, Logs::Quests, "Warning - %s: %s", Config->PluginPlFile.c_str(), err);
|
||||
LogQuests("Warning - [{}]: [{}]", Config->PluginPlFile.c_str(), err);
|
||||
}
|
||||
try
|
||||
{
|
||||
@@ -197,7 +197,7 @@ void Embperl::DoInit() {
|
||||
}
|
||||
catch(const char *err)
|
||||
{
|
||||
Log(Logs::General, Logs::Quests, "Perl warning: %s", err);
|
||||
LogQuests("Perl warning: [{}]", err);
|
||||
}
|
||||
#endif //EMBPERL_PLUGIN
|
||||
in_use = false;
|
||||
|
||||
@@ -25,6 +25,10 @@ Eglin
|
||||
#ifndef WIN32
|
||||
extern "C" { //the perl headers dont do this for us...
|
||||
#endif
|
||||
#if _MSC_VER
|
||||
#define __inline__ __inline
|
||||
#define __builtin_expect
|
||||
#endif
|
||||
#include <perl.h>
|
||||
#include <XSUB.h>
|
||||
#ifndef WIN32
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ EXTERN_C XS(boot_qc)
|
||||
file[255] = '\0';
|
||||
|
||||
if(items != 1)
|
||||
Log(Logs::General, Logs::Error, "boot_qc does not take any arguments.");
|
||||
LogError("boot_qc does not take any arguments");
|
||||
|
||||
char buf[128]; //shouldent have any function names longer than this.
|
||||
|
||||
|
||||
@@ -8,6 +8,10 @@
|
||||
#ifndef WIN32
|
||||
extern "C" { //the perl headers dont do this for us...
|
||||
#endif
|
||||
#if _MSC_VER
|
||||
#define __inline__ __inline
|
||||
#define __builtin_expect
|
||||
#endif
|
||||
#include <perl.h>
|
||||
#include <XSUB.h>
|
||||
#ifndef WIN32
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ Encounter::Encounter(const char* enc_name)
|
||||
:Mob
|
||||
(
|
||||
nullptr, nullptr, 0, 0, 0, INVISIBLE_MAN, 0, BT_NoTarget, 0, 0, 0, 0, 0, glm::vec4(0,0,0,0), 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, EQEmu::TintProfile(), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, EQEmu::TintProfile(), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
)
|
||||
{
|
||||
encounter_name[0] = 0;
|
||||
|
||||
+325
-132
@@ -33,7 +33,6 @@
|
||||
#include "../common/guilds.h"
|
||||
|
||||
#include "guild_mgr.h"
|
||||
#include "net.h"
|
||||
#include "petitions.h"
|
||||
#include "quest_parser_collection.h"
|
||||
#include "raids.h"
|
||||
@@ -56,7 +55,6 @@
|
||||
extern Zone *zone;
|
||||
extern volatile bool is_zone_loaded;
|
||||
extern WorldServer worldserver;
|
||||
extern NetConnection net;
|
||||
extern uint32 numclients;
|
||||
extern PetitionList petition_list;
|
||||
|
||||
@@ -76,12 +74,12 @@ Entity::~Entity()
|
||||
Client *Entity::CastToClient()
|
||||
{
|
||||
if (this == 0x00) {
|
||||
Log(Logs::General, Logs::Error, "CastToClient error (nullptr)");
|
||||
LogError("CastToClient error (nullptr)");
|
||||
return 0;
|
||||
}
|
||||
#ifdef _EQDEBUG
|
||||
if (!IsClient()) {
|
||||
Log(Logs::General, Logs::Error, "CastToClient error (not client)");
|
||||
LogError("CastToClient error (not client)");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@@ -93,7 +91,7 @@ NPC *Entity::CastToNPC()
|
||||
{
|
||||
#ifdef _EQDEBUG
|
||||
if (!IsNPC()) {
|
||||
Log(Logs::General, Logs::Error, "CastToNPC error (Not NPC)");
|
||||
LogError("CastToNPC error (Not NPC)");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@@ -286,9 +284,27 @@ Bot *Entity::CastToBot()
|
||||
#endif
|
||||
return static_cast<Bot *>(this);
|
||||
}
|
||||
|
||||
const Bot *Entity::CastToBot() const
|
||||
{
|
||||
#ifdef _EQDEBUG
|
||||
if (!IsBot()) {
|
||||
std::cout << "CastToBot error" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
return static_cast<const Bot *>(this);
|
||||
}
|
||||
#endif
|
||||
|
||||
EntityList::EntityList()
|
||||
:
|
||||
object_timer(5000),
|
||||
door_timer(5000),
|
||||
corpse_timer(2000),
|
||||
group_timer(1000),
|
||||
raid_timer(1000),
|
||||
trap_timer(1000)
|
||||
{
|
||||
// set up ids between 1 and 1500
|
||||
// neither client or server performs well if you have
|
||||
@@ -338,7 +354,7 @@ void EntityList::TrapProcess()
|
||||
return;
|
||||
|
||||
if (trap_list.empty()) {
|
||||
net.trap_timer.Disable();
|
||||
trap_timer.Disable();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -366,7 +382,7 @@ void EntityList::CheckGroupList (const char *fname, const int fline)
|
||||
{
|
||||
if (*it == nullptr)
|
||||
{
|
||||
Log(Logs::General, Logs::Error, "nullptr group, %s:%i", fname, fline);
|
||||
LogError("nullptr group, [{}]:[{}]", fname, fline);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -377,7 +393,7 @@ void EntityList::GroupProcess()
|
||||
return;
|
||||
|
||||
if (group_list.empty()) {
|
||||
net.group_timer.Disable();
|
||||
group_timer.Disable();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -401,7 +417,7 @@ void EntityList::RaidProcess()
|
||||
return;
|
||||
|
||||
if (raid_list.empty()) {
|
||||
net.raid_timer.Disable();
|
||||
raid_timer.Disable();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -416,7 +432,7 @@ void EntityList::DoorProcess()
|
||||
return;
|
||||
#endif
|
||||
if (door_list.empty()) {
|
||||
net.door_timer.Disable();
|
||||
door_timer.Disable();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -434,7 +450,7 @@ void EntityList::DoorProcess()
|
||||
void EntityList::ObjectProcess()
|
||||
{
|
||||
if (object_list.empty()) {
|
||||
net.object_timer.Disable();
|
||||
object_timer.Disable();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -453,7 +469,7 @@ void EntityList::ObjectProcess()
|
||||
void EntityList::CorpseProcess()
|
||||
{
|
||||
if (corpse_list.empty()) {
|
||||
net.corpse_timer.Disable(); // No corpses in list
|
||||
corpse_timer.Disable(); // No corpses in list
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -509,32 +525,32 @@ void EntityList::MobProcess()
|
||||
}
|
||||
|
||||
if(mob_dead) {
|
||||
if(mob->IsNPC()) {
|
||||
entity_list.RemoveNPC(id);
|
||||
}
|
||||
else if(mob->IsMerc()) {
|
||||
if(mob->IsMerc()) {
|
||||
entity_list.RemoveMerc(id);
|
||||
#ifdef BOTS
|
||||
}
|
||||
#ifdef BOTS
|
||||
else if(mob->IsBot()) {
|
||||
entity_list.RemoveBot(id);
|
||||
}
|
||||
#endif
|
||||
else if(mob->IsNPC()) {
|
||||
entity_list.RemoveNPC(id);
|
||||
}
|
||||
else {
|
||||
#ifdef _WINDOWS
|
||||
struct in_addr in;
|
||||
in.s_addr = mob->CastToClient()->GetIP();
|
||||
Log(Logs::General, Logs::Zone_Server, "Dropping client: Process=false, ip=%s port=%u", inet_ntoa(in), mob->CastToClient()->GetPort());
|
||||
LogInfo("Dropping client: Process=false, ip=[{}] port=[{}]", inet_ntoa(in), mob->CastToClient()->GetPort());
|
||||
#endif
|
||||
zone->StartShutdownTimer();
|
||||
Group *g = GetGroupByMob(mob);
|
||||
if(g) {
|
||||
Log(Logs::General, Logs::Error, "About to delete a client still in a group.");
|
||||
LogError("About to delete a client still in a group");
|
||||
g->DelMember(mob);
|
||||
}
|
||||
Raid *r = entity_list.GetRaidByClient(mob->CastToClient());
|
||||
if(r) {
|
||||
Log(Logs::General, Logs::Error, "About to delete a client still in a raid.");
|
||||
LogError("About to delete a client still in a raid");
|
||||
r->MemberZoned(mob->CastToClient());
|
||||
}
|
||||
entity_list.RemoveClient(id);
|
||||
@@ -581,8 +597,7 @@ void EntityList::AddGroup(Group *group)
|
||||
|
||||
uint32 gid = worldserver.NextGroupID();
|
||||
if (gid == 0) {
|
||||
Log(Logs::General, Logs::Error,
|
||||
"Unable to get new group ID from world server. group is going to be broken.");
|
||||
LogError("Unable to get new group ID from world server. group is going to be broken");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -596,8 +611,8 @@ void EntityList::AddGroup(Group *group, uint32 gid)
|
||||
{
|
||||
group->SetID(gid);
|
||||
group_list.push_back(group);
|
||||
if (!net.group_timer.Enabled())
|
||||
net.group_timer.Start();
|
||||
if (!group_timer.Enabled())
|
||||
group_timer.Start();
|
||||
#if EQDEBUG >= 5
|
||||
CheckGroupList(__FILE__, __LINE__);
|
||||
#endif
|
||||
@@ -610,8 +625,7 @@ void EntityList::AddRaid(Raid *raid)
|
||||
|
||||
uint32 gid = worldserver.NextGroupID();
|
||||
if (gid == 0) {
|
||||
Log(Logs::General, Logs::Error,
|
||||
"Unable to get new group ID from world server. group is going to be broken.");
|
||||
LogError("Unable to get new group ID from world server. group is going to be broken");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -622,8 +636,8 @@ void EntityList::AddRaid(Raid *raid, uint32 gid)
|
||||
{
|
||||
raid->SetID(gid);
|
||||
raid_list.push_back(raid);
|
||||
if (!net.raid_timer.Enabled())
|
||||
net.raid_timer.Start();
|
||||
if (!raid_timer.Enabled())
|
||||
raid_timer.Start();
|
||||
}
|
||||
|
||||
|
||||
@@ -640,8 +654,8 @@ void EntityList::AddCorpse(Corpse *corpse, uint32 in_id)
|
||||
corpse->CalcCorpseName();
|
||||
corpse_list.insert(std::pair<uint16, Corpse *>(corpse->GetID(), corpse));
|
||||
|
||||
if (!net.corpse_timer.Enabled())
|
||||
net.corpse_timer.Start();
|
||||
if (!corpse_timer.Enabled())
|
||||
corpse_timer.Start();
|
||||
}
|
||||
|
||||
void EntityList::AddNPC(NPC *npc, bool SendSpawnPacket, bool dontqueue)
|
||||
@@ -743,8 +757,8 @@ void EntityList::AddObject(Object *obj, bool SendSpawnPacket)
|
||||
|
||||
object_list.insert(std::pair<uint16, Object *>(obj->GetID(), obj));
|
||||
|
||||
if (!net.object_timer.Enabled())
|
||||
net.object_timer.Start();
|
||||
if (!object_timer.Enabled())
|
||||
object_timer.Start();
|
||||
}
|
||||
|
||||
void EntityList::AddDoor(Doors *door)
|
||||
@@ -752,16 +766,16 @@ void EntityList::AddDoor(Doors *door)
|
||||
door->SetEntityID(GetFreeID());
|
||||
door_list.insert(std::pair<uint16, Doors *>(door->GetEntityID(), door));
|
||||
|
||||
if (!net.door_timer.Enabled())
|
||||
net.door_timer.Start();
|
||||
if (!door_timer.Enabled())
|
||||
door_timer.Start();
|
||||
}
|
||||
|
||||
void EntityList::AddTrap(Trap *trap)
|
||||
{
|
||||
trap->SetID(GetFreeID());
|
||||
trap_list.insert(std::pair<uint16, Trap *>(trap->GetID(), trap));
|
||||
if (!net.trap_timer.Enabled())
|
||||
net.trap_timer.Start();
|
||||
if (!trap_timer.Enabled())
|
||||
trap_timer.Start();
|
||||
}
|
||||
|
||||
void EntityList::AddBeacon(Beacon *beacon)
|
||||
@@ -806,7 +820,7 @@ void EntityList::CheckSpawnQueue()
|
||||
auto it = npc_list.find(ns->spawn.spawnId);
|
||||
if (it == npc_list.end()) {
|
||||
// We must of despawned, hope that's the reason!
|
||||
Log(Logs::General, Logs::Error, "Error in EntityList::CheckSpawnQueue: Unable to find NPC for spawnId '%u'", ns->spawn.spawnId);
|
||||
LogError("Error in EntityList::CheckSpawnQueue: Unable to find NPC for spawnId [{}]", ns->spawn.spawnId);
|
||||
}
|
||||
else {
|
||||
NPC *pnpc = it->second;
|
||||
@@ -1224,33 +1238,19 @@ void EntityList::ChannelMessage(Mob *from, uint8 chan_num, uint8 language,
|
||||
while(it != client_list.end()) {
|
||||
Client *client = it->second;
|
||||
eqFilterType filter = FilterNone;
|
||||
if (chan_num == 3) //shout
|
||||
if (chan_num == ChatChannel_Shout) //shout
|
||||
filter = FilterShouts;
|
||||
else if (chan_num == 4) //auction
|
||||
else if (chan_num == ChatChannel_Auction) //auction
|
||||
filter = FilterAuctions;
|
||||
//
|
||||
// Only say is limited in range
|
||||
if (chan_num != 8 || Distance(client->GetPosition(), from->GetPosition()) < 200)
|
||||
if (chan_num != ChatChannel_Say || Distance(client->GetPosition(), from->GetPosition()) < 200)
|
||||
if (filter == FilterNone || client->GetFilter(filter) != FilterHide)
|
||||
client->ChannelMessageSend(from->GetName(), 0, chan_num, language, lang_skill, buffer);
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
void EntityList::ChannelMessageSend(Mob *to, uint8 chan_num, uint8 language, const char *message, ...)
|
||||
{
|
||||
if (!to->IsClient())
|
||||
return;
|
||||
va_list argptr;
|
||||
char buffer[4096];
|
||||
|
||||
va_start(argptr, message);
|
||||
vsnprintf(buffer, 4096, message, argptr);
|
||||
va_end(argptr);
|
||||
|
||||
to->CastToClient()->ChannelMessageSend(0, 0, chan_num, language, buffer);
|
||||
}
|
||||
|
||||
void EntityList::SendZoneSpawns(Client *client)
|
||||
{
|
||||
EQApplicationPacket *app;
|
||||
@@ -1674,9 +1674,9 @@ void EntityList::DuelMessage(Mob *winner, Mob *loser, bool flee)
|
||||
//might want some sort of distance check in here?
|
||||
if (cur != winner && cur != loser) {
|
||||
if (flee)
|
||||
cur->Message_StringID(15, DUEL_FLED, winner->GetName(),loser->GetName(),loser->GetName());
|
||||
cur->MessageString(Chat::Yellow, DUEL_FLED, winner->GetName(),loser->GetName(),loser->GetName());
|
||||
else
|
||||
cur->Message_StringID(15, DUEL_FINISHED, winner->GetName(),loser->GetName());
|
||||
cur->MessageString(Chat::Yellow, DUEL_FINISHED, winner->GetName(),loser->GetName());
|
||||
}
|
||||
++it;
|
||||
}
|
||||
@@ -1716,6 +1716,18 @@ Client *EntityList::GetClientByWID(uint32 iWID)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Client *EntityList::GetClientByLSID(uint32 iLSID)
|
||||
{
|
||||
auto it = client_list.begin();
|
||||
while (it != client_list.end()) {
|
||||
if (it->second->LSAccountID() == iLSID) {
|
||||
return it->second;
|
||||
}
|
||||
++it;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Client *EntityList::GetRandomClient(const glm::vec3& location, float Distance, Client *ExcludeClient)
|
||||
{
|
||||
std::vector<Client *> ClientsInRange;
|
||||
@@ -1984,22 +1996,22 @@ Client *EntityList::GetClientByAccID(uint32 accid)
|
||||
}
|
||||
|
||||
void EntityList::ChannelMessageFromWorld(const char *from, const char *to,
|
||||
uint8 chan_num, uint32 guild_id, uint8 language, const char *message)
|
||||
uint8 chan_num, uint32 guild_id, uint8 language, uint8 lang_skill, const char *message)
|
||||
{
|
||||
for (auto it = client_list.begin(); it != client_list.end(); ++it) {
|
||||
Client *client = it->second;
|
||||
if (chan_num == 0) {
|
||||
if (chan_num == ChatChannel_Guild) {
|
||||
if (!client->IsInGuild(guild_id))
|
||||
continue;
|
||||
if (!guild_mgr.CheckPermission(guild_id, client->GuildRank(), GUILD_HEAR))
|
||||
continue;
|
||||
if (client->GetFilter(FilterGuildChat) == FilterHide)
|
||||
continue;
|
||||
} else if (chan_num == 5) {
|
||||
} else if (chan_num == ChatChannel_OOC) {
|
||||
if (client->GetFilter(FilterOOC) == FilterHide)
|
||||
continue;
|
||||
}
|
||||
client->ChannelMessageSend(from, to, chan_num, language, message);
|
||||
client->ChannelMessageSend(from, to, chan_num, language, lang_skill, message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2062,7 +2074,7 @@ void EntityList::QueueClientsGuildBankItemUpdate(const GuildBankItemUpdate_Struc
|
||||
void EntityList::MessageStatus(uint32 to_guild_id, int to_minstatus, uint32 type, const char *message, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
char buffer[4096];
|
||||
char buffer[4096];
|
||||
|
||||
va_start(argptr, message);
|
||||
vsnprintf(buffer, 4096, message, argptr);
|
||||
@@ -2071,75 +2083,242 @@ void EntityList::MessageStatus(uint32 to_guild_id, int to_minstatus, uint32 type
|
||||
auto it = client_list.begin();
|
||||
while (it != client_list.end()) {
|
||||
Client *client = it->second;
|
||||
if ((to_guild_id == 0 || client->IsInGuild(to_guild_id)) && client->Admin() >= to_minstatus)
|
||||
if ((to_guild_id == 0 || client->IsInGuild(to_guild_id)) && client->Admin() >= to_minstatus) {
|
||||
client->Message(type, buffer);
|
||||
}
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
// works much like MessageClose, but with formatted strings
|
||||
void EntityList::MessageClose_StringID(Mob *sender, bool skipsender, float dist, uint32 type, uint32 string_id, const char* message1,const char* message2,const char* message3,const char* message4,const char* message5,const char* message6,const char* message7,const char* message8,const char* message9)
|
||||
/**
|
||||
* @param sender
|
||||
* @param skipsender
|
||||
* @param dist
|
||||
* @param type
|
||||
* @param string_id
|
||||
* @param message1
|
||||
* @param message2
|
||||
* @param message3
|
||||
* @param message4
|
||||
* @param message5
|
||||
* @param message6
|
||||
* @param message7
|
||||
* @param message8
|
||||
* @param message9
|
||||
*/
|
||||
void EntityList::MessageCloseString(
|
||||
Mob *sender,
|
||||
bool skipsender,
|
||||
float dist,
|
||||
uint32 type,
|
||||
uint32 string_id,
|
||||
const char *message1,
|
||||
const char *message2,
|
||||
const char *message3,
|
||||
const char *message4,
|
||||
const char *message5,
|
||||
const char *message6,
|
||||
const char *message7,
|
||||
const char *message8,
|
||||
const char *message9
|
||||
)
|
||||
{
|
||||
Client *c;
|
||||
float dist2 = dist * dist;
|
||||
float dist2 = dist * dist;
|
||||
|
||||
for (auto it = client_list.begin(); it != client_list.end(); ++it) {
|
||||
c = it->second;
|
||||
if(c && DistanceSquared(c->GetPosition(), sender->GetPosition()) <= dist2 && (!skipsender || c != sender))
|
||||
c->Message_StringID(type, string_id, message1, message2, message3, message4, message5, message6, message7, message8, message9);
|
||||
for (auto & it : client_list) {
|
||||
c = it.second;
|
||||
if (c && DistanceSquared(c->GetPosition(), sender->GetPosition()) <= dist2 && (!skipsender || c != sender)) {
|
||||
c->MessageString(
|
||||
type,
|
||||
string_id,
|
||||
message1,
|
||||
message2,
|
||||
message3,
|
||||
message4,
|
||||
message5,
|
||||
message6,
|
||||
message7,
|
||||
message8,
|
||||
message9
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EntityList::FilteredMessageClose_StringID(Mob *sender, bool skipsender,
|
||||
float dist, uint32 type, eqFilterType filter, uint32 string_id,
|
||||
const char *message1, const char *message2, const char *message3,
|
||||
const char *message4, const char *message5, const char *message6,
|
||||
const char *message7, const char *message8, const char *message9)
|
||||
/**
|
||||
* @param sender
|
||||
* @param skipsender
|
||||
* @param dist
|
||||
* @param type
|
||||
* @param filter
|
||||
* @param string_id
|
||||
* @param message1
|
||||
* @param message2
|
||||
* @param message3
|
||||
* @param message4
|
||||
* @param message5
|
||||
* @param message6
|
||||
* @param message7
|
||||
* @param message8
|
||||
* @param message9
|
||||
*/
|
||||
void EntityList::FilteredMessageCloseString(
|
||||
Mob *sender, bool skipsender,
|
||||
float dist,
|
||||
uint32 type,
|
||||
eqFilterType filter,
|
||||
uint32 string_id,
|
||||
const char *message1,
|
||||
const char *message2,
|
||||
const char *message3,
|
||||
const char *message4,
|
||||
const char *message5,
|
||||
const char *message6,
|
||||
const char *message7,
|
||||
const char *message8,
|
||||
const char *message9
|
||||
)
|
||||
{
|
||||
Client *c;
|
||||
float dist2 = dist * dist;
|
||||
float dist2 = dist * dist;
|
||||
|
||||
for (auto it = client_list.begin(); it != client_list.end(); ++it) {
|
||||
c = it->second;
|
||||
if (c && DistanceSquared(c->GetPosition(), sender->GetPosition()) <= dist2 && (!skipsender || c != sender))
|
||||
c->FilteredMessage_StringID(sender, type, filter, string_id,
|
||||
message1, message2, message3, message4, message5,
|
||||
message6, message7, message8, message9);
|
||||
for (auto & it : client_list) {
|
||||
c = it.second;
|
||||
if (c && DistanceSquared(c->GetPosition(), sender->GetPosition()) <= dist2 && (!skipsender || c != sender)) {
|
||||
c->FilteredMessageString(
|
||||
sender, type, filter, string_id,
|
||||
message1, message2, message3, message4, message5,
|
||||
message6, message7, message8, message9
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EntityList::Message_StringID(Mob *sender, bool skipsender, uint32 type, uint32 string_id, const char* message1,const char* message2,const char* message3,const char* message4,const char* message5,const char* message6,const char* message7,const char* message8,const char* message9)
|
||||
/**
|
||||
*
|
||||
* @param sender
|
||||
* @param skipsender
|
||||
* @param type
|
||||
* @param string_id
|
||||
* @param message1
|
||||
* @param message2
|
||||
* @param message3
|
||||
* @param message4
|
||||
* @param message5
|
||||
* @param message6
|
||||
* @param message7
|
||||
* @param message8
|
||||
* @param message9
|
||||
*/
|
||||
void EntityList::MessageString(
|
||||
Mob *sender,
|
||||
bool skipsender,
|
||||
uint32 type,
|
||||
uint32 string_id,
|
||||
const char *message1,
|
||||
const char *message2,
|
||||
const char *message3,
|
||||
const char *message4,
|
||||
const char *message5,
|
||||
const char *message6,
|
||||
const char *message7,
|
||||
const char *message8,
|
||||
const char *message9
|
||||
)
|
||||
{
|
||||
Client *c;
|
||||
|
||||
for (auto it = client_list.begin(); it != client_list.end(); ++it) {
|
||||
c = it->second;
|
||||
if(c && (!skipsender || c != sender))
|
||||
c->Message_StringID(type, string_id, message1, message2, message3, message4, message5, message6, message7, message8, message9);
|
||||
for (auto & it : client_list) {
|
||||
c = it.second;
|
||||
if (c && (!skipsender || c != sender)) {
|
||||
c->MessageString(
|
||||
type,
|
||||
string_id,
|
||||
message1,
|
||||
message2,
|
||||
message3,
|
||||
message4,
|
||||
message5,
|
||||
message6,
|
||||
message7,
|
||||
message8,
|
||||
message9
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EntityList::FilteredMessage_StringID(Mob *sender, bool skipsender,
|
||||
uint32 type, eqFilterType filter, uint32 string_id,
|
||||
const char *message1, const char *message2, const char *message3,
|
||||
const char *message4, const char *message5, const char *message6,
|
||||
const char *message7, const char *message8, const char *message9)
|
||||
/**
|
||||
*
|
||||
* @param sender
|
||||
* @param skipsender
|
||||
* @param type
|
||||
* @param filter
|
||||
* @param string_id
|
||||
* @param message1
|
||||
* @param message2
|
||||
* @param message3
|
||||
* @param message4
|
||||
* @param message5
|
||||
* @param message6
|
||||
* @param message7
|
||||
* @param message8
|
||||
* @param message9
|
||||
*/
|
||||
void EntityList::FilteredMessageString(
|
||||
Mob *sender,
|
||||
bool skipsender,
|
||||
uint32 type,
|
||||
eqFilterType filter,
|
||||
uint32 string_id,
|
||||
const char *message1,
|
||||
const char *message2,
|
||||
const char *message3,
|
||||
const char *message4,
|
||||
const char *message5,
|
||||
const char *message6,
|
||||
const char *message7,
|
||||
const char *message8,
|
||||
const char *message9
|
||||
)
|
||||
{
|
||||
Client *c;
|
||||
|
||||
for (auto it = client_list.begin(); it != client_list.end(); ++it) {
|
||||
c = it->second;
|
||||
if (c && (!skipsender || c != sender))
|
||||
c->FilteredMessage_StringID(sender, type, filter, string_id,
|
||||
message1, message2, message3, message4, message5, message6,
|
||||
message7, message8, message9);
|
||||
for (auto & it : client_list) {
|
||||
c = it.second;
|
||||
if (c && (!skipsender || c != sender)) {
|
||||
c->FilteredMessageString(
|
||||
sender,
|
||||
type,
|
||||
filter,
|
||||
string_id,
|
||||
message1,
|
||||
message2,
|
||||
message3,
|
||||
message4,
|
||||
message5,
|
||||
message6,
|
||||
message7,
|
||||
message8,
|
||||
message9
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EntityList::MessageClose(Mob* sender, bool skipsender, float dist, uint32 type, const char* message, ...)
|
||||
/**
|
||||
* @param sender
|
||||
* @param skipsender
|
||||
* @param dist
|
||||
* @param type
|
||||
* @param message
|
||||
* @param ...
|
||||
*/
|
||||
void EntityList::MessageClose(Mob *sender, bool skipsender, float dist, uint32 type, const char *message, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
char buffer[4096];
|
||||
char buffer[4096];
|
||||
|
||||
va_start(argptr, message);
|
||||
vsnprintf(buffer, 4095, message, argptr);
|
||||
@@ -2149,16 +2328,26 @@ void EntityList::MessageClose(Mob* sender, bool skipsender, float dist, uint32 t
|
||||
|
||||
auto it = client_list.begin();
|
||||
while (it != client_list.end()) {
|
||||
if (DistanceSquared(it->second->GetPosition(), sender->GetPosition()) <= dist2 && (!skipsender || it->second != sender))
|
||||
if (DistanceSquared(it->second->GetPosition(), sender->GetPosition()) <= dist2 &&
|
||||
(!skipsender || it->second != sender)) {
|
||||
it->second->Message(type, buffer);
|
||||
}
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
void EntityList::FilteredMessageClose(Mob *sender, bool skipsender, float dist, uint32 type, eqFilterType filter, const char *message, ...)
|
||||
void EntityList::FilteredMessageClose(
|
||||
Mob *sender,
|
||||
bool skipsender,
|
||||
float dist,
|
||||
uint32 type,
|
||||
eqFilterType filter,
|
||||
const char *message,
|
||||
...
|
||||
)
|
||||
{
|
||||
va_list argptr;
|
||||
char buffer[4096];
|
||||
char buffer[4096];
|
||||
|
||||
va_start(argptr, message);
|
||||
vsnprintf(buffer, 4095, message, argptr);
|
||||
@@ -2168,8 +2357,10 @@ void EntityList::FilteredMessageClose(Mob *sender, bool skipsender, float dist,
|
||||
|
||||
auto it = client_list.begin();
|
||||
while (it != client_list.end()) {
|
||||
if (DistanceSquared(it->second->GetPosition(), sender->GetPosition()) <= dist2 && (!skipsender || it->second != sender))
|
||||
it->second->FilteredMessage(sender, type, filter, buffer);
|
||||
if (DistanceSquared(it->second->GetPosition(), sender->GetPosition()) <= dist2 &&
|
||||
(!skipsender || it->second != sender)) {
|
||||
it->second->FilteredMessage(sender, type, filter, buffer);
|
||||
}
|
||||
++it;
|
||||
}
|
||||
}
|
||||
@@ -2689,7 +2880,7 @@ char *EntityList::MakeNameUnique(char *name)
|
||||
return name;
|
||||
}
|
||||
}
|
||||
Log(Logs::General, Logs::Error, "Fatal error in EntityList::MakeNameUnique: Unable to find unique name for '%s'", name);
|
||||
LogError("Fatal error in EntityList::MakeNameUnique: Unable to find unique name for [{}]", name);
|
||||
char tmp[64] = "!";
|
||||
strn0cpy(&tmp[1], name, sizeof(tmp) - 1);
|
||||
strcpy(name, tmp);
|
||||
@@ -2714,15 +2905,15 @@ void EntityList::ListNPCCorpses(Client *client)
|
||||
uint32 x = 0;
|
||||
|
||||
auto it = corpse_list.begin();
|
||||
client->Message(0, "NPC Corpses in the zone:");
|
||||
client->Message(Chat::White, "NPC Corpses in the zone:");
|
||||
while (it != corpse_list.end()) {
|
||||
if (it->second->IsNPCCorpse()) {
|
||||
client->Message(0, " %5d: %s", it->first, it->second->GetName());
|
||||
client->Message(Chat::White, " %5d: %s", it->first, it->second->GetName());
|
||||
x++;
|
||||
}
|
||||
++it;
|
||||
}
|
||||
client->Message(0, "%d npc corpses listed.", x);
|
||||
client->Message(Chat::White, "%d npc corpses listed.", x);
|
||||
}
|
||||
|
||||
void EntityList::ListPlayerCorpses(Client *client)
|
||||
@@ -2730,15 +2921,15 @@ void EntityList::ListPlayerCorpses(Client *client)
|
||||
uint32 x = 0;
|
||||
|
||||
auto it = corpse_list.begin();
|
||||
client->Message(0, "Player Corpses in the zone:");
|
||||
client->Message(Chat::White, "Player Corpses in the zone:");
|
||||
while (it != corpse_list.end()) {
|
||||
if (it->second->IsPlayerCorpse()) {
|
||||
client->Message(0, " %5d: %s", it->first, it->second->GetName());
|
||||
client->Message(Chat::White, " %5d: %s", it->first, it->second->GetName());
|
||||
x++;
|
||||
}
|
||||
++it;
|
||||
}
|
||||
client->Message(0, "%d player corpses listed.", x);
|
||||
client->Message(Chat::White, "%d player corpses listed.", x);
|
||||
}
|
||||
|
||||
// returns the number of corpses deleted. A negative number indicates an error code.
|
||||
@@ -2765,7 +2956,7 @@ void EntityList::CorpseFix(Client* c)
|
||||
Corpse* corpse = it->second;
|
||||
if (corpse->IsNPCCorpse()) {
|
||||
if (DistanceNoZ(c->GetPosition(), corpse->GetPosition()) < 100) {
|
||||
c->Message(15, "Attempting to fix %s", it->second->GetCleanName());
|
||||
c->Message(Chat::Yellow, "Attempting to fix %s", it->second->GetCleanName());
|
||||
corpse->GMMove(corpse->GetX(), corpse->GetY(), c->GetZ() + 2, 0);
|
||||
}
|
||||
}
|
||||
@@ -3540,7 +3731,7 @@ void EntityList::LimitAddNPC(NPC *npc)
|
||||
SpawnLimitRecord r;
|
||||
|
||||
uint16 eid = npc->GetID();
|
||||
r.spawngroup_id = npc->GetSp2();
|
||||
r.spawngroup_id = npc->GetSpawnGroupId();
|
||||
r.npc_type = npc->GetNPCTypeID();
|
||||
|
||||
npc_limit_list[eid] = r;
|
||||
@@ -3735,25 +3926,27 @@ bool Entity::CheckCoordLosNoZLeaps(float cur_x, float cur_y, float cur_z,
|
||||
return false;
|
||||
}
|
||||
|
||||
void EntityList::QuestJournalledSayClose(Mob *sender, Client *QuestInitiator,
|
||||
float dist, const char* mobname, const char* message)
|
||||
void EntityList::QuestJournalledSayClose(Mob *sender, float dist, const char *mobname, const char *message,
|
||||
Journal::Options &opts)
|
||||
{
|
||||
Client *c = nullptr;
|
||||
float dist2 = dist * dist;
|
||||
SerializeBuffer buf(sizeof(SpecialMesgHeader_Struct) + 12 + 64 + 64);
|
||||
|
||||
// Send the message to the quest initiator such that the client will enter it into the NPC Quest Journal
|
||||
if (QuestInitiator) {
|
||||
auto buf = new char[strlen(mobname) + strlen(message) + 10];
|
||||
sprintf(buf, "%s says, '%s'", mobname, message);
|
||||
QuestInitiator->QuestJournalledMessage(mobname, buf);
|
||||
safe_delete_array(buf);
|
||||
}
|
||||
// Use the old method for all other nearby clients
|
||||
for (auto it = client_list.begin(); it != client_list.end(); ++it) {
|
||||
c = it->second;
|
||||
if(c && (c != QuestInitiator) && DistanceSquared(c->GetPosition(), sender->GetPosition()) <= dist2)
|
||||
c->Message_StringID(10, GENERIC_SAY, mobname, message);
|
||||
}
|
||||
buf.WriteInt8(static_cast<int8>(opts.speak_mode));
|
||||
buf.WriteInt8(static_cast<int8>(opts.journal_mode));
|
||||
buf.WriteInt8(opts.language);
|
||||
buf.WriteInt32(opts.message_type);
|
||||
buf.WriteInt32(opts.target_spawn_id);
|
||||
buf.WriteString(mobname);
|
||||
buf.WriteInt32(0); // location, client doesn't seem to do anything with this
|
||||
buf.WriteInt32(0);
|
||||
buf.WriteInt32(0);
|
||||
buf.WriteString(message);
|
||||
|
||||
auto outapp = new EQApplicationPacket(OP_SpecialMesg, buf);
|
||||
|
||||
// client only bothers logging if target spawn ID matches, safe to send to everyone
|
||||
QueueCloseClients(sender, outapp, false, dist);
|
||||
delete outapp;
|
||||
}
|
||||
|
||||
Corpse *EntityList::GetClosestCorpse(Mob *sender, const char *Name)
|
||||
@@ -3869,7 +4062,7 @@ void EntityList::GroupMessage(uint32 gid, const char *from, const char *message)
|
||||
g = it->second->GetGroup();
|
||||
if (g) {
|
||||
if (g->GetID() == gid)
|
||||
it->second->ChannelMessageSend(from, it->second->GetName(), 2, 0, message);
|
||||
it->second->ChannelMessageSend(from, it->second->GetName(), ChatChannel_Group, 0, 100, message);
|
||||
}
|
||||
}
|
||||
++it;
|
||||
@@ -4621,7 +4814,7 @@ void EntityList::ExpeditionWarning(uint32 minutes_left)
|
||||
|
||||
auto it = client_list.begin();
|
||||
while (it != client_list.end()) {
|
||||
it->second->Message_StringID(15, EXPEDITION_MIN_REMAIN, itoa((int)minutes_left));
|
||||
it->second->MessageString(Chat::Yellow, EXPEDITION_MIN_REMAIN, itoa((int)minutes_left));
|
||||
it->second->QueuePacket(outapp);
|
||||
++it;
|
||||
}
|
||||
|
||||
+45
-7
@@ -29,6 +29,7 @@
|
||||
|
||||
#include "position.h"
|
||||
#include "zonedump.h"
|
||||
#include "common.h"
|
||||
|
||||
class Encounter;
|
||||
class Beacon;
|
||||
@@ -116,6 +117,7 @@ public:
|
||||
|
||||
#ifdef BOTS
|
||||
Bot* CastToBot();
|
||||
const Bot* CastToBot() const;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
@@ -174,6 +176,7 @@ public:
|
||||
}
|
||||
Client *GetClientByCharID(uint32 iCharID);
|
||||
Client *GetClientByWID(uint32 iWID);
|
||||
Client *GetClientByLSID(uint32 iLSID);
|
||||
Client *GetClient(uint32 ip, uint16 port);
|
||||
Client *GetRandomClient(const glm::vec3& location, float Distance, Client *ExcludeClient = nullptr);
|
||||
Group *GetGroupByMob(Mob* mob);
|
||||
@@ -318,14 +321,42 @@ public:
|
||||
void MessageStatus(uint32 to_guilddbid, int to_minstatus, uint32 type, const char* message, ...);
|
||||
void MessageClose(Mob* sender, bool skipsender, float dist, uint32 type, const char* message, ...);
|
||||
void FilteredMessageClose(Mob* sender, bool skipsender, float dist, uint32 type, eqFilterType filter, const char* message, ...);
|
||||
void Message_StringID(Mob *sender, bool skipsender, uint32 type, uint32 string_id, const char* message1=0,const char* message2=0,const char* message3=0,const char* message4=0,const char* message5=0,const char* message6=0,const char* message7=0,const char* message8=0,const char* message9=0);
|
||||
void FilteredMessage_StringID(Mob *sender, bool skipsender, uint32 type, eqFilterType filter, uint32 string_id, const char* message1=0,const char* message2=0,const char* message3=0,const char* message4=0,const char* message5=0,const char* message6=0,const char* message7=0,const char* message8=0,const char* message9=0);
|
||||
void MessageClose_StringID(Mob *sender, bool skipsender, float dist, uint32 type, uint32 string_id, const char* message1=0,const char* message2=0,const char* message3=0,const char* message4=0,const char* message5=0,const char* message6=0,const char* message7=0,const char* message8=0,const char* message9=0);
|
||||
void FilteredMessageClose_StringID(Mob *sender, bool skipsender, float dist, uint32 type, eqFilterType filter, uint32 string_id, const char* message1=0,const char* message2=0,const char* message3=0,const char* message4=0,const char* message5=0,const char* message6=0,const char* message7=0,const char* message8=0,const char* message9=0);
|
||||
void ChannelMessageFromWorld(const char* from, const char* to, uint8 chan_num, uint32 guilddbid, uint8 language, const char* message);
|
||||
void MessageString(Mob *sender, bool skipsender, uint32 type, uint32 string_id, const char* message1=0,const char* message2=0,const char* message3=0,const char* message4=0,const char* message5=0,const char* message6=0,const char* message7=0,const char* message8=0,const char* message9=0);
|
||||
void FilteredMessageString(Mob *sender, bool skipsender, uint32 type, eqFilterType filter, uint32 string_id, const char* message1=0,const char* message2=0,const char* message3=0,const char* message4=0,const char* message5=0,const char* message6=0,const char* message7=0,const char* message8=0,const char* message9=0);
|
||||
void MessageCloseString(
|
||||
Mob *sender,
|
||||
bool skipsender,
|
||||
float dist,
|
||||
uint32 type,
|
||||
uint32 string_id,
|
||||
const char *message1 = 0,
|
||||
const char *message2 = 0,
|
||||
const char *message3 = 0,
|
||||
const char *message4 = 0,
|
||||
const char *message5 = 0,
|
||||
const char *message6 = 0,
|
||||
const char *message7 = 0,
|
||||
const char *message8 = 0,
|
||||
const char *message9 = 0);
|
||||
void FilteredMessageCloseString(
|
||||
Mob *sender,
|
||||
bool skipsender,
|
||||
float dist,
|
||||
uint32 type,
|
||||
eqFilterType filter,
|
||||
uint32 string_id,
|
||||
const char *message1 = 0,
|
||||
const char *message2 = 0,
|
||||
const char *message3 = 0,
|
||||
const char *message4 = 0,
|
||||
const char *message5 = 0,
|
||||
const char *message6 = 0,
|
||||
const char *message7 = 0,
|
||||
const char *message8 = 0,
|
||||
const char *message9 = 0);
|
||||
void ChannelMessageFromWorld(const char* from, const char* to, uint8 chan_num, uint32 guilddbid, uint8 language, uint8 lang_skill, const char* message);
|
||||
void ChannelMessage(Mob* from, uint8 chan_num, uint8 language, const char* message, ...);
|
||||
void ChannelMessage(Mob* from, uint8 chan_num, uint8 language, uint8 lang_skill, const char* message, ...);
|
||||
void ChannelMessageSend(Mob* to, uint8 chan_num, uint8 language, const char* message, ...);
|
||||
void SendZoneSpawns(Client*);
|
||||
void SendZonePVPUpdates(Client *);
|
||||
void SendZoneSpawnsBulk(Client* client);
|
||||
@@ -337,7 +368,7 @@ public:
|
||||
void SendNimbusEffects(Client *c);
|
||||
void SendUntargetable(Client *c);
|
||||
void DuelMessage(Mob* winner, Mob* loser, bool flee);
|
||||
void QuestJournalledSayClose(Mob *sender, Client *QuestIntiator, float dist, const char* mobname, const char* message);
|
||||
void QuestJournalledSayClose(Mob *sender, float dist, const char* mobname, const char* message, Journal::Options &opts);
|
||||
void GroupMessage(uint32 gid, const char *from, const char *message);
|
||||
void ExpeditionWarning(uint32 minutes_left);
|
||||
|
||||
@@ -507,6 +538,13 @@ private:
|
||||
std::list<Area> area_list;
|
||||
std::queue<uint16> free_ids;
|
||||
|
||||
Timer object_timer;
|
||||
Timer door_timer;
|
||||
Timer corpse_timer;
|
||||
Timer group_timer;
|
||||
Timer raid_timer;
|
||||
Timer trap_timer;
|
||||
|
||||
// Please Do Not Declare Any EntityList Class Members After This Comment
|
||||
#ifdef BOTS
|
||||
public:
|
||||
|
||||
+47
-46
@@ -46,7 +46,7 @@ static uint32 ScaleAAXPBasedOnCurrentAATotal(int earnedAA, uint32 add_aaxp)
|
||||
// Are we within the scaling window?
|
||||
if (earnedAA >= aaLimit || earnedAA < aaMinimum)
|
||||
{
|
||||
Log(Logs::Detail, Logs::None, "Not within AA scaling window.");
|
||||
LogDebug("Not within AA scaling window");
|
||||
|
||||
// At or past the limit. We're done.
|
||||
return add_aaxp;
|
||||
@@ -333,18 +333,18 @@ void Client::CalculateLeadershipExp(uint32 &add_exp, uint8 conlevel)
|
||||
uint32 mentor_exp = exp * (GetGroup()->GetMentorPercent() / 100.0f);
|
||||
exp -= mentor_exp;
|
||||
mentoree->AddLeadershipEXP(mentor_exp, 0); // ends up rounded down
|
||||
mentoree->Message_StringID(MT_Leadership, GAIN_GROUP_LEADERSHIP_EXP);
|
||||
mentoree->MessageString(Chat::LeaderShip, GAIN_GROUP_LEADERSHIP_EXP);
|
||||
}
|
||||
if (exp > 0)
|
||||
{
|
||||
// possible if you mentor 100% to the other client
|
||||
AddLeadershipEXP(exp, 0); // ends up rounded up if mentored, no idea how live actually does it
|
||||
Message_StringID(MT_Leadership, GAIN_GROUP_LEADERSHIP_EXP);
|
||||
MessageString(Chat::LeaderShip, GAIN_GROUP_LEADERSHIP_EXP);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Message_StringID(MT_Leadership, MAX_GROUP_LEADERSHIP_POINTS);
|
||||
MessageString(Chat::LeaderShip, MAX_GROUP_LEADERSHIP_POINTS);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -357,11 +357,11 @@ void Client::CalculateLeadershipExp(uint32 &add_exp, uint8 conlevel)
|
||||
&& RuleI(Character, KillsPerRaidLeadershipAA) > 0)
|
||||
{
|
||||
AddLeadershipEXP(0, RAID_EXP_PER_POINT / RuleI(Character, KillsPerRaidLeadershipAA));
|
||||
Message_StringID(MT_Leadership, GAIN_RAID_LEADERSHIP_EXP);
|
||||
MessageString(Chat::LeaderShip, GAIN_RAID_LEADERSHIP_EXP);
|
||||
}
|
||||
else
|
||||
{
|
||||
Message_StringID(MT_Leadership, MAX_RAID_LEADERSHIP_POINTS);
|
||||
MessageString(Chat::LeaderShip, MAX_RAID_LEADERSHIP_POINTS);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -378,17 +378,17 @@ void Client::CalculateLeadershipExp(uint32 &add_exp, uint8 conlevel)
|
||||
uint32 mentor_exp = exp * (raid->GetMentorPercent(group_id) / 100.0f);
|
||||
exp -= mentor_exp;
|
||||
mentoree->AddLeadershipEXP(mentor_exp, 0);
|
||||
mentoree->Message_StringID(MT_Leadership, GAIN_GROUP_LEADERSHIP_EXP);
|
||||
mentoree->MessageString(Chat::LeaderShip, GAIN_GROUP_LEADERSHIP_EXP);
|
||||
}
|
||||
if (exp > 0)
|
||||
{
|
||||
AddLeadershipEXP(exp, 0);
|
||||
Message_StringID(MT_Leadership, GAIN_GROUP_LEADERSHIP_EXP);
|
||||
MessageString(Chat::LeaderShip, GAIN_GROUP_LEADERSHIP_EXP);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Message_StringID(MT_Leadership, MAX_GROUP_LEADERSHIP_POINTS);
|
||||
MessageString(Chat::LeaderShip, MAX_GROUP_LEADERSHIP_POINTS);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -514,7 +514,7 @@ void Client::AddEXP(uint32 in_add_exp, uint8 conlevel, bool resexp) {
|
||||
|
||||
// AA Sanity Checking for players who set aa exp and deleveled below allowed aa level.
|
||||
if (GetLevel() <= 50 && m_epp.perAA > 0) {
|
||||
Message(15, "You are below the level allowed to gain AA Experience. AA Experience set to 0%");
|
||||
Message(Chat::Yellow, "You are below the level allowed to gain AA Experience. AA Experience set to 0%");
|
||||
aaexp = 0;
|
||||
m_epp.perAA = 0;
|
||||
}
|
||||
@@ -524,11 +524,11 @@ void Client::AddEXP(uint32 in_add_exp, uint8 conlevel, bool resexp) {
|
||||
}
|
||||
|
||||
void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) {
|
||||
Log(Logs::Detail, Logs::None, "Attempting to Set Exp for %s (XP: %u, AAXP: %u, Rez: %s)", this->GetCleanName(), set_exp, set_aaxp, isrezzexp ? "true" : "false");
|
||||
LogDebug("Attempting to Set Exp for [{}] (XP: [{}], AAXP: [{}], Rez: [{}])", this->GetCleanName(), set_exp, set_aaxp, isrezzexp ? "true" : "false");
|
||||
|
||||
auto max_AAXP = GetRequiredAAExperience();
|
||||
if (max_AAXP == 0 || GetEXPForLevel(GetLevel()) == 0xFFFFFFFF) {
|
||||
Message(13, "Error in Client::SetEXP. EXP not set.");
|
||||
Message(Chat::Red, "Error in Client::SetEXP. EXP not set.");
|
||||
return; // Must be invalid class/race
|
||||
}
|
||||
uint32 i = 0;
|
||||
@@ -564,23 +564,23 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) {
|
||||
|
||||
if (isrezzexp) {
|
||||
if (RuleI(Character, ShowExpValues) > 0)
|
||||
Message(MT_Experience, "You regain %s experience from resurrection. %s", exp_amount_message.c_str(), exp_percent_message.c_str());
|
||||
else Message_StringID(MT_Experience, REZ_REGAIN);
|
||||
Message(Chat::Experience, "You regain %s experience from resurrection. %s", exp_amount_message.c_str(), exp_percent_message.c_str());
|
||||
else MessageString(Chat::Experience, REZ_REGAIN);
|
||||
} else {
|
||||
if (membercount > 1) {
|
||||
if (RuleI(Character, ShowExpValues) > 0)
|
||||
Message(MT_Experience, "You have gained %s party experience! %s", exp_amount_message.c_str(), exp_percent_message.c_str());
|
||||
else Message_StringID(MT_Experience, GAIN_GROUPXP);
|
||||
Message(Chat::Experience, "You have gained %s party experience! %s", exp_amount_message.c_str(), exp_percent_message.c_str());
|
||||
else MessageString(Chat::Experience, GAIN_GROUPXP);
|
||||
}
|
||||
else if (IsRaidGrouped()) {
|
||||
if (RuleI(Character, ShowExpValues) > 0)
|
||||
Message(MT_Experience, "You have gained %s raid experience! %s", exp_amount_message.c_str(), exp_percent_message.c_str());
|
||||
else Message_StringID(MT_Experience, GAIN_RAIDEXP);
|
||||
Message(Chat::Experience, "You have gained %s raid experience! %s", exp_amount_message.c_str(), exp_percent_message.c_str());
|
||||
else MessageString(Chat::Experience, GAIN_RAIDEXP);
|
||||
}
|
||||
else {
|
||||
if (RuleI(Character, ShowExpValues) > 0)
|
||||
Message(MT_Experience, "You have gained %s experience! %s", exp_amount_message.c_str(), exp_percent_message.c_str());
|
||||
else Message_StringID(MT_Experience, GAIN_XP);
|
||||
Message(Chat::Experience, "You have gained %s experience! %s", exp_amount_message.c_str(), exp_percent_message.c_str());
|
||||
else MessageString(Chat::Experience, GAIN_XP);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -588,9 +588,9 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) {
|
||||
uint32 exp_lost = m_pp.exp - set_exp;
|
||||
float exp_percent = (float)((float)exp_lost / (float)(GetEXPForLevel(GetLevel() + 1) - GetEXPForLevel(GetLevel())))*(float)100;
|
||||
|
||||
if (RuleI(Character, ShowExpValues) == 1 && exp_lost > 0) Message(15, "You have lost %i experience.", exp_lost);
|
||||
else if (RuleI(Character, ShowExpValues) == 2 && exp_lost > 0) Message(15, "You have lost %i experience. (%.3f%%)", exp_lost, exp_percent);
|
||||
else Message(15, "You have lost experience.");
|
||||
if (RuleI(Character, ShowExpValues) == 1 && exp_lost > 0) Message(Chat::Yellow, "You have lost %i experience.", exp_lost);
|
||||
else if (RuleI(Character, ShowExpValues) == 2 && exp_lost > 0) Message(Chat::Yellow, "You have lost %i experience. (%.3f%%)", exp_lost, exp_percent);
|
||||
else Message(Chat::Yellow, "You have lost experience.");
|
||||
}
|
||||
|
||||
//check_level represents the level we should be when we have
|
||||
@@ -643,7 +643,7 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) {
|
||||
|
||||
//figure out how many AA points we get from the exp were setting
|
||||
m_pp.aapoints = set_aaxp / max_AAXP;
|
||||
Log(Logs::Detail, Logs::None, "Calculating additional AA Points from AAXP for %s: %u / %u = %.1f points", this->GetCleanName(), set_aaxp, max_AAXP, (float)set_aaxp / (float)max_AAXP);
|
||||
LogDebug("Calculating additional AA Points from AAXP for [{}]: [{}] / [{}] = [{}] points", this->GetCleanName(), set_aaxp, max_AAXP, (float)set_aaxp / (float)max_AAXP);
|
||||
|
||||
//get remainder exp points, set in PP below
|
||||
set_aaxp = set_aaxp - (max_AAXP * m_pp.aapoints);
|
||||
@@ -654,9 +654,9 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) {
|
||||
//figure out how many points were actually gained
|
||||
/*uint32 gained = m_pp.aapoints - last_unspentAA;*/ //unused
|
||||
|
||||
//Message(15, "You have gained %d skill points!!", m_pp.aapoints - last_unspentAA);
|
||||
//Message(Chat::Yellow, "You have gained %d skill points!!", m_pp.aapoints - last_unspentAA);
|
||||
char val1[20]={0};
|
||||
Message_StringID(MT_Experience, GAIN_ABILITY_POINT, ConvertArray(m_pp.aapoints, val1),m_pp.aapoints == 1 ? "" : "(s)"); //You have gained an ability point! You now have %1 ability point%2.
|
||||
MessageString(Chat::Experience, GAIN_ABILITY_POINT, ConvertArray(m_pp.aapoints, val1),m_pp.aapoints == 1 ? "" : "(s)"); //You have gained an ability point! You now have %1 ability point%2.
|
||||
|
||||
/* QS: PlayerLogAARate */
|
||||
if (RuleB(QueryServ, PlayerLogAARate)){
|
||||
@@ -665,7 +665,7 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) {
|
||||
QServ->SendQuery(query.c_str());
|
||||
}
|
||||
|
||||
//Message(15, "You now have %d skill points available to spend.", m_pp.aapoints);
|
||||
//Message(Chat::Yellow, "You now have %d skill points available to spend.", m_pp.aapoints);
|
||||
}
|
||||
|
||||
uint8 maxlevel = RuleI(Character, MaxExpLevel) + 1;
|
||||
@@ -699,18 +699,18 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) {
|
||||
if (level_increase)
|
||||
{
|
||||
if (level_count == 1)
|
||||
Message_StringID(MT_Experience, GAIN_LEVEL, ConvertArray(check_level, val1));
|
||||
MessageString(Chat::Experience, GAIN_LEVEL, ConvertArray(check_level, val1));
|
||||
else
|
||||
Message(15, "Welcome to level %i!", check_level);
|
||||
Message(Chat::Yellow, "Welcome to level %i!", check_level);
|
||||
|
||||
if (check_level == RuleI(Character, DeathItemLossLevel))
|
||||
Message_StringID(15, CORPSE_ITEM_LOST);
|
||||
MessageString(Chat::Yellow, CORPSE_ITEM_LOST);
|
||||
|
||||
if (check_level == RuleI(Character, DeathExpLossLevel))
|
||||
Message_StringID(15, CORPSE_EXP_LOST);
|
||||
MessageString(Chat::Yellow, CORPSE_EXP_LOST);
|
||||
}
|
||||
else
|
||||
Message_StringID(MT_Experience, LOSE_LEVEL, ConvertArray(check_level, val1));
|
||||
MessageString(Chat::Experience, LOSE_LEVEL, ConvertArray(check_level, val1));
|
||||
|
||||
#ifdef BOTS
|
||||
uint8 myoldlevel = GetLevel();
|
||||
@@ -758,14 +758,14 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) {
|
||||
char val1[20]={0};
|
||||
char val2[20]={0};
|
||||
char val3[20]={0};
|
||||
Message_StringID(MT_Experience, GM_GAINXP, ConvertArray(set_aaxp,val1),ConvertArray(set_exp,val2),ConvertArray(GetEXPForLevel(GetLevel()+1),val3)); //[GM] You have gained %1 AXP and %2 EXP (%3).
|
||||
MessageString(Chat::Experience, GM_GAINXP, ConvertArray(set_aaxp,val1),ConvertArray(set_exp,val2),ConvertArray(GetEXPForLevel(GetLevel()+1),val3)); //[GM] You have gained %1 AXP and %2 EXP (%3).
|
||||
}
|
||||
}
|
||||
|
||||
void Client::SetLevel(uint8 set_level, bool command)
|
||||
{
|
||||
if (GetEXPForLevel(set_level) == 0xFFFFFFFF) {
|
||||
Log(Logs::General, Logs::Error, "Client::SetLevel() GetEXPForLevel(%i) = 0xFFFFFFFF", set_level);
|
||||
LogError("Client::SetLevel() GetEXPForLevel([{}]) = 0xFFFFFFFF", set_level);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -812,7 +812,7 @@ void Client::SetLevel(uint8 set_level, bool command)
|
||||
m_pp.level = set_level;
|
||||
if (command){
|
||||
m_pp.exp = GetEXPForLevel(set_level);
|
||||
Message(15, "Welcome to level %i!", set_level);
|
||||
Message(Chat::Yellow, "Welcome to level %i!", set_level);
|
||||
lu->exp = 0;
|
||||
}
|
||||
else {
|
||||
@@ -823,7 +823,7 @@ void Client::SetLevel(uint8 set_level, bool command)
|
||||
safe_delete(outapp);
|
||||
this->SendAppearancePacket(AT_WhoLevel, set_level); // who level change
|
||||
|
||||
Log(Logs::General, Logs::Normal, "Setting Level for %s to %i", GetName(), set_level);
|
||||
LogInfo("Setting Level for [{}] to [{}]", GetName(), set_level);
|
||||
|
||||
CalcBonuses();
|
||||
|
||||
@@ -1077,12 +1077,12 @@ void Client::SetLeadershipEXP(uint32 group_exp, uint32 raid_exp) {
|
||||
while(group_exp >= GROUP_EXP_PER_POINT) {
|
||||
group_exp -= GROUP_EXP_PER_POINT;
|
||||
m_pp.group_leadership_points++;
|
||||
Message_StringID(MT_Leadership, GAIN_GROUP_LEADERSHIP_POINT);
|
||||
MessageString(Chat::LeaderShip, GAIN_GROUP_LEADERSHIP_POINT);
|
||||
}
|
||||
while(raid_exp >= RAID_EXP_PER_POINT) {
|
||||
raid_exp -= RAID_EXP_PER_POINT;
|
||||
m_pp.raid_leadership_points++;
|
||||
Message_StringID(MT_Leadership, GAIN_RAID_LEADERSHIP_POINT);
|
||||
MessageString(Chat::LeaderShip, GAIN_RAID_LEADERSHIP_POINT);
|
||||
}
|
||||
|
||||
m_pp.group_leadership_exp = group_exp;
|
||||
@@ -1131,15 +1131,16 @@ uint32 Client::GetCharMaxLevelFromQGlobal() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32 Client::GetCharMaxLevelFromBucket() {
|
||||
uint32 char_id = this->CharacterID();
|
||||
std::string query = StringFormat("SELECT value FROM data_buckets WHERE `key` = '%i-CharMaxLevel'", char_id);
|
||||
auto results = database.QueryDatabase(query);
|
||||
uint32 Client::GetCharMaxLevelFromBucket()
|
||||
{
|
||||
uint32 char_id = this->CharacterID();
|
||||
std::string query = StringFormat("SELECT value FROM data_buckets WHERE `key` = '%i-CharMaxLevel'", char_id);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
Log(Logs::General, Logs::Error, "Data bucket for CharMaxLevel for char ID %i failed.", char_id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
LogError("Data bucket for CharMaxLevel for char ID [{}] failed", char_id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (results.RowCount() > 0) {
|
||||
auto row = results.begin();
|
||||
return atoi(row[0]);
|
||||
|
||||
+32
-32
@@ -62,17 +62,17 @@ uint32 ZoneDatabase::GetZoneForage(uint32 ZoneID, uint8 skill) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8 index = 0;
|
||||
for (auto row = results.begin(); row != results.end(); ++row, ++index) {
|
||||
if (index >= FORAGE_ITEM_LIMIT)
|
||||
break;
|
||||
|
||||
item[index] = atoi(row[0]);
|
||||
chance[index] = atoi(row[1]) + chancepool;
|
||||
Log(Logs::General, Logs::Error, "Possible Forage: %d with a %d chance", item[index], chance[index]);
|
||||
chancepool = chance[index];
|
||||
}
|
||||
uint8 index = 0;
|
||||
for (auto row = results.begin(); row != results.end(); ++row, ++index) {
|
||||
if (index >= FORAGE_ITEM_LIMIT) {
|
||||
break;
|
||||
}
|
||||
|
||||
item[index] = atoi(row[0]);
|
||||
chance[index] = atoi(row[1]) + chancepool;
|
||||
LogError("Possible Forage: [{}] with a [{}] chance", item[index], chance[index]);
|
||||
chancepool = chance[index];
|
||||
}
|
||||
|
||||
if(chancepool == 0 || index < 1)
|
||||
return 0;
|
||||
@@ -161,14 +161,14 @@ bool Client::CanFish() {
|
||||
|
||||
if (!Pole || !Pole->IsClassCommon() || Pole->GetItem()->ItemType != EQEmu::item::ItemTypeFishingPole) {
|
||||
if (m_inv.HasItemByUse(EQEmu::item::ItemTypeFishingPole, 1, invWhereWorn | invWherePersonal | invWhereBank | invWhereSharedBank | invWhereTrading | invWhereCursor)) //We have a fishing pole somewhere, just not equipped
|
||||
Message_StringID(MT_Skills, FISHING_EQUIP_POLE); //You need to put your fishing pole in your primary hand.
|
||||
MessageString(Chat::Skills, FISHING_EQUIP_POLE); //You need to put your fishing pole in your primary hand.
|
||||
else //We don't have a fishing pole anywhere
|
||||
Message_StringID(MT_Skills, FISHING_NO_POLE); //You can't fish without a fishing pole, go buy one.
|
||||
MessageString(Chat::Skills, FISHING_NO_POLE); //You can't fish without a fishing pole, go buy one.
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Bait || !Bait->IsClassCommon() || Bait->GetItem()->ItemType != EQEmu::item::ItemTypeFishingBait) {
|
||||
Message_StringID(MT_Skills, FISHING_NO_BAIT); //You can't fish without fishing bait, go buy some.
|
||||
MessageString(Chat::Skills, FISHING_NO_BAIT); //You can't fish without fishing bait, go buy some.
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ bool Client::CanFish() {
|
||||
const float LineLength = RuleR(Watermap, FishingLineLength);
|
||||
int HeadingDegrees;
|
||||
|
||||
HeadingDegrees = (int) ((GetHeading()*360)/256);
|
||||
HeadingDegrees = (int) ((GetHeading()*360)/512);
|
||||
HeadingDegrees = HeadingDegrees % 360;
|
||||
|
||||
rodPosition.x = m_Position.x + RodLength * sin(HeadingDegrees * M_PI/180.0f);
|
||||
@@ -190,7 +190,7 @@ bool Client::CanFish() {
|
||||
float bestz = zone->zonemap->FindBestZ(rodPosition, nullptr);
|
||||
float len = m_Position.z - bestz;
|
||||
if(len > LineLength || len < 0.0f) {
|
||||
Message_StringID(MT_Skills, FISHING_LAND);
|
||||
MessageString(Chat::Skills, FISHING_LAND);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -203,7 +203,7 @@ bool Client::CanFish() {
|
||||
bool in_water = zone->watermap->InWater(dest) || zone->watermap->InVWater(dest);
|
||||
|
||||
if (in_lava) {
|
||||
Message_StringID(MT_Skills, FISHING_LAVA); //Trying to catch a fire elemental or something?
|
||||
MessageString(Chat::Skills, FISHING_LAVA); //Trying to catch a fire elemental or something?
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -212,7 +212,7 @@ bool Client::CanFish() {
|
||||
}
|
||||
}
|
||||
|
||||
Message_StringID(MT_Skills, FISHING_LAND);
|
||||
MessageString(Chat::Skills, FISHING_LAND);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -223,7 +223,7 @@ void Client::GoFish()
|
||||
|
||||
//TODO: generate a message if we're already fishing
|
||||
/*if (!fishing_timer.Check()) { //this isn't the right check, may need to add something to the Client class like 'bool is_fishing'
|
||||
Message_StringID(0, ALREADY_FISHING); //You are already fishing!
|
||||
MessageString(Chat::White, ALREADY_FISHING); //You are already fishing!
|
||||
return;
|
||||
}*/
|
||||
|
||||
@@ -293,12 +293,12 @@ void Client::GoFish()
|
||||
|
||||
entity_list.AddNPC(npc);
|
||||
|
||||
Message(MT_Emote,
|
||||
Message(Chat::Emote,
|
||||
"You fish up a little more than you bargained for...");
|
||||
}
|
||||
}
|
||||
else {
|
||||
Message(MT_Emote, "You notice something lurking just below the water's surface...");
|
||||
Message(Chat::Emote, "You notice something lurking just below the water's surface...");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -315,17 +315,17 @@ void Client::GoFish()
|
||||
const EQEmu::ItemData* food_item = database.GetItem(food_id);
|
||||
|
||||
if (food_item->ItemType != EQEmu::item::ItemTypeFood) {
|
||||
Message_StringID(MT_Skills, FISHING_SUCCESS);
|
||||
MessageString(Chat::Skills, FISHING_SUCCESS);
|
||||
}
|
||||
else {
|
||||
Message_StringID(MT_Skills, FISHING_SUCCESS_FISH_NAME, food_item->Name);
|
||||
MessageString(Chat::Skills, FISHING_SUCCESS_FISH_NAME, food_item->Name);
|
||||
}
|
||||
|
||||
EQEmu::ItemInstance* inst = database.CreateItem(food_item, 1);
|
||||
if(inst != nullptr) {
|
||||
if(CheckLoreConflict(inst->GetItem()))
|
||||
{
|
||||
Message_StringID(0, DUP_LORE);
|
||||
MessageString(Chat::White, DUP_LORE);
|
||||
safe_delete(inst);
|
||||
}
|
||||
else
|
||||
@@ -351,13 +351,13 @@ void Client::GoFish()
|
||||
//chance to use bait when you dont catch anything...
|
||||
if (zone->random.Int(0, 4) == 1) {
|
||||
DeleteItemInInventory(bslot, 1, true); //do we need client update?
|
||||
Message_StringID(MT_Skills, FISHING_LOST_BAIT); //You lost your bait!
|
||||
MessageString(Chat::Skills, FISHING_LOST_BAIT); //You lost your bait!
|
||||
} else {
|
||||
if (zone->random.Int(0, 15) == 1) //give about a 1 in 15 chance to spill your beer. we could make this a rule, but it doesn't really seem worth it
|
||||
//TODO: check for & consume an alcoholic beverage from inventory when this triggers, and set it as a rule that's disabled by default
|
||||
Message_StringID(MT_Skills, FISHING_SPILL_BEER); //You spill your beer while bringing in your line.
|
||||
MessageString(Chat::Skills, FISHING_SPILL_BEER); //You spill your beer while bringing in your line.
|
||||
else
|
||||
Message_StringID(MT_Skills, FISHING_FAILED); //You didn't catch anything.
|
||||
MessageString(Chat::Skills, FISHING_FAILED); //You didn't catch anything.
|
||||
}
|
||||
|
||||
parse->EventPlayer(EVENT_FISH_FAILURE, this, "", 0);
|
||||
@@ -367,7 +367,7 @@ void Client::GoFish()
|
||||
//this is potentially exploitable in that they can fish
|
||||
//and then swap out items in primary slot... too lazy to fix right now
|
||||
if (zone->random.Int(0, 49) == 1) {
|
||||
Message_StringID(MT_Skills, FISHING_POLE_BROKE); //Your fishing pole broke!
|
||||
MessageString(Chat::Skills, FISHING_POLE_BROKE); //Your fishing pole broke!
|
||||
DeleteItemInInventory(EQEmu::invslot::slotPrimary, 0, true);
|
||||
}
|
||||
|
||||
@@ -413,7 +413,7 @@ void Client::ForageItem(bool guarantee) {
|
||||
const EQEmu::ItemData* food_item = database.GetItem(foragedfood);
|
||||
|
||||
if(!food_item) {
|
||||
Log(Logs::General, Logs::Error, "nullptr returned from database.GetItem in ClientForageItem");
|
||||
LogError("nullptr returned from database.GetItem in ClientForageItem");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -434,13 +434,13 @@ void Client::ForageItem(bool guarantee) {
|
||||
break;
|
||||
}
|
||||
|
||||
Message_StringID(MT_Skills, stringid);
|
||||
MessageString(Chat::Skills, stringid);
|
||||
EQEmu::ItemInstance* inst = database.CreateItem(food_item, 1);
|
||||
if(inst != nullptr) {
|
||||
// check to make sure it isn't a foraged lore item
|
||||
if(CheckLoreConflict(inst->GetItem()))
|
||||
{
|
||||
Message_StringID(0, DUP_LORE);
|
||||
MessageString(Chat::White, DUP_LORE);
|
||||
safe_delete(inst);
|
||||
}
|
||||
else {
|
||||
@@ -462,12 +462,12 @@ void Client::ForageItem(bool guarantee) {
|
||||
|
||||
int ChanceSecondForage = aabonuses.ForageAdditionalItems + itembonuses.ForageAdditionalItems + spellbonuses.ForageAdditionalItems;
|
||||
if(!guarantee && zone->random.Roll(ChanceSecondForage)) {
|
||||
Message_StringID(MT_Skills, FORAGE_MASTERY);
|
||||
MessageString(Chat::Skills, FORAGE_MASTERY);
|
||||
ForageItem(true);
|
||||
}
|
||||
|
||||
} else {
|
||||
Message_StringID(MT_Skills, FORAGE_FAILED);
|
||||
MessageString(Chat::Skills, FORAGE_FAILED);
|
||||
parse->EventPlayer(EVENT_FORAGE_FAILURE, this, "", 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,14 +21,14 @@ std::vector<int> GlobalLootManager::GetGlobalLootTables(NPC *mob) const
|
||||
void GlobalLootManager::ShowZoneGlobalLoot(Client *to) const
|
||||
{
|
||||
for (auto &e : m_entries)
|
||||
to->Message(0, " %s : %d table %d", e.GetDescription().c_str(), e.GetID(), e.GetLootTableID());
|
||||
to->Message(Chat::White, " %s : %d table %d", e.GetDescription().c_str(), e.GetID(), e.GetLootTableID());
|
||||
}
|
||||
|
||||
void GlobalLootManager::ShowNPCGlobalLoot(Client *to, NPC *who) const
|
||||
{
|
||||
for (auto &e : m_entries) {
|
||||
if (e.PassesRules(who))
|
||||
to->Message(0, " %s : %d table %d", e.GetDescription().c_str(), e.GetID(), e.GetLootTableID());
|
||||
to->Message(Chat::White, " %s : %d table %d", e.GetDescription().c_str(), e.GetID(), e.GetLootTableID());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+35
-30
@@ -199,7 +199,7 @@ void Group::SplitMoney(uint32 copper, uint32 silver, uint32 gold, uint32 platinu
|
||||
Client *c = members[i]->CastToClient();
|
||||
//I could not get MoneyOnCorpse to work, so we use this
|
||||
c->AddMoneyToPP(cpsplit, spsplit, gpsplit, ppsplit, true);
|
||||
c->Message(2, msg.c_str());
|
||||
c->Message(Chat::Green, msg.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -835,7 +835,7 @@ void Group::CastGroupSpell(Mob* caster, uint16 spell_id) {
|
||||
caster->SpellOnTarget(spell_id, members[z]->GetPet());
|
||||
#endif
|
||||
} else
|
||||
Log(Logs::Detail, Logs::Spells, "Group spell: %s is out of range %f at distance %f from %s", members[z]->GetName(), range, distance, caster->GetName());
|
||||
LogSpells("Group spell: [{}] is out of range [{}] at distance [{}] from [{}]", members[z]->GetName(), range, distance, caster->GetName());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -874,7 +874,7 @@ void Group::GroupBardPulse(Mob* caster, uint16 spell_id) {
|
||||
members[z]->GetPet()->BardPulse(spell_id, caster);
|
||||
#endif
|
||||
} else
|
||||
Log(Logs::Detail, Logs::Spells, "Group bard pulse: %s is out of range %f at distance %f from %s", members[z]->GetName(), range, distance, caster->GetName());
|
||||
LogSpells("Group bard pulse: [{}] is out of range [{}] at distance [{}] from [{}]", members[z]->GetName(), range, distance, caster->GetName());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -910,7 +910,7 @@ void Group::GroupMessage(Mob* sender, uint8 language, uint8 lang_skill, const ch
|
||||
continue;
|
||||
|
||||
if (members[i]->IsClient() && members[i]->CastToClient()->GetFilter(FilterGroupChat)!=0)
|
||||
members[i]->CastToClient()->ChannelMessageSend(sender->GetName(),members[i]->GetName(),2,language,lang_skill,message);
|
||||
members[i]->CastToClient()->ChannelMessageSend(sender->GetName(),members[i]->GetName(),ChatChannel_Group,language,lang_skill,message);
|
||||
}
|
||||
|
||||
auto pack =
|
||||
@@ -1177,10 +1177,15 @@ bool Group::LearnMembers() {
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
if (results.RowCount() == 0) {
|
||||
Log(Logs::General, Logs::Error, "Error getting group members for group %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str());
|
||||
return false;
|
||||
}
|
||||
if (results.RowCount() == 0) {
|
||||
LogError(
|
||||
"Error getting group members for group [{}]: [{}]",
|
||||
(unsigned long) GetID(),
|
||||
results.ErrorMessage().c_str()
|
||||
);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
int memberIndex = 0;
|
||||
for(auto row = results.begin(); row != results.end(); ++row) {
|
||||
@@ -1207,7 +1212,7 @@ void Group::VerifyGroup() {
|
||||
for (i = 0; i < MAX_GROUP_MEMBERS; i++) {
|
||||
if (membername[i][0] == '\0') {
|
||||
#if EQDEBUG >= 7
|
||||
Log(Logs::General, Logs::None, "Group %lu: Verify %d: Empty.\n", (unsigned long)GetID(), i);
|
||||
LogDebug("Group [{}]: Verify [{}]: Empty.\n", (unsigned long)GetID(), i);
|
||||
#endif
|
||||
members[i] = nullptr;
|
||||
continue;
|
||||
@@ -1216,7 +1221,7 @@ void Group::VerifyGroup() {
|
||||
Mob *them = entity_list.GetMob(membername[i]);
|
||||
if(them == nullptr && members[i] != nullptr) { //they aren't in zone
|
||||
#if EQDEBUG >= 6
|
||||
Log(Logs::General, Logs::None, "Member of group %lu named '%s' has disappeared!!", (unsigned long)GetID(), membername[i]);
|
||||
LogDebug("Member of group [{}] named [{}] has disappeared!!", (unsigned long)GetID(), membername[i]);
|
||||
#endif
|
||||
membername[i][0] = '\0';
|
||||
members[i] = nullptr;
|
||||
@@ -1225,18 +1230,18 @@ void Group::VerifyGroup() {
|
||||
|
||||
if(them != nullptr && members[i] != them) { //our pointer is out of date... not so good.
|
||||
#if EQDEBUG >= 5
|
||||
Log(Logs::General, Logs::None, "Member of group %lu named '%s' had an out of date pointer!!", (unsigned long)GetID(), membername[i]);
|
||||
LogDebug("Member of group [{}] named [{}] had an out of date pointer!!", (unsigned long)GetID(), membername[i]);
|
||||
#endif
|
||||
members[i] = them;
|
||||
continue;
|
||||
}
|
||||
#if EQDEBUG >= 8
|
||||
Log(Logs::General, Logs::None, "Member of group %lu named '%s' is valid.", (unsigned long)GetID(), membername[i]);
|
||||
LogDebug("Member of group [{}] named [{}] is valid", (unsigned long)GetID(), membername[i]);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void Group::GroupMessage_StringID(Mob* sender, uint32 type, uint32 string_id, const char* message,const char* message2,const char* message3,const char* message4,const char* message5,const char* message6,const char* message7,const char* message8,const char* message9, uint32 distance) {
|
||||
void Group::GroupMessageString(Mob* sender, uint32 type, uint32 string_id, const char* message,const char* message2,const char* message3,const char* message4,const char* message5,const char* message6,const char* message7,const char* message8,const char* message9, uint32 distance) {
|
||||
uint32 i;
|
||||
for (i = 0; i < MAX_GROUP_MEMBERS; i++) {
|
||||
if(members[i] == nullptr)
|
||||
@@ -1248,7 +1253,7 @@ void Group::GroupMessage_StringID(Mob* sender, uint32 type, uint32 string_id, co
|
||||
if(!members[i]->IsClient())
|
||||
continue;
|
||||
|
||||
members[i]->Message_StringID(type, string_id, message, message2, message3, message4, message5, message6, message7, message8, message9, 0);
|
||||
members[i]->MessageString(type, string_id, message, message2, message3, message4, message5, message6, message7, message8, message9, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1566,7 +1571,7 @@ void Group::DelegateMainTank(const char *NewMainTankName, uint8 toggle)
|
||||
MainTankName.c_str(), GetID());
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
Log(Logs::General, Logs::Error, "Unable to set group main tank: %s\n", results.ErrorMessage().c_str());
|
||||
LogError("Unable to set group main tank: [{}]\n", results.ErrorMessage().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1612,7 +1617,7 @@ void Group::DelegateMainAssist(const char *NewMainAssistName, uint8 toggle)
|
||||
MainAssistName.c_str(), GetID());
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
Log(Logs::General, Logs::Error, "Unable to set group main assist: %s\n", results.ErrorMessage().c_str());
|
||||
LogError("Unable to set group main assist: [{}]\n", results.ErrorMessage().c_str());
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1659,7 +1664,7 @@ void Group::DelegatePuller(const char *NewPullerName, uint8 toggle)
|
||||
PullerName.c_str(), GetID());
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
Log(Logs::General, Logs::Error, "Unable to set group main puller: %s\n", results.ErrorMessage().c_str());
|
||||
LogError("Unable to set group main puller: [{}]\n", results.ErrorMessage().c_str());
|
||||
|
||||
}
|
||||
|
||||
@@ -1680,9 +1685,9 @@ void Group::NotifyMainTank(Client *c, uint8 toggle)
|
||||
if (c->ClientVersion() < EQEmu::versions::ClientVersion::SoD)
|
||||
{
|
||||
if(toggle)
|
||||
c->Message(0, "%s is now Main Tank.", MainTankName.c_str());
|
||||
c->Message(Chat::White, "%s is now Main Tank.", MainTankName.c_str());
|
||||
else
|
||||
c->Message(0, "%s is no longer Main Tank.", MainTankName.c_str());
|
||||
c->Message(Chat::White, "%s is no longer Main Tank.", MainTankName.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1775,9 +1780,9 @@ void Group::NotifyPuller(Client *c, uint8 toggle)
|
||||
if (c->ClientVersion() < EQEmu::versions::ClientVersion::SoD)
|
||||
{
|
||||
if(toggle)
|
||||
c->Message(0, "%s is now Puller.", PullerName.c_str());
|
||||
c->Message(Chat::White, "%s is now Puller.", PullerName.c_str());
|
||||
else
|
||||
c->Message(0, "%s is no longer Puller.", PullerName.c_str());
|
||||
c->Message(Chat::White, "%s is no longer Puller.", PullerName.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1810,7 +1815,7 @@ void Group::UnDelegateMainTank(const char *OldMainTankName, uint8 toggle)
|
||||
std::string query = StringFormat("UPDATE group_leaders SET maintank = '' WHERE gid = %i LIMIT 1", GetID());
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
Log(Logs::General, Logs::Error, "Unable to clear group main tank: %s\n", results.ErrorMessage().c_str());
|
||||
LogError("Unable to clear group main tank: [{}]\n", results.ErrorMessage().c_str());
|
||||
|
||||
if(!toggle) {
|
||||
for(uint32 i = 0; i < MAX_GROUP_MEMBERS; ++i) {
|
||||
@@ -1859,7 +1864,7 @@ void Group::UnDelegateMainAssist(const char *OldMainAssistName, uint8 toggle)
|
||||
std::string query = StringFormat("UPDATE group_leaders SET assist = '' WHERE gid = %i LIMIT 1", GetID());
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
Log(Logs::General, Logs::Error, "Unable to clear group main assist: %s\n", results.ErrorMessage().c_str());
|
||||
LogError("Unable to clear group main assist: [{}]\n", results.ErrorMessage().c_str());
|
||||
|
||||
if(!toggle)
|
||||
{
|
||||
@@ -1887,7 +1892,7 @@ void Group::UnDelegatePuller(const char *OldPullerName, uint8 toggle)
|
||||
std::string query = StringFormat("UPDATE group_leaders SET puller = '' WHERE gid = %i LIMIT 1", GetID());
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
Log(Logs::General, Logs::Error, "Unable to clear group main puller: %s\n", results.ErrorMessage().c_str());
|
||||
LogError("Unable to clear group main puller: [{}]\n", results.ErrorMessage().c_str());
|
||||
|
||||
if(!toggle) {
|
||||
for(uint32 i = 0; i < MAX_GROUP_MEMBERS; ++i) {
|
||||
@@ -1970,7 +1975,7 @@ void Group::SetGroupMentor(int percent, char *name)
|
||||
mentoree_name.c_str(), mentor_percent, GetID());
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
Log(Logs::General, Logs::Error, "Unable to set group mentor: %s\n", results.ErrorMessage().c_str());
|
||||
LogError("Unable to set group mentor: [{}]\n", results.ErrorMessage().c_str());
|
||||
}
|
||||
|
||||
void Group::ClearGroupMentor()
|
||||
@@ -1981,7 +1986,7 @@ void Group::ClearGroupMentor()
|
||||
std::string query = StringFormat("UPDATE group_leaders SET mentoree = '', mentor_percent = 0 WHERE gid = %i LIMIT 1", GetID());
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
Log(Logs::General, Logs::Error, "Unable to clear group mentor: %s\n", results.ErrorMessage().c_str());
|
||||
LogError("Unable to clear group mentor: [{}]\n", results.ErrorMessage().c_str());
|
||||
}
|
||||
|
||||
void Group::NotifyAssistTarget(Client *c)
|
||||
@@ -2051,7 +2056,7 @@ void Group::DelegateMarkNPC(const char *NewNPCMarkerName)
|
||||
NewNPCMarkerName, GetID());
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
Log(Logs::General, Logs::Error, "Unable to set group mark npc: %s\n", results.ErrorMessage().c_str());
|
||||
LogError("Unable to set group mark npc: [{}]\n", results.ErrorMessage().c_str());
|
||||
}
|
||||
|
||||
void Group::NotifyMarkNPC(Client *c)
|
||||
@@ -2132,7 +2137,7 @@ void Group::UnDelegateMarkNPC(const char *OldNPCMarkerName)
|
||||
std::string query = StringFormat("UPDATE group_leaders SET marknpc = '' WHERE gid = %i LIMIT 1", GetID());
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
Log(Logs::General, Logs::Error, "Unable to clear group marknpc: %s\n", results.ErrorMessage().c_str());
|
||||
LogError("Unable to clear group marknpc: [{}]\n", results.ErrorMessage().c_str());
|
||||
|
||||
}
|
||||
|
||||
@@ -2149,7 +2154,7 @@ void Group::SaveGroupLeaderAA()
|
||||
safe_delete_array(queryBuffer);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
Log(Logs::General, Logs::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str());
|
||||
LogError("Unable to store LeadershipAA: [{}]\n", results.ErrorMessage().c_str());
|
||||
|
||||
}
|
||||
|
||||
@@ -2493,4 +2498,4 @@ void Group::QueueClients(Mob *sender, const EQApplicationPacket *app, bool ack_r
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -74,7 +74,7 @@ public:
|
||||
void GroupBardPulse(Mob* caster,uint16 spellid);
|
||||
void SplitExp(uint32 exp, Mob* other);
|
||||
void GroupMessage(Mob* sender,uint8 language,uint8 lang_skill,const char* message);
|
||||
void GroupMessage_StringID(Mob* sender, uint32 type, uint32 string_id, const char* message,const char* message2=0,const char* message3=0,const char* message4=0,const char* message5=0,const char* message6=0,const char* message7=0,const char* message8=0,const char* message9=0, uint32 distance = 0);
|
||||
void GroupMessageString(Mob* sender, uint32 type, uint32 string_id, const char* message,const char* message2=0,const char* message3=0,const char* message4=0,const char* message5=0,const char* message6=0,const char* message7=0,const char* message8=0,const char* message9=0, uint32 distance = 0);
|
||||
uint32 GetTotalGroupDamage(Mob* other);
|
||||
void SplitMoney(uint32 copper, uint32 silver, uint32 gold, uint32 platinum, Client *splitter = nullptr);
|
||||
inline void SetLeader(Mob* newleader){ leader=newleader; };
|
||||
|
||||
+8
-8
@@ -56,7 +56,7 @@ void Client::SendGuildMOTD(bool GetGuildMOTDReply) {
|
||||
|
||||
}
|
||||
|
||||
Log(Logs::Detail, Logs::Guilds, "Sending OP_GuildMOTD of length %d", outapp->size);
|
||||
LogGuilds("Sending OP_GuildMOTD of length [{}]", outapp->size);
|
||||
|
||||
FastQueuePacket(&outapp);
|
||||
}
|
||||
@@ -147,10 +147,10 @@ void Client::SendGuildSpawnAppearance() {
|
||||
if (!IsInAGuild()) {
|
||||
// clear guildtag
|
||||
SendAppearancePacket(AT_GuildID, GUILD_NONE);
|
||||
Log(Logs::Detail, Logs::Guilds, "Sending spawn appearance for no guild tag.");
|
||||
LogGuilds("Sending spawn appearance for no guild tag");
|
||||
} else {
|
||||
uint8 rank = guild_mgr.GetDisplayedRank(GuildID(), GuildRank(), CharacterID());
|
||||
Log(Logs::Detail, Logs::Guilds, "Sending spawn appearance for guild %d at rank %d", GuildID(), rank);
|
||||
LogGuilds("Sending spawn appearance for guild [{}] at rank [{}]", GuildID(), rank);
|
||||
SendAppearancePacket(AT_GuildID, GuildID());
|
||||
if (ClientVersion() >= EQEmu::versions::ClientVersion::RoF)
|
||||
{
|
||||
@@ -174,11 +174,11 @@ void Client::SendGuildList() {
|
||||
//ask the guild manager to build us a nice guild list packet
|
||||
outapp->pBuffer = guild_mgr.MakeGuildList(/*GetName()*/"", outapp->size);
|
||||
if(outapp->pBuffer == nullptr) {
|
||||
Log(Logs::Detail, Logs::Guilds, "Unable to make guild list!");
|
||||
LogGuilds("Unable to make guild list!");
|
||||
return;
|
||||
}
|
||||
|
||||
Log(Logs::Detail, Logs::Guilds, "Sending OP_ZoneGuildList of length %d", outapp->size);
|
||||
LogGuilds("Sending OP_ZoneGuildList of length [{}]", outapp->size);
|
||||
|
||||
FastQueuePacket(&outapp);
|
||||
}
|
||||
@@ -195,7 +195,7 @@ void Client::SendGuildMembers() {
|
||||
outapp->pBuffer = data;
|
||||
data = nullptr;
|
||||
|
||||
Log(Logs::Detail, Logs::Guilds, "Sending OP_GuildMemberList of length %d", outapp->size);
|
||||
LogGuilds("Sending OP_GuildMemberList of length [{}]", outapp->size);
|
||||
|
||||
FastQueuePacket(&outapp);
|
||||
|
||||
@@ -227,7 +227,7 @@ void Client::RefreshGuildInfo()
|
||||
|
||||
CharGuildInfo info;
|
||||
if(!guild_mgr.GetCharInfo(CharacterID(), info)) {
|
||||
Log(Logs::Detail, Logs::Guilds, "Unable to obtain guild char info for %s (%d)", GetName(), CharacterID());
|
||||
LogGuilds("Unable to obtain guild char info for [{}] ([{}])", GetName(), CharacterID());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -341,7 +341,7 @@ void Client::SendGuildJoin(GuildJoin_Struct* gj){
|
||||
outgj->rank = gj->rank;
|
||||
outgj->zoneid = gj->zoneid;
|
||||
|
||||
Log(Logs::Detail, Logs::Guilds, "Sending OP_GuildManageAdd for join of length %d", outapp->size);
|
||||
LogGuilds("Sending OP_GuildManageAdd for join of length [{}]", outapp->size);
|
||||
|
||||
FastQueuePacket(&outapp);
|
||||
|
||||
|
||||
+37
-38
@@ -32,7 +32,7 @@ extern WorldServer worldserver;
|
||||
extern volatile bool is_zone_loaded;
|
||||
|
||||
void ZoneGuildManager::SendGuildRefresh(uint32 guild_id, bool name, bool motd, bool rank, bool relation) {
|
||||
Log(Logs::Detail, Logs::Guilds, "Sending guild refresh for %d to world, changes: name=%d, motd=%d, rank=d, relation=%d", guild_id, name, motd, rank, relation);
|
||||
LogGuilds("Sending guild refresh for [{}] to world, changes: name=[{}], motd=[{}], rank=d, relation=[{}]", guild_id, name, motd, rank, relation);
|
||||
auto pack = new ServerPacket(ServerOP_RefreshGuild, sizeof(ServerGuildRefresh_Struct));
|
||||
ServerGuildRefresh_Struct *s = (ServerGuildRefresh_Struct *) pack->pBuffer;
|
||||
s->guild_id = guild_id;
|
||||
@@ -46,7 +46,7 @@ void ZoneGuildManager::SendGuildRefresh(uint32 guild_id, bool name, bool motd, b
|
||||
|
||||
void ZoneGuildManager::SendCharRefresh(uint32 old_guild_id, uint32 guild_id, uint32 charid) {
|
||||
if(guild_id == 0) {
|
||||
Log(Logs::Detail, Logs::Guilds, "Guild lookup for char %d when sending char refresh.", charid);
|
||||
LogGuilds("Guild lookup for char [{}] when sending char refresh", charid);
|
||||
|
||||
CharGuildInfo gci;
|
||||
if(!GetCharInfo(charid, gci)) {
|
||||
@@ -56,7 +56,7 @@ void ZoneGuildManager::SendCharRefresh(uint32 old_guild_id, uint32 guild_id, uin
|
||||
}
|
||||
}
|
||||
|
||||
Log(Logs::Detail, Logs::Guilds, "Sending char refresh for %d from guild %d to world", charid, guild_id);
|
||||
LogGuilds("Sending char refresh for [{}] from guild [{}] to world", charid, guild_id);
|
||||
|
||||
auto pack = new ServerPacket(ServerOP_GuildCharRefresh, sizeof(ServerGuildCharRefresh_Struct));
|
||||
ServerGuildCharRefresh_Struct *s = (ServerGuildCharRefresh_Struct *) pack->pBuffer;
|
||||
@@ -89,7 +89,7 @@ void ZoneGuildManager::SendRankUpdate(uint32 CharID)
|
||||
}
|
||||
|
||||
void ZoneGuildManager::SendGuildDelete(uint32 guild_id) {
|
||||
Log(Logs::Detail, Logs::Guilds, "Sending guild delete for guild %d to world", guild_id);
|
||||
LogGuilds("Sending guild delete for guild [{}] to world", guild_id);
|
||||
auto pack = new ServerPacket(ServerOP_DeleteGuild, sizeof(ServerGuildID_Struct));
|
||||
ServerGuildID_Struct *s = (ServerGuildID_Struct *) pack->pBuffer;
|
||||
s->guild_id = guild_id;
|
||||
@@ -189,7 +189,7 @@ uint8 *ZoneGuildManager::MakeGuildMembers(uint32 guild_id, const char *prefix_na
|
||||
}
|
||||
|
||||
void ZoneGuildManager::ListGuilds(Client *c) const {
|
||||
c->Message(0, "Listing guilds on the server:");
|
||||
c->Message(Chat::White, "Listing guilds on the server:");
|
||||
char leadername[64];
|
||||
std::map<uint32, GuildInfo *>::const_iterator cur, end;
|
||||
cur = m_guilds.begin();
|
||||
@@ -199,12 +199,12 @@ void ZoneGuildManager::ListGuilds(Client *c) const {
|
||||
leadername[0] = '\0';
|
||||
database.GetCharName(cur->second->leader_char_id, leadername);
|
||||
if (leadername[0] == '\0')
|
||||
c->Message(0, " Guild #%i <%s>", cur->first, cur->second->name.c_str());
|
||||
c->Message(Chat::White, " Guild #%i <%s>", cur->first, cur->second->name.c_str());
|
||||
else
|
||||
c->Message(0, " Guild #%i <%s> Leader: %s", cur->first, cur->second->name.c_str(), leadername);
|
||||
c->Message(Chat::White, " Guild #%i <%s> Leader: %s", cur->first, cur->second->name.c_str(), leadername);
|
||||
r++;
|
||||
}
|
||||
c->Message(0, "%i guilds listed.", r);
|
||||
c->Message(Chat::White, "%i guilds listed.", r);
|
||||
}
|
||||
|
||||
|
||||
@@ -212,17 +212,17 @@ void ZoneGuildManager::DescribeGuild(Client *c, uint32 guild_id) const {
|
||||
std::map<uint32, GuildInfo *>::const_iterator res;
|
||||
res = m_guilds.find(guild_id);
|
||||
if(res == m_guilds.end()) {
|
||||
c->Message(0, "Guild %d not found.", guild_id);
|
||||
c->Message(Chat::White, "Guild %d not found.", guild_id);
|
||||
return;
|
||||
}
|
||||
|
||||
const GuildInfo *info = res->second;
|
||||
|
||||
c->Message(0, "Guild info DB# %i <%s>", guild_id, info->name.c_str());
|
||||
c->Message(Chat::White, "Guild info DB# %i <%s>", guild_id, info->name.c_str());
|
||||
|
||||
char leadername[64];
|
||||
database.GetCharName(info->leader_char_id, leadername);
|
||||
c->Message(0, "Guild Leader: %s", leadername);
|
||||
c->Message(Chat::White, "Guild Leader: %s", leadername);
|
||||
|
||||
char permbuffer[256];
|
||||
uint8 i;
|
||||
@@ -232,8 +232,8 @@ void ZoneGuildManager::DescribeGuild(Client *c, uint32 guild_id) const {
|
||||
for(r = 0; r < _MaxGuildAction; r++)
|
||||
permptr += sprintf(permptr, " %s: %c", GuildActionNames[r], info->ranks[i].permissions[r]?'Y':'N');
|
||||
|
||||
c->Message(0, "Rank %i: %s", i, info->ranks[i].name.c_str());
|
||||
c->Message(0, "Permissions: %s", permbuffer);
|
||||
c->Message(Chat::White, "Rank %i: %s", i, info->ranks[i].name.c_str());
|
||||
c->Message(Chat::White, "Permissions: %s", permbuffer);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -261,12 +261,12 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) {
|
||||
switch(pack->opcode) {
|
||||
case ServerOP_RefreshGuild: {
|
||||
if(pack->size != sizeof(ServerGuildRefresh_Struct)) {
|
||||
Log(Logs::General, Logs::Error, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildRefresh_Struct));
|
||||
LogError("Received ServerOP_RefreshGuild of incorrect size [{}], expected [{}]", pack->size, sizeof(ServerGuildRefresh_Struct));
|
||||
return;
|
||||
}
|
||||
ServerGuildRefresh_Struct *s = (ServerGuildRefresh_Struct *) pack->pBuffer;
|
||||
|
||||
Log(Logs::Detail, Logs::Guilds, "Received guild refresh from world for %d, changes: name=%d, motd=%d, rank=%d, relation=%d", s->guild_id, s->name_change, s->motd_change, s->rank_change, s->relation_change);
|
||||
LogGuilds("Received guild refresh from world for [{}], changes: name=[{}], motd=[{}], rank=[{}], relation=[{}]", s->guild_id, s->name_change, s->motd_change, s->rank_change, s->relation_change);
|
||||
|
||||
//reload all the guild details from the database.
|
||||
RefreshGuild(s->guild_id);
|
||||
@@ -295,12 +295,12 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) {
|
||||
|
||||
case ServerOP_GuildCharRefresh: {
|
||||
if(pack->size != sizeof(ServerGuildCharRefresh_Struct)) {
|
||||
Log(Logs::General, Logs::Error, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildCharRefresh_Struct));
|
||||
LogError("Received ServerOP_RefreshGuild of incorrect size [{}], expected [{}]", pack->size, sizeof(ServerGuildCharRefresh_Struct));
|
||||
return;
|
||||
}
|
||||
ServerGuildCharRefresh_Struct *s = (ServerGuildCharRefresh_Struct *) pack->pBuffer;
|
||||
|
||||
Log(Logs::Detail, Logs::Guilds, "Received guild member refresh from world for char %d from guild %d", s->char_id, s->guild_id);
|
||||
LogGuilds("Received guild member refresh from world for char [{}] from guild [{}]", s->char_id, s->guild_id);
|
||||
|
||||
Client *c = entity_list.GetClientByCharID(s->char_id);
|
||||
|
||||
@@ -338,7 +338,7 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) {
|
||||
{
|
||||
if(pack->size != sizeof(ServerGuildRankUpdate_Struct))
|
||||
{
|
||||
Log(Logs::General, Logs::Error, "Received ServerOP_RankUpdate of incorrect size %d, expected %d",
|
||||
LogError("Received ServerOP_RankUpdate of incorrect size [{}], expected [{}]",
|
||||
pack->size, sizeof(ServerGuildRankUpdate_Struct));
|
||||
|
||||
return;
|
||||
@@ -364,12 +364,12 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) {
|
||||
|
||||
case ServerOP_DeleteGuild: {
|
||||
if(pack->size != sizeof(ServerGuildID_Struct)) {
|
||||
Log(Logs::General, Logs::Error, "Received ServerOP_DeleteGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildID_Struct));
|
||||
LogError("Received ServerOP_DeleteGuild of incorrect size [{}], expected [{}]", pack->size, sizeof(ServerGuildID_Struct));
|
||||
return;
|
||||
}
|
||||
ServerGuildID_Struct *s = (ServerGuildID_Struct *) pack->pBuffer;
|
||||
|
||||
Log(Logs::Detail, Logs::Guilds, "Received guild delete from world for guild %d", s->guild_id);
|
||||
LogGuilds("Received guild delete from world for guild [{}]", s->guild_id);
|
||||
|
||||
//clear all the guild tags.
|
||||
entity_list.RefreshAllGuildInfo(s->guild_id);
|
||||
@@ -417,23 +417,22 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) {
|
||||
|
||||
if (!c || !c->IsInAGuild())
|
||||
{
|
||||
Log(Logs::Detail, Logs::Guilds,"Invalid Client or not in guild. ID=%i", FromID);
|
||||
LogGuilds("Invalid Client or not in guild. ID=[{}]", FromID);
|
||||
break;
|
||||
}
|
||||
Log(Logs::Detail, Logs::Guilds,"Processing ServerOP_OnlineGuildMembersResponse");
|
||||
LogGuilds("Processing ServerOP_OnlineGuildMembersResponse");
|
||||
auto outapp = new EQApplicationPacket(OP_GuildMemberUpdate, sizeof(GuildMemberUpdate_Struct));
|
||||
GuildMemberUpdate_Struct *gmus = (GuildMemberUpdate_Struct*)outapp->pBuffer;
|
||||
char Name[64];
|
||||
gmus->LastSeen = time(nullptr);
|
||||
gmus->InstanceID = 0;
|
||||
gmus->GuildID = c->GuildID();
|
||||
for (int i=0;i<Count;i++)
|
||||
{
|
||||
for (int i = 0; i < Count; i++) {
|
||||
// Just make the packet once and swap out name/zone and send
|
||||
VARSTRUCT_DECODE_STRING(Name, Buffer);
|
||||
strn0cpy(gmus->MemberName, Name, sizeof(gmus->MemberName));
|
||||
gmus->ZoneID = VARSTRUCT_DECODE_TYPE(uint32, Buffer);
|
||||
Log(Logs::Detail, Logs::Guilds,"Sending OP_GuildMemberUpdate to %i. Name=%s ZoneID=%i",FromID,Name,gmus->ZoneID);
|
||||
LogGuilds("Sending OP_GuildMemberUpdate to [{}]. Name=[{}] ZoneID=[{}]", FromID, Name, gmus->ZoneID);
|
||||
c->QueuePacket(outapp);
|
||||
}
|
||||
safe_delete(outapp);
|
||||
@@ -537,14 +536,14 @@ void ZoneGuildManager::AddMemberApproval(uint32 refid,Client* name)
|
||||
if(tmp != 0)
|
||||
{
|
||||
if(!tmp->AddMemberApproval(name))
|
||||
name->Message(0,"Unable to add to list.");
|
||||
name->Message(Chat::White,"Unable to add to list.");
|
||||
else
|
||||
{
|
||||
name->Message(0,"Added to list.");
|
||||
name->Message(Chat::White,"Added to list.");
|
||||
}
|
||||
}
|
||||
else
|
||||
name->Message(0,"Unable to find guild reference id.");
|
||||
name->Message(Chat::White,"Unable to find guild reference id.");
|
||||
}
|
||||
|
||||
ZoneGuildManager::~ZoneGuildManager()
|
||||
@@ -683,7 +682,7 @@ void GuildBankManager::SendGuildBank(Client *c)
|
||||
|
||||
if(Iterator == Banks.end())
|
||||
{
|
||||
Log(Logs::General, Logs::Error, "Unable to find guild bank for guild ID %i", c->GuildID());
|
||||
LogError("Unable to find guild bank for guild ID [{}]", c->GuildID());
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -856,7 +855,7 @@ bool GuildBankManager::AddItem(uint32 GuildID, uint8 Area, uint32 ItemID, int32
|
||||
|
||||
if(Iterator == Banks.end())
|
||||
{
|
||||
Log(Logs::General, Logs::Error, "Unable to find guild bank for guild ID %i", GuildID);
|
||||
LogError("Unable to find guild bank for guild ID [{}]", GuildID);
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -902,7 +901,7 @@ bool GuildBankManager::AddItem(uint32 GuildID, uint8 Area, uint32 ItemID, int32
|
||||
|
||||
if(Slot < 0)
|
||||
{
|
||||
Log(Logs::General, Logs::Error, "No space to add item to the guild bank.");
|
||||
LogError("No space to add item to the guild bank");
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -1391,13 +1390,13 @@ bool GuildApproval::ProcessApproval()
|
||||
{
|
||||
if(owner && owner->GuildID() != 0)
|
||||
{
|
||||
owner->Message(10,"You are already in a guild! Guild request deleted.");
|
||||
owner->Message(Chat::NPCQuestSay,"You are already in a guild! Guild request deleted.");
|
||||
return false;
|
||||
}
|
||||
if(deletion_timer->Check() || !owner)
|
||||
{
|
||||
if(owner)
|
||||
owner->Message(0,"You took too long! Your guild request has been deleted.");
|
||||
owner->Message(Chat::White,"You took too long! Your guild request has been deleted.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1414,7 +1413,7 @@ GuildApproval::GuildApproval(const char* guildname, Client* owner,uint32 id)
|
||||
this->owner = owner;
|
||||
this->refid = id;
|
||||
if(owner)
|
||||
owner->Message(0,"You can now start getting your guild approved, tell your %i members to #guildapprove %i, you have 30 minutes to create your guild.",tmp,GetID());
|
||||
owner->Message(Chat::White,"You can now start getting your guild approved, tell your %i members to #guildapprove %i, you have 30 minutes to create your guild.",tmp,GetID());
|
||||
for(int i=0;i<tmp;i++)
|
||||
members[i] = 0;
|
||||
}
|
||||
@@ -1463,7 +1462,7 @@ void GuildApproval::ApprovedMembers(Client* requestee)
|
||||
for(int i=0;i<tmp;i++)
|
||||
{
|
||||
if(members[i])
|
||||
requestee->Message(0,"%i: %s",i,members[i]->GetName());
|
||||
requestee->Message(Chat::White,"%i: %s",i,members[i]->GetName());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1484,8 +1483,8 @@ void GuildApproval::GuildApproved()
|
||||
{
|
||||
if(members[i])
|
||||
{
|
||||
owner->Message(0, "%s",members[i]->GetName());
|
||||
owner->Message(0, "%i",members[i]->CharacterID());
|
||||
owner->Message(Chat::White, "%s",members[i]->GetName());
|
||||
owner->Message(Chat::White, "%i",members[i]->CharacterID());
|
||||
guild_mgr.SetGuild(members[i]->CharacterID(),tmpeq,0);
|
||||
size_t len = MBUFFER - strlen(gmembers)+1;
|
||||
strncat(gmembers," ",len);
|
||||
@@ -1521,7 +1520,7 @@ void GuildApproval::GuildApproved()
|
||||
memcpy(pack->pBuffer, &tmpeq, 4);
|
||||
worldserver.SendPacket(pack);
|
||||
safe_delete(pack);
|
||||
owner->Message(0, "Your guild was created.");
|
||||
owner->Message(Chat::White, "Your guild was created.");
|
||||
owner = 0;
|
||||
}
|
||||
|
||||
+1
-1
@@ -608,7 +608,7 @@ void HateList::PrintHateListToClient(Client *c)
|
||||
while (iterator != list.end())
|
||||
{
|
||||
struct_HateList *e = (*iterator);
|
||||
c->Message(0, "- name: %s, damage: %d, hate: %d",
|
||||
c->Message(Chat::White, "- name: %s, damage: %d, hate: %d",
|
||||
(e->entity_on_hatelist && e->entity_on_hatelist->GetName()) ? e->entity_on_hatelist->GetName() : "(null)",
|
||||
e->hatelist_damage, e->stored_hate_amount);
|
||||
|
||||
|
||||
+26
-26
@@ -170,7 +170,7 @@ bool HealRotation::ClearMemberPool()
|
||||
m_active_heal_target = false;
|
||||
|
||||
if (!ClearTargetPool())
|
||||
Log(Logs::General, Logs::Error, "HealRotation::ClearTargetPool() failed to clear m_target_pool (size: %u)", m_target_pool.size());
|
||||
LogError("HealRotation::ClearTargetPool() failed to clear m_target_pool (size: [{}])", m_target_pool.size());
|
||||
|
||||
auto clear_list = const_cast<const std::list<Bot*>&>(m_member_pool);
|
||||
for (auto member_iter : clear_list)
|
||||
@@ -871,42 +871,42 @@ void HealRotation::bias_targets()
|
||||
m_casting_target_poke = true;
|
||||
|
||||
#if (EQDEBUG >= 12)
|
||||
Log(Logs::General, Logs::Error, "HealRotation::bias_targets() - *** Post-processing state ***");
|
||||
Log(Logs::General, Logs::Error, "HealRotation Settings:");
|
||||
Log(Logs::General, Logs::Error, "HealRotation::m_interval_ms = %u", m_interval_ms);
|
||||
Log(Logs::General, Logs::Error, "HealRotation::m_next_cast_time_ms = %u (current_time: %u, time_diff: %i)", m_next_cast_time_ms, Timer::GetCurrentTime(), ((int32)Timer::GetCurrentTime() - (int32)m_next_cast_time_ms));
|
||||
Log(Logs::General, Logs::Error, "HealRotation::m_next_poke_time_ms = %u (current_time: %u, time_diff: %i)", m_next_poke_time_ms, Timer::GetCurrentTime(), ((int32)Timer::GetCurrentTime() - (int32)m_next_poke_time_ms));
|
||||
Log(Logs::General, Logs::Error, "HealRotation::m_fast_heals = %s", ((m_fast_heals) ? ("true") : ("false")));
|
||||
Log(Logs::General, Logs::Error, "HealRotation::m_adaptive_targeting = %s", ((m_adaptive_targeting) ? ("true") : ("false")));
|
||||
Log(Logs::General, Logs::Error, "HealRotation::m_casting_override = %s", ((m_casting_override) ? ("true") : ("false")));
|
||||
Log(Logs::General, Logs::Error, "HealRotation::m_casting_target_poke = %s", ((m_casting_target_poke) ? ("true") : ("false")));
|
||||
Log(Logs::General, Logs::Error, "HealRotation::m_active_heal_target = %s", ((m_active_heal_target) ? ("true") : ("false")));
|
||||
Log(Logs::General, Logs::Error, "HealRotation::m_is_active = %s", ((m_is_active) ? ("true") : ("false")));
|
||||
Log(Logs::General, Logs::Error, "HealRotation::m_member_list.size() = %i", m_member_pool.size());
|
||||
Log(Logs::General, Logs::Error, "HealRotation::m_cycle_list.size() = %i", m_cycle_pool.size());
|
||||
Log(Logs::General, Logs::Error, "HealRotation::m_target_list.size() = %i", m_target_pool.size());
|
||||
if (m_member_pool.size()) { Log(Logs::General, Logs::Error, "(std::shared_ptr<HealRotation>::use_count() = %i", m_member_pool.front()->MemberOfHealRotation()->use_count()); }
|
||||
else { Log(Logs::General, Logs::Error, "(std::shared_ptr<HealRotation>::use_count() = unknown (0)"); }
|
||||
Log(Logs::General, Logs::Error, "HealRotation Members:");
|
||||
LogError("HealRotation::bias_targets() - *** Post-processing state ***");
|
||||
LogError("HealRotation Settings:");
|
||||
LogError("HealRotation::m_interval_ms = [{}]", m_interval_ms);
|
||||
LogError("HealRotation::m_next_cast_time_ms = [{}] (current_time: [{}], time_diff: [{}])", m_next_cast_time_ms, Timer::GetCurrentTime(), ((int32)Timer::GetCurrentTime() - (int32)m_next_cast_time_ms));
|
||||
LogError("HealRotation::m_next_poke_time_ms = [{}] (current_time: [{}], time_diff: [{}])", m_next_poke_time_ms, Timer::GetCurrentTime(), ((int32)Timer::GetCurrentTime() - (int32)m_next_poke_time_ms));
|
||||
LogError("HealRotation::m_fast_heals = [{}]", ((m_fast_heals) ? ("true") : ("false")));
|
||||
LogError("HealRotation::m_adaptive_targeting = [{}]", ((m_adaptive_targeting) ? ("true") : ("false")));
|
||||
LogError("HealRotation::m_casting_override = [{}]", ((m_casting_override) ? ("true") : ("false")));
|
||||
LogError("HealRotation::m_casting_target_poke = [{}]", ((m_casting_target_poke) ? ("true") : ("false")));
|
||||
LogError("HealRotation::m_active_heal_target = [{}]", ((m_active_heal_target) ? ("true") : ("false")));
|
||||
LogError("HealRotation::m_is_active = [{}]", ((m_is_active) ? ("true") : ("false")));
|
||||
LogError("HealRotation::m_member_list.size() = [{}]", m_member_pool.size());
|
||||
LogError("HealRotation::m_cycle_list.size() = [{}]", m_cycle_pool.size());
|
||||
LogError("HealRotation::m_target_list.size() = [{}]", m_target_pool.size());
|
||||
if (m_member_pool.size()) { LogError("(std::shared_ptr<HealRotation>::use_count() = [{}]", m_member_pool.front()->MemberOfHealRotation()->use_count()); }
|
||||
else { LogError("(std::shared_ptr<HealRotation>::use_count() = unknown (0)"); }
|
||||
LogError("HealRotation Members:");
|
||||
int member_index = 0;
|
||||
for (auto mlist_iter : m_member_pool) {
|
||||
if (!mlist_iter) { continue; }
|
||||
Log(Logs::General, Logs::Error, "(%i) %s (hrcast: %c)", (++member_index), mlist_iter->GetCleanName(), ((mlist_iter->AmICastingForHealRotation())?('T'):('F')));
|
||||
LogError("([{}]) [{}] (hrcast: [{}])", (++member_index), mlist_iter->GetCleanName(), ((mlist_iter->AmICastingForHealRotation())?('T'):('F')));
|
||||
}
|
||||
if (!member_index) { Log(Logs::General, Logs::Error, "(0) None"); }
|
||||
Log(Logs::General, Logs::Error, "HealRotation Cycle:");
|
||||
if (!member_index) { LogError("(0) None"); }
|
||||
LogError("HealRotation Cycle:");
|
||||
int cycle_index = 0;
|
||||
for (auto clist_iter : m_cycle_pool) {
|
||||
if (!clist_iter) { continue; }
|
||||
Log(Logs::General, Logs::Error, "(%i) %s", (++cycle_index), clist_iter->GetCleanName());
|
||||
LogError("([{}]) [{}]", (++cycle_index), clist_iter->GetCleanName());
|
||||
}
|
||||
if (!cycle_index) { Log(Logs::General, Logs::Error, "(0) None"); }
|
||||
Log(Logs::General, Logs::Error, "HealRotation Targets: (sort type: %u)", sort_type);
|
||||
if (!cycle_index) { LogError("(0) None"); }
|
||||
LogError("HealRotation Targets: (sort type: [{}])", sort_type);
|
||||
int target_index = 0;
|
||||
|
||||
for (auto tlist_iter : m_target_pool) {
|
||||
if (!tlist_iter) { continue; }
|
||||
Log(Logs::General, Logs::Error, "(%i) %s (hp: %3.1f%%, at: %u, dontheal: %c, crit(base): %c(%c), safe(base): %c(%c), hcnt(ext): %u(%u), hfreq(ext): %f(%f))",
|
||||
LogError("([{}]) [{}] (hp: [{}], at: [{}], dontheal: [{}], crit(base): [{}]([{}]), safe(base): [{}]([{}]), hcnt(ext): [{}]([{}]), hfreq(ext): [{}]([{}]))",
|
||||
(++target_index), tlist_iter->GetCleanName(),
|
||||
tlist_iter->GetHPRatio(),
|
||||
ClassArmorType(tlist_iter->GetClass()),
|
||||
@@ -920,7 +920,7 @@ void HealRotation::bias_targets()
|
||||
tlist_iter->HealRotationHealFrequency(),
|
||||
tlist_iter->HealRotationExtendedHealFrequency());
|
||||
}
|
||||
if (!target_index) { Log(Logs::General, Logs::Error, "(0) None (hp: 0.0\%, at: 0, dontheal: F, crit(base): F(F), safe(base): F(F), hcnt(ext): 0(0), hfreq(ext): 0.0(0.0))"); }
|
||||
if (!target_index) { LogError("(0) None (hp: 0.0\%, at: 0, dontheal: F, crit(base): F(F), safe(base): F(F), hcnt(ext): 0(0), hfreq(ext): 0.0(0.0))"); }
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -79,8 +79,8 @@ const NPCType *Horse::BuildHorseType(uint16 spell_id) {
|
||||
}
|
||||
|
||||
if (results.RowCount() != 1) {
|
||||
Log(Logs::General, Logs::Error, "No Database entry for mount: %s, check the horses table", fileName);
|
||||
return nullptr;
|
||||
LogError("No Database entry for mount: [{}], check the horses table", fileName);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto row = results.begin();
|
||||
@@ -118,11 +118,11 @@ const NPCType *Horse::BuildHorseType(uint16 spell_id) {
|
||||
|
||||
void Client::SummonHorse(uint16 spell_id) {
|
||||
if (GetHorseId() != 0) {
|
||||
Message(13,"You already have a Horse. Get off, Fatbutt!");
|
||||
Message(Chat::Red,"You already have a Horse. Get off, Fatbutt!");
|
||||
return;
|
||||
}
|
||||
if(!Horse::IsHorseSpell(spell_id)) {
|
||||
Log(Logs::General, Logs::Error, "%s tried to summon an unknown horse, spell id %d", GetName(), spell_id);
|
||||
LogError("[{}] tried to summon an unknown horse, spell id [{}]", GetName(), spell_id);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+151
-153
@@ -98,7 +98,7 @@ uint32 Client::NukeItem(uint32 itemnum, uint8 where_to_check) {
|
||||
x++;
|
||||
}
|
||||
|
||||
DeleteItemInInventory(i, 0, ((((uint64)1 << (EQEmu::invslot::GENERAL_BEGIN + ((i - EQEmu::invbag::GENERAL_BAGS_BEGIN) / EQEmu::invbag::SLOT_COUNT))) & GetInv().GetLookup()->PossessionsBitmask) == 0));
|
||||
DeleteItemInInventory(i, 0, ((((uint64)1 << (EQEmu::invslot::GENERAL_BEGIN + ((i - EQEmu::invbag::GENERAL_BAGS_BEGIN) / EQEmu::invbag::SLOT_COUNT))) & GetInv().GetLookup()->PossessionsBitmask) != 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -185,8 +185,8 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
|
||||
|
||||
// make sure the item exists
|
||||
if(item == nullptr) {
|
||||
Message(13, "Item %u does not exist.", item_id);
|
||||
Log(Logs::Detail, Logs::Inventory, "Player %s on account %s attempted to create an item with an invalid id.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n",
|
||||
Message(Chat::Red, "Item %u does not exist.", item_id);
|
||||
LogInventory("Player [{}] on account [{}] attempted to create an item with an invalid id.\n(Item: [{}], Aug1: [{}], Aug2: [{}], Aug3: [{}], Aug4: [{}], Aug5: [{}], Aug6: [{}])\n",
|
||||
GetName(), account_name, item_id, aug1, aug2, aug3, aug4, aug5, aug6);
|
||||
|
||||
return false;
|
||||
@@ -194,14 +194,14 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
|
||||
// check that there is not a lore conflict between base item and existing inventory
|
||||
else if(CheckLoreConflict(item)) {
|
||||
// DuplicateLoreMessage(item_id);
|
||||
Message(13, "You already have a lore %s (%i) in your inventory.", item->Name, item_id);
|
||||
Message(Chat::Red, "You already have a lore %s (%i) in your inventory.", item->Name, item_id);
|
||||
|
||||
return false;
|
||||
}
|
||||
// check to make sure we are augmenting an augmentable item
|
||||
else if (((!item->IsClassCommon()) || (item->AugType > 0)) && (aug1 | aug2 | aug3 | aug4 | aug5 | aug6)) {
|
||||
Message(13, "You can not augment an augment or a non-common class item.");
|
||||
Log(Logs::Detail, Logs::Inventory, "Player %s on account %s attempted to augment an augment or a non-common class item.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug5: %u)\n",
|
||||
Message(Chat::Red, "You can not augment an augment or a non-common class item.");
|
||||
LogInventory("Player [{}] on account [{}] attempted to augment an augment or a non-common class item.\n(Item: [{}], Aug1: [{}], Aug2: [{}], Aug3: [{}], Aug4: [{}], Aug5: [{}], Aug5: [{}])\n",
|
||||
GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5, aug6);
|
||||
|
||||
return false;
|
||||
@@ -214,8 +214,8 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
|
||||
// check to make sure we are a GM if the item is GM-only
|
||||
/*
|
||||
else if(item->MinStatus && ((this->Admin() < item->MinStatus) || (this->Admin() < RuleI(GM, MinStatusToSummonItem)))) {
|
||||
Message(13, "You are not a GM or do not have the status to summon this item.");
|
||||
Log(Logs::Detail, Logs::Inventory, "Player %s on account %s attempted to create a GM-only item with a status of %i.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u, MinStatus: %u)\n",
|
||||
Message(Chat::Red, "You are not a GM or do not have the status to summon this item.");
|
||||
LogInventory("Player [{}] on account [{}] attempted to create a GM-only item with a status of [{}].\n(Item: [{}], Aug1: [{}], Aug2: [{}], Aug3: [{}], Aug4: [{}], Aug5: [{}], Aug6: [{}], MinStatus: [{}])\n",
|
||||
GetName(), account_name, this->Admin(), item->ID, aug1, aug2, aug3, aug4, aug5, aug6, item->MinStatus);
|
||||
|
||||
return false;
|
||||
@@ -237,8 +237,8 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
|
||||
|
||||
if(augtest == nullptr) {
|
||||
if(augments[iter]) {
|
||||
Message(13, "Augment %u (Aug%i) does not exist.", augments[iter], iter + 1);
|
||||
Log(Logs::Detail, Logs::Inventory, "Player %s on account %s attempted to create an augment (Aug%i) with an invalid id.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n",
|
||||
Message(Chat::Red, "Augment %u (Aug%i) does not exist.", augments[iter], iter + 1);
|
||||
LogInventory("Player [{}] on account [{}] attempted to create an augment (Aug[{}]) with an invalid id.\n(Item: [{}], Aug1: [{}], Aug2: [{}], Aug3: [{}], Aug4: [{}], Aug5: [{}], Aug6: [{}])\n",
|
||||
GetName(), account_name, (iter + 1), item->ID, aug1, aug2, aug3, aug4, aug5, aug6);
|
||||
|
||||
return false;
|
||||
@@ -248,14 +248,14 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
|
||||
// check that there is not a lore conflict between augment and existing inventory
|
||||
if(CheckLoreConflict(augtest)) {
|
||||
// DuplicateLoreMessage(augtest->ID);
|
||||
Message(13, "You already have a lore %s (%u) in your inventory.", augtest->Name, augtest->ID);
|
||||
Message(Chat::Red, "You already have a lore %s (%u) in your inventory.", augtest->Name, augtest->ID);
|
||||
|
||||
return false;
|
||||
}
|
||||
// check that augment is an actual augment
|
||||
else if(augtest->AugType == 0) {
|
||||
Message(13, "%s (%u) (Aug%i) is not an actual augment.", augtest->Name, augtest->ID, iter + 1);
|
||||
Log(Logs::Detail, Logs::Inventory, "Player %s on account %s attempted to use a non-augment item (Aug%i) as an augment.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n",
|
||||
Message(Chat::Red, "%s (%u) (Aug%i) is not an actual augment.", augtest->Name, augtest->ID, iter + 1);
|
||||
LogInventory("Player [{}] on account [{}] attempted to use a non-augment item (Aug[{}]) as an augment.\n(Item: [{}], Aug1: [{}], Aug2: [{}], Aug3: [{}], Aug4: [{}], Aug5: [{}], Aug6: [{}])\n",
|
||||
GetName(), account_name, item->ID, (iter + 1), aug1, aug2, aug3, aug4, aug5, aug6);
|
||||
|
||||
return false;
|
||||
@@ -266,8 +266,8 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
|
||||
// check to make sure we are a GM if the augment is GM-only
|
||||
/*
|
||||
else if(augtest->MinStatus && ((this->Admin() < augtest->MinStatus) || (this->Admin() < RuleI(GM, MinStatusToSummonItem)))) {
|
||||
Message(13, "You are not a GM or do not have the status to summon this augment.");
|
||||
Log(Logs::Detail, Logs::Inventory, "Player %s on account %s attempted to create a GM-only augment (Aug%i) with a status of %i.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, MinStatus: %u)\n",
|
||||
Message(Chat::Red, "You are not a GM or do not have the status to summon this augment.");
|
||||
LogInventory("Player [{}] on account [{}] attempted to create a GM-only augment (Aug[{}]) with a status of [{}].\n(Item: [{}], Aug1: [{}], Aug2: [{}], Aug3: [{}], Aug4: [{}], Aug5: [{}], MinStatus: [{}])\n",
|
||||
GetName(), account_name, (iter + 1), this->Admin(), item->ID, aug1, aug2, aug3, aug4, aug5, aug6, item->MinStatus);
|
||||
|
||||
return false;
|
||||
@@ -277,16 +277,16 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
|
||||
// check for augment type allowance
|
||||
if(enforcewear) {
|
||||
if ((item->AugSlotType[iter] == EQEmu::item::AugTypeNone) || !(((uint32)1 << (item->AugSlotType[iter] - 1)) & augtest->AugType)) {
|
||||
Message(13, "Augment %u (Aug%i) is not acceptable wear on Item %u.", augments[iter], iter + 1, item->ID);
|
||||
Log(Logs::Detail, Logs::Inventory, "Player %s on account %s attempted to augment an item with an unacceptable augment type (Aug%i).\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n",
|
||||
Message(Chat::Red, "Augment %u (Aug%i) is not acceptable wear on Item %u.", augments[iter], iter + 1, item->ID);
|
||||
LogInventory("Player [{}] on account [{}] attempted to augment an item with an unacceptable augment type (Aug[{}]).\n(Item: [{}], Aug1: [{}], Aug2: [{}], Aug3: [{}], Aug4: [{}], Aug5: [{}], Aug6: [{}])\n",
|
||||
GetName(), account_name, (iter + 1), item->ID, aug1, aug2, aug3, aug4, aug5, aug6);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if(item->AugSlotVisible[iter] == 0) {
|
||||
Message(13, "Item %u has not evolved enough to accept Augment %u (Aug%i).", item->ID, augments[iter], iter + 1);
|
||||
Log(Logs::Detail, Logs::Inventory, "Player %s on account %s attempted to augment an unevolved item with augment type (Aug%i).\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n",
|
||||
Message(Chat::Red, "Item %u has not evolved enough to accept Augment %u (Aug%i).", item->ID, augments[iter], iter + 1);
|
||||
LogInventory("Player [{}] on account [{}] attempted to augment an unevolved item with augment type (Aug[{}]).\n(Item: [{}], Aug1: [{}], Aug2: [{}], Aug3: [{}], Aug4: [{}], Aug5: [{}], Aug6: [{}])\n",
|
||||
GetName(), account_name, (iter + 1), item->ID, aug1, aug2, aug3, aug4, aug5, aug6);
|
||||
|
||||
return false;
|
||||
@@ -462,8 +462,8 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
|
||||
}
|
||||
|
||||
if(restrictfail) {
|
||||
Message(13, "Augment %u (Aug%i) is restricted from wear on Item %u.", augments[iter], (iter + 1), item->ID);
|
||||
Log(Logs::Detail, Logs::Inventory, "Player %s on account %s attempted to augment an item with a restricted augment (Aug%i).\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n",
|
||||
Message(Chat::Red, "Augment %u (Aug%i) is restricted from wear on Item %u.", augments[iter], (iter + 1), item->ID);
|
||||
LogInventory("Player [{}] on account [{}] attempted to augment an item with a restricted augment (Aug[{}]).\n(Item: [{}], Aug1: [{}], Aug2: [{}], Aug3: [{}], Aug4: [{}], Aug5: [{}], Aug6: [{}])\n",
|
||||
GetName(), account_name, (iter + 1), item->ID, aug1, aug2, aug3, aug4, aug5, aug6);
|
||||
|
||||
return false;
|
||||
@@ -473,8 +473,8 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
|
||||
if(enforceusable) {
|
||||
// check for class usability
|
||||
if(item->Classes && !(classes &= augtest->Classes)) {
|
||||
Message(13, "Augment %u (Aug%i) will result in an item not usable by any class.", augments[iter], (iter + 1));
|
||||
Log(Logs::Detail, Logs::Inventory, "Player %s on account %s attempted to create an item unusable by any class.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n",
|
||||
Message(Chat::Red, "Augment %u (Aug%i) will result in an item not usable by any class.", augments[iter], (iter + 1));
|
||||
LogInventory("Player [{}] on account [{}] attempted to create an item unusable by any class.\n(Item: [{}], Aug1: [{}], Aug2: [{}], Aug3: [{}], Aug4: [{}], Aug5: [{}], Aug6: [{}])\n",
|
||||
GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5, aug6);
|
||||
|
||||
return false;
|
||||
@@ -482,8 +482,8 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
|
||||
|
||||
// check for race usability
|
||||
if(item->Races && !(races &= augtest->Races)) {
|
||||
Message(13, "Augment %u (Aug%i) will result in an item not usable by any race.", augments[iter], (iter + 1));
|
||||
Log(Logs::Detail, Logs::Inventory, "Player %s on account %s attempted to create an item unusable by any race.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n",
|
||||
Message(Chat::Red, "Augment %u (Aug%i) will result in an item not usable by any race.", augments[iter], (iter + 1));
|
||||
LogInventory("Player [{}] on account [{}] attempted to create an item unusable by any race.\n(Item: [{}], Aug1: [{}], Aug2: [{}], Aug3: [{}], Aug4: [{}], Aug5: [{}], Aug6: [{}])\n",
|
||||
GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5, aug6);
|
||||
|
||||
return false;
|
||||
@@ -491,8 +491,8 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
|
||||
|
||||
// check for slot usability
|
||||
if(item->Slots && !(slots &= augtest->Slots)) {
|
||||
Message(13, "Augment %u (Aug%i) will result in an item not usable in any slot.", augments[iter], (iter + 1));
|
||||
Log(Logs::Detail, Logs::Inventory, "Player %s on account %s attempted to create an item unusable in any slot.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n",
|
||||
Message(Chat::Red, "Augment %u (Aug%i) will result in an item not usable in any slot.", augments[iter], (iter + 1));
|
||||
LogInventory("Player [{}] on account [{}] attempted to create an item unusable in any slot.\n(Item: [{}], Aug1: [{}], Aug2: [{}], Aug3: [{}], Aug4: [{}], Aug5: [{}], Aug6: [{}])\n",
|
||||
GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5, aug6);
|
||||
|
||||
return false;
|
||||
@@ -517,9 +517,9 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
|
||||
EQEmu::ItemInstance* inst = database.CreateItem(item, charges);
|
||||
|
||||
if(inst == nullptr) {
|
||||
Message(13, "An unknown server error has occurred and your item was not created.");
|
||||
Message(Chat::Red, "An unknown server error has occurred and your item was not created.");
|
||||
// this goes to logfile since this is a major error
|
||||
Log(Logs::General, Logs::Error, "Player %s on account %s encountered an unknown item creation error.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n",
|
||||
LogError("Player [{}] on account [{}] encountered an unknown item creation error.\n(Item: [{}], Aug1: [{}], Aug2: [{}], Aug3: [{}], Aug4: [{}], Aug5: [{}], Aug6: [{}])\n",
|
||||
GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5, aug6);
|
||||
|
||||
return false;
|
||||
@@ -545,7 +545,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
|
||||
|
||||
if(!(slots & ((uint32)1 << slottest))) {
|
||||
Message(0, "This item is not equipable at slot %u - moving to cursor.", to_slot);
|
||||
Log(Logs::Detail, Logs::Inventory, "Player %s on account %s attempted to equip an item unusable in slot %u - moved to cursor.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n",
|
||||
LogInventory("Player [{}] on account [{}] attempted to equip an item unusable in slot [{}] - moved to cursor.\n(Item: [{}], Aug1: [{}], Aug2: [{}], Aug3: [{}], Aug4: [{}], Aug5: [{}], Aug6: [{}])\n",
|
||||
GetName(), account_name, to_slot, item->ID, aug1, aug2, aug3, aug4, aug5, aug6);
|
||||
|
||||
to_slot = EQEmu::invslot::slotCursor;
|
||||
@@ -582,7 +582,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
|
||||
// Drop item from inventory to ground (generally only dropped from SLOT_CURSOR)
|
||||
void Client::DropItem(int16 slot_id, bool recurse)
|
||||
{
|
||||
Log(Logs::General, Logs::Inventory, "'%s' (char_id: %u) Attempting to drop item from slot %i on the ground",
|
||||
LogInventory("[{}] (char_id: [{}]) Attempting to drop item from slot [{}] on the ground",
|
||||
GetCleanName(), CharacterID(), slot_id);
|
||||
|
||||
if(GetInv().CheckNoDrop(slot_id, recurse) && RuleI(World, FVNoDropFlag) == 0 ||
|
||||
@@ -590,20 +590,20 @@ void Client::DropItem(int16 slot_id, bool recurse)
|
||||
{
|
||||
auto invalid_drop = m_inv.GetItem(slot_id);
|
||||
if (!invalid_drop) {
|
||||
Log(Logs::General, Logs::Inventory, "Error in InventoryProfile::CheckNoDrop() - returned 'true' for empty slot");
|
||||
LogInventory("Error in InventoryProfile::CheckNoDrop() - returned 'true' for empty slot");
|
||||
}
|
||||
else {
|
||||
if (LogSys.log_settings[Logs::Inventory].is_category_enabled) {
|
||||
Log(Logs::General, Logs::Inventory, "DropItem() Hack detected - full item parse:");
|
||||
Log(Logs::General, Logs::Inventory, "depth: 0, Item: '%s' (id: %u), IsDroppable: %s",
|
||||
LogInventory("DropItem() Hack detected - full item parse:");
|
||||
LogInventory("depth: 0, Item: [{}] (id: [{}]), IsDroppable: [{}]",
|
||||
(invalid_drop->GetItem() ? invalid_drop->GetItem()->Name : "null data"), invalid_drop->GetID(), (invalid_drop->IsDroppable(false) ? "true" : "false"));
|
||||
|
||||
for (auto iter1 : *invalid_drop->GetContents()) { // depth 1
|
||||
Log(Logs::General, Logs::Inventory, "-depth: 1, Item: '%s' (id: %u), IsDroppable: %s",
|
||||
LogInventory("-depth: 1, Item: [{}] (id: [{}]), IsDroppable: [{}]",
|
||||
(iter1.second->GetItem() ? iter1.second->GetItem()->Name : "null data"), iter1.second->GetID(), (iter1.second->IsDroppable(false) ? "true" : "false"));
|
||||
|
||||
for (auto iter2 : *iter1.second->GetContents()) { // depth 2
|
||||
Log(Logs::General, Logs::Inventory, "--depth: 2, Item: '%s' (id: %u), IsDroppable: %s",
|
||||
LogInventory("--depth: 2, Item: [{}] (id: [{}]), IsDroppable: [{}]",
|
||||
(iter2.second->GetItem() ? iter2.second->GetItem()->Name : "null data"), iter2.second->GetID(), (iter2.second->IsDroppable(false) ? "true" : "false"));
|
||||
}
|
||||
}
|
||||
@@ -620,39 +620,39 @@ void Client::DropItem(int16 slot_id, bool recurse)
|
||||
EQEmu::ItemInstance *inst = m_inv.PopItem(slot_id);
|
||||
if(inst) {
|
||||
if (LogSys.log_settings[Logs::Inventory].is_category_enabled) {
|
||||
Log(Logs::General, Logs::Inventory, "DropItem() Processing - full item parse:");
|
||||
Log(Logs::General, Logs::Inventory, "depth: 0, Item: '%s' (id: %u), IsDroppable: %s",
|
||||
LogInventory("DropItem() Processing - full item parse:");
|
||||
LogInventory("depth: 0, Item: [{}] (id: [{}]), IsDroppable: [{}]",
|
||||
(inst->GetItem() ? inst->GetItem()->Name : "null data"), inst->GetID(), (inst->IsDroppable(false) ? "true" : "false"));
|
||||
|
||||
if (!inst->IsDroppable(false))
|
||||
Log(Logs::General, Logs::Error, "Non-droppable item being processed for drop by '%s'", GetCleanName());
|
||||
LogError("Non-droppable item being processed for drop by [{}]", GetCleanName());
|
||||
|
||||
for (auto iter1 : *inst->GetContents()) { // depth 1
|
||||
Log(Logs::General, Logs::Inventory, "-depth: 1, Item: '%s' (id: %u), IsDroppable: %s",
|
||||
LogInventory("-depth: 1, Item: [{}] (id: [{}]), IsDroppable: [{}]",
|
||||
(iter1.second->GetItem() ? iter1.second->GetItem()->Name : "null data"), iter1.second->GetID(), (iter1.second->IsDroppable(false) ? "true" : "false"));
|
||||
|
||||
if (!iter1.second->IsDroppable(false))
|
||||
Log(Logs::General, Logs::Error, "Non-droppable item being processed for drop by '%s'", GetCleanName());
|
||||
LogError("Non-droppable item being processed for drop by [{}]", GetCleanName());
|
||||
|
||||
for (auto iter2 : *iter1.second->GetContents()) { // depth 2
|
||||
Log(Logs::General, Logs::Inventory, "--depth: 2, Item: '%s' (id: %u), IsDroppable: %s",
|
||||
LogInventory("--depth: 2, Item: [{}] (id: [{}]), IsDroppable: [{}]",
|
||||
(iter2.second->GetItem() ? iter2.second->GetItem()->Name : "null data"), iter2.second->GetID(), (iter2.second->IsDroppable(false) ? "true" : "false"));
|
||||
|
||||
if (!iter2.second->IsDroppable(false))
|
||||
Log(Logs::General, Logs::Error, "Non-droppable item being processed for drop by '%s'", GetCleanName());
|
||||
LogError("Non-droppable item being processed for drop by [{}]", GetCleanName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int i = parse->EventItem(EVENT_DROP_ITEM, this, inst, nullptr, "", slot_id);
|
||||
if(i != 0) {
|
||||
Log(Logs::General, Logs::Inventory, "Item drop handled by [EVENT_DROP_ITEM]");
|
||||
LogInventory("Item drop handled by [EVENT_DROP_ITEM]");
|
||||
safe_delete(inst);
|
||||
}
|
||||
} else {
|
||||
// Item doesn't exist in inventory!
|
||||
Log(Logs::General, Logs::Inventory, "DropItem() - No item found in slot %i", slot_id);
|
||||
Message(13, "Error: Item not found in slot %i", slot_id);
|
||||
LogInventory("DropItem() - No item found in slot [{}]", slot_id);
|
||||
Message(Chat::Red, "Error: Item not found in slot %i", slot_id);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -673,7 +673,7 @@ void Client::DropItem(int16 slot_id, bool recurse)
|
||||
entity_list.AddObject(object, true);
|
||||
object->StartDecay();
|
||||
|
||||
Log(Logs::General, Logs::Inventory, "Item drop handled ut assolet");
|
||||
LogInventory("Item drop handled ut assolet");
|
||||
DropItemQS(inst, false);
|
||||
|
||||
safe_delete(inst);
|
||||
@@ -752,14 +752,14 @@ void Client::DropInst(const EQEmu::ItemInstance* inst)
|
||||
{
|
||||
if (!inst) {
|
||||
// Item doesn't exist in inventory!
|
||||
Message(13, "Error: Item not found");
|
||||
Message(Chat::Red, "Error: Item not found");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (inst->GetItem()->NoDrop == 0)
|
||||
{
|
||||
Message(13, "This item is NODROP. Deleting.");
|
||||
Message(Chat::Red, "This item is NODROP. Deleting.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -851,9 +851,9 @@ void Client::SendCursorBuffer()
|
||||
}
|
||||
|
||||
if (!lore_pass) {
|
||||
Log(Logs::General, Logs::Inventory, "(%s) Duplicate lore items are not allowed - destroying item %s(id:%u) on cursor",
|
||||
LogInventory("([{}]) Duplicate lore items are not allowed - destroying item [{}](id:[{}]) on cursor",
|
||||
GetName(), test_item->Name, test_item->ID);
|
||||
Message_StringID(MT_LootMessages, 290);
|
||||
MessageString(Chat::Loot, 290);
|
||||
parse->EventItem(EVENT_DESTROY_ITEM, this, test_inst, nullptr, "", 0);
|
||||
DeleteItemInInventory(EQEmu::invslot::slotCursor);
|
||||
SendCursorBuffer();
|
||||
@@ -866,7 +866,7 @@ void Client::SendCursorBuffer()
|
||||
// Remove item from inventory
|
||||
void Client::DeleteItemInInventory(int16 slot_id, int8 quantity, bool client_update, bool update_db) {
|
||||
#if (EQDEBUG >= 5)
|
||||
Log(Logs::General, Logs::None, "DeleteItemInInventory(%i, %i, %s)", slot_id, quantity, (client_update) ? "true":"false");
|
||||
LogDebug("DeleteItemInInventory([{}], [{}], [{}])", slot_id, quantity, (client_update) ? "true":"false");
|
||||
#endif
|
||||
|
||||
// Added 'IsSlotValid(slot_id)' check to both segments of client packet processing.
|
||||
@@ -986,7 +986,7 @@ void Client::DeleteItemInInventory(int16 slot_id, int8 quantity, bool client_upd
|
||||
|
||||
bool Client::PushItemOnCursor(const EQEmu::ItemInstance& inst, bool client_update)
|
||||
{
|
||||
Log(Logs::Detail, Logs::Inventory, "Putting item %s (%d) on the cursor", inst.GetItem()->Name, inst.GetItem()->ID);
|
||||
LogInventory("Putting item [{}] ([{}]) on the cursor", inst.GetItem()->Name, inst.GetItem()->ID);
|
||||
m_inv.PushCursor(inst);
|
||||
|
||||
if (client_update) {
|
||||
@@ -1002,7 +1002,7 @@ bool Client::PushItemOnCursor(const EQEmu::ItemInstance& inst, bool client_updat
|
||||
// (Also saves changes back to the database: this may be optimized in the future)
|
||||
// client_update: Sends packet to client
|
||||
bool Client::PutItemInInventory(int16 slot_id, const EQEmu::ItemInstance& inst, bool client_update) {
|
||||
Log(Logs::Detail, Logs::Inventory, "Putting item %s (%d) into slot %d", inst.GetItem()->Name, inst.GetItem()->ID, slot_id);
|
||||
LogInventory("Putting item [{}] ([{}]) into slot [{}]", inst.GetItem()->Name, inst.GetItem()->ID, slot_id);
|
||||
|
||||
if (slot_id == EQEmu::invslot::slotCursor) { // don't trust macros before conditional statements...
|
||||
return PushItemOnCursor(inst, client_update);
|
||||
@@ -1031,7 +1031,7 @@ bool Client::PutItemInInventory(int16 slot_id, const EQEmu::ItemInstance& inst,
|
||||
|
||||
void Client::PutLootInInventory(int16 slot_id, const EQEmu::ItemInstance &inst, ServerLootItem_Struct** bag_item_data)
|
||||
{
|
||||
Log(Logs::Detail, Logs::Inventory, "Putting loot item %s (%d) into slot %d", inst.GetItem()->Name, inst.GetItem()->ID, slot_id);
|
||||
LogInventory("Putting loot item [{}] ([{}]) into slot [{}]", inst.GetItem()->Name, inst.GetItem()->ID, slot_id);
|
||||
|
||||
bool cursor_empty = m_inv.CursorEmpty();
|
||||
|
||||
@@ -1075,8 +1075,7 @@ void Client::PutLootInInventory(int16 slot_id, const EQEmu::ItemInstance &inst,
|
||||
// Dump bag contents to cursor in the event that owning bag is not the first cursor item
|
||||
// (This assumes that the data passed is correctly associated..no safety checks are implemented)
|
||||
if (slot_id == EQEmu::invslot::slotCursor && !cursor_empty) {
|
||||
Log(Logs::Detail, Logs::Inventory,
|
||||
"Putting bag loot item %s (%d) into slot %d (non-empty cursor override)",
|
||||
LogInventory("Putting bag loot item [{}] ([{}]) into slot [{}] (non-empty cursor override)",
|
||||
inst.GetItem()->Name, inst.GetItem()->ID, EQEmu::invslot::slotCursor);
|
||||
|
||||
PutLootInInventory(EQEmu::invslot::slotCursor, *bagitem);
|
||||
@@ -1084,8 +1083,7 @@ void Client::PutLootInInventory(int16 slot_id, const EQEmu::ItemInstance &inst,
|
||||
else {
|
||||
auto bag_slot = EQEmu::InventoryProfile::CalcSlotId(slot_id, index);
|
||||
|
||||
Log(Logs::Detail, Logs::Inventory,
|
||||
"Putting bag loot item %s (%d) into slot %d (bag slot %d)",
|
||||
LogInventory("Putting bag loot item [{}] ([{}]) into slot [{}] (bag slot [{}])",
|
||||
inst.GetItem()->Name, inst.GetItem()->ID, bag_slot, index);
|
||||
|
||||
PutLootInInventory(bag_slot, *bagitem);
|
||||
@@ -1520,16 +1518,16 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
|
||||
if(!IsValidSlot(src_slot_check)){
|
||||
// SoF+ sends a Unix timestamp (should be int32) for src and dst slots every 10 minutes for some reason.
|
||||
if(src_slot_check < 2147483647)
|
||||
Message(13, "Warning: Invalid slot move from slot %u to slot %u with %u charges!", src_slot_check, dst_slot_check, stack_count_check);
|
||||
Log(Logs::Detail, Logs::Inventory, "Invalid slot move from slot %u to slot %u with %u charges!", src_slot_check, dst_slot_check, stack_count_check);
|
||||
Message(Chat::Red, "Warning: Invalid slot move from slot %u to slot %u with %u charges!", src_slot_check, dst_slot_check, stack_count_check);
|
||||
LogInventory("Invalid slot move from slot [{}] to slot [{}] with [{}] charges!", src_slot_check, dst_slot_check, stack_count_check);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!IsValidSlot(dst_slot_check)) {
|
||||
// SoF+ sends a Unix timestamp (should be int32) for src and dst slots every 10 minutes for some reason.
|
||||
if(src_slot_check < 2147483647)
|
||||
Message(13, "Warning: Invalid slot move from slot %u to slot %u with %u charges!", src_slot_check, dst_slot_check, stack_count_check);
|
||||
Log(Logs::Detail, Logs::Inventory, "Invalid slot move from slot %u to slot %u with %u charges!", src_slot_check, dst_slot_check, stack_count_check);
|
||||
Message(Chat::Red, "Warning: Invalid slot move from slot %u to slot %u with %u charges!", src_slot_check, dst_slot_check, stack_count_check);
|
||||
LogInventory("Invalid slot move from slot [{}] to slot [{}] with [{}] charges!", src_slot_check, dst_slot_check, stack_count_check);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1553,9 +1551,9 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
|
||||
}
|
||||
|
||||
if (!lore_pass) {
|
||||
Log(Logs::General, Logs::Inventory, "(%s) Duplicate lore items are not allowed - destroying item %s(id:%u) on cursor",
|
||||
LogInventory("([{}]) Duplicate lore items are not allowed - destroying item [{}](id:[{}]) on cursor",
|
||||
GetName(), test_item->Name, test_item->ID);
|
||||
Message_StringID(MT_LootMessages, 290);
|
||||
MessageString(Chat::Loot, 290);
|
||||
parse->EventItem(EVENT_DESTROY_ITEM, this, test_inst, nullptr, "", 0);
|
||||
DeleteItemInInventory(EQEmu::invslot::slotCursor, 0, true);
|
||||
}
|
||||
@@ -1565,7 +1563,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
|
||||
|
||||
if (move_in->to_slot == (uint32)INVALID_INDEX) {
|
||||
if (move_in->from_slot == (uint32)EQEmu::invslot::slotCursor) {
|
||||
Log(Logs::Detail, Logs::Inventory, "Client destroyed item from cursor slot %d", move_in->from_slot);
|
||||
LogInventory("Client destroyed item from cursor slot [{}]", move_in->from_slot);
|
||||
if(RuleB(QueryServ, PlayerLogMoves)) { QSSwapItemAuditor(move_in); } // QS Audit
|
||||
|
||||
EQEmu::ItemInstance *inst = m_inv.GetItem(EQEmu::invslot::slotCursor);
|
||||
@@ -1579,7 +1577,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
|
||||
return true; // Item destroyed by client
|
||||
}
|
||||
else {
|
||||
Log(Logs::Detail, Logs::Inventory, "Deleted item from slot %d as a result of an inventory container tradeskill combine.", move_in->from_slot);
|
||||
LogInventory("Deleted item from slot [{}] as a result of an inventory container tradeskill combine", move_in->from_slot);
|
||||
if(RuleB(QueryServ, PlayerLogMoves)) { QSSwapItemAuditor(move_in); } // QS Audit
|
||||
DeleteItemInInventory(move_in->from_slot);
|
||||
return true; // Item deletion
|
||||
@@ -1608,7 +1606,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
|
||||
banker ? banker->GetName() : "UNKNOWN NPC", distance);
|
||||
database.SetMQDetectionFlag(AccountName(), GetName(), hacked_string, zone->GetShortName());
|
||||
safe_delete_array(hacked_string);
|
||||
Kick(); // Kicking player to avoid item loss do to client and server inventories not being sync'd
|
||||
Kick("Inventory desync"); // Kicking player to avoid item loss do to client and server inventories not being sync'd
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1619,17 +1617,17 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
|
||||
EQEmu::ItemInstance* src_inst = m_inv.GetItem(src_slot_id);
|
||||
EQEmu::ItemInstance* dst_inst = m_inv.GetItem(dst_slot_id);
|
||||
if (src_inst){
|
||||
Log(Logs::Detail, Logs::Inventory, "Src slot %d has item %s (%d) with %d charges in it.", src_slot_id, src_inst->GetItem()->Name, src_inst->GetItem()->ID, src_inst->GetCharges());
|
||||
LogInventory("Src slot [{}] has item [{}] ([{}]) with [{}] charges in it", src_slot_id, src_inst->GetItem()->Name, src_inst->GetItem()->ID, src_inst->GetCharges());
|
||||
srcitemid = src_inst->GetItem()->ID;
|
||||
//SetTint(dst_slot_id,src_inst->GetColor());
|
||||
if (src_inst->GetCharges() > 0 && (src_inst->GetCharges() < (int16)move_in->number_in_stack || move_in->number_in_stack > src_inst->GetItem()->StackSize))
|
||||
{
|
||||
Message(13,"Error: Insufficient number in stack.");
|
||||
Message(Chat::Red,"Error: Insufficient number in stack.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (dst_inst) {
|
||||
Log(Logs::Detail, Logs::Inventory, "Dest slot %d has item %s (%d) with %d charges in it.", dst_slot_id, dst_inst->GetItem()->Name, dst_inst->GetItem()->ID, dst_inst->GetCharges());
|
||||
LogInventory("Dest slot [{}] has item [{}] ([{}]) with [{}] charges in it", dst_slot_id, dst_inst->GetItem()->Name, dst_inst->GetItem()->ID, dst_inst->GetCharges());
|
||||
dstitemid = dst_inst->GetItem()->ID;
|
||||
}
|
||||
if (Trader && srcitemid>0){
|
||||
@@ -1650,7 +1648,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
|
||||
}
|
||||
if (srcitemid==17899 || srcbagid==17899 || dstitemid==17899 || dstbagid==17899){
|
||||
this->Trader_EndTrader();
|
||||
this->Message(13,"You cannot move your Trader Satchels, or items inside them, while Trading.");
|
||||
this->Message(Chat::Red,"You cannot move your Trader Satchels, or items inside them, while Trading.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1664,7 +1662,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
|
||||
move_in->from_slot = dst_slot_check;
|
||||
move_in->to_slot = src_slot_check;
|
||||
move_in->number_in_stack = dst_inst->GetCharges();
|
||||
if(!SwapItem(move_in)) { Log(Logs::Detail, Logs::Inventory, "Recursive SwapItem call failed due to non-existent destination item (charid: %i, fromslot: %i, toslot: %i)", CharacterID(), src_slot_id, dst_slot_id); }
|
||||
if(!SwapItem(move_in)) { LogInventory("Recursive SwapItem call failed due to non-existent destination item (charid: [{}], fromslot: [{}], toslot: [{}])", CharacterID(), src_slot_id, dst_slot_id); }
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -1672,7 +1670,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
|
||||
//verify shared bank transactions in the database
|
||||
if (src_inst && src_slot_id >= EQEmu::invslot::SHARED_BANK_BEGIN && src_slot_id <= EQEmu::invbag::SHARED_BANK_BAGS_END) {
|
||||
if(!database.VerifyInventory(account_id, src_slot_id, src_inst)) {
|
||||
Log(Logs::General, Logs::Error, "Player %s on account %s was found exploiting the shared bank.\n", GetName(), account_name);
|
||||
LogError("Player [{}] on account [{}] was found exploiting the shared bank.\n", GetName(), account_name);
|
||||
DeleteItemInInventory(dst_slot_id,0,true);
|
||||
return(false);
|
||||
}
|
||||
@@ -1687,7 +1685,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
|
||||
}
|
||||
if (dst_inst && dst_slot_id >= EQEmu::invslot::SHARED_BANK_BEGIN && dst_slot_id <= EQEmu::invbag::SHARED_BANK_BAGS_END) {
|
||||
if(!database.VerifyInventory(account_id, dst_slot_id, dst_inst)) {
|
||||
Log(Logs::General, Logs::Error, "Player %s on account %s was found exploting the shared bank.\n", GetName(), account_name);
|
||||
LogError("Player [{}] on account [{}] was found exploting the shared bank.\n", GetName(), account_name);
|
||||
DeleteItemInInventory(src_slot_id,0,true);
|
||||
return(false);
|
||||
}
|
||||
@@ -1724,7 +1722,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
|
||||
ndh_item_data.append(StringFormat(", nodrop=%s(%u)", (ndh_item->NoDrop == 0 ? "true" : "false"), ndh_item->NoDrop));
|
||||
}
|
||||
}
|
||||
Log(Logs::General, Logs::Error, "WorldKick() of Player %s(id:%u, acct:%u) due to 'NoDrop Hack' detection >> SlotID:%i, ItemData:'%s'",
|
||||
LogError("WorldKick() of Player [{}](id:[{}], acct:[{}]) due to 'NoDrop Hack' detection >> SlotID:[{}], ItemData:[{}]",
|
||||
GetName(), CharacterID(), AccountID(), src_slot_id, ndh_item_data.c_str());
|
||||
ndh_inst = nullptr;
|
||||
|
||||
@@ -1822,14 +1820,14 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
|
||||
// Step 4: Check for entity trade
|
||||
if (dst_slot_id >= EQEmu::invslot::TRADE_BEGIN && dst_slot_id <= EQEmu::invslot::TRADE_END) {
|
||||
if (src_slot_id != EQEmu::invslot::slotCursor) {
|
||||
Kick();
|
||||
Kick("Trade with non-cursor item");
|
||||
return false;
|
||||
}
|
||||
if (with) {
|
||||
Log(Logs::Detail, Logs::Inventory, "Trade item move from slot %d to slot %d (trade with %s)", src_slot_id, dst_slot_id, with->GetName());
|
||||
LogInventory("Trade item move from slot [{}] to slot [{}] (trade with [{}])", src_slot_id, dst_slot_id, with->GetName());
|
||||
// Fill Trade list with items from cursor
|
||||
if (!m_inv[EQEmu::invslot::slotCursor]) {
|
||||
Message(13, "Error: Cursor item not located on server!");
|
||||
Message(Chat::Red, "Error: Cursor item not located on server!");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1859,18 +1857,18 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
|
||||
if (move_in->number_in_stack > 0) {
|
||||
// Determine if charged items can stack
|
||||
if(src_inst && !src_inst->IsStackable()) {
|
||||
Log(Logs::Detail, Logs::Inventory, "Move from %d to %d with stack size %d. %s is not a stackable item. (charname: %s)", src_slot_id, dst_slot_id, move_in->number_in_stack, src_inst->GetItem()->Name, GetName());
|
||||
LogInventory("Move from [{}] to [{}] with stack size [{}]. [{}] is not a stackable item. (charname: [{}])", src_slot_id, dst_slot_id, move_in->number_in_stack, src_inst->GetItem()->Name, GetName());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (dst_inst) {
|
||||
if(src_inst->GetID() != dst_inst->GetID()) {
|
||||
Log(Logs::Detail, Logs::Inventory, "Move from %d to %d with stack size %d. Incompatible item types: %d != %d", src_slot_id, dst_slot_id, move_in->number_in_stack, src_inst->GetID(), dst_inst->GetID());
|
||||
LogInventory("Move from [{}] to [{}] with stack size [{}]. Incompatible item types: [{}] != [{}]", src_slot_id, dst_slot_id, move_in->number_in_stack, src_inst->GetID(), dst_inst->GetID());
|
||||
return(false);
|
||||
}
|
||||
if(dst_inst->GetCharges() < dst_inst->GetItem()->StackSize) {
|
||||
//we have a chance of stacking.
|
||||
Log(Logs::Detail, Logs::Inventory, "Move from %d to %d with stack size %d. dest has %d/%d charges", src_slot_id, dst_slot_id, move_in->number_in_stack, dst_inst->GetCharges(), dst_inst->GetItem()->StackSize);
|
||||
LogInventory("Move from [{}] to [{}] with stack size [{}]. dest has [{}]/[{}] charges", src_slot_id, dst_slot_id, move_in->number_in_stack, dst_inst->GetCharges(), dst_inst->GetItem()->StackSize);
|
||||
// Charges can be emptied into dst
|
||||
uint16 usedcharges = dst_inst->GetItem()->StackSize - dst_inst->GetCharges();
|
||||
if (usedcharges > move_in->number_in_stack)
|
||||
@@ -1882,15 +1880,15 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
|
||||
// Depleted all charges?
|
||||
if (src_inst->GetCharges() < 1)
|
||||
{
|
||||
Log(Logs::Detail, Logs::Inventory, "Dest (%d) now has %d charges, source (%d) was entirely consumed. (%d moved)", dst_slot_id, dst_inst->GetCharges(), src_slot_id, usedcharges);
|
||||
LogInventory("Dest ([{}]) now has [{}] charges, source ([{}]) was entirely consumed. ([{}] moved)", dst_slot_id, dst_inst->GetCharges(), src_slot_id, usedcharges);
|
||||
database.SaveInventory(CharacterID(),nullptr,src_slot_id);
|
||||
m_inv.DeleteItem(src_slot_id);
|
||||
all_to_stack = true;
|
||||
} else {
|
||||
Log(Logs::Detail, Logs::Inventory, "Dest (%d) now has %d charges, source (%d) has %d (%d moved)", dst_slot_id, dst_inst->GetCharges(), src_slot_id, src_inst->GetCharges(), usedcharges);
|
||||
LogInventory("Dest ([{}]) now has [{}] charges, source ([{}]) has [{}] ([{}] moved)", dst_slot_id, dst_inst->GetCharges(), src_slot_id, src_inst->GetCharges(), usedcharges);
|
||||
}
|
||||
} else {
|
||||
Log(Logs::Detail, Logs::Inventory, "Move from %d to %d with stack size %d. Exceeds dest maximum stack size: %d/%d", src_slot_id, dst_slot_id, move_in->number_in_stack, (src_inst->GetCharges()+dst_inst->GetCharges()), dst_inst->GetItem()->StackSize);
|
||||
LogInventory("Move from [{}] to [{}] with stack size [{}]. Exceeds dest maximum stack size: [{}]/[{}]", src_slot_id, dst_slot_id, move_in->number_in_stack, (src_inst->GetCharges()+dst_inst->GetCharges()), dst_inst->GetItem()->StackSize);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1900,12 +1898,12 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
|
||||
// Move entire stack
|
||||
EQEmu::InventoryProfile::SwapItemFailState fail_state = EQEmu::InventoryProfile::swapInvalid;
|
||||
if (!m_inv.SwapItem(src_slot_id, dst_slot_id, fail_state)) { return false; }
|
||||
Log(Logs::Detail, Logs::Inventory, "Move entire stack from %d to %d with stack size %d. Dest empty.", src_slot_id, dst_slot_id, move_in->number_in_stack);
|
||||
LogInventory("Move entire stack from [{}] to [{}] with stack size [{}]. Dest empty", src_slot_id, dst_slot_id, move_in->number_in_stack);
|
||||
}
|
||||
else {
|
||||
// Split into two
|
||||
src_inst->SetCharges(src_inst->GetCharges() - move_in->number_in_stack);
|
||||
Log(Logs::Detail, Logs::Inventory, "Split stack of %s (%d) from slot %d to %d with stack size %d. Src keeps %d.", src_inst->GetItem()->Name, src_inst->GetItem()->ID, src_slot_id, dst_slot_id, move_in->number_in_stack, src_inst->GetCharges());
|
||||
LogInventory("Split stack of [{}] ([{}]) from slot [{}] to [{}] with stack size [{}]. Src keeps [{}]", src_inst->GetItem()->Name, src_inst->GetItem()->ID, src_slot_id, dst_slot_id, move_in->number_in_stack, src_inst->GetCharges());
|
||||
EQEmu::ItemInstance* inst = database.CreateItem(src_inst->GetItem(), move_in->number_in_stack);
|
||||
m_inv.PutItem(dst_slot_id, *inst);
|
||||
safe_delete(inst);
|
||||
@@ -1939,12 +1937,12 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
|
||||
fail_message = "You are not sufficient level to use this item.";
|
||||
|
||||
if (fail_message)
|
||||
Message(CC_Red, "%s", fail_message);
|
||||
Message(Chat::Red, "%s", fail_message);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Log(Logs::Detail, Logs::Inventory, "Moving entire item from slot %d to slot %d", src_slot_id, dst_slot_id);
|
||||
LogInventory("Moving entire item from slot [{}] to slot [{}]", src_slot_id, dst_slot_id);
|
||||
|
||||
if (src_slot_id <= EQEmu::invslot::EQUIPMENT_END) {
|
||||
if(src_inst) {
|
||||
@@ -2007,8 +2005,8 @@ void Client::SwapItemResync(MoveItem_Struct* move_slots) {
|
||||
|
||||
// resync the 'from' and 'to' slots on an as-needed basis
|
||||
// Not as effective as the full process, but less intrusive to gameplay
|
||||
Log(Logs::Detail, Logs::Inventory, "Inventory desyncronization. (charname: %s, source: %i, destination: %i)", GetName(), move_slots->from_slot, move_slots->to_slot);
|
||||
Message(15, "Inventory Desyncronization detected: Resending slot data...");
|
||||
LogInventory("Inventory desyncronization. (charname: [{}], source: [{}], destination: [{}])", GetName(), move_slots->from_slot, move_slots->to_slot);
|
||||
Message(Chat::Yellow, "Inventory Desyncronization detected: Resending slot data...");
|
||||
|
||||
if (move_slots->from_slot >= EQEmu::invslot::EQUIPMENT_BEGIN && move_slots->from_slot <= EQEmu::invbag::CURSOR_BAG_END) {
|
||||
int16 resync_slot = (EQEmu::InventoryProfile::CalcSlotId(move_slots->from_slot) == INVALID_INDEX) ? move_slots->from_slot : EQEmu::InventoryProfile::CalcSlotId(move_slots->from_slot);
|
||||
@@ -2031,9 +2029,9 @@ void Client::SwapItemResync(MoveItem_Struct* move_slots) {
|
||||
safe_delete(outapp);
|
||||
}
|
||||
safe_delete(token_inst);
|
||||
Message(14, "Source slot %i resyncronized.", move_slots->from_slot);
|
||||
Message(Chat::Lime, "Source slot %i resyncronized.", move_slots->from_slot);
|
||||
}
|
||||
else { Message(13, "Could not resyncronize source slot %i.", move_slots->from_slot); }
|
||||
else { Message(Chat::Red, "Could not resyncronize source slot %i.", move_slots->from_slot); }
|
||||
}
|
||||
else {
|
||||
int16 resync_slot = (EQEmu::InventoryProfile::CalcSlotId(move_slots->from_slot) == INVALID_INDEX) ? move_slots->from_slot : EQEmu::InventoryProfile::CalcSlotId(move_slots->from_slot);
|
||||
@@ -2046,11 +2044,11 @@ void Client::SwapItemResync(MoveItem_Struct* move_slots) {
|
||||
SendItemPacket(resync_slot, m_inv[resync_slot], ItemPacketTrade);
|
||||
|
||||
safe_delete(token_inst);
|
||||
Message(14, "Source slot %i resyncronized.", move_slots->from_slot);
|
||||
Message(Chat::Lime, "Source slot %i resyncronized.", move_slots->from_slot);
|
||||
}
|
||||
else { Message(13, "Could not resyncronize source slot %i.", move_slots->from_slot); }
|
||||
else { Message(Chat::Red, "Could not resyncronize source slot %i.", move_slots->from_slot); }
|
||||
}
|
||||
else { Message(13, "Could not resyncronize source slot %i.", move_slots->from_slot); }
|
||||
else { Message(Chat::Red, "Could not resyncronize source slot %i.", move_slots->from_slot); }
|
||||
}
|
||||
|
||||
if (move_slots->to_slot >= EQEmu::invslot::EQUIPMENT_BEGIN && move_slots->to_slot <= EQEmu::invbag::CURSOR_BAG_END) {
|
||||
@@ -2073,9 +2071,9 @@ void Client::SwapItemResync(MoveItem_Struct* move_slots) {
|
||||
safe_delete(outapp);
|
||||
}
|
||||
safe_delete(token_inst);
|
||||
Message(14, "Destination slot %i resyncronized.", move_slots->to_slot);
|
||||
Message(Chat::Lime, "Destination slot %i resyncronized.", move_slots->to_slot);
|
||||
}
|
||||
else { Message(13, "Could not resyncronize destination slot %i.", move_slots->to_slot); }
|
||||
else { Message(Chat::Red, "Could not resyncronize destination slot %i.", move_slots->to_slot); }
|
||||
}
|
||||
else {
|
||||
int16 resync_slot = (EQEmu::InventoryProfile::CalcSlotId(move_slots->to_slot) == INVALID_INDEX) ? move_slots->to_slot : EQEmu::InventoryProfile::CalcSlotId(move_slots->to_slot);
|
||||
@@ -2088,11 +2086,11 @@ void Client::SwapItemResync(MoveItem_Struct* move_slots) {
|
||||
SendItemPacket(resync_slot, m_inv[resync_slot], ItemPacketTrade);
|
||||
|
||||
safe_delete(token_inst);
|
||||
Message(14, "Destination slot %i resyncronized.", move_slots->to_slot);
|
||||
Message(Chat::Lime, "Destination slot %i resyncronized.", move_slots->to_slot);
|
||||
}
|
||||
else { Message(13, "Could not resyncronize destination slot %i.", move_slots->to_slot); }
|
||||
else { Message(Chat::Red, "Could not resyncronize destination slot %i.", move_slots->to_slot); }
|
||||
}
|
||||
else { Message(13, "Could not resyncronize destination slot %i.", move_slots->to_slot); }
|
||||
else { Message(Chat::Red, "Could not resyncronize destination slot %i.", move_slots->to_slot); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2219,7 +2217,7 @@ void Client::DyeArmor(EQEmu::TintProfile* dye){
|
||||
SendWearChange(i);
|
||||
}
|
||||
else{
|
||||
Message(13,"Could not locate A Vial of Prismatic Dye.");
|
||||
Message(Chat::Red,"Could not locate A Vial of Prismatic Dye.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -2459,7 +2457,7 @@ static bool CopyBagContents(EQEmu::ItemInstance* new_bag, const EQEmu::ItemInsta
|
||||
for (auto bag_slot = 0; bag_slot < old_bag->GetItem()->BagSlots; ++bag_slot) {
|
||||
if (!old_bag->GetItem(bag_slot)) { continue; }
|
||||
if (old_bag->GetItem(bag_slot)->GetItem()->Size > new_bag->GetItem()->BagSize) {
|
||||
Log(Logs::General, Logs::Inventory, "Copy Bag Contents: Failure due to %s is larger than size capacity of %s (%i > %i)",
|
||||
LogInventory("Copy Bag Contents: Failure due to [{}] is larger than size capacity of [{}] ([{}] > [{}])",
|
||||
old_bag->GetItem(bag_slot)->GetItem()->Name, new_bag->GetItem()->Name, old_bag->GetItem(bag_slot)->GetItem()->Size, new_bag->GetItem()->BagSize);
|
||||
return false;
|
||||
}
|
||||
@@ -2493,7 +2491,7 @@ void Client::DisenchantSummonedBags(bool client_update)
|
||||
if (!new_inst) { continue; }
|
||||
|
||||
if (CopyBagContents(new_inst, inst)) {
|
||||
Log(Logs::General, Logs::Inventory, "Disenchant Summoned Bags: Replacing %s with %s in slot %i", inst->GetItem()->Name, new_inst->GetItem()->Name, slot_id);
|
||||
LogInventory("Disenchant Summoned Bags: Replacing [{}] with [{}] in slot [{}]", inst->GetItem()->Name, new_inst->GetItem()->Name, slot_id);
|
||||
PutItemInInventory(slot_id, *new_inst, client_update);
|
||||
}
|
||||
safe_delete(new_inst);
|
||||
@@ -2517,7 +2515,7 @@ void Client::DisenchantSummonedBags(bool client_update)
|
||||
if (!new_inst) { continue; }
|
||||
|
||||
if (CopyBagContents(new_inst, inst)) {
|
||||
Log(Logs::General, Logs::Inventory, "Disenchant Summoned Bags: Replacing %s with %s in slot %i", inst->GetItem()->Name, new_inst->GetItem()->Name, slot_id);
|
||||
LogInventory("Disenchant Summoned Bags: Replacing [{}] with [{}] in slot [{}]", inst->GetItem()->Name, new_inst->GetItem()->Name, slot_id);
|
||||
PutItemInInventory(slot_id, *new_inst, client_update);
|
||||
}
|
||||
safe_delete(new_inst);
|
||||
@@ -2538,7 +2536,7 @@ void Client::DisenchantSummonedBags(bool client_update)
|
||||
if (!new_inst) { continue; }
|
||||
|
||||
if (CopyBagContents(new_inst, inst)) {
|
||||
Log(Logs::General, Logs::Inventory, "Disenchant Summoned Bags: Replacing %s with %s in slot %i", inst->GetItem()->Name, new_inst->GetItem()->Name, slot_id);
|
||||
LogInventory("Disenchant Summoned Bags: Replacing [{}] with [{}] in slot [{}]", inst->GetItem()->Name, new_inst->GetItem()->Name, slot_id);
|
||||
PutItemInInventory(slot_id, *new_inst, client_update);
|
||||
}
|
||||
safe_delete(new_inst);
|
||||
@@ -2559,7 +2557,7 @@ void Client::DisenchantSummonedBags(bool client_update)
|
||||
if (!new_inst) { break; }
|
||||
|
||||
if (CopyBagContents(new_inst, inst)) {
|
||||
Log(Logs::General, Logs::Inventory, "Disenchant Summoned Bags: Replacing %s with %s in slot %i", inst->GetItem()->Name, new_inst->GetItem()->Name, EQEmu::invslot::slotCursor);
|
||||
LogInventory("Disenchant Summoned Bags: Replacing [{}] with [{}] in slot [{}]", inst->GetItem()->Name, new_inst->GetItem()->Name, EQEmu::invslot::slotCursor);
|
||||
std::list<EQEmu::ItemInstance*> local;
|
||||
local.push_front(new_inst);
|
||||
m_inv.PopItem(EQEmu::invslot::slotCursor);
|
||||
@@ -2598,7 +2596,7 @@ void Client::RemoveNoRent(bool client_update)
|
||||
|
||||
auto inst = m_inv[slot_id];
|
||||
if(inst && !inst->GetItem()->NoRent) {
|
||||
Log(Logs::Detail, Logs::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
|
||||
LogInventory("NoRent Timer Lapse: Deleting [{}] from slot [{}]", inst->GetItem()->Name, slot_id);
|
||||
DeleteItemInInventory(slot_id, 0, client_update);
|
||||
}
|
||||
}
|
||||
@@ -2609,7 +2607,7 @@ void Client::RemoveNoRent(bool client_update)
|
||||
|
||||
auto inst = m_inv[slot_id];
|
||||
if (inst && !inst->GetItem()->NoRent) {
|
||||
Log(Logs::Detail, Logs::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
|
||||
LogInventory("NoRent Timer Lapse: Deleting [{}] from slot [{}]", inst->GetItem()->Name, slot_id);
|
||||
DeleteItemInInventory(slot_id, 0, client_update);
|
||||
}
|
||||
}
|
||||
@@ -2621,7 +2619,7 @@ void Client::RemoveNoRent(bool client_update)
|
||||
|
||||
auto inst = m_inv[slot_id];
|
||||
if(inst && !inst->GetItem()->NoRent) {
|
||||
Log(Logs::Detail, Logs::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
|
||||
LogInventory("NoRent Timer Lapse: Deleting [{}] from slot [{}]", inst->GetItem()->Name, slot_id);
|
||||
DeleteItemInInventory(slot_id, 0, client_update);
|
||||
}
|
||||
}
|
||||
@@ -2632,7 +2630,7 @@ void Client::RemoveNoRent(bool client_update)
|
||||
|
||||
auto inst = m_inv[slot_id];
|
||||
if(inst && !inst->GetItem()->NoRent) {
|
||||
Log(Logs::Detail, Logs::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
|
||||
LogInventory("NoRent Timer Lapse: Deleting [{}] from slot [{}]", inst->GetItem()->Name, slot_id);
|
||||
DeleteItemInInventory(slot_id, 0, false); // Can't delete from client Bank slots
|
||||
}
|
||||
}
|
||||
@@ -2644,7 +2642,7 @@ void Client::RemoveNoRent(bool client_update)
|
||||
|
||||
auto inst = m_inv[slot_id];
|
||||
if(inst && !inst->GetItem()->NoRent) {
|
||||
Log(Logs::Detail, Logs::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
|
||||
LogInventory("NoRent Timer Lapse: Deleting [{}] from slot [{}]", inst->GetItem()->Name, slot_id);
|
||||
DeleteItemInInventory(slot_id, 0, false); // Can't delete from client Bank Container slots
|
||||
}
|
||||
}
|
||||
@@ -2652,7 +2650,7 @@ void Client::RemoveNoRent(bool client_update)
|
||||
for (auto slot_id = EQEmu::invslot::SHARED_BANK_BEGIN; slot_id <= EQEmu::invslot::SHARED_BANK_END; ++slot_id) {
|
||||
auto inst = m_inv[slot_id];
|
||||
if(inst && !inst->GetItem()->NoRent) {
|
||||
Log(Logs::Detail, Logs::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
|
||||
LogInventory("NoRent Timer Lapse: Deleting [{}] from slot [{}]", inst->GetItem()->Name, slot_id);
|
||||
DeleteItemInInventory(slot_id, 0, false); // Can't delete from client Shared Bank slots
|
||||
}
|
||||
}
|
||||
@@ -2660,7 +2658,7 @@ void Client::RemoveNoRent(bool client_update)
|
||||
for (auto slot_id = EQEmu::invbag::SHARED_BANK_BAGS_BEGIN; slot_id <= EQEmu::invbag::SHARED_BANK_BAGS_END; ++slot_id) {
|
||||
auto inst = m_inv[slot_id];
|
||||
if(inst && !inst->GetItem()->NoRent) {
|
||||
Log(Logs::Detail, Logs::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
|
||||
LogInventory("NoRent Timer Lapse: Deleting [{}] from slot [{}]", inst->GetItem()->Name, slot_id);
|
||||
DeleteItemInInventory(slot_id, 0, false); // Can't delete from client Shared Bank Container slots
|
||||
}
|
||||
}
|
||||
@@ -2678,7 +2676,7 @@ void Client::RemoveNoRent(bool client_update)
|
||||
auto inst = *iter;
|
||||
if (inst == nullptr) { continue; }
|
||||
if (!inst->GetItem()->NoRent) {
|
||||
Log(Logs::Detail, Logs::Inventory, "NoRent Timer Lapse: Deleting %s from `Limbo`", inst->GetItem()->Name);
|
||||
LogInventory("NoRent Timer Lapse: Deleting [{}] from `Limbo`", inst->GetItem()->Name);
|
||||
}
|
||||
else {
|
||||
m_inv.PushCursor(*inst);
|
||||
@@ -2702,7 +2700,7 @@ void Client::RemoveDuplicateLore(bool client_update)
|
||||
auto inst = m_inv.PopItem(slot_id);
|
||||
if (inst == nullptr) { continue; }
|
||||
if(CheckLoreConflict(inst->GetItem())) {
|
||||
Log(Logs::Detail, Logs::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
|
||||
LogInventory("Lore Duplication Error: Deleting [{}] from slot [{}]", inst->GetItem()->Name, slot_id);
|
||||
database.SaveInventory(character_id, nullptr, slot_id);
|
||||
}
|
||||
else {
|
||||
@@ -2718,7 +2716,7 @@ void Client::RemoveDuplicateLore(bool client_update)
|
||||
auto inst = m_inv.PopItem(slot_id);
|
||||
if (inst == nullptr) { continue; }
|
||||
if (CheckLoreConflict(inst->GetItem())) {
|
||||
Log(Logs::Detail, Logs::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
|
||||
LogInventory("Lore Duplication Error: Deleting [{}] from slot [{}]", inst->GetItem()->Name, slot_id);
|
||||
database.SaveInventory(character_id, nullptr, slot_id);
|
||||
}
|
||||
else {
|
||||
@@ -2735,7 +2733,7 @@ void Client::RemoveDuplicateLore(bool client_update)
|
||||
auto inst = m_inv.PopItem(slot_id);
|
||||
if (inst == nullptr) { continue; }
|
||||
if(CheckLoreConflict(inst->GetItem())) {
|
||||
Log(Logs::Detail, Logs::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
|
||||
LogInventory("Lore Duplication Error: Deleting [{}] from slot [{}]", inst->GetItem()->Name, slot_id);
|
||||
database.SaveInventory(character_id, nullptr, slot_id);
|
||||
}
|
||||
else {
|
||||
@@ -2751,7 +2749,7 @@ void Client::RemoveDuplicateLore(bool client_update)
|
||||
auto inst = m_inv.PopItem(slot_id);
|
||||
if (inst == nullptr) { continue; }
|
||||
if(CheckLoreConflict(inst->GetItem())) {
|
||||
Log(Logs::Detail, Logs::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
|
||||
LogInventory("Lore Duplication Error: Deleting [{}] from slot [{}]", inst->GetItem()->Name, slot_id);
|
||||
database.SaveInventory(character_id, nullptr, slot_id);
|
||||
}
|
||||
else {
|
||||
@@ -2768,7 +2766,7 @@ void Client::RemoveDuplicateLore(bool client_update)
|
||||
auto inst = m_inv.PopItem(slot_id);
|
||||
if (inst == nullptr) { continue; }
|
||||
if(CheckLoreConflict(inst->GetItem())) {
|
||||
Log(Logs::Detail, Logs::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id);
|
||||
LogInventory("Lore Duplication Error: Deleting [{}] from slot [{}]", inst->GetItem()->Name, slot_id);
|
||||
database.SaveInventory(character_id, nullptr, slot_id);
|
||||
}
|
||||
else {
|
||||
@@ -2793,7 +2791,7 @@ void Client::RemoveDuplicateLore(bool client_update)
|
||||
auto inst = *iter;
|
||||
if (inst == nullptr) { continue; }
|
||||
if (CheckLoreConflict(inst->GetItem())) {
|
||||
Log(Logs::Detail, Logs::Inventory, "Lore Duplication Error: Deleting %s from `Limbo`", inst->GetItem()->Name);
|
||||
LogInventory("Lore Duplication Error: Deleting [{}] from `Limbo`", inst->GetItem()->Name);
|
||||
safe_delete(inst);
|
||||
}
|
||||
else {
|
||||
@@ -2812,7 +2810,7 @@ void Client::RemoveDuplicateLore(bool client_update)
|
||||
m_inv.PushCursor(*inst);
|
||||
}
|
||||
else {
|
||||
Log(Logs::Detail, Logs::Inventory, "Lore Duplication Error: Deleting %s from `Limbo`", inst->GetItem()->Name);
|
||||
LogInventory("Lore Duplication Error: Deleting [{}] from `Limbo`", inst->GetItem()->Name);
|
||||
}
|
||||
safe_delete(inst);
|
||||
}
|
||||
@@ -2830,7 +2828,7 @@ void Client::MoveSlotNotAllowed(bool client_update)
|
||||
auto inst = m_inv.PopItem(slot_id);
|
||||
bool is_arrow = (inst->GetItem()->ItemType == EQEmu::item::ItemTypeArrow) ? true : false;
|
||||
int16 free_slot_id = m_inv.FindFreeSlot(inst->IsClassBag(), true, inst->GetItem()->Size, is_arrow);
|
||||
Log(Logs::Detail, Logs::Inventory, "Slot Assignment Error: Moving %s from slot %i to %i", inst->GetItem()->Name, slot_id, free_slot_id);
|
||||
LogInventory("Slot Assignment Error: Moving [{}] from slot [{}] to [{}]", inst->GetItem()->Name, slot_id, free_slot_id);
|
||||
PutItemInInventory(free_slot_id, *inst, client_update);
|
||||
database.SaveInventory(character_id, nullptr, slot_id);
|
||||
safe_delete(inst);
|
||||
@@ -2846,7 +2844,7 @@ void Client::MoveSlotNotAllowed(bool client_update)
|
||||
// auto inst = m_inv.PopItem(slot_id);
|
||||
// bool is_arrow = (inst->GetItem()->ItemType == EQEmu::item::ItemTypeArrow) ? true : false;
|
||||
// int16 free_slot_id = m_inv.FindFreeSlot(inst->IsClassBag(), true, inst->GetItem()->Size, is_arrow);
|
||||
// Log(Logs::Detail, Logs::Inventory, "Slot Assignment Error: Moving %s from slot %i to %i", inst->GetItem()->Name, slot_id, free_slot_id);
|
||||
// LogInventory("Slot Assignment Error: Moving [{}] from slot [{}] to [{}]", inst->GetItem()->Name, slot_id, free_slot_id);
|
||||
// PutItemInInventory(free_slot_id, *inst, client_update);
|
||||
// database.SaveInventory(character_id, nullptr, slot_id);
|
||||
// safe_delete(inst);
|
||||
@@ -3001,7 +2999,7 @@ void Client::CreateBandolier(const EQApplicationPacket *app)
|
||||
|
||||
BandolierCreate_Struct *bs = (BandolierCreate_Struct*)app->pBuffer;
|
||||
|
||||
Log(Logs::Detail, Logs::Inventory, "Char: %s Creating Bandolier Set %i, Set Name: %s", GetName(), bs->Number, bs->Name);
|
||||
LogInventory("Char: [{}] Creating Bandolier Set [{}], Set Name: [{}]", GetName(), bs->Number, bs->Name);
|
||||
strcpy(m_pp.bandoliers[bs->Number].Name, bs->Name);
|
||||
|
||||
const EQEmu::ItemInstance* InvItem = nullptr;
|
||||
@@ -3015,13 +3013,13 @@ void Client::CreateBandolier(const EQApplicationPacket *app)
|
||||
InvItem = GetInv()[WeaponSlot];
|
||||
if(InvItem) {
|
||||
BaseItem = InvItem->GetItem();
|
||||
Log(Logs::Detail, Logs::Inventory, "Char: %s adding item %s to slot %i", GetName(),BaseItem->Name, WeaponSlot);
|
||||
LogInventory("Char: [{}] adding item [{}] to slot [{}]", GetName(),BaseItem->Name, WeaponSlot);
|
||||
m_pp.bandoliers[bs->Number].Items[BandolierSlot].ID = BaseItem->ID;
|
||||
m_pp.bandoliers[bs->Number].Items[BandolierSlot].Icon = BaseItem->Icon;
|
||||
database.SaveCharacterBandolier(this->CharacterID(), bs->Number, BandolierSlot, m_pp.bandoliers[bs->Number].Items[BandolierSlot].ID, m_pp.bandoliers[bs->Number].Items[BandolierSlot].Icon, bs->Name);
|
||||
}
|
||||
else {
|
||||
Log(Logs::Detail, Logs::Inventory, "Char: %s no item in slot %i", GetName(), WeaponSlot);
|
||||
LogInventory("Char: [{}] no item in slot [{}]", GetName(), WeaponSlot);
|
||||
m_pp.bandoliers[bs->Number].Items[BandolierSlot].ID = 0;
|
||||
m_pp.bandoliers[bs->Number].Items[BandolierSlot].Icon = 0;
|
||||
}
|
||||
@@ -3031,7 +3029,7 @@ void Client::CreateBandolier(const EQApplicationPacket *app)
|
||||
void Client::RemoveBandolier(const EQApplicationPacket *app)
|
||||
{
|
||||
BandolierDelete_Struct *bds = (BandolierDelete_Struct*)app->pBuffer;
|
||||
Log(Logs::Detail, Logs::Inventory, "Char: %s removing set", GetName(), bds->Number);
|
||||
LogInventory("Char: [{}] removing set", GetName(), bds->Number);
|
||||
memset(m_pp.bandoliers[bds->Number].Name, 0, 32);
|
||||
for(int i = bandolierPrimary; i <= bandolierAmmo; i++) {
|
||||
m_pp.bandoliers[bds->Number].Items[i].ID = 0;
|
||||
@@ -3046,7 +3044,7 @@ void Client::SetBandolier(const EQApplicationPacket *app)
|
||||
// any items currently in the weapon slots to inventory.
|
||||
|
||||
BandolierSet_Struct *bss = (BandolierSet_Struct*)app->pBuffer;
|
||||
Log(Logs::Detail, Logs::Inventory, "Char: %s activating set %i", GetName(), bss->Number);
|
||||
LogInventory("Char: [{}] activating set [{}]", GetName(), bss->Number);
|
||||
int16 slot = 0;
|
||||
int16 WeaponSlot = 0;
|
||||
EQEmu::ItemInstance *BandolierItems[4]; // Temporary holding area for the weapons we pull out of their inventory
|
||||
@@ -3113,19 +3111,19 @@ void Client::SetBandolier(const EQApplicationPacket *app)
|
||||
else { // The player doesn't have the required weapon with them.
|
||||
BandolierItems[BandolierSlot] = 0;
|
||||
if (slot == INVALID_INDEX) {
|
||||
Log(Logs::Detail, Logs::Inventory, "Character does not have required bandolier item for slot %i", WeaponSlot);
|
||||
LogInventory("Character does not have required bandolier item for slot [{}]", WeaponSlot);
|
||||
EQEmu::ItemInstance *InvItem = m_inv.PopItem(WeaponSlot);
|
||||
if(InvItem) {
|
||||
// If there was an item in that weapon slot, put it in the inventory
|
||||
Log(Logs::Detail, Logs::Inventory, "returning item %s in weapon slot %i to inventory",
|
||||
LogInventory("returning item [{}] in weapon slot [{}] to inventory",
|
||||
InvItem->GetItem()->Name, WeaponSlot);
|
||||
Log(Logs::Detail, Logs::Inventory, "returning item %s in weapon slot %i to inventory", InvItem->GetItem()->Name, WeaponSlot);
|
||||
LogInventory("returning item [{}] in weapon slot [{}] to inventory", InvItem->GetItem()->Name, WeaponSlot);
|
||||
if (MoveItemToInventory(InvItem)) {
|
||||
database.SaveInventory(character_id, 0, WeaponSlot);
|
||||
Log(Logs::General, Logs::Error, "returning item %s in weapon slot %i to inventory", InvItem->GetItem()->Name, WeaponSlot);
|
||||
LogError("returning item [{}] in weapon slot [{}] to inventory", InvItem->GetItem()->Name, WeaponSlot);
|
||||
}
|
||||
else {
|
||||
Log(Logs::General, Logs::Error, "Char: %s, ERROR returning %s to inventory", GetName(), InvItem->GetItem()->Name);
|
||||
LogError("Char: [{}], ERROR returning [{}] to inventory", GetName(), InvItem->GetItem()->Name);
|
||||
}
|
||||
safe_delete(InvItem);
|
||||
}
|
||||
@@ -3159,7 +3157,7 @@ void Client::SetBandolier(const EQApplicationPacket *app)
|
||||
if(InvItem) {
|
||||
// If there was already an item in that weapon slot that we replaced, find a place to put it
|
||||
if (!MoveItemToInventory(InvItem)) {
|
||||
Log(Logs::General, Logs::Error, "Char: %s, ERROR returning %s to inventory", GetName(), InvItem->GetItem()->Name);
|
||||
LogError("Char: [{}], ERROR returning [{}] to inventory", GetName(), InvItem->GetItem()->Name);
|
||||
}
|
||||
safe_delete(InvItem);
|
||||
}
|
||||
@@ -3170,13 +3168,13 @@ void Client::SetBandolier(const EQApplicationPacket *app)
|
||||
// put it in the player's inventory.
|
||||
EQEmu::ItemInstance *InvItem = m_inv.PopItem(WeaponSlot);
|
||||
if(InvItem) {
|
||||
Log(Logs::Detail, Logs::Inventory, "Bandolier has no item for slot %i, returning item %s to inventory", WeaponSlot, InvItem->GetItem()->Name);
|
||||
LogInventory("Bandolier has no item for slot [{}], returning item [{}] to inventory", WeaponSlot, InvItem->GetItem()->Name);
|
||||
// If there was an item in that weapon slot, put it in the inventory
|
||||
if (MoveItemToInventory(InvItem)) {
|
||||
database.SaveInventory(character_id, 0, WeaponSlot);
|
||||
}
|
||||
else {
|
||||
Log(Logs::General, Logs::Error, "Char: %s, ERROR returning %s to inventory", GetName(), InvItem->GetItem()->Name);
|
||||
LogError("Char: [{}], ERROR returning [{}] to inventory", GetName(), InvItem->GetItem()->Name);
|
||||
}
|
||||
safe_delete(InvItem);
|
||||
}
|
||||
@@ -3209,7 +3207,7 @@ bool Client::MoveItemToInventory(EQEmu::ItemInstance *ItemToReturn, bool UpdateC
|
||||
return false;
|
||||
}
|
||||
|
||||
Log(Logs::Detail, Logs::Inventory,"Char: %s Returning %s to inventory", GetName(), ItemToReturn->GetItem()->Name);
|
||||
LogInventory("Char: [{}] Returning [{}] to inventory", GetName(), ItemToReturn->GetItem()->Name);
|
||||
|
||||
uint32 ItemID = ItemToReturn->GetItem()->ID;
|
||||
|
||||
@@ -3293,7 +3291,7 @@ bool Client::MoveItemToInventory(EQEmu::ItemInstance *ItemToReturn, bool UpdateC
|
||||
|
||||
database.SaveInventory(character_id, m_inv.GetItem(i), i);
|
||||
|
||||
Log(Logs::Detail, Logs::Inventory, "Char: %s Storing in main inventory slot %i", GetName(), i);
|
||||
LogInventory("Char: [{}] Storing in main inventory slot [{}]", GetName(), i);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -3316,7 +3314,7 @@ bool Client::MoveItemToInventory(EQEmu::ItemInstance *ItemToReturn, bool UpdateC
|
||||
|
||||
database.SaveInventory(character_id, m_inv.GetItem(BaseSlotID + BagSlot), BaseSlotID + BagSlot);
|
||||
|
||||
Log(Logs::Detail, Logs::Inventory, "Char: %s Storing in bag slot %i", GetName(), BaseSlotID + BagSlot);
|
||||
LogInventory("Char: [{}] Storing in bag slot [{}]", GetName(), BaseSlotID + BagSlot);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -3326,7 +3324,7 @@ bool Client::MoveItemToInventory(EQEmu::ItemInstance *ItemToReturn, bool UpdateC
|
||||
|
||||
// Store on the cursor
|
||||
//
|
||||
Log(Logs::Detail, Logs::Inventory, "Char: %s No space, putting on the cursor", GetName());
|
||||
LogInventory("Char: [{}] No space, putting on the cursor", GetName());
|
||||
|
||||
PushItemOnCursor(*ItemToReturn, UpdateClient);
|
||||
|
||||
@@ -3394,10 +3392,10 @@ bool Client::InterrogateInventory(Client* requester, bool log, bool silent, bool
|
||||
log = true;
|
||||
|
||||
if (log) {
|
||||
Log(Logs::General, Logs::Error, "Client::InterrogateInventory() called for %s by %s with an error state of %s", GetName(), requester->GetName(), (error ? "TRUE" : "FALSE"));
|
||||
LogError("Client::InterrogateInventory() called for [{}] by [{}] with an error state of [{}]", GetName(), requester->GetName(), (error ? "TRUE" : "FALSE"));
|
||||
}
|
||||
if (!silent) {
|
||||
requester->Message(1, "--- Inventory Interrogation Report for %s (requested by: %s, error state: %s) ---", GetName(), requester->GetName(), (error ? "TRUE" : "FALSE"));
|
||||
requester->Message(Chat::Default, "--- Inventory Interrogation Report for %s (requested by: %s, error state: %s) ---", GetName(), requester->GetName(), (error ? "TRUE" : "FALSE"));
|
||||
}
|
||||
|
||||
// call InterrogateInventory_ for report
|
||||
@@ -3406,21 +3404,21 @@ bool Client::InterrogateInventory(Client* requester, bool log, bool silent, bool
|
||||
}
|
||||
|
||||
if (error) {
|
||||
Message(13, "An error has been discovered in your inventory!");
|
||||
Message(13, "Do not log out, zone or re-arrange items until this");
|
||||
Message(13, "issue has been resolved or item loss may occur!");
|
||||
Message(Chat::Red, "An error has been discovered in your inventory!");
|
||||
Message(Chat::Red, "Do not log out, zone or re-arrange items until this");
|
||||
Message(Chat::Red, "issue has been resolved or item loss may occur!");
|
||||
|
||||
if (allowtrip)
|
||||
TripInterrogateInvState();
|
||||
}
|
||||
|
||||
if (log) {
|
||||
Log(Logs::General, Logs::Error, "Target interrogate inventory flag: %s", (GetInterrogateInvState() ? "TRUE" : "FALSE"));
|
||||
Log(Logs::Detail, Logs::None, "[CLIENT] Client::InterrogateInventory() -- End");
|
||||
LogError("Target interrogate inventory flag: [{}]", (GetInterrogateInvState() ? "TRUE" : "FALSE"));
|
||||
LogDebug("[CLIENT] Client::InterrogateInventory() -- End");
|
||||
}
|
||||
if (!silent) {
|
||||
requester->Message(1, "Target interrogation flag: %s", (GetInterrogateInvState() ? "TRUE" : "FALSE"));
|
||||
requester->Message(1, "--- End of Interrogation Report ---");
|
||||
requester->Message(Chat::Default, "Target interrogation flag: %s", (GetInterrogateInvState() ? "TRUE" : "FALSE"));
|
||||
requester->Message(Chat::Default, "--- End of Interrogation Report ---");
|
||||
}
|
||||
|
||||
instmap.clear();
|
||||
@@ -3431,7 +3429,7 @@ bool Client::InterrogateInventory(Client* requester, bool log, bool silent, bool
|
||||
void Client::InterrogateInventory_(bool errorcheck, Client* requester, int16 head, int16 index, const EQEmu::ItemInstance* inst, const EQEmu::ItemInstance* parent, bool log, bool silent, bool &error, int depth)
|
||||
{
|
||||
if (depth >= 10) {
|
||||
Log(Logs::Detail, Logs::None, "[CLIENT] Client::InterrogateInventory_() - Recursion count has exceeded the maximum allowable (You have a REALLY BIG PROBLEM!!)");
|
||||
LogDebug("[CLIENT] Client::InterrogateInventory_() - Recursion count has exceeded the maximum allowable (You have a REALLY BIG PROBLEM!!)");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3462,11 +3460,11 @@ void Client::InterrogateInventory_(bool errorcheck, Client* requester, int16 hea
|
||||
else { e = ""; }
|
||||
|
||||
if (log) {
|
||||
Log(Logs::General, Logs::Error, "Head: %i, Depth: %i, Instance: %s, Parent: %s%s",
|
||||
LogError("Head: [{}], Depth: [{}], Instance: [{}], Parent: [{}][{}]",
|
||||
head, depth, i.c_str(), p.c_str(), e.c_str());
|
||||
}
|
||||
if (!silent) {
|
||||
requester->Message(6, "%i:%i - inst: %s - parent: %s%s",
|
||||
requester->Message(Chat::Gray, "%i:%i - inst: %s - parent: %s%s",
|
||||
head, depth, i.c_str(), p.c_str(), e.c_str());
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -240,7 +240,7 @@ void NPC::AddLootDrop(const EQEmu::ItemData *item2, ItemList* itemlist, int16 ch
|
||||
|
||||
auto item = new ServerLootItem_Struct;
|
||||
#if EQDEBUG>=11
|
||||
Log(Logs::General, Logs::None, "Adding drop to npc: %s, Item: %i", GetName(), item2->ID);
|
||||
LogDebug("Adding drop to npc: [{}], Item: [{}]", GetName(), item2->ID);
|
||||
#endif
|
||||
|
||||
EQApplicationPacket* outapp = nullptr;
|
||||
@@ -352,7 +352,7 @@ void NPC::AddLootDrop(const EQEmu::ItemData *item2, ItemList* itemlist, int16 ch
|
||||
}
|
||||
else if (foundslot == EQEmu::invslot::slotSecondary
|
||||
&& (GetOwner() != nullptr || (CanThisClassDualWield() && zone->random.Roll(NPC_DW_CHANCE)) || (item2->Damage==0)) &&
|
||||
(item2->IsType1HWeapon() || item2->ItemType == EQEmu::item::ItemTypeShield))
|
||||
(item2->IsType1HWeapon() || item2->ItemType == EQEmu::item::ItemTypeShield || item2->ItemType == EQEmu::item::ItemTypeLight))
|
||||
{
|
||||
if (item2->Proc.Effect!=0)
|
||||
CastToMob()->AddProcToWeapon(item2->Proc.Effect, true);
|
||||
|
||||
+37
-1
@@ -47,7 +47,7 @@ bool Lua_Client::InZone() {
|
||||
|
||||
void Lua_Client::Kick() {
|
||||
Lua_Safe_Call_Void();
|
||||
self->Kick();
|
||||
self->Kick("Lua Quest");
|
||||
}
|
||||
|
||||
void Lua_Client::Disconnect() {
|
||||
@@ -550,6 +550,16 @@ void Lua_Client::UnmemSpellAll(bool update_client) {
|
||||
self->UnmemSpellAll(update_client);
|
||||
}
|
||||
|
||||
uint16 Lua_Client::FindMemmedSpellBySlot(int slot) {
|
||||
Lua_Safe_Call_Int();
|
||||
return self->FindMemmedSpellBySlot(slot);
|
||||
}
|
||||
|
||||
int Lua_Client::MemmedCount() {
|
||||
Lua_Safe_Call_Int();
|
||||
return self->MemmedCount();
|
||||
}
|
||||
|
||||
void Lua_Client::ScribeSpell(int spell_id, int slot) {
|
||||
Lua_Safe_Call_Void();
|
||||
self->ScribeSpell(spell_id, slot);
|
||||
@@ -615,11 +625,21 @@ void Lua_Client::UntrainDiscAll(bool update_client) {
|
||||
self->UntrainDiscAll(update_client);
|
||||
}
|
||||
|
||||
bool Lua_Client::IsStanding() {
|
||||
Lua_Safe_Call_Bool();
|
||||
return self->IsStanding();
|
||||
}
|
||||
|
||||
bool Lua_Client::IsSitting() {
|
||||
Lua_Safe_Call_Bool();
|
||||
return self->IsSitting();
|
||||
}
|
||||
|
||||
bool Lua_Client::IsCrouching() {
|
||||
Lua_Safe_Call_Bool();
|
||||
return self->IsCrouching();
|
||||
}
|
||||
|
||||
void Lua_Client::SetFeigned(bool v) {
|
||||
Lua_Safe_Call_Void();
|
||||
self->SetFeigned(v);
|
||||
@@ -1190,6 +1210,16 @@ void Lua_Client::AddAlternateCurrencyValue(uint32 currency, int amount) {
|
||||
self->AddAlternateCurrencyValue(currency, amount, 1);
|
||||
}
|
||||
|
||||
void Lua_Client::SetAlternateCurrencyValue(uint32 currency, int amount) {
|
||||
Lua_Safe_Call_Void();
|
||||
self->SetAlternateCurrencyValue(currency, amount);
|
||||
}
|
||||
|
||||
int Lua_Client::GetAlternateCurrencyValue(uint32 currency) {
|
||||
Lua_Safe_Call_Int();
|
||||
return self->GetAlternateCurrencyValue(currency);
|
||||
}
|
||||
|
||||
void Lua_Client::SendWebLink(const char *site) {
|
||||
Lua_Safe_Call_Void();
|
||||
self->SendWebLink(site);
|
||||
@@ -1608,6 +1638,8 @@ luabind::scope lua_register_client() {
|
||||
.def("UnmemSpellBySpellID", (void(Lua_Client::*)(int32))&Lua_Client::UnmemSpellBySpellID)
|
||||
.def("UnmemSpellAll", (void(Lua_Client::*)(void))&Lua_Client::UnmemSpellAll)
|
||||
.def("UnmemSpellAll", (void(Lua_Client::*)(bool))&Lua_Client::UnmemSpellAll)
|
||||
.def("FindMemmedSpellBySlot", (uint16(Lua_Client::*)(int))&Lua_Client::FindMemmedSpellBySlot)
|
||||
.def("MemmedCount", (int(Lua_Client::*)(void))&Lua_Client::MemmedCount)
|
||||
.def("ScribeSpell", (void(Lua_Client::*)(int,int))&Lua_Client::ScribeSpell)
|
||||
.def("ScribeSpell", (void(Lua_Client::*)(int,int,bool))&Lua_Client::ScribeSpell)
|
||||
.def("UnscribeSpell", (void(Lua_Client::*)(int))&Lua_Client::UnscribeSpell)
|
||||
@@ -1621,7 +1653,9 @@ luabind::scope lua_register_client() {
|
||||
.def("UntrainDisc", (void(Lua_Client::*)(int,bool))&Lua_Client::UntrainDisc)
|
||||
.def("UntrainDiscAll", (void(Lua_Client::*)(void))&Lua_Client::UntrainDiscAll)
|
||||
.def("UntrainDiscAll", (void(Lua_Client::*)(bool))&Lua_Client::UntrainDiscAll)
|
||||
.def("IsStanding", (bool(Lua_Client::*)(void))&Lua_Client::IsStanding)
|
||||
.def("IsSitting", (bool(Lua_Client::*)(void))&Lua_Client::IsSitting)
|
||||
.def("IsCrouching", (bool(Lua_Client::*)(void))&Lua_Client::IsCrouching)
|
||||
.def("SetFeigned", (void(Lua_Client::*)(bool))&Lua_Client::SetFeigned)
|
||||
.def("GetFeigned", (bool(Lua_Client::*)(void))&Lua_Client::GetFeigned)
|
||||
.def("AutoSplitEnabled", (bool(Lua_Client::*)(void))&Lua_Client::AutoSplitEnabled)
|
||||
@@ -1736,6 +1770,8 @@ luabind::scope lua_register_client() {
|
||||
.def("OpenLFGuildWindow", (void(Lua_Client::*)(void))&Lua_Client::OpenLFGuildWindow)
|
||||
.def("Signal", (void(Lua_Client::*)(uint32))&Lua_Client::Signal)
|
||||
.def("AddAlternateCurrencyValue", (void(Lua_Client::*)(uint32,int))&Lua_Client::AddAlternateCurrencyValue)
|
||||
.def("SetAlternateCurrencyValue", (void(Lua_Client::*)(uint32,int))&Lua_Client::SetAlternateCurrencyValue)
|
||||
.def("GetAlternateCurrencyValue", (int(Lua_Client::*)(uint32))&Lua_Client::GetAlternateCurrencyValue)
|
||||
.def("SendWebLink", (void(Lua_Client::*)(const char *))&Lua_Client::SendWebLink)
|
||||
.def("HasSpellScribed", (bool(Lua_Client::*)(int))&Lua_Client::HasSpellScribed)
|
||||
.def("SetAccountFlag", (void(Lua_Client::*)(std::string,std::string))&Lua_Client::SetAccountFlag)
|
||||
|
||||
@@ -135,6 +135,8 @@ public:
|
||||
void UnmemSpellBySpellID(int32 spell_id);
|
||||
void UnmemSpellAll();
|
||||
void UnmemSpellAll(bool update_client);
|
||||
uint16 FindMemmedSpellBySlot(int slot);
|
||||
int MemmedCount();
|
||||
void ScribeSpell(int spell_id, int slot);
|
||||
void ScribeSpell(int spell_id, int slot, bool update_client);
|
||||
void UnscribeSpell(int slot);
|
||||
@@ -148,7 +150,9 @@ public:
|
||||
void UntrainDisc(int slot, bool update_client);
|
||||
void UntrainDiscAll();
|
||||
void UntrainDiscAll(bool update_client);
|
||||
bool IsStanding();
|
||||
bool IsSitting();
|
||||
bool IsCrouching();
|
||||
void SetFeigned(bool v);
|
||||
bool GetFeigned();
|
||||
bool AutoSplitEnabled();
|
||||
@@ -265,6 +269,8 @@ public:
|
||||
void OpenLFGuildWindow();
|
||||
void Signal(uint32 id);
|
||||
void AddAlternateCurrencyValue(uint32 currency, int amount);
|
||||
void SetAlternateCurrencyValue(uint32 currency, int amount);
|
||||
int GetAlternateCurrencyValue(uint32 currency);
|
||||
void SendWebLink(const char *site);
|
||||
bool HasSpellScribed(int spell_id);
|
||||
void SetAccountFlag(std::string flag, std::string val);
|
||||
|
||||
+116
-90
@@ -36,6 +36,8 @@ struct BodyTypes { };
|
||||
struct Filters { };
|
||||
struct MessageTypes { };
|
||||
struct Rule { };
|
||||
struct Journal_SpeakMode { };
|
||||
struct Journal_Mode { };
|
||||
|
||||
struct lua_registered_event {
|
||||
std::string encounter_name;
|
||||
@@ -1366,14 +1368,14 @@ double lua_clock() {
|
||||
}
|
||||
|
||||
void lua_debug(std::string message) {
|
||||
Log(Logs::General, Logs::QuestDebug, message);
|
||||
Log(Logs::General, Logs::QuestDebug, message.c_str());
|
||||
}
|
||||
|
||||
void lua_debug(std::string message, int level) {
|
||||
if (level < Logs::General || level > Logs::Detail)
|
||||
return;
|
||||
|
||||
Log(static_cast<Logs::DebugLevel>(level), Logs::QuestDebug, message);
|
||||
Log(static_cast<Logs::DebugLevel>(level), Logs::QuestDebug, message.c_str());
|
||||
}
|
||||
|
||||
void lua_update_zone_header(std::string type, std::string value) {
|
||||
@@ -2232,91 +2234,92 @@ luabind::scope lua_register_message_types() {
|
||||
return luabind::class_<MessageTypes>("MT")
|
||||
.enum_("constants")
|
||||
[
|
||||
luabind::value("Say", MT_Say),
|
||||
luabind::value("Tell", MT_Tell),
|
||||
luabind::value("Group", MT_Group),
|
||||
luabind::value("Guild", MT_Guild),
|
||||
luabind::value("OOC", MT_OOC),
|
||||
luabind::value("Auction", MT_Auction),
|
||||
luabind::value("Shout", MT_Shout),
|
||||
luabind::value("Emote", MT_Emote),
|
||||
luabind::value("Spells", MT_Spells),
|
||||
luabind::value("YouHitOther", MT_YouHitOther),
|
||||
luabind::value("OtherHitsYou", MT_OtherHitsYou),
|
||||
luabind::value("YouMissOther", MT_YouMissOther),
|
||||
luabind::value("OtherMissesYou", MT_OtherMissesYou),
|
||||
luabind::value("Broadcasts", MT_Broadcasts),
|
||||
luabind::value("Skills", MT_Skills),
|
||||
luabind::value("Disciplines", MT_Disciplines),
|
||||
luabind::value("Unused1", MT_Unused1),
|
||||
luabind::value("DefaultText", MT_DefaultText),
|
||||
luabind::value("Unused2", MT_Unused2),
|
||||
luabind::value("MerchantOffer", MT_MerchantOffer),
|
||||
luabind::value("MerchantBuySell", MT_MerchantBuySell),
|
||||
luabind::value("YourDeath", MT_YourDeath),
|
||||
luabind::value("OtherDeath", MT_OtherDeath),
|
||||
luabind::value("OtherHits", MT_OtherHits),
|
||||
luabind::value("OtherMisses", MT_OtherMisses),
|
||||
luabind::value("Who", MT_Who),
|
||||
luabind::value("YellForHelp", MT_YellForHelp),
|
||||
luabind::value("NonMelee", MT_NonMelee),
|
||||
luabind::value("WornOff", MT_WornOff),
|
||||
luabind::value("MoneySplit", MT_MoneySplit),
|
||||
luabind::value("LootMessages", MT_LootMessages),
|
||||
luabind::value("DiceRoll", MT_DiceRoll),
|
||||
luabind::value("OtherSpells", MT_OtherSpells),
|
||||
luabind::value("SpellFailure", MT_SpellFailure),
|
||||
luabind::value("Chat", MT_Chat),
|
||||
luabind::value("Channel1", MT_Channel1),
|
||||
luabind::value("Channel2", MT_Channel2),
|
||||
luabind::value("Channel3", MT_Channel3),
|
||||
luabind::value("Channel4", MT_Channel4),
|
||||
luabind::value("Channel5", MT_Channel5),
|
||||
luabind::value("Channel6", MT_Channel6),
|
||||
luabind::value("Channel7", MT_Channel7),
|
||||
luabind::value("Channel8", MT_Channel8),
|
||||
luabind::value("Channel9", MT_Channel9),
|
||||
luabind::value("Channel10", MT_Channel10),
|
||||
luabind::value("CritMelee", MT_CritMelee),
|
||||
luabind::value("SpellCrits", MT_SpellCrits),
|
||||
luabind::value("TooFarAway", MT_TooFarAway),
|
||||
luabind::value("NPCRampage", MT_NPCRampage),
|
||||
luabind::value("NPCFlurry", MT_NPCFlurry),
|
||||
luabind::value("NPCEnrage", MT_NPCEnrage),
|
||||
luabind::value("SayEcho", MT_SayEcho),
|
||||
luabind::value("TellEcho", MT_TellEcho),
|
||||
luabind::value("GroupEcho", MT_GroupEcho),
|
||||
luabind::value("GuildEcho", MT_GuildEcho),
|
||||
luabind::value("OOCEcho", MT_OOCEcho),
|
||||
luabind::value("AuctionEcho", MT_AuctionEcho),
|
||||
luabind::value("ShoutECho", MT_ShoutECho),
|
||||
luabind::value("EmoteEcho", MT_EmoteEcho),
|
||||
luabind::value("Chat1Echo", MT_Chat1Echo),
|
||||
luabind::value("Chat2Echo", MT_Chat2Echo),
|
||||
luabind::value("Chat3Echo", MT_Chat3Echo),
|
||||
luabind::value("Chat4Echo", MT_Chat4Echo),
|
||||
luabind::value("Chat5Echo", MT_Chat5Echo),
|
||||
luabind::value("Chat6Echo", MT_Chat6Echo),
|
||||
luabind::value("Chat7Echo", MT_Chat7Echo),
|
||||
luabind::value("Chat8Echo", MT_Chat8Echo),
|
||||
luabind::value("Chat9Echo", MT_Chat9Echo),
|
||||
luabind::value("Chat10Echo", MT_Chat10Echo),
|
||||
luabind::value("DoTDamage", MT_DoTDamage),
|
||||
luabind::value("ItemLink", MT_ItemLink),
|
||||
luabind::value("RaidSay", MT_RaidSay),
|
||||
luabind::value("MyPet", MT_MyPet),
|
||||
luabind::value("DS", MT_DS),
|
||||
luabind::value("Leadership", MT_Leadership),
|
||||
luabind::value("PetFlurry", MT_PetFlurry),
|
||||
luabind::value("PetCrit", MT_PetCrit),
|
||||
luabind::value("FocusEffect", MT_FocusEffect),
|
||||
luabind::value("Experience", MT_Experience),
|
||||
luabind::value("System", MT_System),
|
||||
luabind::value("PetSpell", MT_PetSpell),
|
||||
luabind::value("PetResponse", MT_PetResponse),
|
||||
luabind::value("ItemSpeech", MT_ItemSpeech),
|
||||
luabind::value("StrikeThrough", MT_StrikeThrough),
|
||||
luabind::value("Stun", MT_Stun)
|
||||
luabind::value("NPCQuestSay", Chat::NPCQuestSay),
|
||||
luabind::value("Say", Chat::Say),
|
||||
luabind::value("Tell", Chat::Tell),
|
||||
luabind::value("Group", Chat::Group),
|
||||
luabind::value("Guild", Chat::Guild),
|
||||
luabind::value("OOC", Chat::OOC),
|
||||
luabind::value("Auction", Chat::Auction),
|
||||
luabind::value("Shout", Chat::Shout),
|
||||
luabind::value("Emote", Chat::Emote),
|
||||
luabind::value("Spells", Chat::Spells),
|
||||
luabind::value("YouHitOther", Chat::YouHitOther),
|
||||
luabind::value("OtherHitsYou", Chat::OtherHitYou),
|
||||
luabind::value("YouMissOther", Chat::YouMissOther),
|
||||
luabind::value("OtherMissesYou", Chat::OtherMissYou),
|
||||
luabind::value("Broadcasts", Chat::Broadcasts),
|
||||
luabind::value("Skills", Chat::Skills),
|
||||
luabind::value("Disciplines", Chat::Disciplines),
|
||||
luabind::value("Unused1", Chat::Unused1),
|
||||
luabind::value("DefaultText", Chat::DefaultText),
|
||||
luabind::value("Unused2", Chat::Unused2),
|
||||
luabind::value("MerchantOffer", Chat::MerchantOffer),
|
||||
luabind::value("MerchantBuySell", Chat::MerchantExchange),
|
||||
luabind::value("YourDeath", Chat::YourDeath),
|
||||
luabind::value("OtherDeath", Chat::OtherDeath),
|
||||
luabind::value("OtherHits", Chat::OtherHitOther),
|
||||
luabind::value("OtherMisses", Chat::OtherMissOther),
|
||||
luabind::value("Who", Chat::Who),
|
||||
luabind::value("YellForHelp", Chat::YellForHelp),
|
||||
luabind::value("NonMelee", Chat::NonMelee),
|
||||
luabind::value("WornOff", Chat::SpellWornOff),
|
||||
luabind::value("MoneySplit", Chat::MoneySplit),
|
||||
luabind::value("LootMessages", Chat::Loot),
|
||||
luabind::value("DiceRoll", Chat::DiceRoll),
|
||||
luabind::value("OtherSpells", Chat::OtherSpells),
|
||||
luabind::value("SpellFailure", Chat::SpellFailure),
|
||||
luabind::value("Chat", Chat::ChatChannel),
|
||||
luabind::value("Channel1", Chat::Chat1),
|
||||
luabind::value("Channel2", Chat::Chat2),
|
||||
luabind::value("Channel3", Chat::Chat3),
|
||||
luabind::value("Channel4", Chat::Chat4),
|
||||
luabind::value("Channel5", Chat::Chat5),
|
||||
luabind::value("Channel6", Chat::Chat6),
|
||||
luabind::value("Channel7", Chat::Chat7),
|
||||
luabind::value("Channel8", Chat::Chat8),
|
||||
luabind::value("Channel9", Chat::Chat9),
|
||||
luabind::value("Channel10", Chat::Chat10),
|
||||
luabind::value("CritMelee", Chat::MeleeCrit),
|
||||
luabind::value("SpellCrits", Chat::SpellCrit),
|
||||
luabind::value("TooFarAway", Chat::TooFarAway),
|
||||
luabind::value("NPCRampage", Chat::NPCRampage),
|
||||
luabind::value("NPCFlurry", Chat::NPCFlurry),
|
||||
luabind::value("NPCEnrage", Chat::NPCEnrage),
|
||||
luabind::value("SayEcho", Chat::EchoSay),
|
||||
luabind::value("TellEcho", Chat::EchoTell),
|
||||
luabind::value("GroupEcho", Chat::EchoGroup),
|
||||
luabind::value("GuildEcho", Chat::EchoGuild),
|
||||
luabind::value("OOCEcho", Chat::EchoOOC),
|
||||
luabind::value("AuctionEcho", Chat::EchoAuction),
|
||||
luabind::value("ShoutECho", Chat::EchoShout),
|
||||
luabind::value("EmoteEcho", Chat::EchoEmote),
|
||||
luabind::value("Chat1Echo", Chat::EchoChat1),
|
||||
luabind::value("Chat2Echo", Chat::EchoChat2),
|
||||
luabind::value("Chat3Echo", Chat::EchoChat3),
|
||||
luabind::value("Chat4Echo", Chat::EchoChat4),
|
||||
luabind::value("Chat5Echo", Chat::EchoChat5),
|
||||
luabind::value("Chat6Echo", Chat::EchoChat6),
|
||||
luabind::value("Chat7Echo", Chat::EchoChat7),
|
||||
luabind::value("Chat8Echo", Chat::EchoChat8),
|
||||
luabind::value("Chat9Echo", Chat::EchoChat9),
|
||||
luabind::value("Chat10Echo", Chat::EchoChat10),
|
||||
luabind::value("DoTDamage", Chat::DotDamage),
|
||||
luabind::value("ItemLink", Chat::ItemLink),
|
||||
luabind::value("RaidSay", Chat::RaidSay),
|
||||
luabind::value("MyPet", Chat::MyPet),
|
||||
luabind::value("DS", Chat::DamageShield),
|
||||
luabind::value("Leadership", Chat::LeaderShip),
|
||||
luabind::value("PetFlurry", Chat::PetFlurry),
|
||||
luabind::value("PetCrit", Chat::PetCritical),
|
||||
luabind::value("FocusEffect", Chat::FocusEffect),
|
||||
luabind::value("Experience", Chat::Experience),
|
||||
luabind::value("System", Chat::System),
|
||||
luabind::value("PetSpell", Chat::PetSpell),
|
||||
luabind::value("PetResponse", Chat::PetResponse),
|
||||
luabind::value("ItemSpeech", Chat::ItemSpeech),
|
||||
luabind::value("StrikeThrough", Chat::StrikeThrough),
|
||||
luabind::value("Stun", Chat::Stun)
|
||||
];
|
||||
}
|
||||
|
||||
@@ -2324,17 +2327,17 @@ luabind::scope lua_register_rules_const() {
|
||||
return luabind::class_<Rule>("Rule")
|
||||
.enum_("constants")
|
||||
[
|
||||
#define RULE_INT(cat, rule, default_value) \
|
||||
#define RULE_INT(cat, rule, default_value, notes) \
|
||||
luabind::value(#rule, RuleManager::Int__##rule),
|
||||
#include "../common/ruletypes.h"
|
||||
luabind::value("_IntRuleCount", RuleManager::_IntRuleCount),
|
||||
#undef RULE_INT
|
||||
#define RULE_REAL(cat, rule, default_value) \
|
||||
#define RULE_REAL(cat, rule, default_value, notes) \
|
||||
luabind::value(#rule, RuleManager::Real__##rule),
|
||||
#include "../common/ruletypes.h"
|
||||
luabind::value("_RealRuleCount", RuleManager::_RealRuleCount),
|
||||
#undef RULE_REAL
|
||||
#define RULE_BOOL(cat, rule, default_value) \
|
||||
#define RULE_BOOL(cat, rule, default_value, notes) \
|
||||
luabind::value(#rule, RuleManager::Bool__##rule),
|
||||
#include "../common/ruletypes.h"
|
||||
luabind::value("_BoolRuleCount", RuleManager::_BoolRuleCount)
|
||||
@@ -2362,4 +2365,27 @@ luabind::scope lua_register_ruleb() {
|
||||
];
|
||||
}
|
||||
|
||||
luabind::scope lua_register_journal_speakmode() {
|
||||
return luabind::class_<Journal_SpeakMode>("SpeakMode")
|
||||
.enum_("constants")
|
||||
[
|
||||
luabind::value("Raw", static_cast<int>(Journal::SpeakMode::Raw)),
|
||||
luabind::value("Say", static_cast<int>(Journal::SpeakMode::Say)),
|
||||
luabind::value("Shout", static_cast<int>(Journal::SpeakMode::Shout)),
|
||||
luabind::value("EmoteAlt", static_cast<int>(Journal::SpeakMode::EmoteAlt)),
|
||||
luabind::value("Emote", static_cast<int>(Journal::SpeakMode::Emote)),
|
||||
luabind::value("Group", static_cast<int>(Journal::SpeakMode::Group))
|
||||
];
|
||||
}
|
||||
|
||||
luabind::scope lua_register_journal_mode() {
|
||||
return luabind::class_<Journal_Mode>("JournalMode")
|
||||
.enum_("constants")
|
||||
[
|
||||
luabind::value("None", static_cast<int>(Journal::Mode::None)),
|
||||
luabind::value("Log1", static_cast<int>(Journal::Mode::Log1)),
|
||||
luabind::value("Log2", static_cast<int>(Journal::Mode::Log2))
|
||||
];
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -19,6 +19,8 @@ luabind::scope lua_register_rules_const();
|
||||
luabind::scope lua_register_rulei();
|
||||
luabind::scope lua_register_ruler();
|
||||
luabind::scope lua_register_ruleb();
|
||||
luabind::scope lua_register_journal_speakmode();
|
||||
luabind::scope lua_register_journal_mode();
|
||||
|
||||
#endif
|
||||
#endif
|
||||
+103
-7
@@ -267,6 +267,11 @@ void Lua_Mob::ChangeSize(double in_size, bool no_restriction) {
|
||||
self->ChangeSize(static_cast<float>(in_size), no_restriction);
|
||||
}
|
||||
|
||||
void Lua_Mob::RandomizeFeatures(bool send_illusion, bool save_variables) {
|
||||
Lua_Safe_Call_Void();
|
||||
self->RandomizeFeatures(send_illusion, save_variables);
|
||||
}
|
||||
|
||||
void Lua_Mob::GMMove(double x, double y, double z) {
|
||||
Lua_Safe_Call_Void();
|
||||
self->GMMove(static_cast<float>(x), static_cast<float>(y), static_cast<float>(z));
|
||||
@@ -317,6 +322,16 @@ bool Lua_Mob::FindBuff(int spell_id) {
|
||||
return self->FindBuff(spell_id);
|
||||
}
|
||||
|
||||
uint16 Lua_Mob::FindBuffBySlot(int slot) {
|
||||
Lua_Safe_Call_Int();
|
||||
return self->FindBuffBySlot(slot);
|
||||
}
|
||||
|
||||
uint32 Lua_Mob::BuffCount() {
|
||||
Lua_Safe_Call_Int();
|
||||
return self->BuffCount();
|
||||
}
|
||||
|
||||
bool Lua_Mob::FindType(int type) {
|
||||
Lua_Safe_Call_Bool();
|
||||
return self->FindType(type);
|
||||
@@ -728,9 +743,9 @@ void Lua_Mob::Message(int type, const char *message) {
|
||||
self->Message(type, message);
|
||||
}
|
||||
|
||||
void Lua_Mob::Message_StringID(int type, int string_id, uint32 distance) {
|
||||
void Lua_Mob::MessageString(int type, int string_id, uint32 distance) {
|
||||
Lua_Safe_Call_Void();
|
||||
self->Message_StringID(type, string_id, distance);
|
||||
self->MessageString(type, string_id, distance);
|
||||
}
|
||||
|
||||
void Lua_Mob::Say(const char *message) {
|
||||
@@ -738,9 +753,72 @@ void Lua_Mob::Say(const char *message) {
|
||||
self->Say(message);
|
||||
}
|
||||
|
||||
void Lua_Mob::Say(const char* message, int language) {
|
||||
Lua_Safe_Call_Void();
|
||||
entity_list.ChannelMessage(self, ChatChannel_Say, language, message); // these run through the client channels and probably shouldn't for NPCs, but oh well
|
||||
}
|
||||
|
||||
void Lua_Mob::QuestSay(Lua_Client client, const char *message) {
|
||||
Lua_Safe_Call_Void();
|
||||
self->QuestJournalledSay(client, message);
|
||||
Journal::Options journal_opts;
|
||||
journal_opts.speak_mode = Journal::SpeakMode::Say;
|
||||
journal_opts.journal_mode = RuleB(NPC, EnableNPCQuestJournal) ? Journal::Mode::Log2 : Journal::Mode::None;
|
||||
journal_opts.language = 0;
|
||||
journal_opts.message_type = Chat::NPCQuestSay;
|
||||
journal_opts.target_spawn_id = 0;
|
||||
self->QuestJournalledSay(client, message, journal_opts);
|
||||
}
|
||||
|
||||
void Lua_Mob::QuestSay(Lua_Client client, const char *message, luabind::adl::object opts) {
|
||||
Lua_Safe_Call_Void();
|
||||
|
||||
Journal::Options journal_opts;
|
||||
// defaults
|
||||
journal_opts.speak_mode = Journal::SpeakMode::Say;
|
||||
journal_opts.journal_mode = Journal::Mode::Log2;
|
||||
journal_opts.language = 0;
|
||||
journal_opts.message_type = Chat::NPCQuestSay;
|
||||
journal_opts.target_spawn_id = 0;
|
||||
|
||||
if (luabind::type(opts) == LUA_TTABLE) {
|
||||
auto cur = opts["speak_mode"];
|
||||
if (luabind::type(cur) != LUA_TNIL) {
|
||||
try {
|
||||
journal_opts.speak_mode = static_cast<Journal::SpeakMode>(luabind::object_cast<int>(cur));
|
||||
} catch (luabind::cast_failed) {
|
||||
}
|
||||
}
|
||||
|
||||
cur = opts["journal_mode"];
|
||||
if (luabind::type(cur) != LUA_TNIL) {
|
||||
try {
|
||||
journal_opts.journal_mode = static_cast<Journal::Mode>(luabind::object_cast<int>(cur));
|
||||
} catch (luabind::cast_failed) {
|
||||
}
|
||||
}
|
||||
|
||||
cur = opts["language"];
|
||||
if (luabind::type(cur) != LUA_TNIL) {
|
||||
try {
|
||||
journal_opts.language = luabind::object_cast<int>(cur);
|
||||
} catch (luabind::cast_failed) {
|
||||
}
|
||||
}
|
||||
|
||||
cur = opts["message_type"];
|
||||
if (luabind::type(cur) != LUA_TNIL) {
|
||||
try {
|
||||
journal_opts.message_type = luabind::object_cast<int>(cur);
|
||||
} catch (luabind::cast_failed) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if rule disables it, we override provided
|
||||
if (!RuleB(NPC, EnableNPCQuestJournal))
|
||||
journal_opts.journal_mode = Journal::Mode::None;
|
||||
|
||||
self->QuestJournalledSay(client, message, journal_opts);
|
||||
}
|
||||
|
||||
void Lua_Mob::Shout(const char *message) {
|
||||
@@ -748,6 +826,11 @@ void Lua_Mob::Shout(const char *message) {
|
||||
self->Shout(message);
|
||||
}
|
||||
|
||||
void Lua_Mob::Shout(const char* message, int language) {
|
||||
Lua_Safe_Call_Void();
|
||||
entity_list.ChannelMessage(self, ChatChannel_Shout, language, message);
|
||||
}
|
||||
|
||||
void Lua_Mob::Emote(const char *message) {
|
||||
Lua_Safe_Call_Void();
|
||||
self->Emote(message);
|
||||
@@ -2086,6 +2169,11 @@ int Lua_Mob::GetWeaponDamageBonus(Lua_Item weapon, bool offhand) {
|
||||
return self->GetWeaponDamageBonus(weapon, offhand);
|
||||
}
|
||||
|
||||
int Lua_Mob::GetItemStat(uint32 itemid, const char* identifier) {
|
||||
Lua_Safe_Call_Int();
|
||||
return self->GetItemStat(itemid, identifier);
|
||||
}
|
||||
|
||||
Lua_StatBonuses Lua_Mob::GetItemBonuses()
|
||||
{
|
||||
Lua_Safe_Call_Class(Lua_StatBonuses);
|
||||
@@ -2202,6 +2290,7 @@ luabind::scope lua_register_mob() {
|
||||
.def("DoAnim", (void(Lua_Mob::*)(int,int,bool,int))&Lua_Mob::DoAnim)
|
||||
.def("ChangeSize", (void(Lua_Mob::*)(double))&Lua_Mob::ChangeSize)
|
||||
.def("ChangeSize", (void(Lua_Mob::*)(double,bool))&Lua_Mob::ChangeSize)
|
||||
.def("RandomizeFeatures", (void(Lua_Mob::*)(bool,bool))&Lua_Mob::RandomizeFeatures)
|
||||
.def("GMMove", (void(Lua_Mob::*)(double,double,double))&Lua_Mob::GMMove)
|
||||
.def("GMMove", (void(Lua_Mob::*)(double,double,double,double))&Lua_Mob::GMMove)
|
||||
.def("GMMove", (void(Lua_Mob::*)(double,double,double,double,bool))&Lua_Mob::GMMove)
|
||||
@@ -2212,6 +2301,8 @@ luabind::scope lua_register_mob() {
|
||||
.def("IsInvisible", (bool(Lua_Mob::*)(Lua_Mob))&Lua_Mob::IsInvisible)
|
||||
.def("SetInvisible", &Lua_Mob::SetInvisible)
|
||||
.def("FindBuff", &Lua_Mob::FindBuff)
|
||||
.def("FindBuffBySlot", (uint16(Lua_Mob::*)(int))&Lua_Mob::FindBuffBySlot)
|
||||
.def("BuffCount", &Lua_Mob::BuffCount)
|
||||
.def("FindType", (bool(Lua_Mob::*)(int))&Lua_Mob::FindType)
|
||||
.def("FindType", (bool(Lua_Mob::*)(int,bool))&Lua_Mob::FindType)
|
||||
.def("FindType", (bool(Lua_Mob::*)(int,bool,int))&Lua_Mob::FindType)
|
||||
@@ -2242,6 +2333,7 @@ luabind::scope lua_register_mob() {
|
||||
.def("IsWarriorClass", &Lua_Mob::IsWarriorClass)
|
||||
.def("GetHP", &Lua_Mob::GetHP)
|
||||
.def("GetMaxHP", &Lua_Mob::GetMaxHP)
|
||||
.def("GetItemStat", (int(Lua_Mob::*)(uint32,const char*))&Lua_Mob::GetItemStat)
|
||||
.def("GetItemHPBonuses", &Lua_Mob::GetItemHPBonuses)
|
||||
.def("GetSpellHPBonuses", &Lua_Mob::GetSpellHPBonuses)
|
||||
.def("GetWalkspeed", &Lua_Mob::GetWalkspeed)
|
||||
@@ -2294,10 +2386,14 @@ luabind::scope lua_register_mob() {
|
||||
.def("SetCurrentWP", &Lua_Mob::SetCurrentWP)
|
||||
.def("GetSize", &Lua_Mob::GetSize)
|
||||
.def("Message", &Lua_Mob::Message)
|
||||
.def("Message_StringID", &Lua_Mob::Message_StringID)
|
||||
.def("Say", &Lua_Mob::Say)
|
||||
.def("QuestSay", &Lua_Mob::QuestSay)
|
||||
.def("Shout", &Lua_Mob::Shout)
|
||||
.def("MessageString", &Lua_Mob::MessageString)
|
||||
.def("Message_StringID", &Lua_Mob::MessageString)
|
||||
.def("Say", (void(Lua_Mob::*)(const char*))& Lua_Mob::Say)
|
||||
.def("Say", (void(Lua_Mob::*)(const char*, int))& Lua_Mob::Say)
|
||||
.def("QuestSay", (void(Lua_Mob::*)(Lua_Client,const char *))&Lua_Mob::QuestSay)
|
||||
.def("QuestSay", (void(Lua_Mob::*)(Lua_Client,const char *,luabind::adl::object))&Lua_Mob::QuestSay)
|
||||
.def("Shout", (void(Lua_Mob::*)(const char*))& Lua_Mob::Shout)
|
||||
.def("Shout", (void(Lua_Mob::*)(const char*, int))& Lua_Mob::Shout)
|
||||
.def("Emote", &Lua_Mob::Emote)
|
||||
.def("InterruptSpell", (void(Lua_Mob::*)(void))&Lua_Mob::InterruptSpell)
|
||||
.def("InterruptSpell", (void(Lua_Mob::*)(int))&Lua_Mob::InterruptSpell)
|
||||
|
||||
+8
-1
@@ -71,6 +71,7 @@ public:
|
||||
void DoAnim(int anim_num, int type, bool ackreq, int filter);
|
||||
void ChangeSize(double in_size);
|
||||
void ChangeSize(double in_size, bool no_restriction);
|
||||
void RandomizeFeatures(bool send_illusion, bool save_variables);
|
||||
void GMMove(double x, double y, double z);
|
||||
void GMMove(double x, double y, double z, double heading);
|
||||
void GMMove(double x, double y, double z, double heading, bool send_update);
|
||||
@@ -81,6 +82,8 @@ public:
|
||||
bool IsInvisible(Lua_Mob other);
|
||||
void SetInvisible(int state);
|
||||
bool FindBuff(int spell_id);
|
||||
uint16 FindBuffBySlot(int slot);
|
||||
uint32 BuffCount();
|
||||
bool FindType(int type);
|
||||
bool FindType(int type, bool offensive);
|
||||
bool FindType(int type, bool offensive, int threshold);
|
||||
@@ -163,10 +166,13 @@ public:
|
||||
void SetCurrentWP(int wp);
|
||||
double GetSize();
|
||||
void Message(int type, const char *message);
|
||||
void Message_StringID(int type, int string_id, uint32 distance);
|
||||
void MessageString(int type, int string_id, uint32 distance);
|
||||
void Say(const char *message);
|
||||
void Say(const char* message, int language);
|
||||
void QuestSay(Lua_Client client, const char *message);
|
||||
void QuestSay(Lua_Client client, const char *message, luabind::adl::object opts);
|
||||
void Shout(const char *message);
|
||||
void Shout(const char* message, int language);
|
||||
void Emote(const char *message);
|
||||
void InterruptSpell();
|
||||
void InterruptSpell(int spell_id);
|
||||
@@ -401,6 +407,7 @@ public:
|
||||
bool IsAmnesiad();
|
||||
int32 GetMeleeMitigation();
|
||||
int GetWeaponDamageBonus(Lua_Item weapon, bool offhand);
|
||||
int GetItemStat(uint32 itemid, const char* identifier);
|
||||
Lua_StatBonuses GetItemBonuses();
|
||||
Lua_StatBonuses GetSpellBonuses();
|
||||
Lua_StatBonuses GetAABonuses();
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#ifdef LUA_EQEMU
|
||||
|
||||
#include "lua.hpp"
|
||||
#include <luabind/luabind.hpp>
|
||||
#include <luabind/object.hpp>
|
||||
@@ -629,3 +631,5 @@ void LuaMod::GetExperienceForKill(Client *self, Mob *against, uint32 &returnValu
|
||||
lua_pop(L, n);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
+23
-2
@@ -159,7 +159,7 @@ void Lua_NPC::SetSaveWaypoint(int wp) {
|
||||
|
||||
void Lua_NPC::SetSp2(int sg2) {
|
||||
Lua_Safe_Call_Void();
|
||||
self->SetSp2(sg2);
|
||||
self->SetSpawnGroupId(sg2);
|
||||
}
|
||||
|
||||
int Lua_NPC::GetWaypointMax() {
|
||||
@@ -174,7 +174,7 @@ int Lua_NPC::GetGrid() {
|
||||
|
||||
uint32 Lua_NPC::GetSp2() {
|
||||
Lua_Safe_Call_Int();
|
||||
return self->GetSp2();
|
||||
return self->GetSpawnGroupId();
|
||||
}
|
||||
|
||||
int Lua_NPC::GetNPCFactionID() {
|
||||
@@ -529,6 +529,24 @@ int Lua_NPC::GetAvoidanceRating()
|
||||
return self->GetAvoidanceRating();
|
||||
}
|
||||
|
||||
void Lua_NPC::SetSimpleRoamBox(float box_size)
|
||||
{
|
||||
Lua_Safe_Call_Void();
|
||||
self->SetSimpleRoamBox(box_size);
|
||||
}
|
||||
|
||||
void Lua_NPC::SetSimpleRoamBox(float box_size, float move_distance)
|
||||
{
|
||||
Lua_Safe_Call_Void();
|
||||
self->SetSimpleRoamBox(box_size, move_distance);
|
||||
}
|
||||
|
||||
void Lua_NPC::SetSimpleRoamBox(float box_size, float move_distance, int move_delay)
|
||||
{
|
||||
Lua_Safe_Call_Void();
|
||||
self->SetSimpleRoamBox(box_size, move_distance, move_delay);
|
||||
}
|
||||
|
||||
luabind::scope lua_register_npc() {
|
||||
return luabind::class_<Lua_NPC, Lua_Mob>("NPC")
|
||||
.def(luabind::constructor<>())
|
||||
@@ -614,6 +632,9 @@ luabind::scope lua_register_npc() {
|
||||
.def("GetGuardPointZ", (float(Lua_NPC::*)(void))&Lua_NPC::GetGuardPointZ)
|
||||
.def("SetPrimSkill", (void(Lua_NPC::*)(int))&Lua_NPC::SetPrimSkill)
|
||||
.def("SetSecSkill", (void(Lua_NPC::*)(int))&Lua_NPC::SetSecSkill)
|
||||
.def("SetSimpleRoamBox", (void(Lua_NPC::*)(float))&Lua_NPC::SetSimpleRoamBox)
|
||||
.def("SetSimpleRoamBox", (void(Lua_NPC::*)(float, float))&Lua_NPC::SetSimpleRoamBox)
|
||||
.def("SetSimpleRoamBox", (void(Lua_NPC::*)(float, float, int))&Lua_NPC::SetSimpleRoamBox)
|
||||
.def("GetPrimSkill", (int(Lua_NPC::*)(void))&Lua_NPC::GetPrimSkill)
|
||||
.def("GetSecSkill", (int(Lua_NPC::*)(void))&Lua_NPC::GetSecSkill)
|
||||
.def("GetSwarmOwner", (int(Lua_NPC::*)(void))&Lua_NPC::GetSwarmOwner)
|
||||
|
||||
@@ -131,6 +131,9 @@ public:
|
||||
void MerchantCloseShop();
|
||||
int GetRawAC();
|
||||
int GetAvoidanceRating();
|
||||
void SetSimpleRoamBox(float box_size);
|
||||
void SetSimpleRoamBox(float box_size, float move_distance);
|
||||
void SetSimpleRoamBox(float box_size, float move_distance, int move_delay);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
+5
-3
@@ -1102,7 +1102,9 @@ void LuaParser::MapFunctions(lua_State *L) {
|
||||
lua_register_rules_const(),
|
||||
lua_register_rulei(),
|
||||
lua_register_ruler(),
|
||||
lua_register_ruleb()
|
||||
lua_register_ruleb(),
|
||||
lua_register_journal_speakmode(),
|
||||
lua_register_journal_mode()
|
||||
];
|
||||
|
||||
} catch(std::exception &ex) {
|
||||
@@ -1298,8 +1300,6 @@ QuestEventID LuaParser::ConvertLuaEvent(QuestEventID evt) {
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void LuaParser::MeleeMitigation(Mob *self, Mob *attacker, DamageHitInfo &hit, ExtraAttackOptions *opts, bool &ignoreDefault)
|
||||
{
|
||||
for (auto &mod : mods_) {
|
||||
@@ -1372,3 +1372,5 @@ uint32 LuaParser::GetExperienceForKill(Client *self, Mob *against, bool &ignoreD
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,3 +1,5 @@
|
||||
#ifdef LUA_EQEMU
|
||||
|
||||
#include "lua.hpp"
|
||||
#include <luabind/luabind.hpp>
|
||||
|
||||
@@ -333,6 +335,11 @@ int Lua_StatBonuses::Geteffective_casting_level() const {
|
||||
return self->effective_casting_level;
|
||||
}
|
||||
|
||||
int Lua_StatBonuses::Getadjusted_casting_skill() const {
|
||||
Lua_Safe_Call_Int();
|
||||
return self->adjusted_casting_skill;
|
||||
}
|
||||
|
||||
int Lua_StatBonuses::Getreflect_chance() const {
|
||||
Lua_Safe_Call_Int();
|
||||
return self->reflect_chance;
|
||||
@@ -1347,6 +1354,7 @@ luabind::scope lua_register_stat_bonuses() {
|
||||
.def("skillmod", &Lua_StatBonuses::Getskillmod)
|
||||
.def("skillmodmax", &Lua_StatBonuses::Getskillmodmax)
|
||||
.def("effective_casting_level", &Lua_StatBonuses::Geteffective_casting_level)
|
||||
.def("adjusted_casting_skill", &Lua_StatBonuses::Getadjusted_casting_skill)
|
||||
.def("reflect_chance", &Lua_StatBonuses::Getreflect_chance)
|
||||
.def("singingMod", &Lua_StatBonuses::GetsingingMod)
|
||||
.def("Amplification", &Lua_StatBonuses::GetAmplification)
|
||||
@@ -1536,4 +1544,6 @@ luabind::scope lua_register_stat_bonuses() {
|
||||
.def("Assassinate", &Lua_StatBonuses::GetAssassinate)
|
||||
.def("AssassinateLevel", &Lua_StatBonuses::GetAssassinateLevel)
|
||||
.def("ReduceTradeskillFail", &Lua_StatBonuses::GetReduceTradeskillFail);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -91,6 +91,7 @@ public:
|
||||
int32 Getskillmod(int idx) const;
|
||||
int32 Getskillmodmax(int idx) const;
|
||||
int Geteffective_casting_level() const;
|
||||
int Getadjusted_casting_skill() const;
|
||||
int Getreflect_chance() const;
|
||||
uint32 GetsingingMod() const;
|
||||
uint32 GetAmplification() const;
|
||||
|
||||
+103
-149
@@ -32,6 +32,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#include "../common/eq_stream_ident.h"
|
||||
#include "../common/patches/patches.h"
|
||||
#include "../common/rulesys.h"
|
||||
#include "../common/profanity_manager.h"
|
||||
#include "../common/misc_functions.h"
|
||||
#include "../common/string_util.h"
|
||||
#include "../common/platform.h"
|
||||
@@ -42,16 +43,15 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#include "../common/spdat.h"
|
||||
#include "../common/eqemu_logsys.h"
|
||||
|
||||
#include "api_service.h"
|
||||
#include "zone_config.h"
|
||||
#include "masterentity.h"
|
||||
#include "worldserver.h"
|
||||
#include "net.h"
|
||||
#include "zone.h"
|
||||
#include "queryserv.h"
|
||||
#include "command.h"
|
||||
#ifdef BOTS
|
||||
#include "bot_command.h"
|
||||
#include "bot_database.h"
|
||||
#endif
|
||||
#include "zone_config.h"
|
||||
#include "titles.h"
|
||||
@@ -66,6 +66,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#include "../common/event/event_loop.h"
|
||||
#include "../common/event/timer.h"
|
||||
#include "../common/net/eqstream.h"
|
||||
#include "../common/net/servertalk_server.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
@@ -94,7 +95,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
volatile bool RunLoops = true;
|
||||
extern volatile bool is_zone_loaded;
|
||||
|
||||
NetConnection net;
|
||||
EntityList entity_list;
|
||||
WorldServer worldserver;
|
||||
uint32 numclients = 0;
|
||||
@@ -113,6 +113,9 @@ const ZoneConfig *Config;
|
||||
double frame_time = 0.0;
|
||||
|
||||
void Shutdown();
|
||||
void UpdateWindowTitle(char* iNewTitle);
|
||||
void CatchSignal(int sig_num);
|
||||
|
||||
extern void MapOpcodes();
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
@@ -143,9 +146,9 @@ int main(int argc, char** argv) {
|
||||
|
||||
QServ = new QueryServ;
|
||||
|
||||
Log(Logs::General, Logs::Zone_Server, "Loading server configuration..");
|
||||
LogInfo("Loading server configuration..");
|
||||
if (!ZoneConfig::LoadConfig()) {
|
||||
Log(Logs::General, Logs::Error, "Loading server configuration failed.");
|
||||
LogError("Loading server configuration failed");
|
||||
return 1;
|
||||
}
|
||||
Config = ZoneConfig::get();
|
||||
@@ -223,31 +226,19 @@ int main(int argc, char** argv) {
|
||||
worldserver.SetLauncherName("NONE");
|
||||
}
|
||||
|
||||
Log(Logs::General, Logs::Zone_Server, "Connecting to MySQL...");
|
||||
LogInfo("Connecting to MySQL... ");
|
||||
if (!database.Connect(
|
||||
Config->DatabaseHost.c_str(),
|
||||
Config->DatabaseUsername.c_str(),
|
||||
Config->DatabasePassword.c_str(),
|
||||
Config->DatabaseDB.c_str(),
|
||||
Config->DatabasePort)) {
|
||||
Log(Logs::General, Logs::Error, "Cannot continue without a database connection.");
|
||||
LogError("Cannot continue without a database connection");
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifdef BOTS
|
||||
if (!botdb.Connect(
|
||||
Config->DatabaseHost.c_str(),
|
||||
Config->DatabaseUsername.c_str(),
|
||||
Config->DatabasePassword.c_str(),
|
||||
Config->DatabaseDB.c_str(),
|
||||
Config->DatabasePort)) {
|
||||
Log(Logs::General, Logs::Error, "Cannot continue without a bots database connection.");
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Register Log System and Settings */
|
||||
LogSys.OnLogHookCallBackZone(&Zone::GMSayHookCallBackProcess);
|
||||
LogSys.SetGMSayHandler(&Zone::GMSayHookCallBackProcess);
|
||||
database.LoadLogSettings(LogSys.log_settings);
|
||||
LogSys.StartFileLogs();
|
||||
|
||||
@@ -265,131 +256,135 @@ int main(int argc, char** argv) {
|
||||
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
|
||||
#endif
|
||||
|
||||
Log(Logs::General, Logs::Zone_Server, "CURRENT_VERSION: %s", CURRENT_VERSION);
|
||||
LogInfo("CURRENT_VERSION: {}", CURRENT_VERSION);
|
||||
|
||||
/*
|
||||
* Setup nice signal handlers
|
||||
*/
|
||||
if (signal(SIGINT, CatchSignal) == SIG_ERR) {
|
||||
Log(Logs::General, Logs::Error, "Could not set signal handler");
|
||||
LogError("Could not set signal handler");
|
||||
return 1;
|
||||
}
|
||||
if (signal(SIGTERM, CatchSignal) == SIG_ERR) {
|
||||
Log(Logs::General, Logs::Error, "Could not set signal handler");
|
||||
LogError("Could not set signal handler");
|
||||
return 1;
|
||||
}
|
||||
#ifndef WIN32
|
||||
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) {
|
||||
Log(Logs::General, Logs::Error, "Could not set signal handler");
|
||||
LogError("Could not set signal handler");
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
Log(Logs::General, Logs::Zone_Server, "Mapping Incoming Opcodes");
|
||||
LogInfo("Mapping Incoming Opcodes");
|
||||
MapOpcodes();
|
||||
|
||||
Log(Logs::General, Logs::Zone_Server, "Loading Variables");
|
||||
LogInfo("Loading Variables");
|
||||
database.LoadVariables();
|
||||
|
||||
std::string hotfix_name;
|
||||
if (database.GetVariable("hotfix_name", hotfix_name)) {
|
||||
if (!hotfix_name.empty()) {
|
||||
Log(Logs::General, Logs::Zone_Server, "Current hotfix in use: '%s'", hotfix_name.c_str());
|
||||
LogInfo("Current hotfix in use: [{}]", hotfix_name.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
Log(Logs::General, Logs::Zone_Server, "Loading zone names");
|
||||
LogInfo("Loading zone names");
|
||||
database.LoadZoneNames();
|
||||
|
||||
Log(Logs::General, Logs::Zone_Server, "Loading items");
|
||||
LogInfo("Loading items");
|
||||
if (!database.LoadItems(hotfix_name)) {
|
||||
Log(Logs::General, Logs::Error, "Loading items FAILED!");
|
||||
Log(Logs::General, Logs::Error, "Failed. But ignoring error and going on...");
|
||||
LogError("Loading items failed!");
|
||||
LogError("Failed. But ignoring error and going on..");
|
||||
}
|
||||
|
||||
Log(Logs::General, Logs::Zone_Server, "Loading npc faction lists");
|
||||
LogInfo("Loading npc faction lists");
|
||||
if (!database.LoadNPCFactionLists(hotfix_name)) {
|
||||
Log(Logs::General, Logs::Error, "Loading npcs faction lists FAILED!");
|
||||
LogError("Loading npcs faction lists failed!");
|
||||
return 1;
|
||||
}
|
||||
Log(Logs::General, Logs::Zone_Server, "Loading loot tables");
|
||||
LogInfo("Loading loot tables");
|
||||
if (!database.LoadLoot(hotfix_name)) {
|
||||
Log(Logs::General, Logs::Error, "Loading loot FAILED!");
|
||||
LogError("Loading loot failed!");
|
||||
return 1;
|
||||
}
|
||||
Log(Logs::General, Logs::Zone_Server, "Loading skill caps");
|
||||
LogInfo("Loading skill caps");
|
||||
if (!database.LoadSkillCaps(std::string(hotfix_name))) {
|
||||
Log(Logs::General, Logs::Error, "Loading skill caps FAILED!");
|
||||
LogError("Loading skill caps failed!");
|
||||
return 1;
|
||||
}
|
||||
|
||||
Log(Logs::General, Logs::Zone_Server, "Loading spells");
|
||||
LogInfo("Loading spells");
|
||||
if (!database.LoadSpells(hotfix_name, &SPDAT_RECORDS, &spells)) {
|
||||
Log(Logs::General, Logs::Error, "Loading spells FAILED!");
|
||||
LogError("Loading spells failed!");
|
||||
return 1;
|
||||
}
|
||||
|
||||
Log(Logs::General, Logs::Zone_Server, "Loading base data");
|
||||
LogInfo("Loading base data");
|
||||
if (!database.LoadBaseData(hotfix_name)) {
|
||||
Log(Logs::General, Logs::Error, "Loading base data FAILED!");
|
||||
LogError("Loading base data failed!");
|
||||
return 1;
|
||||
}
|
||||
|
||||
Log(Logs::General, Logs::Zone_Server, "Loading guilds");
|
||||
LogInfo("Loading guilds");
|
||||
guild_mgr.LoadGuilds();
|
||||
|
||||
Log(Logs::General, Logs::Zone_Server, "Loading factions");
|
||||
LogInfo("Loading factions");
|
||||
database.LoadFactionData();
|
||||
|
||||
Log(Logs::General, Logs::Zone_Server, "Loading titles");
|
||||
LogInfo("Loading titles");
|
||||
title_manager.LoadTitles();
|
||||
|
||||
Log(Logs::General, Logs::Zone_Server, "Loading tributes");
|
||||
LogInfo("Loading tributes");
|
||||
database.LoadTributes();
|
||||
|
||||
Log(Logs::General, Logs::Zone_Server, "Loading corpse timers");
|
||||
LogInfo("Loading corpse timers");
|
||||
database.GetDecayTimes(npcCorpseDecayTimes);
|
||||
|
||||
Log(Logs::General, Logs::Zone_Server, "Loading commands");
|
||||
LogInfo("Loading profanity list");
|
||||
if (!EQEmu::ProfanityManager::LoadProfanityList(&database))
|
||||
LogError("Loading profanity list failed!");
|
||||
|
||||
LogInfo("Loading commands");
|
||||
int retval = command_init();
|
||||
if (retval<0)
|
||||
Log(Logs::General, Logs::Error, "Command loading FAILED");
|
||||
LogError("Command loading failed");
|
||||
else
|
||||
Log(Logs::General, Logs::Zone_Server, "%d commands loaded", retval);
|
||||
LogInfo("{} commands loaded", retval);
|
||||
|
||||
//rules:
|
||||
{
|
||||
std::string tmp;
|
||||
if (database.GetVariable("RuleSet", tmp)) {
|
||||
Log(Logs::General, Logs::Zone_Server, "Loading rule set '%s'", tmp.c_str());
|
||||
LogInfo("Loading rule set [{}]", tmp.c_str());
|
||||
if (!RuleManager::Instance()->LoadRules(&database, tmp.c_str(), false)) {
|
||||
Log(Logs::General, Logs::Error, "Failed to load ruleset '%s', falling back to defaults.", tmp.c_str());
|
||||
LogError("Failed to load ruleset [{}], falling back to defaults", tmp.c_str());
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!RuleManager::Instance()->LoadRules(&database, "default", false)) {
|
||||
Log(Logs::General, Logs::Zone_Server, "No rule set configured, using default rules");
|
||||
LogInfo("No rule set configured, using default rules");
|
||||
}
|
||||
else {
|
||||
Log(Logs::General, Logs::Zone_Server, "Loaded default rule set 'default'", tmp.c_str());
|
||||
LogInfo("Loaded default rule set 'default'");
|
||||
}
|
||||
}
|
||||
|
||||
EQEmu::InitializeDynamicLookups();
|
||||
Log(Logs::General, Logs::Zone_Server, "Initialized dynamic dictionary entries");
|
||||
LogInfo("Initialized dynamic dictionary entries");
|
||||
}
|
||||
|
||||
#ifdef BOTS
|
||||
Log(Logs::General, Logs::Zone_Server, "Loading bot commands");
|
||||
LogInfo("Loading bot commands");
|
||||
int botretval = bot_command_init();
|
||||
if (botretval<0)
|
||||
Log(Logs::General, Logs::Error, "Bot command loading FAILED");
|
||||
LogError("Bot command loading failed");
|
||||
else
|
||||
Log(Logs::General, Logs::Zone_Server, "%d bot commands loaded", botretval);
|
||||
LogInfo("[{}] bot commands loaded", botretval);
|
||||
|
||||
Log(Logs::General, Logs::Zone_Server, "Loading bot spell casting chances");
|
||||
if (!botdb.LoadBotSpellCastingChances())
|
||||
Log(Logs::General, Logs::Error, "Bot spell casting chances loading FAILED");
|
||||
LogInfo("Loading bot spell casting chances");
|
||||
if (!database.botdb.LoadBotSpellCastingChances())
|
||||
LogError("Bot spell casting chances loading failed");
|
||||
#endif
|
||||
|
||||
if (RuleB(TaskSystem, EnableTaskSystem)) {
|
||||
@@ -413,7 +408,7 @@ int main(int argc, char** argv) {
|
||||
#endif
|
||||
|
||||
//now we have our parser, load the quests
|
||||
Log(Logs::General, Logs::Zone_Server, "Loading quests");
|
||||
LogInfo("Loading quests");
|
||||
parse->ReloadQuests();
|
||||
|
||||
worldserver.Connect();
|
||||
@@ -426,10 +421,10 @@ int main(int argc, char** argv) {
|
||||
#endif
|
||||
#endif
|
||||
if (!strlen(zone_name) || !strcmp(zone_name, ".")) {
|
||||
Log(Logs::General, Logs::Zone_Server, "Entering sleep mode");
|
||||
LogInfo("Entering sleep mode");
|
||||
}
|
||||
else if (!Zone::Bootup(database.GetZoneID(zone_name), instance_id, true)) {
|
||||
Log(Logs::General, Logs::Error, "Zone Bootup failed :: Zone::Bootup");
|
||||
LogError("Zone Bootup failed :: Zone::Bootup");
|
||||
zone = 0;
|
||||
}
|
||||
|
||||
@@ -438,37 +433,60 @@ int main(int argc, char** argv) {
|
||||
RegisterAllPatches(stream_identifier);
|
||||
|
||||
#ifndef WIN32
|
||||
Log(Logs::Detail, Logs::None, "Main thread running with thread id %d", pthread_self());
|
||||
LogDebug("Main thread running with thread id [{}]", pthread_self());
|
||||
#endif
|
||||
|
||||
bool worldwasconnected = worldserver.Connected();
|
||||
bool eqsf_open = false;
|
||||
bool websocker_server_opened = false;
|
||||
|
||||
Timer quest_timers(100);
|
||||
UpdateWindowTitle();
|
||||
bool worldwasconnected = worldserver.Connected();
|
||||
UpdateWindowTitle(nullptr);
|
||||
std::shared_ptr<EQStreamInterface> eqss;
|
||||
EQStreamInterface *eqsi;
|
||||
bool eqsf_open = false;
|
||||
std::unique_ptr<EQ::Net::EQStreamManager> eqsm;
|
||||
std::chrono::time_point<std::chrono::system_clock> frame_prev = std::chrono::system_clock::now();
|
||||
std::unique_ptr<EQ::Net::WebsocketServer> ws_server;
|
||||
|
||||
auto loop_fn = [&](EQ::Timer* t) {
|
||||
//Advance the timer to our current point in time
|
||||
Timer::SetCurrentTime();
|
||||
|
||||
//Calculate frame time
|
||||
/**
|
||||
* Calculate frame time
|
||||
*/
|
||||
std::chrono::time_point<std::chrono::system_clock> frame_now = std::chrono::system_clock::now();
|
||||
frame_time = std::chrono::duration_cast<std::chrono::duration<double>>(frame_now - frame_prev).count();
|
||||
frame_prev = frame_now;
|
||||
|
||||
if (!eqsf_open && Config->ZonePort != 0) {
|
||||
Log(Logs::General, Logs::Zone_Server, "Starting EQ Network server on port %d", Config->ZonePort);
|
||||
/**
|
||||
* Websocket server
|
||||
*/
|
||||
if (!websocker_server_opened && Config->ZonePort != 0) {
|
||||
LogInfo("Websocket Server listener started ([{}]:[{}])", Config->TelnetIP.c_str(), Config->ZonePort);
|
||||
ws_server.reset(new EQ::Net::WebsocketServer(Config->TelnetIP, Config->ZonePort));
|
||||
RegisterApiService(ws_server);
|
||||
websocker_server_opened = true;
|
||||
}
|
||||
|
||||
EQ::Net::EQStreamManagerOptions opts(Config->ZonePort, false, true);
|
||||
/**
|
||||
* EQStreamManager
|
||||
*/
|
||||
if (!eqsf_open && Config->ZonePort != 0) {
|
||||
LogInfo("Starting EQ Network server on port {}", Config->ZonePort);
|
||||
|
||||
EQStreamManagerInterfaceOptions opts(Config->ZonePort, false, RuleB(Network, CompressZoneStream));
|
||||
opts.daybreak_options.resend_delay_ms = RuleI(Network, ResendDelayBaseMS);
|
||||
opts.daybreak_options.resend_delay_factor = RuleR(Network, ResendDelayFactor);
|
||||
opts.daybreak_options.resend_delay_min = RuleI(Network, ResendDelayMinMS);
|
||||
opts.daybreak_options.resend_delay_max = RuleI(Network, ResendDelayMaxMS);
|
||||
opts.daybreak_options.outgoing_data_rate = RuleR(Network, ClientDataRate);
|
||||
eqsm.reset(new EQ::Net::EQStreamManager(opts));
|
||||
eqsf_open = true;
|
||||
|
||||
eqsm->OnNewConnection([&stream_identifier](std::shared_ptr<EQ::Net::EQStream> stream) {
|
||||
stream_identifier.AddStream(stream);
|
||||
LogF(Logs::Detail, Logs::World_Server, "New connection from IP {0}:{1}", stream->RemoteEndpoint(), ntohs(stream->GetRemotePort()));
|
||||
LogF(Logs::Detail, Logs::WorldServer, "New connection from IP {0}:{1}", stream->GetRemoteIP(), ntohs(stream->GetRemotePort()));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -480,7 +498,7 @@ int main(int argc, char** argv) {
|
||||
//now that we know what patch they are running, start up their client object
|
||||
struct in_addr in;
|
||||
in.s_addr = eqsi->GetRemoteIP();
|
||||
Log(Logs::Detail, Logs::World_Server, "New client from %s:%d", inet_ntoa(in), ntohs(eqsi->GetRemotePort()));
|
||||
LogInfo("New client from [{}]:[{}]", inet_ntoa(in), ntohs(eqsi->GetRemotePort()));
|
||||
auto client = new Client(eqsi);
|
||||
entity_list.AddClient(client);
|
||||
}
|
||||
@@ -490,30 +508,19 @@ int main(int argc, char** argv) {
|
||||
}
|
||||
else {
|
||||
if (worldwasconnected && is_zone_loaded) {
|
||||
entity_list.ChannelMessageFromWorld(0, 0, 6, 0, 0, "WARNING: World server connection lost");
|
||||
entity_list.ChannelMessageFromWorld(0, 0, ChatChannel_Broadcast, 0, 0, 100, "WARNING: World server connection lost");
|
||||
worldwasconnected = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_zone_loaded) {
|
||||
{
|
||||
if (net.group_timer.Enabled() && net.group_timer.Check())
|
||||
entity_list.GroupProcess();
|
||||
|
||||
if (net.door_timer.Enabled() && net.door_timer.Check())
|
||||
entity_list.DoorProcess();
|
||||
|
||||
if (net.object_timer.Enabled() && net.object_timer.Check())
|
||||
entity_list.ObjectProcess();
|
||||
|
||||
if (net.corpse_timer.Enabled() && net.corpse_timer.Check())
|
||||
entity_list.CorpseProcess();
|
||||
|
||||
if (net.trap_timer.Enabled() && net.trap_timer.Check())
|
||||
entity_list.TrapProcess();
|
||||
|
||||
if (net.raid_timer.Enabled() && net.raid_timer.Check())
|
||||
entity_list.RaidProcess();
|
||||
entity_list.GroupProcess();
|
||||
entity_list.DoorProcess();
|
||||
entity_list.ObjectProcess();
|
||||
entity_list.CorpseProcess();
|
||||
entity_list.TrapProcess();
|
||||
entity_list.RaidProcess();
|
||||
|
||||
entity_list.Process();
|
||||
entity_list.MobProcess();
|
||||
@@ -526,8 +533,9 @@ int main(int argc, char** argv) {
|
||||
}
|
||||
}
|
||||
|
||||
if (quest_timers.Check())
|
||||
if (quest_timers.Check()) {
|
||||
quest_manager.Process();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -584,14 +592,14 @@ int main(int argc, char** argv) {
|
||||
bot_command_deinit();
|
||||
#endif
|
||||
safe_delete(parse);
|
||||
Log(Logs::General, Logs::Zone_Server, "Proper zone shutdown complete.");
|
||||
LogInfo("Proper zone shutdown complete.");
|
||||
LogSys.CloseFileLogs();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CatchSignal(int sig_num) {
|
||||
#ifdef _WINDOWS
|
||||
Log(Logs::General, Logs::Zone_Server, "Recieved signal: %i", sig_num);
|
||||
LogInfo("Recieved signal: [{}]", sig_num);
|
||||
#endif
|
||||
RunLoops = false;
|
||||
}
|
||||
@@ -600,64 +608,10 @@ void Shutdown()
|
||||
{
|
||||
Zone::Shutdown(true);
|
||||
RunLoops = false;
|
||||
Log(Logs::General, Logs::Zone_Server, "Shutting down...");
|
||||
LogInfo("Shutting down...");
|
||||
LogSys.CloseFileLogs();
|
||||
}
|
||||
|
||||
uint32 NetConnection::GetIP()
|
||||
{
|
||||
char name[255 + 1];
|
||||
size_t len = 0;
|
||||
hostent* host = 0;
|
||||
|
||||
if (gethostname(name, len) < 0 || len <= 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
host = (hostent*)gethostbyname(name);
|
||||
if (host == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return inet_addr(host->h_addr);
|
||||
}
|
||||
|
||||
uint32 NetConnection::GetIP(char* name)
|
||||
{
|
||||
hostent* host = 0;
|
||||
|
||||
host = (hostent*)gethostbyname(name);
|
||||
if (host == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return inet_addr(host->h_addr);
|
||||
|
||||
}
|
||||
|
||||
NetConnection::NetConnection()
|
||||
:
|
||||
object_timer(5000),
|
||||
door_timer(5000),
|
||||
corpse_timer(2000),
|
||||
group_timer(1000),
|
||||
raid_timer(1000),
|
||||
trap_timer(1000)
|
||||
{
|
||||
group_timer.Disable();
|
||||
raid_timer.Disable();
|
||||
corpse_timer.Disable();
|
||||
door_timer.Disable();
|
||||
object_timer.Disable();
|
||||
trap_timer.Disable();
|
||||
}
|
||||
|
||||
NetConnection::~NetConnection() {
|
||||
}
|
||||
|
||||
/* Update Window Title with relevant information */
|
||||
void UpdateWindowTitle(char* iNewTitle) {
|
||||
#ifdef _WINDOWS
|
||||
+23
-23
@@ -223,7 +223,7 @@ Map *Map::LoadMapFile(std::string file) {
|
||||
filename += file;
|
||||
filename += ".map";
|
||||
|
||||
Log(Logs::General, Logs::Status, "Attempting to load Map File '%s'", filename.c_str());
|
||||
LogInfo("Attempting to load Map File [{}]", filename.c_str());
|
||||
|
||||
auto m = new Map();
|
||||
if (m->Load(filename)) {
|
||||
@@ -238,7 +238,7 @@ Map *Map::LoadMapFile(std::string file) {
|
||||
bool Map::Load(std::string filename, bool force_mmf_overwrite)
|
||||
{
|
||||
if (LoadMMF(filename, force_mmf_overwrite)) {
|
||||
Log(Logs::General, Logs::Status, "Loaded .MMF Map File in place of '%s'", filename.c_str());
|
||||
LogInfo("Loaded .MMF Map File in place of [{}]", filename.c_str());
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
@@ -255,7 +255,7 @@ bool Map::Load(std::string filename)
|
||||
}
|
||||
|
||||
if(version == 0x01000000) {
|
||||
Log(Logs::General, Logs::Status, "Loaded V1 Map File '%s'", filename.c_str());
|
||||
LogInfo("Loaded V1 Map File [{}]", filename.c_str());
|
||||
bool v = LoadV1(f);
|
||||
fclose(f);
|
||||
|
||||
@@ -266,7 +266,7 @@ bool Map::Load(std::string filename)
|
||||
|
||||
return v;
|
||||
} else if(version == 0x02000000) {
|
||||
Log(Logs::General, Logs::Status, "Loaded V2 Map File '%s'", filename.c_str());
|
||||
LogInfo("Loaded V2 Map File [{}]", filename.c_str());
|
||||
bool v = LoadV2(f);
|
||||
fclose(f);
|
||||
|
||||
@@ -943,53 +943,53 @@ bool Map::LoadMMF(const std::string& map_file_name, bool force_mmf_overwrite)
|
||||
std::string mmf_file_name = map_file_name;
|
||||
strip_map_extension(mmf_file_name);
|
||||
if (!add_mmf_extension(mmf_file_name)) {
|
||||
Log(Logs::General, Logs::Zone_Server, "Failed to load Map MMF file: '%s'", mmf_file_name.c_str());
|
||||
LogInfo("Failed to load Map MMF file: [{}]", mmf_file_name.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
FILE *f = fopen(mmf_file_name.c_str(), "rb");
|
||||
if (!f) {
|
||||
Log(Logs::General, Logs::Zone_Server, "Failed to load Map MMF file: '%s' - could not open file", mmf_file_name.c_str());
|
||||
LogInfo("Failed to load Map MMF file: [{}] - could not open file", mmf_file_name.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 file_version;
|
||||
if (fread(&file_version, sizeof(uint32), 1, f) != 1) {
|
||||
fclose(f);
|
||||
Log(Logs::General, Logs::Zone_Server, "Failed to load Map MMF file: '%s' - f@file_version", mmf_file_name.c_str());
|
||||
LogInfo("Failed to load Map MMF file: [{}] - f@file_version", mmf_file_name.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 rm_buffer_size;
|
||||
if (fread(&rm_buffer_size, sizeof(uint32), 1, f) != 1) {
|
||||
fclose(f);
|
||||
Log(Logs::General, Logs::Zone_Server, "Failed to load Map MMF file: '%s' - f@rm_buffer_size", mmf_file_name.c_str());
|
||||
LogInfo("Failed to load Map MMF file: [{}] - f@rm_buffer_size", mmf_file_name.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 rm_buffer_crc32;
|
||||
if (fread(&rm_buffer_crc32, sizeof(uint32), 1, f) != 1) {
|
||||
fclose(f);
|
||||
Log(Logs::General, Logs::Zone_Server, "Failed to load Map MMF file: '%s' - f@rm_buffer_crc32", mmf_file_name.c_str());
|
||||
LogInfo("Failed to load Map MMF file: [{}] - f@rm_buffer_crc32", mmf_file_name.c_str());
|
||||
return false;
|
||||
}
|
||||
if (rm_buffer_crc32 != /*crc32_check*/ 0) {
|
||||
fclose(f);
|
||||
Log(Logs::General, Logs::Zone_Server, "Failed to load Map MMF file: '%s' - bad rm_buffer checksum", mmf_file_name.c_str());
|
||||
LogInfo("Failed to load Map MMF file: [{}] - bad rm_buffer checksum", mmf_file_name.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 mmf_buffer_size;
|
||||
if (fread(&mmf_buffer_size, sizeof(uint32), 1, f) != 1) {
|
||||
fclose(f);
|
||||
Log(Logs::General, Logs::Zone_Server, "Failed to load Map MMF file: '%s' - f@mmf_buffer_size", mmf_file_name.c_str());
|
||||
LogInfo("Failed to load Map MMF file: [{}] - f@mmf_buffer_size", mmf_file_name.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<char> mmf_buffer(mmf_buffer_size);
|
||||
if (fread(mmf_buffer.data(), mmf_buffer_size, 1, f) != 1) {
|
||||
fclose(f);
|
||||
Log(Logs::General, Logs::Zone_Server, "Failed to load Map MMF file: '%s' - f@mmf_buffer", mmf_file_name.c_str());
|
||||
LogInfo("Failed to load Map MMF file: [{}] - f@mmf_buffer", mmf_file_name.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1016,7 +1016,7 @@ bool Map::LoadMMF(const std::string& map_file_name, bool force_mmf_overwrite)
|
||||
if (!imp->rm) {
|
||||
delete imp;
|
||||
imp = nullptr;
|
||||
Log(Logs::General, Logs::Zone_Server, "Failed to load Map MMF file: '%s' - null RaycastMesh", mmf_file_name.c_str());
|
||||
LogInfo("Failed to load Map MMF file: [{}] - null RaycastMesh", mmf_file_name.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1026,14 +1026,14 @@ bool Map::LoadMMF(const std::string& map_file_name, bool force_mmf_overwrite)
|
||||
bool Map::SaveMMF(const std::string& map_file_name, bool force_mmf_overwrite)
|
||||
{
|
||||
if (!imp || !imp->rm) {
|
||||
Log(Logs::General, Logs::Zone_Server, "Failed to save Map MMF file - No implementation (map_file_name: '%s')", map_file_name.c_str());
|
||||
LogInfo("Failed to save Map MMF file - No implementation (map_file_name: [{}])", map_file_name.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string mmf_file_name = map_file_name;
|
||||
strip_map_extension(mmf_file_name);
|
||||
if (!add_mmf_extension(mmf_file_name)) {
|
||||
Log(Logs::General, Logs::Zone_Server, "Failed to save Map MMF file: '%s'", mmf_file_name.c_str());
|
||||
LogInfo("Failed to save Map MMF file: [{}]", mmf_file_name.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1047,7 +1047,7 @@ bool Map::SaveMMF(const std::string& map_file_name, bool force_mmf_overwrite)
|
||||
std::vector<char> rm_buffer; // size set in MyRaycastMesh::serialize()
|
||||
serializeRaycastMesh(imp->rm, rm_buffer);
|
||||
if (rm_buffer.empty()) {
|
||||
Log(Logs::General, Logs::Zone_Server, "Failed to save Map MMF file: '%s' - empty RaycastMesh buffer", mmf_file_name.c_str());
|
||||
LogInfo("Failed to save Map MMF file: [{}] - empty RaycastMesh buffer", mmf_file_name.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1058,13 +1058,13 @@ bool Map::SaveMMF(const std::string& map_file_name, bool force_mmf_overwrite)
|
||||
|
||||
mmf_buffer_size = DeflateData(rm_buffer.data(), rm_buffer.size(), mmf_buffer.data(), mmf_buffer.size());
|
||||
if (!mmf_buffer_size) {
|
||||
Log(Logs::General, Logs::Zone_Server, "Failed to save Map MMF file: '%s' - null MMF buffer size", mmf_file_name.c_str());
|
||||
LogInfo("Failed to save Map MMF file: [{}] - null MMF buffer size", mmf_file_name.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
f = fopen(mmf_file_name.c_str(), "wb");
|
||||
if (!f) {
|
||||
Log(Logs::General, Logs::Zone_Server, "Failed to save Map MMF file: '%s' - could not open file", mmf_file_name.c_str());
|
||||
LogInfo("Failed to save Map MMF file: [{}] - could not open file", mmf_file_name.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1072,14 +1072,14 @@ bool Map::SaveMMF(const std::string& map_file_name, bool force_mmf_overwrite)
|
||||
if (fwrite(&file_version, sizeof(uint32), 1, f) != 1) {
|
||||
fclose(f);
|
||||
std::remove(mmf_file_name.c_str());
|
||||
Log(Logs::General, Logs::Zone_Server, "Failed to save Map MMF file: '%s' - f@file_version", mmf_file_name.c_str());
|
||||
LogInfo("Failed to save Map MMF file: [{}] - f@file_version", mmf_file_name.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (fwrite(&rm_buffer_size, sizeof(uint32), 1, f) != 1) {
|
||||
fclose(f);
|
||||
std::remove(mmf_file_name.c_str());
|
||||
Log(Logs::General, Logs::Zone_Server, "Failed to save Map MMF file: '%s' - f@rm_buffer_size", mmf_file_name.c_str());
|
||||
LogInfo("Failed to save Map MMF file: [{}] - f@rm_buffer_size", mmf_file_name.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1087,21 +1087,21 @@ bool Map::SaveMMF(const std::string& map_file_name, bool force_mmf_overwrite)
|
||||
if (fwrite(&rm_buffer_crc32, sizeof(uint32), 1, f) != 1) {
|
||||
fclose(f);
|
||||
std::remove(mmf_file_name.c_str());
|
||||
Log(Logs::General, Logs::Zone_Server, "Failed to save Map MMF file: '%s' - f@rm_buffer_crc32", mmf_file_name.c_str());
|
||||
LogInfo("Failed to save Map MMF file: [{}] - f@rm_buffer_crc32", mmf_file_name.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (fwrite(&mmf_buffer_size, sizeof(uint32), 1, f) != 1) {
|
||||
fclose(f);
|
||||
std::remove(mmf_file_name.c_str());
|
||||
Log(Logs::General, Logs::Zone_Server, "Failed to save Map MMF file: '%s' - f@mmf_buffer_size", mmf_file_name.c_str());
|
||||
LogInfo("Failed to save Map MMF file: [{}] - f@mmf_buffer_size", mmf_file_name.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (fwrite(mmf_buffer.data(), mmf_buffer_size, 1, f) != 1) {
|
||||
fclose(f);
|
||||
std::remove(mmf_file_name.c_str());
|
||||
Log(Logs::General, Logs::Zone_Server, "Failed to save Map MMF file: '%s' - f@mmf_buffer", mmf_file_name.c_str());
|
||||
LogInfo("Failed to save Map MMF file: [{}] - f@mmf_buffer", mmf_file_name.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
+30
-30
@@ -66,7 +66,7 @@ Merc::Merc(const NPCType* d, float x, float y, float z, float heading)
|
||||
memset(equipment, 0, sizeof(equipment));
|
||||
|
||||
SetMercID(0);
|
||||
SetStance(MercStanceBalanced);
|
||||
SetStance(EQEmu::constants::stanceBalanced);
|
||||
rest_timer.Disable();
|
||||
|
||||
if (GetClass() == ROGUE)
|
||||
@@ -891,7 +891,7 @@ int32 Merc::CalcMaxMana()
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
Log(Logs::General, Logs::None, "Invalid Class '%c' in CalcMaxMana", GetCasterClass());
|
||||
LogDebug("Invalid Class [{}] in CalcMaxMana", GetCasterClass());
|
||||
max_mana = 0;
|
||||
break;
|
||||
}
|
||||
@@ -912,7 +912,7 @@ int32 Merc::CalcMaxMana()
|
||||
}
|
||||
|
||||
#if EQDEBUG >= 11
|
||||
Log(Logs::General, Logs::None, "Merc::CalcMaxMana() called for %s - returning %d", GetName(), max_mana);
|
||||
LogDebug("Merc::CalcMaxMana() called for [{}] - returning [{}]", GetName(), max_mana);
|
||||
#endif
|
||||
return max_mana;
|
||||
}
|
||||
@@ -1618,7 +1618,7 @@ void Merc::AI_Process() {
|
||||
{
|
||||
if(zone->random.Roll(flurrychance))
|
||||
{
|
||||
Message_StringID(MT_NPCFlurry, YOU_FLURRY);
|
||||
MessageString(Chat::NPCFlurry, YOU_FLURRY);
|
||||
Attack(GetTarget(), EQEmu::invslot::slotPrimary, false);
|
||||
Attack(GetTarget(), EQEmu::invslot::slotPrimary, false);
|
||||
}
|
||||
@@ -1637,11 +1637,11 @@ void Merc::AI_Process() {
|
||||
// TODO: Do mercs berserk? Find this out on live...
|
||||
//if (GetClass() == WARRIOR || GetClass() == BERSERKER) {
|
||||
// if(GetHP() > 0 && !berserk && this->GetHPRatio() < 30) {
|
||||
// entity_list.MessageClose_StringID(this, false, 200, 0, BERSERK_START, GetName());
|
||||
// entity_list.MessageCloseString(this, false, 200, 0, BERSERK_START, GetName());
|
||||
// this->berserk = true;
|
||||
// }
|
||||
// if (berserk && this->GetHPRatio() > 30) {
|
||||
// entity_list.MessageClose_StringID(this, false, 200, 0, BERSERK_END, GetName());
|
||||
// entity_list.MessageCloseString(this, false, 200, 0, BERSERK_END, GetName());
|
||||
// this->berserk = false;
|
||||
// }
|
||||
//}
|
||||
@@ -1688,7 +1688,7 @@ void Merc::AI_Process() {
|
||||
if (AI_movement_timer->Check())
|
||||
{
|
||||
if(!IsRooted()) {
|
||||
Log(Logs::Detail, Logs::AI, "Pursuing %s while engaged.", GetTarget()->GetCleanName());
|
||||
LogAI("Pursuing [{}] while engaged", GetTarget()->GetCleanName());
|
||||
RunTo(GetTarget()->GetX(), GetTarget()->GetY(), GetTarget()->GetZ());
|
||||
return;
|
||||
}
|
||||
@@ -1807,7 +1807,7 @@ bool Merc::AI_EngagedCastCheck() {
|
||||
{
|
||||
AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting.
|
||||
|
||||
Log(Logs::Detail, Logs::AI, "Merc Engaged autocast check triggered");
|
||||
LogAI("Merc Engaged autocast check triggered");
|
||||
|
||||
int8 mercClass = GetClass();
|
||||
|
||||
@@ -1862,7 +1862,7 @@ bool Merc::AI_IdleCastCheck() {
|
||||
|
||||
if (AIautocastspell_timer->Check(false)) {
|
||||
#if MercAI_DEBUG_Spells >= 25
|
||||
Log(Logs::Detail, Logs::AI, "Merc Non-Engaged autocast check triggered: %s", this->GetCleanName());
|
||||
LogAI("Merc Non-Engaged autocast check triggered: [{}]", this->GetCleanName());
|
||||
#endif
|
||||
AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting.
|
||||
|
||||
@@ -1908,13 +1908,13 @@ bool Merc::AI_IdleCastCheck() {
|
||||
|
||||
bool EntityList::Merc_AICheckCloseBeneficialSpells(Merc* caster, uint8 iChance, float iRange, uint32 iSpellTypes) {
|
||||
|
||||
if((iSpellTypes&SpellTypes_Detrimental) != 0) {
|
||||
if((iSpellTypes & SPELL_TYPES_DETRIMENTAL) != 0) {
|
||||
//according to live, you can buff and heal through walls...
|
||||
//now with PCs, this only applies if you can TARGET the target, but
|
||||
// according to Rogean, Live NPCs will just cast through walls/floors, no problem..
|
||||
//
|
||||
// This check was put in to address an idle-mob CPU issue
|
||||
Log(Logs::General, Logs::Error, "Error: detrimental spells requested from AICheckCloseBeneficialSpells!!");
|
||||
LogError("Error: detrimental spells requested from AICheckCloseBeneficialSpells!!");
|
||||
return(false);
|
||||
}
|
||||
|
||||
@@ -2623,7 +2623,7 @@ int16 Merc::GetFocusEffect(focusType type, uint16 spell_id) {
|
||||
realTotal = CalcFocusEffect(type, UsedFocusID, spell_id);
|
||||
|
||||
if (realTotal != 0 && UsedItem)
|
||||
Message_StringID(MT_Spells, BEGINS_TO_GLOW, UsedItem->Name);
|
||||
MessageString(Chat::Spells, BEGINS_TO_GLOW, UsedItem->Name);
|
||||
}
|
||||
|
||||
//Check if spell focus effect exists for the client.
|
||||
@@ -3669,13 +3669,13 @@ MercSpell Merc::GetBestMercSpellForAENuke(Merc* caster, Mob* tar) {
|
||||
|
||||
switch(caster->GetStance())
|
||||
{
|
||||
case MercStanceBurnAE:
|
||||
case EQEmu::constants::stanceBurnAE:
|
||||
initialCastChance = 50;
|
||||
break;
|
||||
case MercStanceBalanced:
|
||||
case EQEmu::constants::stanceBalanced:
|
||||
initialCastChance = 25;
|
||||
break;
|
||||
case MercStanceBurn:
|
||||
case EQEmu::constants::stanceBurn:
|
||||
initialCastChance = 0;
|
||||
break;
|
||||
}
|
||||
@@ -3717,11 +3717,11 @@ MercSpell Merc::GetBestMercSpellForTargetedAENuke(Merc* caster, Mob* tar) {
|
||||
|
||||
switch(caster->GetStance())
|
||||
{
|
||||
case MercStanceBurnAE:
|
||||
case EQEmu::constants::stanceBurnAE:
|
||||
numTargetsCheck = 1;
|
||||
break;
|
||||
case MercStanceBalanced:
|
||||
case MercStanceBurn:
|
||||
case EQEmu::constants::stanceBalanced:
|
||||
case EQEmu::constants::stanceBurn:
|
||||
numTargetsCheck = 2;
|
||||
break;
|
||||
}
|
||||
@@ -3769,11 +3769,11 @@ MercSpell Merc::GetBestMercSpellForPBAENuke(Merc* caster, Mob* tar) {
|
||||
|
||||
switch(caster->GetStance())
|
||||
{
|
||||
case MercStanceBurnAE:
|
||||
case EQEmu::constants::stanceBurnAE:
|
||||
numTargetsCheck = 2;
|
||||
break;
|
||||
case MercStanceBalanced:
|
||||
case MercStanceBurn:
|
||||
case EQEmu::constants::stanceBalanced:
|
||||
case EQEmu::constants::stanceBurn:
|
||||
numTargetsCheck = 3;
|
||||
break;
|
||||
}
|
||||
@@ -3820,11 +3820,11 @@ MercSpell Merc::GetBestMercSpellForAERainNuke(Merc* caster, Mob* tar) {
|
||||
|
||||
switch(caster->GetStance())
|
||||
{
|
||||
case MercStanceBurnAE:
|
||||
case EQEmu::constants::stanceBurnAE:
|
||||
numTargetsCheck = 1;
|
||||
break;
|
||||
case MercStanceBalanced:
|
||||
case MercStanceBurn:
|
||||
case EQEmu::constants::stanceBalanced:
|
||||
case EQEmu::constants::stanceBurn:
|
||||
numTargetsCheck = 2;
|
||||
break;
|
||||
}
|
||||
@@ -4494,7 +4494,7 @@ bool Merc::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, boo
|
||||
{
|
||||
if (!other) {
|
||||
SetTarget(nullptr);
|
||||
Log(Logs::General, Logs::Error, "A null Mob object was passed to Merc::Attack() for evaluation!");
|
||||
LogError("A null Mob object was passed to Merc::Attack() for evaluation!");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -5321,10 +5321,10 @@ void Client::UpdateMercTimer()
|
||||
Log(Logs::General, Logs::Mercenaries, "UpdateMercTimer Complete for %s.", GetName());
|
||||
|
||||
// Normal upkeep charge message
|
||||
//Message(7, "You have been charged a mercenary upkeep cost of %i plat, and %i gold and your mercenary upkeep cost timer has been reset to 15 minutes.", upkeep_plat, upkeep_gold, (int)(RuleI(Mercs, UpkeepIntervalMS) / 1000 / 60));
|
||||
//Message(Chat::LightGray, "You have been charged a mercenary upkeep cost of %i plat, and %i gold and your mercenary upkeep cost timer has been reset to 15 minutes.", upkeep_plat, upkeep_gold, (int)(RuleI(Mercs, UpkeepIntervalMS) / 1000 / 60));
|
||||
|
||||
// Message below given when too low level to be charged
|
||||
//Message(7, "Your mercenary waived an upkeep cost of %i plat, and %i gold or %i %s and your mercenary upkeep cost timer has been reset to %i minutes", upkeep_plat, upkeep_gold, 1, "Bayle Marks", (int)(RuleI(Mercs, UpkeepIntervalMS) / 1000 / 60));
|
||||
//Message(Chat::LightGray, "Your mercenary waived an upkeep cost of %i plat, and %i gold or %i %s and your mercenary upkeep cost timer has been reset to %i minutes", upkeep_plat, upkeep_gold, 1, "Bayle Marks", (int)(RuleI(Mercs, UpkeepIntervalMS) / 1000 / 60));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5649,7 +5649,7 @@ void Client::SpawnMerc(Merc* merc, bool setMaxStats) {
|
||||
merc->SetSuspended(false);
|
||||
SetMerc(merc);
|
||||
merc->Unsuspend(setMaxStats);
|
||||
merc->SetStance(GetMercInfo().Stance);
|
||||
merc->SetStance((EQEmu::constants::StanceType)GetMercInfo().Stance);
|
||||
|
||||
Log(Logs::General, Logs::Mercenaries, "SpawnMerc Success for %s.", GetName());
|
||||
|
||||
@@ -6181,7 +6181,7 @@ void NPC::LoadMercTypes() {
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
{
|
||||
Log(Logs::General, Logs::Error, "Error in NPC::LoadMercTypes()");
|
||||
LogError("Error in NPC::LoadMercTypes()");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -6214,7 +6214,7 @@ void NPC::LoadMercs() {
|
||||
|
||||
if (!results.Success())
|
||||
{
|
||||
Log(Logs::General, Logs::Error, "Error in NPC::LoadMercTypes()");
|
||||
LogError("Error in NPC::LoadMercTypes()");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+3
-15
@@ -30,18 +30,6 @@ namespace EQEmu
|
||||
|
||||
const int MercAISpellRange = 100; // TODO: Write a method that calcs what the merc's spell range is based on spell, equipment, AA, whatever and replace this
|
||||
|
||||
enum MercStanceType {
|
||||
MercStancePassive = 1,
|
||||
MercStanceBalanced,
|
||||
MercStanceEfficient,
|
||||
MercStanceReactive,
|
||||
MercStanceAggressive,
|
||||
MercStanceAssist,
|
||||
MercStanceBurn,
|
||||
MercStanceEfficient2,
|
||||
MercStanceBurnAE
|
||||
};
|
||||
|
||||
struct MercSpell {
|
||||
uint16 spellid; // <= 0 = no spell
|
||||
uint32 type; // 0 = never, must be one (and only one) of the defined values
|
||||
@@ -175,7 +163,7 @@ public:
|
||||
uint8 GetTierID() { return _TierID; }
|
||||
uint32 GetCostFormula() { return _CostFormula; }
|
||||
uint32 GetMercNameType() { return _NameType; }
|
||||
uint32 GetStance() { return _currentStance; }
|
||||
EQEmu::constants::StanceType GetStance() { return _currentStance; }
|
||||
int GetHatedCount() { return _hatedCount; }
|
||||
|
||||
inline const uint8 GetClientVersion() const { return _OwnerClientVersion; }
|
||||
@@ -265,7 +253,7 @@ public:
|
||||
void SetMercNameType( uint8 nametype ) { _NameType = nametype; }
|
||||
void SetClientVersion(uint8 clientVersion) { _OwnerClientVersion = clientVersion; }
|
||||
void SetSuspended(bool suspended) { _suspended = suspended; }
|
||||
void SetStance( uint32 stance ) { _currentStance = stance; }
|
||||
void SetStance( EQEmu::constants::StanceType stance ) { _currentStance = stance; }
|
||||
void SetHatedCount( int count ) { _hatedCount = count; }
|
||||
|
||||
void Sit();
|
||||
@@ -385,7 +373,7 @@ private:
|
||||
uint8 _CostFormula;
|
||||
uint8 _NameType;
|
||||
uint8 _OwnerClientVersion;
|
||||
uint32 _currentStance;
|
||||
EQEmu::constants::StanceType _currentStance;
|
||||
|
||||
EQEmu::InventoryProfile m_inv;
|
||||
int32 max_end;
|
||||
|
||||
+189
-226
@@ -92,7 +92,8 @@ Mob::Mob(
|
||||
uint8 in_bracertexture,
|
||||
uint8 in_handtexture,
|
||||
uint8 in_legtexture,
|
||||
uint8 in_feettexture
|
||||
uint8 in_feettexture,
|
||||
uint16 in_usemodel
|
||||
) :
|
||||
attack_timer(2000),
|
||||
attack_dw_timer(2000),
|
||||
@@ -147,6 +148,7 @@ Mob::Mob(
|
||||
race = in_race;
|
||||
base_gender = in_gender;
|
||||
base_race = in_race;
|
||||
use_model = in_usemodel;
|
||||
class_ = in_class;
|
||||
bodytype = in_bodytype;
|
||||
orig_bodytype = in_bodytype;
|
||||
@@ -1112,7 +1114,7 @@ void Mob::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho)
|
||||
ns->spawn.spawnId = GetID();
|
||||
ns->spawn.curHp = static_cast<uint8>(GetHPRatio());
|
||||
ns->spawn.max_hp = 100; //this field needs a better name
|
||||
ns->spawn.race = race;
|
||||
ns->spawn.race = (use_model) ? use_model : race;
|
||||
ns->spawn.runspeed = runspeed;
|
||||
ns->spawn.walkspeed = walkspeed;
|
||||
ns->spawn.class_ = class_;
|
||||
@@ -1126,7 +1128,10 @@ void Mob::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho)
|
||||
UpdateActiveLight();
|
||||
ns->spawn.light = m_Light.Type[EQEmu::lightsource::LightActive];
|
||||
|
||||
ns->spawn.showhelm = (helmtexture && helmtexture != 0xFF) ? 1 : 0;
|
||||
if (IsNPC() && race == ERUDITE)
|
||||
ns->spawn.showhelm = 1;
|
||||
else
|
||||
ns->spawn.showhelm = (helmtexture && helmtexture != 0xFF) ? 1 : 0;
|
||||
|
||||
ns->spawn.invis = (invisible || hidden) ? 1 : 0; // TODO: load this before spawning players
|
||||
ns->spawn.NPC = IsClient() ? 0 : 1;
|
||||
@@ -1317,7 +1322,7 @@ void Mob::SendHPUpdate(bool skip_self /*= false*/, bool force_update_all /*= fal
|
||||
* This is to prevent excessive packet sending under trains/fast combat
|
||||
*/
|
||||
if (this->CastToClient()->hp_self_update_throttle_timer.Check() || force_update_all) {
|
||||
Log(Logs::General, Logs::HP_Update,
|
||||
Log(Logs::General, Logs::HPUpdate,
|
||||
"Mob::SendHPUpdate :: Update HP of self (%s) HP: %i last: %i skip_self: %s",
|
||||
this->GetCleanName(),
|
||||
current_hp,
|
||||
@@ -1351,14 +1356,14 @@ void Mob::SendHPUpdate(bool skip_self /*= false*/, bool force_update_all /*= fal
|
||||
int8 current_hp_percent = static_cast<int8>(max_hp == 0 ? 0 : static_cast<int>(current_hp * 100 / max_hp));
|
||||
|
||||
Log(Logs::General,
|
||||
Logs::HP_Update,
|
||||
Logs::HPUpdate,
|
||||
"Mob::SendHPUpdate :: SendHPUpdate %s HP is %i last %i",
|
||||
this->GetCleanName(),
|
||||
current_hp_percent,
|
||||
last_hp_percent);
|
||||
|
||||
if (current_hp_percent == last_hp_percent && !force_update_all) {
|
||||
Log(Logs::General, Logs::HP_Update, "Mob::SendHPUpdate :: Same HP - skipping update");
|
||||
Log(Logs::General, Logs::HPUpdate, "Mob::SendHPUpdate :: Same HP - skipping update");
|
||||
ResetHPUpdateTimer();
|
||||
return;
|
||||
}
|
||||
@@ -1368,7 +1373,7 @@ void Mob::SendHPUpdate(bool skip_self /*= false*/, bool force_update_all /*= fal
|
||||
this->CastToClient()->SendHPUpdateMarquee();
|
||||
}
|
||||
|
||||
Log(Logs::General, Logs::HP_Update, "Mob::SendHPUpdate :: HP Changed - Send update");
|
||||
Log(Logs::General, Logs::HPUpdate, "Mob::SendHPUpdate :: HP Changed - Send update");
|
||||
|
||||
last_hp_percent = current_hp_percent;
|
||||
}
|
||||
@@ -1430,6 +1435,25 @@ void Mob::SendHPUpdate(bool skip_self /*= false*/, bool force_update_all /*= fal
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef BOTS
|
||||
if (GetOwner() && GetOwner()->IsBot() && GetOwner()->CastToBot()->GetBotOwner() && GetOwner()->CastToBot()->GetBotOwner()->IsClient()) {
|
||||
auto bot_owner = GetOwner()->CastToBot()->GetBotOwner()->CastToClient();
|
||||
if (bot_owner) {
|
||||
bot_owner->QueuePacket(&hp_packet, false);
|
||||
group = entity_list.GetGroupByClient(bot_owner);
|
||||
|
||||
if (group) {
|
||||
group->SendHPPacketsFrom(this);
|
||||
}
|
||||
|
||||
Raid *raid = entity_list.GetRaidByClient(bot_owner);
|
||||
if (raid) {
|
||||
raid->SendHPManaEndPacketsFrom(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (GetPet() && GetPet()->IsClient()) {
|
||||
GetPet()->CastToClient()->QueuePacket(&hp_packet, false);
|
||||
}
|
||||
@@ -1546,39 +1570,39 @@ void Mob::ShowStats(Client* client)
|
||||
}
|
||||
else if (IsCorpse()) {
|
||||
if (IsPlayerCorpse()) {
|
||||
client->Message(0, " CharID: %i PlayerCorpse: %i", CastToCorpse()->GetCharID(), CastToCorpse()->GetCorpseDBID());
|
||||
client->Message(Chat::White, " CharID: %i PlayerCorpse: %i", CastToCorpse()->GetCharID(), CastToCorpse()->GetCorpseDBID());
|
||||
}
|
||||
else {
|
||||
client->Message(0, " NPCCorpse", GetID());
|
||||
client->Message(Chat::White, " NPCCorpse", GetID());
|
||||
}
|
||||
}
|
||||
else {
|
||||
client->Message(0, " Level: %i AC: %i Class: %i Size: %1.1f Haste: %i", GetLevel(), GetAC(), GetClass(), GetSize(), GetHaste());
|
||||
client->Message(0, " HP: %i Max HP: %i",GetHP(), GetMaxHP());
|
||||
client->Message(0, " Mana: %i Max Mana: %i", GetMana(), GetMaxMana());
|
||||
client->Message(0, " Total ATK: %i Worn/Spell ATK (Cap %i): %i", GetATK(), RuleI(Character, ItemATKCap), GetATKBonus());
|
||||
client->Message(0, " STR: %i STA: %i DEX: %i AGI: %i INT: %i WIS: %i CHA: %i", GetSTR(), GetSTA(), GetDEX(), GetAGI(), GetINT(), GetWIS(), GetCHA());
|
||||
client->Message(0, " MR: %i PR: %i FR: %i CR: %i DR: %i Corruption: %i PhR: %i", GetMR(), GetPR(), GetFR(), GetCR(), GetDR(), GetCorrup(), GetPhR());
|
||||
client->Message(0, " Race: %i BaseRace: %i Texture: %i HelmTexture: %i Gender: %i BaseGender: %i", GetRace(), GetBaseRace(), GetTexture(), GetHelmTexture(), GetGender(), GetBaseGender());
|
||||
client->Message(Chat::White, " Level: %i AC: %i Class: %i Size: %1.1f Haste: %i", GetLevel(), ACSum(), GetClass(), GetSize(), GetHaste());
|
||||
client->Message(Chat::White, " HP: %i Max HP: %i",GetHP(), GetMaxHP());
|
||||
client->Message(Chat::White, " Mana: %i Max Mana: %i", GetMana(), GetMaxMana());
|
||||
client->Message(Chat::White, " Total ATK: %i Worn/Spell ATK (Cap %i): %i", GetATK(), RuleI(Character, ItemATKCap), GetATKBonus());
|
||||
client->Message(Chat::White, " STR: %i STA: %i DEX: %i AGI: %i INT: %i WIS: %i CHA: %i", GetSTR(), GetSTA(), GetDEX(), GetAGI(), GetINT(), GetWIS(), GetCHA());
|
||||
client->Message(Chat::White, " MR: %i PR: %i FR: %i CR: %i DR: %i Corruption: %i PhR: %i", GetMR(), GetPR(), GetFR(), GetCR(), GetDR(), GetCorrup(), GetPhR());
|
||||
client->Message(Chat::White, " Race: %i BaseRace: %i Texture: %i HelmTexture: %i Gender: %i BaseGender: %i", GetRace(), GetBaseRace(), GetTexture(), GetHelmTexture(), GetGender(), GetBaseGender());
|
||||
if (client->Admin() >= 100)
|
||||
client->Message(0, " EntityID: %i PetID: %i OwnerID: %i AIControlled: %i Targetted: %i", GetID(), GetPetID(), GetOwnerID(), IsAIControlled(), targeted);
|
||||
client->Message(Chat::White, " EntityID: %i PetID: %i OwnerID: %i AIControlled: %i Targetted: %i", GetID(), GetPetID(), GetOwnerID(), IsAIControlled(), targeted);
|
||||
|
||||
if (IsNPC()) {
|
||||
NPC *n = CastToNPC();
|
||||
uint32 spawngroupid = 0;
|
||||
if(n->respawn2 != 0)
|
||||
spawngroupid = n->respawn2->SpawnGroupID();
|
||||
client->Message(0, " NPCID: %u SpawnGroupID: %u Grid: %i LootTable: %u FactionID: %i SpellsID: %u ", GetNPCTypeID(),spawngroupid, n->GetGrid(), n->GetLoottableID(), n->GetNPCFactionID(), n->GetNPCSpellsID());
|
||||
client->Message(0, " Accuracy: %i MerchantID: %i EmoteID: %i Runspeed: %.3f Walkspeed: %.3f", n->GetAccuracyRating(), n->MerchantType, n->GetEmoteID(), static_cast<float>(0.025f * n->GetRunspeed()), static_cast<float>(0.025f * n->GetWalkspeed()));
|
||||
client->Message(Chat::White, " NPCID: %u SpawnGroupID: %u Grid: %i LootTable: %u FactionID: %i SpellsID: %u ", GetNPCTypeID(),spawngroupid, n->GetGrid(), n->GetLoottableID(), n->GetNPCFactionID(), n->GetNPCSpellsID());
|
||||
client->Message(Chat::White, " Accuracy: %i MerchantID: %i EmoteID: %i Runspeed: %.3f Walkspeed: %.3f", n->GetAccuracyRating(), n->MerchantType, n->GetEmoteID(), static_cast<float>(0.025f * n->GetRunspeed()), static_cast<float>(0.025f * n->GetWalkspeed()));
|
||||
n->QueryLoot(client);
|
||||
}
|
||||
if (IsAIControlled()) {
|
||||
client->Message(0, " AggroRange: %1.0f AssistRange: %1.0f", GetAggroRange(), GetAssistRange());
|
||||
client->Message(Chat::White, " AggroRange: %1.0f AssistRange: %1.0f", GetAggroRange(), GetAssistRange());
|
||||
}
|
||||
|
||||
client->Message(0, " compute_tohit: %i TotalToHit: %i", compute_tohit(EQEmu::skills::SkillHandtoHand), GetTotalToHit(EQEmu::skills::SkillHandtoHand, 0));
|
||||
client->Message(0, " compute_defense: %i TotalDefense: %i", compute_defense(), GetTotalDefense());
|
||||
client->Message(0, " offense: %i mitigation ac: %i", offense(EQEmu::skills::SkillHandtoHand), GetMitigationAC());
|
||||
client->Message(Chat::White, " compute_tohit: %i TotalToHit: %i", compute_tohit(EQEmu::skills::SkillHandtoHand), GetTotalToHit(EQEmu::skills::SkillHandtoHand, 0));
|
||||
client->Message(Chat::White, " compute_defense: %i TotalDefense: %i", compute_defense(), GetTotalDefense());
|
||||
client->Message(Chat::White, " offense: %i mitigation ac: %i", offense(EQEmu::skills::SkillHandtoHand), GetMitigationAC());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1615,33 +1639,33 @@ void Mob::DoAnim(const int animnum, int type, bool ackreq, eqFilterType filter)
|
||||
void Mob::ShowBuffs(Client* client) {
|
||||
if(SPDAT_RECORDS <= 0)
|
||||
return;
|
||||
client->Message(0, "Buffs on: %s", this->GetName());
|
||||
client->Message(Chat::White, "Buffs on: %s", this->GetName());
|
||||
uint32 i;
|
||||
uint32 buff_count = GetMaxTotalSlots();
|
||||
for (i=0; i < buff_count; i++) {
|
||||
if (buffs[i].spellid != SPELL_UNKNOWN) {
|
||||
if (spells[buffs[i].spellid].buffdurationformula == DF_Permanent)
|
||||
client->Message(0, " %i: %s: Permanent", i, spells[buffs[i].spellid].name);
|
||||
client->Message(Chat::White, " %i: %s: Permanent", i, spells[buffs[i].spellid].name);
|
||||
else
|
||||
client->Message(0, " %i: %s: %i tics left", i, spells[buffs[i].spellid].name, buffs[i].ticsremaining);
|
||||
client->Message(Chat::White, " %i: %s: %i tics left", i, spells[buffs[i].spellid].name, buffs[i].ticsremaining);
|
||||
|
||||
}
|
||||
}
|
||||
if (IsClient()){
|
||||
client->Message(0, "itembonuses:");
|
||||
client->Message(0, "Atk:%i Ac:%i HP(%i):%i Mana:%i", itembonuses.ATK, itembonuses.AC, itembonuses.HPRegen, itembonuses.HP, itembonuses.Mana);
|
||||
client->Message(0, "Str:%i Sta:%i Dex:%i Agi:%i Int:%i Wis:%i Cha:%i",
|
||||
client->Message(Chat::White, "itembonuses:");
|
||||
client->Message(Chat::White, "Atk:%i Ac:%i HP(%i):%i Mana:%i", itembonuses.ATK, itembonuses.AC, itembonuses.HPRegen, itembonuses.HP, itembonuses.Mana);
|
||||
client->Message(Chat::White, "Str:%i Sta:%i Dex:%i Agi:%i Int:%i Wis:%i Cha:%i",
|
||||
itembonuses.STR,itembonuses.STA,itembonuses.DEX,itembonuses.AGI,itembonuses.INT,itembonuses.WIS,itembonuses.CHA);
|
||||
client->Message(0, "SvMagic:%i SvFire:%i SvCold:%i SvPoison:%i SvDisease:%i",
|
||||
client->Message(Chat::White, "SvMagic:%i SvFire:%i SvCold:%i SvPoison:%i SvDisease:%i",
|
||||
itembonuses.MR,itembonuses.FR,itembonuses.CR,itembonuses.PR,itembonuses.DR);
|
||||
client->Message(0, "DmgShield:%i Haste:%i", itembonuses.DamageShield, itembonuses.haste );
|
||||
client->Message(0, "spellbonuses:");
|
||||
client->Message(0, "Atk:%i Ac:%i HP(%i):%i Mana:%i", spellbonuses.ATK, spellbonuses.AC, spellbonuses.HPRegen, spellbonuses.HP, spellbonuses.Mana);
|
||||
client->Message(0, "Str:%i Sta:%i Dex:%i Agi:%i Int:%i Wis:%i Cha:%i",
|
||||
client->Message(Chat::White, "DmgShield:%i Haste:%i", itembonuses.DamageShield, itembonuses.haste );
|
||||
client->Message(Chat::White, "spellbonuses:");
|
||||
client->Message(Chat::White, "Atk:%i Ac:%i HP(%i):%i Mana:%i", spellbonuses.ATK, spellbonuses.AC, spellbonuses.HPRegen, spellbonuses.HP, spellbonuses.Mana);
|
||||
client->Message(Chat::White, "Str:%i Sta:%i Dex:%i Agi:%i Int:%i Wis:%i Cha:%i",
|
||||
spellbonuses.STR,spellbonuses.STA,spellbonuses.DEX,spellbonuses.AGI,spellbonuses.INT,spellbonuses.WIS,spellbonuses.CHA);
|
||||
client->Message(0, "SvMagic:%i SvFire:%i SvCold:%i SvPoison:%i SvDisease:%i",
|
||||
client->Message(Chat::White, "SvMagic:%i SvFire:%i SvCold:%i SvPoison:%i SvDisease:%i",
|
||||
spellbonuses.MR,spellbonuses.FR,spellbonuses.CR,spellbonuses.PR,spellbonuses.DR);
|
||||
client->Message(0, "DmgShield:%i Haste:%i", spellbonuses.DamageShield, spellbonuses.haste );
|
||||
client->Message(Chat::White, "DmgShield:%i Haste:%i", spellbonuses.DamageShield, spellbonuses.haste );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1649,15 +1673,15 @@ void Mob::ShowBuffList(Client* client) {
|
||||
if(SPDAT_RECORDS <= 0)
|
||||
return;
|
||||
|
||||
client->Message(0, "Buffs on: %s", this->GetCleanName());
|
||||
client->Message(Chat::White, "Buffs on: %s", this->GetCleanName());
|
||||
uint32 i;
|
||||
uint32 buff_count = GetMaxTotalSlots();
|
||||
for (i = 0; i < buff_count; i++) {
|
||||
if (buffs[i].spellid != SPELL_UNKNOWN) {
|
||||
if (spells[buffs[i].spellid].buffdurationformula == DF_Permanent)
|
||||
client->Message(0, " %i: %s: Permanent", i, spells[buffs[i].spellid].name);
|
||||
client->Message(Chat::White, " %i: %s: Permanent", i, spells[buffs[i].spellid].name);
|
||||
else
|
||||
client->Message(0, " %i: %s: %i tics left", i, spells[buffs[i].spellid].name, buffs[i].ticsremaining);
|
||||
client->Message(Chat::White, " %i: %s: %i tics left", i, spells[buffs[i].spellid].name, buffs[i].ticsremaining);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1692,151 +1716,74 @@ void Mob::SendIllusionPacket(
|
||||
float in_size
|
||||
)
|
||||
{
|
||||
uint8 new_texture = in_texture;
|
||||
uint8 new_helmtexture = in_helmtexture;
|
||||
uint8 new_haircolor;
|
||||
uint8 new_beardcolor;
|
||||
uint8 new_eyecolor1;
|
||||
uint8 new_eyecolor2;
|
||||
uint8 new_hairstyle;
|
||||
uint8 new_luclinface;
|
||||
uint8 new_beard;
|
||||
uint8 new_aa_title;
|
||||
uint32 new_drakkin_heritage;
|
||||
uint32 new_drakkin_tattoo;
|
||||
uint32 new_drakkin_details;
|
||||
|
||||
uint16 BaseRace = GetBaseRace();
|
||||
race = (in_race) ? in_race : GetBaseRace();
|
||||
|
||||
if (in_race == 0) {
|
||||
race = BaseRace;
|
||||
if (in_gender == 0xFF) {
|
||||
gender = GetBaseGender();
|
||||
if (in_gender != 0xFF)
|
||||
{
|
||||
gender = in_gender;
|
||||
}
|
||||
else {
|
||||
gender = in_gender;
|
||||
else
|
||||
{
|
||||
gender = (in_race) ? GetDefaultGender(race, gender) : GetBaseGender();
|
||||
}
|
||||
}
|
||||
else {
|
||||
race = in_race;
|
||||
if (in_gender == 0xFF) {
|
||||
gender = GetDefaultGender(race, gender);
|
||||
|
||||
if (in_texture == 0xFF && !IsPlayerRace(in_race))
|
||||
{
|
||||
new_texture = GetTexture();
|
||||
}
|
||||
else {
|
||||
gender = in_gender;
|
||||
|
||||
if (in_helmtexture == 0xFF && !IsPlayerRace(in_race))
|
||||
{
|
||||
new_helmtexture = GetHelmTexture();
|
||||
}
|
||||
}
|
||||
|
||||
if (in_texture == 0xFF) {
|
||||
if (IsPlayerRace(in_race)) {
|
||||
texture = 0xFF;
|
||||
}
|
||||
else {
|
||||
texture = GetTexture();
|
||||
}
|
||||
}
|
||||
else {
|
||||
texture = in_texture;
|
||||
}
|
||||
|
||||
if (in_helmtexture == 0xFF) {
|
||||
if (IsPlayerRace(in_race)) {
|
||||
helmtexture = 0xFF;
|
||||
}
|
||||
else if (in_texture != 0xFF) {
|
||||
helmtexture = in_texture;
|
||||
}
|
||||
else {
|
||||
helmtexture = GetHelmTexture();
|
||||
}
|
||||
}
|
||||
else {
|
||||
helmtexture = in_helmtexture;
|
||||
}
|
||||
|
||||
if (in_haircolor == 0xFF) {
|
||||
haircolor = GetHairColor();
|
||||
}
|
||||
else {
|
||||
haircolor = in_haircolor;
|
||||
}
|
||||
|
||||
if (in_beardcolor == 0xFF) {
|
||||
beardcolor = GetBeardColor();
|
||||
}
|
||||
else {
|
||||
beardcolor = in_beardcolor;
|
||||
}
|
||||
|
||||
if (in_eyecolor1 == 0xFF) {
|
||||
eyecolor1 = GetEyeColor1();
|
||||
}
|
||||
else {
|
||||
eyecolor1 = in_eyecolor1;
|
||||
}
|
||||
|
||||
if (in_eyecolor2 == 0xFF) {
|
||||
eyecolor2 = GetEyeColor2();
|
||||
}
|
||||
else {
|
||||
eyecolor2 = in_eyecolor2;
|
||||
}
|
||||
|
||||
if (in_hairstyle == 0xFF) {
|
||||
hairstyle = GetHairStyle();
|
||||
}
|
||||
else {
|
||||
hairstyle = in_hairstyle;
|
||||
}
|
||||
|
||||
if (in_luclinface == 0xFF) {
|
||||
luclinface = GetLuclinFace();
|
||||
}
|
||||
else {
|
||||
luclinface = in_luclinface;
|
||||
}
|
||||
|
||||
if (in_beard == 0xFF) {
|
||||
beard = GetBeard();
|
||||
}
|
||||
else {
|
||||
beard = in_beard;
|
||||
}
|
||||
|
||||
aa_title = in_aa_title;
|
||||
|
||||
if (in_drakkin_heritage == 0xFFFFFFFF) {
|
||||
drakkin_heritage = GetDrakkinHeritage();
|
||||
}
|
||||
else {
|
||||
drakkin_heritage = in_drakkin_heritage;
|
||||
}
|
||||
|
||||
if (in_drakkin_tattoo == 0xFFFFFFFF) {
|
||||
drakkin_tattoo = GetDrakkinTattoo();
|
||||
}
|
||||
else {
|
||||
drakkin_tattoo = in_drakkin_tattoo;
|
||||
}
|
||||
|
||||
if (in_drakkin_details == 0xFFFFFFFF) {
|
||||
drakkin_details = GetDrakkinDetails();
|
||||
}
|
||||
else {
|
||||
drakkin_details = in_drakkin_details;
|
||||
}
|
||||
|
||||
if (in_size <= 0.0f) {
|
||||
size = GetSize();
|
||||
}
|
||||
else {
|
||||
size = in_size;
|
||||
}
|
||||
new_haircolor = (in_haircolor == 0xFF) ? GetHairColor() : in_haircolor;
|
||||
new_beardcolor = (in_beardcolor == 0xFF) ? GetBeardColor() : in_beardcolor;
|
||||
new_eyecolor1 = (in_eyecolor1 == 0xFF) ? GetEyeColor1() : in_eyecolor1;
|
||||
new_eyecolor2 = (in_eyecolor2 == 0xFF) ? GetEyeColor2() : in_eyecolor2;
|
||||
new_hairstyle = (in_hairstyle == 0xFF) ? GetHairStyle() : in_hairstyle;
|
||||
new_luclinface = (in_luclinface == 0xFF) ? GetLuclinFace() : in_luclinface;
|
||||
new_beard = (in_beard == 0xFF) ? GetBeard() : in_beard;
|
||||
new_drakkin_heritage =
|
||||
(in_drakkin_heritage == 0xFFFFFFFF) ? GetDrakkinHeritage() : in_drakkin_heritage;
|
||||
new_drakkin_tattoo =
|
||||
(in_drakkin_tattoo == 0xFFFFFFFF) ? GetDrakkinTattoo() : in_drakkin_tattoo;
|
||||
new_drakkin_details =
|
||||
(in_drakkin_details == 0xFFFFFFFF) ? GetDrakkinDetails() : in_drakkin_details;
|
||||
new_aa_title = in_aa_title;
|
||||
size = (in_size <= 0.0f) ? GetSize() : in_size;
|
||||
|
||||
// Reset features to Base from the Player Profile
|
||||
if (IsClient() && in_race == 0) {
|
||||
race = CastToClient()->GetBaseRace();
|
||||
gender = CastToClient()->GetBaseGender();
|
||||
texture = 0xFF;
|
||||
helmtexture = 0xFF;
|
||||
haircolor = CastToClient()->GetBaseHairColor();
|
||||
beardcolor = CastToClient()->GetBaseBeardColor();
|
||||
eyecolor1 = CastToClient()->GetBaseEyeColor();
|
||||
eyecolor2 = CastToClient()->GetBaseEyeColor();
|
||||
hairstyle = CastToClient()->GetBaseHairStyle();
|
||||
luclinface = CastToClient()->GetBaseFace();
|
||||
beard = CastToClient()->GetBaseBeard();
|
||||
aa_title = 0xFF;
|
||||
drakkin_heritage = CastToClient()->GetBaseHeritage();
|
||||
drakkin_tattoo = CastToClient()->GetBaseTattoo();
|
||||
drakkin_details = CastToClient()->GetBaseDetails();
|
||||
race = CastToClient()->GetBaseRace();
|
||||
gender = CastToClient()->GetBaseGender();
|
||||
new_texture = texture = 0xFF;
|
||||
new_helmtexture = helmtexture = 0xFF;
|
||||
new_haircolor = haircolor = CastToClient()->GetBaseHairColor();
|
||||
new_beardcolor = beardcolor = CastToClient()->GetBaseBeardColor();
|
||||
new_eyecolor1 = eyecolor1 = CastToClient()->GetBaseEyeColor();
|
||||
new_eyecolor2 = eyecolor2 = CastToClient()->GetBaseEyeColor();
|
||||
new_hairstyle = hairstyle = CastToClient()->GetBaseHairStyle();
|
||||
new_luclinface = luclinface = CastToClient()->GetBaseFace();
|
||||
new_beard = beard = CastToClient()->GetBaseBeard();
|
||||
new_aa_title = aa_title = 0xFF;
|
||||
new_drakkin_heritage = drakkin_heritage = CastToClient()->GetBaseHeritage();
|
||||
new_drakkin_tattoo = drakkin_tattoo = CastToClient()->GetBaseTattoo();
|
||||
new_drakkin_details = drakkin_details = CastToClient()->GetBaseDetails();
|
||||
switch (race) {
|
||||
case OGRE:
|
||||
size = 9;
|
||||
@@ -1873,18 +1820,18 @@ void Mob::SendIllusionPacket(
|
||||
strcpy(is->charname, GetCleanName());
|
||||
is->race = race;
|
||||
is->gender = gender;
|
||||
is->texture = texture;
|
||||
is->helmtexture = helmtexture;
|
||||
is->haircolor = haircolor;
|
||||
is->beardcolor = beardcolor;
|
||||
is->beard = beard;
|
||||
is->eyecolor1 = eyecolor1;
|
||||
is->eyecolor2 = eyecolor2;
|
||||
is->hairstyle = hairstyle;
|
||||
is->face = luclinface;
|
||||
is->drakkin_heritage = drakkin_heritage;
|
||||
is->drakkin_tattoo = drakkin_tattoo;
|
||||
is->drakkin_details = drakkin_details;
|
||||
is->texture = new_texture;
|
||||
is->helmtexture = new_helmtexture;
|
||||
is->haircolor = new_haircolor;
|
||||
is->beardcolor = new_beardcolor;
|
||||
is->beard = new_beard;
|
||||
is->eyecolor1 = new_eyecolor1;
|
||||
is->eyecolor2 = new_eyecolor2;
|
||||
is->hairstyle = new_hairstyle;
|
||||
is->face = new_luclinface;
|
||||
is->drakkin_heritage = new_drakkin_heritage;
|
||||
is->drakkin_tattoo = new_drakkin_tattoo;
|
||||
is->drakkin_details = new_drakkin_details;
|
||||
is->size = size;
|
||||
|
||||
entity_list.QueueClients(this, outapp);
|
||||
@@ -1893,22 +1840,20 @@ void Mob::SendIllusionPacket(
|
||||
/* Refresh armor and tints after send illusion packet */
|
||||
this->SendArmorAppearance();
|
||||
|
||||
Log(Logs::Detail,
|
||||
Logs::Spells,
|
||||
"Illusion: Race = %i, Gender = %i, Texture = %i, HelmTexture = %i, HairColor = %i, BeardColor = %i, EyeColor1 = %i, EyeColor2 = %i, HairStyle = %i, Face = %i, DrakkinHeritage = %i, DrakkinTattoo = %i, DrakkinDetails = %i, Size = %f",
|
||||
LogSpells("Illusion: Race = [{}], Gender = [{}], Texture = [{}], HelmTexture = [{}], HairColor = [{}], BeardColor = [{}], EyeColor1 = [{}], EyeColor2 = [{}], HairStyle = [{}], Face = [{}], DrakkinHeritage = [{}], DrakkinTattoo = [{}], DrakkinDetails = [{}], Size = [{}]",
|
||||
race,
|
||||
gender,
|
||||
texture,
|
||||
helmtexture,
|
||||
haircolor,
|
||||
beardcolor,
|
||||
eyecolor1,
|
||||
eyecolor2,
|
||||
hairstyle,
|
||||
luclinface,
|
||||
drakkin_heritage,
|
||||
drakkin_tattoo,
|
||||
drakkin_details,
|
||||
new_texture,
|
||||
new_helmtexture,
|
||||
new_haircolor,
|
||||
new_beardcolor,
|
||||
new_eyecolor1,
|
||||
new_eyecolor2,
|
||||
new_hairstyle,
|
||||
new_luclinface,
|
||||
new_drakkin_heritage,
|
||||
new_drakkin_tattoo,
|
||||
new_drakkin_details,
|
||||
size);
|
||||
}
|
||||
|
||||
@@ -2121,6 +2066,16 @@ bool Mob::IsPlayerRace(uint16 in_race) {
|
||||
return false;
|
||||
}
|
||||
|
||||
uint16 Mob::GetFactionRace() {
|
||||
uint16 current_race = GetRace();
|
||||
if (IsPlayerRace(current_race) || current_race == TREE ||
|
||||
current_race == MINOR_ILL_OBJ) {
|
||||
return current_race;
|
||||
}
|
||||
else {
|
||||
return (GetBaseRace());
|
||||
}
|
||||
}
|
||||
|
||||
uint8 Mob::GetDefaultGender(uint16 in_race, uint8 in_gender) {
|
||||
if (Mob::IsPlayerRace(in_race) || in_race == 15 || in_race == 50 || in_race == 57 || in_race == 70 || in_race == 98 || in_race == 118 || in_race == 562) {
|
||||
@@ -2771,7 +2726,7 @@ bool Mob::HateSummon() {
|
||||
if(target)
|
||||
{
|
||||
if(summon_level == 1) {
|
||||
entity_list.MessageClose(this, true, 500, MT_Say, "%s says,'You will not evade me, %s!' ", GetCleanName(), target->GetCleanName() );
|
||||
entity_list.MessageClose(this, true, 500, Chat::Say, "%s says 'You will not evade me, %s!' ", GetCleanName(), target->GetCleanName() );
|
||||
|
||||
if (target->IsClient())
|
||||
target->CastToClient()->MovePC(zone->GetZoneID(), zone->GetInstanceID(), m_Position.x, m_Position.y, m_Position.z, target->GetHeading(), 0, SummonPC);
|
||||
@@ -2780,7 +2735,7 @@ bool Mob::HateSummon() {
|
||||
|
||||
return true;
|
||||
} else if(summon_level == 2) {
|
||||
entity_list.MessageClose(this, true, 500, MT_Say, "%s says,'You will not evade me, %s!'", GetCleanName(), target->GetCleanName());
|
||||
entity_list.MessageClose(this, true, 500, Chat::Say, "%s says 'You will not evade me, %s!'", GetCleanName(), target->GetCleanName());
|
||||
GMMove(target->GetX(), target->GetY(), target->GetZ());
|
||||
}
|
||||
}
|
||||
@@ -2851,10 +2806,10 @@ void Mob::WipeHateList()
|
||||
}
|
||||
}
|
||||
|
||||
uint32 Mob::RandomTimer(int min,int max) {
|
||||
uint32 Mob::RandomTimer(int min, int max)
|
||||
{
|
||||
int r = 14000;
|
||||
if(min != 0 && max != 0 && min < max)
|
||||
{
|
||||
if (min != 0 && max != 0 && min < max) {
|
||||
r = zone->random.Int(min, max);
|
||||
}
|
||||
return r;
|
||||
@@ -2897,7 +2852,7 @@ void Mob::Say(const char *format, ...)
|
||||
talker = this;
|
||||
}
|
||||
|
||||
entity_list.MessageClose_StringID(
|
||||
entity_list.MessageCloseString(
|
||||
talker, false, 200, 10,
|
||||
GENERIC_SAY, GetCleanName(), buf
|
||||
);
|
||||
@@ -2906,48 +2861,50 @@ void Mob::Say(const char *format, ...)
|
||||
//
|
||||
// this is like the above, but the first parameter is a string id
|
||||
//
|
||||
void Mob::Say_StringID(uint32 string_id, const char *message3, const char *message4, const char *message5, const char *message6, const char *message7, const char *message8, const char *message9)
|
||||
void Mob::SayString(uint32 string_id, const char *message3, const char *message4, const char *message5, const char *message6, const char *message7, const char *message8, const char *message9)
|
||||
{
|
||||
char string_id_str[10];
|
||||
|
||||
snprintf(string_id_str, 10, "%d", string_id);
|
||||
|
||||
entity_list.MessageClose_StringID(this, false, 200, 10,
|
||||
entity_list.MessageCloseString(
|
||||
this, false, 200, 10,
|
||||
GENERIC_STRINGID_SAY, GetCleanName(), string_id_str, message3, message4, message5,
|
||||
message6, message7, message8, message9
|
||||
);
|
||||
}
|
||||
|
||||
void Mob::Say_StringID(uint32 type, uint32 string_id, const char *message3, const char *message4, const char *message5, const char *message6, const char *message7, const char *message8, const char *message9)
|
||||
void Mob::SayString(uint32 type, uint32 string_id, const char *message3, const char *message4, const char *message5, const char *message6, const char *message7, const char *message8, const char *message9)
|
||||
{
|
||||
char string_id_str[10];
|
||||
|
||||
snprintf(string_id_str, 10, "%d", string_id);
|
||||
|
||||
entity_list.MessageClose_StringID(this, false, 200, type,
|
||||
entity_list.MessageCloseString(
|
||||
this, false, 200, type,
|
||||
GENERIC_STRINGID_SAY, GetCleanName(), string_id_str, message3, message4, message5,
|
||||
message6, message7, message8, message9
|
||||
);
|
||||
}
|
||||
|
||||
void Mob::SayTo_StringID(Client *to, uint32 string_id, const char *message3, const char *message4, const char *message5, const char *message6, const char *message7, const char *message8, const char *message9)
|
||||
void Mob::SayString(Client *to, uint32 string_id, const char *message3, const char *message4, const char *message5, const char *message6, const char *message7, const char *message8, const char *message9)
|
||||
{
|
||||
if (!to)
|
||||
return;
|
||||
|
||||
auto string_id_str = std::to_string(string_id);
|
||||
|
||||
to->Message_StringID(10, GENERIC_STRINGID_SAY, GetCleanName(), string_id_str.c_str(), message3, message4, message5, message6, message7, message8, message9);
|
||||
to->MessageString(Chat::NPCQuestSay, GENERIC_STRINGID_SAY, GetCleanName(), string_id_str.c_str(), message3, message4, message5, message6, message7, message8, message9);
|
||||
}
|
||||
|
||||
void Mob::SayTo_StringID(Client *to, uint32 type, uint32 string_id, const char *message3, const char *message4, const char *message5, const char *message6, const char *message7, const char *message8, const char *message9)
|
||||
void Mob::SayString(Client *to, uint32 type, uint32 string_id, const char *message3, const char *message4, const char *message5, const char *message6, const char *message7, const char *message8, const char *message9)
|
||||
{
|
||||
if (!to)
|
||||
return;
|
||||
|
||||
auto string_id_str = std::to_string(string_id);
|
||||
|
||||
to->Message_StringID(type, GENERIC_STRINGID_SAY, GetCleanName(), string_id_str.c_str(), message3, message4, message5, message6, message7, message8, message9);
|
||||
to->MessageString(type, GENERIC_STRINGID_SAY, GetCleanName(), string_id_str.c_str(), message3, message4, message5, message6, message7, message8, message9);
|
||||
}
|
||||
|
||||
void Mob::Shout(const char *format, ...)
|
||||
@@ -2959,7 +2916,7 @@ void Mob::Shout(const char *format, ...)
|
||||
vsnprintf(buf, 1000, format, ap);
|
||||
va_end(ap);
|
||||
|
||||
entity_list.Message_StringID(this, false, MT_Shout,
|
||||
entity_list.MessageString(this, false, Chat::Shout,
|
||||
GENERIC_SHOUT, GetCleanName(), buf);
|
||||
}
|
||||
|
||||
@@ -2972,13 +2929,19 @@ void Mob::Emote(const char *format, ...)
|
||||
vsnprintf(buf, 1000, format, ap);
|
||||
va_end(ap);
|
||||
|
||||
entity_list.MessageClose_StringID(this, false, 200, 10,
|
||||
GENERIC_EMOTE, GetCleanName(), buf);
|
||||
entity_list.MessageCloseString(
|
||||
this, false, 200, 10,
|
||||
GENERIC_EMOTE, GetCleanName(), buf
|
||||
);
|
||||
}
|
||||
|
||||
void Mob::QuestJournalledSay(Client *QuestInitiator, const char *str)
|
||||
void Mob::QuestJournalledSay(Client *QuestInitiator, const char *str, Journal::Options &opts)
|
||||
{
|
||||
entity_list.QuestJournalledSayClose(this, QuestInitiator, 200, GetCleanName(), str);
|
||||
// just in case
|
||||
if (opts.target_spawn_id == 0 && QuestInitiator)
|
||||
opts.target_spawn_id = QuestInitiator->GetID();
|
||||
|
||||
entity_list.QuestJournalledSayClose(this, 200, GetCleanName(), str, opts);
|
||||
}
|
||||
|
||||
const char *Mob::GetCleanName()
|
||||
@@ -3098,7 +3061,7 @@ void Mob::ExecWeaponProc(const EQEmu::ItemInstance *inst, uint16 spell_id, Mob *
|
||||
if(!IsValidSpell(spell_id)) { // Check for a valid spell otherwise it will crash through the function
|
||||
if(IsClient()){
|
||||
Message(0, "Invalid spell proc %u", spell_id);
|
||||
Log(Logs::Detail, Logs::Spells, "Player %s, Weapon Procced invalid spell %u", this->GetName(), spell_id);
|
||||
LogSpells("Player [{}], Weapon Procced invalid spell [{}]", this->GetName(), spell_id);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -3627,7 +3590,7 @@ void Mob::TryTwincast(Mob *caster, Mob *target, uint32 spell_id)
|
||||
{
|
||||
if(zone->random.Roll(focus))
|
||||
{
|
||||
Message(MT_Spells,"You twincast %s!",spells[spell_id].name);
|
||||
Message(Chat::Spells,"You twincast %s!", spells[spell_id].name);
|
||||
SpellFinished(spell_id, target, EQEmu::spells::CastingSlot::Item, 0, -1, spells[spell_id].ResistDiff);
|
||||
}
|
||||
}
|
||||
@@ -4664,7 +4627,7 @@ void Mob::MeleeLifeTap(int32 damage) {
|
||||
if(lifetap_amt && damage > 0){
|
||||
|
||||
lifetap_amt = damage * lifetap_amt / 100;
|
||||
Log(Logs::Detail, Logs::Combat, "Melee lifetap healing for %d damage.", damage);
|
||||
LogCombat("Melee lifetap healing for [{}] damage", damage);
|
||||
|
||||
if (lifetap_amt > 0)
|
||||
HealDamage(lifetap_amt); //Heal self for modified damage amount.
|
||||
@@ -4945,16 +4908,16 @@ void Mob::SlowMitigation(Mob* caster)
|
||||
if (GetSlowMitigation() && caster && caster->IsClient())
|
||||
{
|
||||
if ((GetSlowMitigation() > 0) && (GetSlowMitigation() < 26))
|
||||
caster->Message_StringID(MT_SpellFailure, SLOW_MOSTLY_SUCCESSFUL);
|
||||
caster->MessageString(Chat::SpellFailure, SLOW_MOSTLY_SUCCESSFUL);
|
||||
|
||||
else if ((GetSlowMitigation() >= 26) && (GetSlowMitigation() < 74))
|
||||
caster->Message_StringID(MT_SpellFailure, SLOW_PARTIALLY_SUCCESSFUL);
|
||||
caster->MessageString(Chat::SpellFailure, SLOW_PARTIALLY_SUCCESSFUL);
|
||||
|
||||
else if ((GetSlowMitigation() >= 74) && (GetSlowMitigation() < 101))
|
||||
caster->Message_StringID(MT_SpellFailure, SLOW_SLIGHTLY_SUCCESSFUL);
|
||||
caster->MessageString(Chat::SpellFailure, SLOW_SLIGHTLY_SUCCESSFUL);
|
||||
|
||||
else if (GetSlowMitigation() > 100)
|
||||
caster->Message_StringID(MT_SpellFailure, SPELL_OPPOSITE_EFFECT);
|
||||
caster->MessageString(Chat::SpellFailure, SPELL_OPPOSITE_EFFECT);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+18
-13
@@ -159,7 +159,8 @@ public:
|
||||
uint8 in_bracertexture,
|
||||
uint8 in_handtexture,
|
||||
uint8 in_legtexture,
|
||||
uint8 in_feettexture
|
||||
uint8 in_feettexture,
|
||||
uint16 in_usemodel
|
||||
);
|
||||
virtual ~Mob();
|
||||
|
||||
@@ -384,6 +385,8 @@ public:
|
||||
void DamageShield(Mob* other, bool spell_ds = false);
|
||||
int32 RuneAbsorb(int32 damage, uint16 type);
|
||||
bool FindBuff(uint16 spellid);
|
||||
uint16 FindBuffBySlot(int slot);
|
||||
uint32 BuffCount();
|
||||
bool FindType(uint16 type, bool bOffensive = false, uint16 threshold = 100);
|
||||
int16 GetBuffSlotFromType(uint16 type);
|
||||
uint16 GetSpellIDFromSlot(uint8 slot);
|
||||
@@ -442,6 +445,7 @@ public:
|
||||
virtual void SetMaxHP() { current_hp = max_hp; }
|
||||
virtual inline uint16 GetBaseRace() const { return base_race; }
|
||||
virtual inline uint8 GetBaseGender() const { return base_gender; }
|
||||
virtual uint16 GetFactionRace();
|
||||
virtual inline uint16 GetDeity() const { return deity; }
|
||||
virtual EQEmu::deity::DeityTypeBit GetDeityBit() { return EQEmu::deity::ConvertDeityTypeToDeityTypeBit((EQEmu::deity::DeityType)deity); }
|
||||
inline uint16 GetRace() const { return race; }
|
||||
@@ -718,29 +722,29 @@ public:
|
||||
inline void SetRareSpawn(bool in) { rare_spawn = in; }
|
||||
|
||||
virtual void Message(uint32 type, const char* message, ...) { }
|
||||
virtual void Message_StringID(uint32 type, uint32 string_id, uint32 distance = 0) { }
|
||||
virtual void Message_StringID(uint32 type, uint32 string_id, const char* message, const char* message2 = 0,
|
||||
virtual void MessageString(uint32 type, uint32 string_id, uint32 distance = 0) { }
|
||||
virtual void MessageString(uint32 type, uint32 string_id, const char* message, const char* message2 = 0,
|
||||
const char* message3 = 0, const char* message4 = 0, const char* message5 = 0, const char* message6 = 0,
|
||||
const char* message7 = 0, const char* message8 = 0, const char* message9 = 0, uint32 distance = 0) { }
|
||||
virtual void FilteredMessage_StringID(Mob *sender, uint32 type, eqFilterType filter, uint32 string_id) { }
|
||||
virtual void FilteredMessage_StringID(Mob *sender, uint32 type, eqFilterType filter,
|
||||
virtual void FilteredMessageString(Mob *sender, uint32 type, eqFilterType filter, uint32 string_id) { }
|
||||
virtual void FilteredMessageString(Mob *sender, uint32 type, eqFilterType filter,
|
||||
uint32 string_id, const char *message1, const char *message2 = nullptr,
|
||||
const char *message3 = nullptr, const char *message4 = nullptr,
|
||||
const char *message5 = nullptr, const char *message6 = nullptr,
|
||||
const char *message7 = nullptr, const char *message8 = nullptr,
|
||||
const char *message9 = nullptr) { }
|
||||
void Say(const char *format, ...);
|
||||
void Say_StringID(uint32 string_id, const char *message3 = 0, const char *message4 = 0, const char *message5 = 0,
|
||||
void SayString(uint32 string_id, const char *message3 = 0, const char *message4 = 0, const char *message5 = 0,
|
||||
const char *message6 = 0, const char *message7 = 0, const char *message8 = 0, const char *message9 = 0);
|
||||
void Say_StringID(uint32 type, uint32 string_id, const char *message3 = 0, const char *message4 = 0, const char *message5 = 0,
|
||||
void SayString(uint32 type, uint32 string_id, const char *message3 = 0, const char *message4 = 0, const char *message5 = 0,
|
||||
const char *message6 = 0, const char *message7 = 0, const char *message8 = 0, const char *message9 = 0);
|
||||
void SayTo_StringID(Client *to, uint32 string_id, const char *message3 = 0, const char *message4 = 0, const char *message5 = 0,
|
||||
void SayString(Client *to, uint32 string_id, const char *message3 = 0, const char *message4 = 0, const char *message5 = 0,
|
||||
const char *message6 = 0, const char *message7 = 0, const char *message8 = 0, const char *message9 = 0);
|
||||
void SayTo_StringID(Client *to, uint32 type, uint32 string_id, const char *message3 = 0, const char *message4 = 0, const char *message5 = 0,
|
||||
void SayString(Client *to, uint32 type, uint32 string_id, const char *message3 = 0, const char *message4 = 0, const char *message5 = 0,
|
||||
const char *message6 = 0, const char *message7 = 0, const char *message8 = 0, const char *message9 = 0);
|
||||
void Shout(const char *format, ...);
|
||||
void Emote(const char *format, ...);
|
||||
void QuestJournalledSay(Client *QuestInitiator, const char *str);
|
||||
void QuestJournalledSay(Client *QuestInitiator, const char *str, Journal::Options &opts);
|
||||
int32 GetItemStat(uint32 itemid, const char *identifier);
|
||||
|
||||
int16 CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, bool best_focus=false);
|
||||
@@ -1090,7 +1094,7 @@ public:
|
||||
inline glm::vec4 GetCurrentWayPoint() const { return m_CurrentWayPoint; }
|
||||
inline float GetCWPP() const { return(static_cast<float>(cur_wp_pause)); }
|
||||
inline int GetCWP() const { return(cur_wp); }
|
||||
void SetCurrentWP(uint16 waypoint) { cur_wp = waypoint; }
|
||||
void SetCurrentWP(int waypoint) { cur_wp = waypoint; }
|
||||
virtual FACTION_VALUE GetReverseFactionCon(Mob* iOther) { return FACTION_INDIFFERENT; }
|
||||
|
||||
virtual const bool IsUnderwaterOnly() const { return false; }
|
||||
@@ -1279,6 +1283,7 @@ protected:
|
||||
|
||||
uint8 gender;
|
||||
uint16 race;
|
||||
uint16 use_model;
|
||||
uint8 base_gender;
|
||||
uint16 base_race;
|
||||
uint8 class_;
|
||||
@@ -1462,8 +1467,8 @@ protected:
|
||||
eStandingPetOrder pStandingPetOrder;
|
||||
uint32 minLastFightingDelayMoving;
|
||||
uint32 maxLastFightingDelayMoving;
|
||||
float pAggroRange;
|
||||
float pAssistRange;
|
||||
float pAggroRange = 0;
|
||||
float pAssistRange = 0;
|
||||
std::unique_ptr<Timer> AI_think_timer;
|
||||
std::unique_ptr<Timer> AI_movement_timer;
|
||||
std::unique_ptr<Timer> AI_target_check_timer;
|
||||
|
||||
+134
-58
@@ -127,7 +127,7 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint32 iSpellTypes, bool bInnates
|
||||
) {
|
||||
|
||||
#if MobAI_DEBUG_Spells >= 21
|
||||
Log(Logs::Detail, Logs::AI, "Mob::AICastSpell: Casting: spellid=%u, tar=%s, dist2[%f]<=%f, mana_cost[%i]<=%i, cancast[%u]<=%u, type=%u",
|
||||
LogAI("Mob::AICastSpell: Casting: spellid=[{}], tar=[{}], dist2[[{}]]<=[{}], mana_cost[[{}]]<=[{}], cancast[[{}]]<=[{}], type=[{}]",
|
||||
AIspells[i].spellid, tar->GetName(), dist2, (spells[AIspells[i].spellid].range * spells[AIspells[i].spellid].range), mana_cost, GetMana(), AIspells[i].time_cancast, Timer::GetCurrentTime(), AIspells[i].type);
|
||||
#endif
|
||||
|
||||
@@ -360,7 +360,7 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint32 iSpellTypes, bool bInnates
|
||||
}
|
||||
#if MobAI_DEBUG_Spells >= 21
|
||||
else {
|
||||
Log(Logs::Detail, Logs::AI, "Mob::AICastSpell: NotCasting: spellid=%u, tar=%s, dist2[%f]<=%f, mana_cost[%i]<=%i, cancast[%u]<=%u, type=%u",
|
||||
LogAI("Mob::AICastSpell: NotCasting: spellid=[{}], tar=[{}], dist2[[{}]]<=[{}], mana_cost[[{}]]<=[{}], cancast[[{}]]<=[{}], type=[{}]",
|
||||
AIspells[i].spellid, tar->GetName(), dist2, (spells[AIspells[i].spellid].range * spells[AIspells[i].spellid].range), mana_cost, GetMana(), AIspells[i].time_cancast, Timer::GetCurrentTime(), AIspells[i].type);
|
||||
}
|
||||
#endif
|
||||
@@ -371,7 +371,7 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint32 iSpellTypes, bool bInnates
|
||||
|
||||
bool NPC::AIDoSpellCast(uint8 i, Mob* tar, int32 mana_cost, uint32* oDontDoAgainBefore) {
|
||||
#if MobAI_DEBUG_Spells >= 1
|
||||
Log(Logs::Detail, Logs::AI, "Mob::AIDoSpellCast: spellid = %u, tar = %s, mana = %i, Name: '%s'", AIspells[i].spellid, tar->GetName(), mana_cost, spells[AIspells[i].spellid].name);
|
||||
LogAI("Mob::AIDoSpellCast: spellid = [{}], tar = [{}], mana = [{}], Name: [{}]", AIspells[i].spellid, tar->GetName(), mana_cost, spells[AIspells[i].spellid].name);
|
||||
#endif
|
||||
casting_spell_AIindex = i;
|
||||
|
||||
@@ -379,13 +379,13 @@ bool NPC::AIDoSpellCast(uint8 i, Mob* tar, int32 mana_cost, uint32* oDontDoAgain
|
||||
}
|
||||
|
||||
bool EntityList::AICheckCloseBeneficialSpells(NPC* caster, uint8 iChance, float iRange, uint32 iSpellTypes) {
|
||||
if((iSpellTypes & SpellTypes_Detrimental) != 0) {
|
||||
if((iSpellTypes & SPELL_TYPES_DETRIMENTAL) != 0) {
|
||||
//according to live, you can buff and heal through walls...
|
||||
//now with PCs, this only applies if you can TARGET the target, but
|
||||
// according to Rogean, Live NPCs will just cast through walls/floors, no problem..
|
||||
//
|
||||
// This check was put in to address an idle-mob CPU issue
|
||||
Log(Logs::General, Logs::Error, "Error: detrimental spells requested from AICheckCloseBeneficialSpells!!");
|
||||
LogError("Error: detrimental spells requested from AICheckCloseBeneficialSpells!!");
|
||||
return(false);
|
||||
}
|
||||
|
||||
@@ -447,7 +447,7 @@ void Mob::AI_Init()
|
||||
maxLastFightingDelayMoving = RuleI(NPC, LastFightingDelayMovingMax);
|
||||
|
||||
pDontHealMeBefore = 0;
|
||||
pDontBuffMeBefore = 0;
|
||||
pDontBuffMeBefore = Timer::GetCurrentTime() + 400;
|
||||
pDontDotMeBefore = 0;
|
||||
pDontRootMeBefore = 0;
|
||||
pDontSnareMeBefore = 0;
|
||||
@@ -578,7 +578,7 @@ void NPC::AI_Stop() {
|
||||
|
||||
void Client::AI_Stop() {
|
||||
Mob::AI_Stop();
|
||||
this->Message_StringID(13,PLAYER_REGAIN);
|
||||
this->MessageString(Chat::Red,PLAYER_REGAIN);
|
||||
|
||||
auto app = new EQApplicationPacket(OP_Charm, sizeof(Charm_Struct));
|
||||
Charm_Struct *ps = (Charm_Struct*)app->pBuffer;
|
||||
@@ -1356,7 +1356,7 @@ void Mob::AI_Process() {
|
||||
}
|
||||
else if (AI_movement_timer->Check() && target) {
|
||||
if (!IsRooted()) {
|
||||
Log(Logs::Detail, Logs::AI, "Pursuing %s while engaged.", target->GetName());
|
||||
LogAI("Pursuing [{}] while engaged", target->GetName());
|
||||
RunTo(target->GetX(), target->GetY(), target->GetZ());
|
||||
|
||||
}
|
||||
@@ -1574,7 +1574,36 @@ void NPC::AI_DoMovement() {
|
||||
*/
|
||||
if (roambox_distance > 0) {
|
||||
|
||||
if (!IsMoving()) {
|
||||
// Check if we're already moving to a WP
|
||||
// If so, if we're not moving we have arrived and need to set delay
|
||||
|
||||
if (GetCWP() == EQEmu::WaypointStatus::RoamBoxPauseInProgress && !IsMoving()) {
|
||||
// We have arrived
|
||||
|
||||
int roambox_move_delay = EQEmu::ClampLower(GetRoamboxDelay(), GetRoamboxMinDelay());
|
||||
int move_delay_max = (roambox_move_delay > 0 ? roambox_move_delay : (int) GetRoamboxMinDelay() * 4);
|
||||
int random_timer = RandomTimer(
|
||||
GetRoamboxMinDelay(),
|
||||
move_delay_max
|
||||
);
|
||||
|
||||
Log(
|
||||
Logs::Detail,
|
||||
Logs::NPCRoamBox, "(%s) Timer calc | random_timer [%i] roambox_move_delay [%i] move_min [%i] move_max [%i]",
|
||||
this->GetCleanName(),
|
||||
random_timer,
|
||||
roambox_move_delay,
|
||||
(int) GetRoamboxMinDelay(),
|
||||
move_delay_max
|
||||
);
|
||||
|
||||
time_until_can_move = Timer::GetCurrentTime() + random_timer;
|
||||
SetCurrentWP(0);
|
||||
return;
|
||||
}
|
||||
|
||||
// Set a new destination
|
||||
if (!IsMoving() && time_until_can_move < Timer::GetCurrentTime()) {
|
||||
auto move_x = static_cast<float>(zone->random.Real(-roambox_distance, roambox_distance));
|
||||
auto move_y = static_cast<float>(zone->random.Real(-roambox_distance, roambox_distance));
|
||||
|
||||
@@ -1625,29 +1654,54 @@ void NPC::AI_DoMovement() {
|
||||
}
|
||||
}
|
||||
|
||||
glm::vec3 destination;
|
||||
destination.x = roambox_destination_x;
|
||||
destination.y = roambox_destination_y;
|
||||
destination.z = m_Position.z;
|
||||
roambox_destination_z = zone->zonemap ? zone->zonemap->FindClosestZ(destination, nullptr) + this->GetZOffset() : 0;
|
||||
PathfinderOptions opts;
|
||||
opts.smooth_path = true;
|
||||
opts.step_size = RuleR(Pathing, NavmeshStepSize);
|
||||
opts.offset = GetZOffset();
|
||||
opts.flags = PathingNotDisabled ^ PathingZoneLine;
|
||||
|
||||
Log(Logs::Detail,
|
||||
auto partial = false;
|
||||
auto stuck = false;
|
||||
auto route = zone->pathing->FindPath(
|
||||
glm::vec3(GetX(), GetY(), GetZ()),
|
||||
glm::vec3(
|
||||
roambox_destination_x,
|
||||
roambox_destination_y,
|
||||
GetGroundZ(roambox_destination_x, roambox_destination_y)
|
||||
),
|
||||
partial,
|
||||
stuck,
|
||||
opts
|
||||
);
|
||||
|
||||
if (route.empty()) {
|
||||
Log(
|
||||
Logs::Detail,
|
||||
Logs::NPCRoamBox, "(%s) We don't have a path route... exiting...",
|
||||
this->GetCleanName()
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
roambox_destination_z = 0;
|
||||
|
||||
Log(
|
||||
Logs::General,
|
||||
Logs::NPCRoamBox,
|
||||
"Calculate | NPC: %s distance %.3f | min_x %.3f | max_x %.3f | final_x %.3f | min_y %.3f | max_y %.3f | final_y %.3f",
|
||||
"NPC (%s) distance [%.0f] X (min/max) [%.0f / %.0f] Y (min/max) [%.0f / %.0f] | Dest x/y/z [%.0f / %.0f / %.0f]",
|
||||
this->GetCleanName(),
|
||||
roambox_distance,
|
||||
roambox_min_x,
|
||||
roambox_max_x,
|
||||
roambox_destination_x,
|
||||
roambox_min_y,
|
||||
roambox_max_y,
|
||||
roambox_destination_y);
|
||||
}
|
||||
roambox_destination_x,
|
||||
roambox_destination_y,
|
||||
roambox_destination_z
|
||||
);
|
||||
|
||||
NavigateTo(roambox_destination_x, roambox_destination_y, roambox_destination_z);
|
||||
|
||||
if (m_Position.x == roambox_destination_x && m_Position.y == roambox_destination_y) {
|
||||
time_until_can_move = Timer::GetCurrentTime() + RandomTimer(roambox_min_delay, roambox_delay);
|
||||
SetCurrentWP(EQEmu::WaypointStatus::RoamBoxPauseInProgress);
|
||||
NavigateTo(roambox_destination_x, roambox_destination_y, roambox_destination_z);
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -1657,25 +1711,23 @@ void NPC::AI_DoMovement() {
|
||||
pause_timer_complete = true;
|
||||
AI_walking_timer->Disable();
|
||||
}
|
||||
|
||||
|
||||
int32 gridno = CastToNPC()->GetGrid();
|
||||
|
||||
if (gridno > 0 || cur_wp == -2) {
|
||||
|
||||
if (gridno > 0 || cur_wp == EQEmu::WaypointStatus::QuestControlNoGrid) {
|
||||
if (pause_timer_complete == true) { // time to pause at wp is over
|
||||
AI_SetupNextWaypoint();
|
||||
} // endif (pause_timer_complete==true)
|
||||
else if (!(AI_walking_timer->Enabled())) { // currently moving
|
||||
bool doMove = true;
|
||||
if(IsPositionEqual(glm::vec2(m_CurrentWayPoint.x, m_CurrentWayPoint.y), glm::vec2(GetX(), GetY()))) {
|
||||
Log(Logs::Detail,
|
||||
Logs::AI,
|
||||
"We have reached waypoint %d (%.3f,%.3f,%.3f) on grid %d",
|
||||
LogAI("We have reached waypoint [{}] ({},{},{}) on grid [{}]",
|
||||
cur_wp,
|
||||
GetX(),
|
||||
GetY(),
|
||||
GetZ(),
|
||||
GetGrid());
|
||||
|
||||
|
||||
SetWaypointPause();
|
||||
SetAppearance(eaStanding, false);
|
||||
if (cur_wp_pause > 0) {
|
||||
@@ -1692,7 +1744,7 @@ void NPC::AI_DoMovement() {
|
||||
// as that is where roamer is unset and we don't want
|
||||
// the next trip through to move again based on grid stuff.
|
||||
doMove = false;
|
||||
if (cur_wp == -2) {
|
||||
if (cur_wp == EQEmu::WaypointStatus::QuestControlNoGrid) {
|
||||
AI_SetupNextWaypoint();
|
||||
}
|
||||
|
||||
@@ -1721,7 +1773,7 @@ void NPC::AI_DoMovement() {
|
||||
else if (gridno < 0) { // this mob is under quest control
|
||||
if (pause_timer_complete == true) { // time to pause has ended
|
||||
SetGrid(0 - GetGrid()); // revert to AI control
|
||||
Log(Logs::Detail, Logs::Pathing, "Quest pathing is finished. Resuming on grid %d", GetGrid());
|
||||
LogPathing("Quest pathing is finished. Resuming on grid [{}]", GetGrid());
|
||||
|
||||
SetAppearance(eaStanding, false);
|
||||
|
||||
@@ -1736,12 +1788,7 @@ void NPC::AI_DoMovement() {
|
||||
if (at_gp) {
|
||||
|
||||
if (moved) {
|
||||
Log(Logs::Detail,
|
||||
Logs::AI,
|
||||
"Reached guard point (%.3f,%.3f,%.3f)",
|
||||
m_GuardPoint.x,
|
||||
m_GuardPoint.y,
|
||||
m_GuardPoint.z);
|
||||
LogAI("Reached guard point ({},{},{})", m_GuardPoint.x, m_GuardPoint.y, m_GuardPoint.z);
|
||||
|
||||
ClearFeignMemory();
|
||||
moved = false;
|
||||
@@ -1789,11 +1836,10 @@ void NPC::AI_SetupNextWaypoint() {
|
||||
}
|
||||
else {
|
||||
pause_timer_complete = false;
|
||||
Log(Logs::Detail, Logs::Pathing, "We are departing waypoint %d.", cur_wp);
|
||||
|
||||
LogPathing("We are departing waypoint [{}]", cur_wp);
|
||||
//if we were under quest control (with no grid), we are done now..
|
||||
if (cur_wp == -2) {
|
||||
Log(Logs::Detail, Logs::Pathing, "Non-grid quest mob has reached its quest ordered waypoint. Leaving pathing mode.");
|
||||
if (cur_wp == EQEmu::WaypointStatus::QuestControlNoGrid) {
|
||||
LogPathing("Non-grid quest mob has reached its quest ordered waypoint. Leaving pathing mode");
|
||||
roamer = false;
|
||||
cur_wp = 0;
|
||||
}
|
||||
@@ -1930,7 +1976,7 @@ bool NPC::AI_EngagedCastCheck() {
|
||||
if (AIautocastspell_timer->Check(false)) {
|
||||
AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting.
|
||||
|
||||
Log(Logs::Detail, Logs::AI, "Engaged autocast check triggered. Trying to cast healing spells then maybe offensive spells.");
|
||||
LogAI("Engaged autocast check triggered. Trying to cast healing spells then maybe offensive spells");
|
||||
|
||||
// first try innate (spam) spells
|
||||
if(!AICastSpell(GetTarget(), 0, SpellType_Nuke | SpellType_Lifetap | SpellType_DOT | SpellType_Dispel | SpellType_Mez | SpellType_Slow | SpellType_Debuff | SpellType_Charm | SpellType_Root, true)) {
|
||||
@@ -1959,7 +2005,7 @@ bool NPC::AI_PursueCastCheck() {
|
||||
if (AIautocastspell_timer->Check(false)) {
|
||||
AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting.
|
||||
|
||||
Log(Logs::Detail, Logs::AI, "Engaged (pursuing) autocast check triggered. Trying to cast offensive spells.");
|
||||
LogAI("Engaged (pursuing) autocast check triggered. Trying to cast offensive spells");
|
||||
// checking innate (spam) spells first
|
||||
if(!AICastSpell(GetTarget(), AISpellVar.pursue_detrimental_chance, SpellType_Root | SpellType_Nuke | SpellType_Lifetap | SpellType_Snare | SpellType_DOT | SpellType_Dispel | SpellType_Mez | SpellType_Slow | SpellType_Debuff, true)) {
|
||||
if(!AICastSpell(GetTarget(), AISpellVar.pursue_detrimental_chance, SpellType_Root | SpellType_Nuke | SpellType_Lifetap | SpellType_Snare | SpellType_DOT | SpellType_Dispel | SpellType_Mez | SpellType_Slow | SpellType_Debuff)) {
|
||||
@@ -1981,7 +2027,7 @@ bool NPC::AI_IdleCastCheck() {
|
||||
//last duration it was set to... try to put up a more reasonable timer...
|
||||
AIautocastspell_timer->Start(RandomTimer(AISpellVar.idle_no_sp_recast_min, AISpellVar.idle_no_sp_recast_max), false);
|
||||
|
||||
Log(Logs::Moderate, Logs::Spells, "Triggering AI_IdleCastCheck :: Mob %s - Min : %u Max : %u", this->GetCleanName(), AISpellVar.idle_no_sp_recast_min, AISpellVar.idle_no_sp_recast_max);
|
||||
LogSpells("Triggering AI_IdleCastCheck :: Mob [{}] - Min : [{}] Max : [{}]", this->GetCleanName(), AISpellVar.idle_no_sp_recast_min, AISpellVar.idle_no_sp_recast_max);
|
||||
|
||||
} //else, spell casting finishing will reset the timer.
|
||||
} //else, spell casting finishing will reset the timer.
|
||||
@@ -2020,14 +2066,14 @@ void Mob::StartEnrage()
|
||||
|
||||
// start the timer. need to call IsEnraged frequently since we dont have callback timers :-/
|
||||
bEnraged = true;
|
||||
entity_list.MessageClose_StringID(this, true, 200, MT_NPCEnrage, NPC_ENRAGE_START, GetCleanName());
|
||||
entity_list.MessageCloseString(this, true, 200, Chat::NPCEnrage, NPC_ENRAGE_START, GetCleanName());
|
||||
}
|
||||
|
||||
void Mob::ProcessEnrage(){
|
||||
if(IsEnraged()){
|
||||
Timer *timer = GetSpecialAbilityTimer(SPECATK_ENRAGE);
|
||||
if(timer && timer->Check()){
|
||||
entity_list.MessageClose_StringID(this, true, 200, MT_NPCEnrage, NPC_ENRAGE_END, GetCleanName());
|
||||
entity_list.MessageCloseString(this, true, 200, Chat::NPCEnrage, NPC_ENRAGE_END, GetCleanName());
|
||||
|
||||
int enraged_cooldown = GetSpecialAbilityParam(SPECATK_ENRAGE, 2);
|
||||
enraged_cooldown = enraged_cooldown > 0 ? enraged_cooldown : EnragedTimer;
|
||||
@@ -2048,9 +2094,23 @@ bool Mob::Flurry(ExtraAttackOptions *opts)
|
||||
Mob *target = GetTarget();
|
||||
if (target) {
|
||||
if (!IsPet()) {
|
||||
entity_list.MessageClose_StringID(this, true, 200, MT_NPCFlurry, NPC_FLURRY, GetCleanName(), target->GetCleanName());
|
||||
entity_list.MessageCloseString(
|
||||
this,
|
||||
true,
|
||||
200,
|
||||
Chat::NPCFlurry,
|
||||
NPC_FLURRY,
|
||||
GetCleanName(),
|
||||
target->GetCleanName());
|
||||
} else {
|
||||
entity_list.MessageClose_StringID(this, true, 200, MT_PetFlurry, NPC_FLURRY, GetCleanName(), target->GetCleanName());
|
||||
entity_list.MessageCloseString(
|
||||
this,
|
||||
true,
|
||||
200,
|
||||
Chat::PetFlurry,
|
||||
NPC_FLURRY,
|
||||
GetCleanName(),
|
||||
target->GetCleanName());
|
||||
}
|
||||
|
||||
int num_attacks = GetSpecialAbilityParam(SPECATK_FLURRY, 1);
|
||||
@@ -2087,9 +2147,9 @@ bool Mob::Rampage(ExtraAttackOptions *opts)
|
||||
{
|
||||
int index_hit = 0;
|
||||
if (!IsPet())
|
||||
entity_list.MessageClose_StringID(this, true, 200, MT_NPCRampage, NPC_RAMPAGE, GetCleanName());
|
||||
entity_list.MessageCloseString(this, true, 200, Chat::NPCRampage, NPC_RAMPAGE, GetCleanName());
|
||||
else
|
||||
entity_list.MessageClose_StringID(this, true, 200, MT_PetFlurry, NPC_RAMPAGE, GetCleanName());
|
||||
entity_list.MessageCloseString(this, true, 200, Chat::PetFlurry, NPC_RAMPAGE, GetCleanName());
|
||||
|
||||
int rampage_targets = GetSpecialAbilityParam(SPECATK_RAMPAGE, 1);
|
||||
if (rampage_targets == 0) // if set to 0 or not set in the DB
|
||||
@@ -2144,9 +2204,9 @@ void Mob::AreaRampage(ExtraAttackOptions *opts)
|
||||
{
|
||||
int index_hit = 0;
|
||||
if (!IsPet()) { // do not know every pet AA so thought it safer to add this
|
||||
entity_list.MessageClose_StringID(this, true, 200, MT_NPCRampage, AE_RAMPAGE, GetCleanName());
|
||||
entity_list.MessageCloseString(this, true, 200, Chat::NPCRampage, AE_RAMPAGE, GetCleanName());
|
||||
} else {
|
||||
entity_list.MessageClose_StringID(this, true, 200, MT_PetFlurry, AE_RAMPAGE, GetCleanName());
|
||||
entity_list.MessageCloseString(this, true, 200, Chat::PetFlurry, AE_RAMPAGE, GetCleanName());
|
||||
}
|
||||
|
||||
int rampage_targets = GetSpecialAbilityParam(SPECATK_AREA_RAMPAGE, 1);
|
||||
@@ -2427,7 +2487,7 @@ bool NPC::AI_AddNPCSpells(uint32 iDBSpellsID) {
|
||||
}
|
||||
DBnpcspells_Struct* parentlist = database.GetNPCSpells(spell_list->parent_list);
|
||||
#if MobAI_DEBUG_Spells >= 10
|
||||
std::string debug_msg = StringFormat("Loading NPCSpells onto %s: dbspellsid=%u", this->GetName(), iDBSpellsID);
|
||||
std::string debug_msg = StringFormat("Loading NPCSpells onto %s: dbspellsid=%u, level=%u", this->GetName(), iDBSpellsID, this->GetLevel());
|
||||
if (spell_list) {
|
||||
debug_msg.append(StringFormat(" (found, %u), parentlist=%u", spell_list->entries.size(), spell_list->parent_list));
|
||||
if (spell_list->parent_list) {
|
||||
@@ -2440,7 +2500,23 @@ bool NPC::AI_AddNPCSpells(uint32 iDBSpellsID) {
|
||||
else {
|
||||
debug_msg.append(" (not found)");
|
||||
}
|
||||
Log(Logs::Detail, Logs::AI, "%s", debug_msg.c_str());
|
||||
LogAI("[{}]", debug_msg.c_str());
|
||||
|
||||
#ifdef MobAI_DEBUG_Spells >= 25
|
||||
if (parentlist) {
|
||||
for (const auto &iter : parentlist->entries) {
|
||||
LogAI("([{}]) [{}]", iter.spellid, spells[iter.spellid].name);
|
||||
}
|
||||
}
|
||||
LogAI("fin (parent list)");
|
||||
if (spell_list) {
|
||||
for (const auto &iter : spell_list->entries) {
|
||||
LogAI("([{}]) [{}]", iter.spellid, spells[iter.spellid].name);
|
||||
}
|
||||
}
|
||||
LogAI("fin (spell list)");
|
||||
#endif
|
||||
|
||||
#endif
|
||||
uint16 attack_proc_spell = -1;
|
||||
int8 proc_chance = 3;
|
||||
@@ -2599,7 +2675,7 @@ bool NPC::AI_AddNPCSpellsEffects(uint32 iDBSpellsEffectsID) {
|
||||
else {
|
||||
debug_msg.append(" (not found)");
|
||||
}
|
||||
Log(Logs::Detail, Logs::AI, "%s", debug_msg.c_str());
|
||||
LogAI("[{}]", debug_msg.c_str());
|
||||
#endif
|
||||
|
||||
if (parentlist) {
|
||||
@@ -2719,7 +2795,7 @@ void NPC::AISpellsList(Client *c)
|
||||
return;
|
||||
|
||||
for (auto it = AIspells.begin(); it != AIspells.end(); ++it)
|
||||
c->Message(0, "%s (%d): Type %d, Priority %d, Recast Delay %d, Resist Adjust %d, Min HP %d, Max HP %d",
|
||||
c->Message(Chat::White, "%s (%d): Type %d, Priority %d, Recast Delay %d, Resist Adjust %d, Min HP %d, Max HP %d",
|
||||
spells[it->spellid].name, it->spellid, it->type, it->priority, it->recast_delay, it->resist_adjust, it->min_hp, it->max_hp);
|
||||
|
||||
return;
|
||||
@@ -2813,7 +2889,7 @@ DBnpcspells_Struct *ZoneDatabase::GetNPCSpells(uint32 iDBSpellsID)
|
||||
entry.max_hp = atoi(row[8]);
|
||||
|
||||
// some spell types don't make much since to be priority 0, so fix that
|
||||
if (!(entry.type & SpellTypes_Innate) && entry.priority == 0)
|
||||
if (!(entry.type & SPELL_TYPES_INNATE) && entry.priority == 0)
|
||||
entry.priority = 1;
|
||||
|
||||
if (row[9])
|
||||
|
||||
+4
-4
@@ -189,11 +189,11 @@ inline std::string GetMobAttributeByString(Mob *mob, const std::string &attribut
|
||||
}
|
||||
|
||||
if (attribute == "cor") {
|
||||
return std::to_string(mob->GetCorrup());
|
||||
return commify(std::to_string(mob->GetCorrup())) + scaling_modified;
|
||||
}
|
||||
|
||||
if (attribute == "phy") {
|
||||
return std::to_string(mob->GetPhR());
|
||||
return commify(std::to_string(mob->GetPhR())) + scaling_modified;
|
||||
}
|
||||
|
||||
if (attribute == "name") {
|
||||
@@ -278,7 +278,7 @@ inline std::string GetMobAttributeByString(Mob *mob, const std::string &attribut
|
||||
return std::to_string((int)npc->GetWalkspeed());
|
||||
}
|
||||
if (attribute == "spawngroup") {
|
||||
return std::to_string(npc->GetSp2());
|
||||
return std::to_string(npc->GetSpawnGroupId());
|
||||
}
|
||||
if (attribute == "grid") {
|
||||
return std::to_string(npc->GetGrid());
|
||||
@@ -624,7 +624,7 @@ inline void NPCCommandsMenu(Client* client, NPC* npc)
|
||||
|
||||
if (menu_commands.length() > 0) {
|
||||
std::string dev_menu = "[" + EQEmu::SayLinkEngine::GenerateQuestSaylink("#devtools", false, "DevTools") + "] ";;
|
||||
client->Message(0, "| %s [Show Commands] %s", dev_menu.c_str(), menu_commands.c_str());
|
||||
client->Message(Chat::White, "| %s [Show Commands] %s", dev_menu.c_str(), menu_commands.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+597
-324
File diff suppressed because it is too large.
Load diff
+27
-16
@@ -41,18 +41,29 @@ class MobMovementManager
|
||||
public:
|
||||
~MobMovementManager();
|
||||
void Process();
|
||||
void AddMob(Mob *m);
|
||||
void RemoveMob(Mob *m);
|
||||
void AddClient(Client *c);
|
||||
void RemoveClient(Client *c);
|
||||
void AddMob(Mob *mob);
|
||||
void RemoveMob(Mob *mob);
|
||||
void AddClient(Client *client);
|
||||
void RemoveClient(Client *client);
|
||||
|
||||
void RotateTo(Mob *who, float to, MobMovementMode mode = MovementRunning);
|
||||
void RotateTo(Mob *who, float to, MobMovementMode mob_movement_mode = MovementRunning);
|
||||
void Teleport(Mob *who, float x, float y, float z, float heading);
|
||||
void NavigateTo(Mob *who, float x, float y, float z, MobMovementMode mode = MovementRunning);
|
||||
void StopNavigation(Mob *who);
|
||||
void SendCommandToClients(Mob *m, float dx, float dy, float dz, float dh, int anim, ClientRange range);
|
||||
|
||||
void SendCommandToClients(
|
||||
Mob *mob,
|
||||
float delta_x,
|
||||
float delta_y,
|
||||
float delta_z,
|
||||
float delta_heading,
|
||||
int anim,
|
||||
ClientRange range,
|
||||
Client* single_client = nullptr
|
||||
);
|
||||
|
||||
float FixHeading(float in);
|
||||
void DumpStats(Client *to);
|
||||
void DumpStats(Client *client);
|
||||
void ClearStats();
|
||||
|
||||
static MobMovementManager &Get() {
|
||||
@@ -65,18 +76,18 @@ private:
|
||||
MobMovementManager(const MobMovementManager&);
|
||||
MobMovementManager& operator=(const MobMovementManager&);
|
||||
|
||||
void FillCommandStruct(PlayerPositionUpdateServer_Struct *spu, Mob *m, float dx, float dy, float dz, float dh, int anim);
|
||||
void UpdatePath(Mob *who, float x, float y, float z, MobMovementMode mode);
|
||||
void FillCommandStruct(PlayerPositionUpdateServer_Struct *position_update, Mob *mob, float delta_x, float delta_y, float delta_z, float delta_heading, int anim);
|
||||
void UpdatePath(Mob *who, float x, float y, float z, MobMovementMode mob_movement_mode);
|
||||
void UpdatePathGround(Mob *who, float x, float y, float z, MobMovementMode mode);
|
||||
void UpdatePathUnderwater(Mob *who, float x, float y, float z, MobMovementMode mode);
|
||||
void UpdatePathUnderwater(Mob *who, float x, float y, float z, MobMovementMode movement_mode);
|
||||
void UpdatePathBoat(Mob *who, float x, float y, float z, MobMovementMode mode);
|
||||
void PushTeleportTo(MobMovementEntry &ent, float x, float y, float z, float heading);
|
||||
void PushMoveTo(MobMovementEntry &ent, float x, float y, float z, MobMovementMode mode);
|
||||
void PushSwimTo(MobMovementEntry &ent, float x, float y, float z, MobMovementMode mode);
|
||||
void PushRotateTo(MobMovementEntry &ent, Mob *who, float to, MobMovementMode mode);
|
||||
void PushStopMoving(MobMovementEntry &ent);
|
||||
void PushEvadeCombat(MobMovementEntry &ent);
|
||||
void HandleStuckBehavior(Mob *who, float x, float y, float z, MobMovementMode mode);
|
||||
void PushMoveTo(MobMovementEntry &ent, float x, float y, float z, MobMovementMode mob_movement_mode);
|
||||
void PushSwimTo(MobMovementEntry &ent, float x, float y, float z, MobMovementMode mob_movement_mode);
|
||||
void PushRotateTo(MobMovementEntry &ent, Mob *who, float to, MobMovementMode mob_movement_mode);
|
||||
void PushStopMoving(MobMovementEntry &mob_movement_entry);
|
||||
void PushEvadeCombat(MobMovementEntry &mob_movement_entry);
|
||||
void HandleStuckBehavior(Mob *who, float x, float y, float z, MobMovementMode mob_movement_mode);
|
||||
|
||||
struct Implementation;
|
||||
std::unique_ptr<Implementation> _impl;
|
||||
|
||||
-48
@@ -1,48 +0,0 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#ifdef _WINDOWS
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <unistd.h>
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
|
||||
#include "../common/types.h"
|
||||
#include "../common/timer.h"
|
||||
void CatchSignal(int);
|
||||
void UpdateWindowTitle(char* iNewTitle = 0);
|
||||
|
||||
class NetConnection
|
||||
{
|
||||
public:
|
||||
~NetConnection();
|
||||
NetConnection();
|
||||
|
||||
uint32 GetIP();
|
||||
uint32 GetIP(char* name);
|
||||
Timer object_timer;
|
||||
Timer door_timer;
|
||||
Timer corpse_timer;
|
||||
Timer group_timer;
|
||||
Timer raid_timer;
|
||||
Timer trap_timer;
|
||||
};
|
||||
+128
-78
@@ -112,7 +112,8 @@ NPC::NPC(const NPCType *npc_type_data, Spawn2 *in_respawn, const glm::vec4 &posi
|
||||
npc_type_data->bracertexture,
|
||||
npc_type_data->handtexture,
|
||||
npc_type_data->legtexture,
|
||||
npc_type_data->feettexture
|
||||
npc_type_data->feettexture,
|
||||
npc_type_data->use_model
|
||||
),
|
||||
attacked_timer(CombatEventTimer_expire),
|
||||
swarm_timer(100),
|
||||
@@ -145,33 +146,33 @@ NPC::NPC(const NPCType *npc_type_data, Spawn2 *in_respawn, const glm::vec4 &posi
|
||||
size = GetRaceGenderDefaultHeight(race, gender);
|
||||
}
|
||||
|
||||
taunting = false;
|
||||
proximity = nullptr;
|
||||
copper = 0;
|
||||
silver = 0;
|
||||
gold = 0;
|
||||
platinum = 0;
|
||||
max_dmg = npc_type_data->max_dmg;
|
||||
min_dmg = npc_type_data->min_dmg;
|
||||
attack_count = npc_type_data->attack_count;
|
||||
grid = 0;
|
||||
wp_m = 0;
|
||||
max_wp = 0;
|
||||
save_wp = 0;
|
||||
spawn_group = 0;
|
||||
swarmInfoPtr = nullptr;
|
||||
spellscale = npc_type_data->spellscale;
|
||||
healscale = npc_type_data->healscale;
|
||||
pAggroRange = npc_type_data->aggroradius;
|
||||
pAssistRange = npc_type_data->assistradius;
|
||||
findable = npc_type_data->findable;
|
||||
trackable = npc_type_data->trackable;
|
||||
MR = npc_type_data->MR;
|
||||
CR = npc_type_data->CR;
|
||||
DR = npc_type_data->DR;
|
||||
FR = npc_type_data->FR;
|
||||
PR = npc_type_data->PR;
|
||||
Corrup = npc_type_data->Corrup;
|
||||
taunting = false;
|
||||
proximity = nullptr;
|
||||
copper = 0;
|
||||
silver = 0;
|
||||
gold = 0;
|
||||
platinum = 0;
|
||||
max_dmg = npc_type_data->max_dmg;
|
||||
min_dmg = npc_type_data->min_dmg;
|
||||
attack_count = npc_type_data->attack_count;
|
||||
grid = 0;
|
||||
wp_m = 0;
|
||||
max_wp = 0;
|
||||
save_wp = 0;
|
||||
spawn_group_id = 0;
|
||||
swarmInfoPtr = nullptr;
|
||||
spellscale = npc_type_data->spellscale;
|
||||
healscale = npc_type_data->healscale;
|
||||
pAggroRange = npc_type_data->aggroradius;
|
||||
pAssistRange = npc_type_data->assistradius;
|
||||
findable = npc_type_data->findable;
|
||||
trackable = npc_type_data->trackable;
|
||||
MR = npc_type_data->MR;
|
||||
CR = npc_type_data->CR;
|
||||
DR = npc_type_data->DR;
|
||||
FR = npc_type_data->FR;
|
||||
PR = npc_type_data->PR;
|
||||
Corrup = npc_type_data->Corrup;
|
||||
PhR = npc_type_data->PhR;
|
||||
STR = npc_type_data->STR;
|
||||
STA = npc_type_data->STA;
|
||||
@@ -208,6 +209,7 @@ NPC::NPC(const NPCType *npc_type_data, Spawn2 *in_respawn, const glm::vec4 &posi
|
||||
default_accuracy_rating = npc_type_data->accuracy_rating;
|
||||
default_avoidance_rating = npc_type_data->avoidance_rating;
|
||||
default_atk = npc_type_data->ATK;
|
||||
strn0cpy(default_special_abilities, npc_type_data->special_abilities, 512);
|
||||
|
||||
// used for when getting charmed, if 0, doesn't swap
|
||||
charm_ac = npc_type_data->charm_ac;
|
||||
@@ -225,6 +227,11 @@ NPC::NPC(const NPCType *npc_type_data, Spawn2 *in_respawn, const glm::vec4 &posi
|
||||
merchant_open = GetClass() == MERCHANT;
|
||||
adventure_template_id = npc_type_data->adventure_template;
|
||||
flymode = iflymode;
|
||||
|
||||
if (npc_type_data->flymode >= 0) {
|
||||
flymode = static_cast<GravityBehavior>(npc_type_data->flymode);
|
||||
}
|
||||
|
||||
guard_anim = eaStanding;
|
||||
roambox_distance = 0;
|
||||
roambox_max_x = -2;
|
||||
@@ -238,6 +245,7 @@ NPC::NPC(const NPCType *npc_type_data, Spawn2 *in_respawn, const glm::vec4 &posi
|
||||
p_depop = false;
|
||||
loottable_id = npc_type_data->loottable_id;
|
||||
skip_global_loot = npc_type_data->skip_global_loot;
|
||||
skip_auto_scale = npc_type_data->skip_auto_scale;
|
||||
rare_spawn = npc_type_data->rare_spawn;
|
||||
no_target_hotkey = npc_type_data->no_target_hotkey;
|
||||
primary_faction = 0;
|
||||
@@ -604,16 +612,16 @@ void NPC::ClearItemList() {
|
||||
|
||||
void NPC::QueryLoot(Client* to)
|
||||
{
|
||||
to->Message(0, "| # Current Loot (%s) LootTableID: %i", GetName(), GetLoottableID());
|
||||
to->Message(Chat::White, "| # Current Loot (%s) LootTableID: %i", GetName(), GetLoottableID());
|
||||
|
||||
int item_count = 0;
|
||||
for (auto cur = itemlist.begin(); cur != itemlist.end(); ++cur, ++item_count) {
|
||||
if (!(*cur)) {
|
||||
Log(Logs::General, Logs::Error, "NPC::QueryLoot() - ItemList error, null item");
|
||||
LogError("NPC::QueryLoot() - ItemList error, null item");
|
||||
continue;
|
||||
}
|
||||
if (!(*cur)->item_id || !database.GetItem((*cur)->item_id)) {
|
||||
Log(Logs::General, Logs::Error, "NPC::QueryLoot() - Database error, invalid item");
|
||||
LogError("NPC::QueryLoot() - Database error, invalid item");
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -632,7 +640,7 @@ void NPC::QueryLoot(Client* to)
|
||||
);
|
||||
}
|
||||
|
||||
to->Message(0, "| %i Platinum %i Gold %i Silver %i Copper", platinum, gold, silver, copper);
|
||||
to->Message(Chat::White, "| %i Platinum %i Gold %i Silver %i Copper", platinum, gold, silver, copper);
|
||||
}
|
||||
|
||||
void NPC::AddCash(uint16 in_copper, uint16 in_silver, uint16 in_gold, uint16 in_platinum) {
|
||||
@@ -1183,17 +1191,17 @@ NPC* NPC::SpawnNPC(const char* spawncommand, const glm::vec4& position, Client*
|
||||
|
||||
if (client) {
|
||||
// Notify client of spawn data
|
||||
client->Message(0, "New spawn:");
|
||||
client->Message(0, "Name: %s", npc->name);
|
||||
client->Message(0, "Race: %u", npc->race);
|
||||
client->Message(0, "Level: %u", npc->level);
|
||||
client->Message(0, "Material: %u", npc->texture);
|
||||
client->Message(0, "Current/Max HP: %i", npc->max_hp);
|
||||
client->Message(0, "Gender: %u", npc->gender);
|
||||
client->Message(0, "Class: %u", npc->class_);
|
||||
client->Message(0, "Weapon Item Number: %u/%u", npc->d_melee_texture1, npc->d_melee_texture2);
|
||||
client->Message(0, "MerchantID: %u", npc->MerchantType);
|
||||
client->Message(0, "Bodytype: %u", npc->bodytype);
|
||||
client->Message(Chat::White, "New spawn:");
|
||||
client->Message(Chat::White, "Name: %s", npc->name);
|
||||
client->Message(Chat::White, "Race: %u", npc->race);
|
||||
client->Message(Chat::White, "Level: %u", npc->level);
|
||||
client->Message(Chat::White, "Material: %u", npc->texture);
|
||||
client->Message(Chat::White, "Current/Max HP: %i", npc->max_hp);
|
||||
client->Message(Chat::White, "Gender: %u", npc->gender);
|
||||
client->Message(Chat::White, "Class: %u", npc->class_);
|
||||
client->Message(Chat::White, "Weapon Item Number: %u/%u", npc->d_melee_texture1, npc->d_melee_texture2);
|
||||
client->Message(Chat::White, "MerchantID: %u", npc->MerchantType);
|
||||
client->Message(Chat::White, "Bodytype: %u", npc->bodytype);
|
||||
}
|
||||
|
||||
return npc;
|
||||
@@ -1263,7 +1271,7 @@ uint32 ZoneDatabase::CreateNewNPCCommand(const char *zone, uint32 zone_version,
|
||||
}
|
||||
uint32 spawngroupid = results.LastInsertedID();
|
||||
|
||||
spawn->SetSp2(spawngroupid);
|
||||
spawn->SetSpawnGroupId(spawngroupid);
|
||||
spawn->SetNPCTypeID(npc_type_id);
|
||||
|
||||
query = StringFormat("INSERT INTO spawn2 (zone, version, x, y, z, respawntime, heading, spawngroupID) "
|
||||
@@ -1348,7 +1356,7 @@ uint32 ZoneDatabase::DeleteSpawnLeaveInNPCTypeTable(const char *zone, Client *cl
|
||||
|
||||
std::string query = StringFormat("SELECT id, spawngroupID FROM spawn2 WHERE "
|
||||
"zone='%s' AND spawngroupID=%i",
|
||||
zone, spawn->GetSp2());
|
||||
zone, spawn->GetSpawnGroupId());
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return 0;
|
||||
@@ -1389,7 +1397,7 @@ uint32 ZoneDatabase::DeleteSpawnRemoveFromNPCTypeTable(const char *zone, uint32
|
||||
|
||||
std::string query = StringFormat("SELECT id, spawngroupID FROM spawn2 WHERE zone = '%s' "
|
||||
"AND (version = %u OR version = -1) AND spawngroupID = %i",
|
||||
zone, zone_version, spawn->GetSp2());
|
||||
zone, zone_version, spawn->GetSpawnGroupId());
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return 0;
|
||||
@@ -1464,7 +1472,7 @@ uint32 ZoneDatabase::AddNPCTypes(const char *zone, uint32 zone_version, Client *
|
||||
npc_type_id = results.LastInsertedID();
|
||||
|
||||
if (client)
|
||||
client->Message(0, "%s npc_type ID %i created successfully!", numberlessName, npc_type_id);
|
||||
client->Message(Chat::White, "%s npc_type ID %i created successfully!", numberlessName, npc_type_id);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -1570,7 +1578,7 @@ void NPC::PickPocket(Client* thief)
|
||||
//make sure were allowed to target them:
|
||||
int over_level = GetLevel();
|
||||
if(over_level > (thief->GetLevel() + THIEF_PICKPOCKET_OVER)) {
|
||||
thief->Message(13, "You are too inexperienced to pick pocket this target");
|
||||
thief->Message(Chat::Red, "You are too inexperienced to pick pocket this target");
|
||||
thief->SendPickPocketResponse(this, 0, PickPocketFailed);
|
||||
//should we check aggro
|
||||
return;
|
||||
@@ -1580,7 +1588,7 @@ void NPC::PickPocket(Client* thief)
|
||||
if (zone->CanDoCombat())
|
||||
AddToHateList(thief, 50);
|
||||
Say("Stop thief!");
|
||||
thief->Message(13, "You are noticed trying to steal!");
|
||||
thief->Message(Chat::Red, "You are noticed trying to steal!");
|
||||
thief->SendPickPocketResponse(this, 0, PickPocketFailed);
|
||||
return;
|
||||
}
|
||||
@@ -1687,7 +1695,7 @@ void NPC::PickPocket(Client* thief)
|
||||
return;
|
||||
}
|
||||
|
||||
thief->Message(0, "This target's pockets are empty");
|
||||
thief->Message(Chat::White, "This target's pockets are empty");
|
||||
thief->SendPickPocketResponse(this, 0, PickPocketFailed);
|
||||
}
|
||||
|
||||
@@ -1737,17 +1745,17 @@ void NPC::Disarm(Client* client, int chance) {
|
||||
SendWearChange(matslot);
|
||||
if ((CastToMob()->GetBodyType() == BT_Humanoid || CastToMob()->GetBodyType() == BT_Summoned) && eslot == EQEmu::invslot::slotPrimary)
|
||||
Say("Ahh! My weapon!");
|
||||
client->Message_StringID(MT_Skills, DISARM_SUCCESS, this->GetCleanName());
|
||||
client->MessageString(Chat::Skills, DISARM_SUCCESS, this->GetCleanName());
|
||||
if (chance != 1000)
|
||||
client->CheckIncreaseSkill(EQEmu::skills::SkillDisarm, nullptr, 4);
|
||||
return;
|
||||
}
|
||||
client->Message_StringID(MT_Skills, DISARM_FAILED);
|
||||
client->MessageString(Chat::Skills, DISARM_FAILED);
|
||||
if (chance != 1000)
|
||||
client->CheckIncreaseSkill(EQEmu::skills::SkillDisarm, nullptr, 2);
|
||||
return;
|
||||
}
|
||||
client->Message_StringID(MT_Skills, DISARM_FAILED);
|
||||
client->MessageString(Chat::Skills, DISARM_FAILED);
|
||||
}
|
||||
|
||||
void Mob::NPCSpecialAttacks(const char* parse, int permtag, bool reset, bool remove) {
|
||||
@@ -1895,7 +1903,7 @@ void Mob::NPCSpecialAttacks(const char* parse, int permtag, bool reset, bool rem
|
||||
{
|
||||
if(database.SetSpecialAttkFlag(this->GetNPCTypeID(), orig_parse))
|
||||
{
|
||||
Log(Logs::General, Logs::Normal, "NPCTypeID: %i flagged to '%s' for Special Attacks.\n",this->GetNPCTypeID(),orig_parse);
|
||||
LogInfo("NPCTypeID: [{}] flagged to [{}] for Special Attacks.\n",this->GetNPCTypeID(),orig_parse);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2145,7 +2153,7 @@ void NPC::ModifyNPCStat(const char *identifier, const char *new_value)
|
||||
std::string variable_key = StringFormat("modify_stat_%s", id.c_str());
|
||||
SetEntityVariable(variable_key.c_str(), new_value);
|
||||
|
||||
Log(Logs::Detail, Logs::NPCScaling, "NPC::ModifyNPCStat key: %s val: %s ", variable_key.c_str(), new_value);
|
||||
LogNPCScaling("NPC::ModifyNPCStat key: [{}] val: [{}] ", variable_key.c_str(), new_value);
|
||||
|
||||
if (id == "ac") {
|
||||
AC = atoi(val.c_str());
|
||||
@@ -2213,6 +2221,14 @@ void NPC::ModifyNPCStat(const char *identifier, const char *new_value)
|
||||
CR = atoi(val.c_str());
|
||||
return;
|
||||
}
|
||||
else if (id == "cor") {
|
||||
Corrup = atoi(val.c_str());
|
||||
return;
|
||||
}
|
||||
else if (id == "phr") {
|
||||
PhR = atoi(val.c_str());
|
||||
return;
|
||||
}
|
||||
else if (id == "pr") {
|
||||
PR = atoi(val.c_str());
|
||||
return;
|
||||
@@ -2577,7 +2593,7 @@ void NPC::DoNPCEmote(uint8 event_, uint16 emoteid)
|
||||
else if(nes->type == 2)
|
||||
this->Shout("%s",nes->text);
|
||||
else if(nes->type == 3)
|
||||
entity_list.MessageClose_StringID(this, true, 200, 10, GENERIC_STRING, nes->text);
|
||||
entity_list.MessageCloseString(this, true, 200, 10, GENERIC_STRING, nes->text);
|
||||
else
|
||||
this->Say("%s",nes->text);
|
||||
}
|
||||
@@ -2823,39 +2839,61 @@ void NPC::DepopSwarmPets()
|
||||
}
|
||||
}
|
||||
|
||||
void NPC::ModifyStatsOnCharm(bool bRemoved)
|
||||
void NPC::ModifyStatsOnCharm(bool is_charm_removed)
|
||||
{
|
||||
if (bRemoved) {
|
||||
if (charm_ac)
|
||||
if (is_charm_removed) {
|
||||
if (charm_ac) {
|
||||
AC = default_ac;
|
||||
if (charm_attack_delay)
|
||||
}
|
||||
if (charm_attack_delay) {
|
||||
attack_delay = default_attack_delay;
|
||||
if (charm_accuracy_rating)
|
||||
}
|
||||
if (charm_accuracy_rating) {
|
||||
accuracy_rating = default_accuracy_rating;
|
||||
if (charm_avoidance_rating)
|
||||
}
|
||||
if (charm_avoidance_rating) {
|
||||
avoidance_rating = default_avoidance_rating;
|
||||
if (charm_atk)
|
||||
}
|
||||
if (charm_atk) {
|
||||
ATK = default_atk;
|
||||
}
|
||||
if (charm_min_dmg || charm_max_dmg) {
|
||||
base_damage = round((default_max_dmg - default_min_dmg) / 1.9);
|
||||
min_damage = default_min_dmg - round(base_damage / 10.0);
|
||||
min_damage = default_min_dmg - round(base_damage / 10.0);
|
||||
}
|
||||
} else {
|
||||
if (charm_ac)
|
||||
AC = charm_ac;
|
||||
if (charm_attack_delay)
|
||||
attack_delay = charm_attack_delay;
|
||||
if (charm_accuracy_rating)
|
||||
accuracy_rating = charm_accuracy_rating;
|
||||
if (charm_avoidance_rating)
|
||||
avoidance_rating = charm_avoidance_rating;
|
||||
if (charm_atk)
|
||||
ATK = charm_atk;
|
||||
if (charm_min_dmg || charm_max_dmg) {
|
||||
base_damage = round((charm_max_dmg - charm_min_dmg) / 1.9);
|
||||
min_damage = charm_min_dmg - round(base_damage / 10.0);
|
||||
if (RuleB(Spells, CharmDisablesSpecialAbilities)) {
|
||||
ProcessSpecialAbilities(default_special_abilities);
|
||||
}
|
||||
|
||||
SetAttackTimer();
|
||||
CalcAC();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (charm_ac) {
|
||||
AC = charm_ac;
|
||||
}
|
||||
if (charm_attack_delay) {
|
||||
attack_delay = charm_attack_delay;
|
||||
}
|
||||
if (charm_accuracy_rating) {
|
||||
accuracy_rating = charm_accuracy_rating;
|
||||
}
|
||||
if (charm_avoidance_rating) {
|
||||
avoidance_rating = charm_avoidance_rating;
|
||||
}
|
||||
if (charm_atk) {
|
||||
ATK = charm_atk;
|
||||
}
|
||||
if (charm_min_dmg || charm_max_dmg) {
|
||||
base_damage = round((charm_max_dmg - charm_min_dmg) / 1.9);
|
||||
min_damage = charm_min_dmg - round(base_damage / 10.0);
|
||||
}
|
||||
if (RuleB(Spells, CharmDisablesSpecialAbilities)) {
|
||||
ClearSpecialAbilities();
|
||||
}
|
||||
|
||||
// the rest of the stats aren't cached, so lets just do these two instead of full CalcBonuses()
|
||||
SetAttackTimer();
|
||||
CalcAC();
|
||||
@@ -2909,3 +2947,15 @@ bool NPC::IsProximitySet()
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void NPC::SetSimpleRoamBox(float box_size, float move_distance, int move_delay)
|
||||
{
|
||||
AI_SetRoambox(
|
||||
(move_distance != 0 ? move_distance : box_size / 2),
|
||||
GetX() + box_size,
|
||||
GetX() - box_size,
|
||||
GetY() + box_size,
|
||||
GetY() - box_size,
|
||||
move_delay
|
||||
);
|
||||
}
|
||||
+15
-10
@@ -214,13 +214,13 @@ public:
|
||||
|
||||
virtual int32 CalcMaxMana();
|
||||
void SetGrid(int32 grid_){ grid=grid_; }
|
||||
void SetSp2(uint32 sg2){ spawn_group=sg2; }
|
||||
void SetSpawnGroupId(uint32 sg2){ spawn_group_id =sg2; }
|
||||
void SetWaypointMax(uint16 wp_){ wp_m=wp_; }
|
||||
void SetSaveWaypoint(uint16 wp_){ save_wp=wp_; }
|
||||
|
||||
uint16 GetWaypointMax() const { return wp_m; }
|
||||
int32 GetGrid() const { return grid; }
|
||||
uint32 GetSp2() const { return spawn_group; }
|
||||
uint32 GetSpawnGroupId() const { return spawn_group_id; }
|
||||
uint32 GetSpawnPointID() const;
|
||||
|
||||
glm::vec4 const GetSpawnPoint() const { return m_SpawnPoint; }
|
||||
@@ -294,7 +294,7 @@ public:
|
||||
int32 GetNPCHPRegen() const { return hp_regen + itembonuses.HPRegen + spellbonuses.HPRegen; }
|
||||
inline const char* GetAmmoIDfile() const { return ammo_idfile; }
|
||||
|
||||
void ModifyStatsOnCharm(bool bRemoved);
|
||||
void ModifyStatsOnCharm(bool is_charm_removed);
|
||||
|
||||
//waypoint crap
|
||||
int GetMaxWp() const { return max_wp; }
|
||||
@@ -453,6 +453,8 @@ public:
|
||||
|
||||
bool IgnoreDespawn() { return ignore_despawn; }
|
||||
|
||||
void SetSimpleRoamBox(float box_size, float move_distance = 0, int move_delay = 0);
|
||||
|
||||
float GetRoamboxMaxX() const;
|
||||
float GetRoamboxMaxY() const;
|
||||
float GetRoamboxMinX() const;
|
||||
@@ -468,6 +470,7 @@ public:
|
||||
|
||||
virtual int GetStuckBehavior() const { return NPCTypedata_ours ? NPCTypedata_ours->stuck_behavior : NPCTypedata->stuck_behavior; }
|
||||
|
||||
inline bool IsSkipAutoScale() const { return skip_auto_scale; }
|
||||
|
||||
protected:
|
||||
|
||||
@@ -477,13 +480,13 @@ protected:
|
||||
friend class EntityList;
|
||||
friend class Aura;
|
||||
std::list<struct NPCFaction*> faction_list;
|
||||
uint32 copper;
|
||||
uint32 silver;
|
||||
uint32 gold;
|
||||
uint32 platinum;
|
||||
int32 grid;
|
||||
uint32 spawn_group;
|
||||
uint16 wp_m;
|
||||
uint32 copper;
|
||||
uint32 silver;
|
||||
uint32 gold;
|
||||
uint32 platinum;
|
||||
int32 grid;
|
||||
uint32 spawn_group_id;
|
||||
uint16 wp_m;
|
||||
|
||||
int32 npc_faction_id;
|
||||
int32 primary_faction;
|
||||
@@ -538,6 +541,7 @@ protected:
|
||||
int default_accuracy_rating;
|
||||
int default_avoidance_rating;
|
||||
int default_atk;
|
||||
char default_special_abilities[512];
|
||||
|
||||
// when charmed, switch to these
|
||||
int charm_ac;
|
||||
@@ -612,6 +616,7 @@ protected:
|
||||
private:
|
||||
uint32 loottable_id;
|
||||
bool skip_global_loot;
|
||||
bool skip_auto_scale;
|
||||
bool p_depop;
|
||||
};
|
||||
|
||||
|
||||
+28
-36
@@ -24,8 +24,12 @@
|
||||
/**
|
||||
* @param npc
|
||||
*/
|
||||
void NpcScaleManager::ScaleNPC(NPC * npc)
|
||||
void NpcScaleManager::ScaleNPC(NPC *npc)
|
||||
{
|
||||
if (npc->IsSkipAutoScale()) {
|
||||
return;
|
||||
}
|
||||
|
||||
int8 npc_type = GetNPCScalingType(npc);
|
||||
int npc_level = npc->GetLevel();
|
||||
bool is_auto_scaled = IsAutoScaled(npc);
|
||||
@@ -33,7 +37,8 @@ void NpcScaleManager::ScaleNPC(NPC * npc)
|
||||
global_npc_scale scale_data = GetGlobalScaleDataForTypeLevel(npc_type, npc_level);
|
||||
|
||||
if (!scale_data.level) {
|
||||
Log(Logs::General, Logs::NPCScaling, "NPC: %s - scaling data not found for type: %i level: %i",
|
||||
LogNPCScaling(
|
||||
"NPC: [{}] - scaling data not found for type: [{}] level: [{}]",
|
||||
npc->GetCleanName(),
|
||||
npc_type,
|
||||
npc_level
|
||||
@@ -42,7 +47,7 @@ void NpcScaleManager::ScaleNPC(NPC * npc)
|
||||
return;
|
||||
}
|
||||
|
||||
if (npc->GetAC() == 0) {
|
||||
if (npc->GetAC() == 0 && is_auto_scaled) {
|
||||
npc->ModifyNPCStat("ac", std::to_string(scale_data.ac).c_str());
|
||||
}
|
||||
if (npc->GetMaxHP() == 0) {
|
||||
@@ -94,11 +99,11 @@ void NpcScaleManager::ScaleNPC(NPC * npc)
|
||||
if (npc->GetDR() == 0) {
|
||||
npc->ModifyNPCStat("dr", std::to_string(scale_data.disease_resist).c_str());
|
||||
}
|
||||
if (npc->GetCorrup() == 0) {
|
||||
npc->ModifyNPCStat("cr", std::to_string(scale_data.corruption_resist).c_str());
|
||||
if (npc->GetCorrup() == 0 && is_auto_scaled) {
|
||||
npc->ModifyNPCStat("cor", std::to_string(scale_data.corruption_resist).c_str());
|
||||
}
|
||||
if (npc->GetPhR() == 0) {
|
||||
npc->ModifyNPCStat("pr", std::to_string(scale_data.physical_resist).c_str());
|
||||
if (npc->GetPhR() == 0 && is_auto_scaled) {
|
||||
npc->ModifyNPCStat("phr", std::to_string(scale_data.physical_resist).c_str());
|
||||
}
|
||||
if (npc->GetMinDMG() == 0 && npc->GetMaxDMG() == 0) {
|
||||
int min_dmg = scale_data.min_dmg;
|
||||
@@ -106,11 +111,7 @@ void NpcScaleManager::ScaleNPC(NPC * npc)
|
||||
int32 class_level_damage_mod = GetClassLevelDamageMod(npc->GetLevel(), npc->GetClass());
|
||||
min_dmg = (min_dmg * class_level_damage_mod) / 220;
|
||||
|
||||
Log(Logs::Moderate,
|
||||
Logs::NPCScaling,
|
||||
"ClassLevelDamageMod::min_dmg base: %i calc: %i",
|
||||
scale_data.min_dmg,
|
||||
min_dmg);
|
||||
LogNPCScaling("ClassLevelDamageMod::min_dmg base: [{}] calc: [{}]", scale_data.min_dmg, min_dmg);
|
||||
}
|
||||
|
||||
npc->ModifyNPCStat("min_hit", std::to_string(min_dmg).c_str());
|
||||
@@ -121,12 +122,7 @@ void NpcScaleManager::ScaleNPC(NPC * npc)
|
||||
int32 class_level_damage_mod = GetClassLevelDamageMod(npc->GetLevel(), npc->GetClass());
|
||||
max_dmg = (scale_data.max_dmg * class_level_damage_mod) / 220;
|
||||
|
||||
Log(Logs::Moderate,
|
||||
Logs::NPCScaling,
|
||||
"ClassLevelDamageMod::max_dmg base: %i calc: %i",
|
||||
scale_data.max_dmg,
|
||||
max_dmg
|
||||
);
|
||||
LogNPCScaling("ClassLevelDamageMod::max_dmg base: [{}] calc: [{}]", scale_data.max_dmg, max_dmg);
|
||||
}
|
||||
|
||||
npc->ModifyNPCStat("max_hit", std::to_string(max_dmg).c_str());
|
||||
@@ -157,14 +153,14 @@ void NpcScaleManager::ScaleNPC(NPC * npc)
|
||||
}
|
||||
}
|
||||
|
||||
Log(Logs::General,
|
||||
Logs::NPCScaling,
|
||||
"(%s) level: %i type: %i Auto: %s Setting: %s",
|
||||
LogNPCScaling(
|
||||
"([{}]) level: [{}] type: [{}] Auto: [{}] Setting: [{}]",
|
||||
npc->GetCleanName(),
|
||||
npc_level,
|
||||
npc_type,
|
||||
(is_auto_scaled ? "true" : "false"),
|
||||
scale_log.c_str());
|
||||
scale_log.c_str()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,7 +242,7 @@ bool NpcScaleManager::LoadScaleData()
|
||||
);
|
||||
}
|
||||
|
||||
Log(Logs::General, Logs::NPCScaling, "Global Base Scaling Data Loaded...");
|
||||
LogNPCScaling("Global Base Scaling Data Loaded");
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -416,14 +412,14 @@ int8 NpcScaleManager::GetNPCScalingType(NPC *&npc)
|
||||
{
|
||||
std::string npc_name = npc->GetName();
|
||||
|
||||
if (npc->IsRareSpawn() || npc_name.find('#') != std::string::npos || isupper(npc_name[0])) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (npc->IsRaidTarget()) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (npc->IsRareSpawn() || npc_name.find('#') != std::string::npos || isupper(npc_name[0])) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -486,10 +482,8 @@ bool NpcScaleManager::ApplyGlobalBaseScalingToNPCStatically(NPC *&npc)
|
||||
global_npc_scale scale_data = GetGlobalScaleDataForTypeLevel(npc_type, npc_level);
|
||||
|
||||
if (!scale_data.level) {
|
||||
Log(
|
||||
Logs::General,
|
||||
Logs::NPCScaling,
|
||||
"NpcScaleManager::ApplyGlobalBaseScalingToNPCStatically NPC: %s - scaling data not found for type: %i level: %i",
|
||||
LogNPCScaling(
|
||||
"NpcScaleManager::ApplyGlobalBaseScalingToNPCStatically NPC: [{}] - scaling data not found for type: [{}] level: [{}]",
|
||||
npc->GetCleanName(),
|
||||
npc_type,
|
||||
npc_level
|
||||
@@ -574,10 +568,8 @@ bool NpcScaleManager::ApplyGlobalBaseScalingToNPCDynamically(NPC *&npc)
|
||||
global_npc_scale scale_data = GetGlobalScaleDataForTypeLevel(npc_type, npc_level);
|
||||
|
||||
if (!scale_data.level) {
|
||||
Log(
|
||||
Logs::General,
|
||||
Logs::NPCScaling,
|
||||
"NpcScaleManager::ApplyGlobalBaseScalingToNPCDynamically NPC: %s - scaling data not found for type: %i level: %i",
|
||||
LogNPCScaling(
|
||||
"NpcScaleManager::ApplyGlobalBaseScalingToNPCDynamically NPC: [{}] - scaling data not found for type: [{}] level: [{}]",
|
||||
npc->GetCleanName(),
|
||||
npc_type,
|
||||
npc_level
|
||||
@@ -621,4 +613,4 @@ bool NpcScaleManager::ApplyGlobalBaseScalingToNPCDynamically(NPC *&npc)
|
||||
auto results = database.QueryDatabase(query);
|
||||
|
||||
return results.Success();
|
||||
}
|
||||
}
|
||||
+15
-13
@@ -339,7 +339,7 @@ const EQEmu::ItemInstance* Object::GetItem(uint8 index) {
|
||||
void Object::PutItem(uint8 index, const EQEmu::ItemInstance* inst)
|
||||
{
|
||||
if (index > 9) {
|
||||
Log(Logs::General, Logs::Error, "Object::PutItem: Invalid index specified (%i)", index);
|
||||
LogError("Object::PutItem: Invalid index specified ([{}])", index);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -443,6 +443,14 @@ bool Object::Process(){
|
||||
if(m_ground_spawn && respawn_timer.Check()){
|
||||
RandomSpawn(true);
|
||||
}
|
||||
|
||||
if (user != nullptr && !entity_list.GetClientByCharID(user->CharacterID())) {
|
||||
m_inuse = false;
|
||||
last_user = user;
|
||||
user->SetTradeskillObject(nullptr);
|
||||
user = nullptr;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -465,7 +473,7 @@ void Object::RandomSpawn(bool send_packet) {
|
||||
}
|
||||
}
|
||||
|
||||
Log(Logs::Detail, Logs::Zone_Server, "Object::RandomSpawn(%s): %d (%.2f, %.2f, %.2f)", m_data.object_name, m_inst->GetID(), m_data.x, m_data.y, m_data.z);
|
||||
LogInfo("Object::RandomSpawn([{}]): [{}] ([{}], [{}], [{}])", m_data.object_name, m_inst->GetID(), m_data.x, m_data.y, m_data.z);
|
||||
|
||||
respawn_timer.Disable();
|
||||
|
||||
@@ -554,7 +562,6 @@ bool Object::HandleClick(Client* sender, const ClickObject_Struct* click_object)
|
||||
ClickObjectAction_Struct* coa = (ClickObjectAction_Struct*)outapp->pBuffer;
|
||||
|
||||
//TODO: there is prolly a better way to do this.
|
||||
m_inuse = true;
|
||||
coa->type = m_type;
|
||||
coa->unknown16 = 0x0a;
|
||||
|
||||
@@ -572,16 +579,10 @@ bool Object::HandleClick(Client* sender, const ClickObject_Struct* click_object)
|
||||
|
||||
if (sender->ClientVersion() >= EQEmu::versions::ClientVersion::RoF) {
|
||||
coa->drop_id = 0xFFFFFFFF;
|
||||
sender->Message(0, "Someone else is using that. Try again later.");
|
||||
sender->Message(Chat::White, "Someone else is using that. Try again later.");
|
||||
}
|
||||
}
|
||||
|
||||
if(sender->IsLooting())
|
||||
{
|
||||
coa->open = 0x00;
|
||||
user = sender;
|
||||
}
|
||||
|
||||
sender->QueuePacket(outapp);
|
||||
safe_delete(outapp);
|
||||
|
||||
@@ -590,6 +591,7 @@ bool Object::HandleClick(Client* sender, const ClickObject_Struct* click_object)
|
||||
return(false);
|
||||
|
||||
// Starting to use this object
|
||||
m_inuse = true;
|
||||
sender->SetTradeskillObject(this);
|
||||
|
||||
user = sender;
|
||||
@@ -645,7 +647,7 @@ uint32 ZoneDatabase::AddObject(uint32 type, uint32 icon, const Object_Struct& ob
|
||||
safe_delete_array(object_name);
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
Log(Logs::General, Logs::Error, "Unable to insert object: %s", results.ErrorMessage().c_str());
|
||||
LogError("Unable to insert object: [{}]", results.ErrorMessage().c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -684,7 +686,7 @@ void ZoneDatabase::UpdateObject(uint32 id, uint32 type, uint32 icon, const Objec
|
||||
safe_delete_array(object_name);
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
Log(Logs::General, Logs::Error, "Unable to update object: %s", results.ErrorMessage().c_str());
|
||||
LogError("Unable to update object: [{}]", results.ErrorMessage().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -728,7 +730,7 @@ void ZoneDatabase::DeleteObject(uint32 id)
|
||||
std::string query = StringFormat("DELETE FROM object WHERE id = %i", id);
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
Log(Logs::General, Logs::Error, "Unable to delete object: %s", results.ErrorMessage().c_str());
|
||||
LogError("Unable to delete object: [{}]", results.ErrorMessage().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-1851
File diff suppressed because it is too large.
Load diff
@@ -1,22 +0,0 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemu.org)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#ifndef OLDCODE_H
|
||||
#define OLDCODE_H
|
||||
|
||||
#endif
|
||||
|
||||
@@ -41,7 +41,7 @@ glm::mat4 CreateScaleMatrix(float sx, float sy, float sz) {
|
||||
return scale;
|
||||
}
|
||||
|
||||
OrientedBoundingBox::OrientedBoundingBox(glm::vec3 pos, glm::vec3 rot, glm::vec3 scale, glm::vec3 extents) {
|
||||
OrientedBoundingBox::OrientedBoundingBox(const glm::vec3 &pos, const glm::vec3 &rot, const glm::vec3 &scale, const glm::vec3 &extents) {
|
||||
min_x = -extents.x;
|
||||
max_x = extents.x;
|
||||
|
||||
@@ -81,7 +81,7 @@ OrientedBoundingBox::OrientedBoundingBox(glm::vec3 pos, glm::vec3 rot, glm::vec3
|
||||
inverted_transformation = glm::inverse(transformation);
|
||||
}
|
||||
|
||||
bool OrientedBoundingBox::ContainsPoint(glm::vec3 p) const {
|
||||
bool OrientedBoundingBox::ContainsPoint(const glm::vec3 &p) const {
|
||||
glm::vec4 pt(p.x, p.y, p.z, 1);
|
||||
glm::vec4 box_space_p = inverted_transformation * pt;
|
||||
|
||||
|
||||
@@ -8,10 +8,10 @@ class OrientedBoundingBox
|
||||
{
|
||||
public:
|
||||
OrientedBoundingBox() { }
|
||||
OrientedBoundingBox(glm::vec3 pos, glm::vec3 rot, glm::vec3 scale, glm::vec3 extents);
|
||||
OrientedBoundingBox(const glm::vec3 &pos, const glm::vec3 &rot, const glm::vec3 &scale, const glm::vec3 &extents);
|
||||
~OrientedBoundingBox() { }
|
||||
|
||||
bool ContainsPoint(glm::vec3 p) const;
|
||||
bool ContainsPoint(const glm::vec3 &p) const;
|
||||
|
||||
glm::mat4& GetTransformation() { return transformation; }
|
||||
glm::mat4& GetInvertedTransformation() { return inverted_transformation; }
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
extern Zone *zone;
|
||||
|
||||
const int MaxNavmeshNodes = 4096;
|
||||
const int MaxNavmeshNodes = 1024;
|
||||
|
||||
struct PathfinderNavmesh::Implementation
|
||||
{
|
||||
@@ -163,7 +163,7 @@ IPathfinder::IPath PathfinderNavmesh::FindPath(const glm::vec3 &start, const glm
|
||||
static const int max_polys = 256;
|
||||
dtPolyRef start_ref;
|
||||
dtPolyRef end_ref;
|
||||
glm::vec3 ext(5.0f, 100.0f, 5.0f);
|
||||
glm::vec3 ext(10.0f, 200.0f, 10.0f);
|
||||
|
||||
m_impl->query->findNearestPoly(¤t_location[0], &ext[0], &filter, &start_ref, 0);
|
||||
m_impl->query->findNearestPoly(&dest_location[0], &ext[0], &filter, &end_ref, 0);
|
||||
@@ -355,7 +355,7 @@ void PathfinderNavmesh::DebugCommand(Client *c, const Seperator *sep)
|
||||
{
|
||||
if (sep->arg[1][0] == '\0' || !strcasecmp(sep->arg[1], "help"))
|
||||
{
|
||||
c->Message(0, "#path show: Plots a path from the user to their target.");
|
||||
c->Message(Chat::White, "#path show: Plots a path from the user to their target.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -475,7 +475,7 @@ void PathfinderNavmesh::Load(const std::string &path)
|
||||
m_impl->nav_mesh->addTile(data, data_size, DT_TILE_FREE_DATA, tile_ref, 0);
|
||||
}
|
||||
|
||||
Log(Logs::General, Logs::Status, "Loaded Navmesh V%u file %s", version, path.c_str());
|
||||
LogInfo("Loaded Navmesh V[{}] file [{}]", version, path.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -200,9 +200,9 @@ void PathfinderWaypoint::DebugCommand(Client *c, const Seperator *sep)
|
||||
{
|
||||
if(sep->arg[1][0] == '\0' || !strcasecmp(sep->arg[1], "help"))
|
||||
{
|
||||
c->Message(0, "Syntax: #path shownodes: Spawns a npc to represent every npc node.");
|
||||
c->Message(0, "#path show: Plots a path from the user to their target.");
|
||||
c->Message(0, "#path info node_id: Gives information about node info (requires shownode target).");
|
||||
c->Message(Chat::White, "Syntax: #path shownodes: Spawns a npc to represent every npc node.");
|
||||
c->Message(Chat::White, "#path show: Plots a path from the user to their target.");
|
||||
c->Message(Chat::White, "#path info node_id: Gives information about node info (requires shownode target).");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -251,14 +251,14 @@ void PathfinderWaypoint::Load(const std::string &filename) {
|
||||
|
||||
if (strncmp(Magic, "EQEMUPATH", 9))
|
||||
{
|
||||
Log(Logs::General, Logs::Error, "Bad Magic String in .path file.");
|
||||
LogError("Bad Magic String in .path file");
|
||||
fclose(f);
|
||||
return;
|
||||
}
|
||||
|
||||
fread(&Head, sizeof(Head), 1, f);
|
||||
|
||||
Log(Logs::General, Logs::Status, "Path File Header: Version %ld, PathNodes %ld",
|
||||
LogInfo("Path File Header: Version [{}], PathNodes [{}]",
|
||||
(long)Head.version, (long)Head.PathNodeCount);
|
||||
|
||||
if (Head.version == 2)
|
||||
@@ -271,7 +271,7 @@ void PathfinderWaypoint::Load(const std::string &filename) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
Log(Logs::General, Logs::Error, "Unsupported path file version.");
|
||||
LogError("Unsupported path file version");
|
||||
fclose(f);
|
||||
return;
|
||||
}
|
||||
@@ -306,7 +306,7 @@ void PathfinderWaypoint::LoadV2(FILE *f, const PathFileHeader &header)
|
||||
auto &node = m_impl->Nodes[i];
|
||||
if (PathNodes[i].Neighbours[j].id > MaxNodeID)
|
||||
{
|
||||
Log(Logs::General, Logs::Error, "Path Node %i, Neighbour %i (%i) out of range.", i, j, PathNodes[i].Neighbours[j].id);
|
||||
LogError("Path Node [{}], Neighbour [{}] ([{}]) out of range", i, j, PathNodes[i].Neighbours[j].id);
|
||||
m_impl->PathFileValid = false;
|
||||
}
|
||||
|
||||
@@ -425,11 +425,11 @@ void PathfinderWaypoint::NodeInfo(Client *c)
|
||||
return;
|
||||
}
|
||||
|
||||
c->Message(0, "Pathing node: %i at (%.2f, %.2f, %.2f) with bestz %.2f",
|
||||
c->Message(Chat::White, "Pathing node: %i at (%.2f, %.2f, %.2f) with bestz %.2f",
|
||||
node->id, node->v.x, node->v.y, node->v.z, node->bestz);
|
||||
|
||||
for (auto &edge : node->edges) {
|
||||
c->Message(0, "id: %i, distance: %.2f, door id: %i, is teleport: %i",
|
||||
c->Message(Chat::White, "id: %i, distance: %.2f, door id: %i, is teleport: %i",
|
||||
edge.first,
|
||||
edge.second.distance,
|
||||
edge.second.door_id,
|
||||
|
||||
+22
-19
@@ -1,5 +1,5 @@
|
||||
#include "../common/global_define.h"
|
||||
#include "../common/event/background_task.h"
|
||||
#include "../common/event/task.h"
|
||||
|
||||
#include "client.h"
|
||||
#include "zone.h"
|
||||
@@ -30,7 +30,7 @@ void CullPoints(std::vector<FindPerson_Point> &points) {
|
||||
|
||||
if (zone->zonemap->CheckLoS(glm::vec3(p.x, p.y, p.z), glm::vec3(p2.x, p2.y, p2.z))) {
|
||||
points.erase(points.begin() + i + 1);
|
||||
Log(Logs::General, Logs::Status, "Culled find path point %u, connecting %u->%u instead.", i + 1, i, i + 2);
|
||||
LogInfo("Culled find path point [{}], connecting [{}]->[{}] instead", i + 1, i, i + 2);
|
||||
}
|
||||
else {
|
||||
break;
|
||||
@@ -40,53 +40,56 @@ void CullPoints(std::vector<FindPerson_Point> &points) {
|
||||
}
|
||||
|
||||
void Client::SendPathPacket(const std::vector<FindPerson_Point> &points) {
|
||||
EQ::BackgroundTask task([](EQEmu::Any &data) {
|
||||
auto &points = EQEmu::any_cast<std::vector<FindPerson_Point>&>(data);
|
||||
EQEmu::Any data(points);
|
||||
EQ::Task([=](EQ::Task::ResolveFn resolve, EQ::Task::RejectFn reject) {
|
||||
auto points = EQEmu::any_cast<std::vector<FindPerson_Point>>(data);
|
||||
CullPoints(points);
|
||||
}, [this](EQEmu::Any &data) {
|
||||
auto &points = EQEmu::any_cast<std::vector<FindPerson_Point>&>(data);
|
||||
|
||||
resolve(points);
|
||||
})
|
||||
.Then([this](const EQEmu::Any &result) {
|
||||
auto points = EQEmu::any_cast<std::vector<FindPerson_Point>>(result);
|
||||
if (points.size() < 2) {
|
||||
if (Admin() > 10) {
|
||||
Message(MT_System, "Too few points");
|
||||
Message(Chat::System, "Too few points");
|
||||
}
|
||||
|
||||
|
||||
EQApplicationPacket outapp(OP_FindPersonReply, 0);
|
||||
QueuePacket(&outapp);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (points.size() > 36) {
|
||||
if (Admin() > 10) {
|
||||
Message(MT_System, "Too many points %u", points.size());
|
||||
Message(Chat::System, "Too many points %u", points.size());
|
||||
}
|
||||
|
||||
|
||||
EQApplicationPacket outapp(OP_FindPersonReply, 0);
|
||||
QueuePacket(&outapp);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (Admin() > 10) {
|
||||
Message(MT_System, "Total points %u", points.size());
|
||||
Message(Chat::System, "Total points %u", points.size());
|
||||
}
|
||||
|
||||
|
||||
int len = sizeof(FindPersonResult_Struct) + (points.size() + 1) * sizeof(FindPerson_Point);
|
||||
auto outapp = new EQApplicationPacket(OP_FindPersonReply, len);
|
||||
FindPersonResult_Struct* fpr = (FindPersonResult_Struct*)outapp->pBuffer;
|
||||
|
||||
|
||||
std::vector<FindPerson_Point>::iterator cur, end;
|
||||
cur = points.begin();
|
||||
end = points.end();
|
||||
unsigned int r;
|
||||
for (r = 0; cur != end; ++cur, r++) {
|
||||
fpr->path[r] = *cur;
|
||||
|
||||
|
||||
}
|
||||
//put the last element into the destination field
|
||||
--cur;
|
||||
fpr->path[r] = *cur;
|
||||
fpr->dest = *cur;
|
||||
|
||||
|
||||
FastQueuePacket(&outapp);
|
||||
}, points);
|
||||
})
|
||||
.Run();
|
||||
}
|
||||
+190
-51
@@ -174,7 +174,7 @@ XS(XS_Client_Kick) {
|
||||
if (THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
THIS->Kick();
|
||||
THIS->Kick("Perl Quest");
|
||||
}
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
@@ -961,8 +961,7 @@ XS(XS_Client_SetEXP); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Client_SetEXP) {
|
||||
dXSARGS;
|
||||
if (items < 3 || items > 4)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: Client::SetEXP(THIS, uint32 experience_points, uint32 aa_experience_points, [bool resexp=false])");
|
||||
Perl_croak(aTHX_ "Usage: Client::SetEXP(THIS, uint32 experience_points, uint32 aa_experience_points, [bool resexp=false])");
|
||||
{
|
||||
Client *THIS;
|
||||
uint32 set_exp = (uint32) SvUV(ST(1));
|
||||
@@ -992,8 +991,7 @@ XS(XS_Client_SetBindPoint); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Client_SetBindPoint) {
|
||||
dXSARGS;
|
||||
if (items < 1 || items > 6)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: Client::SetBindPoint(THIS, int to_zone = -1, int to_instance = 0, float new_x = 0.0f, float new_y = 0.0f, float new_z = 0.0f)");
|
||||
Perl_croak(aTHX_ "Usage: Client::SetBindPoint(THIS, int to_zone = -1, int to_instance = 0, float new_x = 0.0f, float new_y = 0.0f, float new_z = 0.0f)");
|
||||
{
|
||||
Client *THIS;
|
||||
int to_zone;
|
||||
@@ -1231,20 +1229,18 @@ XS(XS_Client_MovePC) {
|
||||
THIS->MovePC(zoneID, x, y, z, heading);
|
||||
} else {
|
||||
if (THIS->IsMerc()) {
|
||||
Log(Logs::Detail, Logs::None,
|
||||
"[CLIENT] Perl(XS_Client_MovePC) attempted to process a type Merc reference");
|
||||
} else if (THIS->IsNPC()) {
|
||||
Log(Logs::Detail, Logs::None,
|
||||
"[CLIENT] Perl(XS_Client_MovePC) attempted to process a type NPC reference");
|
||||
LogDebug("[CLIENT] Perl(XS_Client_MovePC) attempted to process a type Merc reference");
|
||||
}
|
||||
#ifdef BOTS
|
||||
else if (THIS->IsBot()) {
|
||||
Log(Logs::Detail, Logs::None, "[CLIENT] Perl(XS_Client_MovePC) attempted to process a type Bot reference");
|
||||
}
|
||||
else if (THIS->IsBot()) {
|
||||
LogDebug("[CLIENT] Perl(XS_Client_MovePC) attempted to process a type Bot reference");
|
||||
}
|
||||
#endif
|
||||
else if (THIS->IsNPC()) {
|
||||
LogDebug("[CLIENT] Perl(XS_Client_MovePC) attempted to process a type NPC reference");
|
||||
}
|
||||
else {
|
||||
Log(Logs::Detail, Logs::None,
|
||||
"[CLIENT] Perl(XS_Client_MovePC) attempted to process an Unknown type reference");
|
||||
LogDebug("[CLIENT] Perl(XS_Client_MovePC) attempted to process an Unknown type reference");
|
||||
}
|
||||
|
||||
Perl_croak(aTHX_ "THIS is not of type Client");
|
||||
@@ -1258,8 +1254,7 @@ XS(XS_Client_MovePCInstance); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Client_MovePCInstance) {
|
||||
dXSARGS;
|
||||
if (items != 7)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: Client::MovePCInstance(THIS, uint32 zone_id, uint32 instance_id, float x, float y, float z, float heading)");
|
||||
Perl_croak(aTHX_ "Usage: Client::MovePCInstance(THIS, uint32 zone_id, uint32 instance_id, float x, float y, float z, float heading)");
|
||||
{
|
||||
Client *THIS;
|
||||
uint32 zoneID = (uint32) SvUV(ST(1));
|
||||
@@ -1281,20 +1276,18 @@ XS(XS_Client_MovePCInstance) {
|
||||
THIS->MovePC(zoneID, instanceID, x, y, z, heading);
|
||||
} else {
|
||||
if (THIS->IsMerc()) {
|
||||
Log(Logs::Detail, Logs::None,
|
||||
"[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type Merc reference");
|
||||
} else if (THIS->IsNPC()) {
|
||||
Log(Logs::Detail, Logs::None,
|
||||
"[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type NPC reference");
|
||||
LogDebug("[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type Merc reference");
|
||||
}
|
||||
#ifdef BOTS
|
||||
else if (THIS->IsBot()) {
|
||||
Log(Logs::Detail, Logs::None, "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type Bot reference");
|
||||
}
|
||||
else if (THIS->IsBot()) {
|
||||
LogDebug("[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type Bot reference");
|
||||
}
|
||||
#endif
|
||||
else if (THIS->IsNPC()) {
|
||||
LogDebug("[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type NPC reference");
|
||||
}
|
||||
else {
|
||||
Log(Logs::Detail, Logs::None,
|
||||
"[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process an Unknown type reference");
|
||||
LogDebug("[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process an Unknown type reference");
|
||||
}
|
||||
|
||||
Perl_croak(aTHX_ "THIS is not of type Client");
|
||||
@@ -1331,8 +1324,7 @@ XS(XS_Client_GetFactionLevel); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Client_GetFactionLevel) {
|
||||
dXSARGS;
|
||||
if (items != 8)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: Client::GetFactionLevel(THIS, uint32 character_id, uint32 npc_id, uint32 player_race_id, uint32 player_class_id, uint32 player_deity_id, uint32 player_faction_id, Mob*)");
|
||||
Perl_croak(aTHX_ "Usage: Client::GetFactionLevel(THIS, uint32 character_id, uint32 npc_id, uint32 player_race_id, uint32 player_class_id, uint32 player_deity_id, uint32 player_faction_id, Mob*)");
|
||||
{
|
||||
Client *THIS;
|
||||
FACTION_VALUE RETVAL;
|
||||
@@ -1372,8 +1364,7 @@ XS(XS_Client_SetFactionLevel); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Client_SetFactionLevel) {
|
||||
dXSARGS;
|
||||
if (items != 6)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: Client::SetFactionLevel(THIS, uint32 character_id, uint32 npc_id, uint8 character_class, uint8 character_race, uint8 character_deity)");
|
||||
Perl_croak(aTHX_ "Usage: Client::SetFactionLevel(THIS, uint32 character_id, uint32 npc_id, uint8 character_class, uint8 character_race, uint8 character_deity)");
|
||||
{
|
||||
Client *THIS;
|
||||
uint32 char_id = (uint32) SvUV(ST(1));
|
||||
@@ -1399,8 +1390,7 @@ XS(XS_Client_SetFactionLevel2); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Client_SetFactionLevel2) {
|
||||
dXSARGS;
|
||||
if (items < 7 || items > 8)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: Client::SetFactionLevel2(THIS, uint32 character_id, int32 faction_id, uint8 character_class, uint8 character_race, uint8 character_deity, int32 value, uint8 temp)");
|
||||
Perl_croak(aTHX_ "Usage: Client::SetFactionLevel2(THIS, uint32 character_id, int32 faction_id, uint8 character_class, uint8 character_race, uint8 character_deity, int32 value, uint8 temp)");
|
||||
{
|
||||
Client *THIS;
|
||||
uint32 char_id = (uint32) SvUV(ST(1));
|
||||
@@ -1720,8 +1710,7 @@ XS(XS_Client_AddMoneyToPP); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Client_AddMoneyToPP) {
|
||||
dXSARGS;
|
||||
if (items != 6)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: Client::AddMoneyToPP(THIS, uint32 copper, uint32 silver, uint32 gold, uint32 platinum, bool update_client)");
|
||||
Perl_croak(aTHX_ "Usage: Client::AddMoneyToPP(THIS, uint32 copper, uint32 silver, uint32 gold, uint32 platinum, bool update_client)");
|
||||
{
|
||||
Client *THIS;
|
||||
uint32 copper = (uint32) SvUV(ST(1));
|
||||
@@ -2404,6 +2393,57 @@ XS(XS_Client_UnmemSpellAll) {
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
XS(XS_Client_FindMemmedSpellBySlot); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Client_FindMemmedSpellBySlot) {
|
||||
dXSARGS;
|
||||
if (items != 2)
|
||||
Perl_croak(aTHX_ "Usage: Client::FindMemmedSpellBySlot(THIS, int slot)");
|
||||
{
|
||||
Client *THIS;
|
||||
uint16 RETVAL;
|
||||
dXSTARG;
|
||||
int slot = SvIV(ST(1));
|
||||
|
||||
if (sv_derived_from(ST(0), "Client")) {
|
||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
||||
THIS = INT2PTR(Client *, tmp);
|
||||
} else
|
||||
Perl_croak(aTHX_ "THIS is not of type Client");
|
||||
if (THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
RETVAL = THIS->FindMemmedSpellBySlot(slot);
|
||||
XSprePUSH;
|
||||
PUSHu((UV) RETVAL);
|
||||
}
|
||||
XSRETURN(1);
|
||||
}
|
||||
|
||||
XS(XS_Client_MemmedCount); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Client_MemmedCount) {
|
||||
dXSARGS;
|
||||
if (items != 1)
|
||||
Perl_croak(aTHX_ "Usage: Client::MemmedCount(THIS)");
|
||||
{
|
||||
Client *THIS;
|
||||
uint32 RETVAL;
|
||||
dXSTARG;
|
||||
|
||||
if (sv_derived_from(ST(0), "Client")) {
|
||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
||||
THIS = INT2PTR(Client *, tmp);
|
||||
} else
|
||||
Perl_croak(aTHX_ "THIS is not of type Client");
|
||||
if (THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
RETVAL = THIS->MemmedCount();
|
||||
XSprePUSH;
|
||||
PUSHu((UV) RETVAL);
|
||||
}
|
||||
XSRETURN(1);
|
||||
}
|
||||
|
||||
XS(XS_Client_ScribeSpell); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Client_ScribeSpell) {
|
||||
dXSARGS;
|
||||
@@ -2596,6 +2636,32 @@ XS(XS_Client_UntrainDiscAll) {
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
XS(XS_Client_IsStanding); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Client_IsStanding)
|
||||
{
|
||||
dXSARGS;
|
||||
if (items != 1)
|
||||
Perl_croak(aTHX_ "Usage: Client::IsStanding(THIS)");
|
||||
{
|
||||
Client * THIS;
|
||||
bool RETVAL;
|
||||
|
||||
if (sv_derived_from(ST(0), "Client")) {
|
||||
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
||||
THIS = INT2PTR(Client *,tmp);
|
||||
}
|
||||
else
|
||||
Perl_croak(aTHX_ "THIS is not of type Client");
|
||||
if(THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
RETVAL = THIS->IsStanding();
|
||||
ST(0) = boolSV(RETVAL);
|
||||
sv_2mortal(ST(0));
|
||||
}
|
||||
XSRETURN(1);
|
||||
}
|
||||
|
||||
XS(XS_Client_IsSitting); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Client_IsSitting) {
|
||||
dXSARGS;
|
||||
@@ -2620,6 +2686,32 @@ XS(XS_Client_IsSitting) {
|
||||
XSRETURN(1);
|
||||
}
|
||||
|
||||
XS(XS_Client_IsCrouching); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Client_IsCrouching)
|
||||
{
|
||||
dXSARGS;
|
||||
if (items != 1)
|
||||
Perl_croak(aTHX_ "Usage: Client::IsCrouching(THIS)");
|
||||
{
|
||||
Client * THIS;
|
||||
bool RETVAL;
|
||||
|
||||
if (sv_derived_from(ST(0), "Client")) {
|
||||
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
||||
THIS = INT2PTR(Client *,tmp);
|
||||
}
|
||||
else
|
||||
Perl_croak(aTHX_ "THIS is not of type Client");
|
||||
if(THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
RETVAL = THIS->IsCrouching();
|
||||
ST(0) = boolSV(RETVAL);
|
||||
sv_2mortal(ST(0));
|
||||
}
|
||||
XSRETURN(1);
|
||||
}
|
||||
|
||||
XS(XS_Client_IsBecomeNPC); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Client_IsBecomeNPC) {
|
||||
dXSARGS;
|
||||
@@ -2988,8 +3080,7 @@ XS(XS_Client_DeleteItemInInventory); /* prototype to pass -Wmissing-prototypes *
|
||||
XS(XS_Client_DeleteItemInInventory) {
|
||||
dXSARGS;
|
||||
if (items < 2 || items > 4)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: Client::DeleteItemInInventory(THIS, int16 slot_id, [int8 quantity = 0], [bool client_update = false])");
|
||||
Perl_croak(aTHX_ "Usage: Client::DeleteItemInInventory(THIS, int16 slot_id, [int8 quantity = 0], [bool client_update = false])");
|
||||
{
|
||||
Client *THIS;
|
||||
int16 slot_id = (int16) SvIV(ST(1));
|
||||
@@ -3025,8 +3116,7 @@ XS(XS_Client_SummonItem); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Client_SummonItem) {
|
||||
dXSARGS;
|
||||
if (items < 2 || items > 10)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: Client::SummonItem(THIS, uint32 item_id, [int16 charges = -1], [bool attune = false], [uint32 aug1 = 0], [uint32 aug2 = 0], [uint32 aug3 = 0], [uint32 aug4 = 0], [uint32 aug5 = 0], [uint16 slot_id = cursor])");
|
||||
Perl_croak(aTHX_ "Usage: Client::SummonItem(THIS, uint32 item_id, [int16 charges = -1], [bool attune = false], [uint32 aug1 = 0], [uint32 aug2 = 0], [uint32 aug3 = 0], [uint32 aug4 = 0], [uint32 aug5 = 0], [uint16 slot_id = cursor])");
|
||||
{
|
||||
Client *THIS;
|
||||
uint32 item_id = (uint32) SvUV(ST(1));
|
||||
@@ -4727,8 +4817,7 @@ XS(XS_Client_GrantAlternateAdvancementAbility); /* prototype to pass -Wmissing-p
|
||||
XS(XS_Client_GrantAlternateAdvancementAbility) {
|
||||
dXSARGS;
|
||||
if (items < 3 || items > 4)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: Client::GrantAlternateAdvancementAbility(THIS, int aa_id, int points, [bool ignore_cost = false])");
|
||||
Perl_croak(aTHX_ "Usage: Client::GrantAlternateAdvancementAbility(THIS, int aa_id, int points, [bool ignore_cost = false])");
|
||||
{
|
||||
Client *THIS;
|
||||
bool RETVAL;
|
||||
@@ -4885,8 +4974,7 @@ XS(XS_Client_UpdateTaskActivity); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Client_UpdateTaskActivity) {
|
||||
dXSARGS;
|
||||
if (items < 4)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: Client::UpdateTaskActivity(THIS, int task_id, int activity_id, int count, [bool ignore_quest_update = false])");
|
||||
Perl_croak(aTHX_ "Usage: Client::UpdateTaskActivity(THIS, int task_id, int activity_id, int count, [bool ignore_quest_update = false])");
|
||||
{
|
||||
bool ignore_quest_update = false;
|
||||
|
||||
@@ -4945,8 +5033,7 @@ XS(XS_Client_AssignTask); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Client_AssignTask) {
|
||||
dXSARGS;
|
||||
if (items != 3 && items != 4)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: Client::AssignTask(THIS, int task_id, int npc_id, [bool enforce_level_requirement = false])");
|
||||
Perl_croak(aTHX_ "Usage: Client::AssignTask(THIS, int task_id, int npc_id, [bool enforce_level_requirement = false])");
|
||||
{
|
||||
Client *THIS;
|
||||
int TaskID = (int) SvIV(ST(1));
|
||||
@@ -5455,6 +5542,55 @@ XS(XS_Client_AddAlternateCurrencyValue) {
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
XS(XS_Client_SetAlternateCurrencyValue); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Client_SetAlternateCurrencyValue) {
|
||||
dXSARGS;
|
||||
if (items != 3)
|
||||
Perl_croak(aTHX_ "Usage: Client::SetAlternateCurrencyValue(THIS, uint32 currency_id, int32 amount)");
|
||||
{
|
||||
Client *THIS;
|
||||
uint32 currency_id = (uint32) SvUV(ST(1));
|
||||
int32 amount = (int32) SvUV(ST(2));
|
||||
|
||||
if (sv_derived_from(ST(0), "Client")) {
|
||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
||||
THIS = INT2PTR(Client *, tmp);
|
||||
} else
|
||||
Perl_croak(aTHX_ "THIS is not of type Client");
|
||||
if (THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
THIS->SetAlternateCurrencyValue(currency_id, amount);
|
||||
}
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
XS(XS_Client_GetAlternateCurrencyValue); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Client_GetAlternateCurrencyValue) {
|
||||
dXSARGS;
|
||||
if (items != 2)
|
||||
Perl_croak(aTHX_ "Usage: Client::GetAlternateCurrencyValue(THIS, uint32 currency_id)");
|
||||
{
|
||||
Client *THIS;
|
||||
uint32 currency_id = (uint32) SvUV(ST(1));
|
||||
int32 RETVAL = 0;
|
||||
dXSTARG;
|
||||
|
||||
if (sv_derived_from(ST(0), "Client")) {
|
||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
||||
THIS = INT2PTR(Client *, tmp);
|
||||
} else
|
||||
Perl_croak(aTHX_ "THIS is not of type Client");
|
||||
if (THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
RETVAL = THIS->GetAlternateCurrencyValue(currency_id);
|
||||
XSprePUSH;
|
||||
PUSHi((IV) RETVAL);
|
||||
}
|
||||
XSRETURN(1);
|
||||
}
|
||||
|
||||
XS(XS_Client_SendWebLink); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Client_SendWebLink) {
|
||||
dXSARGS;
|
||||
@@ -5808,8 +5944,7 @@ XS(XS_Client_SendMarqueeMessage); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Client_SendMarqueeMessage) {
|
||||
dXSARGS;
|
||||
if (items != 7)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: Client::SendMarqueeMessage(THIS, uint32 type, uint32 priority, uint32 fade_in, uint32 fade_out, uint32 duration, string msg)");
|
||||
Perl_croak(aTHX_ "Usage: Client::SendMarqueeMessage(THIS, uint32 type, uint32 priority, uint32 fade_in, uint32 fade_out, uint32 duration, string msg)");
|
||||
{
|
||||
Client *THIS;
|
||||
uint32 type = (uint32) SvUV(ST(1));
|
||||
@@ -5988,8 +6123,7 @@ XS(XS_Client_QuestReward); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Client_QuestReward) {
|
||||
dXSARGS;
|
||||
if (items < 1 || items > 9)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: Client::QuestReward(THIS, int32 mob, int32 copper, int32 silver, int32 gold, int32 platinum, int32 item_id, int32 exp, [bool faction = false])");
|
||||
Perl_croak(aTHX_ "Usage: Client::QuestReward(THIS, int32 mob, int32 copper, int32 silver, int32 gold, int32 platinum, int32 item_id, int32 exp, [bool faction = false])");
|
||||
{
|
||||
Client *THIS;
|
||||
Mob *mob = nullptr;
|
||||
@@ -6089,8 +6223,7 @@ XS(XS_Client_Popup2); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Client_Popup2) {
|
||||
dXSARGS;
|
||||
if (items < 3 || items > 10)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: Client::SendFullPopup(THIS, string title, string text, uint32 popup_id, uint32 negative_id, uint32 buttons, uint32 duration, string button_name_0, string button_name_1, uint32 sound_controls)");
|
||||
Perl_croak(aTHX_ "Usage: Client::SendFullPopup(THIS, string title, string text, uint32 popup_id, uint32 negative_id, uint32 buttons, uint32 duration, string button_name_0, string button_name_1, uint32 sound_controls)");
|
||||
{
|
||||
Client *THIS;
|
||||
char *Title = (char *) SvPV_nolen(ST(1));
|
||||
@@ -6243,6 +6376,7 @@ XS(boot_Client) {
|
||||
newXSproto(strcpy(buf, "GetAccountFlag"), XS_Client_GetAccountFlag, file, "$$");
|
||||
newXSproto(strcpy(buf, "GetAggroCount"), XS_Client_GetAggroCount, file, "$");
|
||||
newXSproto(strcpy(buf, "GetAllMoney"), XS_Client_GetAllMoney, file, "$");
|
||||
newXSproto(strcpy(buf, "GetAlternateCurrencyValue"), XS_Client_GetAlternateCurrencyValue, file, "$$");
|
||||
newXSproto(strcpy(buf, "GetAnon"), XS_Client_GetAnon, file, "$");
|
||||
newXSproto(strcpy(buf, "GetAugmentAt"), XS_Client_GetAugmentAt, file, "$$$");
|
||||
newXSproto(strcpy(buf, "GetAugmentIDAt"), XS_Client_GetAugmentIDAt, file, "$$$");
|
||||
@@ -6338,7 +6472,9 @@ XS(boot_Client) {
|
||||
newXSproto(strcpy(buf, "IsLD"), XS_Client_IsLD, file, "$");
|
||||
newXSproto(strcpy(buf, "IsMedding"), XS_Client_IsMedding, file, "$");
|
||||
newXSproto(strcpy(buf, "IsRaidGrouped"), XS_Client_IsRaidGrouped, file, "$");
|
||||
newXSproto(strcpy(buf, "IsStanding"), XS_Client_IsStanding, file, "$");
|
||||
newXSproto(strcpy(buf, "IsSitting"), XS_Client_IsSitting, file, "$");
|
||||
newXSproto(strcpy(buf, "IsCrouching"), XS_Client_IsCrouching, file, "$");
|
||||
newXSproto(strcpy(buf, "IsTaskActive"), XS_Client_IsTaskActive, file, "$$");
|
||||
newXSproto(strcpy(buf, "IsTaskActivityActive"), XS_Client_IsTaskActivityActive, file, "$$$");
|
||||
newXSproto(strcpy(buf, "IsTaskCompleted"), XS_Client_IsTaskCompleted, file, "$$");
|
||||
@@ -6378,6 +6514,7 @@ XS(boot_Client) {
|
||||
newXSproto(strcpy(buf, "SetAAPoints"), XS_Client_SetAAPoints, file, "$$");
|
||||
newXSproto(strcpy(buf, "SetAATitle"), XS_Client_SetAATitle, file, "$$;$");
|
||||
newXSproto(strcpy(buf, "SetAccountFlag"), XS_Client_SetAccountFlag, file, "$$");
|
||||
newXSproto(strcpy(buf, "SetAlternateCurrencyValue"), XS_Client_SetAlternateCurrencyValue, file, "$$$");
|
||||
newXSproto(strcpy(buf, "SetBaseClass"), XS_Client_SetBaseClass, file, "$$");
|
||||
newXSproto(strcpy(buf, "SetBaseGender"), XS_Client_SetBaseGender, file, "$$");
|
||||
newXSproto(strcpy(buf, "SetBaseRace"), XS_Client_SetBaseRace, file, "$$");
|
||||
@@ -6424,6 +6561,8 @@ XS(boot_Client) {
|
||||
newXSproto(strcpy(buf, "UnmemSpell"), XS_Client_UnmemSpell, file, "$$;$");
|
||||
newXSproto(strcpy(buf, "UnmemSpellAll"), XS_Client_UnmemSpellAll, file, "$;$");
|
||||
newXSproto(strcpy(buf, "UnmemSpellBySpellID"), XS_Client_UnmemSpellBySpellID, file, "$$");
|
||||
newXSproto(strcpy(buf, "FindMemmedSpellBySlot"), XS_Client_FindMemmedSpellBySlot, file, "$$");
|
||||
newXSproto(strcpy(buf, "MemmedCount"), XS_Client_MemmedCount, file, "$");
|
||||
newXSproto(strcpy(buf, "UnscribeSpell"), XS_Client_UnscribeSpell, file, "$$;$");
|
||||
newXSproto(strcpy(buf, "UnscribeSpellAll"), XS_Client_UnscribeSpellAll, file, "$;$");
|
||||
newXSproto(strcpy(buf, "UntrainDisc"), XS_Client_UntrainDisc, file, "$$;$");
|
||||
|
||||
@@ -1222,8 +1222,7 @@ XS(XS_EntityList_MessageStatus); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_EntityList_MessageStatus) {
|
||||
dXSARGS;
|
||||
if (items < 5)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: EntityList::MessageStatus(THIS, uint32 guild_id, uint32 emote_color_type, string message)");
|
||||
Perl_croak(aTHX_ "Usage: EntityList::MessageStatus(THIS, uint32 guild_id, uint32 emote_color_type, string message)");
|
||||
{
|
||||
EntityList *THIS;
|
||||
uint32 to_guilddbid = (uint32) SvUV(ST(1));
|
||||
@@ -1248,8 +1247,7 @@ XS(XS_EntityList_MessageClose); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_EntityList_MessageClose) {
|
||||
dXSARGS;
|
||||
if (items < 6)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: EntityList::MessageClose(THIS, Mob* sender, bool skip_sender, float distance, uint32 emote_color_type, string message)");
|
||||
Perl_croak(aTHX_ "Usage: EntityList::MessageClose(THIS, Mob* sender, bool skip_sender, float distance, uint32 emote_color_type, string message)");
|
||||
{
|
||||
EntityList *THIS;
|
||||
Mob *sender;
|
||||
@@ -1682,8 +1680,7 @@ XS(XS_EntityList_MessageGroup); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_EntityList_MessageGroup) {
|
||||
dXSARGS;
|
||||
if (items < 5)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: EntityList::MessageGroup(THIS, Mob* sender, bool skip_close, uint32 emote_color_type, string message)");
|
||||
Perl_croak(aTHX_ "Usage: EntityList::MessageGroup(THIS, Mob* sender, bool skip_close, uint32 emote_color_type, string message)");
|
||||
{
|
||||
EntityList *THIS;
|
||||
Mob *sender;
|
||||
@@ -1716,8 +1713,7 @@ XS(XS_EntityList_GetRandomClient); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_EntityList_GetRandomClient) {
|
||||
dXSARGS;
|
||||
if ((items < 5) || (items > 6))
|
||||
Perl_croak(aTHX_
|
||||
"Usage: EntityList::GetRandomClient(THIS, float x, float y, float z, float distance, [Client* exclude_client = nullptr])");
|
||||
Perl_croak(aTHX_ "Usage: EntityList::GetRandomClient(THIS, float x, float y, float z, float distance, [Client* exclude_client = nullptr])");
|
||||
{
|
||||
EntityList *THIS;
|
||||
Client *RETVAL, *c = nullptr;
|
||||
|
||||
@@ -486,8 +486,7 @@ XS(XS_Group_TeleportGroup); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Group_TeleportGroup) {
|
||||
dXSARGS;
|
||||
if (items != 7)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: Group::TeleportGroup(THIS, Mob* sender, uint32 zone_id, float x, float y, float z, float heading)");
|
||||
Perl_croak(aTHX_ "Usage: Group::TeleportGroup(THIS, Mob* sender, uint32 zone_id, float x, float y, float z, float heading)");
|
||||
{
|
||||
Group *THIS;
|
||||
Mob *sender;
|
||||
|
||||
+102
-49
@@ -794,8 +794,7 @@ XS(XS_Mob_Attack); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Mob_Attack) {
|
||||
dXSARGS;
|
||||
if (items < 2 || items > 4)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: Mob::Attack(THIS, Mob* other, [int hand = 13 [prim|sec]], [bool from_riposte = false])");
|
||||
Perl_croak(aTHX_ "Usage: Mob::Attack(THIS, Mob* other, [int hand = 13 [prim|sec]], [bool from_riposte = false])");
|
||||
{
|
||||
Mob *THIS;
|
||||
bool RETVAL;
|
||||
@@ -842,8 +841,7 @@ XS(XS_Mob_Damage); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Mob_Damage) {
|
||||
dXSARGS;
|
||||
if (items < 5 || items > 8)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: Mob::Damage(THIS, Mob* from, int32 damage, uint16 spell_id, int attack_skill, [bool avoidable = true], [int8 buffslot = -1], [bool buff_tic = false])");
|
||||
Perl_croak(aTHX_ "Usage: Mob::Damage(THIS, Mob* from, int32 damage, uint16 spell_id, int attack_skill, [bool avoidable = true], [int8 buffslot = -1], [bool buff_tic = false])");
|
||||
{
|
||||
Mob *THIS;
|
||||
Mob *from;
|
||||
@@ -1135,6 +1133,29 @@ XS(XS_Mob_ChangeSize) {
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
XS(XS_Mob_RandomizeFeatures); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Mob_RandomizeFeatures) {
|
||||
dXSARGS;
|
||||
if (items < 2 || items > 3)
|
||||
Perl_croak(aTHX_ "Usage: Mob::RandomizeFeatures(THIS, bool send_illusion, set_variables)");
|
||||
{
|
||||
Mob *THIS;
|
||||
bool send_illusion = (bool) SvNV(ST(1));
|
||||
bool set_variables = (bool) SvNV(ST(2));
|
||||
|
||||
if (sv_derived_from(ST(0), "Mob")) {
|
||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
||||
THIS = INT2PTR(Mob *, tmp);
|
||||
} else
|
||||
Perl_croak(aTHX_ "THIS is not of type Mob");
|
||||
if (THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
THIS->RandomizeFeatures(send_illusion, set_variables);
|
||||
}
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
XS(XS_Mob_GMMove); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Mob_GMMove) {
|
||||
dXSARGS;
|
||||
@@ -1274,6 +1295,57 @@ XS(XS_Mob_FindBuff) {
|
||||
XSRETURN(1);
|
||||
}
|
||||
|
||||
XS(XS_Mob_FindBuffBySlot); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Mob_FindBuffBySlot) {
|
||||
dXSARGS;
|
||||
if (items != 2)
|
||||
Perl_croak(aTHX_ "Usage: Mob::FindBuffBySlot(THIS, int slot)");
|
||||
{
|
||||
Mob *THIS;
|
||||
uint16 RETVAL;
|
||||
dXSTARG;
|
||||
int slot = SvIV(ST(1));
|
||||
|
||||
if (sv_derived_from(ST(0), "Mob")) {
|
||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
||||
THIS = INT2PTR(Mob *, tmp);
|
||||
} else
|
||||
Perl_croak(aTHX_ "THIS is not of type Mob");
|
||||
if (THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
RETVAL = THIS->FindBuffBySlot(slot);
|
||||
XSprePUSH;
|
||||
PUSHu((UV) RETVAL);
|
||||
}
|
||||
XSRETURN(1);
|
||||
}
|
||||
|
||||
XS(XS_Mob_BuffCount); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Mob_BuffCount) {
|
||||
dXSARGS;
|
||||
if (items != 1)
|
||||
Perl_croak(aTHX_ "Usage: Mob::BuffCount(THIS)");
|
||||
{
|
||||
Mob *THIS;
|
||||
uint32 RETVAL;
|
||||
dXSTARG;
|
||||
|
||||
if (sv_derived_from(ST(0), "Mob")) {
|
||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
||||
THIS = INT2PTR(Mob *, tmp);
|
||||
} else
|
||||
Perl_croak(aTHX_ "THIS is not of type Mob");
|
||||
if (THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
RETVAL = THIS->BuffCount();
|
||||
XSprePUSH;
|
||||
PUSHu((UV) RETVAL);
|
||||
}
|
||||
XSRETURN(1);
|
||||
}
|
||||
|
||||
XS(XS_Mob_FindType); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Mob_FindType) {
|
||||
dXSARGS;
|
||||
@@ -1373,8 +1445,7 @@ XS(XS_Mob_MakeTempPet); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Mob_MakeTempPet) {
|
||||
dXSARGS;
|
||||
if (items < 2 || items > 6)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: Mob::MakeTempPet(THIS, uint16 spell_id, [string name = nullptr], [uint32 duration = 0], [Mob* target = nullptr], [bool sticktarg = 0])");
|
||||
Perl_croak(aTHX_ "Usage: Mob::MakeTempPet(THIS, uint16 spell_id, [string name = nullptr], [uint32 duration = 0], [Mob* target = nullptr], [bool sticktarg = 0])");
|
||||
{
|
||||
Mob *THIS;
|
||||
uint16 spell_id = (uint16) SvUV(ST(1));
|
||||
@@ -1424,8 +1495,7 @@ XS(XS_Mob_TypesTempPet); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Mob_TypesTempPet) {
|
||||
dXSARGS;
|
||||
if (items < 2 || items > 7)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: Mob::TypesTempPet(THIS, uint32 type_id, [string name = nullptr], [uint32 duration = 0], [bool follow = 0], [Mob* target = nullptr], [bool stick_targ = 0])");
|
||||
Perl_croak(aTHX_ "Usage: Mob::TypesTempPet(THIS, uint32 type_id, [string name = nullptr], [uint32 duration = 0], [bool follow = 0], [Mob* target = nullptr], [bool stick_targ = 0])");
|
||||
{
|
||||
Mob *THIS;
|
||||
uint32 typesid = (uint32) SvUV(ST(1));
|
||||
@@ -3606,8 +3676,7 @@ XS(XS_Mob_Message_StringID); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Mob_Message_StringID) {
|
||||
dXSARGS;
|
||||
if (items < 3 || items > 4)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: Mob::Message_StringID(THIS, uint32 emote_color_type, uint32 string_id, [uint32 distance = 0])");
|
||||
Perl_croak(aTHX_ "Usage: Mob::Message_StringID(THIS, uint32 emote_color_type, uint32 string_id, [uint32 distance = 0])");
|
||||
{
|
||||
Mob *THIS;
|
||||
uint32 type = (uint32) SvUV(ST(1));
|
||||
@@ -3628,7 +3697,7 @@ XS(XS_Mob_Message_StringID) {
|
||||
distance = (uint32) SvUV(ST(3));
|
||||
}
|
||||
|
||||
THIS->Message_StringID(type, string_id, distance);
|
||||
THIS->MessageString(type, string_id, distance);
|
||||
}
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
@@ -3731,8 +3800,7 @@ XS(XS_Mob_CastSpell); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Mob_CastSpell) {
|
||||
dXSARGS;
|
||||
if (items < 3 || items > 7)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: Mob::CastSpell(THIS, uint16 spell_id, uint16 target_id, [int slot = 22], [int32 cast_time = -1], [int32 mana_cost = -1], [int16 resist_adjust = 0])");
|
||||
Perl_croak(aTHX_ "Usage: Mob::CastSpell(THIS, uint16 spell_id, uint16 target_id, [int slot = 22], [int32 cast_time = -1], [int32 mana_cost = -1], [int16 resist_adjust = 0])");
|
||||
{
|
||||
Mob *THIS;
|
||||
uint16 spell_id = (uint16) SvUV(ST(1));
|
||||
@@ -3788,8 +3856,7 @@ XS(XS_Mob_SpellFinished); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Mob_SpellFinished) {
|
||||
dXSARGS;
|
||||
if (items < 2 || items > 5)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: Mob::SpellFinished(uint16 spell_id, [Mob* spell_target = this], [uint16 mana_cost = 0], [uint16 resist_diff = 0])");
|
||||
Perl_croak(aTHX_ "Usage: Mob::SpellFinished(uint16 spell_id, [Mob* spell_target = this], [uint16 mana_cost = 0], [uint16 resist_diff = 0])");
|
||||
{
|
||||
Mob *THIS;
|
||||
uint16 spell_id = (uint16) SvUV(ST(1));
|
||||
@@ -3971,8 +4038,7 @@ XS(XS_Mob_CanBuffStack); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Mob_CanBuffStack) {
|
||||
dXSARGS;
|
||||
if (items < 3 || items > 4)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: Mob::CanBuffStack(THIS, uint16 spell_id, uint8 caster_level, [bool fail_if_overwritten = false])");
|
||||
Perl_croak(aTHX_ "Usage: Mob::CanBuffStack(THIS, uint16 spell_id, uint8 caster_level, [bool fail_if_overwritten = false])");
|
||||
{
|
||||
Mob *THIS;
|
||||
int RETVAL;
|
||||
@@ -4970,8 +5036,7 @@ XS(XS_Mob_AddToHateList); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Mob_AddToHateList) {
|
||||
dXSARGS;
|
||||
if (items < 2 || items > 7)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: Mob::AddToHateList(THIS, Mob* other, [int32 hate = 0], [int32 damage = 0], [bool yell_for_help = true], [bool frenzy = false], [bool buff_tic = false])");
|
||||
Perl_croak(aTHX_ "Usage: Mob::AddToHateList(THIS, Mob* other, [int32 hate = 0], [int32 damage = 0], [bool yell_for_help = true], [bool frenzy = false], [bool buff_tic = false])");
|
||||
{
|
||||
Mob *THIS;
|
||||
Mob *other;
|
||||
@@ -5535,8 +5600,7 @@ XS(XS_Mob_NavigateTo); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Mob_NavigateTo) {
|
||||
dXSARGS;
|
||||
if (items < 4 || items > 5)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: Mob::NavigateTo(THIS, float x, float y, float z)");
|
||||
Perl_croak(aTHX_ "Usage: Mob::NavigateTo(THIS, float x, float y, float z)");
|
||||
{
|
||||
Mob *THIS;
|
||||
float x = (float) SvNV(ST(1));
|
||||
@@ -5661,8 +5725,7 @@ XS(XS_Mob_NPCSpecialAttacks); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Mob_NPCSpecialAttacks) {
|
||||
dXSARGS;
|
||||
if (items < 3 || items > 5)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: Mob::NPCSpecialAttacks(THIS, string abilities_string, int perm_tag, [bool reset = true], [bool remove = true])");
|
||||
Perl_croak(aTHX_ "Usage: Mob::NPCSpecialAttacks(THIS, string abilities_string, int perm_tag, [bool reset = true], [bool remove = true])");
|
||||
{
|
||||
Mob *THIS;
|
||||
char *parse = (char *) SvPV_nolen(ST(1));
|
||||
@@ -6402,8 +6465,7 @@ XS(XS_Mob_DoSpecialAttackDamage); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Mob_DoSpecialAttackDamage) {
|
||||
dXSARGS;
|
||||
if (items < 4 || items > 6)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: Mob::DoSpecialAttackDamage(THIS, Mob* target, int skill, int32 max_damage, [int32 min_damage = 1], [int32 hate_override = -11])");
|
||||
Perl_croak(aTHX_ "Usage: Mob::DoSpecialAttackDamage(THIS, Mob* target, int skill, int32 max_damage, [int32 min_damage = 1], [int32 hate_override = -11])");
|
||||
{
|
||||
Mob *THIS;
|
||||
Mob *target;
|
||||
@@ -6546,8 +6608,7 @@ XS(XS_Mob_ProjectileAnim); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Mob_ProjectileAnim) {
|
||||
dXSARGS;
|
||||
if (items < 3 || items > 9)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: Mob::ProjectileAnim(THIS, Mob* mob, int item_id, [bool is_arrow = false], [float speed = 0], [float angle = 0], [float tilt = 0], [float arc = 0])");
|
||||
Perl_croak(aTHX_ "Usage: Mob::ProjectileAnim(THIS, Mob* mob, int item_id, [bool is_arrow = false], [float speed = 0], [float angle = 0], [float tilt = 0], [float arc = 0])");
|
||||
|
||||
{
|
||||
Mob *THIS;
|
||||
@@ -6629,8 +6690,7 @@ XS(XS_Mob_SendAppearanceEffect); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Mob_SendAppearanceEffect) {
|
||||
dXSARGS;
|
||||
if (items < 2 || items > 7)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: Mob::SendAppearanceEffect(THIS, int32 param_1, [int32 param_2 = 0], [int32 param_3 = 0], [int32 param_4 = 0], [int32 param_5 = 0], [Client* single_client_to_send_to = null])");
|
||||
Perl_croak(aTHX_ "Usage: Mob::SendAppearanceEffect(THIS, int32 param_1, [int32 param_2 = 0], [int32 param_3 = 0], [int32 param_4 = 0], [int32 param_5 = 0], [Client* single_client_to_send_to = null])");
|
||||
{
|
||||
Mob *THIS;
|
||||
int32 parm1 = (int32) SvIV(ST(1));
|
||||
@@ -6759,8 +6819,7 @@ XS(XS_Mob_SendIllusion); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Mob_SendIllusion) {
|
||||
dXSARGS;
|
||||
if (items < 2 || items > 14)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: Mob::SendIllusion(THIS, uint16 race, [uint8 gender = 0xFF], [uint8 texture = 0xFF], [unit8 helmtexture = 0xFF], [unit8 face = 0xFF], [unit8 hairstyle = 0xFF], [uint8 hair_color = 0xFF], [uint8 beard = 0xFF], [uint8 beard_color = 0xFF], [uint32 drakkin_heritage = 0xFFFFFFFF], [uint32 drakkin_tattoo = 0xFFFFFFFF], [uint32 drakkin_details = 0xFFFFFFFF], [float size = -1])");
|
||||
Perl_croak(aTHX_ "Usage: Mob::SendIllusion(THIS, uint16 race, [uint8 gender = 0xFF], [uint8 texture face = 0xFF], [uint8 hairstyle = 0xFF], [uint8 hair_color = 0xFF], [uint8 beard = 0xFF], [uint8 beard_color =FF], [uint32 drakkin_tattoo = 0xFFFFFFFF], [uint32 drakkin_details = 0xFFFFFFFF], [float size = -1])");
|
||||
{
|
||||
Mob *THIS;
|
||||
uint16 race = (uint16) SvIV(ST(1));
|
||||
@@ -6808,8 +6867,7 @@ XS(XS_Mob_CameraEffect); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Mob_CameraEffect) {
|
||||
dXSARGS;
|
||||
if (items < 2 || items > 5)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: Mob::CameraEffect(THIS, uint32 duration, [uint32 intensity = 0], [Client* single_client = nullptr], [bool is_world_wide = false])");
|
||||
Perl_croak(aTHX_ "Usage: Mob::CameraEffect(THIS, uint32 duration, [uint32 intensity = 0], [Client* single_client = nullptr], [bool is_world_wide = false])");
|
||||
{
|
||||
Mob *THIS;
|
||||
uint32 duration = (uint32) SvUV(ST(1));
|
||||
@@ -6851,8 +6909,7 @@ XS(XS_Mob_SpellEffect); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Mob_SpellEffect) {
|
||||
dXSARGS;
|
||||
if (items < 2 || items > 8)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: Mob::SpellEffect(THIS, uint32 effect, [uint32 duration = 5000], [uint32 finish_delay = 0], [bool zone_wide = false], [uint32 unk20 = 3000], [bool perm_effect = false], [Client* single_client])");
|
||||
Perl_croak(aTHX_ "Usage: Mob::SpellEffect(THIS, uint32 effect, [uint32 duration = 5000], [uint32 finish_delay = 0], [bool zone_wide = false], [uint32 unk20 = 3000], [bool perm_effect = false], [Client* single_client])");
|
||||
{
|
||||
Mob *THIS;
|
||||
uint32 effect = (uint32) SvUV(ST(1));
|
||||
@@ -6980,8 +7037,7 @@ XS(XS_Mob_SetGlobal);
|
||||
XS(XS_Mob_SetGlobal) {
|
||||
dXSARGS;
|
||||
if (items < 5 || items > 6)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: SetGlobal(THIS, string var_name, string new_value, int options, string duration, [Mob* other = nullptr])");
|
||||
Perl_croak(aTHX_ "Usage: SetGlobal(THIS, string var_name, string new_value, int options, string duration, [Mob* other = nullptr])");
|
||||
{
|
||||
Mob *THIS;
|
||||
char *varname = (char *) SvPV_nolen(ST(1));
|
||||
@@ -7017,8 +7073,7 @@ XS(XS_Mob_TarGlobal);
|
||||
XS(XS_Mob_TarGlobal) {
|
||||
dXSARGS;
|
||||
if (items != 7)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: TarGlobal(THIS, string var_name, string value, string duration, int npc_id, int character_id, int zone_id)");
|
||||
Perl_croak(aTHX_ "Usage: TarGlobal(THIS, string var_name, string value, string duration, int npc_id, int character_id, int zone_id)");
|
||||
{
|
||||
Mob *THIS;
|
||||
char *varname = (char *) SvPV_nolen(ST(1));
|
||||
@@ -7067,8 +7122,7 @@ XS(XS_Mob_SetSlotTint); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Mob_SetSlotTint) {
|
||||
dXSARGS;
|
||||
if (items != 5)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: Mob::SetSlotTint(THIS, uint8 material_slot, uint8 red_tint, uint8 green_tint, uint8 blue_tint)");
|
||||
Perl_croak(aTHX_ "Usage: Mob::SetSlotTint(THIS, uint8 material_slot, uint8 red_tint, uint8 green_tint, uint8 blue_tint)");
|
||||
{
|
||||
Mob *THIS;
|
||||
uint8 material_slot = (uint8) SvIV(ST(1));
|
||||
@@ -7093,8 +7147,7 @@ XS(XS_Mob_WearChange); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Mob_WearChange) {
|
||||
dXSARGS;
|
||||
if (items < 3 || items > 4)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: Mob::WearChange(THIS, uint8 material_slot, uint16 texture, [uint32 color = 0, uint32 hero_forge_model = 0])");
|
||||
Perl_croak(aTHX_ "Usage: Mob::WearChange(THIS, uint8 material_slot, uint16 texture, [uint32 color = 0, uint32 hero_forge_model = 0])");
|
||||
{
|
||||
Mob *THIS;
|
||||
uint8 material_slot = (uint8) SvIV(ST(1));
|
||||
@@ -7524,8 +7577,7 @@ XS(XS_Mob_DoMeleeSkillAttackDmg); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Mob_DoMeleeSkillAttackDmg) {
|
||||
dXSARGS;
|
||||
if (items != 7)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: Mob::DoMeleeSkillAttackDmg(THIS, Mob* target, uint16 weapon_damage, int skill, int16 chance_mod, int16 focus, uint8 can_riposte)");
|
||||
Perl_croak(aTHX_ "Usage: Mob::DoMeleeSkillAttackDmg(THIS, Mob* target, uint16 weapon_damage, int skill, int16 chance_mod, int16 focus, uint8 can_riposte)");
|
||||
{
|
||||
Mob *THIS;
|
||||
Mob *target;
|
||||
@@ -7560,8 +7612,7 @@ XS(XS_Mob_DoArcheryAttackDmg); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Mob_DoArcheryAttackDmg) {
|
||||
dXSARGS;
|
||||
if (items != 7)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: Mob::DoArcheryAttackDmg(THIS, Mob* target, [range_weapon_item_instance = nullptr], [ammo_item_instance = nullptr], uint16 weapon_damage, int16 chance_mod, int16 focus)");
|
||||
Perl_croak(aTHX_ "Usage: Mob::DoArcheryAttackDmg(THIS, Mob* target, [range_weapon_item_instance = nullptr], [ammo_item_instance = nullptr], uint16 weapon_damage, int16 chance_mod, int16 focus)");
|
||||
{
|
||||
Mob *THIS;
|
||||
Mob *target;
|
||||
@@ -7596,8 +7647,7 @@ XS(XS_Mob_DoThrowingAttackDmg); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Mob_DoThrowingAttackDmg) {
|
||||
dXSARGS;
|
||||
if (items != 7)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: Mob::DoThrowingAttackDmg(THIS, Mob* target, [range_weapon_item_instance = nullptr], [ammo_item_instance = nullptr], uint16 weapon_damage, int16 chance_mod, int16 focus)");
|
||||
Perl_croak(aTHX_ "Usage: Mob::DoThrowingAttackDmg(THIS, Mob* target, [range_weapon_item_instance = nullptr], [ammo_item_instance = nullptr], uint16 weapon_damage, int16 chance_mod, int16 focus)");
|
||||
{
|
||||
Mob *THIS;
|
||||
Mob *target;
|
||||
@@ -8552,11 +8602,14 @@ XS(boot_Mob) {
|
||||
newXSproto(strcpy(buf, "SetHP"), XS_Mob_SetHP, file, "$$");
|
||||
newXSproto(strcpy(buf, "DoAnim"), XS_Mob_DoAnim, file, "$$;$");
|
||||
newXSproto(strcpy(buf, "ChangeSize"), XS_Mob_ChangeSize, file, "$$;$");
|
||||
newXSproto(strcpy(buf, "RandomizeFeatures"), XS_Mob_RandomizeFeatures, file, "$$;$");
|
||||
newXSproto(strcpy(buf, "GMMove"), XS_Mob_GMMove, file, "$$$$;$");
|
||||
newXSproto(strcpy(buf, "HasProcs"), XS_Mob_HasProcs, file, "$");
|
||||
newXSproto(strcpy(buf, "IsInvisible"), XS_Mob_IsInvisible, file, "$;$");
|
||||
newXSproto(strcpy(buf, "SetInvisible"), XS_Mob_SetInvisible, file, "$$");
|
||||
newXSproto(strcpy(buf, "FindBuff"), XS_Mob_FindBuff, file, "$$");
|
||||
newXSproto(strcpy(buf, "FindBuffBySlot"), XS_Mob_FindBuffBySlot, file, "$$");
|
||||
newXSproto(strcpy(buf, "BuffCount"), XS_Mob_BuffCount, file, "$");
|
||||
newXSproto(strcpy(buf, "FindType"), XS_Mob_FindType, file, "$$;$$");
|
||||
newXSproto(strcpy(buf, "GetBuffSlotFromType"), XS_Mob_GetBuffSlotFromType, file, "$$");
|
||||
newXSproto(strcpy(buf, "MakePet"), XS_Mob_MakePet, file, "$$$;$");
|
||||
|
||||
+87
-10
@@ -97,8 +97,7 @@ XS(XS_NPC_AddItem); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_NPC_AddItem) {
|
||||
dXSARGS;
|
||||
if (items < 2 || items > 10)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: NPC::AddItem(THIS, uint32 item_id, [uint16 charges = 0], [bool equip_item = true], [uint32 aug1 = 0], [uint32 aug2 = 0], [uint32 aug3 = 0], [uint32 aug4 = 0], [uint32 aug5 = 0], [uint32 aug6 = 0])");
|
||||
Perl_croak(aTHX_ "Usage: NPC::AddItem(THIS, uint32 item_id, [uint16 charges = 0], [bool equip_item = true], [uint32 aug1 = 0], [uint32 aug2 = 0], [uint32 aug3 = 0], [uint32 aug4 = 0], [uint32 aug5 = 0], [uint32 aug6 = 0])");
|
||||
{
|
||||
NPC *THIS;
|
||||
uint32 itemid = (uint32) SvUV(ST(1));
|
||||
@@ -571,7 +570,7 @@ XS(XS_NPC_SetSp2) {
|
||||
if (THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
THIS->SetSp2(sg2);
|
||||
THIS->SetSpawnGroupId(sg2);
|
||||
}
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
@@ -644,7 +643,7 @@ XS(XS_NPC_GetSp2) {
|
||||
if (THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
RETVAL = THIS->GetSp2();
|
||||
RETVAL = THIS->GetSpawnGroupId();
|
||||
XSprePUSH;
|
||||
PUSHu((UV) RETVAL);
|
||||
}
|
||||
@@ -1283,8 +1282,7 @@ XS(XS_NPC_MoveTo); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_NPC_MoveTo) {
|
||||
dXSARGS;
|
||||
if (items != 4 && items != 5 && items != 6)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: NPC::MoveTo(THIS, float x, float y, float z, [float heading], [bool save_guard_location = false])");
|
||||
Perl_croak(aTHX_ "Usage: NPC::MoveTo(THIS, float x, float y, float z, [float heading], [bool save_guard_location = false])");
|
||||
{
|
||||
NPC *THIS;
|
||||
float mtx = (float) SvNV(ST(1));
|
||||
@@ -1391,8 +1389,7 @@ XS(XS_NPC_AI_SetRoambox); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_NPC_AI_SetRoambox) {
|
||||
dXSARGS;
|
||||
if (items < 6 || items > 8)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: NPC::AI_SetRoambox(THIS, float distance, float max_x, float min_x, float max_y, float min_y, [uint32 max_delay = 2500], [uint32 min_delay = 2500])");
|
||||
Perl_croak(aTHX_ "Usage: NPC::AI_SetRoambox(THIS, float distance, float max_x, float min_x, float max_y, float min_y, [uint32 max_delay = 2500], [uint32 min_delay = 2500])");
|
||||
{
|
||||
NPC *THIS;
|
||||
float iDist = (float) SvNV(ST(1));
|
||||
@@ -1852,8 +1849,7 @@ XS(XS_NPC_AddSpellToNPCList); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_NPC_AddSpellToNPCList) {
|
||||
dXSARGS;
|
||||
if (items != 7)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: NPC::AddAISpell(THIS, int priority, int spell_id, int type, int mana_cost, int recast_delay, int resist_adjust)");
|
||||
Perl_croak(aTHX_ "Usage: NPC::AddAISpell(THIS, int priority, int spell_id, int type, int mana_cost, int recast_delay, int resist_adjust)");
|
||||
{
|
||||
NPC *THIS;
|
||||
int priority = (int) SvIV(ST(1));
|
||||
@@ -2167,6 +2163,48 @@ XS(XS_NPC_GetScore) {
|
||||
XSRETURN(1);
|
||||
}
|
||||
|
||||
XS(XS_NPC_MerchantOpenShop);
|
||||
XS(XS_NPC_MerchantOpenShop) {
|
||||
dXSARGS;
|
||||
if (items != 1)
|
||||
Perl_croak(aTHX_ "Usage: NPC::MerchantOpenShop(THIS)");
|
||||
{
|
||||
NPC *THIS;
|
||||
dXSTARG;
|
||||
if (sv_derived_from(ST(0), "NPC")) {
|
||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
||||
THIS = INT2PTR(NPC *, tmp);
|
||||
} else
|
||||
Perl_croak(aTHX_ "THIS is not of type NPC");
|
||||
if (THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
THIS->MerchantOpenShop();
|
||||
}
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
XS(XS_NPC_MerchantCloseShop);
|
||||
XS(XS_NPC_MerchantCloseShop) {
|
||||
dXSARGS;
|
||||
if (items != 1)
|
||||
Perl_croak(aTHX_ "Usage: NPC::MerchantCloseShop(THIS)");
|
||||
{
|
||||
NPC *THIS;
|
||||
dXSTARG;
|
||||
if (sv_derived_from(ST(0), "NPC")) {
|
||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
||||
THIS = INT2PTR(NPC *, tmp);
|
||||
} else
|
||||
Perl_croak(aTHX_ "THIS is not of type NPC");
|
||||
if (THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
THIS->MerchantCloseShop();
|
||||
}
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
XS(XS_NPC_AddMeleeProc);
|
||||
XS(XS_NPC_AddMeleeProc) {
|
||||
dXSARGS;
|
||||
@@ -2377,6 +2415,42 @@ XS(XS_NPC_GetCombatState) {
|
||||
XSRETURN(1);
|
||||
}
|
||||
|
||||
XS(XS_NPC_SetSimpleRoamBox); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_NPC_SetSimpleRoamBox) {
|
||||
dXSARGS;
|
||||
if (items < 2)
|
||||
Perl_croak(aTHX_ "Usage: NPC::SetSimpleRoamBox(THIS, box_size, move_distance, move_delay)");
|
||||
{
|
||||
NPC *THIS;
|
||||
|
||||
auto box_size = (float) SvNV(ST(1));
|
||||
float move_distance = 0;
|
||||
int move_delay = 0;
|
||||
|
||||
if (items >= 3) {
|
||||
move_distance = (float) SvNV(ST(2));
|
||||
}
|
||||
|
||||
if (items >= 4) {
|
||||
move_delay = (int) SvIV(ST(3));
|
||||
}
|
||||
|
||||
if (sv_derived_from(ST(0), "NPC")) {
|
||||
IV tmp = SvIV((SV *) SvRV(ST(0)));
|
||||
THIS = INT2PTR(NPC *, tmp);
|
||||
}
|
||||
else {
|
||||
Perl_croak(aTHX_ "THIS is not of type NPC");
|
||||
}
|
||||
if (THIS == nullptr) {
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
}
|
||||
|
||||
THIS->SetSimpleRoamBox(box_size, move_distance, move_delay);
|
||||
}
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
@@ -2479,6 +2553,8 @@ XS(boot_NPC) {
|
||||
newXSproto(strcpy(buf, "GetAvoidanceRating"), XS_NPC_GetAvoidanceRating, file, "$");
|
||||
newXSproto(strcpy(buf, "GetSpawnKillCount"), XS_NPC_GetSpawnKillCount, file, "$");
|
||||
newXSproto(strcpy(buf, "GetScore"), XS_NPC_GetScore, file, "$");
|
||||
newXSproto(strcpy(buf, "MerchantOpenShop"), XS_NPC_MerchantOpenShop, file, "$");
|
||||
newXSproto(strcpy(buf, "MerchantCloseShop"), XS_NPC_MerchantCloseShop, file, "$");
|
||||
newXSproto(strcpy(buf, "AddMeleeProc"), XS_NPC_AddMeleeProc, file, "$$$");
|
||||
newXSproto(strcpy(buf, "AddRangedProc"), XS_NPC_AddRangedProc, file, "$$$");
|
||||
newXSproto(strcpy(buf, "AddDefensiveProc"), XS_NPC_AddDefensiveProc, file, "$$$");
|
||||
@@ -2488,6 +2564,7 @@ XS(boot_NPC) {
|
||||
newXSproto(strcpy(buf, "ChangeLastName"), XS_NPC_ChangeLastName, file, "$:$");
|
||||
newXSproto(strcpy(buf, "ClearLastName"), XS_NPC_ClearLastName, file, "$");
|
||||
newXSproto(strcpy(buf, "GetCombatState"), XS_NPC_GetCombatState, file, "$");
|
||||
newXSproto(strcpy(buf, "SetSimpleRoamBox"), XS_NPC_SetSimpleRoamBox, file, "$$;$$");
|
||||
XSRETURN_YES;
|
||||
}
|
||||
|
||||
|
||||
+2
-4
@@ -420,8 +420,7 @@ XS(XS_Raid_TeleportGroup); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Raid_TeleportGroup) {
|
||||
dXSARGS;
|
||||
if (items != 8)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: Raid::TeleportGroup(THIS, Mob* sender, uint32 zone_id, float x, float y, float z, float heading, uint32 group_id)");
|
||||
Perl_croak(aTHX_ "Usage: Raid::TeleportGroup(THIS, Mob* sender, uint32 zone_id, float x, float y, float z, float heading, uint32 group_id)");
|
||||
{
|
||||
Raid *THIS;
|
||||
Mob *sender;
|
||||
@@ -457,8 +456,7 @@ XS(XS_Raid_TeleportRaid); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Raid_TeleportRaid) {
|
||||
dXSARGS;
|
||||
if (items != 7)
|
||||
Perl_croak(aTHX_
|
||||
"Usage: Raid::TeleportRaid(THIS, Mob* sender, uint32 zone_id, float x, float y, float z, float heading)");
|
||||
Perl_croak(aTHX_ "Usage: Raid::TeleportRaid(THIS, Mob* sender, uint32 zone_id, float x, float y, float z, float heading)");
|
||||
{
|
||||
Raid *THIS;
|
||||
Mob *sender;
|
||||
|
||||
+1
-1
@@ -252,7 +252,7 @@ void ZoneDatabase::InsertPetitionToDB(Petition* wpet)
|
||||
}
|
||||
|
||||
#if EQDEBUG >= 5
|
||||
Log(Logs::General, Logs::None, "New petition created");
|
||||
LogDebug("New petition created");
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
+6
-6
@@ -212,16 +212,16 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower,
|
||||
//lookup our pets table record for this type
|
||||
PetRecord record;
|
||||
if(!database.GetPoweredPetEntry(pettype, act_power, &record)) {
|
||||
Message(13, "Unable to find data for pet %s", pettype);
|
||||
Log(Logs::General, Logs::Error, "Unable to find data for pet %s, check pets table.", pettype);
|
||||
Message(Chat::Red, "Unable to find data for pet %s", pettype);
|
||||
LogError("Unable to find data for pet [{}], check pets table", pettype);
|
||||
return;
|
||||
}
|
||||
|
||||
//find the NPC data for the specified NPC type
|
||||
const NPCType *base = database.LoadNPCTypesData(record.npc_type);
|
||||
if(base == nullptr) {
|
||||
Message(13, "Unable to load NPC data for pet %s", pettype);
|
||||
Log(Logs::General, Logs::Error, "Unable to load NPC data for pet %s (NPC ID %d), check pets and npc_types tables.", pettype, record.npc_type);
|
||||
Message(Chat::Red, "Unable to load NPC data for pet %s", pettype);
|
||||
LogError("Unable to load NPC data for pet [{}] (NPC ID [{}]), check pets and npc_types tables", pettype, record.npc_type);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -374,7 +374,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower,
|
||||
npc_type->helmtexture = monster->helmtexture;
|
||||
npc_type->herosforgemodel = monster->herosforgemodel;
|
||||
} else
|
||||
Log(Logs::General, Logs::Error, "Error loading NPC data for monster summoning pet (NPC ID %d)", monsterid);
|
||||
LogError("Error loading NPC data for monster summoning pet (NPC ID [{}])", monsterid);
|
||||
|
||||
}
|
||||
|
||||
@@ -665,7 +665,7 @@ bool ZoneDatabase::GetBasePetItems(int32 equipmentset, uint32 *items) {
|
||||
|
||||
if (results.RowCount() != 1) {
|
||||
// invalid set reference, it doesn't exist
|
||||
Log(Logs::General, Logs::Error, "Error in GetBasePetItems equipment set '%d' does not exist", curset);
|
||||
LogError("Error in GetBasePetItems equipment set [{}] does not exist", curset);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ Copyright (C) 2001-2014 EQEMu Development Team (http://eqemulator.net)
|
||||
#include "../common/string_util.h"
|
||||
#include "queryserv.h"
|
||||
#include "worldserver.h"
|
||||
#include "net.h"
|
||||
|
||||
|
||||
extern WorldServer worldserver;
|
||||
|
||||
@@ -1050,7 +1050,7 @@ int QuestParserCollection::DispatchEventSpell(QuestEventID evt, NPC* npc, Client
|
||||
|
||||
void QuestParserCollection::LoadPerlEventExportSettings(PerlEventExportSettings* perl_event_export_settings) {
|
||||
|
||||
Log(Logs::General, Logs::Zone_Server, "Loading Perl Event Export Settings...");
|
||||
LogInfo("Loading Perl Event Export Settings...");
|
||||
|
||||
/* Write Defaults First (All Enabled) */
|
||||
for (int i = 0; i < _LargestEventID; i++){
|
||||
|
||||
+244
-197
@@ -154,30 +154,17 @@ void QuestManager::echo(int colour, const char *str) {
|
||||
entity_list.MessageClose(initiator, false, 200, colour, str);
|
||||
}
|
||||
|
||||
void QuestManager::say(const char *str) {
|
||||
void QuestManager::say(const char *str, Journal::Options &opts) {
|
||||
QuestManagerCurrentQuestVars();
|
||||
if (!owner) {
|
||||
Log(Logs::General, Logs::Quests, "QuestManager::say called with nullptr owner. Probably syntax error in quest file.");
|
||||
LogQuests("QuestManager::say called with nullptr owner. Probably syntax error in quest file");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
if(RuleB(NPC, EnableNPCQuestJournal) && initiator) {
|
||||
owner->QuestJournalledSay(initiator, str);
|
||||
}
|
||||
else {
|
||||
owner->Say(str);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void QuestManager::say(const char *str, uint8 language) {
|
||||
QuestManagerCurrentQuestVars();
|
||||
if (!owner) {
|
||||
Log(Logs::General, Logs::Quests, "QuestManager::say called with nullptr owner. Probably syntax error in quest file.");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
entity_list.ChannelMessage(owner, 8, language, str);
|
||||
// if there is no initiator we still want stuff to work (timers, signals, waypoints, etc)
|
||||
if (!RuleB(NPC, EnableNPCQuestJournal) || initiator == nullptr)
|
||||
opts.journal_mode = Journal::Mode::None;
|
||||
owner->QuestJournalledSay(initiator, str, opts);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -247,59 +234,57 @@ Mob* QuestManager::unique_spawn(int npc_type, int grid, int unused, const glm::v
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Mob* QuestManager::spawn_from_spawn2(uint32 spawn2_id)
|
||||
Mob *QuestManager::spawn_from_spawn2(uint32 spawn2_id)
|
||||
{
|
||||
LinkedListIterator<Spawn2*> iterator(zone->spawn2_list);
|
||||
LinkedListIterator<Spawn2 *> iterator(zone->spawn2_list);
|
||||
iterator.Reset();
|
||||
Spawn2 *found_spawn = nullptr;
|
||||
|
||||
while(iterator.MoreElements())
|
||||
{
|
||||
Spawn2* cur = iterator.GetData();
|
||||
while (iterator.MoreElements()) {
|
||||
Spawn2 *cur = iterator.GetData();
|
||||
iterator.Advance();
|
||||
if(cur->GetID() == spawn2_id)
|
||||
{
|
||||
if (cur->GetID() == spawn2_id) {
|
||||
found_spawn = cur;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(found_spawn)
|
||||
{
|
||||
SpawnGroup* sg = zone->spawn_group_list.GetSpawnGroup(found_spawn->SpawnGroupID());
|
||||
if(!sg)
|
||||
{
|
||||
database.LoadSpawnGroupsByID(found_spawn->SpawnGroupID(),&zone->spawn_group_list);
|
||||
sg = zone->spawn_group_list.GetSpawnGroup(found_spawn->SpawnGroupID());
|
||||
if(!sg)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
uint32 npcid = sg->GetNPCType();
|
||||
if(npcid == 0)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const NPCType* tmp = database.LoadNPCTypesData(npcid);
|
||||
if(!tmp)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if(tmp->unique_spawn_by_name)
|
||||
{
|
||||
if(!entity_list.LimitCheckName(tmp->name))
|
||||
{
|
||||
if (found_spawn) {
|
||||
SpawnGroup *spawn_group = zone->spawn_group_list.GetSpawnGroup(found_spawn->SpawnGroupID());
|
||||
if (!spawn_group) {
|
||||
database.LoadSpawnGroupsByID(found_spawn->SpawnGroupID(), &zone->spawn_group_list);
|
||||
spawn_group = zone->spawn_group_list.GetSpawnGroup(found_spawn->SpawnGroupID());
|
||||
if (!spawn_group) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
if(tmp->spawn_limit > 0)
|
||||
{
|
||||
if(!entity_list.LimitCheckType(npcid, tmp->spawn_limit))
|
||||
{
|
||||
uint16 condition_value=1;
|
||||
uint16 condition_id=found_spawn->GetSpawnCondition();
|
||||
|
||||
if (condition_id > 0) {
|
||||
condition_value = zone->spawn_conditions.GetCondition(zone->GetShortName(), zone->GetInstanceID(), condition_id);
|
||||
}
|
||||
|
||||
uint32 npcid = spawn_group->GetNPCType(condition_value);
|
||||
|
||||
if (npcid == 0) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const NPCType *tmp = database.LoadNPCTypesData(npcid);
|
||||
if (!tmp) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (tmp->unique_spawn_by_name) {
|
||||
if (!entity_list.LimitCheckName(tmp->name)) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
if (tmp->spawn_limit > 0) {
|
||||
if (!entity_list.LimitCheckType(npcid, tmp->spawn_limit)) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
@@ -307,21 +292,35 @@ Mob* QuestManager::spawn_from_spawn2(uint32 spawn2_id)
|
||||
database.UpdateRespawnTime(spawn2_id, zone->GetInstanceID(), 0);
|
||||
found_spawn->SetCurrentNPCID(npcid);
|
||||
|
||||
auto position = glm::vec4(found_spawn->GetX(), found_spawn->GetY(), found_spawn->GetZ(), found_spawn->GetHeading());
|
||||
auto position = glm::vec4(
|
||||
found_spawn->GetX(),
|
||||
found_spawn->GetY(),
|
||||
found_spawn->GetZ(),
|
||||
found_spawn->GetHeading()
|
||||
);
|
||||
|
||||
auto npc = new NPC(tmp, found_spawn, position, GravityBehavior::Water);
|
||||
|
||||
found_spawn->SetNPCPointer(npc);
|
||||
npc->AddLootTable();
|
||||
if (npc->DropsGlobalLoot())
|
||||
if (npc->DropsGlobalLoot()) {
|
||||
npc->CheckGlobalLootTables();
|
||||
npc->SetSp2(found_spawn->SpawnGroupID());
|
||||
}
|
||||
npc->SetSpawnGroupId(found_spawn->SpawnGroupID());
|
||||
entity_list.AddNPC(npc);
|
||||
entity_list.LimitAddNPC(npc);
|
||||
|
||||
if (sg->roamdist && sg->roambox[0] && sg->roambox[1] && sg->roambox[2] && sg->roambox[3] && sg->delay &&
|
||||
sg->min_delay)
|
||||
npc->AI_SetRoambox(sg->roamdist, sg->roambox[0], sg->roambox[1], sg->roambox[2], sg->roambox[3],
|
||||
sg->delay, sg->min_delay);
|
||||
if (spawn_group->roamdist > 0) {
|
||||
npc->AI_SetRoambox(
|
||||
spawn_group->roamdist,
|
||||
spawn_group->roambox[0],
|
||||
spawn_group->roambox[1],
|
||||
spawn_group->roambox[2],
|
||||
spawn_group->roambox[3],
|
||||
spawn_group->delay,
|
||||
spawn_group->min_delay
|
||||
);
|
||||
}
|
||||
if (zone->InstantGrids()) {
|
||||
found_spawn->LoadGrid();
|
||||
}
|
||||
@@ -568,7 +567,7 @@ void QuestManager::pausetimer(const char *timer_name) {
|
||||
{
|
||||
if (pcur->owner && pcur->owner == owner && pcur->name == timer_name)
|
||||
{
|
||||
Log(Logs::General, Logs::Quests, "Timer %s is already paused for %s. Returning...", timer_name, owner->GetName());
|
||||
LogQuests("Timer [{}] is already paused for [{}]. Returning", timer_name, owner->GetName());
|
||||
return;
|
||||
}
|
||||
++pcur;
|
||||
@@ -590,7 +589,7 @@ void QuestManager::pausetimer(const char *timer_name) {
|
||||
pt.name = timername;
|
||||
pt.owner = owner;
|
||||
pt.time = milliseconds;
|
||||
Log(Logs::General, Logs::Quests, "Pausing timer %s for %s with %d ms remaining.", timer_name, owner->GetName(), milliseconds);
|
||||
LogQuests("Pausing timer [{}] for [{}] with [{}] ms remaining", timer_name, owner->GetName(), milliseconds);
|
||||
PTimerList.push_back(pt);
|
||||
}
|
||||
|
||||
@@ -616,7 +615,7 @@ void QuestManager::resumetimer(const char *timer_name) {
|
||||
|
||||
if (milliseconds == 0)
|
||||
{
|
||||
Log(Logs::General, Logs::Quests, "Paused timer %s not found or has expired. Returning...", timer_name);
|
||||
LogQuests("Paused timer [{}] not found or has expired. Returning", timer_name);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -627,14 +626,14 @@ void QuestManager::resumetimer(const char *timer_name) {
|
||||
{
|
||||
cur->Timer_.Enable();
|
||||
cur->Timer_.Start(milliseconds, false);
|
||||
Log(Logs::General, Logs::Quests, "Resuming timer %s for %s with %d ms remaining.", timer_name, owner->GetName(), milliseconds);
|
||||
LogQuests("Resuming timer [{}] for [{}] with [{}] ms remaining", timer_name, owner->GetName(), milliseconds);
|
||||
return;
|
||||
}
|
||||
++cur;
|
||||
}
|
||||
|
||||
QTimerList.push_back(QuestTimer(milliseconds, owner, timer_name));
|
||||
Log(Logs::General, Logs::Quests, "Creating a new timer and resuming %s for %s with %d ms remaining.", timer_name, owner->GetName(), milliseconds);
|
||||
LogQuests("Creating a new timer and resuming [{}] for [{}] with [{}] ms remaining", timer_name, owner->GetName(), milliseconds);
|
||||
|
||||
}
|
||||
|
||||
@@ -659,7 +658,7 @@ bool QuestManager::ispausedtimer(const char *timer_name) {
|
||||
void QuestManager::emote(const char *str) {
|
||||
QuestManagerCurrentQuestVars();
|
||||
if (!owner) {
|
||||
Log(Logs::General, Logs::Quests, "QuestManager::emote called with nullptr owner. Probably syntax error in quest file.");
|
||||
LogQuests("QuestManager::emote called with nullptr owner. Probably syntax error in quest file");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
@@ -670,7 +669,7 @@ void QuestManager::emote(const char *str) {
|
||||
void QuestManager::shout(const char *str) {
|
||||
QuestManagerCurrentQuestVars();
|
||||
if (!owner) {
|
||||
Log(Logs::General, Logs::Quests, "QuestManager::shout called with nullptr owner. Probably syntax error in quest file.");
|
||||
LogQuests("QuestManager::shout called with nullptr owner. Probably syntax error in quest file");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
@@ -681,7 +680,7 @@ void QuestManager::shout(const char *str) {
|
||||
void QuestManager::shout2(const char *str) {
|
||||
QuestManagerCurrentQuestVars();
|
||||
if (!owner) {
|
||||
Log(Logs::General, Logs::Quests, "QuestManager::shout2 called with nullptr owner. Probably syntax error in quest file.");
|
||||
LogQuests("QuestManager::shout2 called with nullptr owner. Probably syntax error in quest file");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
@@ -700,7 +699,7 @@ void QuestManager::gmsay(const char *str, uint32 color, bool send_to_world, uint
|
||||
void QuestManager::depop(int npc_type) {
|
||||
QuestManagerCurrentQuestVars();
|
||||
if (!owner || !owner->IsNPC()) {
|
||||
Log(Logs::General, Logs::Quests, "QuestManager::depop called with nullptr owner or non-NPC owner. Probably syntax error in quest file.");
|
||||
LogQuests("QuestManager::depop called with nullptr owner or non-NPC owner. Probably syntax error in quest file");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
@@ -730,7 +729,7 @@ void QuestManager::depop(int npc_type) {
|
||||
void QuestManager::depop_withtimer(int npc_type) {
|
||||
QuestManagerCurrentQuestVars();
|
||||
if (!owner || !owner->IsNPC()) {
|
||||
Log(Logs::General, Logs::Quests, "QuestManager::depop_withtimer called with nullptr owner or non-NPC owner. Probably syntax error in quest file.");
|
||||
LogQuests("QuestManager::depop_withtimer called with nullptr owner or non-NPC owner. Probably syntax error in quest file");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
@@ -757,7 +756,7 @@ void QuestManager::depopall(int npc_type) {
|
||||
entity_list.DepopAll(npc_type);
|
||||
}
|
||||
else {
|
||||
Log(Logs::General, Logs::Quests, "QuestManager::depopall called with nullptr owner, non-NPC owner, or invalid NPC Type ID. Probably syntax error in quest file.");
|
||||
LogQuests("QuestManager::depopall called with nullptr owner, non-NPC owner, or invalid NPC Type ID. Probably syntax error in quest file");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -766,7 +765,7 @@ void QuestManager::depopzone(bool StartSpawnTimer) {
|
||||
zone->Depop(StartSpawnTimer);
|
||||
}
|
||||
else {
|
||||
Log(Logs::General, Logs::Quests, "QuestManager::depopzone called with nullptr zone. Probably syntax error in quest file.");
|
||||
LogQuests("QuestManager::depopzone called with nullptr zone. Probably syntax error in quest file");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -775,7 +774,7 @@ void QuestManager::repopzone() {
|
||||
zone->Repop();
|
||||
}
|
||||
else {
|
||||
Log(Logs::General, Logs::Quests, "QuestManager::repopzone called with nullptr zone. Probably syntax error in quest file.");
|
||||
LogQuests("QuestManager::repopzone called with nullptr zone. Probably syntax error in quest file");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -818,13 +817,13 @@ void QuestManager::changedeity(int diety_id) {
|
||||
if(initiator->IsClient())
|
||||
{
|
||||
initiator->SetDeity(diety_id);
|
||||
initiator->Message(15,"Your Deity has been changed/set to: %i", diety_id);
|
||||
initiator->Message(Chat::Yellow,"Your Deity has been changed/set to: %i", diety_id);
|
||||
initiator->Save(1);
|
||||
initiator->Kick();
|
||||
initiator->Kick("Deity change by QuestManager");
|
||||
}
|
||||
else
|
||||
{
|
||||
initiator->Message(15,"Error changing Deity");
|
||||
initiator->Message(Chat::Yellow,"Error changing Deity");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -940,11 +939,11 @@ void QuestManager::surname(const char *name) {
|
||||
if(initiator->IsClient())
|
||||
{
|
||||
initiator->ChangeLastName(name);
|
||||
initiator->Message(15,"Your surname has been changed/set to: %s", name);
|
||||
initiator->Message(Chat::Yellow,"Your surname has been changed/set to: %s", name);
|
||||
}
|
||||
else
|
||||
{
|
||||
initiator->Message(15,"Error changing/setting surname");
|
||||
initiator->Message(Chat::Yellow,"Error changing/setting surname");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -954,7 +953,7 @@ void QuestManager::permaclass(int class_id) {
|
||||
//Makes the client the class specified
|
||||
initiator->SetBaseClass(class_id);
|
||||
initiator->Save(2);
|
||||
initiator->Kick();
|
||||
initiator->Kick("Base class change by QuestManager");
|
||||
}
|
||||
|
||||
void QuestManager::permarace(int race_id) {
|
||||
@@ -962,7 +961,7 @@ void QuestManager::permarace(int race_id) {
|
||||
//Makes the client the race specified
|
||||
initiator->SetBaseRace(race_id);
|
||||
initiator->Save(2);
|
||||
initiator->Kick();
|
||||
initiator->Kick("Base race change by QuestManager");
|
||||
}
|
||||
|
||||
void QuestManager::permagender(int gender_id) {
|
||||
@@ -970,138 +969,186 @@ void QuestManager::permagender(int gender_id) {
|
||||
//Makes the client the gender specified
|
||||
initiator->SetBaseGender(gender_id);
|
||||
initiator->Save(2);
|
||||
initiator->Kick();
|
||||
initiator->Kick("Base gender change by QuestManager");
|
||||
}
|
||||
|
||||
uint16 QuestManager::scribespells(uint8 max_level, uint8 min_level) {
|
||||
QuestManagerCurrentQuestVars();
|
||||
uint16 book_slot, count;
|
||||
uint16 spell_id;
|
||||
int book_slot = initiator->GetNextAvailableSpellBookSlot();
|
||||
int spell_id = 0;
|
||||
int count = 0;
|
||||
|
||||
uint32 char_id = initiator->CharacterID();
|
||||
bool SpellGlobalRule = RuleB(Spells, EnableSpellGlobals);
|
||||
bool SpellBucketRule = RuleB(Spells, EnableSpellBuckets);
|
||||
bool SpellGlobalCheckResult = 0;
|
||||
bool SpellBucketCheckResult = 0;
|
||||
bool SpellGlobalCheckResult = false;
|
||||
bool SpellBucketCheckResult = false;
|
||||
|
||||
for (
|
||||
spell_id = 0,
|
||||
book_slot = initiator->GetNextAvailableSpellBookSlot(),
|
||||
count = 0; // ;
|
||||
spell_id < SPDAT_RECORDS &&
|
||||
book_slot < EQEmu::spells::SPELLBOOK_SIZE; // ;
|
||||
spell_id++,
|
||||
book_slot = initiator->GetNextAvailableSpellBookSlot(book_slot)
|
||||
)
|
||||
{
|
||||
if
|
||||
(
|
||||
spells[spell_id].classes[WARRIOR] != 0 && //check if spell exists
|
||||
spells[spell_id].classes[initiator->GetPP().class_-1] <= max_level && //maximum level
|
||||
spells[spell_id].classes[initiator->GetPP().class_-1] >= min_level && //minimum level
|
||||
spells[spell_id].skill != 52 &&
|
||||
spells[spell_id].effectid[EFFECT_COUNT - 1] != 10
|
||||
)
|
||||
{
|
||||
if (book_slot == -1) //no more book slots
|
||||
for ( ; spell_id < SPDAT_RECORDS && book_slot < EQEmu::spells::SPELLBOOK_SIZE; ++spell_id) {
|
||||
if (book_slot == -1) {
|
||||
initiator->Message(
|
||||
13,
|
||||
"Unable to scribe spell %s (%i) to spellbook: no more spell book slots available.",
|
||||
((spell_id >= 0 && spell_id < SPDAT_RECORDS) ? spells[spell_id].name : "Out-of-range"),
|
||||
spell_id
|
||||
);
|
||||
|
||||
break;
|
||||
}
|
||||
if (spell_id < 0 || spell_id >= SPDAT_RECORDS) {
|
||||
initiator->Message(Chat::Red, "FATAL ERROR: Spell id out-of-range (id: %i, min: 0, max: %i)", spell_id, SPDAT_RECORDS);
|
||||
return count;
|
||||
}
|
||||
if (book_slot < 0 || book_slot >= EQEmu::spells::SPELLBOOK_SIZE) {
|
||||
initiator->Message(Chat::Red, "FATAL ERROR: Book slot out-of-range (slot: %i, min: 0, max: %i)", book_slot, EQEmu::spells::SPELLBOOK_SIZE);
|
||||
return count;
|
||||
}
|
||||
|
||||
while (true) {
|
||||
if (spells[spell_id].classes[WARRIOR] == 0) // check if spell exists
|
||||
break;
|
||||
if(!IsDiscipline(spell_id) && !initiator->HasSpellScribed(spell_id)) { //isn't a discipline & we don't already have it scribed
|
||||
if (spells[spell_id].classes[initiator->GetPP().class_ - 1] > max_level) // maximum level
|
||||
break;
|
||||
if (spells[spell_id].classes[initiator->GetPP().class_ - 1] < min_level) // minimum level
|
||||
break;
|
||||
if (spells[spell_id].skill == 52)
|
||||
break;
|
||||
if (spells[spell_id].effectid[EFFECT_COUNT - 1] == 10)
|
||||
break;
|
||||
|
||||
uint16 spell_id_ = (uint16)spell_id;
|
||||
if ((spell_id_ != spell_id) || (spell_id != spell_id_)) {
|
||||
initiator->Message(Chat::Red, "FATAL ERROR: Type conversion data loss with spell_id (%i != %u)", spell_id, spell_id_);
|
||||
return count;
|
||||
}
|
||||
|
||||
if (!IsDiscipline(spell_id_) && !initiator->HasSpellScribed(spell_id)) { // isn't a discipline & we don't already have it scribed
|
||||
if (SpellGlobalRule) {
|
||||
// Bool to see if the character has the required QGlobal to scribe it if one exists in the Spell_Globals table
|
||||
SpellGlobalCheckResult = initiator->SpellGlobalCheck(spell_id, char_id);
|
||||
// bool to see if the character has the required QGlobal to scribe it if one exists in the Spell_Globals table
|
||||
SpellGlobalCheckResult = initiator->SpellGlobalCheck(spell_id_, char_id);
|
||||
if (SpellGlobalCheckResult) {
|
||||
initiator->ScribeSpell(spell_id, book_slot);
|
||||
count++;
|
||||
initiator->ScribeSpell(spell_id_, book_slot);
|
||||
++count;
|
||||
}
|
||||
} else if (SpellBucketRule) {
|
||||
SpellBucketCheckResult = initiator->SpellBucketCheck(spell_id, char_id);
|
||||
}
|
||||
else if (SpellBucketRule) {
|
||||
// bool to see if the character has the required bucket to train it if one exists in the spell_buckets table
|
||||
SpellBucketCheckResult = initiator->SpellBucketCheck(spell_id_, char_id);
|
||||
if (SpellBucketCheckResult) {
|
||||
initiator->ScribeSpell(spell_id, book_slot);
|
||||
count++;
|
||||
initiator->ScribeSpell(spell_id_, book_slot);
|
||||
++count;
|
||||
}
|
||||
} else {
|
||||
initiator->ScribeSpell(spell_id, book_slot);
|
||||
count++;
|
||||
}
|
||||
else {
|
||||
initiator->ScribeSpell(spell_id_, book_slot);
|
||||
++count;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
book_slot = initiator->GetNextAvailableSpellBookSlot(book_slot);
|
||||
}
|
||||
return count; //how many spells were scribed successfully
|
||||
|
||||
return count; // how many spells were scribed successfully
|
||||
}
|
||||
|
||||
uint16 QuestManager::traindiscs(uint8 max_level, uint8 min_level) {
|
||||
QuestManagerCurrentQuestVars();
|
||||
uint16 count;
|
||||
uint16 spell_id;
|
||||
int spell_id = 0;
|
||||
int count = 0;
|
||||
|
||||
uint32 char_id = initiator->CharacterID();
|
||||
bool SpellGlobalRule = RuleB(Spells, EnableSpellGlobals);
|
||||
bool SpellBucketRule = RuleB(Spells, EnableSpellBuckets);
|
||||
bool SpellGlobalCheckResult = 0;
|
||||
bool SpellBucketCheckResult = 0;
|
||||
bool SpellGlobalCheckResult = false;
|
||||
bool SpellBucketCheckResult = false;
|
||||
|
||||
for(spell_id = 0, count = 0; spell_id < SPDAT_RECORDS; spell_id++)
|
||||
{
|
||||
if
|
||||
(
|
||||
spells[spell_id].classes[WARRIOR] != 0 && //check if spell exists
|
||||
spells[spell_id].classes[initiator->GetPP().class_-1] <= max_level && //maximum level
|
||||
spells[spell_id].classes[initiator->GetPP().class_-1] >= min_level && //minimum level
|
||||
spells[spell_id].skill != 52 &&
|
||||
( !RuleB(Spells, UseCHAScribeHack) || spells[spell_id].effectid[EFFECT_COUNT - 1] != 10 )
|
||||
)
|
||||
{
|
||||
if(IsDiscipline(spell_id)){
|
||||
//we may want to come up with a function like Client::GetNextAvailableSpellBookSlot() to help speed this up a little
|
||||
for(uint32 r = 0; r < MAX_PP_DISCIPLINES; r++) {
|
||||
if(initiator->GetPP().disciplines.values[r] == spell_id) {
|
||||
initiator->Message(13, "You already know this discipline.");
|
||||
break; //continue the 1st loop
|
||||
bool change = false;
|
||||
|
||||
for( ; spell_id < SPDAT_RECORDS; ++spell_id) {
|
||||
if (spell_id < 0 || spell_id >= SPDAT_RECORDS) {
|
||||
initiator->Message(Chat::Red, "FATAL ERROR: Spell id out-of-range (id: %i, min: 0, max: %i)", spell_id, SPDAT_RECORDS);
|
||||
return count;
|
||||
}
|
||||
|
||||
while (true) {
|
||||
if (spells[spell_id].classes[WARRIOR] == 0) // check if spell exists
|
||||
break;
|
||||
if (spells[spell_id].classes[initiator->GetPP().class_ - 1] > max_level) // maximum level
|
||||
break;
|
||||
if (spells[spell_id].classes[initiator->GetPP().class_ - 1] < min_level) // minimum level
|
||||
break;
|
||||
if (spells[spell_id].skill == 52)
|
||||
break;
|
||||
if (RuleB(Spells, UseCHAScribeHack) && spells[spell_id].effectid[EFFECT_COUNT - 1] == 10)
|
||||
break;
|
||||
|
||||
uint16 spell_id_ = (uint16)spell_id;
|
||||
if ((spell_id_ != spell_id) || (spell_id != spell_id_)) {
|
||||
initiator->Message(Chat::Red, "FATAL ERROR: Type conversion data loss with spell_id (%i != %u)", spell_id, spell_id_);
|
||||
return count;
|
||||
}
|
||||
|
||||
if (!IsDiscipline(spell_id_))
|
||||
break;
|
||||
|
||||
for (uint32 r = 0; r < MAX_PP_DISCIPLINES; r++) {
|
||||
if (initiator->GetPP().disciplines.values[r] == spell_id_) {
|
||||
initiator->Message(Chat::Red, "You already know this discipline.");
|
||||
break; // continue the 1st loop
|
||||
}
|
||||
else if (initiator->GetPP().disciplines.values[r] == 0) {
|
||||
if (SpellGlobalRule) {
|
||||
// bool to see if the character has the required QGlobal to train it if one exists in the Spell_Globals table
|
||||
SpellGlobalCheckResult = initiator->SpellGlobalCheck(spell_id_, char_id);
|
||||
if (SpellGlobalCheckResult) {
|
||||
initiator->GetPP().disciplines.values[r] = spell_id_;
|
||||
database.SaveCharacterDisc(char_id, r, spell_id_);
|
||||
change = true;
|
||||
initiator->Message(Chat::White, "You have learned a new discipline!");
|
||||
++count; // success counter
|
||||
}
|
||||
break; // continue the 1st loop
|
||||
}
|
||||
else if(initiator->GetPP().disciplines.values[r] == 0) {
|
||||
if (SpellGlobalRule) {
|
||||
// Bool to see if the character has the required QGlobal to train it if one exists in the Spell_Globals table
|
||||
SpellGlobalCheckResult = initiator->SpellGlobalCheck(spell_id, char_id);
|
||||
if (SpellGlobalCheckResult) {
|
||||
initiator->GetPP().disciplines.values[r] = spell_id;
|
||||
database.SaveCharacterDisc(char_id, r, spell_id);
|
||||
initiator->SendDisciplineUpdate();
|
||||
initiator->Message(0, "You have learned a new discipline!");
|
||||
count++; //success counter
|
||||
}
|
||||
break; //continue the 1st loop
|
||||
} else if (SpellBucketRule) {
|
||||
// Bool to see if the character has the required bucket to train it if one exists in the spell_buckets table
|
||||
SpellBucketCheckResult = initiator->SpellBucketCheck(spell_id, char_id);
|
||||
if (SpellBucketCheckResult) {
|
||||
initiator->GetPP().disciplines.values[r] = spell_id;
|
||||
database.SaveCharacterDisc(char_id, r, spell_id);
|
||||
initiator->SendDisciplineUpdate();
|
||||
initiator->Message(0, "You have learned a new discipline!");
|
||||
count++;
|
||||
}
|
||||
break;
|
||||
else if (SpellBucketRule) {
|
||||
// bool to see if the character has the required bucket to train it if one exists in the spell_buckets table
|
||||
SpellBucketCheckResult = initiator->SpellBucketCheck(spell_id_, char_id);
|
||||
if (SpellBucketCheckResult) {
|
||||
initiator->GetPP().disciplines.values[r] = spell_id_;
|
||||
database.SaveCharacterDisc(char_id, r, spell_id_);
|
||||
change = true;
|
||||
initiator->Message(Chat::White, "You have learned a new discipline!");
|
||||
++count;
|
||||
}
|
||||
else {
|
||||
initiator->GetPP().disciplines.values[r] = spell_id;
|
||||
database.SaveCharacterDisc(char_id, r, spell_id);
|
||||
initiator->SendDisciplineUpdate();
|
||||
initiator->Message(0, "You have learned a new discipline!");
|
||||
count++; //success counter
|
||||
break; //continue the 1st loop
|
||||
}
|
||||
} //if we get to this point, there's already a discipline in this slot, so we skip it
|
||||
break;
|
||||
}
|
||||
else {
|
||||
initiator->GetPP().disciplines.values[r] = spell_id_;
|
||||
database.SaveCharacterDisc(char_id, r, spell_id_);
|
||||
change = true;;
|
||||
initiator->Message(Chat::White, "You have learned a new discipline!");
|
||||
++count; // success counter
|
||||
break; // continue the 1st loop
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
return count; //how many disciplines were learned successfully
|
||||
|
||||
if (change)
|
||||
initiator->SendDisciplineUpdate();
|
||||
|
||||
return count; // how many disciplines were learned successfully
|
||||
}
|
||||
|
||||
void QuestManager::unscribespells() {
|
||||
QuestManagerCurrentQuestVars();
|
||||
initiator->UnscribeSpellAll();
|
||||
}
|
||||
}
|
||||
|
||||
void QuestManager::untraindiscs() {
|
||||
QuestManagerCurrentQuestVars();
|
||||
@@ -1153,7 +1200,7 @@ void QuestManager::givecash(int copper, int silver, int gold, int platinum) {
|
||||
}
|
||||
tmp += " pieces.";
|
||||
if (initiator)
|
||||
initiator->Message(MT_OOC, tmp.c_str());
|
||||
initiator->Message(Chat::OOC, tmp.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1374,7 +1421,7 @@ void QuestManager::itemlink(int item_id) {
|
||||
linker.SetLinkType(EQEmu::saylink::SayLinkItemData);
|
||||
linker.SetItemData(item);
|
||||
|
||||
initiator->Message(0, "%s tells you, %s", owner->GetCleanName(), linker.GenerateLink().c_str());
|
||||
initiator->Message(Chat::White, "%s tells you, %s", owner->GetCleanName(), linker.GenerateLink().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1787,7 +1834,7 @@ void QuestManager::showgrid(int grid) {
|
||||
"ORDER BY `number`", grid, zone->GetZoneID());
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
Log(Logs::General, Logs::Quests, "Error loading grid %d for showgrid(): %s", grid, results.ErrorMessage().c_str());
|
||||
LogQuests("Error loading grid [{}] for showgrid(): [{}]", grid, results.ErrorMessage().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2127,18 +2174,18 @@ bool QuestManager::createBot(const char *name, const char *lastname, uint8 level
|
||||
{
|
||||
if(Bot::SpawnedBotCount(initiator->CharacterID()) >= MaxBotCreate)
|
||||
{
|
||||
initiator->Message(15,"You have the maximum number of bots allowed.");
|
||||
initiator->Message(Chat::Yellow,"You have the maximum number of bots allowed.");
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string test_name = name;
|
||||
bool available_flag = false;
|
||||
if(!botdb.QueryNameAvailablity(test_name, available_flag)) {
|
||||
initiator->Message(0, "%s for '%s'", BotDatabase::fail::QueryNameAvailablity(), (char*)name);
|
||||
if(!database.botdb.QueryNameAvailablity(test_name, available_flag)) {
|
||||
initiator->Message(Chat::White, "%s for '%s'", BotDatabase::fail::QueryNameAvailablity(), (char*)name);
|
||||
return false;
|
||||
}
|
||||
if (!available_flag) {
|
||||
initiator->Message(0, "The name %s is already being used or is invalid. Please choose a different name.", (char*)name);
|
||||
initiator->Message(Chat::White, "The name %s is already being used or is invalid. Please choose a different name.", (char*)name);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2147,23 +2194,23 @@ bool QuestManager::createBot(const char *name, const char *lastname, uint8 level
|
||||
if(NewBot)
|
||||
{
|
||||
if(!NewBot->IsValidRaceClassCombo()) {
|
||||
initiator->Message(0, "That Race/Class combination cannot be created.");
|
||||
initiator->Message(Chat::White, "That Race/Class combination cannot be created.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!NewBot->IsValidName()) {
|
||||
initiator->Message(0, "%s has invalid characters. You can use only the A-Z, a-z and _ characters in a bot name.", NewBot->GetCleanName());
|
||||
initiator->Message(Chat::White, "%s has invalid characters. You can use only the A-Z, a-z and _ characters in a bot name.", NewBot->GetCleanName());
|
||||
return false;
|
||||
}
|
||||
|
||||
// Now that all validation is complete, we can save our newly created bot
|
||||
if(!NewBot->Save())
|
||||
{
|
||||
initiator->Message(0, "Unable to save %s as a bot.", NewBot->GetCleanName());
|
||||
initiator->Message(Chat::White, "Unable to save %s as a bot.", NewBot->GetCleanName());
|
||||
}
|
||||
else
|
||||
{
|
||||
initiator->Message(0, "%s saved as bot %u.", NewBot->GetCleanName(), NewBot->GetBotID());
|
||||
initiator->Message(Chat::White, "%s saved as bot %u.", NewBot->GetCleanName(), NewBot->GetBotID());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -2620,13 +2667,13 @@ uint16 QuestManager::CreateInstance(const char *zone, int16 version, uint32 dura
|
||||
uint16 id = 0;
|
||||
if(!database.GetUnusedInstanceID(id))
|
||||
{
|
||||
initiator->Message(13, "Server was unable to find a free instance id.");
|
||||
initiator->Message(Chat::Red, "Server was unable to find a free instance id.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(!database.CreateInstance(id, zone_id, version, duration))
|
||||
{
|
||||
initiator->Message(13, "Server was unable to create a new instance.");
|
||||
initiator->Message(Chat::Red, "Server was unable to create a new instance.");
|
||||
return 0;
|
||||
}
|
||||
return id;
|
||||
@@ -2739,9 +2786,9 @@ void QuestManager::RemoveFromInstance(uint16 instance_id)
|
||||
if (initiator)
|
||||
{
|
||||
if (database.RemoveClientFromInstance(instance_id, initiator->CharacterID()))
|
||||
initiator->Message(MT_Say, "Removed client from instance.");
|
||||
initiator->Message(Chat::Say, "Removed client from instance.");
|
||||
else
|
||||
initiator->Message(MT_Say, "Failed to remove client from instance.");
|
||||
initiator->Message(Chat::Say, "Failed to remove client from instance.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2757,11 +2804,11 @@ void QuestManager::RemoveAllFromInstance(uint16 instance_id)
|
||||
std::list<uint32> charid_list;
|
||||
|
||||
if (database.RemoveClientsFromInstance(instance_id))
|
||||
initiator->Message(MT_Say, "Removed all players from instance.");
|
||||
initiator->Message(Chat::Say, "Removed all players from instance.");
|
||||
else
|
||||
{
|
||||
database.GetCharactersInInstance(instance_id, charid_list);
|
||||
initiator->Message(MT_Say, "Failed to remove %i player(s) from instance.", charid_list.size()); // once the expedition system is in, this message it not relevant
|
||||
initiator->Message(Chat::Say, "Failed to remove %i player(s) from instance.", charid_list.size()); // once the expedition system is in, this message it not relevant
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2851,7 +2898,7 @@ uint8 QuestManager::FactionValue()
|
||||
FACTION_VALUE oldfac;
|
||||
uint8 newfac = 0;
|
||||
if(initiator && owner->IsNPC()) {
|
||||
oldfac = initiator->GetFactionLevel(initiator->GetID(), owner->GetID(), initiator->GetRace(), initiator->GetClass(), initiator->GetDeity(), owner->GetPrimaryFaction(), owner);
|
||||
oldfac = initiator->GetFactionLevel(initiator->GetID(), owner->GetID(), initiator->GetFactionRace(), initiator->GetClass(), initiator->GetDeity(), owner->GetPrimaryFaction(), owner);
|
||||
|
||||
// now, reorder the faction to have it make sense (higher values are better)
|
||||
switch (oldfac) {
|
||||
@@ -2940,7 +2987,7 @@ void QuestManager::voicetell(const char *str, int macronum, int racenum, int gen
|
||||
safe_delete(outapp);
|
||||
}
|
||||
else
|
||||
Log(Logs::General, Logs::Quests, "QuestManager::voicetell from %s. Client %s not found.", owner->GetName(), str);
|
||||
LogQuests("QuestManager::voicetell from [{}]. Client [{}] not found", owner->GetName(), str);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -62,8 +62,7 @@ public:
|
||||
|
||||
//quest functions
|
||||
void echo(int colour, const char *str);
|
||||
void say(const char *str);
|
||||
void say(const char *str, uint8 language);
|
||||
void say(const char *str, Journal::Options &opts);
|
||||
void me(const char *str);
|
||||
void summonitem(uint32 itemid, int16 charges = -1);
|
||||
void write(const char *file, const char *str);
|
||||
|
||||
+28
-20
@@ -103,7 +103,7 @@ void Raid::AddMember(Client *c, uint32 group, bool rleader, bool groupleader, bo
|
||||
auto results = database.QueryDatabase(query);
|
||||
|
||||
if(!results.Success()) {
|
||||
Log(Logs::General, Logs::Error, "Error inserting into raid members: %s", results.ErrorMessage().c_str());
|
||||
LogError("Error inserting into raid members: [{}]", results.ErrorMessage().c_str());
|
||||
}
|
||||
|
||||
LearnMembers();
|
||||
@@ -266,12 +266,12 @@ void Raid::SetRaidLeader(const char *wasLead, const char *name)
|
||||
std::string query = StringFormat("UPDATE raid_members SET israidleader = 0 WHERE name = '%s'", wasLead);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
Log(Logs::General, Logs::Error, "Set Raid Leader error: %s\n", results.ErrorMessage().c_str());
|
||||
LogError("Set Raid Leader error: [{}]\n", results.ErrorMessage().c_str());
|
||||
|
||||
query = StringFormat("UPDATE raid_members SET israidleader = 1 WHERE name = '%s'", name);
|
||||
results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
Log(Logs::General, Logs::Error, "Set Raid Leader error: %s\n", results.ErrorMessage().c_str());
|
||||
LogError("Set Raid Leader error: [{}]\n", results.ErrorMessage().c_str());
|
||||
|
||||
strn0cpy(leadername, name, 64);
|
||||
|
||||
@@ -304,7 +304,7 @@ void Raid::SaveGroupLeaderAA(uint32 gid)
|
||||
safe_delete_array(queryBuffer);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
Log(Logs::General, Logs::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str());
|
||||
LogError("Unable to store LeadershipAA: [{}]\n", results.ErrorMessage().c_str());
|
||||
}
|
||||
|
||||
void Raid::SaveRaidLeaderAA()
|
||||
@@ -318,7 +318,7 @@ void Raid::SaveRaidLeaderAA()
|
||||
safe_delete_array(queryBuffer);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
Log(Logs::General, Logs::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str());
|
||||
LogError("Unable to store LeadershipAA: [{}]\n", results.ErrorMessage().c_str());
|
||||
}
|
||||
|
||||
void Raid::UpdateGroupAAs(uint32 gid)
|
||||
@@ -446,7 +446,7 @@ uint32 Raid::GetGroup(Client *c)
|
||||
return 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
void Raid::RaidSay(const char *msg, Client *c)
|
||||
void Raid::RaidSay(const char *msg, Client *c, uint8 language, uint8 lang_skill)
|
||||
{
|
||||
if(!c)
|
||||
return;
|
||||
@@ -455,6 +455,8 @@ void Raid::RaidSay(const char *msg, Client *c)
|
||||
ServerRaidMessage_Struct *rga = (ServerRaidMessage_Struct*)pack->pBuffer;
|
||||
rga->rid = GetID();
|
||||
rga->gid = 0xFFFFFFFF;
|
||||
rga->language = language;
|
||||
rga->lang_skill = lang_skill;
|
||||
strn0cpy(rga->from, c->GetName(), 64);
|
||||
|
||||
strcpy(rga->message, msg); // this is safe because we are allocating enough space for the entire msg above
|
||||
@@ -463,7 +465,7 @@ void Raid::RaidSay(const char *msg, Client *c)
|
||||
safe_delete(pack);
|
||||
}
|
||||
|
||||
void Raid::RaidGroupSay(const char *msg, Client *c)
|
||||
void Raid::RaidGroupSay(const char *msg, Client *c, uint8 language, uint8 lang_skill)
|
||||
{
|
||||
if(!c)
|
||||
return;
|
||||
@@ -477,6 +479,8 @@ void Raid::RaidGroupSay(const char *msg, Client *c)
|
||||
ServerRaidMessage_Struct *rga = (ServerRaidMessage_Struct*)pack->pBuffer;
|
||||
rga->rid = GetID();
|
||||
rga->gid = groupToUse;
|
||||
rga->language = language;
|
||||
rga->lang_skill = lang_skill;
|
||||
strn0cpy(rga->from, c->GetName(), 64);
|
||||
|
||||
strcpy(rga->message, msg); // this is safe because we are allocating enough space for the entire msg above
|
||||
@@ -543,7 +547,7 @@ void Raid::CastGroupSpell(Mob* caster, uint16 spellid, uint32 gid)
|
||||
#endif
|
||||
}
|
||||
else{
|
||||
Log(Logs::Detail, Logs::Spells, "Raid spell: %s is out of range %f at distance %f from %s", members[x].member->GetName(), range, distance, caster->GetName());
|
||||
LogSpells("Raid spell: [{}] is out of range [{}] at distance [{}] from [{}]", members[x].member->GetName(), range, distance, caster->GetName());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -809,7 +813,7 @@ void Raid::SplitMoney(uint32 copper, uint32 silver, uint32 gold, uint32 platinum
|
||||
//I could not get MoneyOnCorpse to work, so we use this
|
||||
members[i].member->AddMoneyToPP(cpsplit, spsplit, gpsplit, ppsplit, true);
|
||||
|
||||
members[i].member->Message(2, msg.c_str());
|
||||
members[i].member->Message(Chat::Green, msg.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -844,7 +848,7 @@ void Raid::GroupBardPulse(Mob* caster, uint16 spellid, uint32 gid){
|
||||
members[z].member->GetPet()->BardPulse(spellid, caster);
|
||||
#endif
|
||||
} else
|
||||
Log(Logs::Detail, Logs::Spells, "Group bard pulse: %s is out of range %f at distance %f from %s", members[z].member->GetName(), range, distance, caster->GetName());
|
||||
LogSpells("Group bard pulse: [{}] is out of range [{}] at distance [{}] from [{}]", members[z].member->GetName(), range, distance, caster->GetName());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1451,10 +1455,14 @@ void Raid::GetRaidDetails()
|
||||
if (!results.Success())
|
||||
return;
|
||||
|
||||
if (results.RowCount() == 0) {
|
||||
Log(Logs::General, Logs::Error, "Error getting raid details for raid %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str());
|
||||
return;
|
||||
}
|
||||
if (results.RowCount() == 0) {
|
||||
LogError(
|
||||
"Error getting raid details for raid [{}]: [{}]",
|
||||
(unsigned long) GetID(),
|
||||
results.ErrorMessage().c_str()
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
auto row = results.begin();
|
||||
|
||||
@@ -1484,7 +1492,7 @@ bool Raid::LearnMembers()
|
||||
return false;
|
||||
|
||||
if(results.RowCount() == 0) {
|
||||
Log(Logs::General, Logs::Error, "Error getting raid members for raid %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str());
|
||||
LogError("Error getting raid members for raid [{}]: [{}]", (unsigned long)GetID(), results.ErrorMessage().c_str());
|
||||
disbandCheck = true;
|
||||
return false;
|
||||
}
|
||||
@@ -1708,12 +1716,12 @@ const char *Raid::GetClientNameByIndex(uint8 index)
|
||||
return members[index].membername;
|
||||
}
|
||||
|
||||
void Raid::RaidMessage_StringID(Mob* sender, uint32 type, uint32 string_id, const char* message,const char* message2,const char* message3,const char* message4,const char* message5,const char* message6,const char* message7,const char* message8,const char* message9, uint32 distance) {
|
||||
void Raid::RaidMessageString(Mob* sender, uint32 type, uint32 string_id, const char* message,const char* message2,const char* message3,const char* message4,const char* message5,const char* message6,const char* message7,const char* message8,const char* message9, uint32 distance) {
|
||||
uint32 i;
|
||||
for (i = 0; i < MAX_RAID_MEMBERS; i++) {
|
||||
if(members[i].member) {
|
||||
if(members[i].member != sender)
|
||||
members[i].member->Message_StringID(type, string_id, message, message2, message3, message4, message5, message6, message7, message8, message9, distance);
|
||||
members[i].member->MessageString(type, string_id, message, message2, message3, message4, message5, message6, message7, message8, message9, distance);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1746,7 +1754,7 @@ void Raid::SetGroupMentor(uint32 group_id, int percent, char *name)
|
||||
name, percent, group_id, GetID());
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
Log(Logs::General, Logs::Error, "Unable to set raid group mentor: %s\n", results.ErrorMessage().c_str());
|
||||
LogError("Unable to set raid group mentor: [{}]\n", results.ErrorMessage().c_str());
|
||||
}
|
||||
|
||||
void Raid::ClearGroupMentor(uint32 group_id)
|
||||
@@ -1761,7 +1769,7 @@ void Raid::ClearGroupMentor(uint32 group_id)
|
||||
group_id, GetID());
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
Log(Logs::General, Logs::Error, "Unable to clear raid group mentor: %s\n", results.ErrorMessage().c_str());
|
||||
LogError("Unable to clear raid group mentor: [{}]\n", results.ErrorMessage().c_str());
|
||||
}
|
||||
|
||||
// there isn't a nice place to add this in another function, unlike groups
|
||||
@@ -1821,4 +1829,4 @@ void Raid::QueueClients(Mob *sender, const EQApplicationPacket *app, bool ack_re
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -152,7 +152,7 @@ public:
|
||||
|
||||
//Actual Implementation Stuff
|
||||
|
||||
void RaidMessage_StringID(Mob* sender, uint32 type, uint32 string_id, const char* message,const char* message2=0,const char* message3=0,const char* message4=0,const char* message5=0,const char* message6=0,const char* message7=0,const char* message8=0,const char* message9=0, uint32 distance = 0);
|
||||
void RaidMessageString(Mob* sender, uint32 type, uint32 string_id, const char* message,const char* message2=0,const char* message3=0,const char* message4=0,const char* message5=0,const char* message6=0,const char* message7=0,const char* message8=0,const char* message9=0, uint32 distance = 0);
|
||||
void CastGroupSpell(Mob* caster,uint16 spellid, uint32 gid);
|
||||
void SplitExp(uint32 exp, Mob* other);
|
||||
uint32 GetTotalRaidDamage(Mob* other);
|
||||
@@ -177,8 +177,8 @@ public:
|
||||
void SendHPManaEndPacketsFrom(Mob *mob);
|
||||
void SendManaPacketFrom(Mob *mob);
|
||||
void SendEndurancePacketFrom(Mob *mob);
|
||||
void RaidSay(const char *msg, Client *c);
|
||||
void RaidGroupSay(const char *msg, Client *c);
|
||||
void RaidSay(const char *msg, Client *c, uint8 language, uint8 lang_skill);
|
||||
void RaidGroupSay(const char *msg, Client *c, uint8 language, uint8 lang_skill);
|
||||
|
||||
//Packet Functions
|
||||
void SendRaidCreate(Client *to);
|
||||
|
||||
+142
-155
@@ -154,17 +154,13 @@ bool Spawn2::Process() {
|
||||
if (timer.Check()) {
|
||||
timer.Disable();
|
||||
|
||||
Log(Logs::Detail, Logs::Spawns, "Spawn2 %d: Timer has triggered", spawn2_id);
|
||||
LogSpawns("Spawn2 [{}]: Timer has triggered", spawn2_id);
|
||||
|
||||
//first check our spawn condition, if this isnt active
|
||||
//then we reset the timer and try again next time.
|
||||
if (condition_id != SC_AlwaysEnabled
|
||||
&& !zone->spawn_conditions.Check(condition_id, condition_min_value)) {
|
||||
Log(Logs::Detail,
|
||||
Logs::Spawns,
|
||||
"Spawn2 %d: spawning prevented by spawn condition %d",
|
||||
spawn2_id,
|
||||
condition_id);
|
||||
LogSpawns("Spawn2 [{}]: spawning prevented by spawn condition [{}]", spawn2_id, condition_id);
|
||||
Reset();
|
||||
return (true);
|
||||
}
|
||||
@@ -175,23 +171,21 @@ bool Spawn2::Process() {
|
||||
}
|
||||
|
||||
if (spawn_group == nullptr) {
|
||||
Log(Logs::Detail,
|
||||
Logs::Spawns,
|
||||
"Spawn2 %d: Unable to locate spawn group %d. Disabling.",
|
||||
spawn2_id,
|
||||
spawngroup_id_);
|
||||
LogSpawns("Spawn2 [{}]: Unable to locate spawn group [{}]. Disabling", spawn2_id, spawngroup_id_);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
uint16 condition_value=1;
|
||||
|
||||
if (condition_id > 0) {
|
||||
condition_value = zone->spawn_conditions.GetCondition(zone->GetShortName(), zone->GetInstanceID(), condition_id);
|
||||
}
|
||||
|
||||
//have the spawn group pick an NPC for us
|
||||
uint32 npcid = spawn_group->GetNPCType();
|
||||
uint32 npcid = spawn_group->GetNPCType(condition_value);
|
||||
if (npcid == 0) {
|
||||
Log(Logs::Detail,
|
||||
Logs::Spawns,
|
||||
"Spawn2 %d: Spawn group %d did not yeild an NPC! not spawning.",
|
||||
spawn2_id,
|
||||
spawngroup_id_);
|
||||
LogSpawns("Spawn2 [{}]: Spawn group [{}] did not yeild an NPC! not spawning", spawn2_id, spawngroup_id_);
|
||||
|
||||
Reset(); //try again later (why?)
|
||||
return (true);
|
||||
@@ -200,24 +194,14 @@ bool Spawn2::Process() {
|
||||
//try to find our NPC type.
|
||||
const NPCType *tmp = database.LoadNPCTypesData(npcid);
|
||||
if (tmp == nullptr) {
|
||||
Log(Logs::Detail,
|
||||
Logs::Spawns,
|
||||
"Spawn2 %d: Spawn group %d yeilded an invalid NPC type %d",
|
||||
spawn2_id,
|
||||
spawngroup_id_,
|
||||
npcid);
|
||||
LogSpawns("Spawn2 [{}]: Spawn group [{}] yeilded an invalid NPC type [{}]", spawn2_id, spawngroup_id_, npcid);
|
||||
Reset(); //try again later
|
||||
return (true);
|
||||
}
|
||||
|
||||
if (tmp->unique_spawn_by_name) {
|
||||
if (!entity_list.LimitCheckName(tmp->name)) {
|
||||
Log(Logs::Detail,
|
||||
Logs::Spawns,
|
||||
"Spawn2 %d: Spawn group %d yeilded NPC type %d, which is unique and one already exists.",
|
||||
spawn2_id,
|
||||
spawngroup_id_,
|
||||
npcid);
|
||||
LogSpawns("Spawn2 [{}]: Spawn group [{}] yeilded NPC type [{}], which is unique and one already exists", spawn2_id, spawngroup_id_, npcid);
|
||||
timer.Start(5000); //try again in five seconds.
|
||||
return (true);
|
||||
}
|
||||
@@ -225,13 +209,7 @@ bool Spawn2::Process() {
|
||||
|
||||
if (tmp->spawn_limit > 0) {
|
||||
if (!entity_list.LimitCheckType(npcid, tmp->spawn_limit)) {
|
||||
Log(Logs::Detail,
|
||||
Logs::Spawns,
|
||||
"Spawn2 %d: Spawn group %d yeilded NPC type %d, which is over its spawn limit (%d)",
|
||||
spawn2_id,
|
||||
spawngroup_id_,
|
||||
npcid,
|
||||
tmp->spawn_limit);
|
||||
LogSpawns("Spawn2 [{}]: Spawn group [{}] yeilded NPC type [{}], which is over its spawn limit ([{}])", spawn2_id, spawngroup_id_, npcid, tmp->spawn_limit);
|
||||
timer.Start(5000); //try again in five seconds.
|
||||
return (true);
|
||||
}
|
||||
@@ -264,7 +242,7 @@ bool Spawn2::Process() {
|
||||
if (npc->DropsGlobalLoot()) {
|
||||
npc->CheckGlobalLootTables();
|
||||
}
|
||||
npc->SetSp2(spawngroup_id_);
|
||||
npc->SetSpawnGroupId(spawngroup_id_);
|
||||
npc->SaveGuardPointAnim(anim);
|
||||
npc->SetAppearance((EmuAppearance) anim);
|
||||
entity_list.AddNPC(npc);
|
||||
@@ -274,9 +252,7 @@ bool Spawn2::Process() {
|
||||
/**
|
||||
* Roambox init
|
||||
*/
|
||||
if (spawn_group->roamdist && spawn_group->roambox[0] && spawn_group->roambox[1] && spawn_group->roambox[2] &&
|
||||
spawn_group->roambox[3] && spawn_group->delay && spawn_group->min_delay) {
|
||||
|
||||
if (spawn_group->roamdist > 0) {
|
||||
npc->AI_SetRoambox(
|
||||
spawn_group->roamdist,
|
||||
spawn_group->roambox[0],
|
||||
@@ -289,30 +265,28 @@ bool Spawn2::Process() {
|
||||
}
|
||||
|
||||
if (zone->InstantGrids()) {
|
||||
Log(Logs::Detail,
|
||||
Logs::Spawns,
|
||||
"Spawn2 %d: Group %d spawned %s (%d) at (%.3f, %.3f, %.3f).",
|
||||
LogSpawns("Spawn2 [{}]: Group [{}] spawned [{}] ([{}]) at ([{}], [{}], [{}])",
|
||||
spawn2_id,
|
||||
spawngroup_id_,
|
||||
npc->GetName(),
|
||||
npcid,
|
||||
x,
|
||||
y,
|
||||
z);
|
||||
z
|
||||
);
|
||||
|
||||
LoadGrid();
|
||||
}
|
||||
else {
|
||||
Log(Logs::Detail,
|
||||
Logs::Spawns,
|
||||
"Spawn2 %d: Group %d spawned %s (%d) at (%.3f, %.3f, %.3f). Grid loading delayed.",
|
||||
LogSpawns("Spawn2 [{}]: Group [{}] spawned [{}] ([{}]) at ([{}], [{}], [{}]). Grid loading delayed",
|
||||
spawn2_id,
|
||||
spawngroup_id_,
|
||||
tmp->name,
|
||||
npcid,
|
||||
x,
|
||||
y,
|
||||
z);
|
||||
z
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -338,7 +312,7 @@ void Spawn2::LoadGrid() {
|
||||
//dont set an NPC's grid until its loaded for them.
|
||||
npcthis->SetGrid(grid_);
|
||||
npcthis->AssignWaypoints(grid_);
|
||||
Log(Logs::Detail, Logs::Spawns, "Spawn2 %d: Loading grid %d for %s", spawn2_id, grid_, npcthis->GetName());
|
||||
LogSpawns("Spawn2 [{}]: Loading grid [{}] for [{}]", spawn2_id, grid_, npcthis->GetName());
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -348,21 +322,21 @@ void Spawn2::LoadGrid() {
|
||||
void Spawn2::Reset() {
|
||||
timer.Start(resetTimer());
|
||||
npcthis = nullptr;
|
||||
Log(Logs::Detail, Logs::Spawns, "Spawn2 %d: Spawn reset, repop in %d ms", spawn2_id, timer.GetRemainingTime());
|
||||
LogSpawns("Spawn2 [{}]: Spawn reset, repop in [{}] ms", spawn2_id, timer.GetRemainingTime());
|
||||
}
|
||||
|
||||
void Spawn2::Depop() {
|
||||
timer.Disable();
|
||||
Log(Logs::Detail, Logs::Spawns, "Spawn2 %d: Spawn reset, repop disabled", spawn2_id);
|
||||
LogSpawns("Spawn2 [{}]: Spawn reset, repop disabled", spawn2_id);
|
||||
npcthis = nullptr;
|
||||
}
|
||||
|
||||
void Spawn2::Repop(uint32 delay) {
|
||||
if (delay == 0) {
|
||||
timer.Trigger();
|
||||
Log(Logs::Detail, Logs::Spawns, "Spawn2 %d: Spawn reset, repop immediately.", spawn2_id);
|
||||
LogSpawns("Spawn2 [{}]: Spawn reset, repop immediately", spawn2_id);
|
||||
} else {
|
||||
Log(Logs::Detail, Logs::Spawns, "Spawn2 %d: Spawn reset for repop, repop in %d ms", spawn2_id, delay);
|
||||
LogSpawns("Spawn2 [{}]: Spawn reset for repop, repop in [{}] ms", spawn2_id, delay);
|
||||
timer.Start(delay);
|
||||
}
|
||||
npcthis = nullptr;
|
||||
@@ -407,7 +381,7 @@ void Spawn2::ForceDespawn()
|
||||
cur = despawnTimer(dtimer);
|
||||
}
|
||||
|
||||
Log(Logs::Detail, Logs::Spawns, "Spawn2 %d: Spawn group %d set despawn timer to %d ms.", spawn2_id, spawngroup_id_, cur);
|
||||
LogSpawns("Spawn2 [{}]: Spawn group [{}] set despawn timer to [{}] ms", spawn2_id, spawngroup_id_, cur);
|
||||
timer.Start(cur);
|
||||
}
|
||||
|
||||
@@ -428,7 +402,7 @@ void Spawn2::DeathReset(bool realdeath)
|
||||
if(spawn2_id)
|
||||
{
|
||||
database.UpdateRespawnTime(spawn2_id, zone->GetInstanceID(), (cur/1000));
|
||||
Log(Logs::Detail, Logs::Spawns, "Spawn2 %d: Spawn reset by death, repop in %d ms", spawn2_id, timer.GetRemainingTime());
|
||||
LogSpawns("Spawn2 [{}]: Spawn reset by death, repop in [{}] ms", spawn2_id, timer.GetRemainingTime());
|
||||
//store it to database too
|
||||
}
|
||||
}
|
||||
@@ -713,12 +687,12 @@ void Spawn2::SpawnConditionChanged(const SpawnCondition &c, int16 old_value) {
|
||||
if(GetSpawnCondition() != c.condition_id)
|
||||
return;
|
||||
|
||||
Log(Logs::Detail, Logs::Spawns, "Spawn2 %d: Notified that our spawn condition %d has changed from %d to %d. Our min value is %d.", spawn2_id, c.condition_id, old_value, c.value, condition_min_value);
|
||||
LogSpawns("Spawn2 [{}]: Notified that our spawn condition [{}] has changed from [{}] to [{}]. Our min value is [{}]", spawn2_id, c.condition_id, old_value, c.value, condition_min_value);
|
||||
|
||||
bool old_state = (old_value >= condition_min_value);
|
||||
bool new_state = (c.value >= condition_min_value);
|
||||
if(old_state == new_state) {
|
||||
Log(Logs::Detail, Logs::Spawns, "Spawn2 %d: Our threshold for this condition was not crossed. Doing nothing.", spawn2_id);
|
||||
LogSpawns("Spawn2 [{}]: Our threshold for this condition was not crossed. Doing nothing", spawn2_id);
|
||||
return; //no change
|
||||
}
|
||||
|
||||
@@ -726,50 +700,50 @@ void Spawn2::SpawnConditionChanged(const SpawnCondition &c, int16 old_value) {
|
||||
switch(c.on_change) {
|
||||
case SpawnCondition::DoNothing:
|
||||
//that was easy.
|
||||
Log(Logs::Detail, Logs::Spawns, "Spawn2 %d: Our condition is now %s. Taking no action on existing spawn.", spawn2_id, new_state?"enabled":"disabled");
|
||||
LogSpawns("Spawn2 [{}]: Our condition is now [{}]. Taking no action on existing spawn", spawn2_id, new_state?"enabled":"disabled");
|
||||
break;
|
||||
case SpawnCondition::DoDepop:
|
||||
Log(Logs::Detail, Logs::Spawns, "Spawn2 %d: Our condition is now %s. Depoping our mob.", spawn2_id, new_state?"enabled":"disabled");
|
||||
LogSpawns("Spawn2 [{}]: Our condition is now [{}]. Depoping our mob", spawn2_id, new_state?"enabled":"disabled");
|
||||
if(npcthis != nullptr)
|
||||
npcthis->Depop(false); //remove the current mob
|
||||
Reset(); //reset our spawn timer
|
||||
break;
|
||||
case SpawnCondition::DoRepop:
|
||||
Log(Logs::Detail, Logs::Spawns, "Spawn2 %d: Our condition is now %s. Forcing a repop.", spawn2_id, new_state?"enabled":"disabled");
|
||||
LogSpawns("Spawn2 [{}]: Our condition is now [{}]. Forcing a repop", spawn2_id, new_state?"enabled":"disabled");
|
||||
if(npcthis != nullptr)
|
||||
npcthis->Depop(false); //remove the current mob
|
||||
Repop(); //repop
|
||||
break;
|
||||
case SpawnCondition::DoRepopIfReady:
|
||||
Log(Logs::Detail, Logs::Spawns, "Spawn2 %d: Our condition is now %s. Forcing a repop if repsawn timer is expired.", spawn2_id, new_state?"enabled":"disabled");
|
||||
LogSpawns("Spawn2 [{}]: Our condition is now [{}]. Forcing a repop if repsawn timer is expired", spawn2_id, new_state?"enabled":"disabled");
|
||||
if(npcthis != nullptr) {
|
||||
Log(Logs::Detail, Logs::Spawns, "Spawn2 %d: Our npcthis is currently not null. The zone thinks it is %s. Forcing a depop.", spawn2_id, npcthis->GetName());
|
||||
LogSpawns("Spawn2 [{}]: Our npcthis is currently not null. The zone thinks it is [{}]. Forcing a depop", spawn2_id, npcthis->GetName());
|
||||
npcthis->Depop(false); //remove the current mob
|
||||
npcthis = nullptr;
|
||||
}
|
||||
if(new_state) { // only get repawn timer remaining when the SpawnCondition is enabled.
|
||||
timer_remaining = database.GetSpawnTimeLeft(spawn2_id,zone->GetInstanceID());
|
||||
Log(Logs::Detail, Logs::Spawns,"Spawn2 %d: Our condition is now %s. The respawn timer_remaining is %d. Forcing a repop if it is <= 0.", spawn2_id, new_state?"enabled":"disabled", timer_remaining);
|
||||
LogSpawns("Spawn2 [{}]: Our condition is now [{}]. The respawn timer_remaining is [{}]. Forcing a repop if it is <= 0", spawn2_id, new_state?"enabled":"disabled", timer_remaining);
|
||||
if(timer_remaining <= 0)
|
||||
Repop();
|
||||
} else {
|
||||
Log(Logs::Detail, Logs::Spawns,"Spawn2 %d: Our condition is now %s. Not checking respawn timer.", spawn2_id, new_state?"enabled":"disabled");
|
||||
LogSpawns("Spawn2 [{}]: Our condition is now [{}]. Not checking respawn timer", spawn2_id, new_state?"enabled":"disabled");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if(c.on_change < SpawnCondition::DoSignalMin) {
|
||||
Log(Logs::Detail, Logs::Spawns, "Spawn2 %d: Our condition is now %s. Invalid on-change action %d.", spawn2_id, new_state?"enabled":"disabled", c.on_change);
|
||||
LogSpawns("Spawn2 [{}]: Our condition is now [{}]. Invalid on-change action [{}]", spawn2_id, new_state?"enabled":"disabled", c.on_change);
|
||||
return; //unknown onchange action
|
||||
}
|
||||
int signal_id = c.on_change - SpawnCondition::DoSignalMin;
|
||||
Log(Logs::Detail, Logs::Spawns, "Spawn2 %d: Our condition is now %s. Signaling our mob with %d.", spawn2_id, new_state?"enabled":"disabled", signal_id);
|
||||
LogSpawns("Spawn2 [{}]: Our condition is now [{}]. Signaling our mob with [{}]", spawn2_id, new_state?"enabled":"disabled", signal_id);
|
||||
if(npcthis != nullptr)
|
||||
npcthis->SignalNPC(signal_id);
|
||||
}
|
||||
}
|
||||
|
||||
void Zone::SpawnConditionChanged(const SpawnCondition &c, int16 old_value) {
|
||||
Log(Logs::Detail, Logs::Spawns, "Zone notified that spawn condition %d has changed from %d to %d. Notifying all spawn points.", c.condition_id, old_value, c.value);
|
||||
LogSpawns("Zone notified that spawn condition [{}] has changed from [{}] to [{}]. Notifying all spawn points", c.condition_id, old_value, c.value);
|
||||
|
||||
LinkedListIterator<Spawn2*> iterator(spawn2_list);
|
||||
|
||||
@@ -839,7 +813,7 @@ void SpawnConditionManager::Process() {
|
||||
EQTime::AddMinutes(cevent.period, &cevent.next);
|
||||
std::string t;
|
||||
EQTime::ToString(&cevent.next, t);
|
||||
Log(Logs::Detail, Logs::Spawns, "Event %d: Will trigger again in %d EQ minutes at %s.", cevent.id, cevent.period, t.c_str());
|
||||
LogSpawns("Event [{}]: Will trigger again in [{}] EQ minutes at [{}]", cevent.id, cevent.period, t.c_str());
|
||||
//save the next event time in the DB
|
||||
UpdateDBEvent(cevent);
|
||||
//find the next closest event timer.
|
||||
@@ -858,7 +832,7 @@ void SpawnConditionManager::ExecEvent(SpawnEvent &event, bool send_update) {
|
||||
std::map<uint16, SpawnCondition>::iterator condi;
|
||||
condi = spawn_conditions.find(event.condition_id);
|
||||
if(condi == spawn_conditions.end()) {
|
||||
Log(Logs::Detail, Logs::Spawns, "Event %d: Unable to find condition %d to execute on.", event.id, event.condition_id);
|
||||
LogSpawns("Event [{}]: Unable to find condition [{}] to execute on", event.id, event.condition_id);
|
||||
return; //unable to find the spawn condition to operate on
|
||||
}
|
||||
|
||||
@@ -866,7 +840,7 @@ void SpawnConditionManager::ExecEvent(SpawnEvent &event, bool send_update) {
|
||||
zone->zone_time.GetCurrentEQTimeOfDay(&tod);
|
||||
if(event.strict && (event.next.hour != tod.hour || event.next.day != tod.day || event.next.month != tod.month || event.next.year != tod.year))
|
||||
{
|
||||
Log(Logs::Detail, Logs::Spawns, "Event %d: Unable to execute. Condition is strict, and event time has already passed.", event.id);
|
||||
LogSpawns("Event [{}]: Unable to execute. Condition is strict, and event time has already passed", event.id);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -878,26 +852,26 @@ void SpawnConditionManager::ExecEvent(SpawnEvent &event, bool send_update) {
|
||||
switch(event.action) {
|
||||
case SpawnEvent::ActionSet:
|
||||
new_value = event.argument;
|
||||
Log(Logs::Detail, Logs::Spawns, "Event %d: Executing. Setting condition %d to %d.", event.id, event.condition_id, event.argument);
|
||||
LogSpawns("Event [{}]: Executing. Setting condition [{}] to [{}]", event.id, event.condition_id, event.argument);
|
||||
break;
|
||||
case SpawnEvent::ActionAdd:
|
||||
new_value += event.argument;
|
||||
Log(Logs::Detail, Logs::Spawns, "Event %d: Executing. Adding %d to condition %d, yeilding %d.", event.id, event.argument, event.condition_id, new_value);
|
||||
LogSpawns("Event [{}]: Executing. Adding [{}] to condition [{}], yielding [{}]", event.id, event.argument, event.condition_id, new_value);
|
||||
break;
|
||||
case SpawnEvent::ActionSubtract:
|
||||
new_value -= event.argument;
|
||||
Log(Logs::Detail, Logs::Spawns, "Event %d: Executing. Subtracting %d from condition %d, yeilding %d.", event.id, event.argument, event.condition_id, new_value);
|
||||
LogSpawns("Event [{}]: Executing. Subtracting [{}] from condition [{}], yielding [{}]", event.id, event.argument, event.condition_id, new_value);
|
||||
break;
|
||||
case SpawnEvent::ActionMultiply:
|
||||
new_value *= event.argument;
|
||||
Log(Logs::Detail, Logs::Spawns, "Event %d: Executing. Multiplying condition %d by %d, yeilding %d.", event.id, event.condition_id, event.argument, new_value);
|
||||
LogSpawns("Event [{}]: Executing. Multiplying condition [{}] by [{}], yielding [{}]", event.id, event.condition_id, event.argument, new_value);
|
||||
break;
|
||||
case SpawnEvent::ActionDivide:
|
||||
new_value /= event.argument;
|
||||
Log(Logs::Detail, Logs::Spawns, "Event %d: Executing. Dividing condition %d by %d, yeilding %d.", event.id, event.condition_id, event.argument, new_value);
|
||||
LogSpawns("Event [{}]: Executing. Dividing condition [{}] by [{}], yielding [{}]", event.id, event.condition_id, event.argument, new_value);
|
||||
break;
|
||||
default:
|
||||
Log(Logs::Detail, Logs::Spawns, "Event %d: Invalid event action type %d", event.id, event.action);
|
||||
LogSpawns("Event [{}]: Invalid event action type [{}]", event.id, event.action);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -967,7 +941,7 @@ bool SpawnConditionManager::LoadDBEvent(uint32 event_id, SpawnEvent &event, std:
|
||||
std::string timeAsString;
|
||||
EQTime::ToString(&event.next, timeAsString);
|
||||
|
||||
Log(Logs::Detail, Logs::Spawns, "(LoadDBEvent) Loaded %s spawn event %d on condition %d with period %d, action %d, argument %d, strict %d. Will trigger at %s", event.enabled? "enabled": "disabled", event.id, event.condition_id, event.period, event.action, event.argument, event.strict, timeAsString.c_str());
|
||||
LogSpawns("(LoadDBEvent) Loaded [{}] spawn event [{}] on condition [{}] with period [{}], action [{}], argument [{}], strict [{}]. Will trigger at [{}]", event.enabled? "enabled": "disabled", event.id, event.condition_id, event.period, event.action, event.argument, event.strict, timeAsString.c_str());
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -994,7 +968,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in
|
||||
cond.on_change = (SpawnCondition::OnChange) atoi(row[1]);
|
||||
spawn_conditions[cond.condition_id] = cond;
|
||||
|
||||
Log(Logs::Detail, Logs::Spawns, "Loaded spawn condition %d with value %d and on_change %d", cond.condition_id, cond.value, cond.on_change);
|
||||
LogSpawns("Loaded spawn condition [{}] with value [{}] and on_change [{}]", cond.condition_id, cond.value, cond.on_change);
|
||||
}
|
||||
|
||||
//load values
|
||||
@@ -1023,33 +997,42 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in
|
||||
return false;
|
||||
}
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
SpawnEvent event;
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
SpawnEvent event;
|
||||
|
||||
event.id = atoi(row[0]);
|
||||
event.condition_id = atoi(row[1]);
|
||||
event.period = atoi(row[2]);
|
||||
event.id = atoi(row[0]);
|
||||
event.condition_id = atoi(row[1]);
|
||||
event.period = atoi(row[2]);
|
||||
|
||||
if(event.period == 0) {
|
||||
Log(Logs::General, Logs::Error, "Refusing to load spawn event #%d because it has a period of 0\n", event.id);
|
||||
continue;
|
||||
}
|
||||
if (event.period == 0) {
|
||||
LogError("Refusing to load spawn event #[{}] because it has a period of 0\n", event.id);
|
||||
continue;
|
||||
}
|
||||
|
||||
event.next.minute = atoi(row[3]);
|
||||
event.next.hour = atoi(row[4]);
|
||||
event.next.day = atoi(row[5]);
|
||||
event.next.month = atoi(row[6]);
|
||||
event.next.year = atoi(row[7]);
|
||||
event.next.minute = atoi(row[3]);
|
||||
event.next.hour = atoi(row[4]);
|
||||
event.next.day = atoi(row[5]);
|
||||
event.next.month = atoi(row[6]);
|
||||
event.next.year = atoi(row[7]);
|
||||
|
||||
event.enabled = atoi(row[8])==0?false:true;
|
||||
event.action = (SpawnEvent::Action) atoi(row[9]);
|
||||
event.argument = atoi(row[10]);
|
||||
event.strict = atoi(row[11])==0?false:true;
|
||||
event.enabled = atoi(row[8]) == 0 ? false : true;
|
||||
event.action = (SpawnEvent::Action) atoi(row[9]);
|
||||
event.argument = atoi(row[10]);
|
||||
event.strict = atoi(row[11]) == 0 ? false : true;
|
||||
|
||||
spawn_events.push_back(event);
|
||||
spawn_events.push_back(event);
|
||||
|
||||
Log(Logs::Detail, Logs::Spawns, "(LoadSpawnConditions) Loaded %s spawn event %d on condition %d with period %d, action %d, argument %d, strict %d", event.enabled? "enabled": "disabled", event.id, event.condition_id, event.period, event.action, event.argument, event.strict);
|
||||
}
|
||||
LogSpawns(
|
||||
"(LoadSpawnConditions) Loaded [{}] spawn event [{}] on condition [{}] with period [{}], action [{}], argument [{}], strict [{}]",
|
||||
event.enabled ? "enabled" : "disabled",
|
||||
event.id,
|
||||
event.condition_id,
|
||||
event.period,
|
||||
event.action,
|
||||
event.argument,
|
||||
event.strict
|
||||
);
|
||||
}
|
||||
|
||||
//now we need to catch up on events that happened while we were away
|
||||
//and use them to alter just the condition variables.
|
||||
@@ -1081,31 +1064,33 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in
|
||||
if(!cevent.enabled)
|
||||
continue;
|
||||
|
||||
//watch for special case of all 0s, which means to reset next to now
|
||||
if(cevent.next.year == 0 && cevent.next.month == 0 && cevent.next.day == 0 && cevent.next.hour == 0 && cevent.next.minute == 0) {
|
||||
Log(Logs::Detail, Logs::Spawns, "Initial next trigger time set for spawn event %d", cevent.id);
|
||||
memcpy(&cevent.next, &tod, sizeof(cevent.next));
|
||||
//add one period
|
||||
EQTime::AddMinutes(cevent.period, &cevent.next);
|
||||
//save it in the db.
|
||||
UpdateDBEvent(cevent);
|
||||
continue; //were done with this event.
|
||||
}
|
||||
//watch for special case of all 0s, which means to reset next to now
|
||||
if (cevent.next.year == 0 && cevent.next.month == 0 && cevent.next.day == 0 && cevent.next.hour == 0 &&
|
||||
cevent.next.minute == 0) {
|
||||
LogSpawns("Initial next trigger time set for spawn event [{}]", cevent.id);
|
||||
memcpy(&cevent.next, &tod, sizeof(cevent.next));
|
||||
//add one period
|
||||
EQTime::AddMinutes(cevent.period, &cevent.next);
|
||||
//save it in the db.
|
||||
UpdateDBEvent(cevent);
|
||||
continue; //were done with this event.
|
||||
}
|
||||
|
||||
bool ran = false;
|
||||
while(EQTime::IsTimeBefore(&tod, &cevent.next)) {
|
||||
Log(Logs::Detail, Logs::Spawns, "Catch up triggering on event %d", cevent.id);
|
||||
//this event has been triggered.
|
||||
//execute the event
|
||||
if(!cevent.strict || StrictCheck)
|
||||
ExecEvent(cevent, false);
|
||||
bool ran = false;
|
||||
while (EQTime::IsTimeBefore(&tod, &cevent.next)) {
|
||||
LogSpawns("Catch up triggering on event [{}]", cevent.id);
|
||||
//this event has been triggered.
|
||||
//execute the event
|
||||
if (!cevent.strict || StrictCheck) {
|
||||
ExecEvent(cevent, false);
|
||||
}
|
||||
|
||||
//add the period of the event to the trigger time
|
||||
EQTime::AddMinutes(cevent.period, &cevent.next);
|
||||
ran = true;
|
||||
}
|
||||
//add the period of the event to the trigger time
|
||||
EQTime::AddMinutes(cevent.period, &cevent.next);
|
||||
ran = true;
|
||||
}
|
||||
|
||||
//only write it out if the event actually ran
|
||||
//only write it out if the event actually ran
|
||||
if(ran)
|
||||
UpdateDBEvent(cevent); //save the event in the DB
|
||||
}
|
||||
@@ -1137,10 +1122,10 @@ void SpawnConditionManager::FindNearestEvent() {
|
||||
}
|
||||
}
|
||||
if (next_id == -1) {
|
||||
Log(Logs::Detail, Logs::Spawns, "No spawn events enabled. Disabling next event.");
|
||||
LogSpawns("No spawn events enabled. Disabling next event");
|
||||
}
|
||||
else {
|
||||
Log(Logs::Detail, Logs::Spawns, "Next event determined to be event %d", next_id);
|
||||
LogSpawns("Next event determined to be event [{}]", next_id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1153,14 +1138,14 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance
|
||||
std::map<uint16, SpawnCondition>::iterator condi;
|
||||
condi = spawn_conditions.find(condition_id);
|
||||
if(condi == spawn_conditions.end()) {
|
||||
Log(Logs::Detail, Logs::Spawns, "Condition update received from world for %d, but we do not have that conditon.", condition_id);
|
||||
LogSpawns("Condition update received from world for [{}], but we do not have that conditon", condition_id);
|
||||
return; //unable to find the spawn condition
|
||||
}
|
||||
|
||||
SpawnCondition &cond = condi->second;
|
||||
|
||||
if(cond.value == new_value) {
|
||||
Log(Logs::Detail, Logs::Spawns, "Condition update received from world for %d with value %d, which is what we already have.", condition_id, new_value);
|
||||
LogSpawns("Condition update received from world for [{}] with value [{}], which is what we already have", condition_id, new_value);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1169,7 +1154,7 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance
|
||||
//set our local value
|
||||
cond.value = new_value;
|
||||
|
||||
Log(Logs::Detail, Logs::Spawns, "Condition update received from world for %d with value %d", condition_id, new_value);
|
||||
LogSpawns("Condition update received from world for [{}] with value [{}]", condition_id, new_value);
|
||||
|
||||
//now we have to test each spawn point to see if it changed.
|
||||
zone->SpawnConditionChanged(cond, old_value);
|
||||
@@ -1180,14 +1165,14 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance
|
||||
std::map<uint16, SpawnCondition>::iterator condi;
|
||||
condi = spawn_conditions.find(condition_id);
|
||||
if(condi == spawn_conditions.end()) {
|
||||
Log(Logs::Detail, Logs::Spawns, "Local Condition update requested for %d, but we do not have that conditon.", condition_id);
|
||||
LogSpawns("Local Condition update requested for [{}], but we do not have that conditon", condition_id);
|
||||
return; //unable to find the spawn condition
|
||||
}
|
||||
|
||||
SpawnCondition &cond = condi->second;
|
||||
|
||||
if(cond.value == new_value) {
|
||||
Log(Logs::Detail, Logs::Spawns, "Local Condition update requested for %d with value %d, which is what we already have.", condition_id, new_value);
|
||||
LogSpawns("Local Condition update requested for [{}] with value [{}], which is what we already have", condition_id, new_value);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1198,7 +1183,7 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance
|
||||
//save it in the DB too
|
||||
UpdateDBCondition(zone_short, instance_id, condition_id, new_value);
|
||||
|
||||
Log(Logs::Detail, Logs::Spawns, "Local Condition update requested for %d with value %d", condition_id, new_value);
|
||||
LogSpawns("Local Condition update requested for [{}] with value [{}]", condition_id, new_value);
|
||||
|
||||
//now we have to test each spawn point to see if it changed.
|
||||
zone->SpawnConditionChanged(cond, old_value);
|
||||
@@ -1208,7 +1193,7 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance
|
||||
//this is a remote spawn condition, update the DB and send
|
||||
//an update packet to the zone if its up
|
||||
|
||||
Log(Logs::Detail, Logs::Spawns, "Remote spawn condition %d set to %d. Updating DB and notifying world.", condition_id, new_value);
|
||||
LogSpawns("Remote spawn condition [{}] set to [{}]. Updating DB and notifying world", condition_id, new_value);
|
||||
|
||||
UpdateDBCondition(zone_short, instance_id, condition_id, new_value);
|
||||
|
||||
@@ -1228,7 +1213,7 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance
|
||||
void SpawnConditionManager::ReloadEvent(uint32 event_id) {
|
||||
std::string zone_short_name;
|
||||
|
||||
Log(Logs::Detail, Logs::Spawns, "Requested to reload event %d from the database.", event_id);
|
||||
LogSpawns("Requested to reload event [{}] from the database", event_id);
|
||||
|
||||
//first look for the event in our local event list
|
||||
std::vector<SpawnEvent>::iterator cur,end;
|
||||
@@ -1241,7 +1226,7 @@ void SpawnConditionManager::ReloadEvent(uint32 event_id) {
|
||||
//load the event into the old event slot
|
||||
if(!LoadDBEvent(event_id, cevent, zone_short_name)) {
|
||||
//unable to find the event in the database...
|
||||
Log(Logs::Detail, Logs::Spawns, "Failed to reload event %d from the database.", event_id);
|
||||
LogSpawns("Failed to reload event [{}] from the database", event_id);
|
||||
return;
|
||||
}
|
||||
//sync up our nearest event
|
||||
@@ -1254,7 +1239,7 @@ void SpawnConditionManager::ReloadEvent(uint32 event_id) {
|
||||
SpawnEvent e;
|
||||
if(!LoadDBEvent(event_id, e, zone_short_name)) {
|
||||
//unable to find the event in the database...
|
||||
Log(Logs::Detail, Logs::Spawns, "Failed to reload event %d from the database.", event_id);
|
||||
LogSpawns("Failed to reload event [{}] from the database", event_id);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1271,7 +1256,7 @@ void SpawnConditionManager::ReloadEvent(uint32 event_id) {
|
||||
|
||||
void SpawnConditionManager::ToggleEvent(uint32 event_id, bool enabled, bool strict, bool reset_base) {
|
||||
|
||||
Log(Logs::Detail, Logs::Spawns, "Request to %s spawn event %d %sresetting trigger time", enabled?"enable":"disable", event_id, reset_base?"":"without ");
|
||||
LogSpawns("Request to [{}] spawn event [{}] [{}]resetting trigger time", enabled?"enable":"disable", event_id, reset_base?"":"without ");
|
||||
|
||||
//first look for the event in our local event list
|
||||
std::vector<SpawnEvent>::iterator cur,end;
|
||||
@@ -1286,13 +1271,13 @@ void SpawnConditionManager::ToggleEvent(uint32 event_id, bool enabled, bool stri
|
||||
cevent.enabled = enabled;
|
||||
cevent.strict = strict;
|
||||
if(reset_base) {
|
||||
Log(Logs::Detail, Logs::Spawns, "Spawn event %d located in this zone. State set. Trigger time reset (period %d).", event_id, cevent.period);
|
||||
LogSpawns("Spawn event [{}] located in this zone. State set. Trigger time reset (period [{}])", event_id, cevent.period);
|
||||
//start with the time now
|
||||
zone->zone_time.GetCurrentEQTimeOfDay(&cevent.next);
|
||||
//advance the next time by our period
|
||||
EQTime::AddMinutes(cevent.period, &cevent.next);
|
||||
} else {
|
||||
Log(Logs::Detail, Logs::Spawns, "Spawn event %d located in this zone. State changed.", event_id);
|
||||
LogSpawns("Spawn event [{}] located in this zone. State changed", event_id);
|
||||
}
|
||||
|
||||
//save the event in the DB
|
||||
@@ -1301,7 +1286,7 @@ void SpawnConditionManager::ToggleEvent(uint32 event_id, bool enabled, bool stri
|
||||
//sync up our nearest event
|
||||
FindNearestEvent();
|
||||
} else {
|
||||
Log(Logs::Detail, Logs::Spawns, "Spawn event %d located in this zone but no change was needed.", event_id);
|
||||
LogSpawns("Spawn event [{}] located in this zone but no change was needed", event_id);
|
||||
}
|
||||
//even if we dont change anything, we still found it
|
||||
return;
|
||||
@@ -1320,24 +1305,24 @@ void SpawnConditionManager::ToggleEvent(uint32 event_id, bool enabled, bool stri
|
||||
SpawnEvent e;
|
||||
std::string zone_short_name;
|
||||
if(!LoadDBEvent(event_id, e, zone_short_name)) {
|
||||
Log(Logs::Detail, Logs::Spawns, "Unable to find spawn event %d in the database.", event_id);
|
||||
LogSpawns("Unable to find spawn event [{}] in the database", event_id);
|
||||
//unable to find the event in the database...
|
||||
return;
|
||||
}
|
||||
if(e.enabled == enabled && !reset_base) {
|
||||
Log(Logs::Detail, Logs::Spawns, "Spawn event %d is not located in this zone but no change was needed.", event_id);
|
||||
LogSpawns("Spawn event [{}] is not located in this zone but no change was needed", event_id);
|
||||
return; //no changes.
|
||||
}
|
||||
|
||||
e.enabled = enabled;
|
||||
if(reset_base) {
|
||||
Log(Logs::Detail, Logs::Spawns, "Spawn event %d is in zone %s. State set. Trigger time reset (period %d). Notifying world.", event_id, zone_short_name.c_str(), e.period);
|
||||
LogSpawns("Spawn event [{}] is in zone [{}]. State set. Trigger time reset (period [{}]). Notifying world", event_id, zone_short_name.c_str(), e.period);
|
||||
//start with the time now
|
||||
zone->zone_time.GetCurrentEQTimeOfDay(&e.next);
|
||||
//advance the next time by our period
|
||||
EQTime::AddMinutes(e.period, &e.next);
|
||||
} else {
|
||||
Log(Logs::Detail, Logs::Spawns, "Spawn event %d is in zone %s. State changed. Notifying world.", event_id, zone_short_name.c_str(), e.period);
|
||||
LogSpawns("Spawn event [{}] is in zone [{}]. State changed. Notifying world", event_id, zone_short_name.c_str(), e.period);
|
||||
}
|
||||
//save the event in the DB
|
||||
UpdateDBEvent(e);
|
||||
@@ -1362,7 +1347,7 @@ int16 SpawnConditionManager::GetCondition(const char *zone_short, uint32 instanc
|
||||
condi = spawn_conditions.find(condition_id);
|
||||
if(condi == spawn_conditions.end())
|
||||
{
|
||||
Log(Logs::Detail, Logs::Spawns, "Unable to find local condition %d in Get request.", condition_id);
|
||||
LogSpawns("Unable to find local condition [{}] in Get request", condition_id);
|
||||
return(0); //unable to find the spawn condition
|
||||
}
|
||||
|
||||
@@ -1371,20 +1356,22 @@ int16 SpawnConditionManager::GetCondition(const char *zone_short, uint32 instanc
|
||||
}
|
||||
|
||||
//this is a remote spawn condition, grab it from the DB
|
||||
//load spawn conditions
|
||||
std::string query = StringFormat("SELECT value FROM spawn_condition_values "
|
||||
"WHERE zone = '%s' AND instance_id = %u AND id = %d",
|
||||
zone_short, instance_id, condition_id);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
Log(Logs::Detail, Logs::Spawns, "Unable to query remote condition %d from zone %s in Get request.", condition_id, zone_short);
|
||||
return 0; //dunno a better thing to do...
|
||||
}
|
||||
//load spawn conditions
|
||||
std::string query = StringFormat(
|
||||
"SELECT value FROM spawn_condition_values "
|
||||
"WHERE zone = '%s' AND instance_id = %u AND id = %d",
|
||||
zone_short, instance_id, condition_id
|
||||
);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
LogSpawns("Unable to query remote condition [{}] from zone [{}] in Get request", condition_id, zone_short);
|
||||
return 0; //dunno a better thing to do...
|
||||
}
|
||||
|
||||
if (results.RowCount() == 0) {
|
||||
Log(Logs::Detail, Logs::Spawns, "Unable to load remote condition %d from zone %s in Get request.", condition_id, zone_short);
|
||||
return 0; //dunno a better thing to do...
|
||||
}
|
||||
if (results.RowCount() == 0) {
|
||||
LogSpawns("Unable to load remote condition [{}] from zone [{}] in Get request", condition_id, zone_short);
|
||||
return 0; //dunno a better thing to do...
|
||||
}
|
||||
|
||||
auto row = results.begin();
|
||||
|
||||
|
||||
+251
-104
@@ -16,8 +16,8 @@
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <fmt/format.h>
|
||||
#include "../common/global_define.h"
|
||||
#include "../common/string_util.h"
|
||||
#include "../common/types.h"
|
||||
|
||||
#include "entity.h"
|
||||
@@ -26,209 +26,356 @@
|
||||
#include "zonedb.h"
|
||||
|
||||
extern EntityList entity_list;
|
||||
extern Zone* zone;
|
||||
extern Zone *zone;
|
||||
|
||||
SpawnEntry::SpawnEntry( uint32 in_NPCType, int in_chance, uint8 in_npc_spawn_limit ) {
|
||||
NPCType = in_NPCType;
|
||||
chance = in_chance;
|
||||
npc_spawn_limit = in_npc_spawn_limit;
|
||||
SpawnEntry::SpawnEntry(uint32 in_NPCType, int in_chance, uint16 in_filter, uint8 in_npc_spawn_limit)
|
||||
{
|
||||
NPCType = in_NPCType;
|
||||
chance = in_chance;
|
||||
condition_value_filter = in_filter;
|
||||
npc_spawn_limit = in_npc_spawn_limit;
|
||||
}
|
||||
|
||||
SpawnGroup::SpawnGroup( uint32 in_id, char* name, int in_group_spawn_limit, float dist, float maxx, float minx, float maxy, float miny, int delay_in, int despawn_in, uint32 despawn_timer_in, int min_delay_in ) {
|
||||
SpawnGroup::SpawnGroup(
|
||||
uint32 in_id,
|
||||
char *name,
|
||||
int in_group_spawn_limit,
|
||||
float dist,
|
||||
float maxx,
|
||||
float minx,
|
||||
float maxy,
|
||||
float miny,
|
||||
int delay_in,
|
||||
int despawn_in,
|
||||
uint32 despawn_timer_in,
|
||||
int min_delay_in
|
||||
)
|
||||
{
|
||||
id = in_id;
|
||||
strn0cpy( name_, name, 120);
|
||||
strn0cpy(name_, name, 120);
|
||||
group_spawn_limit = in_group_spawn_limit;
|
||||
roambox[0]=maxx;
|
||||
roambox[1]=minx;
|
||||
roambox[2]=maxy;
|
||||
roambox[3]=miny;
|
||||
roamdist=dist;
|
||||
min_delay=min_delay_in;
|
||||
delay=delay_in;
|
||||
despawn=despawn_in;
|
||||
despawn_timer=despawn_timer_in;
|
||||
roambox[0] = maxx;
|
||||
roambox[1] = minx;
|
||||
roambox[2] = maxy;
|
||||
roambox[3] = miny;
|
||||
roamdist = dist;
|
||||
min_delay = min_delay_in;
|
||||
delay = delay_in;
|
||||
despawn = despawn_in;
|
||||
despawn_timer = despawn_timer_in;
|
||||
}
|
||||
|
||||
uint32 SpawnGroup::GetNPCType() {
|
||||
#if EQDEBUG >= 10
|
||||
Log(Logs::General, Logs::None, "SpawnGroup[%08x]::GetNPCType()", (uint32) this);
|
||||
#endif
|
||||
int npcType = 0;
|
||||
uint32 SpawnGroup::GetNPCType(uint16 in_filter)
|
||||
{
|
||||
int npcType = 0;
|
||||
int totalchance = 0;
|
||||
|
||||
if(!entity_list.LimitCheckGroup(id, group_spawn_limit))
|
||||
return(0);
|
||||
if (!entity_list.LimitCheckGroup(id, group_spawn_limit)) {
|
||||
return (0);
|
||||
}
|
||||
|
||||
std::list<SpawnEntry*>::iterator cur,end;
|
||||
std::list<SpawnEntry*> possible;
|
||||
std::list<SpawnEntry *>::iterator cur, end;
|
||||
std::list<SpawnEntry *> possible;
|
||||
cur = list_.begin();
|
||||
end = list_.end();
|
||||
for(; cur != end; ++cur) {
|
||||
for (; cur != end; ++cur) {
|
||||
SpawnEntry *se = *cur;
|
||||
|
||||
if(!entity_list.LimitCheckType(se->NPCType, se->npc_spawn_limit))
|
||||
if (!entity_list.LimitCheckType(se->NPCType, se->npc_spawn_limit)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (se->condition_value_filter != in_filter)
|
||||
continue;
|
||||
|
||||
totalchance += se->chance;
|
||||
possible.push_back(se);
|
||||
}
|
||||
if(totalchance == 0)
|
||||
if (totalchance == 0) {
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
int32 roll = 0;
|
||||
roll = zone->random.Int(0, totalchance-1);
|
||||
roll = zone->random.Int(0, totalchance - 1);
|
||||
|
||||
cur = possible.begin();
|
||||
end = possible.end();
|
||||
for(; cur != end; ++cur) {
|
||||
for (; cur != end; ++cur) {
|
||||
SpawnEntry *se = *cur;
|
||||
if (roll < se->chance) {
|
||||
npcType = se->NPCType;
|
||||
break;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
roll -= se->chance;
|
||||
}
|
||||
}
|
||||
return npcType;
|
||||
}
|
||||
|
||||
void SpawnGroup::AddSpawnEntry( SpawnEntry* newEntry ) {
|
||||
list_.push_back( newEntry );
|
||||
void SpawnGroup::AddSpawnEntry(SpawnEntry *newEntry)
|
||||
{
|
||||
list_.push_back(newEntry);
|
||||
}
|
||||
|
||||
SpawnGroup::~SpawnGroup() {
|
||||
std::list<SpawnEntry*>::iterator cur,end;
|
||||
SpawnGroup::~SpawnGroup()
|
||||
{
|
||||
std::list<SpawnEntry *>::iterator cur, end;
|
||||
cur = list_.begin();
|
||||
end = list_.end();
|
||||
for(; cur != end; ++cur) {
|
||||
SpawnEntry* tmp = *cur;
|
||||
for (; cur != end; ++cur) {
|
||||
SpawnEntry *tmp = *cur;
|
||||
safe_delete(tmp);
|
||||
}
|
||||
list_.clear();
|
||||
}
|
||||
|
||||
SpawnGroupList::~SpawnGroupList() {
|
||||
std::map<uint32, SpawnGroup*>::iterator cur,end;
|
||||
cur = groups.begin();
|
||||
end = groups.end();
|
||||
for(; cur != end; ++cur) {
|
||||
SpawnGroup* tmp = cur->second;
|
||||
SpawnGroupList::~SpawnGroupList()
|
||||
{
|
||||
std::map<uint32, SpawnGroup *>::iterator cur, end;
|
||||
cur = m_spawn_groups.begin();
|
||||
end = m_spawn_groups.end();
|
||||
for (; cur != end; ++cur) {
|
||||
SpawnGroup *tmp = cur->second;
|
||||
safe_delete(tmp);
|
||||
}
|
||||
groups.clear();
|
||||
m_spawn_groups.clear();
|
||||
}
|
||||
|
||||
void SpawnGroupList::AddSpawnGroup(SpawnGroup* newGroup) {
|
||||
if(newGroup == nullptr)
|
||||
void SpawnGroupList::AddSpawnGroup(SpawnGroup *new_group)
|
||||
{
|
||||
if (new_group == nullptr) {
|
||||
return;
|
||||
groups[newGroup->id] = newGroup;
|
||||
}
|
||||
|
||||
m_spawn_groups[new_group->id] = new_group;
|
||||
}
|
||||
|
||||
SpawnGroup* SpawnGroupList::GetSpawnGroup(uint32 in_id) {
|
||||
if(groups.count(in_id) != 1)
|
||||
SpawnGroup *SpawnGroupList::GetSpawnGroup(uint32 in_id)
|
||||
{
|
||||
if (m_spawn_groups.count(in_id) != 1) {
|
||||
return nullptr;
|
||||
return(groups[in_id]);
|
||||
}
|
||||
|
||||
return (m_spawn_groups[in_id]);
|
||||
}
|
||||
|
||||
bool SpawnGroupList::RemoveSpawnGroup(uint32 in_id) {
|
||||
if(groups.count(in_id) != 1)
|
||||
return(false);
|
||||
bool SpawnGroupList::RemoveSpawnGroup(uint32 in_id)
|
||||
{
|
||||
if (m_spawn_groups.count(in_id) != 1) {
|
||||
return (false);
|
||||
}
|
||||
|
||||
groups.erase(in_id);
|
||||
return(true);
|
||||
m_spawn_groups.erase(in_id);
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
void SpawnGroupList::ReloadSpawnGroups()
|
||||
{
|
||||
ClearSpawnGroups();
|
||||
database.LoadSpawnGroups(zone->GetShortName(), zone->GetInstanceVersion(), &zone->spawn_group_list);
|
||||
}
|
||||
|
||||
void SpawnGroupList::ClearSpawnGroups()
|
||||
{
|
||||
m_spawn_groups.clear();
|
||||
}
|
||||
|
||||
bool ZoneDatabase::LoadSpawnGroups(const char *zone_name, uint16 version, SpawnGroupList *spawn_group_list)
|
||||
{
|
||||
std::string query = StringFormat("SELECT DISTINCT(spawngroupID), spawngroup.name, spawngroup.spawn_limit, "
|
||||
"spawngroup.dist, spawngroup.max_x, spawngroup.min_x, "
|
||||
"spawngroup.max_y, spawngroup.min_y, spawngroup.delay, "
|
||||
"spawngroup.despawn, spawngroup.despawn_timer, spawngroup.mindelay "
|
||||
"FROM spawn2, spawngroup WHERE spawn2.spawngroupID = spawngroup.ID "
|
||||
"AND spawn2.version = %u and zone = '%s'",
|
||||
version, zone_name);
|
||||
std::string query = fmt::format(
|
||||
SQL(
|
||||
SELECT
|
||||
DISTINCT(spawngroupID),
|
||||
spawngroup.name,
|
||||
spawngroup.spawn_limit,
|
||||
spawngroup.dist,
|
||||
spawngroup.max_x,
|
||||
spawngroup.min_x,
|
||||
spawngroup.max_y,
|
||||
spawngroup.min_y,
|
||||
spawngroup.delay,
|
||||
spawngroup.despawn,
|
||||
spawngroup.despawn_timer,
|
||||
spawngroup.mindelay
|
||||
FROM
|
||||
spawn2,
|
||||
spawngroup
|
||||
WHERE
|
||||
spawn2.spawngroupID = spawngroup.ID
|
||||
AND
|
||||
spawn2.version = {} and zone = '{}'
|
||||
),
|
||||
version,
|
||||
zone_name
|
||||
);
|
||||
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
auto newSpawnGroup = new SpawnGroup(atoi(row[0]), row[1], atoi(row[2]), atof(row[3]), atof(row[4]),
|
||||
atof(row[5]), atof(row[6]), atof(row[7]), atoi(row[8]),
|
||||
atoi(row[9]), atoi(row[10]), atoi(row[11]));
|
||||
spawn_group_list->AddSpawnGroup(newSpawnGroup);
|
||||
auto new_spawn_group = new SpawnGroup(
|
||||
atoi(row[0]),
|
||||
row[1],
|
||||
atoi(row[2]),
|
||||
atof(row[3]),
|
||||
atof(row[4]),
|
||||
atof(row[5]),
|
||||
atof(row[6]),
|
||||
atof(row[7]),
|
||||
atoi(row[8]),
|
||||
atoi(row[9]),
|
||||
atoi(row[10]),
|
||||
atoi(row[11])
|
||||
);
|
||||
|
||||
spawn_group_list->AddSpawnGroup(new_spawn_group);
|
||||
}
|
||||
|
||||
query = StringFormat("SELECT DISTINCT spawnentry.spawngroupID, npcid, chance, "
|
||||
"npc_types.spawn_limit AS sl "
|
||||
"FROM spawnentry, spawn2, npc_types "
|
||||
"WHERE spawnentry.npcID=npc_types.id "
|
||||
"AND spawnentry.spawngroupID = spawn2.spawngroupID "
|
||||
"AND zone = '%s'",
|
||||
zone_name);
|
||||
query = fmt::format(
|
||||
SQL(
|
||||
SELECT
|
||||
DISTINCT
|
||||
spawnentry.spawngroupID,
|
||||
npcid,
|
||||
chance,
|
||||
condition_value_filter,
|
||||
npc_types.spawn_limit
|
||||
AS sl
|
||||
FROM
|
||||
spawnentry,
|
||||
spawn2,
|
||||
npc_types
|
||||
WHERE
|
||||
spawnentry.npcID = npc_types.id
|
||||
AND
|
||||
spawnentry.spawngroupID = spawn2.spawngroupID
|
||||
AND
|
||||
zone = '{}'),
|
||||
zone_name
|
||||
);
|
||||
|
||||
results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
Log(Logs::General, Logs::Error, "Error2 in PopulateZoneLists query '%'", query.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
auto newSpawnEntry = new SpawnEntry(atoi(row[1]), atoi(row[2]), row[3] ? atoi(row[3]) : 0);
|
||||
SpawnGroup *sg = spawn_group_list->GetSpawnGroup(atoi(row[0]));
|
||||
auto new_spawn_entry = new SpawnEntry(
|
||||
atoi(row[1]),
|
||||
atoi(row[2]),
|
||||
atoi(row[3]),
|
||||
(row[4] ? atoi(row[4]) : 0)
|
||||
);
|
||||
|
||||
if (!sg) {
|
||||
safe_delete(newSpawnEntry);
|
||||
SpawnGroup *spawn_group = spawn_group_list->GetSpawnGroup(atoi(row[0]));
|
||||
|
||||
if (!spawn_group) {
|
||||
safe_delete(new_spawn_entry);
|
||||
continue;
|
||||
}
|
||||
|
||||
sg->AddSpawnEntry(newSpawnEntry);
|
||||
spawn_group->AddSpawnEntry(new_spawn_entry);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ZoneDatabase::LoadSpawnGroupsByID(int spawngroupid, SpawnGroupList *spawn_group_list)
|
||||
/**
|
||||
* @param spawn_group_id
|
||||
* @param spawn_group_list
|
||||
* @return
|
||||
*/
|
||||
bool ZoneDatabase::LoadSpawnGroupsByID(int spawn_group_id, SpawnGroupList *spawn_group_list)
|
||||
{
|
||||
std::string query = StringFormat("SELECT DISTINCT(spawngroup.id), spawngroup.name, spawngroup.spawn_limit, "
|
||||
"spawngroup.dist, spawngroup.max_x, spawngroup.min_x, "
|
||||
"spawngroup.max_y, spawngroup.min_y, spawngroup.delay, "
|
||||
"spawngroup.despawn, spawngroup.despawn_timer, spawngroup.mindelay "
|
||||
"FROM spawngroup WHERE spawngroup.ID = '%i'",
|
||||
spawngroupid);
|
||||
std::string query = fmt::format(
|
||||
SQL(
|
||||
SELECT DISTINCT
|
||||
(spawngroup.id),
|
||||
spawngroup.name,
|
||||
spawngroup.spawn_limit,
|
||||
spawngroup.dist,
|
||||
spawngroup.max_x,
|
||||
spawngroup.min_x,
|
||||
spawngroup.max_y,
|
||||
spawngroup.min_y,
|
||||
spawngroup.delay,
|
||||
spawngroup.despawn,
|
||||
spawngroup.despawn_timer,
|
||||
spawngroup.mindelay
|
||||
FROM
|
||||
spawngroup
|
||||
WHERE
|
||||
spawngroup.ID = '{}'
|
||||
),
|
||||
spawn_group_id
|
||||
);
|
||||
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
Log(Logs::General, Logs::Error, "Error2 in PopulateZoneLists query %s", query.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
auto newSpawnGroup = new SpawnGroup(atoi(row[0]), row[1], atoi(row[2]), atof(row[3]), atof(row[4]),
|
||||
atof(row[5]), atof(row[6]), atof(row[7]), atoi(row[8]),
|
||||
atoi(row[9]), atoi(row[10]), atoi(row[11]));
|
||||
spawn_group_list->AddSpawnGroup(newSpawnGroup);
|
||||
auto new_spawn_group = new SpawnGroup(
|
||||
atoi(row[0]),
|
||||
row[1],
|
||||
atoi(row[2]),
|
||||
atof(row[3]),
|
||||
atof(row[4]),
|
||||
atof(row[5]),
|
||||
atof(row[6]),
|
||||
atof(row[7]),
|
||||
atoi(row[8]),
|
||||
atoi(row[9]),
|
||||
atoi(row[10]),
|
||||
atoi(row[11])
|
||||
);
|
||||
|
||||
spawn_group_list->AddSpawnGroup(new_spawn_group);
|
||||
}
|
||||
|
||||
query = StringFormat("SELECT DISTINCT(spawnentry.spawngroupID), spawnentry.npcid, "
|
||||
"spawnentry.chance, spawngroup.spawn_limit FROM spawnentry, spawngroup "
|
||||
"WHERE spawnentry.spawngroupID = '%i' AND spawngroup.spawn_limit = '0' "
|
||||
"ORDER BY chance",
|
||||
spawngroupid);
|
||||
query = fmt::format(
|
||||
SQL(
|
||||
SELECT DISTINCT
|
||||
(spawnentry.spawngroupID),
|
||||
spawnentry.npcid,
|
||||
spawnentry.chance,
|
||||
spawnentry.condition_value_filter,
|
||||
spawngroup.spawn_limit
|
||||
FROM
|
||||
spawnentry,
|
||||
spawngroup
|
||||
WHERE
|
||||
spawnentry.spawngroupID = '{}'
|
||||
AND spawngroup.spawn_limit = '0'
|
||||
ORDER BY chance),
|
||||
spawn_group_id
|
||||
);
|
||||
|
||||
results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
Log(Logs::General, Logs::Error, "Error3 in PopulateZoneLists query '%s'", query.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
auto newSpawnEntry = new SpawnEntry(atoi(row[1]), atoi(row[2]), row[3] ? atoi(row[3]) : 0);
|
||||
SpawnGroup *sg = spawn_group_list->GetSpawnGroup(atoi(row[0]));
|
||||
if (!sg) {
|
||||
safe_delete(newSpawnEntry);
|
||||
auto new_spawn_entry = new SpawnEntry(
|
||||
atoi(row[1]),
|
||||
atoi(row[2]),
|
||||
atoi(row[3]),
|
||||
(row[4] ? atoi(row[4]) : 0)
|
||||
);
|
||||
|
||||
SpawnGroup *spawn_group = spawn_group_list->GetSpawnGroup(atoi(row[0]));
|
||||
if (!spawn_group) {
|
||||
safe_delete(new_spawn_entry);
|
||||
continue;
|
||||
}
|
||||
|
||||
sg->AddSpawnEntry(newSpawnEntry);
|
||||
spawn_group->AddSpawnEntry(new_spawn_entry);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
+36
-22
@@ -23,50 +23,64 @@
|
||||
#include <map>
|
||||
#include <list>
|
||||
|
||||
class SpawnEntry
|
||||
{
|
||||
class SpawnEntry {
|
||||
public:
|
||||
SpawnEntry(uint32 in_NPCType, int in_chance, uint8 in_npc_spawn_limit );
|
||||
~SpawnEntry() { }
|
||||
SpawnEntry(uint32 in_NPCType, int in_chance, uint16 in_filter, uint8 in_npc_spawn_limit);
|
||||
~SpawnEntry() {}
|
||||
uint32 NPCType;
|
||||
int chance;
|
||||
int chance;
|
||||
uint16 condition_value_filter;
|
||||
|
||||
//this is a cached value from npc_types, for speed
|
||||
uint8 npc_spawn_limit; //max # of this entry which can be spawned in this zone
|
||||
};
|
||||
|
||||
class SpawnGroup
|
||||
{
|
||||
class SpawnGroup {
|
||||
public:
|
||||
SpawnGroup(uint32 in_id, char* name, int in_group_spawn_limit, float dist, float maxx, float minx, float maxy, float miny, int delay_in, int despawn_in, uint32 despawn_timer_in, int min_delay_in );
|
||||
SpawnGroup(
|
||||
uint32 in_id,
|
||||
char *name,
|
||||
int in_group_spawn_limit,
|
||||
float dist,
|
||||
float maxx,
|
||||
float minx,
|
||||
float maxy,
|
||||
float miny,
|
||||
int delay_in,
|
||||
int despawn_in,
|
||||
uint32 despawn_timer_in,
|
||||
int min_delay_in
|
||||
);
|
||||
|
||||
~SpawnGroup();
|
||||
uint32 GetNPCType();
|
||||
void AddSpawnEntry( SpawnEntry* newEntry );
|
||||
uint32 GetNPCType(uint16 condition_value_filter=1);
|
||||
void AddSpawnEntry(SpawnEntry *newEntry);
|
||||
uint32 id;
|
||||
float roamdist;
|
||||
float roambox[4];
|
||||
int min_delay;
|
||||
int delay;
|
||||
int despawn;
|
||||
float roamdist;
|
||||
float roambox[4];
|
||||
int min_delay;
|
||||
int delay;
|
||||
int despawn;
|
||||
uint32 despawn_timer;
|
||||
private:
|
||||
char name_[120];
|
||||
std::list<SpawnEntry*> list_;
|
||||
std::list<SpawnEntry *> list_;
|
||||
uint8 group_spawn_limit; //max # of this entry which can be spawned by this group
|
||||
};
|
||||
|
||||
class SpawnGroupList
|
||||
{
|
||||
class SpawnGroupList {
|
||||
public:
|
||||
SpawnGroupList() { }
|
||||
SpawnGroupList() {}
|
||||
~SpawnGroupList();
|
||||
|
||||
void AddSpawnGroup(SpawnGroup* newGroup);
|
||||
SpawnGroup* GetSpawnGroup(uint32 id);
|
||||
void AddSpawnGroup(SpawnGroup *new_group);
|
||||
SpawnGroup *GetSpawnGroup(uint32 id);
|
||||
bool RemoveSpawnGroup(uint32 in_id);
|
||||
void ClearSpawnGroups();
|
||||
void ReloadSpawnGroups();
|
||||
private:
|
||||
//LinkedList<SpawnGroup*> list_;
|
||||
std::map<uint32, SpawnGroup*> groups;
|
||||
std::map<uint32, SpawnGroup *> m_spawn_groups;
|
||||
};
|
||||
|
||||
#endif
|
||||
Loaded 100 of 2754 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user