Merge branch 'master' into master

This commit is contained in:
Paul Coene
2018-12-18 11:33:52 -05:00
committed by GitHub
49 changed files with 4241 additions and 1991 deletions
+5
View File
@@ -77,6 +77,11 @@ namespace EQEmu
} // namespace invtype
namespace popupresponse {
const int32 SERVER_INTERNAL_USE_BASE = 2000000000;
const int32 MOB_INFO_DISMISS = 2000000001;
}
namespace invslot {
using namespace RoF2::invslot::enum_;
-1
View File
@@ -306,7 +306,6 @@ union
uint32 DestructibleUnk9;
bool targetable_with_hotkey;
bool show_name;
};
struct PlayerState_Struct {
+11 -13
View File
@@ -112,7 +112,7 @@ void EQEmuLogSys::LoadLogSettingsDefaults()
* Get Executable platform currently running this code (Zone/World/etc)
*/
log_platform = GetExecutablePlatformInt();
for (int log_category_id = Logs::AA; log_category_id != Logs::MaxCategoryID; log_category_id++) {
log_settings[log_category_id].log_to_console = 0;
log_settings[log_category_id].log_to_file = 0;
@@ -122,11 +122,6 @@ void EQEmuLogSys::LoadLogSettingsDefaults()
file_logs_enabled = false;
/**
* Zero out Array
*/
memset(log_settings, 0, sizeof(LogSettings) * Logs::LogCategory::MaxCategoryID);
/**
* Set Defaults
*/
@@ -138,17 +133,20 @@ void EQEmuLogSys::LoadLogSettingsDefaults()
log_settings[Logs::MySQLError].log_to_console = Logs::General;
log_settings[Logs::Login_Server].log_to_console = Logs::General;
log_settings[Logs::Headless_Client].log_to_console = Logs::General;
log_settings[Logs::NPCScaling].log_to_gmsay = Logs::General;
/**
* Set Category enabled status on defaults
*/
log_settings[Logs::World_Server].is_category_enabled = 1;
log_settings[Logs::Zone_Server].is_category_enabled = 1;
log_settings[Logs::QS_Server].is_category_enabled = 1;
log_settings[Logs::UCS_Server].is_category_enabled = 1;
log_settings[Logs::Crash].is_category_enabled = 1;
log_settings[Logs::MySQLError].is_category_enabled = 1;
log_settings[Logs::Login_Server].is_category_enabled = 1;
for (int log_category_id = Logs::AA; log_category_id != Logs::MaxCategoryID; log_category_id++) {
const bool log_to_console = log_settings[log_category_id].log_to_console > 0;
const bool log_to_file = log_settings[log_category_id].log_to_file > 0;
const bool log_to_gmsay = log_settings[log_category_id].log_to_gmsay > 0;
const bool is_category_enabled = log_to_console || log_to_file || log_to_gmsay;
if (is_category_enabled) {
log_settings[log_category_id].is_category_enabled = 1;
}
}
/**
* Declare process file names for log writing=
-4
View File
@@ -272,10 +272,6 @@ enum {
commandInvSnapshot = 150 //ability to clear/restore snapshots
};
//default states for logging flag on NPCs and clients (having NPCs on by default is prolly a bad idea)
#define CLIENT_DEFAULT_LOGGING_ENABLED true
#define NPC_DEFAULT_LOGGING_ENABLED false
// This is the item ID we use for say links, we use the max that fits in 5 ASCII chars
#define SAYLINK_ITEM_ID 0xFFFFF
+8 -5
View File
@@ -382,15 +382,18 @@ bool RuleManager::ListRulesets(Database *database, std::map<int, std::string> &i
return true;
}
int32 RuleManager::GetIntRule(RuleManager::IntType t) const{
return(m_RuleIntValues[t]);
int32 RuleManager::GetIntRule(RuleManager::IntType t) const
{
return (m_RuleIntValues[t]);
}
float RuleManager::GetRealRule(RuleManager::RealType t) const{
return(m_RuleRealValues[t]);
float RuleManager::GetRealRule(RuleManager::RealType t) const
{
return (m_RuleRealValues[t]);
}
bool RuleManager::GetBoolRule(RuleManager::BoolType t) const{
bool RuleManager::GetBoolRule(RuleManager::BoolType t) const
{
return (m_RuleBoolValues[t] == 1);
}
+4 -1
View File
@@ -38,6 +38,7 @@
RULE_CATEGORY(Character)
RULE_INT(Character, MaxLevel, 65)
RULE_BOOL(Character, PerCharacterQglobalMaxLevel, false) // This will check for qglobal 'CharMaxLevel' character qglobal (Type 5), if player tries to level beyond that point, it will not go beyond that level
RULE_BOOL(Character, PerCharacterBucketMaxLevel, false) // This will check for data bucket 'CharMaxLevel', if player tries to level beyond that point, it will not go beyond that level
RULE_INT(Character, MaxExpLevel, 0) //Sets the Max Level attainable via Experience
RULE_INT(Character, DeathExpLossLevel, 10) // Any level greater than this will lose exp on death
RULE_INT(Character, DeathExpLossMaxLevel, 255) // Any level greater than this will no longer lose exp on death
@@ -342,7 +343,8 @@ RULE_INT(Spells, TranslocateTimeLimit, 0) // If not zero, time in seconds to acc
RULE_INT(Spells, SacrificeMinLevel, 46) //first level Sacrifice will work on
RULE_INT(Spells, SacrificeMaxLevel, 69) //last level Sacrifice will work on
RULE_INT(Spells, SacrificeItemID, 9963) //Item ID of the item Sacrifice will return (defaults to an EE)
RULE_BOOL(Spells, EnableSpellGlobals, false) // If Enabled, spells check the spell_globals table and compare character data from the quest globals before allowing that spell to scribe with scribespells
RULE_BOOL(Spells, EnableSpellGlobals, false) // If Enabled, spells check the spell_globals table and compare character data from their quest globals before allowing the spell to scribe with scribespells/traindiscs
RULE_BOOL(Spells, EnableSpellBuckets, false) // If Enabled, spells check the spell_buckets table and compare character data from their data buckets before allowing the spell to scribe with scribespells/traindiscs
RULE_INT(Spells, MaxBuffSlotsNPC, 60) // default to Tit's limit
RULE_INT(Spells, MaxSongSlotsNPC, 0) // NPCs don't have songs ...
RULE_INT(Spells, MaxDiscSlotsNPC, 0) // NPCs don't have discs ...
@@ -509,6 +511,7 @@ RULE_BOOL(Combat, UseRevampHandToHand, false) // use h2h revamped dmg/delays I b
RULE_BOOL(Combat, ClassicMasterWu, false) // classic master wu uses a random special, modern doesn't
RULE_INT(Combat, LevelToStopDamageCaps, 0) // 1 will effectively disable them, 20 should give basically same results as old incorrect system
RULE_BOOL(Combat, ClassicNPCBackstab, false) // true disables npc facestab - npcs get normal attack if not behind
RULE_BOOL(Combat, UseNPCDamageClassLevelMods, true) // Uses GetClassLevelDamageMod calc in npc_scale_manager
RULE_CATEGORY_END()
RULE_CATEGORY(NPC)
+162 -96
View File
@@ -26,30 +26,31 @@
#include "../zone/zonedb.h"
bool EQEmu::saylink::DegenerateLinkBody(SayLinkBody_Struct& say_link_body_struct, const std::string& say_link_body)
bool EQEmu::saylink::DegenerateLinkBody(SayLinkBody_Struct &say_link_body_struct, const std::string &say_link_body)
{
memset(&say_link_body_struct, 0, sizeof(say_link_body_struct));
if (say_link_body.length() != EQEmu::constants::SAY_LINK_BODY_SIZE)
if (say_link_body.length() != EQEmu::constants::SAY_LINK_BODY_SIZE) {
return false;
}
say_link_body_struct.action_id = (uint8)strtol(say_link_body.substr(0, 1).c_str(), nullptr, 16);
say_link_body_struct.item_id = (uint32)strtol(say_link_body.substr(1, 5).c_str(), nullptr, 16);
say_link_body_struct.augment_1 = (uint32)strtol(say_link_body.substr(6, 5).c_str(), nullptr, 16);
say_link_body_struct.augment_2 = (uint32)strtol(say_link_body.substr(11, 5).c_str(), nullptr, 16);
say_link_body_struct.augment_3 = (uint32)strtol(say_link_body.substr(16, 5).c_str(), nullptr, 16);
say_link_body_struct.augment_4 = (uint32)strtol(say_link_body.substr(21, 5).c_str(), nullptr, 16);
say_link_body_struct.augment_5 = (uint32)strtol(say_link_body.substr(26, 5).c_str(), nullptr, 16);
say_link_body_struct.augment_6 = (uint32)strtol(say_link_body.substr(31, 5).c_str(), nullptr, 16);
say_link_body_struct.is_evolving = (uint8)strtol(say_link_body.substr(36, 1).c_str(), nullptr, 16);
say_link_body_struct.evolve_group = (uint32)strtol(say_link_body.substr(37, 4).c_str(), nullptr, 16);
say_link_body_struct.evolve_level = (uint8)strtol(say_link_body.substr(41, 2).c_str(), nullptr, 16);
say_link_body_struct.ornament_icon = (uint32)strtol(say_link_body.substr(43, 5).c_str(), nullptr, 16);
say_link_body_struct.hash = (uint32)strtol(say_link_body.substr(48, 8).c_str(), nullptr, 16);
say_link_body_struct.action_id = (uint8) strtol(say_link_body.substr(0, 1).c_str(), nullptr, 16);
say_link_body_struct.item_id = (uint32) strtol(say_link_body.substr(1, 5).c_str(), nullptr, 16);
say_link_body_struct.augment_1 = (uint32) strtol(say_link_body.substr(6, 5).c_str(), nullptr, 16);
say_link_body_struct.augment_2 = (uint32) strtol(say_link_body.substr(11, 5).c_str(), nullptr, 16);
say_link_body_struct.augment_3 = (uint32) strtol(say_link_body.substr(16, 5).c_str(), nullptr, 16);
say_link_body_struct.augment_4 = (uint32) strtol(say_link_body.substr(21, 5).c_str(), nullptr, 16);
say_link_body_struct.augment_5 = (uint32) strtol(say_link_body.substr(26, 5).c_str(), nullptr, 16);
say_link_body_struct.augment_6 = (uint32) strtol(say_link_body.substr(31, 5).c_str(), nullptr, 16);
say_link_body_struct.is_evolving = (uint8) strtol(say_link_body.substr(36, 1).c_str(), nullptr, 16);
say_link_body_struct.evolve_group = (uint32) strtol(say_link_body.substr(37, 4).c_str(), nullptr, 16);
say_link_body_struct.evolve_level = (uint8) strtol(say_link_body.substr(41, 2).c_str(), nullptr, 16);
say_link_body_struct.ornament_icon = (uint32) strtol(say_link_body.substr(43, 5).c_str(), nullptr, 16);
say_link_body_struct.hash = (uint32) strtol(say_link_body.substr(48, 8).c_str(), nullptr, 16);
return true;
}
bool EQEmu::saylink::GenerateLinkBody(std::string& say_link_body, const SayLinkBody_Struct& say_link_body_struct)
bool EQEmu::saylink::GenerateLinkBody(std::string &say_link_body, const SayLinkBody_Struct &say_link_body_struct)
{
say_link_body = StringFormat(
"%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%02X" "%05X" "%08X",
@@ -68,8 +69,9 @@ bool EQEmu::saylink::GenerateLinkBody(std::string& say_link_body, const SayLinkB
(0xFFFFFFFF & say_link_body_struct.hash)
);
if (say_link_body.length() != EQEmu::constants::SAY_LINK_BODY_SIZE)
if (say_link_body.length() != EQEmu::constants::SAY_LINK_BODY_SIZE) {
return false;
}
return true;
}
@@ -79,7 +81,7 @@ EQEmu::SayLinkEngine::SayLinkEngine()
Reset();
}
const std::string& EQEmu::SayLinkEngine::GenerateLink()
const std::string &EQEmu::SayLinkEngine::GenerateLink()
{
m_Link.clear();
m_LinkBody.clear();
@@ -97,7 +99,7 @@ const std::string& EQEmu::SayLinkEngine::GenerateLink()
if ((m_Link.length() == 0) || (m_Link.length() > (EQEmu::constants::SAY_LINK_MAXIMUM_SIZE))) {
m_Error = true;
m_Link = "<LINKER ERROR>";
m_Link = "<LINKER ERROR>";
Log(Logs::General, Logs::Error, "SayLinkEngine::GenerateLink() failed to generate a useable say link");
Log(Logs::General, Logs::Error, ">> LinkType: %i, Lengths: {link: %u(%u), body: %u(%u), text: %u(%u)}",
m_LinkType,
@@ -145,83 +147,97 @@ void EQEmu::SayLinkEngine::generate_body()
memset(&m_LinkBodyStruct, 0, sizeof(SayLinkBody_Struct));
const EQEmu::ItemData* item_data = nullptr;
const EQEmu::ItemData *item_data = nullptr;
switch (m_LinkType) {
case saylink::SayLinkBlank:
break;
case saylink::SayLinkItemData:
if (m_ItemData == nullptr) { break; }
m_LinkBodyStruct.item_id = m_ItemData->ID;
m_LinkBodyStruct.evolve_group = m_ItemData->LoreGroup; // this probably won't work for all items
//m_LinkBodyStruct.evolve_level = m_ItemData->EvolvingLevel;
// TODO: add hash call
break;
case saylink::SayLinkLootItem:
if (m_LootData == nullptr) { break; }
item_data = database.GetItem(m_LootData->item_id);
if (item_data == nullptr) { break; }
m_LinkBodyStruct.item_id = item_data->ID;
m_LinkBodyStruct.augment_1 = m_LootData->aug_1;
m_LinkBodyStruct.augment_2 = m_LootData->aug_2;
m_LinkBodyStruct.augment_3 = m_LootData->aug_3;
m_LinkBodyStruct.augment_4 = m_LootData->aug_4;
m_LinkBodyStruct.augment_5 = m_LootData->aug_5;
m_LinkBodyStruct.augment_6 = m_LootData->aug_6;
m_LinkBodyStruct.evolve_group = item_data->LoreGroup; // see note above
//m_LinkBodyStruct.evolve_level = item_data->EvolvingLevel;
// TODO: add hash call
break;
case saylink::SayLinkItemInst:
if (m_ItemInst == nullptr) { break; }
if (m_ItemInst->GetItem() == nullptr) { break; }
m_LinkBodyStruct.item_id = m_ItemInst->GetItem()->ID;
m_LinkBodyStruct.augment_1 = m_ItemInst->GetAugmentItemID(0);
m_LinkBodyStruct.augment_2 = m_ItemInst->GetAugmentItemID(1);
m_LinkBodyStruct.augment_3 = m_ItemInst->GetAugmentItemID(2);
m_LinkBodyStruct.augment_4 = m_ItemInst->GetAugmentItemID(3);
m_LinkBodyStruct.augment_5 = m_ItemInst->GetAugmentItemID(4);
m_LinkBodyStruct.augment_6 = m_ItemInst->GetAugmentItemID(5);
m_LinkBodyStruct.is_evolving = (m_ItemInst->IsEvolving() ? 1 : 0);
m_LinkBodyStruct.evolve_group = m_ItemInst->GetItem()->LoreGroup; // see note above
m_LinkBodyStruct.evolve_level = m_ItemInst->GetEvolveLvl();
m_LinkBodyStruct.ornament_icon = m_ItemInst->GetOrnamentationIcon();
// TODO: add hash call
break;
default:
break;
case saylink::SayLinkBlank:
break;
case saylink::SayLinkItemData:
if (m_ItemData == nullptr) { break; }
m_LinkBodyStruct.item_id = m_ItemData->ID;
m_LinkBodyStruct.evolve_group = m_ItemData->LoreGroup; // this probably won't work for all items
//m_LinkBodyStruct.evolve_level = m_ItemData->EvolvingLevel;
// TODO: add hash call
break;
case saylink::SayLinkLootItem:
if (m_LootData == nullptr) { break; }
item_data = database.GetItem(m_LootData->item_id);
if (item_data == nullptr) { break; }
m_LinkBodyStruct.item_id = item_data->ID;
m_LinkBodyStruct.augment_1 = m_LootData->aug_1;
m_LinkBodyStruct.augment_2 = m_LootData->aug_2;
m_LinkBodyStruct.augment_3 = m_LootData->aug_3;
m_LinkBodyStruct.augment_4 = m_LootData->aug_4;
m_LinkBodyStruct.augment_5 = m_LootData->aug_5;
m_LinkBodyStruct.augment_6 = m_LootData->aug_6;
m_LinkBodyStruct.evolve_group = item_data->LoreGroup; // see note above
//m_LinkBodyStruct.evolve_level = item_data->EvolvingLevel;
// TODO: add hash call
break;
case saylink::SayLinkItemInst:
if (m_ItemInst == nullptr) { break; }
if (m_ItemInst->GetItem() == nullptr) { break; }
m_LinkBodyStruct.item_id = m_ItemInst->GetItem()->ID;
m_LinkBodyStruct.augment_1 = m_ItemInst->GetAugmentItemID(0);
m_LinkBodyStruct.augment_2 = m_ItemInst->GetAugmentItemID(1);
m_LinkBodyStruct.augment_3 = m_ItemInst->GetAugmentItemID(2);
m_LinkBodyStruct.augment_4 = m_ItemInst->GetAugmentItemID(3);
m_LinkBodyStruct.augment_5 = m_ItemInst->GetAugmentItemID(4);
m_LinkBodyStruct.augment_6 = m_ItemInst->GetAugmentItemID(5);
m_LinkBodyStruct.is_evolving = (m_ItemInst->IsEvolving() ? 1 : 0);
m_LinkBodyStruct.evolve_group = m_ItemInst->GetItem()->LoreGroup; // see note above
m_LinkBodyStruct.evolve_level = m_ItemInst->GetEvolveLvl();
m_LinkBodyStruct.ornament_icon = m_ItemInst->GetOrnamentationIcon();
// TODO: add hash call
break;
default:
break;
}
if (m_LinkProxyStruct.action_id)
if (m_LinkProxyStruct.action_id) {
m_LinkBodyStruct.action_id = m_LinkProxyStruct.action_id;
if (m_LinkProxyStruct.item_id)
}
if (m_LinkProxyStruct.item_id) {
m_LinkBodyStruct.item_id = m_LinkProxyStruct.item_id;
if (m_LinkProxyStruct.augment_1)
}
if (m_LinkProxyStruct.augment_1) {
m_LinkBodyStruct.augment_1 = m_LinkProxyStruct.augment_1;
if (m_LinkProxyStruct.augment_2)
}
if (m_LinkProxyStruct.augment_2) {
m_LinkBodyStruct.augment_2 = m_LinkProxyStruct.augment_2;
if (m_LinkProxyStruct.augment_3)
}
if (m_LinkProxyStruct.augment_3) {
m_LinkBodyStruct.augment_3 = m_LinkProxyStruct.augment_3;
if (m_LinkProxyStruct.augment_4)
}
if (m_LinkProxyStruct.augment_4) {
m_LinkBodyStruct.augment_4 = m_LinkProxyStruct.augment_4;
if (m_LinkProxyStruct.augment_5)
}
if (m_LinkProxyStruct.augment_5) {
m_LinkBodyStruct.augment_5 = m_LinkProxyStruct.augment_5;
if (m_LinkProxyStruct.augment_6)
}
if (m_LinkProxyStruct.augment_6) {
m_LinkBodyStruct.augment_6 = m_LinkProxyStruct.augment_6;
if (m_LinkProxyStruct.is_evolving)
}
if (m_LinkProxyStruct.is_evolving) {
m_LinkBodyStruct.is_evolving = m_LinkProxyStruct.is_evolving;
if (m_LinkProxyStruct.evolve_group)
}
if (m_LinkProxyStruct.evolve_group) {
m_LinkBodyStruct.evolve_group = m_LinkProxyStruct.evolve_group;
if (m_LinkProxyStruct.evolve_level)
}
if (m_LinkProxyStruct.evolve_level) {
m_LinkBodyStruct.evolve_level = m_LinkProxyStruct.evolve_level;
if (m_LinkProxyStruct.ornament_icon)
}
if (m_LinkProxyStruct.ornament_icon) {
m_LinkBodyStruct.ornament_icon = m_LinkProxyStruct.ornament_icon;
if (m_LinkProxyStruct.hash)
}
if (m_LinkProxyStruct.hash) {
m_LinkBodyStruct.hash = m_LinkProxyStruct.hash;
}
if (m_TaskUse)
if (m_TaskUse) {
m_LinkBodyStruct.hash = 0x14505DC2;
}
m_LinkBody = StringFormat(
"%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%02X" "%05X" "%08X",
@@ -248,29 +264,79 @@ void EQEmu::SayLinkEngine::generate_text()
return;
}
const EQEmu::ItemData* item_data = nullptr;
const EQEmu::ItemData *item_data = nullptr;
switch (m_LinkType) {
case saylink::SayLinkBlank:
break;
case saylink::SayLinkItemData:
if (m_ItemData == nullptr) { break; }
m_LinkText = m_ItemData->Name;
return;
case saylink::SayLinkLootItem:
if (m_LootData == nullptr) { break; }
item_data = database.GetItem(m_LootData->item_id);
if (item_data == nullptr) { break; }
m_LinkText = item_data->Name;
return;
case saylink::SayLinkItemInst:
if (m_ItemInst == nullptr) { break; }
if (m_ItemInst->GetItem() == nullptr) { break; }
m_LinkText = m_ItemInst->GetItem()->Name;
return;
default:
break;
case saylink::SayLinkBlank:
break;
case saylink::SayLinkItemData:
if (m_ItemData == nullptr) { break; }
m_LinkText = m_ItemData->Name;
return;
case saylink::SayLinkLootItem:
if (m_LootData == nullptr) { break; }
item_data = database.GetItem(m_LootData->item_id);
if (item_data == nullptr) { break; }
m_LinkText = item_data->Name;
return;
case saylink::SayLinkItemInst:
if (m_ItemInst == nullptr) { break; }
if (m_ItemInst->GetItem() == nullptr) { break; }
m_LinkText = m_ItemInst->GetItem()->Name;
return;
default:
break;
}
m_LinkText = "null";
}
std::string EQEmu::SayLinkEngine::GenerateQuestSaylink(std::string saylink_text, bool silent, std::string link_name)
{
uint32 saylink_id = 0;
/**
* Query for an existing phrase and id in the saylink table
*/
std::string query = StringFormat(
"SELECT `id` FROM `saylink` WHERE `phrase` = '%s' LIMIT 1",
EscapeString(saylink_text).c_str());
auto results = database.QueryDatabase(query);
if (results.Success()) {
if (results.RowCount() >= 1) {
for (auto row = results.begin(); row != results.end(); ++row)
saylink_id = static_cast<uint32>(atoi(row[0]));
}
else {
std::string insert_query = StringFormat(
"INSERT INTO `saylink` (`phrase`) VALUES ('%s')",
EscapeString(saylink_text).c_str());
results = database.QueryDatabase(insert_query);
if (!results.Success()) {
Log(Logs::General, Logs::Error, "Error in saylink phrase queries %s", results.ErrorMessage().c_str());
}
else {
saylink_id = results.LastInsertedID();
}
}
}
/**
* Generate the actual link
*/
EQEmu::SayLinkEngine linker;
linker.SetProxyItemID(SAYLINK_ITEM_ID);
if (silent) {
linker.SetProxyAugment2ID(saylink_id);
}
else {
linker.SetProxyAugment1ID(saylink_id);
}
linker.SetProxyText(link_name.c_str());
return linker.GenerateLink();
}
+2
View File
@@ -101,6 +101,8 @@ namespace EQEmu
const std::string& LinkBody() { return m_LinkBody; } // contains string format: '<LinkBody>'
const std::string& LinkText() { return m_LinkText; } // contains string format: '<LinkText>'
static std::string GenerateQuestSaylink(std::string saylink_text, bool silent, std::string link_name);
void Reset();
private:
+5 -7
View File
@@ -1175,19 +1175,17 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_
}
}
const EQEmu::ItemData* SharedDatabase::GetItem(uint32 id) {
if (id == 0)
{
const EQEmu::ItemData *SharedDatabase::GetItem(uint32 id)
{
if (id == 0) {
return nullptr;
}
if(!items_hash || id > items_hash->max_key())
{
if (!items_hash || id > items_hash->max_key()) {
return nullptr;
}
if(items_hash->exists(id))
{
if (items_hash->exists(id)) {
return &(items_hash->at(id));
}
+14
View File
@@ -1122,6 +1122,20 @@ bool IsStackableDot(uint16 spell_id)
return IsEffectInSpell(spell_id, SE_CurrentHP) || IsEffectInSpell(spell_id, SE_GravityEffect);
}
bool IsBardOnlyStackEffect(int effect)
{
switch(effect) {
case SE_CurrentMana:
case SE_ManaRegen_v2:
case SE_CurrentHP:
case SE_HealOverTime:
case SE_BardAEDot:
return true;
default:
return false;
}
}
bool IsCastWhileInvis(uint16 spell_id)
{
if (!IsValidSpell(spell_id))
+1
View File
@@ -968,6 +968,7 @@ uint32 GetPartialMeleeRuneAmount(uint32 spell_id);
uint32 GetPartialMagicRuneAmount(uint32 spell_id);
bool NoDetrimentalSpellAggro(uint16 spell_id);
bool IsStackableDot(uint16 spell_id);
bool IsBardOnlyStackEffect(int effect);
bool IsCastWhileInvis(uint16 spell_id);
bool IsEffectIgnoredInStacking(int spa);
+52 -7
View File
@@ -63,11 +63,50 @@ const std::string vStringFormat(const char* format, va_list args)
return output;
}
const std::string StringFormat(const char* format, ...)
const std::string str_tolower(std::string s)
{
std::transform(
s.begin(), s.end(), s.begin(),
[](unsigned char c) { return ::tolower(c); }
);
return s;
}
std::vector<std::string> split(std::string str_to_split, char delimiter)
{
std::stringstream ss(str_to_split);
std::string item;
std::vector<std::string> exploded_values;
while (std::getline(ss, item, delimiter)) {
exploded_values.push_back(item);
}
return exploded_values;
}
const std::string str_toupper(std::string s)
{
std::transform(
s.begin(), s.end(), s.begin(),
[](unsigned char c) { return ::toupper(c); }
);
return s;
}
const std::string ucfirst(std::string s)
{
std::string output = s;
if (!s.empty())
output[0] = static_cast<char>(::toupper(s[0]));
return output;
}
const std::string StringFormat(const char *format, ...)
{
va_list args;
va_start(args, format);
std::string output = vStringFormat(format,args);
std::string output = vStringFormat(format, args);
va_end(args);
return output;
}
@@ -188,12 +227,18 @@ std::string JoinString(const std::vector<std::string>& ar, const std::string &de
return ret;
}
void find_replace(std::string& string_subject, const std::string& search_string, const std::string& replace_string) {
auto index = string_subject.find_first_of(search_string);
while (index != std::string::npos) {
string_subject.replace(index, index + 1, replace_string);
index = string_subject.find_first_of(search_string);
void find_replace(std::string &string_subject, const std::string &search_string, const std::string &replace_string)
{
if (string_subject.find(search_string) == std::string::npos) {
return;
}
size_t start_pos = 0;
while((start_pos = string_subject.find(search_string, start_pos)) != std::string::npos) {
string_subject.replace(start_pos, search_string.length(), replace_string);
start_pos += replace_string.length();
}
}
//Const char based
+4
View File
@@ -24,6 +24,10 @@
#include "types.h"
//std::string based
const std::string str_tolower(std::string s);
const std::string str_toupper(std::string s);
const std::string ucfirst(std::string s);
std::vector<std::string> split(std::string str_to_split, char delimiter);
const std::string StringFormat(const char* format, ...);
const std::string vStringFormat(const char* format, va_list args);
std::vector<std::string> SplitString(const std::string &s, char delim);