Compare commits

...

33 Commits

Author SHA1 Message Date
Aeadoin ff2af0c49e [Release] 22.9.1 (#3250) 2023-04-03 17:49:39 -04:00
Alex King cd5697bc81 [Cleanup] Multiple cases same outcome and set skip variable to same value (#3216)
# Notes
- `skip` is set to `attacker` before it's set to `attacker` again.
- Multiple spots in `Mob::AttackAnimation` use the same animations.
2023-04-03 17:24:27 -04:00
Alex King b1571cd062 [Cleanup] Wake The Dead argument was named the same as a member variable in Mob (#3214)
# Notes
- Member variable is also named `target`.
2023-04-03 17:23:48 -04:00
Alex King 3e5d0a0601 [Cleanup] Unconditional return in for loop in GetRaidByCharID() (#3179)
# Notes
- This is improper and should just check if we have no result, return `0`, otherwise return `row[0]` of the row we queried.
2023-04-03 17:23:32 -04:00
Alex King 6a80a061dd [Cleanup] Multiple cases with same outcome in GetGMSayColorFromCategory() (#3182)
# Notes
- Both cases have the same return.
- https://pvs-studio.com/en/docs/warnings/v1037/
2023-04-03 17:20:43 -04:00
Alex King 509fd0615e [Cleanup] Remove unused query variable in Database::DeleteInstance() (#3202)
# Notes
- Variable was defined but never used.
2023-04-03 17:18:40 -04:00
Alex King da5e672a28 [Cleanup] Remove unnecessary group validation in Bot::Death() (#3235)
# Note
- We already break if there is no group above, revalidation is unnecessary.
2023-04-03 17:15:09 -04:00
Alex King 7090382074 [Cleanup] Remove unnecessary skill_to_use check in Bot::DoClassAttacks() (#3236)
# Notes
- `skill_to_use` will never be `-1` as it passes through the switch and checks class.
2023-04-03 17:11:56 -04:00
Alex King 26eabcd7a4 [Cleanup] Explicitly cast to float for more precision in Bot::GenerateBastHitPoints() (#3238)
# Notes
- Not casting explicitly we lost precision.
2023-04-03 17:05:48 -04:00
Alex King 60091015d3 [Cleanup] Remove unnecessary >= 0 checks for procs in botspellsai.cpp (#3242)
# Notes
- These are always `>= 0` since they're `uint16`.
2023-04-03 17:05:03 -04:00
Alex King 470392021b [Cleanup] Remove unnecessary setting of spell_type_index in Bot::GetChanceToCastBySpellType() (#3243)
# Notes
- The default is already `SPELL_TYPE_COUNT`, no need to set it again.
2023-04-03 17:04:51 -04:00
Alex King 90984c3215 [Cleanup] Remove unnecessary spell_list validation check in botspellsai.cpp (#3244)
# Notes
- We check if valid above, no need to do it again.
2023-04-03 17:03:56 -04:00
Alex King da2296d416 [Cleanup] Remove unnecessary hpr checks in Bot::BotCastHeal() (#3245)
# Notes
- These checks are unnecessary as we know it doesn't pass previous checks.
2023-04-03 17:03:36 -04:00
Alex King c9221f239c [Cleanup] Remove unnecessary botCaster check in Bot::GetDebuffBotSpell() (#3246)
# Notes
- We already check if `botCaster` is invalid above, no need to do so again.
2023-04-03 17:02:48 -04:00
Alex King f4edc69a87 [Cleanup] Cleanup unnecessary string -> char* -> string conversions in eqemu_config.cpp (#3207)
# Notes
- These conversions are unnecessary since we can just use the string itself.
2023-04-03 17:01:44 -04:00
Alex King 7d04608c4d [Cleanup] summon_count > MAX_SWARM_PETS is always false in aa.cpp (#3212)
# Notes
- This was always false.
2023-04-03 17:00:08 -04:00
Alex King 32be049d96 [Cleanup] Remove extraneous loottable_id setting in WakeTheDead in aa.cpp (#3215)
# Notes
- We already set `made_npc->loottable_id` to `0` above.
2023-04-03 16:59:06 -04:00
Alex King 26fd52fb06 [Cleanup] Fix SEResist array settings duplicate code (#3225)
# Notes
- These conditions did the same thing, combining them is simpler.
2023-04-03 16:53:48 -04:00
Alex King 5dd849ac75 [Cleanup] Fix typo where itembonuses should have been used instead of spellbonuses (#3221)
# Notes
- `itembonuses` was the proper name here, not `spellbonuses`.
2023-04-03 16:51:22 -04:00
Alex King f484fe4176 [Cleanup] gid is assigned 2 values simultaneously in bot.cpp (#3234)
# Notes
- Unnecessarily assigning the value twice simultaneously.
2023-04-03 16:47:46 -04:00
Alex King 3d20c0d6aa [Cleanup] Change level to bot_level in Bot::DoClassAttacks() to not overlap member variable (#3239)
# Notes
- Member variable is named `level`, change variable to `bot_level` so we don't cause issues.
2023-04-03 16:47:31 -04:00
Alex King 0297045cc5 [Cleanup] Move cases in Bot::AICastSpell() (#3247)
# Notes
- These all returned `false`, no need to be separate.
2023-04-03 16:46:31 -04:00
Alex King cb90d00832 [Cleanup] Cleanup variable names in Bot::AddSpellToBotList() (#3248)
# Notes
- `max_hp` was named after a member variable.
2023-04-03 16:45:36 -04:00
Aeadoin f752b57a55 [Cleanup] Cleanup uses of insert/push_back when a temp object is used. (#3170) 2023-04-03 16:45:01 -04:00
Alex King 2bb15271c5 [Cleanup] Fix possible dereferencing of invalid iterator in constants (#3181)
# Notes
- Possible dereferencing of invalid iterator based on logic: https://pvs-studio.com/en/docs/warnings/v783/
2023-04-03 16:42:45 -04:00
Alex King 6976e27501 [Cleanup] Use a constant reference for content_flags in SetContentFlags() (#3196)
# Notes
- This is more performant.
- https://pvs-studio.com/en/docs/warnings/v813/
- https://pvs-studio.com/en/docs/warnings/v820/
2023-04-03 16:38:20 -04:00
Alex King c9f27d6f90 [Cleanup] Remove possible dereferenced nullptrs in bot.cpp (#3241)
# Notes
- Possible dereferenced nullptrs based on logic.
2023-04-03 16:30:46 -04:00
Alex King cb129efcad [Cleanup] Fix loop and code duplication for SE_ProcOnKillShot (#3224)
* [Cleanup] Fix loop for SE_ProcOnKillShot

# Notes
- We were doing `e = 3` instead of doing `e += 3`.

* Update bonuses.cpp
2023-04-03 16:28:15 -04:00
Aeadoin d653989b03 [Bug Fix] Fix issue with Bot Raid invites not working. (#3249)
* [Bug Fix] Fix issue with Bot Raid invites not always working.

* ordering
2023-04-03 16:28:05 -04:00
Alex King ea9b373180 [Cleanup] Further bot.cpp nullptr checks (#3240)
# Notes
- `nullptr` validation
2023-04-03 16:25:00 -04:00
Aeadoin a4e006fbfb [Bug Fix] Correct Forward Declaration compilation warning (#3176)
* [Bug Fix] Correct Forward Declaration compilation warning

* no need for include
2023-04-02 12:19:43 -04:00
Aeadoin 1ffdd4cb34 [Performance] Change to use Pass by reference where valid. (#3163)
* [Performance] Change to use Pass by reference where valid.

* typo
2023-04-01 22:55:40 -04:00
Aeadoin 7f7ba2e6c2 [Cleanup] Remove unused Includes under zone files (#3162) 2023-04-01 22:55:28 -04:00
153 changed files with 443 additions and 605 deletions
+45
View File
@@ -1,3 +1,48 @@
## [22.9.1] - 04/03/2023
### Code
* Add client pointer validation to Zone::GetClosestZonePoint() ([#3173](https://github.com/EQEmu/Server/pull/3173)) @Kinglykrab 2023-04-01
* Change level to bot_level in Bot::DoClassAttacks() to not overlap member variable ([#3239](https://github.com/EQEmu/Server/pull/3239)) @Kinglykrab 2023-04-03
* Cleanup unnecessary string -> char* -> string conversions in eqemu_config.cpp ([#3207](https://github.com/EQEmu/Server/pull/3207)) @Kinglykrab 2023-04-03
* Cleanup uses of insert/push_back when a temp object is used. ([#3170](https://github.com/EQEmu/Server/pull/3170)) @Aeadoin 2023-04-03
* Cleanup variable names in Bot::AddSpellToBotList() ([#3248](https://github.com/EQEmu/Server/pull/3248)) @Kinglykrab 2023-04-03
* Explicitly cast to float for more precision in Bot::GenerateBastHitPoints() ([#3238](https://github.com/EQEmu/Server/pull/3238)) @Kinglykrab 2023-04-03
* Fix SEResist array settings duplicate code ([#3225](https://github.com/EQEmu/Server/pull/3225)) @Kinglykrab 2023-04-03
* Fix loop and code duplication for SE_ProcOnKillShot ([#3224](https://github.com/EQEmu/Server/pull/3224)) @Kinglykrab 2023-04-03
* Fix possible dereferencing of invalid iterator in constants ([#3181](https://github.com/EQEmu/Server/pull/3181)) @Kinglykrab 2023-04-03
* Fix typo where itembonuses should have been used instead of spellbonuses ([#3221](https://github.com/EQEmu/Server/pull/3221)) @Kinglykrab 2023-04-03
* Further bot.cpp nullptr checks ([#3240](https://github.com/EQEmu/Server/pull/3240)) @Kinglykrab 2023-04-03
* Move cases in Bot::AICastSpell() ([#3247](https://github.com/EQEmu/Server/pull/3247)) @Kinglykrab 2023-04-03
* Multiple cases same outcome and set skip variable to same value ([#3216](https://github.com/EQEmu/Server/pull/3216)) @Kinglykrab 2023-04-03
* Multiple cases with same outcome in GetGMSayColorFromCategory() ([#3182](https://github.com/EQEmu/Server/pull/3182)) @Kinglykrab 2023-04-03
* Remove extraneous loottable_id setting in WakeTheDead in aa.cpp ([#3215](https://github.com/EQEmu/Server/pull/3215)) @Kinglykrab 2023-04-03
* Remove possible dereferenced nullptrs in bot.cpp ([#3241](https://github.com/EQEmu/Server/pull/3241)) @Kinglykrab 2023-04-03
* Remove unnecessary >= 0 checks for procs in botspellsai.cpp ([#3242](https://github.com/EQEmu/Server/pull/3242)) @Kinglykrab 2023-04-03
* Remove unnecessary botCaster check in Bot::GetDebuffBotSpell() ([#3246](https://github.com/EQEmu/Server/pull/3246)) @Kinglykrab 2023-04-03
* Remove unnecessary group validation in Bot::Death() ([#3235](https://github.com/EQEmu/Server/pull/3235)) @Kinglykrab 2023-04-03
* Remove unnecessary hpr checks in Bot::BotCastHeal() ([#3245](https://github.com/EQEmu/Server/pull/3245)) @Kinglykrab 2023-04-03
* Remove unnecessary setting of spell_type_index in Bot::GetChanceToCastBySpellType() ([#3243](https://github.com/EQEmu/Server/pull/3243)) @Kinglykrab 2023-04-03
* Remove unnecessary skill_to_use check in Bot::DoClassAttacks() ([#3236](https://github.com/EQEmu/Server/pull/3236)) @Kinglykrab 2023-04-03
* Remove unnecessary spell_list validation check in botspellsai.cpp ([#3244](https://github.com/EQEmu/Server/pull/3244)) @Kinglykrab 2023-04-03
* Remove unnecessary validation check in Zone::ClearBlockedSpells() ([#3172](https://github.com/EQEmu/Server/pull/3172)) @Kinglykrab 2023-04-01
* Remove unused Includes under zone files ([#3162](https://github.com/EQEmu/Server/pull/3162)) @Aeadoin 2023-04-02
* Remove unused query variable in Database::DeleteInstance() ([#3202](https://github.com/EQEmu/Server/pull/3202)) @Kinglykrab 2023-04-03
* Unconditional return in for loop in GetRaidByCharID() ([#3179](https://github.com/EQEmu/Server/pull/3179)) @Kinglykrab 2023-04-03
* Use a constant reference for content_flags in SetContentFlags() ([#3196](https://github.com/EQEmu/Server/pull/3196)) @Kinglykrab 2023-04-03
* Wake The Dead argument was named the same as a member variable in Mob ([#3214](https://github.com/EQEmu/Server/pull/3214)) @Kinglykrab 2023-04-03
* gid is assigned 2 values simultaneously in bot.cpp ([#3234](https://github.com/EQEmu/Server/pull/3234)) @Kinglykrab 2023-04-03
* summon_count > MAX_SWARM_PETS is always false in aa.cpp ([#3212](https://github.com/EQEmu/Server/pull/3212)) @Kinglykrab 2023-04-03
### Fixes
* Correct Forward Declaration compilation warning ([#3176](https://github.com/EQEmu/Server/pull/3176)) @Aeadoin 2023-04-02
* Fix issue with Bot Raid invites not working. ([#3249](https://github.com/EQEmu/Server/pull/3249)) @Aeadoin 2023-04-03
### Performance
* Change to use Pass by reference where valid. ([#3163](https://github.com/EQEmu/Server/pull/3163)) @Aeadoin 2023-04-02
## [22.9.0] - 04/01/2023 ## [22.9.0] - 04/01/2023
### Bots ### Bots
+1 -1
View File
@@ -120,7 +120,7 @@ std::vector<std::string> WorldContentService::GetContentFlagsDisabled()
/** /**
* @param content_flags * @param content_flags
*/ */
void WorldContentService::SetContentFlags(std::vector<ContentFlagsRepository::ContentFlags> content_flags) void WorldContentService::SetContentFlags(const std::vector<ContentFlagsRepository::ContentFlags>& content_flags)
{ {
WorldContentService::content_flags = content_flags; WorldContentService::content_flags = content_flags;
} }
+1 -1
View File
@@ -167,7 +167,7 @@ public:
std::vector<std::string> GetContentFlagsDisabled(); std::vector<std::string> GetContentFlagsDisabled();
bool IsContentFlagEnabled(const std::string& content_flag); bool IsContentFlagEnabled(const std::string& content_flag);
bool IsContentFlagDisabled(const std::string& content_flag); bool IsContentFlagDisabled(const std::string& content_flag);
void SetContentFlags(std::vector<ContentFlagsRepository::ContentFlags> content_flags); void SetContentFlags(const std::vector<ContentFlagsRepository::ContentFlags>& content_flags);
void ReloadContentFlags(); void ReloadContentFlags();
WorldContentService * SetExpansionContext(); WorldContentService * SetExpansionContext();
+1 -1
View File
@@ -125,7 +125,7 @@ public:
StackWalker::OnOutput(szText); StackWalker::OnOutput(szText);
} }
const std::vector<std::string>& const GetLines() { return _lines; } const std::vector<std::string>& GetLines() { return _lines; }
private: private:
std::vector<std::string> _lines; std::vector<std::string> _lines;
}; };
+6 -4
View File
@@ -999,7 +999,7 @@ bool Database::GetVariable(std::string varname, std::string &varvalue)
return false; return false;
} }
bool Database::SetVariable(const std::string varname, const std::string &varvalue) bool Database::SetVariable(const std::string& varname, const std::string &varvalue)
{ {
std::string escaped_name = Strings::Escape(varname); std::string escaped_name = Strings::Escape(varname);
std::string escaped_value = Strings::Escape(varvalue); std::string escaped_value = Strings::Escape(varvalue);
@@ -2043,10 +2043,12 @@ uint32 Database::GetRaidIDByCharID(uint32 character_id) {
character_id character_id
); );
auto results = QueryDatabase(query); auto results = QueryDatabase(query);
for (auto row = results.begin(); row != results.end(); ++row) { if (!results.Success() || !results.RowCount()) {
return Strings::ToUnsignedInt(row[0]);
}
return 0; return 0;
}
auto row = results.begin();
return Strings::ToUnsignedInt(row[0]);
} }
int Database::CountInvSnapshots() { int Database::CountInvSnapshots() {
+1 -1
View File
@@ -235,7 +235,7 @@ public:
/* Database Variables */ /* Database Variables */
bool GetVariable(std::string varname, std::string &varvalue); bool GetVariable(std::string varname, std::string &varvalue);
bool SetVariable(const std::string varname, const std::string &varvalue); bool SetVariable(const std::string& varname, const std::string &varvalue);
bool LoadVariables(); bool LoadVariables();
/* General Queries */ /* General Queries */
-2
View File
@@ -429,8 +429,6 @@ void Database::AssignRaidToInstance(uint32 raid_id, uint32 instance_id)
void Database::DeleteInstance(uint16 instance_id) void Database::DeleteInstance(uint16 instance_id)
{ {
std::string query;
InstanceListPlayerRepository::DeleteWhere(*this, fmt::format("id = {}", instance_id)); InstanceListPlayerRepository::DeleteWhere(*this, fmt::format("id = {}", instance_id));
RespawnTimesRepository::DeleteWhere(*this, fmt::format("instance_id = {}", instance_id)); RespawnTimesRepository::DeleteWhere(*this, fmt::format("instance_id = {}", instance_id));
+1 -1
View File
@@ -74,7 +74,7 @@ void DBcore::ping()
m_mutex->unlock(); m_mutex->unlock();
} }
MySQLRequestResult DBcore::QueryDatabase(std::string query, bool retryOnFailureOnce) MySQLRequestResult DBcore::QueryDatabase(const std::string& query, bool retryOnFailureOnce)
{ {
auto r = QueryDatabase(query.c_str(), query.length(), retryOnFailureOnce); auto r = QueryDatabase(query.c_str(), query.length(), retryOnFailureOnce);
return r; return r;
+1 -1
View File
@@ -24,7 +24,7 @@ public:
~DBcore(); ~DBcore();
eStatus GetStatus() { return pStatus; } eStatus GetStatus() { return pStatus; }
MySQLRequestResult QueryDatabase(const char *query, uint32 querylen, bool retryOnFailureOnce = true); MySQLRequestResult QueryDatabase(const char *query, uint32 querylen, bool retryOnFailureOnce = true);
MySQLRequestResult QueryDatabase(std::string query, bool retryOnFailureOnce = true); MySQLRequestResult QueryDatabase(const std::string& query, bool retryOnFailureOnce = true);
void TransactionBegin(); void TransactionBegin();
void TransactionCommit(); void TransactionCommit();
void TransactionRollback(); void TransactionRollback();
+34 -33
View File
@@ -197,11 +197,11 @@ const std::map<int, std::string>& EQ::constants::GetLanguageMap()
std::string EQ::constants::GetLanguageName(int language_id) std::string EQ::constants::GetLanguageName(int language_id)
{ {
if (EQ::ValueWithin(language_id, LANG_COMMON_TONGUE, LANG_UNKNOWN)) { if (!EQ::ValueWithin(language_id, LANG_COMMON_TONGUE, LANG_UNKNOWN)) {
return EQ::constants::GetLanguageMap().find(language_id)->second; return std::string();
} }
return std::string(); return EQ::constants::GetLanguageMap().find(language_id)->second;
} }
const std::map<uint32, std::string>& EQ::constants::GetLDoNThemeMap() const std::map<uint32, std::string>& EQ::constants::GetLDoNThemeMap()
@@ -220,11 +220,11 @@ const std::map<uint32, std::string>& EQ::constants::GetLDoNThemeMap()
std::string EQ::constants::GetLDoNThemeName(uint32 theme_id) std::string EQ::constants::GetLDoNThemeName(uint32 theme_id)
{ {
if (EQ::ValueWithin(theme_id, LDoNThemes::Unused, LDoNThemes::TAK)) { if (!EQ::ValueWithin(theme_id, LDoNThemes::Unused, LDoNThemes::TAK)) {
return EQ::constants::GetLDoNThemeMap().find(theme_id)->second; return std::string();
} }
return std::string(); return EQ::constants::GetLDoNThemeMap().find(theme_id)->second;
} }
const std::map<int8, std::string>& EQ::constants::GetFlyModeMap() const std::map<int8, std::string>& EQ::constants::GetFlyModeMap()
@@ -243,11 +243,11 @@ const std::map<int8, std::string>& EQ::constants::GetFlyModeMap()
std::string EQ::constants::GetFlyModeName(int8 flymode_id) std::string EQ::constants::GetFlyModeName(int8 flymode_id)
{ {
if (EQ::ValueWithin(flymode_id, GravityBehavior::Ground, GravityBehavior::LevitateWhileRunning)) { if (!EQ::ValueWithin(flymode_id, GravityBehavior::Ground, GravityBehavior::LevitateWhileRunning)) {
return EQ::constants::GetFlyModeMap().find(flymode_id)->second; return std::string();
} }
return std::string(); return EQ::constants::GetFlyModeMap().find(flymode_id)->second;
} }
const std::map<bodyType, std::string>& EQ::constants::GetBodyTypeMap() const std::map<bodyType, std::string>& EQ::constants::GetBodyTypeMap()
@@ -365,11 +365,11 @@ const std::map<uint8, std::string>& EQ::constants::GetConsiderLevelMap()
std::string EQ::constants::GetConsiderLevelName(uint8 faction_consider_level) std::string EQ::constants::GetConsiderLevelName(uint8 faction_consider_level)
{ {
if (EQ::constants::GetConsiderLevelMap().find(faction_consider_level) != EQ::constants::GetConsiderLevelMap().end()) { if (!EQ::ValueWithin(faction_consider_level, ConsiderLevel::Ally, ConsiderLevel::Scowls)) {
return EQ::constants::GetConsiderLevelMap().find(faction_consider_level)->second; return std::string();;
} }
return std::string(); return EQ::constants::GetConsiderLevelMap().find(faction_consider_level)->second;
} }
const std::map<uint8, std::string>& EQ::constants::GetEnvironmentalDamageMap() const std::map<uint8, std::string>& EQ::constants::GetEnvironmentalDamageMap()
@@ -386,11 +386,11 @@ const std::map<uint8, std::string>& EQ::constants::GetEnvironmentalDamageMap()
std::string EQ::constants::GetEnvironmentalDamageName(uint8 damage_type) std::string EQ::constants::GetEnvironmentalDamageName(uint8 damage_type)
{ {
if (EQ::ValueWithin(damage_type, EnvironmentalDamage::Lava, EnvironmentalDamage::Trap)) { if (!EQ::ValueWithin(damage_type, EnvironmentalDamage::Lava, EnvironmentalDamage::Trap)) {
return EQ::constants::GetEnvironmentalDamageMap().find(damage_type)->second; return std::string();
} }
return std::string(); return EQ::constants::GetEnvironmentalDamageMap().find(damage_type)->second;
} }
const std::map<uint8, std::string>& EQ::constants::GetStuckBehaviorMap() const std::map<uint8, std::string>& EQ::constants::GetStuckBehaviorMap()
@@ -407,11 +407,11 @@ const std::map<uint8, std::string>& EQ::constants::GetStuckBehaviorMap()
std::string EQ::constants::GetStuckBehaviorName(uint8 behavior_id) std::string EQ::constants::GetStuckBehaviorName(uint8 behavior_id)
{ {
if (EQ::ValueWithin(behavior_id, StuckBehavior::RunToTarget, StuckBehavior::EvadeCombat)) { if (!EQ::ValueWithin(behavior_id, StuckBehavior::RunToTarget, StuckBehavior::EvadeCombat)) {
return EQ::constants::GetStuckBehaviorMap().find(behavior_id)->second; return std::string();
} }
return std::string(); return EQ::constants::GetStuckBehaviorMap().find(behavior_id)->second;
} }
const std::map<uint8, std::string>& EQ::constants::GetSpawnAnimationMap() const std::map<uint8, std::string>& EQ::constants::GetSpawnAnimationMap()
@@ -429,11 +429,11 @@ const std::map<uint8, std::string>& EQ::constants::GetSpawnAnimationMap()
std::string EQ::constants::GetSpawnAnimationName(uint8 animation_id) std::string EQ::constants::GetSpawnAnimationName(uint8 animation_id)
{ {
if (EQ::ValueWithin(animation_id, SpawnAnimations::Standing, SpawnAnimations::Looting)) { if (!EQ::ValueWithin(animation_id, SpawnAnimations::Standing, SpawnAnimations::Looting)) {
return EQ::constants::GetSpawnAnimationMap().find(animation_id)->second; return std::string();
} }
return std::string(); return EQ::constants::GetSpawnAnimationMap().find(animation_id)->second;
} }
const std::map<int, std::string>& EQ::constants::GetObjectTypeMap() const std::map<int, std::string>& EQ::constants::GetObjectTypeMap()
@@ -507,11 +507,12 @@ const std::map<int, std::string>& EQ::constants::GetObjectTypeMap()
std::string EQ::constants::GetObjectTypeName(int object_type) std::string EQ::constants::GetObjectTypeName(int object_type)
{ {
if (EQ::ValueWithin(object_type, ObjectTypes::SmallBag, ObjectTypes::NoDeposit)) { if (!EQ::ValueWithin(object_type, ObjectTypes::SmallBag, ObjectTypes::NoDeposit)) {
return EQ::constants::GetObjectTypeMap().find(object_type)->second; return std::string();
} }
return std::string(); return EQ::constants::GetObjectTypeMap().find(object_type)->second;
} }
const std::map<uint8, std::string> &EQ::constants::GetWeatherTypeMap() const std::map<uint8, std::string> &EQ::constants::GetWeatherTypeMap()
@@ -527,11 +528,11 @@ const std::map<uint8, std::string> &EQ::constants::GetWeatherTypeMap()
std::string EQ::constants::GetWeatherTypeName(uint8 weather_type) std::string EQ::constants::GetWeatherTypeName(uint8 weather_type)
{ {
if (EQ::ValueWithin(weather_type, WeatherTypes::None, WeatherTypes::Snowing)) { if (!EQ::ValueWithin(weather_type, WeatherTypes::None, WeatherTypes::Snowing)) {
return EQ::constants::GetWeatherTypeMap().find(weather_type)->second; return std::string();
} }
return std::string(); return EQ::constants::GetWeatherTypeMap().find(weather_type)->second;
} }
const std::map<uint8, std::string> &EQ::constants::GetEmoteEventTypeMap() const std::map<uint8, std::string> &EQ::constants::GetEmoteEventTypeMap()
@@ -553,11 +554,11 @@ const std::map<uint8, std::string> &EQ::constants::GetEmoteEventTypeMap()
std::string EQ::constants::GetEmoteEventTypeName(uint8 emote_event_type) std::string EQ::constants::GetEmoteEventTypeName(uint8 emote_event_type)
{ {
if (EQ::ValueWithin(emote_event_type, EmoteEventTypes::LeaveCombat, EmoteEventTypes::OnDespawn)) { if (!EQ::ValueWithin(emote_event_type, EmoteEventTypes::LeaveCombat, EmoteEventTypes::OnDespawn)) {
return EQ::constants::GetEmoteEventTypeMap().find(emote_event_type)->second; return std::string();
} }
return std::string(); return EQ::constants::GetEmoteEventTypeMap().find(emote_event_type)->second;
} }
const std::map<uint8, std::string> &EQ::constants::GetEmoteTypeMap() const std::map<uint8, std::string> &EQ::constants::GetEmoteTypeMap()
@@ -573,9 +574,9 @@ const std::map<uint8, std::string> &EQ::constants::GetEmoteTypeMap()
std::string EQ::constants::GetEmoteTypeName(uint8 emote_type) std::string EQ::constants::GetEmoteTypeName(uint8 emote_type)
{ {
if (EQ::ValueWithin(emote_type, EmoteTypes::Emote, EmoteTypes::Proximity)) { if (!EQ::ValueWithin(emote_type, EmoteTypes::Emote, EmoteTypes::Proximity)) {
return EQ::constants::GetEmoteTypeMap().find(emote_type)->second; return std::string();
} }
return std::string(); return EQ::constants::GetEmoteTypeMap().find(emote_type)->second;
} }
+1 -1
View File
@@ -129,7 +129,7 @@ namespace EQ
LookupEntry(const LookupEntry *lookup_entry) { } LookupEntry(const LookupEntry *lookup_entry) { }
LookupEntry( LookupEntry(
InventoryTypeSize_Struct InventoryTypeSize, const InventoryTypeSize_Struct& InventoryTypeSize,
uint64 EquipmentBitmask, uint64 EquipmentBitmask,
uint64 GeneralBitmask, uint64 GeneralBitmask,
uint64 CursorBitmask, uint64 CursorBitmask,
+1 -1
View File
@@ -145,7 +145,7 @@ void EQStreamIdentifier::Process() {
} }
void EQStreamIdentifier::AddStream(std::shared_ptr<EQStreamInterface> eqs) { void EQStreamIdentifier::AddStream(std::shared_ptr<EQStreamInterface> eqs) {
m_streams.push_back(Record(eqs)); m_streams.emplace_back(Record(eqs));
eqs = nullptr; eqs = nullptr;
} }
+18 -18
View File
@@ -34,13 +34,13 @@ void EQEmuConfig::parse_config()
LongName = _root["server"]["world"].get("longname", "").asString(); LongName = _root["server"]["world"].get("longname", "").asString();
WorldAddress = _root["server"]["world"].get("address", "").asString(); WorldAddress = _root["server"]["world"].get("address", "").asString();
LocalAddress = _root["server"]["world"].get("localaddress", "").asString(); LocalAddress = _root["server"]["world"].get("localaddress", "").asString();
MaxClients = Strings::ToInt(_root["server"]["world"].get("maxclients", "-1").asString().c_str()); MaxClients = Strings::ToInt(_root["server"]["world"].get("maxclients", "-1").asString());
SharedKey = _root["server"]["world"].get("key", "").asString(); SharedKey = _root["server"]["world"].get("key", "").asString();
LoginCount = 0; LoginCount = 0;
if (_root["server"]["world"]["loginserver"].isObject()) { if (_root["server"]["world"]["loginserver"].isObject()) {
LoginHost = _root["server"]["world"]["loginserver"].get("host", "login.eqemulator.net").asString(); LoginHost = _root["server"]["world"]["loginserver"].get("host", "login.eqemulator.net").asString();
LoginPort = Strings::ToUnsignedInt(_root["server"]["world"]["loginserver"].get("port", "5998").asString().c_str()); LoginPort = Strings::ToUnsignedInt(_root["server"]["world"]["loginserver"].get("port", "5998").asString());
LoginLegacy = false; LoginLegacy = false;
if (_root["server"]["world"]["loginserver"].get("legacy", "0").asString() == "1") { LoginLegacy = true; } if (_root["server"]["world"]["loginserver"].get("legacy", "0").asString() == "1") { LoginLegacy = true; }
LoginAccount = _root["server"]["world"]["loginserver"].get("account", "").asString(); LoginAccount = _root["server"]["world"]["loginserver"].get("account", "").asString();
@@ -63,7 +63,7 @@ void EQEmuConfig::parse_config()
auto loginconfig = new LoginConfig; auto loginconfig = new LoginConfig;
loginconfig->LoginHost = _root["server"]["world"][str].get("host", "login.eqemulator.net").asString(); loginconfig->LoginHost = _root["server"]["world"][str].get("host", "login.eqemulator.net").asString();
loginconfig->LoginPort = Strings::ToUnsignedInt(_root["server"]["world"][str].get("port", "5998").asString().c_str()); loginconfig->LoginPort = Strings::ToUnsignedInt(_root["server"]["world"][str].get("port", "5998").asString());
loginconfig->LoginAccount = _root["server"]["world"][str].get("account", "").asString(); loginconfig->LoginAccount = _root["server"]["world"][str].get("account", "").asString();
loginconfig->LoginPassword = _root["server"]["world"][str].get("password", "").asString(); loginconfig->LoginPassword = _root["server"]["world"][str].get("password", "").asString();
@@ -86,15 +86,15 @@ void EQEmuConfig::parse_config()
Locked = false; Locked = false;
if (_root["server"]["world"].get("locked", "false").asString() == "true") { Locked = true; } if (_root["server"]["world"].get("locked", "false").asString() == "true") { Locked = true; }
WorldIP = _root["server"]["world"]["tcp"].get("host", "127.0.0.1").asString(); WorldIP = _root["server"]["world"]["tcp"].get("host", "127.0.0.1").asString();
WorldTCPPort = Strings::ToUnsignedInt(_root["server"]["world"]["tcp"].get("port", "9000").asString().c_str()); WorldTCPPort = Strings::ToUnsignedInt(_root["server"]["world"]["tcp"].get("port", "9000").asString());
TelnetIP = _root["server"]["world"]["telnet"].get("ip", "127.0.0.1").asString(); TelnetIP = _root["server"]["world"]["telnet"].get("ip", "127.0.0.1").asString();
TelnetTCPPort = Strings::ToUnsignedInt(_root["server"]["world"]["telnet"].get("port", "9001").asString().c_str()); TelnetTCPPort = Strings::ToUnsignedInt(_root["server"]["world"]["telnet"].get("port", "9001").asString());
TelnetEnabled = false; TelnetEnabled = false;
if (_root["server"]["world"]["telnet"].get("enabled", "false").asString() == "true") { TelnetEnabled = true; } if (_root["server"]["world"]["telnet"].get("enabled", "false").asString() == "true") { TelnetEnabled = true; }
WorldHTTPMimeFile = _root["server"]["world"]["http"].get("mimefile", "mime.types").asString(); WorldHTTPMimeFile = _root["server"]["world"]["http"].get("mimefile", "mime.types").asString();
WorldHTTPPort = Strings::ToUnsignedInt(_root["server"]["world"]["http"].get("port", "9080").asString().c_str()); WorldHTTPPort = Strings::ToUnsignedInt(_root["server"]["world"]["http"].get("port", "9080").asString());
WorldHTTPEnabled = false; WorldHTTPEnabled = false;
if (_root["server"]["world"]["http"].get("enabled", "false").asString() == "true") { if (_root["server"]["world"]["http"].get("enabled", "false").asString() == "true") {
@@ -109,9 +109,9 @@ void EQEmuConfig::parse_config()
* UCS * UCS
*/ */
ChatHost = _root["server"]["chatserver"].get("host", "eqchat.eqemulator.net").asString(); ChatHost = _root["server"]["chatserver"].get("host", "eqchat.eqemulator.net").asString();
ChatPort = Strings::ToUnsignedInt(_root["server"]["chatserver"].get("port", "7778").asString().c_str()); ChatPort = Strings::ToUnsignedInt(_root["server"]["chatserver"].get("port", "7778").asString());
MailHost = _root["server"]["mailserver"].get("host", "eqmail.eqemulator.net").asString(); MailHost = _root["server"]["mailserver"].get("host", "eqmail.eqemulator.net").asString();
MailPort = Strings::ToUnsignedInt(_root["server"]["mailserver"].get("port", "7778").asString().c_str()); MailPort = Strings::ToUnsignedInt(_root["server"]["mailserver"].get("port", "7778").asString());
/** /**
* Database * Database
@@ -119,7 +119,7 @@ void EQEmuConfig::parse_config()
DatabaseUsername = _root["server"]["database"].get("username", "eq").asString(); DatabaseUsername = _root["server"]["database"].get("username", "eq").asString();
DatabasePassword = _root["server"]["database"].get("password", "eq").asString(); DatabasePassword = _root["server"]["database"].get("password", "eq").asString();
DatabaseHost = _root["server"]["database"].get("host", "localhost").asString(); DatabaseHost = _root["server"]["database"].get("host", "localhost").asString();
DatabasePort = Strings::ToUnsignedInt(_root["server"]["database"].get("port", "3306").asString().c_str()); DatabasePort = Strings::ToUnsignedInt(_root["server"]["database"].get("port", "3306").asString());
DatabaseDB = _root["server"]["database"].get("db", "eq").asString(); DatabaseDB = _root["server"]["database"].get("db", "eq").asString();
/** /**
@@ -128,14 +128,14 @@ void EQEmuConfig::parse_config()
ContentDbUsername = _root["server"]["content_database"].get("username", "").asString(); ContentDbUsername = _root["server"]["content_database"].get("username", "").asString();
ContentDbPassword = _root["server"]["content_database"].get("password", "").asString(); ContentDbPassword = _root["server"]["content_database"].get("password", "").asString();
ContentDbHost = _root["server"]["content_database"].get("host", "").asString(); ContentDbHost = _root["server"]["content_database"].get("host", "").asString();
ContentDbPort = Strings::ToUnsignedInt(_root["server"]["content_database"].get("port", 0).asString().c_str()); ContentDbPort = Strings::ToUnsignedInt(_root["server"]["content_database"].get("port", 0).asString());
ContentDbName = _root["server"]["content_database"].get("db", "").asString(); ContentDbName = _root["server"]["content_database"].get("db", "").asString();
/** /**
* QS * QS
*/ */
QSDatabaseHost = _root["server"]["qsdatabase"].get("host", "localhost").asString(); QSDatabaseHost = _root["server"]["qsdatabase"].get("host", "localhost").asString();
QSDatabasePort = Strings::ToUnsignedInt(_root["server"]["qsdatabase"].get("port", "3306").asString().c_str()); QSDatabasePort = Strings::ToUnsignedInt(_root["server"]["qsdatabase"].get("port", "3306").asString());
QSDatabaseUsername = _root["server"]["qsdatabase"].get("username", "eq").asString(); QSDatabaseUsername = _root["server"]["qsdatabase"].get("username", "eq").asString();
QSDatabasePassword = _root["server"]["qsdatabase"].get("password", "eq").asString(); QSDatabasePassword = _root["server"]["qsdatabase"].get("password", "eq").asString();
QSDatabaseDB = _root["server"]["qsdatabase"].get("db", "eq").asString(); QSDatabaseDB = _root["server"]["qsdatabase"].get("db", "eq").asString();
@@ -143,9 +143,9 @@ void EQEmuConfig::parse_config()
/** /**
* Zones * Zones
*/ */
DefaultStatus = Strings::ToUnsignedInt(_root["server"]["zones"].get("defaultstatus", 0).asString().c_str()); DefaultStatus = Strings::ToUnsignedInt(_root["server"]["zones"].get("defaultstatus", 0).asString());
ZonePortLow = Strings::ToUnsignedInt(_root["server"]["zones"]["ports"].get("low", "7000").asString().c_str()); ZonePortLow = Strings::ToUnsignedInt(_root["server"]["zones"]["ports"].get("low", "7000").asString());
ZonePortHigh = Strings::ToUnsignedInt(_root["server"]["zones"]["ports"].get("high", "7999").asString().c_str()); ZonePortHigh = Strings::ToUnsignedInt(_root["server"]["zones"]["ports"].get("high", "7999").asString());
/** /**
* Files * Files
@@ -175,10 +175,10 @@ void EQEmuConfig::parse_config()
/** /**
* Launcher * Launcher
*/ */
RestartWait = Strings::ToInt(_root["server"]["launcher"]["timers"].get("restart", "10000").asString().c_str()); RestartWait = Strings::ToInt(_root["server"]["launcher"]["timers"].get("restart", "10000").asString());
TerminateWait = Strings::ToInt(_root["server"]["launcher"]["timers"].get("reterminate", "10000").asString().c_str()); TerminateWait = Strings::ToInt(_root["server"]["launcher"]["timers"].get("reterminate", "10000").asString());
InitialBootWait = Strings::ToInt(_root["server"]["launcher"]["timers"].get("initial", "20000").asString().c_str()); InitialBootWait = Strings::ToInt(_root["server"]["launcher"]["timers"].get("initial", "20000").asString());
ZoneBootInterval = Strings::ToInt(_root["server"]["launcher"]["timers"].get("interval", "2000").asString().c_str()); ZoneBootInterval = Strings::ToInt(_root["server"]["launcher"]["timers"].get("interval", "2000").asString());
#ifdef WIN32 #ifdef WIN32
ZoneExe = _root["server"]["launcher"].get("exe", "zone.exe").asString(); ZoneExe = _root["server"]["launcher"].get("exe", "zone.exe").asString();
#else #else
+2 -3
View File
@@ -187,9 +187,10 @@ void EQEmuLogSys::ProcessLogWrite(
uint16 EQEmuLogSys::GetGMSayColorFromCategory(uint16 log_category) uint16 EQEmuLogSys::GetGMSayColorFromCategory(uint16 log_category)
{ {
switch (log_category) { switch (log_category) {
case Logs::Crash:
case Logs::Error:
case Logs::MySQLError: case Logs::MySQLError:
case Logs::QuestErrors: case Logs::QuestErrors:
case Logs::Error:
return Chat::Red; return Chat::Red;
case Logs::MySQLQuery: case Logs::MySQLQuery:
case Logs::Debug: case Logs::Debug:
@@ -199,8 +200,6 @@ uint16 EQEmuLogSys::GetGMSayColorFromCategory(uint16 log_category)
case Logs::Commands: case Logs::Commands:
case Logs::Mercenaries: case Logs::Mercenaries:
return Chat::Magenta; return Chat::Magenta;
case Logs::Crash:
return Chat::Red;
default: default:
return Chat::Yellow; return Chat::Yellow;
} }
+1 -1
View File
@@ -38,7 +38,7 @@ namespace EQ
_running = true; _running = true;
for (size_t i = 0; i < threads; ++i) { for (size_t i = 0; i < threads; ++i) {
_threads.push_back(std::thread(std::bind(&TaskScheduler::ProcessWork, this))); _threads.emplace_back(std::thread(std::bind(&TaskScheduler::ProcessWork, this)));
} }
} }
+1 -1
View File
@@ -7,7 +7,7 @@ EQ::Net::ConsoleServer::ConsoleServer(const std::string &addr, int port)
m_server = std::make_unique<EQ::Net::TCPServer>(); m_server = std::make_unique<EQ::Net::TCPServer>();
m_server->Listen(addr, port, false, [this](std::shared_ptr<EQ::Net::TCPConnection> connection) { m_server->Listen(addr, port, false, [this](std::shared_ptr<EQ::Net::TCPConnection> connection) {
ConsoleServerConnection *c = new ConsoleServerConnection(this, connection); ConsoleServerConnection *c = new ConsoleServerConnection(this, connection);
m_connections.insert(std::make_pair(c->GetUUID(), std::unique_ptr<ConsoleServerConnection>(c))); m_connections.emplace(std::make_pair(c->GetUUID(), std::unique_ptr<ConsoleServerConnection>(c)));
}); });
} }
+6 -6
View File
@@ -97,7 +97,7 @@ void EQ::Net::DaybreakConnectionManager::Connect(const std::string &addr, int po
m_on_new_connection(connection); m_on_new_connection(connection);
} }
m_connections.insert(std::make_pair(std::make_pair(addr, port), connection)); m_connections.emplace(std::make_pair(std::make_pair(addr, port), connection));
} }
void EQ::Net::DaybreakConnectionManager::Process() void EQ::Net::DaybreakConnectionManager::Process()
@@ -234,7 +234,7 @@ void EQ::Net::DaybreakConnectionManager::ProcessPacket(const std::string &endpoi
if (m_on_new_connection) { if (m_on_new_connection) {
m_on_new_connection(connection); m_on_new_connection(connection);
} }
m_connections.insert(std::make_pair(std::make_pair(endpoint, port), connection)); m_connections.emplace(std::make_pair(std::make_pair(endpoint, port), connection));
connection->ProcessPacket(p); connection->ProcessPacket(p);
} }
else if (data[1] != OP_OutOfSession) { else if (data[1] != OP_OutOfSession) {
@@ -527,7 +527,7 @@ void EQ::Net::DaybreakConnection::AddToQueue(int stream, uint16_t seq, const Pac
DynamicPacket *out = new DynamicPacket(); DynamicPacket *out = new DynamicPacket();
out->PutPacket(0, p); out->PutPacket(0, p);
s->packet_queue.insert(std::make_pair(seq, out)); s->packet_queue.emplace(std::make_pair(seq, out));
} }
} }
@@ -1427,7 +1427,7 @@ void EQ::Net::DaybreakConnection::InternalQueuePacket(Packet &p, int stream_id,
static_cast<size_t>((m_rolling_ping * m_owner->m_options.resend_delay_factor) + m_owner->m_options.resend_delay_ms), static_cast<size_t>((m_rolling_ping * m_owner->m_options.resend_delay_factor) + m_owner->m_options.resend_delay_ms),
m_owner->m_options.resend_delay_min, m_owner->m_options.resend_delay_min,
m_owner->m_options.resend_delay_max); m_owner->m_options.resend_delay_max);
stream->sent_packets.insert(std::make_pair(stream->sequence_out, sent)); stream->sent_packets.emplace(std::make_pair(stream->sequence_out, sent));
stream->sequence_out++; stream->sequence_out++;
InternalBufferedSend(first_packet); InternalBufferedSend(first_packet);
@@ -1459,7 +1459,7 @@ void EQ::Net::DaybreakConnection::InternalQueuePacket(Packet &p, int stream_id,
static_cast<size_t>((m_rolling_ping * m_owner->m_options.resend_delay_factor) + m_owner->m_options.resend_delay_ms), static_cast<size_t>((m_rolling_ping * m_owner->m_options.resend_delay_factor) + m_owner->m_options.resend_delay_ms),
m_owner->m_options.resend_delay_min, m_owner->m_options.resend_delay_min,
m_owner->m_options.resend_delay_max); m_owner->m_options.resend_delay_max);
stream->sent_packets.insert(std::make_pair(stream->sequence_out, sent)); stream->sent_packets.emplace(std::make_pair(stream->sequence_out, sent));
stream->sequence_out++; stream->sequence_out++;
InternalBufferedSend(packet); InternalBufferedSend(packet);
@@ -1483,7 +1483,7 @@ void EQ::Net::DaybreakConnection::InternalQueuePacket(Packet &p, int stream_id,
static_cast<size_t>((m_rolling_ping * m_owner->m_options.resend_delay_factor) + m_owner->m_options.resend_delay_ms), static_cast<size_t>((m_rolling_ping * m_owner->m_options.resend_delay_factor) + m_owner->m_options.resend_delay_ms),
m_owner->m_options.resend_delay_min, m_owner->m_options.resend_delay_min,
m_owner->m_options.resend_delay_max); m_owner->m_options.resend_delay_max);
stream->sent_packets.insert(std::make_pair(stream->sequence_out, sent)); stream->sent_packets.emplace(std::make_pair(stream->sequence_out, sent));
stream->sequence_out++; stream->sequence_out++;
InternalBufferedSend(packet); InternalBufferedSend(packet);
+1 -1
View File
@@ -22,7 +22,7 @@ void EQ::Net::EQStreamManager::SetOptions(const EQStreamManagerInterfaceOptions
void EQ::Net::EQStreamManager::DaybreakNewConnection(std::shared_ptr<DaybreakConnection> connection) void EQ::Net::EQStreamManager::DaybreakNewConnection(std::shared_ptr<DaybreakConnection> connection)
{ {
std::shared_ptr<EQStream> stream(new EQStream(this, connection)); std::shared_ptr<EQStream> stream(new EQStream(this, connection));
m_streams.insert(std::make_pair(connection, stream)); m_streams.emplace(std::make_pair(connection, stream));
if (m_on_new_connection) { if (m_on_new_connection) {
m_on_new_connection(stream); m_on_new_connection(stream);
} }
+1 -1
View File
@@ -45,7 +45,7 @@ void EQ::Net::ServertalkClient::SendPacket(ServerPacket *p)
void EQ::Net::ServertalkClient::OnMessage(uint16_t opcode, std::function<void(uint16_t, EQ::Net::Packet&)> cb) void EQ::Net::ServertalkClient::OnMessage(uint16_t opcode, std::function<void(uint16_t, EQ::Net::Packet&)> cb)
{ {
m_message_callbacks.insert(std::make_pair(opcode, cb)); m_message_callbacks.emplace(std::make_pair(opcode, cb));
} }
void EQ::Net::ServertalkClient::OnMessage(std::function<void(uint16_t, EQ::Net::Packet&)> cb) void EQ::Net::ServertalkClient::OnMessage(std::function<void(uint16_t, EQ::Net::Packet&)> cb)
@@ -41,7 +41,7 @@ void EQ::Net::ServertalkLegacyClient::SendPacket(ServerPacket *p)
void EQ::Net::ServertalkLegacyClient::OnMessage(uint16_t opcode, std::function<void(uint16_t, EQ::Net::Packet&)> cb) void EQ::Net::ServertalkLegacyClient::OnMessage(uint16_t opcode, std::function<void(uint16_t, EQ::Net::Packet&)> cb)
{ {
m_message_callbacks.insert(std::make_pair(opcode, cb)); m_message_callbacks.emplace(std::make_pair(opcode, cb));
} }
void EQ::Net::ServertalkLegacyClient::OnMessage(std::function<void(uint16_t, EQ::Net::Packet&)> cb) void EQ::Net::ServertalkLegacyClient::OnMessage(std::function<void(uint16_t, EQ::Net::Packet&)> cb)
+3 -3
View File
@@ -19,12 +19,12 @@ void EQ::Net::ServertalkServer::Listen(const ServertalkServerOptions& opts)
void EQ::Net::ServertalkServer::OnConnectionIdentified(const std::string &type, std::function<void(std::shared_ptr<ServertalkServerConnection>)> cb) void EQ::Net::ServertalkServer::OnConnectionIdentified(const std::string &type, std::function<void(std::shared_ptr<ServertalkServerConnection>)> cb)
{ {
m_on_ident.insert(std::make_pair(type, cb)); m_on_ident.emplace(std::make_pair(type, cb));
} }
void EQ::Net::ServertalkServer::OnConnectionRemoved(const std::string &type, std::function<void(std::shared_ptr<ServertalkServerConnection>)> cb) void EQ::Net::ServertalkServer::OnConnectionRemoved(const std::string &type, std::function<void(std::shared_ptr<ServertalkServerConnection>)> cb)
{ {
m_on_disc.insert(std::make_pair(type, cb)); m_on_disc.emplace(std::make_pair(type, cb));
} }
void EQ::Net::ServertalkServer::ConnectionDisconnected(ServertalkServerConnection *conn) void EQ::Net::ServertalkServer::ConnectionDisconnected(ServertalkServerConnection *conn)
@@ -75,7 +75,7 @@ void EQ::Net::ServertalkServer::ConnectionIdentified(ServertalkServerConnection
else { else {
std::vector<std::shared_ptr<EQ::Net::ServertalkServerConnection>> vec; std::vector<std::shared_ptr<EQ::Net::ServertalkServerConnection>> vec;
vec.push_back(*iter); vec.push_back(*iter);
m_ident_connections.insert(std::make_pair(conn->GetIdentifier(), vec)); m_ident_connections.emplace(std::make_pair(conn->GetIdentifier(), vec));
} }
m_unident_connections.erase(iter); m_unident_connections.erase(iter);
+1 -1
View File
@@ -100,7 +100,7 @@ void EQ::Net::ServertalkServerConnection::SendPacket(ServerPacket *p)
void EQ::Net::ServertalkServerConnection::OnMessage(uint16_t opcode, std::function<void(uint16_t, EQ::Net::Packet&)> cb) void EQ::Net::ServertalkServerConnection::OnMessage(uint16_t opcode, std::function<void(uint16_t, EQ::Net::Packet&)> cb)
{ {
m_message_callbacks.insert(std::make_pair(opcode, cb)); m_message_callbacks.emplace(std::make_pair(opcode, cb));
} }
void EQ::Net::ServertalkServerConnection::OnMessage(std::function<void(uint16_t, EQ::Net::Packet&)> cb) void EQ::Net::ServertalkServerConnection::OnMessage(std::function<void(uint16_t, EQ::Net::Packet&)> cb)
+5 -5
View File
@@ -64,7 +64,7 @@ void ProcLauncher::Process() {
if(GetExitCodeProcess(cur->second->proc_info.hProcess, &res)) { if(GetExitCodeProcess(cur->second->proc_info.hProcess, &res)) {
//got exit code, see if its still running... //got exit code, see if its still running...
if(res == STILL_ACTIVE) { if(res == STILL_ACTIVE) {
cur++; ++cur;
continue; continue;
} }
//else, it died, handle properly //else, it died, handle properly
@@ -76,7 +76,7 @@ void ProcLauncher::Process() {
//if we get here, the current process died. //if we get here, the current process died.
tmp = cur; tmp = cur;
tmp++; ++tmp;
ProcessTerminated(cur); ProcessTerminated(cur);
cur = tmp; cur = tmp;
} }
@@ -174,7 +174,7 @@ ProcLauncher::ProcRef ProcLauncher::Launch(Spec *&to_launch) {
std::vector<std::string>::iterator cur, end; std::vector<std::string>::iterator cur, end;
cur = it->args.begin(); cur = it->args.begin();
end = it->args.end(); end = it->args.end();
for(; cur != end; cur++) { for(; cur != end; ++cur) {
args += " "; args += " ";
args += *cur; args += *cur;
} }
@@ -306,7 +306,7 @@ void ProcLauncher::TerminateAll(bool final) {
std::map<ProcRef, Spec *>::iterator cur, end; std::map<ProcRef, Spec *>::iterator cur, end;
cur = m_running.begin(); cur = m_running.begin();
end = m_running.end(); end = m_running.end();
for(; cur != end; cur++) { for(; cur != end; ++cur) {
Terminate(cur->first, true); Terminate(cur->first, true);
} }
} else { } else {
@@ -317,7 +317,7 @@ void ProcLauncher::TerminateAll(bool final) {
std::map<ProcRef, Spec *>::iterator cur, end; std::map<ProcRef, Spec *>::iterator cur, end;
cur = running.begin(); cur = running.begin();
end = running.end(); end = running.end();
for(; cur != end; cur++) { for(; cur != end; ++cur) {
Terminate(cur->first, true); Terminate(cur->first, true);
safe_delete(cur->second); safe_delete(cur->second);
} }
+1 -1
View File
@@ -258,7 +258,7 @@ bool EQ::ProfanityManager::clear_database_entries(DBcore *db) {
return true; return true;
} }
bool EQ::ProfanityManager::check_for_existing_entry(std::string profanity) { bool EQ::ProfanityManager::check_for_existing_entry(const std::string& profanity) {
if (profanity.empty()) { if (profanity.empty()) {
return false; return false;
} }
+1 -1
View File
@@ -53,7 +53,7 @@ namespace EQ
private: private:
static bool load_database_entries(DBcore *db); static bool load_database_entries(DBcore *db);
static bool clear_database_entries(DBcore *db); static bool clear_database_entries(DBcore *db);
static bool check_for_existing_entry(std::string profanity); static bool check_for_existing_entry(const std::string& profanity);
}; };
+1 -1
View File
@@ -369,7 +369,7 @@ void RuleManager::_SaveRule(Database *db, RuleType type, uint16 index) {
break; break;
} }
const auto rule_notes = _GetRuleNotes(type, index); const auto& rule_notes = _GetRuleNotes(type, index);
const auto& l = RuleValuesRepository::GetWhere( const auto& l = RuleValuesRepository::GetWhere(
*db, *db,
+1 -1
View File
@@ -294,7 +294,7 @@ void EQ::SayLinkEngine::generate_text()
m_LinkText = "null"; m_LinkText = "null";
} }
std::string EQ::SayLinkEngine::GenerateQuestSaylink(std::string saylink_text, bool silent, std::string link_name) std::string EQ::SayLinkEngine::GenerateQuestSaylink(const std::string& saylink_text, bool silent, const std::string& link_name)
{ {
uint32 saylink_id = 0; uint32 saylink_id = 0;
+1 -1
View File
@@ -101,7 +101,7 @@ namespace EQ
const std::string& LinkBody() { return m_LinkBody; } // contains string format: '<LinkBody>' const std::string& LinkBody() { return m_LinkBody; } // contains string format: '<LinkBody>'
const std::string& LinkText() { return m_LinkText; } // contains string format: '<LinkText>' 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); static std::string GenerateQuestSaylink(const std::string& saylink_text, bool silent, const std::string& link_name);
void Reset(); void Reset();
+3 -3
View File
@@ -658,11 +658,11 @@ typedef pdb_symbol current;
size_t next = 0; size_t next = 0;
size_t delimiter_size = sizeof(kBackwardPathDelimiter) - 1; size_t delimiter_size = sizeof(kBackwardPathDelimiter) - 1;
while ((next = s.find(kBackwardPathDelimiter, last)) != std::string::npos) { while ((next = s.find(kBackwardPathDelimiter, last)) != std::string::npos) {
out.push_back(s.substr(last, next - last)); out.emplace_back(s.substr(last, next - last));
last = next + delimiter_size; last = next + delimiter_size;
} }
if (last <= s.length()) { if (last <= s.length()) {
out.push_back(s.substr(last)); out.emplace_back(s.substr(last));
} }
return out; return out;
} }
@@ -3760,7 +3760,7 @@ private:
continue; continue;
started = true; started = true;
} }
lines.push_back(make_pair(line_idx, line)); lines.emplace_back(make_pair(line_idx, line));
} }
lines.erase( lines.erase(
+1 -1
View File
@@ -76,7 +76,7 @@ std::vector<std::string> Strings::Split(const std::string& s, const std::string&
res.push_back(token); res.push_back(token);
} }
res.push_back(s.substr(pos_start)); res.emplace_back(s.substr(pos_start));
return res; return res;
} }
+2 -2
View File
@@ -219,7 +219,7 @@ std::vector<std::string> join_pair(
std::vector<std::string> output; std::vector<std::string> output;
for (const std::pair<T1, T2> &src_iter: src) { for (const std::pair<T1, T2> &src_iter: src) {
output.push_back( output.emplace_back(
fmt::format( fmt::format(
"{}{}{}{}{}{}{}", "{}{}{}{}{}{}{}",
@@ -253,7 +253,7 @@ std::vector<std::string> join_tuple(
for (const std::tuple<T1, T2, T3, T4> &src_iter: src) { for (const std::tuple<T1, T2, T3, T4> &src_iter: src) {
output.push_back( output.emplace_back(
fmt::format( fmt::format(
"{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
+1 -1
View File
@@ -25,7 +25,7 @@
// Build variables // Build variables
// these get injected during the build pipeline // these get injected during the build pipeline
#define CURRENT_VERSION "22.9.0-dev" // always append -dev to the current version for custom-builds #define CURRENT_VERSION "22.9.1-dev" // always append -dev to the current version for custom-builds
#define LOGIN_VERSION "0.8.0" #define LOGIN_VERSION "0.8.0"
#define COMPILE_DATE __DATE__ #define COMPILE_DATE __DATE__
#define COMPILE_TIME __TIME__ #define COMPILE_TIME __TIME__
+1 -1
View File
@@ -174,7 +174,7 @@ ZoneRepository::Zone *ZoneStore::GetZone(const char *in_zone_name)
return nullptr; return nullptr;
} }
ZoneRepository::Zone *ZoneStore::GetZone(std::string in_zone_name) ZoneRepository::Zone *ZoneStore::GetZone(const std::string& in_zone_name)
{ {
for (auto &z: m_zones) { for (auto &z: m_zones) {
if (z.short_name == in_zone_name) { if (z.short_name == in_zone_name) {
+2 -2
View File
@@ -35,7 +35,7 @@ public:
ZoneRepository::Zone *GetZone(uint32 zone_id, int version = 0); ZoneRepository::Zone *GetZone(uint32 zone_id, int version = 0);
ZoneRepository::Zone *GetZone(const char *in_zone_name); ZoneRepository::Zone *GetZone(const char *in_zone_name);
ZoneRepository::Zone *GetZone(std::string in_zone_name); ZoneRepository::Zone *GetZone(const std::string& in_zone_name);
uint32 GetZoneID(const char *in_zone_name); uint32 GetZoneID(const char *in_zone_name);
uint32 GetZoneID(std::string zone_name); uint32 GetZoneID(std::string zone_name);
std::string GetZoneName(uint32 zone_id); std::string GetZoneName(uint32 zone_id);
@@ -53,7 +53,7 @@ extern ZoneStore zone_store;
* Global helpers * Global helpers
*/ */
inline uint32 ZoneID(const char *in_zone_name) { return zone_store.GetZoneID(in_zone_name); } inline uint32 ZoneID(const char *in_zone_name) { return zone_store.GetZoneID(in_zone_name); }
inline uint32 ZoneID(std::string zone_name) { return zone_store.GetZoneID(zone_name); } inline uint32 ZoneID(const std::string& zone_name) { return zone_store.GetZoneID(zone_name); }
inline const char *ZoneName(uint32 zone_id, bool error_unknown = false) inline const char *ZoneName(uint32 zone_id, bool error_unknown = false)
{ {
return zone_store.GetZoneName( return zone_store.GetZoneName(
+1 -1
View File
@@ -489,7 +489,7 @@ bool Client::VerifyLoginHash(
* @param db_loginserver * @param db_loginserver
*/ */
void Client::DoSuccessfulLogin( void Client::DoSuccessfulLogin(
const std::string in_account_name, const std::string& in_account_name,
int db_account_id, int db_account_id,
const std::string &db_loginserver const std::string &db_loginserver
) )
+1 -1
View File
@@ -175,7 +175,7 @@ public:
const std::string &password_hash const std::string &password_hash
); );
void DoSuccessfulLogin(const std::string in_account_name, int db_account_id, const std::string &db_loginserver); void DoSuccessfulLogin(const std::string& in_account_name, int db_account_id, const std::string &db_loginserver);
void CreateLocalAccount(const std::string &username, const std::string &password); void CreateLocalAccount(const std::string &username, const std::string &password);
void CreateEQEmuAccount(const std::string &in_account_name, const std::string &in_account_password, unsigned int loginserver_account_id); void CreateEQEmuAccount(const std::string &in_account_name, const std::string &in_account_password, unsigned int loginserver_account_id);
+1 -1
View File
@@ -490,7 +490,7 @@ namespace LoginserverWebserver {
token_data.can_write token_data.can_write
); );
server.token_manager->loaded_api_tokens.insert( server.token_manager->loaded_api_tokens.emplace(
std::make_pair( std::make_pair(
token_data.token, token_data.token,
token_data token_data
+2 -2
View File
@@ -71,10 +71,10 @@ public:
inline void AutoLinkAccounts(bool b) { auto_link_accounts = b; } inline void AutoLinkAccounts(bool b) { auto_link_accounts = b; }
inline bool CanAutoLinkAccounts() const { return auto_link_accounts; } inline bool CanAutoLinkAccounts() const { return auto_link_accounts; }
inline void EQEmuLoginServerAddress(std::string v) { eqemu_loginserver_address = v; } inline void EQEmuLoginServerAddress(const std::string& v) { eqemu_loginserver_address = v; }
inline std::string GetEQEmuLoginServerAddress() const { return eqemu_loginserver_address; } inline std::string GetEQEmuLoginServerAddress() const { return eqemu_loginserver_address; }
inline void DefaultLoginServerName(std::string v) { default_loginserver_name = v; } inline void DefaultLoginServerName(const std::string& v) { default_loginserver_name = v; }
inline std::string GetDefaultLoginServerName() const { return default_loginserver_name; } inline std::string GetDefaultLoginServerName() const { return default_loginserver_name; }
inline void UpdateInsecurePasswords(bool b) { update_insecure_passwords = b; } inline void UpdateInsecurePasswords(bool b) { update_insecure_passwords = b; }
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "eqemu-server", "name": "eqemu-server",
"version": "22.9.0", "version": "22.9.1",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/EQEmu/Server.git" "url": "https://github.com/EQEmu/Server.git"
+4 -4
View File
@@ -32,7 +32,7 @@ void ServerToClient45SayLink(std::string& clientSayLink, const std::string& serv
void ServerToClient50SayLink(std::string& clientSayLink, const std::string& serverSayLink); void ServerToClient50SayLink(std::string& clientSayLink, const std::string& serverSayLink);
void ServerToClient55SayLink(std::string& clientSayLink, const std::string& serverSayLink); void ServerToClient55SayLink(std::string& clientSayLink, const std::string& serverSayLink);
ChatChannel::ChatChannel(std::string inName, std::string inOwner, std::string inPassword, bool inPermanent, int inMinimumStatus) : ChatChannel::ChatChannel(const std::string& inName, const std::string& inOwner, const std::string& inPassword, bool inPermanent, int inMinimumStatus) :
m_delete_timer(0) { m_delete_timer(0) {
m_name = inName; m_name = inName;
@@ -137,7 +137,7 @@ ChatChannel *ChatChannelList::CreateChannel(
return new_channel; return new_channel;
} }
ChatChannel* ChatChannelList::FindChannel(std::string Name) { ChatChannel* ChatChannelList::FindChannel(const std::string& Name) {
std::string normalized_name = CapitaliseName(Name); std::string normalized_name = CapitaliseName(Name);
@@ -283,7 +283,7 @@ void ChatChannel::SetPassword(const std::string& in_password) {
} }
} }
void ChatChannel::SetOwner(std::string& in_owner) { void ChatChannel::SetOwner(const std::string& in_owner) {
m_owner = in_owner; m_owner = in_owner;
@@ -784,7 +784,7 @@ bool ChatChannel::HasVoice(std::string inVoiced)
return std::find(std::begin(m_voiced), std::end(m_voiced), inVoiced) != std::end(m_voiced); return std::find(std::begin(m_voiced), std::end(m_voiced), inVoiced) != std::end(m_voiced);
} }
std::string CapitaliseName(std::string inString) { std::string CapitaliseName(const std::string& inString) {
std::string NormalisedName = inString; std::string NormalisedName = inString;
+6 -6
View File
@@ -15,7 +15,7 @@ class ChatChannel {
public: public:
ChatChannel(std::string inName, std::string inOwner, std::string inPassword, bool inPermanent, int inMinimumStatus = 0); ChatChannel(const std::string& inName, const std::string& inOwner, const std::string& inPassword, bool inPermanent, int inMinimumStatus = 0);
~ChatChannel(); ~ChatChannel();
void AddClient(Client *c); void AddClient(Client *c);
@@ -29,7 +29,7 @@ public:
void SetPassword(const std::string& in_password); void SetPassword(const std::string& in_password);
bool IsOwner(const std::string& name) { return (m_owner == name); } bool IsOwner(const std::string& name) { return (m_owner == name); }
const std::string& GetPassword() { return m_password; } const std::string& GetPassword() { return m_password; }
void SetOwner(std::string& inOwner); void SetOwner(const std::string& in_owner);
std::string& GetOwnerName(); std::string& GetOwnerName();
void SetTemporary(); void SetTemporary();
void SetPermanent(); void SetPermanent();
@@ -76,7 +76,7 @@ class ChatChannelList {
public: public:
ChatChannel* CreateChannel(const std::string& name, const std::string& owner, const std::string& password, bool permanent, int minimum_status, bool save_to_database = false); ChatChannel* CreateChannel(const std::string& name, const std::string& owner, const std::string& password, bool permanent, int minimum_status, bool save_to_database = false);
ChatChannel* FindChannel(std::string name); ChatChannel* FindChannel(const std::string& name);
ChatChannel* AddClientToChannel(std::string channel_name, Client* c, bool command_directed = false); ChatChannel* AddClientToChannel(std::string channel_name, Client* c, bool command_directed = false);
ChatChannel* RemoveClientFromChannel(const std::string& in_channel_name, Client* c, bool command_directed = false); ChatChannel* RemoveClientFromChannel(const std::string& in_channel_name, Client* c, bool command_directed = false);
void RemoveChannel(ChatChannel *Channel); void RemoveChannel(ChatChannel *Channel);
@@ -91,8 +91,8 @@ public:
static void AddToFilteredNames(const std::string& name); static void AddToFilteredNames(const std::string& name);
static bool IsOnChannelBlockList(const std::string& channel_name); static bool IsOnChannelBlockList(const std::string& channel_name);
static bool IsOnFilteredNameList(const std::string& channel_name); static bool IsOnFilteredNameList(const std::string& channel_name);
static inline void SetChannelBlockList(std::vector<std::string> new_list) { m_blocked_channel_names = new_list; } static inline void SetChannelBlockList(const std::vector<std::string>& new_list) { m_blocked_channel_names = new_list; }
static inline void SetFilteredNameList(std::vector<std::string> new_list) { m_filtered_names = new_list; } static inline void SetFilteredNameList(const std::vector<std::string>& new_list) { m_filtered_names = new_list; }
private: private:
LinkedList<ChatChannel*> ChatChannels; LinkedList<ChatChannel*> ChatChannels;
@@ -101,6 +101,6 @@ private:
}; };
std::string CapitaliseName(std::string inString); std::string CapitaliseName(const std::string& inString);
#endif #endif
+11 -11
View File
@@ -122,11 +122,11 @@ std::vector<std::string> ParseRecipients(std::string RecipientString) {
if (Comma == std::string::npos) { if (Comma == std::string::npos) {
RecipientList.push_back(RecipientString.substr(CurrentPos)); RecipientList.emplace_back(RecipientString.substr(CurrentPos));
break; break;
} }
RecipientList.push_back(RecipientString.substr(CurrentPos, Comma - CurrentPos)); RecipientList.emplace_back(RecipientString.substr(CurrentPos, Comma - CurrentPos));
CurrentPos = Comma + 2; CurrentPos = Comma + 2;
} }
@@ -348,7 +348,7 @@ static void ProcessMailTo(Client *c, std::string MailMessage) {
} }
} }
static void ProcessMailTo(Client *c, std::string from, std::string subject, std::string message) { static void ProcessMailTo(Client *c, const std::string& from, const std::string& subject, const std::string& message) {
} }
static void ProcessSetMessageStatus(std::string SetMessageCommand) { static void ProcessSetMessageStatus(std::string SetMessageCommand) {
@@ -983,7 +983,7 @@ void Client::SendMailBoxes() {
safe_delete(outapp); safe_delete(outapp);
} }
Client *Clientlist::FindCharacter(std::string CharacterName) { Client *Clientlist::FindCharacter(const std::string& CharacterName) {
std::list<Client*>::iterator Iterator; std::list<Client*>::iterator Iterator;
@@ -1243,7 +1243,7 @@ void Client::LeaveAllChannels(bool send_updated_channel_list, bool command_direc
} }
void Client::ProcessChannelList(std::string Input) { void Client::ProcessChannelList(const std::string& Input) {
if (Input.length() == 0) { if (Input.length() == 0) {
@@ -1521,7 +1521,7 @@ void Client::SendChannelMessageByNumber(std::string Message) {
} }
void Client::SendChannelMessage(std::string ChannelName, std::string Message, Client *Sender) { void Client::SendChannelMessage(const std::string& ChannelName, const std::string& Message, Client *Sender) {
if (!Sender) return; if (!Sender) return;
@@ -1548,7 +1548,7 @@ void Client::SendChannelMessage(std::string ChannelName, std::string Message, Cl
safe_delete(outapp); safe_delete(outapp);
} }
void Client::ToggleAnnounce(std::string State) void Client::ToggleAnnounce(const std::string& State)
{ {
if (State == "") if (State == "")
Announce = !Announce; Announce = !Announce;
@@ -1615,7 +1615,7 @@ void Client::GeneralChannelMessage(const char *Characters) {
} }
void Client::GeneralChannelMessage(std::string Message) { void Client::GeneralChannelMessage(const std::string& Message) {
auto outapp = new EQApplicationPacket(OP_ChannelMessage, Message.length() + 3); auto outapp = new EQApplicationPacket(OP_ChannelMessage, Message.length() + 3);
char *PacketBuffer = (char *)outapp->pBuffer; char *PacketBuffer = (char *)outapp->pBuffer;
@@ -2279,7 +2279,7 @@ void Client::SetConnectionType(char c) {
} }
} }
Client *Clientlist::IsCharacterOnline(std::string CharacterName) { Client *Clientlist::IsCharacterOnline(const std::string& CharacterName) {
// This method is used to determine if the character we are a sending an email to is connected to the mailserver, // This method is used to determine if the character we are a sending an email to is connected to the mailserver,
// so we can send them a new email notification. // so we can send them a new email notification.
@@ -2307,7 +2307,7 @@ Client *Clientlist::IsCharacterOnline(std::string CharacterName) {
return nullptr; return nullptr;
} }
int Client::GetMailBoxNumber(std::string CharacterName) { int Client::GetMailBoxNumber(const std::string& CharacterName) {
for (unsigned int i = 0; i < Characters.size(); i++) for (unsigned int i = 0; i < Characters.size(); i++)
if (Characters[i].Name == CharacterName) if (Characters[i].Name == CharacterName)
@@ -2316,7 +2316,7 @@ int Client::GetMailBoxNumber(std::string CharacterName) {
return -1; return -1;
} }
void Client::SendNotification(int MailBoxNumber, std::string Subject, std::string From, int MessageID) { void Client::SendNotification(int MailBoxNumber, const std::string& Subject, const std::string& From, int MessageID) {
char TimeStamp[100]; char TimeStamp[100];
+8 -8
View File
@@ -98,18 +98,18 @@ public:
void AddToChannelList(ChatChannel *JoinedChannel); void AddToChannelList(ChatChannel *JoinedChannel);
void RemoveFromChannelList(ChatChannel *JoinedChannel); void RemoveFromChannelList(ChatChannel *JoinedChannel);
void SendChannelMessage(std::string Message); void SendChannelMessage(std::string Message);
void SendChannelMessage(std::string ChannelName, std::string Message, Client *Sender); void SendChannelMessage(const std::string& ChannelName, const std::string& Message, Client *Sender);
void SendChannelMessageByNumber(std::string Message); void SendChannelMessageByNumber(std::string Message);
void SendChannelList(); void SendChannelList();
void CloseConnection(); void CloseConnection();
void ToggleAnnounce(std::string State); void ToggleAnnounce(const std::string& State);
bool IsAnnounceOn() { return (Announce == true); } bool IsAnnounceOn() { return (Announce == true); }
void AnnounceJoin(ChatChannel *Channel, Client *c); void AnnounceJoin(ChatChannel *Channel, Client *c);
void AnnounceLeave(ChatChannel *Channel, Client *c); void AnnounceLeave(ChatChannel *Channel, Client *c);
void GeneralChannelMessage(std::string Message); void GeneralChannelMessage(const std::string& Message);
void GeneralChannelMessage(const char *Characters); void GeneralChannelMessage(const char *Characters);
void SetChannelPassword(std::string ChannelPassword); void SetChannelPassword(std::string ChannelPassword);
void ProcessChannelList(std::string CommandString); void ProcessChannelList(const std::string& Input);
void AccountUpdate(); void AccountUpdate();
int ChannelCount(); int ChannelCount();
std::string RemoveDuplicateChannels(std::string& in_channels); std::string RemoveDuplicateChannels(std::string& in_channels);
@@ -139,14 +139,14 @@ public:
inline bool GetForceDisconnect() { return ForceDisconnect; } inline bool GetForceDisconnect() { return ForceDisconnect; }
std::string MailBoxName(); std::string MailBoxName();
int GetMailBoxNumber() { return CurrentMailBox; } int GetMailBoxNumber() { return CurrentMailBox; }
int GetMailBoxNumber(std::string CharacterName); int GetMailBoxNumber(const std::string& CharacterName);
void SetConnectionType(char c); void SetConnectionType(char c);
ConnectionType GetConnectionType() { return TypeOfConnection; } ConnectionType GetConnectionType() { return TypeOfConnection; }
EQ::versions::ClientVersion GetClientVersion() { return ClientVersion_; } EQ::versions::ClientVersion GetClientVersion() { return ClientVersion_; }
inline bool IsMailConnection() { return (TypeOfConnection == ConnectionTypeMail) || (TypeOfConnection == ConnectionTypeCombined); } inline bool IsMailConnection() { return (TypeOfConnection == ConnectionTypeMail) || (TypeOfConnection == ConnectionTypeCombined); }
void SendNotification(int MailBoxNumber, std::string From, std::string Subject, int MessageID); void SendNotification(int MailBoxNumber, const std::string& Subject, const std::string& From, int MessageID);
void ChangeMailBox(int NewMailBox); void ChangeMailBox(int NewMailBox);
inline void SetMailBox(int NewMailBox) { CurrentMailBox = NewMailBox; } inline void SetMailBox(int NewMailBox) { CurrentMailBox = NewMailBox; }
void SendFriends(); void SendFriends();
@@ -184,10 +184,10 @@ public:
Clientlist(int MailPort); Clientlist(int MailPort);
void Process(); void Process();
void CloseAllConnections(); void CloseAllConnections();
Client *FindCharacter(std::string CharacterName); Client *FindCharacter(const std::string& CharacterName);
void CheckForStaleConnectionsAll(); void CheckForStaleConnectionsAll();
void CheckForStaleConnections(Client *c); void CheckForStaleConnections(Client *c);
Client *IsCharacterOnline(std::string CharacterName); Client *IsCharacterOnline(const std::string& CharacterName);
void ProcessOPMailCommand(Client* c, std::string command_string, bool command_directed = false); void ProcessOPMailCommand(Client* c, std::string command_string, bool command_directed = false);
private: private:
+1 -1
View File
@@ -142,7 +142,7 @@ int UCSDatabase::FindAccount(const char *characterName, Client *client)
return accountID; return accountID;
} }
bool UCSDatabase::VerifyMailKey(std::string characterName, int IPAddress, std::string MailKey) bool UCSDatabase::VerifyMailKey(const std::string& characterName, int IPAddress, const std::string& MailKey)
{ {
std::string query = StringFormat( std::string query = StringFormat(
+1 -1
View File
@@ -40,7 +40,7 @@ class UCSDatabase : public Database {
public: public:
int FindAccount(const char *CharacterName, Client *c); int FindAccount(const char *CharacterName, Client *c);
int FindCharacter(const char *CharacterName); int FindCharacter(const char *CharacterName);
bool VerifyMailKey(std::string CharacterName, int IPAddress, std::string MailKey); bool VerifyMailKey(const std::string& characterName, int IPAddress, const std::string& MailKey);
bool GetVariable(const char* varname, char* varvalue, uint16 varvalue_len); bool GetVariable(const char* varname, char* varvalue, uint16 varvalue_len);
bool LoadChatChannels(); bool LoadChatChannels();
void LoadReservedNamesFromDB(); void LoadReservedNamesFromDB();
+1 -1
View File
@@ -43,7 +43,7 @@ extern const ucsconfig *Config;
extern UCSDatabase database; extern UCSDatabase database;
extern DiscordManager discord_manager; extern DiscordManager discord_manager;
void ProcessMailTo(Client *c, std::string from, std::string subject, std::string message); void ProcessMailTo(Client *c, const std::string& from, const std::string& subject, const std::string& message);
void Client45ToServerSayLink(std::string& serverSayLink, const std::string& clientSayLink); void Client45ToServerSayLink(std::string& serverSayLink, const std::string& clientSayLink);
void Client50ToServerSayLink(std::string& serverSayLink, const std::string& clientSayLink); void Client50ToServerSayLink(std::string& serverSayLink, const std::string& clientSayLink);
+1 -1
View File
@@ -82,7 +82,7 @@ void Adventure::RemovePlayer(std::string character_name)
} }
} }
bool Adventure::PlayerExists(std::string character_name) bool Adventure::PlayerExists(const std::string& character_name)
{ {
auto iter = players.begin(); auto iter = players.begin();
while(iter != players.end()) while(iter != players.end())
+1 -1
View File
@@ -71,7 +71,7 @@ public:
bool IsActive(); bool IsActive();
void AddPlayer(std::string character_name, bool add_client_to_instance = true); void AddPlayer(std::string character_name, bool add_client_to_instance = true);
void RemovePlayer(std::string character_name); void RemovePlayer(std::string character_name);
bool PlayerExists(std::string character_name); bool PlayerExists(const std::string& character_name);
bool CreateInstance(); bool CreateInstance();
void IncrementCount(); void IncrementCount();
void IncrementAssassinationCount(); void IncrementAssassinationCount();
+4 -4
View File
@@ -106,7 +106,7 @@ void LauncherLink::ProcessMessage(uint16 opcode, EQ::Net::Packet &p)
cur = result.begin(); cur = result.begin();
end = result.end(); end = result.end();
ZoneState zs; ZoneState zs;
for (; cur != end; cur++) { for (; cur != end; ++cur) {
zs.port = cur->port; zs.port = cur->port;
zs.up = false; zs.up = false;
zs.starts = 0; zs.starts = 0;
@@ -232,7 +232,7 @@ void LauncherLink::BootDynamics(uint8 new_count) {
std::map<std::string, ZoneState>::iterator cur, end; std::map<std::string, ZoneState>::iterator cur, end;
cur = m_states.begin(); cur = m_states.begin();
end = m_states.end(); end = m_states.end();
for (; cur != end; cur++) { for (; cur != end; ++cur) {
StopZone(cur->first.c_str()); StopZone(cur->first.c_str());
} }
} }
@@ -244,7 +244,7 @@ void LauncherLink::BootDynamics(uint8 new_count) {
std::map<std::string, ZoneState>::iterator cur, end; std::map<std::string, ZoneState>::iterator cur, end;
cur = m_states.begin(); cur = m_states.begin();
end = m_states.end(); end = m_states.end();
for (; cur != end; cur++) { for (; cur != end; ++cur) {
if (cur->first.find("dynamic_") == 0) { if (cur->first.find("dynamic_") == 0) {
if (found >= new_count) { if (found >= new_count) {
//this zone exceeds the number of allowed booted zones. //this zone exceeds the number of allowed booted zones.
@@ -266,7 +266,7 @@ void LauncherLink::GetZoneList(std::vector<std::string> &l) {
std::map<std::string, ZoneState>::iterator cur, end; std::map<std::string, ZoneState>::iterator cur, end;
cur = m_states.begin(); cur = m_states.begin();
end = m_states.end(); end = m_states.end();
for (; cur != end; cur++) { for (; cur != end; ++cur) {
l.push_back(cur->first.c_str()); l.push_back(cur->first.c_str());
} }
} }
+1 -1
View File
@@ -52,7 +52,7 @@ LoginServerList::~LoginServerList() {
void LoginServerList::Add(const char* iAddress, uint16 iPort, const char* Account, const char* Password, bool Legacy) void LoginServerList::Add(const char* iAddress, uint16 iPort, const char* Account, const char* Password, bool Legacy)
{ {
auto loginserver = new LoginServer(iAddress, iPort, Account, Password, Legacy); auto loginserver = new LoginServer(iAddress, iPort, Account, Password, Legacy);
m_list.push_back(std::unique_ptr<LoginServer>(loginserver)); m_list.emplace_back(std::unique_ptr<LoginServer>(loginserver));
} }
bool LoginServerList::SendStatus() { bool LoginServerList::SendStatus() {
+1 -1
View File
@@ -21,7 +21,7 @@ void QueryServConnection::AddConnection(std::shared_ptr<EQ::Net::ServertalkServe
//Set handlers //Set handlers
connection->OnMessage(ServerOP_QueryServGeneric, std::bind(&QueryServConnection::HandleGenericMessage, this, std::placeholders::_1, std::placeholders::_2)); connection->OnMessage(ServerOP_QueryServGeneric, std::bind(&QueryServConnection::HandleGenericMessage, this, std::placeholders::_1, std::placeholders::_2));
connection->OnMessage(ServerOP_LFGuildUpdate, std::bind(&QueryServConnection::HandleLFGuildUpdateMessage, this, std::placeholders::_1, std::placeholders::_2)); connection->OnMessage(ServerOP_LFGuildUpdate, std::bind(&QueryServConnection::HandleLFGuildUpdateMessage, this, std::placeholders::_1, std::placeholders::_2));
m_streams.insert(std::make_pair(connection->GetUUID(), connection)); m_streams.emplace(std::make_pair(connection->GetUUID(), connection));
m_keepalive = std::make_unique<EQ::Timer>(1000, true, std::bind(&QueryServConnection::OnKeepAlive, this, std::placeholders::_1)); m_keepalive = std::make_unique<EQ::Timer>(1000, true, std::bind(&QueryServConnection::OnKeepAlive, this, std::placeholders::_1));
} }
+1 -1
View File
@@ -1545,7 +1545,7 @@ bool SharedTaskManager::CanAddPlayer(SharedTask *s, uint32_t character_id, std::
void SharedTaskManager::RecordSharedTaskCompletion(SharedTask *s) void SharedTaskManager::RecordSharedTaskCompletion(SharedTask *s)
{ {
// shared task // shared task
auto t = s->GetDbSharedTask(); auto& t = s->GetDbSharedTask();
auto ct = CompletedSharedTasksRepository::NewEntity(); auto ct = CompletedSharedTasksRepository::NewEntity();
ct.id = t.id; ct.id = t.id;
+2 -2
View File
@@ -123,7 +123,7 @@ void WebInterface::SendEvent(const Json::Value &value)
void WebInterface::AddCall(const std::string &method, WebInterfaceCall call) void WebInterface::AddCall(const std::string &method, WebInterfaceCall call)
{ {
m_calls.insert(std::make_pair(method, call)); m_calls.emplace(std::make_pair(method, call));
} }
void WebInterface::SendResponse(const std::string &id, const Json::Value &response) void WebInterface::SendResponse(const std::string &id, const Json::Value &response)
@@ -146,7 +146,7 @@ WebInterfaceList::~WebInterfaceList()
void WebInterfaceList::AddConnection(std::shared_ptr<EQ::Net::ServertalkServerConnection> connection) void WebInterfaceList::AddConnection(std::shared_ptr<EQ::Net::ServertalkServerConnection> connection)
{ {
m_interfaces.insert(std::make_pair(connection->GetUUID(), std::make_unique<WebInterface>(connection))); m_interfaces.emplace(std::make_pair(connection->GetUUID(), std::make_unique<WebInterface>(connection)));
} }
void WebInterfaceList::RemoveConnection(std::shared_ptr<EQ::Net::ServertalkServerConnection> connection) void WebInterfaceList::RemoveConnection(std::shared_ptr<EQ::Net::ServertalkServerConnection> connection)
+2 -2
View File
@@ -59,8 +59,8 @@ public:
static void LockWorld() { if (_world_config) _world_config->Locked=true; } static void LockWorld() { if (_world_config) _world_config->Locked=true; }
static void UnlockWorld() { if (_world_config) _world_config->Locked=false; } static void UnlockWorld() { if (_world_config) _world_config->Locked=false; }
static void SetWorldAddress(std::string addr) { if (_world_config) _world_config->WorldAddress=addr; } static void SetWorldAddress(const std::string& addr) { if (_world_config) _world_config->WorldAddress=addr; }
static void SetLocalAddress(std::string addr) { if (_world_config) _world_config->LocalAddress=addr; } static void SetLocalAddress(const std::string& addr) { if (_world_config) _world_config->LocalAddress=addr; }
void Dump() const; void Dump() const;
}; };
+1 -1
View File
@@ -64,7 +64,7 @@ void ZSList::ShowUpTime(WorldTCPConnection* con, const char* adminname) {
} }
void ZSList::Add(ZoneServer* zoneserver) { void ZSList::Add(ZoneServer* zoneserver) {
zone_server_list.push_back(std::unique_ptr<ZoneServer>(zoneserver)); zone_server_list.emplace_back(std::unique_ptr<ZoneServer>(zoneserver));
zoneserver->SendGroupIDs(); zoneserver->SendGroupIDs();
} }
+5 -10
View File
@@ -35,7 +35,6 @@ Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
#include "string_ids.h" #include "string_ids.h"
#include "titles.h" #include "titles.h"
#include "zonedb.h" #include "zonedb.h"
#include "../common/zone_store.h"
#include "worldserver.h" #include "worldserver.h"
#include "bot.h" #include "bot.h"
@@ -218,9 +217,6 @@ void Mob::TypesTemporaryPets(uint32 typesid, Mob *targ, const char *name_overrid
int summon_count = 0; int summon_count = 0;
summon_count = pet.count; summon_count = pet.count;
if(summon_count > MAX_SWARM_PETS)
summon_count = MAX_SWARM_PETS;
static const glm::vec2 swarmPetLocations[MAX_SWARM_PETS] = { static const glm::vec2 swarmPetLocations[MAX_SWARM_PETS] = {
glm::vec2(5, 5), glm::vec2(-5, 5), glm::vec2(5, -5), glm::vec2(-5, -5), glm::vec2(5, 5), glm::vec2(-5, 5), glm::vec2(5, -5), glm::vec2(-5, -5),
glm::vec2(10, 10), glm::vec2(-10, 10), glm::vec2(10, -10), glm::vec2(-10, -10), glm::vec2(10, 10), glm::vec2(-10, 10), glm::vec2(10, -10), glm::vec2(-10, -10),
@@ -289,7 +285,7 @@ void Mob::TypesTemporaryPets(uint32 typesid, Mob *targ, const char *name_overrid
delete made_npc; delete made_npc;
} }
void Mob::WakeTheDead(uint16 spell_id, Corpse *corpse_to_use, Mob *target, uint32 duration) { void Mob::WakeTheDead(uint16 spell_id, Corpse *corpse_to_use, Mob *tar, uint32 duration) {
/* /*
SPA 299 Wake The Dead, 'animateDead' should be temp pet, always spawns 1 pet from corpse, max value is duration SPA 299 Wake The Dead, 'animateDead' should be temp pet, always spawns 1 pet from corpse, max value is duration
@@ -453,7 +449,6 @@ void Mob::WakeTheDead(uint16 spell_id, Corpse *corpse_to_use, Mob *target, uint3
break; break;
} }
made_npc->loottable_id = 0;
made_npc->merchanttype = 0; made_npc->merchanttype = 0;
made_npc->d_melee_texture1 = 0; made_npc->d_melee_texture1 = 0;
made_npc->d_melee_texture2 = 0; made_npc->d_melee_texture2 = 0;
@@ -494,8 +489,8 @@ void Mob::WakeTheDead(uint16 spell_id, Corpse *corpse_to_use, Mob *target, uint3
swarm_pet_npc->GetSwarmInfo()->owner_id = GetID(); swarm_pet_npc->GetSwarmInfo()->owner_id = GetID();
//give the pets somebody to "love" //give the pets somebody to "love"
if (target != nullptr) { if (tar != nullptr) {
swarm_pet_npc->AddToHateList(target, 10000, 1000); swarm_pet_npc->AddToHateList(tar, 10000, 1000);
swarm_pet_npc->GetSwarmInfo()->target = 0; swarm_pet_npc->GetSwarmInfo()->target = 0;
} }
@@ -508,8 +503,8 @@ void Mob::WakeTheDead(uint16 spell_id, Corpse *corpse_to_use, Mob *target, uint3
} }
//the target of these swarm pets will take offense to being cast on... //the target of these swarm pets will take offense to being cast on...
if (target != nullptr) if (tar != nullptr)
target->AddToHateList(this, 1, 0); tar->AddToHateList(this, 1, 0);
// The other pointers we make are handled elsewhere. // The other pointers we make are handled elsewhere.
delete made_npc; delete made_npc;
-1
View File
@@ -23,7 +23,6 @@
#include "../common/spdat.h" #include "../common/spdat.h"
#include "client.h" #include "client.h"
#include "corpse.h"
#include "entity.h" #include "entity.h"
#include "mob.h" #include "mob.h"
-2
View File
@@ -22,12 +22,10 @@
#include "../common/net/websocket_server.h" #include "../common/net/websocket_server.h"
#include "../common/eqemu_logsys.h" #include "../common/eqemu_logsys.h"
#include "zonedb.h" #include "zonedb.h"
#include "../common/zone_store.h"
#include "client.h" #include "client.h"
#include "entity.h" #include "entity.h"
#include "corpse.h" #include "corpse.h"
#include "api_service.h" #include "api_service.h"
#include "npc.h"
#include "object.h" #include "object.h"
#include "zone.h" #include "zone.h"
#include "doors.h" #include "doors.h"
+23 -15
View File
@@ -20,7 +20,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "../common/eq_constants.h" #include "../common/eq_constants.h"
#include "../common/eq_packet_structs.h" #include "../common/eq_packet_structs.h"
#include "../common/rulesys.h" #include "../common/rulesys.h"
#include "../common/skills.h"
#include "../common/spdat.h" #include "../common/spdat.h"
#include "../common/strings.h" #include "../common/strings.h"
#include "../common/data_verification.h" #include "../common/data_verification.h"
@@ -37,8 +36,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "mob.h" #include "mob.h"
#include "npc.h" #include "npc.h"
#include <stdlib.h>
#include "bot.h" #include "bot.h"
extern QueryServ* QServ; extern QueryServ* QServ;
@@ -104,21 +101,17 @@ EQ::skills::SkillType Mob::AttackAnimation(int Hand, const EQ::ItemInstance* wea
} }
else if (IsNPC()) { else if (IsNPC()) {
switch (skillinuse) { switch (skillinuse) {
case EQ::skills::Skill1HBlunt: // 1H Blunt
case EQ::skills::Skill1HSlashing: // 1H Slashing case EQ::skills::Skill1HSlashing: // 1H Slashing
type = anim1HWeapon; type = anim1HWeapon;
break; break;
case EQ::skills::Skill2HBlunt: // 2H Blunt
case EQ::skills::Skill2HSlashing: // 2H Slashing case EQ::skills::Skill2HSlashing: // 2H Slashing
type = anim2HSlashing; type = anim2HSlashing;
break; break;
case EQ::skills::Skill1HPiercing: // Piercing case EQ::skills::Skill1HPiercing: // Piercing
type = anim1HPiercing; type = anim1HPiercing;
break; break;
case EQ::skills::Skill1HBlunt: // 1H Blunt
type = anim1HWeapon;
break;
case EQ::skills::Skill2HBlunt: // 2H Blunt
type = anim2HSlashing; //anim2HWeapon
break;
case EQ::skills::Skill2HPiercing: // 2H Piercing case EQ::skills::Skill2HPiercing: // 2H Piercing
type = anim2HWeapon; type = anim2HWeapon;
break; break;
@@ -4308,7 +4301,6 @@ void Mob::CommonDamage(Mob* attacker, int64 &damage, const uint16 spell_id, cons
attacker->CastToClient()->QueuePacket(outapp, true, CLIENT_CONNECTED, filter); attacker->CastToClient()->QueuePacket(outapp, true, CLIENT_CONNECTED, filter);
} }
} }
skip = attacker;
} }
//send damage to all clients around except the specified skip mob (attacker or the attacker's owner) and ourself //send damage to all clients around except the specified skip mob (attacker or the attacker's owner) and ourself
@@ -5706,8 +5698,14 @@ void Mob::TryCastOnSkillUse(Mob *on, EQ::skills::SkillType skill) {
if (spellbonuses.HasSkillAttackProc[skill]) { if (spellbonuses.HasSkillAttackProc[skill]) {
for (int i = 0; i < MAX_CAST_ON_SKILL_USE; i += 3) { for (int i = 0; i < MAX_CAST_ON_SKILL_USE; i += 3) {
if (spellbonuses.SkillAttackProc[i + SBIndex::SKILLATK_PROC_SPELL_ID] && skill == spellbonuses.SkillAttackProc[i + SBIndex::SKILLATK_PROC_SKILL]) { if (
if (IsValidSpell(spellbonuses.SkillAttackProc[i + SBIndex::SKILLATK_PROC_SPELL_ID]) && zone->random.Int(1, 1000) <= spellbonuses.SkillAttackProc[i + SBIndex::SKILLATK_PROC_CHANCE]) { spellbonuses.SkillAttackProc[i + SBIndex::SKILLATK_PROC_SPELL_ID] &&
skill == spellbonuses.SkillAttackProc[i + SBIndex::SKILLATK_PROC_SKILL]
) {
if (
IsValidSpell(spellbonuses.SkillAttackProc[i + SBIndex::SKILLATK_PROC_SPELL_ID]) &&
zone->random.Int(1, 1000) <= spellbonuses.SkillAttackProc[i + SBIndex::SKILLATK_PROC_CHANCE]
) {
SpellFinished(spellbonuses.SkillAttackProc[i + SBIndex::SKILLATK_PROC_SPELL_ID], on, EQ::spells::CastingSlot::Item, 0, -1, spells[spellbonuses.SkillAttackProc[i + SBIndex::SKILLATK_PROC_SPELL_ID]].resist_difficulty); SpellFinished(spellbonuses.SkillAttackProc[i + SBIndex::SKILLATK_PROC_SPELL_ID], on, EQ::spells::CastingSlot::Item, 0, -1, spells[spellbonuses.SkillAttackProc[i + SBIndex::SKILLATK_PROC_SPELL_ID]].resist_difficulty);
} }
} }
@@ -5716,8 +5714,14 @@ void Mob::TryCastOnSkillUse(Mob *on, EQ::skills::SkillType skill) {
if (itembonuses.HasSkillAttackProc[skill]) { if (itembonuses.HasSkillAttackProc[skill]) {
for (int i = 0; i < MAX_CAST_ON_SKILL_USE; i += 3) { for (int i = 0; i < MAX_CAST_ON_SKILL_USE; i += 3) {
if (itembonuses.SkillAttackProc[i + SBIndex::SKILLATK_PROC_SPELL_ID] && skill == itembonuses.SkillAttackProc[i + SBIndex::SKILLATK_PROC_SKILL]) { if (
if (IsValidSpell(itembonuses.SkillAttackProc[i + SBIndex::SKILLATK_PROC_SPELL_ID]) && zone->random.Int(1, 1000) <= spellbonuses.SkillAttackProc[i + SBIndex::SKILLATK_PROC_CHANCE]) { itembonuses.SkillAttackProc[i + SBIndex::SKILLATK_PROC_SPELL_ID] &&
skill == itembonuses.SkillAttackProc[i + SBIndex::SKILLATK_PROC_SKILL]
) {
if (
IsValidSpell(itembonuses.SkillAttackProc[i + SBIndex::SKILLATK_PROC_SPELL_ID]) &&
zone->random.Int(1, 1000) <= itembonuses.SkillAttackProc[i + SBIndex::SKILLATK_PROC_CHANCE]
) {
SpellFinished(itembonuses.SkillAttackProc[i + SBIndex::SKILLATK_PROC_SPELL_ID], on, EQ::spells::CastingSlot::Item, 0, -1, spells[itembonuses.SkillAttackProc[i + SBIndex::SKILLATK_PROC_SPELL_ID]].resist_difficulty); SpellFinished(itembonuses.SkillAttackProc[i + SBIndex::SKILLATK_PROC_SPELL_ID], on, EQ::spells::CastingSlot::Item, 0, -1, spells[itembonuses.SkillAttackProc[i + SBIndex::SKILLATK_PROC_SPELL_ID]].resist_difficulty);
} }
} }
@@ -5726,7 +5730,11 @@ void Mob::TryCastOnSkillUse(Mob *on, EQ::skills::SkillType skill) {
if (aabonuses.HasSkillAttackProc[skill]) { if (aabonuses.HasSkillAttackProc[skill]) {
for (int i = 0; i < MAX_CAST_ON_SKILL_USE; i += 3) { for (int i = 0; i < MAX_CAST_ON_SKILL_USE; i += 3) {
if (IsValidSpell(aabonuses.SkillAttackProc[i + SBIndex::SKILLATK_PROC_SPELL_ID]) && aabonuses.SkillAttackProc[i + SBIndex::SKILLATK_PROC_SPELL_ID] && skill == aabonuses.SkillAttackProc[i + SBIndex::SKILLATK_PROC_SKILL]) { if (
IsValidSpell(aabonuses.SkillAttackProc[i + SBIndex::SKILLATK_PROC_SPELL_ID]) &&
aabonuses.SkillAttackProc[i + SBIndex::SKILLATK_PROC_SPELL_ID] &&
skill == aabonuses.SkillAttackProc[i + SBIndex::SKILLATK_PROC_SKILL]
) {
if (zone->random.Int(1, 1000) <= aabonuses.SkillAttackProc[i + SBIndex::SKILLATK_PROC_CHANCE]) { if (zone->random.Int(1, 1000) <= aabonuses.SkillAttackProc[i + SBIndex::SKILLATK_PROC_CHANCE]) {
SpellFinished(aabonuses.SkillAttackProc[i + SBIndex::SKILLATK_PROC_SPELL_ID], on, EQ::spells::CastingSlot::Item, 0, -1, spells[aabonuses.SkillAttackProc[i + SBIndex::SKILLATK_PROC_SPELL_ID]].resist_difficulty); SpellFinished(aabonuses.SkillAttackProc[i + SBIndex::SKILLATK_PROC_SPELL_ID], on, EQ::spells::CastingSlot::Item, 0, -1, spells[aabonuses.SkillAttackProc[i + SBIndex::SKILLATK_PROC_SPELL_ID]].resist_difficulty);
} }
+36 -26
View File
@@ -20,7 +20,6 @@
#include "../common/global_define.h" #include "../common/global_define.h"
#include "../common/item_instance.h" #include "../common/item_instance.h"
#include "../common/rulesys.h" #include "../common/rulesys.h"
#include "../common/skills.h"
#include "../common/spdat.h" #include "../common/spdat.h"
#include "client.h" #include "client.h"
@@ -1506,12 +1505,14 @@ void Mob::ApplyAABonuses(const AA::Rank &rank, StatBonuses *newbon)
case SE_SpellEffectResistChance: { case SE_SpellEffectResistChance: {
for (int e = 0; e < MAX_RESISTABLE_EFFECTS * 2; e += 2) { for (int e = 0; e < MAX_RESISTABLE_EFFECTS * 2; e += 2) {
if (newbon->SEResist[e + 1] && (newbon->SEResist[e] == limit_value) && if (
(newbon->SEResist[e + 1] < base_value)) { !newbon->SEResist[e + 1] ||
newbon->SEResist[e] = limit_value; // Spell Effect ID (
newbon->SEResist[e + 1] = base_value; // Resist Chance newbon->SEResist[e + 1] &&
break; newbon->SEResist[e] == limit_value &&
} else if (!newbon->SEResist[e + 1]) { newbon->SEResist[e + 1] < base_value
)
) {
newbon->SEResist[e] = limit_value; // Spell Effect ID newbon->SEResist[e] = limit_value; // Spell Effect ID
newbon->SEResist[e + 1] = base_value; // Resist Chance newbon->SEResist[e + 1] = base_value; // Resist Chance
break; break;
@@ -3493,14 +3494,16 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses *ne
{ {
for(int e = 0; e < MAX_RESISTABLE_EFFECTS*2; e+=2) for(int e = 0; e < MAX_RESISTABLE_EFFECTS*2; e+=2)
{ {
if(new_bonus->SEResist[e+1] && (new_bonus->SEResist[e] == limit_value) && (new_bonus->SEResist[e+1] < effect_value)){ if (
!new_bonus->SEResist[e + 1] ||
(
new_bonus->SEResist[e + 1] &&
new_bonus->SEResist[e] == limit_value &&
new_bonus->SEResist[e + 1] < effect_value
)
) {
new_bonus->SEResist[e] = limit_value; //Spell Effect ID new_bonus->SEResist[e] = limit_value; //Spell Effect ID
new_bonus->SEResist[e+1] = effect_value; //Resist Chance new_bonus->SEResist[e + 1] = effect_value; //Resist Chance
break;
}
else if (!new_bonus->SEResist[e+1]){
new_bonus->SEResist[e] = limit_value; //Spell Effect ID
new_bonus->SEResist[e+1] = effect_value; //Resist Chance
break; break;
} }
} }
@@ -5044,20 +5047,27 @@ void Mob::NegateSpellEffectBonuses(uint16 spell_id)
case SE_ProcOnKillShot: case SE_ProcOnKillShot:
{ {
for (int e = 0; e < MAX_SPELL_TRIGGER * 3; e = 3) for (int e = 0; e < MAX_SPELL_TRIGGER * 3; e += 3)
{ {
if (negate_spellbonus) { spellbonuses.SpellOnKill[e] = effect_value; } if (negate_spellbonus) {
if (negate_spellbonus) { spellbonuses.SpellOnKill[e + 1] = effect_value; } spellbonuses.SpellOnKill[e] = effect_value;
if (negate_spellbonus) { spellbonuses.SpellOnKill[e + 2] = effect_value; } spellbonuses.SpellOnKill[e + 1] = effect_value;
spellbonuses.SpellOnKill[e + 2] = effect_value;
if (negate_aabonus) { aabonuses.SpellOnKill[e] = effect_value; }
if (negate_aabonus) { aabonuses.SpellOnKill[e + 1] = effect_value; }
if (negate_aabonus) { aabonuses.SpellOnKill[e + 2] = effect_value; }
if (negate_itembonus) { itembonuses.SpellOnKill[e] = effect_value; }
if (negate_itembonus) { itembonuses.SpellOnKill[e + 1] = effect_value; }
if (negate_itembonus) { itembonuses.SpellOnKill[e + 2] = effect_value; }
} }
if (negate_aabonus) {
aabonuses.SpellOnKill[e] = effect_value;
aabonuses.SpellOnKill[e + 1] = effect_value;
aabonuses.SpellOnKill[e + 2] = effect_value;
}
if (negate_itembonus) {
itembonuses.SpellOnKill[e] = effect_value;
itembonuses.SpellOnKill[e + 1] = effect_value;
itembonuses.SpellOnKill[e + 2] = effect_value;
}
}
break; break;
} }
+20 -19
View File
@@ -22,8 +22,6 @@
#include "doors.h" #include "doors.h"
#include "quest_parser_collection.h" #include "quest_parser_collection.h"
#include "lua_parser.h" #include "lua_parser.h"
#include "../common/strings.h"
#include "../common/say_link.h"
#include "../common/repositories/bot_spell_settings_repository.h" #include "../common/repositories/bot_spell_settings_repository.h"
#include "../common/data_verification.h" #include "../common/data_verification.h"
@@ -1186,9 +1184,9 @@ int32 Bot::GenerateBaseHitPoints() {
if (GetOwner() && GetOwner()->CastToClient() && GetOwner()->CastToClient()->ClientVersion() >= EQ::versions::ClientVersion::SoD && RuleB(Character, SoDClientUseSoDHPManaEnd)) { if (GetOwner() && GetOwner()->CastToClient() && GetOwner()->CastToClient()->ClientVersion() >= EQ::versions::ClientVersion::SoD && RuleB(Character, SoDClientUseSoDHPManaEnd)) {
float SoDPost255; float SoDPost255;
if (((NormalSTA - 255) / 2) > 0) if (((NormalSTA - 255) / 2) > 0)
SoDPost255 = ((NormalSTA - 255) / 2); SoDPost255 = ((static_cast<float>(NormalSTA) - 255.0f) / 2.0f);
else else
SoDPost255 = 0; SoDPost255 = 0.0f;
int hp_factor = GetClassHPFactor(); int hp_factor = GetClassHPFactor();
@@ -3147,8 +3145,7 @@ void Bot::SetOwnerTarget(Client* bot_owner) {
AddToHateList(attack_target, 1); AddToHateList(attack_target, 1);
SetTarget(attack_target); SetTarget(attack_target);
SetAttackingFlag(); SetAttackingFlag();
if (HasPet() && (GetClass() != ENCHANTER || GetPet()->GetPetType() != petAnimation || GetAA(aaAnimationEmpathy) >= 2)) { if (GetPet() && (GetClass() != ENCHANTER || GetPet()->GetPetType() != petAnimation || GetAA(aaAnimationEmpathy) >= 2)) {
GetPet()->WipeHateList(); GetPet()->WipeHateList();
GetPet()->AddToHateList(attack_target, 1); GetPet()->AddToHateList(attack_target, 1);
GetPet()->SetTarget(attack_target); GetPet()->SetTarget(attack_target);
@@ -4405,6 +4402,10 @@ void Bot::PerformTradeWithClient(int16 begin_slot_id, int16 end_slot_id, Client*
for (auto& trade_iterator : client_trade) { for (auto& trade_iterator : client_trade) {
// TODO: code for stackables // TODO: code for stackables
if (!trade_iterator.trade_item_instance) {
continue;
}
if (!database.botdb.SaveItemBySlot(this, trade_iterator.to_bot_slot, trade_iterator.trade_item_instance)) { if (!database.botdb.SaveItemBySlot(this, trade_iterator.to_bot_slot, trade_iterator.trade_item_instance)) {
OwnerMessage( OwnerMessage(
fmt::format( fmt::format(
@@ -4532,8 +4533,10 @@ bool Bot::Death(Mob *killerMob, int64 damage, uint16 spell_id, EQ::skills::Skill
give_exp_client = give_exp->CastToClient(); give_exp_client = give_exp->CastToClient();
bool IsLdonTreasure = (GetClass() == LDON_TREASURE); bool IsLdonTreasure = (GetClass() == LDON_TREASURE);
if (entity_list.GetCorpseByID(GetID())) const auto c = entity_list.GetCorpseByID(GetID());
entity_list.GetCorpseByID(GetID())->Depop(); if (c) {
c->Depop();
}
if (HasRaid()) { if (HasRaid()) {
if (auto raid = entity_list.GetRaidByBotName(GetName()); raid) { if (auto raid = entity_list.GetRaidByBotName(GetName()); raid) {
@@ -4587,9 +4590,8 @@ bool Bot::Death(Mob *killerMob, int64 damage, uint16 spell_id, EQ::skills::Skill
GroupJoin_Struct* gu = (GroupJoin_Struct*) outapp->pBuffer; GroupJoin_Struct* gu = (GroupJoin_Struct*) outapp->pBuffer;
gu->action = groupActLeave; gu->action = groupActLeave;
strcpy(gu->membername, GetCleanName()); strcpy(gu->membername, GetCleanName());
if (g) {
for (int k = 0; k < MAX_GROUP_MEMBERS; k++) { for (int k = 0; k < MAX_GROUP_MEMBERS; k++) {
if (g->members[k] && g->members[k]->IsClient()) if (g->members[k] && g->members[k]->IsClient()) {
g->members[k]->CastToClient()->QueuePacket(outapp); g->members[k]->CastToClient()->QueuePacket(outapp);
} }
} }
@@ -5142,12 +5144,12 @@ void Bot::DoClassAttacks(Mob *target, bool IsRiposte) {
float HasteModifier = (GetHaste() * 0.01f); float HasteModifier = (GetHaste() * 0.01f);
uint16 skill_to_use = -1; uint16 skill_to_use = -1;
int level = GetLevel(); int bot_level = GetLevel();
int reuse = (TauntReuseTime * 1000); int reuse = (TauntReuseTime * 1000);
bool did_attack = false; bool did_attack = false;
switch (GetClass()) { switch (GetClass()) {
case WARRIOR: case WARRIOR:
if (level >= RuleI(Combat, NPCBashKickLevel)) { if (bot_level >= RuleI(Combat, NPCBashKickLevel)) {
bool canBash = false; bool canBash = false;
if ((GetRace() == OGRE || GetRace() == TROLL || GetRace() == BARBARIAN) || (m_inv.GetItem(EQ::invslot::slotSecondary) && m_inv.GetItem(EQ::invslot::slotSecondary)->GetItem()->ItemType == EQ::item::ItemTypeShield) || (m_inv.GetItem(EQ::invslot::slotPrimary) && m_inv.GetItem(EQ::invslot::slotPrimary)->GetItem()->IsType2HWeapon() && GetAA(aa2HandBash) >= 1)) if ((GetRace() == OGRE || GetRace() == TROLL || GetRace() == BARBARIAN) || (m_inv.GetItem(EQ::invslot::slotSecondary) && m_inv.GetItem(EQ::invslot::slotSecondary)->GetItem()->ItemType == EQ::item::ItemTypeShield) || (m_inv.GetItem(EQ::invslot::slotPrimary) && m_inv.GetItem(EQ::invslot::slotPrimary)->GetItem()->IsType2HWeapon() && GetAA(aa2HandBash) >= 1))
canBash = true; canBash = true;
@@ -5167,7 +5169,7 @@ void Bot::DoClassAttacks(Mob *target, bool IsRiposte) {
case CLERIC: case CLERIC:
case SHADOWKNIGHT: case SHADOWKNIGHT:
case PALADIN: case PALADIN:
if (level >= RuleI(Combat, NPCBashKickLevel)) { if (bot_level >= RuleI(Combat, NPCBashKickLevel)) {
if ((GetRace() == OGRE || GetRace() == TROLL || GetRace() == BARBARIAN) || (m_inv.GetItem(EQ::invslot::slotSecondary) && m_inv.GetItem(EQ::invslot::slotSecondary)->GetItem()->ItemType == EQ::item::ItemTypeShield) || (m_inv.GetItem(EQ::invslot::slotPrimary) && m_inv.GetItem(EQ::invslot::slotPrimary)->GetItem()->IsType2HWeapon() && GetAA(aa2HandBash) >= 1)) if ((GetRace() == OGRE || GetRace() == TROLL || GetRace() == BARBARIAN) || (m_inv.GetItem(EQ::invslot::slotSecondary) && m_inv.GetItem(EQ::invslot::slotSecondary)->GetItem()->ItemType == EQ::item::ItemTypeShield) || (m_inv.GetItem(EQ::invslot::slotPrimary) && m_inv.GetItem(EQ::invslot::slotPrimary)->GetItem()->IsType2HWeapon() && GetAA(aa2HandBash) >= 1))
skill_to_use = EQ::skills::SkillBash; skill_to_use = EQ::skills::SkillBash;
} }
@@ -5195,9 +5197,6 @@ void Bot::DoClassAttacks(Mob *target, bool IsRiposte) {
break; break;
} }
if (skill_to_use == -1)
return;
int64 dmg = GetBaseSkillDamage(static_cast<EQ::skills::SkillType>(skill_to_use), GetTarget()); int64 dmg = GetBaseSkillDamage(static_cast<EQ::skills::SkillType>(skill_to_use), GetTarget());
if (skill_to_use == EQ::skills::SkillBash) { if (skill_to_use == EQ::skills::SkillBash) {
@@ -6830,8 +6829,11 @@ Bot* Bot::GetBotByBotClientOwnerAndBotName(Client* c, const std::string& botName
void Bot::ProcessBotGroupInvite(Client* c, std::string const& botName) { void Bot::ProcessBotGroupInvite(Client* c, std::string const& botName) {
if (c && !c->HasRaid()) { if (c && !c->HasRaid()) {
Bot* invitedBot = GetBotByBotClientOwnerAndBotName(c, botName); Bot* invitedBot = GetBotByBotClientOwnerAndBotName(c, botName);
if (!invitedBot) {
return;
}
if (invitedBot && !invitedBot->HasGroup() && !invitedBot->HasRaid()) { if (!invitedBot->HasGroup() && !invitedBot->HasRaid()) {
if (!c->IsGrouped()) { if (!c->IsGrouped()) {
auto g = new Group(c); auto g = new Group(c);
if (AddBotToGroup(invitedBot, g)) { if (AddBotToGroup(invitedBot, g)) {
@@ -7162,8 +7164,7 @@ bool EntityList::Bot_AICheckCloseBeneficialSpells(Bot* caster, uint8 iChance, fl
} }
if (caster->IsRaidGrouped()) { if (caster->IsRaidGrouped()) {
if (auto raid = entity_list.GetRaidByBotName(caster->GetName())) { if (auto raid = entity_list.GetRaidByBotName(caster->GetName())) {
uint32 gid = RAID_GROUPLESS; uint32 gid = raid->GetGroup(caster->GetName());
gid = raid->GetGroup(caster->GetName());
if (gid < MAX_RAID_GROUPS) { if (gid < MAX_RAID_GROUPS) {
std::vector<RaidMember> raid_group_members = raid->GetRaidGroupMembers(gid); std::vector<RaidMember> raid_group_members = raid->GetRaidGroupMembers(gid);
for (std::vector<RaidMember>::iterator iter = raid_group_members.begin(); for (std::vector<RaidMember>::iterator iter = raid_group_members.begin();
+1 -10
View File
@@ -34,10 +34,8 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <sstream>
#include <algorithm> #include <algorithm>
#include <ctime> #include <ctime>
#include <thread>
#ifdef _WINDOWS #ifdef _WINDOWS
#define strcasecmp _stricmp #define strcasecmp _stricmp
@@ -47,21 +45,14 @@
#include "../common/global_define.h" #include "../common/global_define.h"
#include "../common/eq_packet.h" #include "../common/eq_packet.h"
#include "../common/features.h" #include "../common/features.h"
#include "../common/guilds.h"
#include "../common/patches/patches.h"
#include "../common/ptimer.h" #include "../common/ptimer.h"
#include "../common/rulesys.h" #include "../common/rulesys.h"
#include "../common/serverinfo.h" #include "../common/serverinfo.h"
#include "../common/strings.h" #include "../common/strings.h"
#include "../common/say_link.h" #include "../common/say_link.h"
#include "../common/eqemu_logsys.h"
#include "../common/emu_constants.h"
#include "bot_command.h" #include "bot_command.h"
#include "zonedb.h" #include "zonedb.h"
#include "../common/zone_store.h"
#include "guild_mgr.h"
#include "map.h" #include "map.h"
#include "doors.h" #include "doors.h"
#include "qglobals.h" #include "qglobals.h"
@@ -1490,7 +1481,7 @@ int bot_command_init(void)
auto bcs_iter = bot_command_settings.find(working_bcl_iter.first); auto bcs_iter = bot_command_settings.find(working_bcl_iter.first);
if (bcs_iter == bot_command_settings.end()) { if (bcs_iter == bot_command_settings.end()) {
injected_bot_command_settings.push_back(std::pair<std::string, uint8>(working_bcl_iter.first, working_bcl_iter.second->access)); injected_bot_command_settings.emplace_back(std::pair<std::string, uint8>(working_bcl_iter.first, working_bcl_iter.second->access));
LogInfo( LogInfo(
"New Bot Command [{}] found... Adding to `bot_command_settings` table with access [{}]", "New Bot Command [{}] found... Adding to `bot_command_settings` table with access [{}]",
working_bcl_iter.first.c_str(), working_bcl_iter.first.c_str(),
+1 -2
View File
@@ -26,7 +26,6 @@
#include "../common/repositories/bot_inventories_repository.h" #include "../common/repositories/bot_inventories_repository.h"
#include "zonedb.h" #include "zonedb.h"
#include "../common/zone_store.h"
#include "bot.h" #include "bot.h"
#include "client.h" #include "client.h"
@@ -1174,7 +1173,7 @@ bool BotDatabase::LoadItemSlots(const uint32 bot_id, std::map<uint16, uint32>& m
if (!l.empty()) { if (!l.empty()) {
for (const auto& e : l) { for (const auto& e : l) {
m.insert(std::pair<uint16, uint32>(e.slot_id, e.item_id)); m.emplace(std::pair<uint16, uint32>(e.slot_id, e.item_id));
} }
} }
+37 -54
View File
@@ -18,7 +18,6 @@
#include "bot.h" #include "bot.h"
#include "../common/data_verification.h" #include "../common/data_verification.h"
#include "../common/strings.h"
#include "../common/repositories/bot_spells_entries_repository.h" #include "../common/repositories/bot_spells_entries_repository.h"
#include "../common/repositories/npc_spells_repository.h" #include "../common/repositories/npc_spells_repository.h"
@@ -84,18 +83,15 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint32 iSpellTypes) {
return BotCastDebuff(tar, botLevel, botSpell, checked_los); return BotCastDebuff(tar, botLevel, botSpell, checked_los);
case SpellType_Cure: case SpellType_Cure:
return BotCastCure(tar, botClass, botSpell, raid); return BotCastCure(tar, botClass, botSpell, raid);
case SpellType_Resurrect:
return false;
case SpellType_HateRedux: case SpellType_HateRedux:
return BotCastHateReduction(tar, botLevel, botSpell); return BotCastHateReduction(tar, botLevel, botSpell);
case SpellType_InCombatBuffSong: case SpellType_InCombatBuffSong:
return BotCastCombatSong(tar, botLevel); return BotCastCombatSong(tar, botLevel);
case SpellType_OutOfCombatBuffSong: case SpellType_OutOfCombatBuffSong:
return BotCastSong(tar, botLevel); return BotCastSong(tar, botLevel);
case SpellType_Resurrect:
case SpellType_PreCombatBuff: case SpellType_PreCombatBuff:
return false;
case SpellType_PreCombatBuffSong: case SpellType_PreCombatBuffSong:
return false;
default: default:
return false; return false;
} }
@@ -243,7 +239,7 @@ bool Bot::BotCastCure(Mob* tar, uint8 botClass, BotSpell& botSpell, Raid* raid)
uint32 r_group = raid->GetGroup(GetName()); uint32 r_group = raid->GetGroup(GetName());
if (r_group) { if (r_group) {
std::vector<RaidMember> raid_group_members = raid->GetRaidGroupMembers(r_group); std::vector<RaidMember> raid_group_members = raid->GetRaidGroupMembers(r_group);
for (auto iter: raid_group_members) { for (auto& iter: raid_group_members) {
if ( if (
iter.member && iter.member &&
!iter.member->qglobal && !iter.member->qglobal &&
@@ -1007,7 +1003,7 @@ bool Bot::BotCastHeal(Mob* tar, uint8 botLevel, uint8 botClass, BotSpell& botSpe
isPrimaryHealer = IsGroupHealer(); isPrimaryHealer = IsGroupHealer();
} }
if (hpr < 95 || (tar->IsClient() && (hpr < 95)) || (botClass == BARD)) { if (hpr < 95 || tar->IsClient() || botClass == BARD) {
if (tar->GetClass() == NECROMANCER && hpr >= 40) { if (tar->GetClass() == NECROMANCER && hpr >= 40) {
return false; return false;
} }
@@ -1025,7 +1021,7 @@ bool Bot::BotCastHeal(Mob* tar, uint8 botLevel, uint8 botClass, BotSpell& botSpe
if (hpr < 35) { if (hpr < 35) {
botSpell = GetBestBotSpellForFastHeal(this); botSpell = GetBestBotSpellForFastHeal(this);
} }
else if (hpr >= 35 && hpr < 70) { else if (hpr < 70) {
if (GetNumberNeedingHealedInGroup(60, false, raid) >= 3) { if (GetNumberNeedingHealedInGroup(60, false, raid) >= 3) {
botSpell = GetBestBotSpellForGroupHeal(this); botSpell = GetBestBotSpellForGroupHeal(this);
} }
@@ -1034,7 +1030,7 @@ bool Bot::BotCastHeal(Mob* tar, uint8 botLevel, uint8 botClass, BotSpell& botSpe
botSpell = GetBestBotSpellForPercentageHeal(this); botSpell = GetBestBotSpellForPercentageHeal(this);
} }
} }
else if (hpr >= 70 && hpr < 95) { else if (hpr < 95) {
if (GetNumberNeedingHealedInGroup(80, false, raid) >= 3) { if (GetNumberNeedingHealedInGroup(80, false, raid) >= 3) {
botSpell = GetBestBotSpellForGroupHealOverTime(this); botSpell = GetBestBotSpellForGroupHealOverTime(this);
} }
@@ -1079,7 +1075,7 @@ bool Bot::BotCastHeal(Mob* tar, uint8 botLevel, uint8 botClass, BotSpell& botSpe
else if (hpr < 40) { else if (hpr < 40) {
botSpell = GetBestBotSpellForPercentageHeal(this); botSpell = GetBestBotSpellForPercentageHeal(this);
} }
else if (hpr >= 40 && hpr < 75) { else if (hpr < 75) {
botSpell = GetBestBotSpellForRegularSingleTargetHeal(this); botSpell = GetBestBotSpellForRegularSingleTargetHeal(this);
} }
else { else {
@@ -2673,7 +2669,7 @@ BotSpell Bot::GetDebuffBotSpell(Bot* botCaster, Mob *tar) {
if (!tar || !botCaster) if (!tar || !botCaster)
return result; return result;
if (botCaster && botCaster->AI_HasSpells()) { if (botCaster->AI_HasSpells()) {
std::vector<BotSpells_Struct> botSpellList = botCaster->AIBot_spells; std::vector<BotSpells_Struct> botSpellList = botCaster->AIBot_spells;
for (int i = botSpellList.size() - 1; i >= 0; i--) { for (int i = botSpellList.size() - 1; i >= 0; i--) {
@@ -2997,9 +2993,9 @@ uint8 Bot::GetChanceToCastBySpellType(uint32 spellType)
spell_type_index = spellTypeIndexPreCombatBuffSong; spell_type_index = spellTypeIndexPreCombatBuffSong;
break; break;
default: default:
spell_type_index = SPELL_TYPE_COUNT;
break; break;
} }
if (spell_type_index >= SPELL_TYPE_COUNT) if (spell_type_index >= SPELL_TYPE_COUNT)
return 0; return 0;
@@ -3054,7 +3050,6 @@ bool Bot::AI_AddBotSpells(uint32 bot_spell_id) {
GetLevel() GetLevel()
); );
if (spell_list) {
debug_msg.append( debug_msg.append(
fmt::format( fmt::format(
" (found, {})", " (found, {})",
@@ -3063,15 +3058,9 @@ bool Bot::AI_AddBotSpells(uint32 bot_spell_id) {
); );
LogAI("[{}]", debug_msg); LogAI("[{}]", debug_msg);
for (const auto &iter : spell_list->entries) { for (const auto &iter: spell_list->entries) {
LogAIDetail("([{}]) [{}]", iter.spellid, spells[iter.spellid].name); LogAIDetail("([{}]) [{}]", iter.spellid, spells[iter.spellid].name);
} }
}
else
{
debug_msg.append(" (not found)");
LogAI("[{}]", debug_msg);
}
LogAI("fin (spell list)"); LogAI("fin (spell list)");
@@ -3186,20 +3175,14 @@ bool Bot::AI_AddBotSpells(uint32 bot_spell_id) {
} }
} }
if (spell_list->attack_proc >= 0) {
attack_proc_spell = spell_list->attack_proc; attack_proc_spell = spell_list->attack_proc;
proc_chance = spell_list->proc_chance; proc_chance = spell_list->proc_chance;
}
if (spell_list->range_proc >= 0) {
range_proc_spell = spell_list->range_proc; range_proc_spell = spell_list->range_proc;
rproc_chance = spell_list->rproc_chance; rproc_chance = spell_list->rproc_chance;
}
if (spell_list->defensive_proc >= 0) {
defensive_proc_spell = spell_list->defensive_proc; defensive_proc_spell = spell_list->defensive_proc;
dproc_chance = spell_list->dproc_chance; dproc_chance = spell_list->dproc_chance;
}
//If any casting variables are defined in the current list, ignore those in the parent list. //If any casting variables are defined in the current list, ignore those in the parent list.
if ( if (
@@ -3434,7 +3417,7 @@ DBbotspells_Struct* ZoneDatabase::GetBotSpells(uint32 bot_spell_id)
} }
} }
bot_spells_cache.insert(std::make_pair(bot_spell_id, spell_set)); bot_spells_cache.emplace(std::make_pair(bot_spell_id, spell_set));
return &bot_spells_cache[bot_spell_id]; return &bot_spells_cache[bot_spell_id];
} }
@@ -3444,41 +3427,41 @@ DBbotspells_Struct* ZoneDatabase::GetBotSpells(uint32 bot_spell_id)
// adds a spell to the list, taking into account priority and resorting list as needed. // adds a spell to the list, taking into account priority and resorting list as needed.
void Bot::AddSpellToBotList( void Bot::AddSpellToBotList(
int16 iPriority, int16 in_priority,
uint16 iSpellID, uint16 in_spell_id,
uint32 iType, uint32 in_type,
int16 iManaCost, int16 in_mana_cost,
int32 iRecastDelay, int32 in_recast_delay,
int16 iResistAdjust, int16 in_resist_adjust,
uint8 min_level, uint8 in_min_level,
uint8 max_level, uint8 in_max_level,
int8 min_hp, int8 in_min_hp,
int8 max_hp, int8 in_max_hp,
std::string bucket_name, std::string in_bucket_name,
std::string bucket_value, std::string in_bucket_value,
uint8 bucket_comparison uint8 in_bucket_comparison
) { ) {
if (!IsValidSpell(iSpellID)) { if (!IsValidSpell(in_spell_id)) {
return; return;
} }
HasAISpell = true; HasAISpell = true;
BotSpells_Struct t; BotSpells_Struct t;
t.priority = iPriority; t.priority = in_priority;
t.spellid = iSpellID; t.spellid = in_spell_id;
t.type = iType; t.type = in_type;
t.manacost = iManaCost; t.manacost = in_mana_cost;
t.recast_delay = iRecastDelay; t.recast_delay = in_recast_delay;
t.time_cancast = 0; t.time_cancast = 0;
t.resist_adjust = iResistAdjust; t.resist_adjust = in_resist_adjust;
t.minlevel = min_level; t.minlevel = in_min_level;
t.maxlevel = maxlevel; t.maxlevel = in_max_level;
t.min_hp = min_hp; t.min_hp = in_min_hp;
t.max_hp = max_hp; t.max_hp = in_max_hp;
t.bucket_name = bucket_name; t.bucket_name = in_bucket_name;
t.bucket_value = bucket_value; t.bucket_value = in_bucket_value;
t.bucket_comparison = bucket_comparison; t.bucket_comparison = in_bucket_comparison;
AIBot_spells.push_back(t); AIBot_spells.push_back(t);
+2 -5
View File
@@ -46,7 +46,6 @@ extern volatile bool RunLoops;
#include "position.h" #include "position.h"
#include "worldserver.h" #include "worldserver.h"
#include "zonedb.h" #include "zonedb.h"
#include "../common/zone_store.h"
#include "petitions.h" #include "petitions.h"
#include "command.h" #include "command.h"
#include "water_map.h" #include "water_map.h"
@@ -57,8 +56,6 @@ extern volatile bool RunLoops;
#include "quest_parser_collection.h" #include "quest_parser_collection.h"
#include "queryserv.h" #include "queryserv.h"
#include "mob_movement_manager.h" #include "mob_movement_manager.h"
#include "../common/content/world_content_service.h"
#include "../common/expedition_lockout_timer.h"
#include "cheat_manager.h" #include "cheat_manager.h"
#include "../common/repositories/bug_reports_repository.h" #include "../common/repositories/bug_reports_repository.h"
@@ -8183,7 +8180,7 @@ void Client::TryItemTimer(int slot)
continue; continue;
} }
auto item_timers = a_inst->GetTimers(); auto& item_timers = a_inst->GetTimers();
auto it_iter = item_timers.begin(); auto it_iter = item_timers.begin();
while(it_iter != item_timers.end()) { while(it_iter != item_timers.end()) {
if(it_iter->second.Check()) { if(it_iter->second.Check()) {
@@ -9987,7 +9984,7 @@ void Client::SendDzCompassUpdate()
for (const auto& client_dz : GetDynamicZones()) for (const auto& client_dz : GetDynamicZones())
{ {
auto compass = client_dz->GetCompassLocation(); auto& compass = client_dz->GetCompassLocation();
if (zone && zone->IsZone(compass.zone_id, 0)) if (zone && zone->IsZone(compass.zone_id, 0))
{ {
DynamicZoneCompassEntry_Struct entry{}; DynamicZoneCompassEntry_Struct entry{};
-2
View File
@@ -22,8 +22,6 @@
#include "../common/rulesys.h" #include "../common/rulesys.h"
#include "../common/spdat.h" #include "../common/spdat.h"
#include "../common/data_verification.h"
#include "client.h" #include "client.h"
#include "mob.h" #include "mob.h"
+5 -19
View File
@@ -26,7 +26,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include <string.h> #include <string.h>
#include <zlib.h> #include <zlib.h>
#include "bot.h" #include "bot.h"
#include "bot_command.h"
#ifdef _WINDOWS #ifdef _WINDOWS
#define snprintf _snprintf #define snprintf _snprintf
@@ -39,23 +38,14 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include <unistd.h> #include <unistd.h>
#endif #endif
#include "../common/crc32.h"
#include "../common/data_verification.h" #include "../common/data_verification.h"
#include "../common/faction.h"
#include "../common/guilds.h"
#include "../common/rdtsc.h" #include "../common/rdtsc.h"
#include "../common/rulesys.h"
#include "../common/skills.h"
#include "../common/spdat.h"
#include "../common/strings.h"
#include "data_bucket.h" #include "data_bucket.h"
#include "event_codes.h" #include "event_codes.h"
#include "expedition.h" #include "expedition.h"
#include "expedition_database.h"
#include "guild_mgr.h" #include "guild_mgr.h"
#include "merc.h" #include "merc.h"
#include "petitions.h" #include "petitions.h"
#include "pets.h"
#include "queryserv.h" #include "queryserv.h"
#include "quest_parser_collection.h" #include "quest_parser_collection.h"
#include "string_ids.h" #include "string_ids.h"
@@ -71,7 +61,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "client.h" #include "client.h"
#include "../common/repositories/account_repository.h" #include "../common/repositories/account_repository.h"
#include "bot.h"
#include "../common/events/player_event_logs.h" #include "../common/events/player_event_logs.h"
extern QueryServ* QServ; extern QueryServ* QServ;
@@ -1731,7 +1720,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app)
auto dz = zone->GetDynamicZone(); auto dz = zone->GetDynamicZone();
if (dz && dz->GetSafeReturnLocation().zone_id != 0) if (dz && dz->GetSafeReturnLocation().zone_id != 0)
{ {
auto safereturn = dz->GetSafeReturnLocation(); auto& safereturn = dz->GetSafeReturnLocation();
auto safereturn_entry = CharacterInstanceSafereturnsRepository::NewEntity(); auto safereturn_entry = CharacterInstanceSafereturnsRepository::NewEntity();
safereturn_entry.character_id = CharacterID(); safereturn_entry.character_id = CharacterID();
@@ -5377,7 +5366,7 @@ void Client::Handle_OP_CorpseDrag(const EQApplicationPacket *app)
if (!corpse->CastToCorpse()->Summon(this, false, true)) if (!corpse->CastToCorpse()->Summon(this, false, true))
return; return;
DraggedCorpses.push_back(std::pair<std::string, uint16>(cds->CorpseName, corpse->GetID())); DraggedCorpses.emplace_back(std::pair<std::string, uint16>(cds->CorpseName, corpse->GetID()));
MessageString(Chat::DefaultText, CORPSEDRAG_BEGIN, cds->CorpseName); MessageString(Chat::DefaultText, CORPSEDRAG_BEGIN, cds->CorpseName);
} }
@@ -11771,17 +11760,14 @@ void Client::Handle_OP_RaidCommand(const EQApplicationPacket* app)
{ {
case RaidCommandInviteIntoExisting: case RaidCommandInviteIntoExisting:
case RaidCommandInvite: { case RaidCommandInvite: {
Bot* player_to_invite = nullptr;
if (RuleB(Bots, Enabled) && entity_list.GetBotByBotName(raid_command_packet->player_name)) { if (RuleB(Bots, Enabled) && entity_list.GetBotByBotName(raid_command_packet->player_name)) {
auto player_to_invite = entity_list.GetBotByBotName(raid_command_packet->player_name);
if (!player_to_invite) { if (!player_to_invite) {
break; break;
} }
Bot* player_to_invite = entity_list.GetBotByBotName(raid_command_packet->player_name); auto player_to_invite_group = player_to_invite->GetGroup();
Group* player_to_invite_group = player_to_invite->GetGroup();
if (player_to_invite_group && player_to_invite_group->IsGroupMember(this)) { if (player_to_invite_group && player_to_invite_group->IsGroupMember(this)) {
MessageString(Chat::Red, ALREADY_IN_PARTY); MessageString(Chat::Red, ALREADY_IN_PARTY);
break; break;
-5
View File
@@ -22,12 +22,8 @@
#include "../common/eqemu_logsys.h" #include "../common/eqemu_logsys.h"
#include "../common/global_define.h" #include "../common/global_define.h"
#include <iostream> #include <iostream>
#include <stdio.h>
#include <zlib.h>
#ifdef _WINDOWS #ifdef _WINDOWS
#include <winsock2.h>
#include <windows.h>
#define snprintf _snprintf #define snprintf _snprintf
#define strncasecmp _strnicmp #define strncasecmp _strnicmp
#define strcasecmp _stricmp #define strcasecmp _stricmp
@@ -54,7 +50,6 @@
#include "worldserver.h" #include "worldserver.h"
#include "zone.h" #include "zone.h"
#include "zonedb.h" #include "zonedb.h"
#include "../common/zone_store.h"
#include "../common/events/player_event_logs.h" #include "../common/events/player_event_logs.h"
extern QueryServ* QServ; extern QueryServ* QServ;
+1 -1
View File
@@ -2,7 +2,7 @@
#include "../common/eqemu_logsys.h" #include "../common/eqemu_logsys.h"
#include "../common/strings.h" #include "../common/strings.h"
void CombatRecord::Start(std::string in_mob_name) void CombatRecord::Start(const std::string& in_mob_name)
{ {
m_start_time = std::time(nullptr); m_start_time = std::time(nullptr);
m_end_time = 0; m_end_time = 0;
+1 -1
View File
@@ -7,7 +7,7 @@
class CombatRecord { class CombatRecord {
public: public:
void Start(std::string in_mob_name); void Start(const std::string& in_mob_name);
void Stop(); void Stop();
bool InCombat() const; bool InCombat() const;
void ProcessHPEvent(int64 hp, int64 current_hp); void ProcessHPEvent(int64 hp, int64 current_hp);
+1 -7
View File
@@ -1,9 +1,6 @@
#include <string.h> #include <string.h>
#include <stdlib.h>
#include <sstream>
#include <algorithm> #include <algorithm>
#include <ctime>
#include <thread> #include <thread>
#include <fmt/format.h> #include <fmt/format.h>
@@ -26,8 +23,6 @@
#include "command.h" #include "command.h"
#include "dynamic_zone.h" #include "dynamic_zone.h"
#include "expedition.h" #include "expedition.h"
#include "guild_mgr.h"
#include "qglobals.h"
#include "queryserv.h" #include "queryserv.h"
#include "quest_parser_collection.h" #include "quest_parser_collection.h"
#include "titles.h" #include "titles.h"
@@ -401,7 +396,7 @@ int command_init(void)
for (const auto& w : working_cl) { for (const auto& w : working_cl) {
auto cs = command_settings.find(w.first); auto cs = command_settings.find(w.first);
if (cs == command_settings.end()) { if (cs == command_settings.end()) {
injected_command_settings.push_back(std::pair<std::string, uint8>(w.first, w.second->admin)); injected_command_settings.emplace_back(std::pair<std::string, uint8>(w.first, w.second->admin));
LogInfo( LogInfo(
"New Command [{}] found... Adding to `command_settings` table with admin [{}]...", "New Command [{}] found... Adding to `command_settings` table with admin [{}]...",
w.first, w.first,
@@ -971,7 +966,6 @@ void command_bot(Client *c, const Seperator *sep)
#include "gm_commands/doanim.cpp" #include "gm_commands/doanim.cpp"
#include "gm_commands/door.cpp" #include "gm_commands/door.cpp"
#include "gm_commands/door_manipulation.cpp" #include "gm_commands/door_manipulation.cpp"
#include "gm_commands/door_manipulation.h"
#include "gm_commands/dye.cpp" #include "gm_commands/dye.cpp"
#include "gm_commands/dz.cpp" #include "gm_commands/dz.cpp"
#include "gm_commands/dzkickplayers.cpp" #include "gm_commands/dzkickplayers.cpp"
+1 -1
View File
@@ -749,7 +749,7 @@ bool Corpse::Save() {
e.ornamentidfile = item->ornamentidfile; e.ornamentidfile = item->ornamentidfile;
e.ornament_hero_model = item->ornament_hero_model; e.ornament_hero_model = item->ornament_hero_model;
ce.items.push_back(std::move(e)); ce.items.emplace_back(std::move(e));
} }
/* Create New Corpse*/ /* Create New Corpse*/
-4
View File
@@ -1,11 +1,7 @@
#include "data_bucket.h" #include "data_bucket.h"
#include <utility>
#include "../common/strings.h"
#include "zonedb.h" #include "zonedb.h"
#include "../common/zone_store.h"
#include <ctime> #include <ctime>
#include <cctype> #include <cctype>
#include <algorithm>
/** /**
* Persists data via bucket_name as key * Persists data via bucket_name as key
+1 -2
View File
@@ -1,7 +1,6 @@
#include <regex> #include <regex>
#include "dialogue_window.h" #include "dialogue_window.h"
#include "../common/strings.h"
void DialogueWindow::Render(Client *c, std::string markdown) void DialogueWindow::Render(Client *c, std::string markdown)
{ {
@@ -285,7 +284,7 @@ void DialogueWindow::Render(Client *c, std::string markdown)
size_t link_open = bracket_message.find('\x12'); size_t link_open = bracket_message.find('\x12');
size_t link_close = bracket_message.find_last_of('\x12'); size_t link_close = bracket_message.find_last_of('\x12');
if (link_open != link_close && (bracket_message.length() - link_open) > EQ::constants::SAY_LINK_BODY_SIZE) { if (link_open != link_close && (bracket_message.length() - link_open) > EQ::constants::SAY_LINK_BODY_SIZE) {
replacements.insert( replacements.emplace(
std::pair<std::string, std::string>( std::pair<std::string, std::string>(
bracket_message, bracket_message,
bracket_message.substr(EQ::constants::SAY_LINK_BODY_SIZE + 1) bracket_message.substr(EQ::constants::SAY_LINK_BODY_SIZE + 1)
-2
View File
@@ -30,10 +30,8 @@
#include "string_ids.h" #include "string_ids.h"
#include "worldserver.h" #include "worldserver.h"
#include "zonedb.h" #include "zonedb.h"
#include "../common/zone_store.h"
#include "../common/repositories/criteria/content_filter_criteria.h" #include "../common/repositories/criteria/content_filter_criteria.h"
#include <iostream>
#include <string.h> #include <string.h>
#define OPEN_DOOR 0x02 #define OPEN_DOOR 0x02
-1
View File
@@ -23,7 +23,6 @@
#include "expedition.h" #include "expedition.h"
#include "string_ids.h" #include "string_ids.h"
#include "worldserver.h" #include "worldserver.h"
#include "../common/eqemu_logsys.h"
extern WorldServer worldserver; extern WorldServer worldserver;
-1
View File
@@ -28,7 +28,6 @@
#include "string_ids.h" #include "string_ids.h"
#include "worldserver.h" #include "worldserver.h"
#include "zonedb.h" #include "zonedb.h"
#include "../common/zone_store.h"
#include "position.h" #include "position.h"
float Mob::GetActSpellRange(uint16 spell_id, float range) float Mob::GetActSpellRange(uint16 spell_id, float range)
-1
View File
@@ -24,7 +24,6 @@
#include "../common/global_define.h" #include "../common/global_define.h"
#include "../common/misc_functions.h" #include "../common/misc_functions.h"
#include "../common/eqemu_logsys.h"
#include "dialogue_window.h" #include "dialogue_window.h"
#include "embperl.h" #include "embperl.h"
+3 -7
View File
@@ -12,13 +12,9 @@ Eglin
#include "../common/global_define.h" #include "../common/global_define.h"
#include "../common/eqemu_logsys.h" #include "../common/eqemu_logsys.h"
#include <cstdio>
#include <cstdarg>
#include <vector> #include <vector>
#include "embperl.h" #include "embperl.h"
#include "embxs.h"
#include "../common/features.h" #include "../common/features.h"
#include "../common/path_manager.h"
#include "../common/process/process.h" #include "../common/process/process.h"
#include "../common/file.h" #include "../common/file.h"
#include "../common/timer.h" #include "../common/timer.h"
@@ -102,7 +98,7 @@ void Embperl::DoInit() {
try { try {
init_eval_file(); init_eval_file();
} }
catch(std::string e) catch(std::string& e)
{ {
//remember... lasterr() is no good if we crap out here, in construction //remember... lasterr() is no good if we crap out here, in construction
LogQuests("Perl Error [{}]", e); LogQuests("Perl Error [{}]", e);
@@ -142,7 +138,7 @@ void Embperl::DoInit() {
perl_command = "main::eval_file('plugin', '" + Config->PluginPlFile + "');"; perl_command = "main::eval_file('plugin', '" + Config->PluginPlFile + "');";
eval_pv(perl_command.c_str(), FALSE); eval_pv(perl_command.c_str(), FALSE);
} }
catch(std::string e) catch(std::string& e)
{ {
LogQuests("Warning [{}]: [{}]", Config->PluginPlFile, e); LogQuests("Warning [{}]: [{}]", Config->PluginPlFile, e);
} }
@@ -160,7 +156,7 @@ void Embperl::DoInit() {
"}"; "}";
eval_pv(perl_command.c_str(),FALSE); eval_pv(perl_command.c_str(),FALSE);
} }
catch(std::string e) catch(std::string& e)
{ {
LogQuests("Warning [{}]", e); LogQuests("Warning [{}]", e);
} }
-1
View File
@@ -24,7 +24,6 @@
#include "embperl.h" #include "embperl.h"
#include "masterentity.h" #include "masterentity.h"
#include "command.h" #include "command.h"
#include "bot_command.h"
const char *getItemName(unsigned itemid) const char *getItemName(unsigned itemid)
{ {
+13 -16
View File
@@ -17,14 +17,12 @@
*/ */
#include "../common/data_verification.h" #include "../common/data_verification.h"
#include "../common/global_define.h" #include "../common/global_define.h"
#include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
#include <string.h> #include <string.h>
#include <iostream> #include <iostream>
#ifdef _WINDOWS #ifdef _WINDOWS
#include <process.h>
#else #else
#include <pthread.h> #include <pthread.h>
#include "../common/unix.h" #include "../common/unix.h"
@@ -43,7 +41,6 @@
#include "worldserver.h" #include "worldserver.h"
#include "water_map.h" #include "water_map.h"
#include "npc_scale_manager.h" #include "npc_scale_manager.h"
#include "../common/say_link.h"
#include "dialogue_window.h" #include "dialogue_window.h"
#ifdef _WINDOWS #ifdef _WINDOWS
@@ -332,8 +329,8 @@ bool EntityList::CanAddHateForMob(Mob *p)
void EntityList::AddClient(Client *client) void EntityList::AddClient(Client *client)
{ {
client->SetID(GetFreeID()); client->SetID(GetFreeID());
client_list.insert(std::pair<uint16, Client *>(client->GetID(), client)); client_list.emplace(std::pair<uint16, Client *>(client->GetID(), client));
mob_list.insert(std::pair<uint16, Mob *>(client->GetID(), client)); mob_list.emplace(std::pair<uint16, Mob *>(client->GetID(), client));
} }
@@ -655,7 +652,7 @@ void EntityList::AddCorpse(Corpse *corpse, uint32 in_id)
corpse->SetID(in_id); corpse->SetID(in_id);
corpse->CalcCorpseName(); corpse->CalcCorpseName();
corpse_list.insert(std::pair<uint16, Corpse *>(corpse->GetID(), corpse)); corpse_list.emplace(std::pair<uint16, Corpse *>(corpse->GetID(), corpse));
if (!corpse_timer.Enabled()) if (!corpse_timer.Enabled())
corpse_timer.Start(); corpse_timer.Start();
@@ -674,8 +671,8 @@ void EntityList::AddNPC(NPC *npc, bool send_spawn_packet, bool dont_queue)
} }
} }
npc_list.insert(std::pair<uint16, NPC *>(npc->GetID(), npc)); npc_list.emplace(std::pair<uint16, NPC *>(npc->GetID(), npc));
mob_list.insert(std::pair<uint16, Mob *>(npc->GetID(), npc)); mob_list.emplace(std::pair<uint16, Mob *>(npc->GetID(), npc));
if (parse->HasQuestSub(npc->GetNPCTypeID(), EVENT_SPAWN)) { if (parse->HasQuestSub(npc->GetNPCTypeID(), EVENT_SPAWN)) {
parse->EventNPC(EVENT_SPAWN, npc, nullptr, "", 0); parse->EventNPC(EVENT_SPAWN, npc, nullptr, "", 0);
@@ -755,8 +752,8 @@ void EntityList::AddMerc(Merc *merc, bool SendSpawnPacket, bool dontqueue)
} }
} }
merc_list.insert(std::pair<uint16, Merc *>(merc->GetID(), merc)); merc_list.emplace(std::pair<uint16, Merc *>(merc->GetID(), merc));
mob_list.insert(std::pair<uint16, Mob *>(merc->GetID(), merc)); mob_list.emplace(std::pair<uint16, Mob *>(merc->GetID(), merc));
} }
} }
@@ -773,7 +770,7 @@ void EntityList::AddObject(Object *obj, bool SendSpawnPacket)
QueueClients(0, &app,false); QueueClients(0, &app,false);
} }
object_list.insert(std::pair<uint16, Object *>(obj->GetID(), obj)); object_list.emplace(std::pair<uint16, Object *>(obj->GetID(), obj));
if (!object_timer.Enabled()) if (!object_timer.Enabled())
object_timer.Start(); object_timer.Start();
@@ -782,7 +779,7 @@ void EntityList::AddObject(Object *obj, bool SendSpawnPacket)
void EntityList::AddDoor(Doors *door) void EntityList::AddDoor(Doors *door)
{ {
door->SetEntityID(GetFreeID()); door->SetEntityID(GetFreeID());
door_list.insert(std::pair<uint16, Doors *>(door->GetEntityID(), door)); door_list.emplace(std::pair<uint16, Doors *>(door->GetEntityID(), door));
if (!door_timer.Enabled()) if (!door_timer.Enabled())
door_timer.Start(); door_timer.Start();
@@ -791,7 +788,7 @@ void EntityList::AddDoor(Doors *door)
void EntityList::AddTrap(Trap *trap) void EntityList::AddTrap(Trap *trap)
{ {
trap->SetID(GetFreeID()); trap->SetID(GetFreeID());
trap_list.insert(std::pair<uint16, Trap *>(trap->GetID(), trap)); trap_list.emplace(std::pair<uint16, Trap *>(trap->GetID(), trap));
if (!trap_timer.Enabled()) if (!trap_timer.Enabled())
trap_timer.Start(); trap_timer.Start();
} }
@@ -799,13 +796,13 @@ void EntityList::AddTrap(Trap *trap)
void EntityList::AddBeacon(Beacon *beacon) void EntityList::AddBeacon(Beacon *beacon)
{ {
beacon->SetID(GetFreeID()); beacon->SetID(GetFreeID());
beacon_list.insert(std::pair<uint16, Beacon *>(beacon->GetID(), beacon)); beacon_list.emplace(std::pair<uint16, Beacon *>(beacon->GetID(), beacon));
} }
void EntityList::AddEncounter(Encounter *encounter) void EntityList::AddEncounter(Encounter *encounter)
{ {
encounter->SetID(GetFreeID()); encounter->SetID(GetFreeID());
encounter_list.insert(std::pair<uint16, Encounter *>(encounter->GetID(), encounter)); encounter_list.emplace(std::pair<uint16, Encounter *>(encounter->GetID(), encounter));
} }
void EntityList::AddToSpawnQueue(uint16 entityid, NewSpawn_Struct **ns) void EntityList::AddToSpawnQueue(uint16 entityid, NewSpawn_Struct **ns)
@@ -2987,7 +2984,7 @@ void EntityList::ScanCloseMobs(
float distance = DistanceSquared(scanning_mob->GetPosition(), mob->GetPosition()); float distance = DistanceSquared(scanning_mob->GetPosition(), mob->GetPosition());
if (distance <= scan_range || mob->GetAggroRange() >= scan_range) { if (distance <= scan_range || mob->GetAggroRange() >= scan_range) {
close_mobs.insert(std::pair<uint16, Mob *>(mob->GetID(), mob)); close_mobs.emplace(std::pair<uint16, Mob *>(mob->GetID(), mob));
if (add_self_to_other_lists && scanning_mob->GetID() > 0) { if (add_self_to_other_lists && scanning_mob->GetID() > 0) {
bool has_mob = false; bool has_mob = false;
-3
View File
@@ -25,9 +25,6 @@
#include "string_ids.h" #include "string_ids.h"
#include "worldserver.h" #include "worldserver.h"
#include "zonedb.h" #include "zonedb.h"
#include "../common/eqemu_logsys.h"
#include "../common/expedition_lockout_timer.h"
#include "../common/repositories/dynamic_zone_members_repository.h"
#include "../common/repositories/expedition_lockouts_repository.h" #include "../common/repositories/expedition_lockouts_repository.h"
extern WorldServer worldserver; extern WorldServer worldserver;
-3
View File
@@ -21,9 +21,6 @@
#include "expedition_database.h" #include "expedition_database.h"
#include "expedition.h" #include "expedition.h"
#include "zonedb.h" #include "zonedb.h"
#include "../common/database.h"
#include "../common/expedition_lockout_timer.h"
#include "../common/strings.h"
#include <fmt/core.h> #include <fmt/core.h>
uint32_t ExpeditionDatabase::InsertExpedition(uint32_t dz_id) uint32_t ExpeditionDatabase::InsertExpedition(uint32_t dz_id)
-2
View File
@@ -24,9 +24,7 @@
#include "groups.h" #include "groups.h"
#include "raids.h" #include "raids.h"
#include "string_ids.h" #include "string_ids.h"
#include "../common/expedition_lockout_timer.h"
#include "../common/repositories/character_expedition_lockouts_repository.h" #include "../common/repositories/character_expedition_lockouts_repository.h"
#include "../common/repositories/expeditions_repository.h"
constexpr char SystemName[] = "expedition"; constexpr char SystemName[] = "expedition";
-3
View File
@@ -30,15 +30,12 @@
#include "titles.h" #include "titles.h"
#include "water_map.h" #include "water_map.h"
#include "zonedb.h" #include "zonedb.h"
#include "../common/zone_store.h"
#include "../common/repositories/criteria/content_filter_criteria.h" #include "../common/repositories/criteria/content_filter_criteria.h"
#include "../common/events/player_event_logs.h" #include "../common/events/player_event_logs.h"
#include "worldserver.h" #include "worldserver.h"
extern WorldServer worldserver; extern WorldServer worldserver;
#include <iostream>
#ifdef _WINDOWS #ifdef _WINDOWS
#define snprintf _snprintf #define snprintf _snprintf
#endif #endif
+1 -1
View File
@@ -32,7 +32,7 @@ void command_dye(Client *c, const Seperator *sep)
c->Message(Chat::White, "Red, Green, and Blue go from 0 to 255."); c->Message(Chat::White, "Red, Green, and Blue go from 0 to 255.");
for (const auto &slot : dye_slots) { for (const auto &slot : dye_slots) {
slot_messages.push_back(fmt::format("({}) {}", slot_id, slot)); slot_messages.emplace_back(fmt::format("({}) {}", slot_id, slot));
slot_id++; slot_id++;
} }
+1 -1
View File
@@ -56,7 +56,7 @@ void command_mysql(Client *c, const Seperator *sep)
row_index < results.ColumnCount(); row_index < results.ColumnCount();
row_index++ row_index++
) { ) {
lines.push_back( lines.emplace_back(
fmt::format( fmt::format(
"{} | {} ", "{} | {} ",
results.FieldName(row_index), results.FieldName(row_index),
+1 -1
View File
@@ -35,7 +35,7 @@ void command_set_adventure_points(Client *c, const Seperator *sep)
auto theme_id = Strings::ToUnsignedInt(sep->arg[1]); auto theme_id = Strings::ToUnsignedInt(sep->arg[1]);
if (!EQ::ValueWithin(theme_id, LDoNThemes::Unused, LDoNThemes::TAK)) { if (!EQ::ValueWithin(theme_id, LDoNThemes::Unused, LDoNThemes::TAK)) {
c->Message(Chat::White, "Valid themes are as follows."); c->Message(Chat::White, "Valid themes are as follows.");
auto theme_map = EQ::constants::GetLDoNThemeMap(); auto& theme_map = EQ::constants::GetLDoNThemeMap();
for (const auto& theme : theme_map) { for (const auto& theme : theme_map) {
c->Message( c->Message(
Chat::White, Chat::White,
+1 -1
View File
@@ -16,7 +16,7 @@ void command_suspendmulti(Client *c, const Seperator *sep)
const auto& n = Strings::Split(sep->arg[1], "|"); const auto& n = Strings::Split(sep->arg[1], "|");
std::vector<std::string> v; std::vector<std::string> v;
for (const auto& c : n) { for (const auto& c : n) {
v.push_back(fmt::format("'{}'", Strings::ToLower(c))); v.emplace_back(fmt::format("'{}'", Strings::ToLower(c)));
} }
auto days = Strings::ToUnsignedInt(sep->arg[2]); auto days = Strings::ToUnsignedInt(sep->arg[2]);
-3
View File
@@ -20,9 +20,6 @@
#include "../common/eqemu_logsys.h" #include "../common/eqemu_logsys.h"
#include "expedition.h" #include "expedition.h"
#include "masterentity.h" #include "masterentity.h"
#include "../common/packet_functions.h"
#include "../common/packet_dump.h"
#include "../common/strings.h"
#include "worldserver.h" #include "worldserver.h"
#include "string_ids.h" #include "string_ids.h"
#include "../common/events/player_event_logs.h" #include "../common/events/player_event_logs.h"
-2
View File
@@ -20,11 +20,9 @@
#include "../common/strings.h" #include "../common/strings.h"
#include "client.h" #include "client.h"
#include "entity.h"
#include "guild_mgr.h" #include "guild_mgr.h"
#include "worldserver.h" #include "worldserver.h"
#include "zonedb.h" #include "zonedb.h"
#include "../common/zone_store.h"
ZoneGuildManager guild_mgr; ZoneGuildManager guild_mgr;
GuildBankManager *GuildBanks; GuildBankManager *GuildBanks;
-2
View File
@@ -22,7 +22,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "mob.h" #include "mob.h"
#include "raids.h" #include "raids.h"
#include "../common/rulesys.h"
#include "../common/data_verification.h" #include "../common/data_verification.h"
#include "hate_list.h" #include "hate_list.h"
@@ -30,7 +29,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "zone.h" #include "zone.h"
#include "water_map.h" #include "water_map.h"
#include <stdlib.h>
#include <list> #include <list>
extern Zone *zone; extern Zone *zone;
-3
View File
@@ -23,11 +23,8 @@
#include "quest_parser_collection.h" #include "quest_parser_collection.h"
#include "worldserver.h" #include "worldserver.h"
#include "zonedb.h" #include "zonedb.h"
#include "../common/zone_store.h"
#include "../common/events/player_event_logs.h" #include "../common/events/player_event_logs.h"
#include "bot.h" #include "bot.h"
#include "../common/events/player_event_logs.h"
extern WorldServer worldserver; extern WorldServer worldserver;
-6
View File
@@ -18,7 +18,6 @@
#include "../common/global_define.h" #include "../common/global_define.h"
#include "../common/loottable.h" #include "../common/loottable.h"
#include "../common/misc_functions.h"
#include "../common/data_verification.h" #include "../common/data_verification.h"
#include "client.h" #include "client.h"
@@ -26,13 +25,8 @@
#include "mob.h" #include "mob.h"
#include "npc.h" #include "npc.h"
#include "zonedb.h" #include "zonedb.h"
#include "../common/zone_store.h"
#include "global_loot_manager.h" #include "global_loot_manager.h"
#include "../common/repositories/criteria/content_filter_criteria.h" #include "../common/repositories/criteria/content_filter_criteria.h"
#include "../common/say_link.h"
#include <iostream>
#include <stdlib.h>
#ifdef _WINDOWS #ifdef _WINDOWS
#define snprintf _snprintf #define snprintf _snprintf
-1
View File
@@ -17,7 +17,6 @@
#include "lua_packet.h" #include "lua_packet.h"
#include "dialogue_window.h" #include "dialogue_window.h"
#include "titles.h" #include "titles.h"
#include "../common/expedition_lockout_timer.h"
struct InventoryWhere { }; struct InventoryWhere { };
-1
View File
@@ -1,6 +1,5 @@
#ifdef LUA_EQEMU #ifdef LUA_EQEMU
#include "lua.hpp"
#include <luabind/luabind.hpp> #include <luabind/luabind.hpp>
#include <luabind/object.hpp> #include <luabind/object.hpp>
-1
View File
@@ -1,6 +1,5 @@
#ifdef LUA_EQEMU #ifdef LUA_EQEMU
#include "lua.hpp"
#include <luabind/luabind.hpp> #include <luabind/luabind.hpp>
#include "lua_encounter.h" #include "lua_encounter.h"
#include "encounter.h" #include "encounter.h"
-1
View File
@@ -1,6 +1,5 @@
#ifdef LUA_EQEMU #ifdef LUA_EQEMU
#include "lua.hpp"
#include <luabind/luabind.hpp> #include <luabind/luabind.hpp>
#include "entity.h" #include "entity.h"
+13 -15
View File
@@ -1,12 +1,10 @@
#ifdef LUA_EQEMU #ifdef LUA_EQEMU
#include "lua.hpp"
#include <luabind/luabind.hpp> #include <luabind/luabind.hpp>
#include <luabind/iterator_policy.hpp> #include <luabind/iterator_policy.hpp>
#include "masterentity.h" #include "masterentity.h"
#include "lua_entity_list.h" #include "lua_entity_list.h"
#include "lua_entity.h"
#include "lua_mob.h" #include "lua_mob.h"
#include "lua_client.h" #include "lua_client.h"
#include "lua_npc.h" #include "lua_npc.h"
@@ -349,7 +347,7 @@ Lua_Mob_List Lua_EntityList::GetMobList() {
auto iter = t_list.begin(); auto iter = t_list.begin();
while(iter != t_list.end()) { while(iter != t_list.end()) {
ret.entries.push_back(Lua_Mob(iter->second)); ret.entries.emplace_back(Lua_Mob(iter->second));
++iter; ++iter;
} }
@@ -363,7 +361,7 @@ Lua_Client_List Lua_EntityList::GetClientList() {
auto iter = t_list.begin(); auto iter = t_list.begin();
while(iter != t_list.end()) { while(iter != t_list.end()) {
ret.entries.push_back(Lua_Client(iter->second)); ret.entries.emplace_back(Lua_Client(iter->second));
++iter; ++iter;
} }
@@ -387,7 +385,7 @@ Lua_Bot_List Lua_EntityList::GetBotList() {
if (bot_list.size()) { if (bot_list.size()) {
for (auto bot : bot_list) { for (auto bot : bot_list) {
ret.entries.push_back(Lua_Bot(bot)); ret.entries.emplace_back(Lua_Bot(bot));
} }
} }
@@ -411,7 +409,7 @@ Lua_Bot_List Lua_EntityList::GetBotListByCharacterID(uint32 character_id) {
if (bot_list.size()) { if (bot_list.size()) {
for (auto bot : bot_list) { for (auto bot : bot_list) {
ret.entries.push_back(Lua_Bot(bot)); ret.entries.emplace_back(Lua_Bot(bot));
} }
} }
@@ -425,7 +423,7 @@ Lua_Bot_List Lua_EntityList::GetBotListByCharacterID(uint32 character_id, uint8
if (bot_list.size()) { if (bot_list.size()) {
for (auto bot : bot_list) { for (auto bot : bot_list) {
ret.entries.push_back(Lua_Bot(bot)); ret.entries.emplace_back(Lua_Bot(bot));
} }
} }
@@ -439,7 +437,7 @@ Lua_Bot_List Lua_EntityList::GetBotListByClientName(std::string client_name) {
if (bot_list.size()) { if (bot_list.size()) {
for (auto bot : bot_list) { for (auto bot : bot_list) {
ret.entries.push_back(Lua_Bot(bot)); ret.entries.emplace_back(Lua_Bot(bot));
} }
} }
@@ -453,7 +451,7 @@ Lua_Bot_List Lua_EntityList::GetBotListByClientName(std::string client_name, uin
if (bot_list.size()) { if (bot_list.size()) {
for (auto bot : bot_list) { for (auto bot : bot_list) {
ret.entries.push_back(Lua_Bot(bot)); ret.entries.emplace_back(Lua_Bot(bot));
} }
} }
@@ -487,7 +485,7 @@ Lua_Client_List Lua_EntityList::GetShuffledClientList() {
auto iter = t_list.begin(); auto iter = t_list.begin();
while(iter != t_list.end()) { while(iter != t_list.end()) {
ret.entries.push_back(Lua_Client(iter->second)); ret.entries.emplace_back(Lua_Client(iter->second));
++iter; ++iter;
} }
@@ -503,7 +501,7 @@ Lua_NPC_List Lua_EntityList::GetNPCList() {
auto iter = t_list.begin(); auto iter = t_list.begin();
while(iter != t_list.end()) { while(iter != t_list.end()) {
ret.entries.push_back(Lua_NPC(iter->second)); ret.entries.emplace_back(Lua_NPC(iter->second));
++iter; ++iter;
} }
@@ -517,7 +515,7 @@ Lua_Corpse_List Lua_EntityList::GetCorpseList() {
auto iter = t_list.begin(); auto iter = t_list.begin();
while(iter != t_list.end()) { while(iter != t_list.end()) {
ret.entries.push_back(Lua_Corpse(iter->second)); ret.entries.emplace_back(Lua_Corpse(iter->second));
++iter; ++iter;
} }
@@ -531,7 +529,7 @@ Lua_Object_List Lua_EntityList::GetObjectList() {
auto iter = t_list.begin(); auto iter = t_list.begin();
while(iter != t_list.end()) { while(iter != t_list.end()) {
ret.entries.push_back(Lua_Object(iter->second)); ret.entries.emplace_back(Lua_Object(iter->second));
++iter; ++iter;
} }
@@ -545,7 +543,7 @@ Lua_Doors_List Lua_EntityList::GetDoorsList() {
auto iter = t_list.begin(); auto iter = t_list.begin();
while(iter != t_list.end()) { while(iter != t_list.end()) {
ret.entries.push_back(Lua_Door(iter->second)); ret.entries.emplace_back(Lua_Door(iter->second));
++iter; ++iter;
} }
@@ -560,7 +558,7 @@ Lua_Spawn_List Lua_EntityList::GetSpawnList() {
auto iter = t_list.begin(); auto iter = t_list.begin();
while(iter != t_list.end()) { while(iter != t_list.end()) {
ret.entries.push_back(Lua_Spawn(*iter)); ret.entries.emplace_back(Lua_Spawn(*iter));
++iter; ++iter;
} }
-2
View File
@@ -9,10 +9,8 @@
#include "../common/content/world_content_service.h" #include "../common/content/world_content_service.h"
#include "../common/timer.h" #include "../common/timer.h"
#include "../common/eqemu_logsys.h"
#include "../common/classes.h" #include "../common/classes.h"
#include "../common/rulesys.h" #include "../common/rulesys.h"
#include "lua_parser.h"
#include "lua_item.h" #include "lua_item.h"
#include "lua_iteminst.h" #include "lua_iteminst.h"
#include "lua_client.h" #include "lua_client.h"

Some files were not shown because too many files have changed in this diff Show More