Compare commits

..

180 Commits

Author SHA1 Message Date
Chris Miles c64a2aec94 [Release] 22.11.0 (#3328)
* [Release] 22.11.0

* Update version.h
2023-04-29 20:37:04 -05:00
Alex King 0e582eda82 [Quest API] Add HasSpellEffect() to Perl/Lua (#3319)
* [Quest API] Add HasSpellEffect() to Perl/Lua

# Perl
- Add `$mob->HasSpellEffect(effect_id)`.

# Lua
- Add `mob:HasSpellEffect(effect_id)`.

# Notes
- Allows operators to see if a Mob has an effect ID from any of their buffs.

* Update mob.cpp
2023-04-29 20:09:00 -05:00
Alex King 7eff6ada87 [Cleanup] Remove unused code in zone/pets.cpp (#3310)
# Notes
- This code is unused.
2023-04-29 20:00:37 -05:00
Alex King 291997d35b [Cleanup] Remove pDontCastBefore_casting_spell from zone/npc.h (#3311)
# Notes
- This is unused.
2023-04-29 20:00:20 -05:00
Alex King ac4572bf79 [Cleanup] Remove unused methods in zone/client.cpp and zone/client.h (#3312)
* [Cleanup] Remove unused methods in zone/client.cpp and zone/client.h

# Notes
- Remove `CheckAccess()` in `zone/client.cpp`.
- Remove `CheckAccess()` in `zone/client.h`.
- Remove `CheckQuests()` in `zone/client.h`.
- Remove `MakeCorpse()` in `zone/client.h`.
- Remove `HPTick()` in `zone/client.h`.
- These methods are unused.

* Update client.h
2023-04-29 20:00:08 -05:00
Alex King f0a9578b6a [Cleanup] Remove GetClassHPFactor() from zone/merc.h (#3314)
# Notes
- This is unused.
2023-04-29 19:59:50 -05:00
Alex King baa824d8fb [Cleanup] Remove GetClassHPFactor() from zone/client_mods.cpp and zone/client.h (#3313)
# Notes
- This is unused.
2023-04-29 19:59:19 -05:00
Alex King b19d3ac8a2 [Cleanup] Remove unused methods in zone/bot.cpp and zone/bot.h (#3315)
# Notes
- Remove `DoFinishedSpellAETarget()`.
- Remove `SendBotArcheryWearChange()`.
- These are unused.
2023-04-29 19:59:05 -05:00
Alex King 6a393bf0c3 [Quest API] Add GetDefaultRaceSize() overloads to Perl/Lua (#3320)
# Perl
- Add `$mob->GetDefaultRaceSize(race_id)`.
- Add `$mob->GetDefaultRaceSize(race_id, gender_id)`.

# Lua
- Add `mob:GetDefaultRaceSize(race_id)`.
- Add `mob:GetDefaultRaceSize(race_id, gender_id)`.

# Notes
- This allows you to get a default size for a race and gender that isn't the current mob's race and gender.
2023-04-29 19:53:49 -05:00
Alex King 09a5551de1 [Cleanup] quest::setallskill() had always true condition. (#3301)
# Notes
- Remove unnecessary double check of `initiator`.
- Cleanup logic to use `EQ::skills::GetSkillTypeMap()`.
2023-04-29 19:52:30 -05:00
Alex King 6e2e035d66 [Cleanup] Remove unused variable in common/crash.cpp (#3308)
# Notes
- This variable is unused.
2023-04-29 19:51:41 -05:00
Alex King ac5922bb32 [Cleanup] Use default ctor/dtor in oriented_bounding_box.h (#3307)
# Notes
- Use default ctor/dtor instead of empty ones.
2023-04-29 19:51:21 -05:00
Chris Miles ecf2a369cc [Discord] Add Discord webhook callback processing to world (#3322) 2023-04-29 20:49:06 -04:00
Chris Miles 95b306599f [Maps] Update download with faster releases link (#3321) 2023-04-29 19:39:24 -05:00
Chris Miles 497d20512a [Crash] Fix UCS crash that occurs during log reloading (#3324) 2023-04-29 19:39:13 -05:00
Aeadoin db916e946e [Bug Fix] Fix issue with spawning Mercs (#3327) 2023-04-29 18:45:35 -04:00
Alex King 958549b407 [Bug Fix] Possible issues with SummonItem in Client::QuestReward() methods (#3325)
# Notes
- These methods were ignoring the sixth augment slot and could cause item to be summoned attuned being `EQ::invslot::slotCursor` is a non-zero value.
2023-04-26 21:28:24 -04:00
Paul Coene 71ebf1b2d4 [Messages] Remove duplicate you have lost a level message (#3323) 2023-04-25 17:42:31 -04:00
Paul Coene e19b8d3056 [Bug Fix] Fix issue with NPCs no longer using some armor. (#3318)
* [BugFix/NPCs] Fix issue with NPCs no longer using some armor.

* Removed redundant memory clear
2023-04-24 17:05:29 -04:00
Alex King 8b1d64a043 [Cleanup] quest::createBot() unnecessary check against nullptr (#3302)
# Notes
- We initialize this variable, so it can never be a nullptr.
2023-04-23 15:08:50 -04:00
Alex King 576f99f292 [Cleanup] Add initiator/owner checks to various methods in questmgr.cpp (#3306)
* [Cleanup] Add initiator/owner checks to various methods in questmgr.cpp

# Notes
- Add `initiator` check to `quest::permaclass()`.
- Add `initiator` check to `quest::permarace()`.
- Add `initiator` check to `quest::permagender()`.
- Add `initiator` check to `quest::scribespells()`.
- Add `initiator` check to `quest::traindiscs()`.
- Add `initiator` check to `quest::unscribespells()`.
- Add `initiator` check to `quest::untraindiscs()`.
- Cleanup `initiator` check in `quest::pvp()`.
- Cleanup `initiator` check in `quest::movepc()`.
- Cleanup `initiator` check in `quest::gmmove()`.
- Cleanup `initiator` check in `quest::movegrp()`.
- Add `owner` check to `quest::doanim()`.
- Cleanup `initiator` check in `quest::addskill()`.
- Cleanup `initiator` check in `quest::setlanguage()`.
- Cleanup `initiator` check in `quest::setskill()`.

* Update questmgr.cpp

* Update questmgr.cpp

* Update questmgr.cpp

* Update questmgr.cpp
2023-04-23 15:08:32 -04:00
Alex King e3761cf2a3 [Cleanup] Add check for owner in quest::resumetimer() (#3305)
# Notes
- We didn't check for owner before doing `owner->GetName()`.
2023-04-23 15:07:49 -04:00
Alex King ad1764b464 [Cleanup] Add cehck for owner in quest::pausetimer() (#3304)
# Notes
- We didn't check for `owner` before doing `owner->GetName()`.
2023-04-23 15:07:09 -04:00
Alex King 1c9ea57a4e [Cleanup] Fix possible nullptr in quest::addloot() (#3303)
# Notes
- We didn't check for `owner` before calling `owner->IsNPC()`.
2023-04-23 15:06:53 -04:00
Alex King 03c158b674 [Crash] Fix possible nullptr in Client::GetCharMaxLevelFromQGlobal() (#3317)
# Notes
- We could possibly not have a `zone` here, causing a crash.
- http://spire.akkadius.com/dev/release/22.9.1?id=3051
- http://spire.akkadius.com/dev/release/22.9.1?id=3052
- http://spire.akkadius.com/dev/release/22.9.1?id=3073
- http://spire.akkadius.com/dev/release/22.9.1?id=3102
- http://spire.akkadius.com/dev/release/22.9.1?id=3103
- http://spire.akkadius.com/dev/release/22.9.1?id=3104
- http://spire.akkadius.com/dev/release/22.9.1?id=3107
- http://spire.akkadius.com/dev/release/22.9.1?id=3108
- http://spire.akkadius.com/dev/release/22.9.1?id=3109
- http://spire.akkadius.com/dev/release/22.9.1?id=3110
- http://spire.akkadius.com/dev/release/22.9.1?id=3111
- http://spire.akkadius.com/dev/release/22.9.1?id=3112
- http://spire.akkadius.com/dev/release/22.9.1?id=3113
- http://spire.akkadius.com/dev/release/22.9.1?id=3114
2023-04-23 15:05:47 -04:00
Aeadoin 39b5374e92 [Crash] Fix possible dereference of nullptr in Client::CalcHPRegen (#3316) 2023-04-23 14:27:43 -04:00
Aeadoin 2d3ddcb574 [Release] 22.10.0 (#3300) 2023-04-22 10:17:20 -04:00
Aeadoin ed09281f66 [Bug Fix] Camping was causing player to leave raid, causing unexpected behavior (#3299) 2023-04-22 10:03:40 -04:00
Paul Coene 8e51bf8b19 Fix crash when Removing empty password protected channel. (#3298) 2023-04-22 08:49:34 -04:00
Alex King 844efa7e20 [Cleanup] Breaks in wrong spot in cases in spell_effects.cpp (#3297)
* [Cleanup] Breaks in wrong spot in cases in spell_effects.cpp

# Notes
- These breaks were inside conditions, meaning the case wasn't always broken.

* Update spell_effects.cpp
2023-04-22 08:49:13 -04:00
Alex King fa3a5c7a72 [Feature] Make ornamentations work with any augment type (#3281)
* [Feature] Make ornamentations work with any augment type

# Notes
- On Live there are augments that are not type 20/21 and are ornamentations.
- We also only allow a singular augment type to be ornamentation augment types, this will allow you to use any augment type as an ornamentation if it has a proper Hero's Forge model or a non-IT63/non-IT64 idfile.

* Update ruletypes.h

* Update client_packet.cpp

* Update item_instance.cpp

* Cleanup.
2023-04-16 10:26:19 -04:00
Aeadoin 93db35658a [Crash] Add additional raid integrity checks on Bot Spawn. (#3295)
* simple cleanup before changes

* can't be in a raid yet

* change to sizeof

* change to use sizeof
2023-04-16 10:06:19 -04:00
Alex King d45a57056a [Cleanup] Remove getd(), geti(), InUse(), lasterr(), my_get_sv(), and VarExists() in embperl.cpp/embperl.h (#3283)
* [Cleanup] Remove getd(), geti(), InUse(), lasterr(), and VarExists() in embperl.cpp/embperl.h

# Notes
- These are unused.

* Update embperl.h

* Update embperl.cpp
2023-04-15 13:20:18 -04:00
Alex King ff40dbc710 [Cleanup] Utilize IsTaunting(), SetPetPower(), SetPetType(), and SetTaunting() (#3275)
* [Cleanup] Utilize SetPetPower() in zone/pets.cpp

# Notes
- This wasn't used before.

* Utilize other methods.

* Update special_attacks.cpp
2023-04-15 13:20:04 -04:00
Aeadoin 7523c972fa [Crash] Fix crash with uninitialized item instance, and Bot timeout (#3296) 2023-04-15 13:12:48 -04:00
Alex King 4320c1429e [Cleanup] Remove _GetMovementSpeed() from mob.h (#3276)
# Notes
- This is unused.
2023-04-14 19:42:48 -04:00
Alex King dc8bfddd7a [Cleanup] Remove IsFullHP from mob.cpp/mob.h (#3277)
# Notes
- This is unused.
2023-04-14 19:42:39 -04:00
Alex King a8cdfb07e6 [Cleanup] Remove pendinggroup from mob.h (#3278)
# Notes
- This is unused.
2023-04-14 19:42:27 -04:00
Alex King 011de2692e [Cleanup] Remove IsMeleeDmg() from skills.cpp/skills.h (#3279)
# Notes
- This is unused.
2023-04-14 19:42:14 -04:00
Alex King 0cc76ab489 [Cleanup] Remove position_same_update_count from client.cpp/client.h (#3280)
# Notes
- This is unused.
2023-04-14 19:42:01 -04:00
Alex King c5c9985e0d [Cleanup] Remove ExportVarComplex() from embparser.cpp/embparser.h (#3282)
# Notes
- This is unused.
2023-04-14 19:41:23 -04:00
Alex King a7e95d7818 [Cleanup] Delete embxs.cpp/embxs.h (#3284)
* [Cleanup] Delete embxs.cpp/embxs.h

# Notes
- These files and the one method in them are unused.

* Update embperl.cpp
2023-04-14 19:40:51 -04:00
Alex King 933d856b5b [Cleanup] Remove GetQGlobal() from qglobals.cpp/qglobals.h (#3285)
# Notes
- This is unused.
2023-04-14 19:40:35 -04:00
Alex King 285cc3af29 [Cleanup] Remove item_timers from questmgr.cpp/questmgr.h (#3286)
* [Cleanup] Remove item_timers from questmgr.cpp/questmgr.h

# Notes
- This is unused.

* Update questmgr.h
2023-04-14 19:40:21 -04:00
Alex King de8ae7afa6 [Cleanup] Cleanup zone/zoning.cpp (#3289)
# Notes
- Duplicate outcome cases in `Client::Handle_OP_ZoneChange`.
- Use `.length()` over `strlen` in array defintition.
- Remove unnecessary `else if` in `Client::ZonePC`
2023-04-14 19:40:01 -04:00
Alex King 1b272cba50 [Cleanup] Remove unused ctor and use default dtor in xtargetautohaters.h (#3290)
* [Cleanup] Remove unused ctor and use default dtor in xtargetautohaters.h

# Notes
- Utilize default dtor.
- Remove unused ctor.

* Update zone_event_scheduler.cpp
2023-04-14 19:39:25 -04:00
Alex King e35e38b039 [Cleanup] Remove unused variables and use reference in task_manager.cpp (#3291)
# Notes
- Remove unused `query` and `item` variable.
- Use a reference for task data instead of calling `cts->m_completed_tasks[task_index]` over and over.
2023-04-14 19:39:07 -04:00
Alex King 9215ba7a8a [Cleanup] Remove always true statements in task_client_state.cpp (#3292)
# Notes
- `!tasks_enabled.empty()` is always true.
- `tasks_disabled.size()` is always true.
2023-04-14 19:38:35 -04:00
Alex King 3f4334985b [Cleanup] Remove unnecessary condition and cleanup variable name in tasks.cpp (#3293)
# Notes
- `task_state` is verified by `safe_delete`.
- `size` is the name of a member variable, we should just use `sizeof(uint32_t)` instead.
2023-04-14 19:38:28 -04:00
Alex King 21002c2e8a [Quest API] Fix LDoN Methods in Perl/Lua (#3287)
# Perl
- Add `quest::removeldonloss(theme_id)`.
- Add `quest::removeldonwin(theme_id)`.

# Lua
- Fix `eq.remove_ldon_win(theme_id)` as it was using `quest_manager.addldonwin(theme_id)` instead of `quest_manager.removeldonwin(theme_id)`.
2023-04-10 16:16:54 -04:00
Alex King 445f967ed6 [Quest API] Add ApplySpellRaid() and SetSpellDurationRaid() to Bots in Perl/Lua (#3274)
# Perl
- Add `$bot->ApplySpellRaid(spell_id)`.
- Add `$bot->ApplySpellRaid(spell_id, duration)`.
- Add `$bot->ApplySpellRaid(spell_id, duration, allow_pets)`.
- Add `$bot->ApplySpellRaid(spell_id, duration, allow_pets, is_raid_group_only)`.
- Add `$bot->SetSpellDuration(spell_id)`.
- Add `$bot->SetSpellDuration(spell_id, duration)`.
- Add `$bot->SetSpellDuration(spell_id, duration, allow_pets)`.
- Add `$bot->SetSpellDuration(spell_id, duration, allow_pets, is_raid_group_only)`.

# Lua
- Add `bot:ApplySpellRaid(spell_id)`.
- Add `bot:ApplySpellRaid(spell_id, duration)`.
- Add `bot:ApplySpellRaid(spell_id, duration, allow_pets)`.
- Add `bot:ApplySpellRaid(spell_id, duration, allow_pets, is_raid_group_only)`.
- Add `bot:SetSpellDuration(spell_id)`.
- Add `bot:SetSpellDuration(spell_id, duration)`.
- Add `bot:SetSpellDuration(spell_id, duration, allow_pets)`.
- Add `bot:SetSpellDuration(spell_id, duration, allow_pets, is_raid_group_only)`.

# Notes
- These methods weren't added initially as we did not support bots in raid groups until recently.
2023-04-09 12:00:12 -04:00
Alex King 57a15d473f [Quest API] Add GetBuffSpellIDs() to Perl/Lua (#3273)
# Perl
- Add `$mob->GetBuffSpellIDs()`.

# Lua
- Add `$mob->GetBuffSpellIDs()`.

# Notes
- These methods allow operators to get a list of a mob's buff IDs without having to loop through their buffs themselves.
2023-04-09 10:58:35 -04:00
Trent df92c578d2 [Rules] Optional summoning when already in melee range (#3204)
* Add summon melee range rule

* Fix compilation

* Remove redundant range check for HateSummon
2023-04-08 18:04:17 -04:00
Aeadoin 3af43a8e8d [Hotfix] Resolve loading of inventory (#3272) 2023-04-08 17:45:06 -04:00
Aeadoin 647bcce30b [Crash] Resolve crash due to uninitialized pointer. (#3271) 2023-04-08 17:21:53 -04:00
Alex King 25b527156c [Cleanup] Fix possible nullptr inst in GetSharedBank() (#3190)
* [Cleanup] Fix possible nullptr inst in GetSharedBank()

# Notes
- We weren't continuing if we had a `nullptr`.

* Update shareddb.cpp

* Fix.
2023-04-08 09:42:10 -04:00
Aeadoin b3ab7deb80 [Bots] Cleanup GetBotTables() (#3270) 2023-04-06 17:43:57 -05:00
Alex King 4a9cb07132 [Cleanup] Remove unnecessary setting of reuse variable in Bot::DoClassAttacks() (#3233)
# Notes
- Bash, Kick, and Taunt have the same reuse time, no reason to set it to the same value.
2023-04-05 19:17:15 -04:00
Alex King 8f1b62d166 [Cleanup] Remove always true/false conditions from bot.cpp (#3237)
* [Cleanup] Remove always true/false conditions from bot.cpp

# Notes
- Some of these conditions were always true or false based on previous conditions.

* Update bot.cpp
2023-04-05 19:05:49 -04:00
Alex King 7e9994b5d4 [Cleanup] Fix ornamentation augment icons in inspect requests (#3264)
* [Cleanup] Fix ornamentation augment icons in inspect requests

# Notes
- We were not setting `aug_item` to the ornamentation augment when we found one.

* Update client.cpp
2023-04-05 19:04:32 -04:00
Chris Miles f2f8fae58b [Telnet] Telnet encoding fix (#3269) 2023-04-05 12:16:25 -04:00
Alex King 3a1e88f9ed [Cleanup] Remove unused SetConfigFile in common/eqemu_config.h (#3208)
# Notes
- This is unused.
2023-04-05 12:15:10 -04:00
Alex King 4e101aa6d6 [Cleanup] Use default dtor instead of empty dtor for EQTime in eqtime.cpp/eqtime.h (#3210)
# Notes
- This is better than using an empty dtor.
2023-04-05 12:15:02 -04:00
Alex King ef411ee154 [Cleanup] Use default ctor instead of an empty ctor. (#3206)
# Notes
- Use `= default;` instead of an empty ctor.
- https://pvs-studio.com/en/docs/warnings/v832/
2023-04-05 12:14:22 -04:00
Alex King 93b3f97f24 [Cleanup] Cleanup discord.cpp and discord_manager.cpp (#3205)
# Notes
- Unused variables in `discord.cpp`.
- Use `.clear()` instead of setting to `""` in `discord_manager.cpp`.
2023-04-05 12:14:14 -04:00
Alex King c1d4cb90b9 [Cleanup] Cleanup cheap-to-copy reference to use value instead in eq_stream_ident.cpp/eq_stream_ident.h (#3209)
# Notes
- More performant to pass by value than by reference.
2023-04-05 12:14:01 -04:00
Alex King e939c82717 [Cleanup] Convert equipable_slot_list to std::vector from std::list in bot_command.cpp (#3253)
# Notes
- No need to use a `std::list` here.
2023-04-05 11:35:04 -04:00
Alex King 7d03479f41 [Cleanup] Use constant reference and check for empty string properly in dbcore.cpp (#3203)
# Notes
- Passing by constant reference is more performant.
- Checking for empty string with `!= '\0'` is more performant.
- https://pvs-studio.com/en/docs/warnings/v805/
- https://pvs-studio.com/en/docs/warnings/v813/
2023-04-05 11:27:50 -04:00
Alex King ff440e16b6 [Cleanup] Use .clear() and .empty() instead of comparing to empty string or setting to empty string in CheckDatabaseConvertPPBlob() (#3201)
# Notes
- Use these methods to increase performance.
2023-04-05 11:27:12 -04:00
Alex King c6bb0f6495 [Cleanup] Move variable definition to more relevant scope in DatabaseDumpService::Dump() (#3200)
# Notes
- This was unused except for in this one spot, move to scope of condition where it's used.
- https://pvs-studio.com/en/docs/warnings/v821/
2023-04-05 11:26:21 -04:00
Alex King d142bc552a [Cleanuo] Only define row if we have results in Database::GetCharacterID() (#3199)
# Notes
- This is more performant and we don't unnecessarily define a variable we can't use.
- https://pvs-studio.com/en/docs/warnings/v821/
2023-04-05 11:25:28 -04:00
Alex King 7dc57c3b05 [Cleanup] Utilize .empty() instead of checking for an empty string in Database::ReserveName() (#3198)
# Notes
- This is more performant.
- https://pvs-studio.com/en/docs/warnings/v815/
2023-04-05 11:24:54 -04:00
Alex King ea9b09cf1f [Cleanup] Remove unused variable in Database::CopyCharacter() (#3197)
# Notes
- This variable was created but never used.
- https://pvs-studio.com/en/docs/warnings/v808/
2023-04-05 11:24:27 -04:00
Alex King 968278d8f8 [Cleanup] Use .clear() instead of setting string to empty in eqemu_command_handler.cpp (#3195)
# Notes
- `x = ""` has less performance than `x.clear()`.
- https://pvs-studio.com/en/docs/warnings/v815/
2023-04-05 11:24:12 -04:00
Alex King aa910864c8 [Cleanup] Remove unused macros in common/types.h (#3194)
# Notes
- These are unused.
2023-04-05 11:23:37 -04:00
Alex King 1499f3338e [Cleanup] Remove always true condition in Strings::Commify() (#3193)
# Notes
- `i < 0` was always true.
2023-04-05 11:23:24 -04:00
Alex King fef2f9fc61 [Cleanup] Fix shared_tasks.cpp/shared_tasks.cpp variable named same as class member (#3192)
* [Cleanup] Fix shared_tasks.cpp/shared_tasks.cpp variable named same as class member

# Notes
- This variable was named `m_db_shared_task` which is the same as `SharedTask:;m_db_shared_task`.

* Single letter receiver of complex type.
2023-04-05 11:22:42 -04:00
Alex King 8afbc585da [Cleanup] Remove bool return from GetSharedPlatinum() (#3191)
# Notes
- This was returning `false` and implicitly converting it to an integer.
2023-04-05 11:22:23 -04:00
Alex King 457ce85746 [Cleanup] Cleanup always true/false statements in shareddb.cpp (#3189)
# Notes
- `parent_index < EQ::invslot::SLOT_BEGIN` was always `false`.
- `item->LoreGroup != -1` was always `true`.
2023-04-05 11:21:43 -04:00
Alex King 49c093dc62 [Cleanup] Remove always true statement in say_link.cpp (#3188)
# Notes
- This is always true since we check `!saylinks.empty()` prior to this.
2023-04-05 11:20:52 -04:00
Alex King beccd557a8 [Cleanup] Cleanup item_instance.cpp always true statements and reassigning of same values (#3187)
# Notes
- Some things were always true.
- Some values were reassigned to the value they already were.
2023-04-05 11:20:36 -04:00
Alex King e11610b9fa [Cleanup] Remove unnecessary check for IsStackable() in DeleteItem() (#3186)
# Notes
- We check the opposites therefore we don't need either.
- https://pvs-studio.com/en/docs/warnings/v728/
2023-04-05 11:20:13 -04:00
Alex King 3e652b98bc [Cleanup] Cleanup macros in features.h (#3185)
# Notes
- These needed to either be wrapped in parentheses or simplified to their values.
- https://pvs-studio.com/en/docs/warnings/v1003/
2023-04-05 11:18:22 -04:00
Alex King d43af28de4 [Cleanup] Multiple cases with same outcome in GetDiscordPayloadFromEvent() (#3184)
# Notes
- All 4 of these use `FormatWithNodata`.
2023-04-05 11:17:52 -04:00
Alex King f5106b6af6 [Cleanup] Remove unused code in eq_packet.cpp/eq_packet.h (#3183)
# Notes
- These are unused.
2023-04-05 11:17:29 -04:00
Alex King 3386d13d2d [Cleanup] results variable is assigned but never used in SaveCharacterCreate() (#3180)
# Notes
- This was unnecessary since `QueryDatabase()` runs regardless.
2023-04-05 11:17:10 -04:00
Alex King d1b7c675f9 [Cleanup] Validate for nullptrs in bot.cpp (#3232)
* [Cleanup] Validate for nullptrs in bot.cpp

# Notes
- Validate for nullptrs in these spots in bot.cpp before using the variable.

* Update bot.cpp
2023-04-05 11:15:46 -04:00
Alex King a40e1cf893 [Cleanup] Add missing breaks and returns in bonuses.cpp (#3231)
# Notes
- Many spots were missing a `break;` or a `return` for their value.
2023-04-05 11:15:22 -04:00
Alex King c81ab00764 [Cleanup] Set bonuses to use spell ID instead of boolean (#3230)
# Notes
- Spell bonuses `Illusion` is the spell ID, not a boolean.
2023-04-05 11:14:55 -04:00
Alex King 025ef5e1d6 [Cleanup] Move unreachable code in ApplySpellsBonuses() (#3229)
# Notes
- This code was unreachable since it was inside the switch and should have been checked on its own in the condition where we verify we are using AISpellEffects.
2023-04-05 11:14:28 -04:00
Alex King 1f29a40e6d [Cleanup] Remove extraneous check for NegateAttacks in SE_NegateAttacks (#3228)
# Notes
- We checked both, we only need to check one.
2023-04-05 11:12:02 -04:00
Alex King 66cadd599b [Cleanup] Remove extraneous parentheses around math in Mob::ApplySpellsBonuses() (#3227)
# Notes
- Extra parentheses.
2023-04-05 11:11:41 -04:00
Alex King aa0345c1f1 [Cleanup] Cleanup duplicate conditions in negate bonuses in bonuses.cpp (#3226)
# Notes
- Lots of duplicate conditions.
2023-04-05 11:11:22 -04:00
Alex King 73b11c5036 [Cleanup] SE_StrikeThrough and SE_StrikeThrough2 are the same in bonuses.cpp (#3223)
# Notes
- These were the same code duplicated.
2023-04-05 11:05:59 -04:00
Alex King efbeb2dbb7 [Cleanup] SE_AttackSpeed3 effect_value is always less than 0 (#3222)
# Notes
- This was always false.
2023-04-05 11:05:44 -04:00
Alex King 8c97c20727 [Cleanup] Fix skill_used being used as boolean in Mob::CommonDamage() (#3220)
# Notes
- This is unnecessary as we always have a skill value.
2023-04-05 11:03:28 -04:00
Alex King f2d07e5c69 [Cleanup] Remove unnecessary break in while loop in Mob::AddToHateList() (#3219)
# Notes
- This is unnecessary and breaks the loop for no reason.
2023-04-05 10:31:57 -04:00
Alex King 64d5b54e65 [Cleanup] Fix filter condition in attack.cpp (#3218)
# Notes
- This condition was causing them to be used as `booleans` versus being checked individually.
2023-04-05 10:31:34 -04:00
Alex King 89b3a04eb3 [Cleanup] Identical conditions right beside each other in aa.cpp (#3213)
# Notes
- These conditions were identical and could be consolidated.
2023-04-05 10:30:27 -04:00
Alex King 1bafe0b6b3 [Cleanup] other is always defined in these cases in attack.cpp (#3217)
# Notes
- `other` is always defined since we check it prior to checking here.
2023-04-05 10:30:13 -04:00
Alex King 82762c3f5a [Cleanup] Use variable for character instead of a loop (#3268)
# Notes
- Store character in a variable instead of looping a list of 1 entry.
2023-04-05 10:29:16 -04:00
Alex King 2742eca119 [Cleanup] Remove unnecessary conditions in Client::SendFactionMessage() (#3267)
# Notes
- `faction_value < this_faction_max` and `faction_value > this_faction_min` are always true if they get to that point in the code.
2023-04-05 10:27:15 -04:00
Alex King 8fc7f3a732 [Cleanup] Cleanup unnecessary condition in Client::SendAlternateCurrencyValue() (#3266)
# Notes
- `value == 0` is unnecessary as it can only be 0 if we fail the `value > 0` check.
2023-04-05 10:27:01 -04:00
Alex King 39ce0178f9 [Cleanup] Remove unnecessary conditions in Client::Consume() (#3265)
# Notes
- We check `increase < 0` prior to this, so this can't ever happen.
2023-04-05 10:26:32 -04:00
Alex King 3d2f560436 [Cleanup] Fix GetLastName() length check in Client::SendWindow() (#3263)
# Notes
- `target->GetLastName()` was always true, we need to make sure the target has a last name.
2023-04-05 10:23:54 -04:00
Alex King a0768d2d28 [Cleanup] Remove unnecessary conditions in Client::FilteredMessageCheck() (#3262)
# Notes
- We check `FilterHide` prior to the secondary conditions, so it can never show up.
2023-04-05 10:23:33 -04:00
Alex King 9009a7aa23 [Cleanup] Remove extra assignment of current_endurance in Client ctor (#3261)
# Notes
- We already assign `current_endurance` to `0`, no need to do it again.
2023-04-05 10:23:20 -04:00
Alex King 67b03b4e31 [Cleanup] Combine similar cases in Client::InitInnates() (#3260)
# Notes
- These cases were the same, consolidating them is better.
2023-04-05 10:23:05 -04:00
Alex King b08975aefb [Cleanup] Use .empty() in Client::ScribeSpells() and Client::LearnDisciplines() (#3259)
* [Cleanup] Use .empty() in Client::ScribeSpells() and Client::LearnDisciplines()

# Notes
- Use `.empty()` instead of using a variable storing size in condition.

* Update client.cpp
2023-04-05 10:22:36 -04:00
Alex King ea3a7cae0b [Cleanup] Remove always true conditions and unreachable code in Client::SendMercPersonalInfo() (#3258)
* [Cleanup] Remove unreachable code in Client::SendMercPersonalInfo()

# Notes
- This cannot be reached due to prior returns.

* Update client.cpp

* Update client.cpp
2023-04-05 10:14:07 -04:00
Alex King 81314a3315 [Cleanup] Fix check for !this in Client::SendHPUpdateMarquee() (#3257)
# Notes
- `!this` isn't valid, as `this` can never be nullptr.
2023-04-05 10:13:24 -04:00
Alex King d33cfad567 [Cleanup] Fix always false conditions in Client::IncStats() (#3256)
# Notes
- Value can never be less than `0` as it's unsigned.
2023-04-05 10:12:32 -04:00
Alex King c1698a5bdd [Cleanup] Fix possible overflows in Client::AddPlatinum() and Client::TakePlatinum() (#3255)
# Notes
- Fix possible overflows by casting properly.
2023-04-05 10:10:33 -04:00
Alex King 2a094e8792 [Cleanup] Use variable for c->GetTarget() instead of calling multiple times in bot_command.cpp (#3254)
# Notes
- Calling multiple times is less performant than using a variable.
2023-04-05 10:09:19 -04:00
Alex King 4a0725e278 [Cleanup] Cleanup string -> char* -> string conversions in bot_command.cpp (#3252)
# Notes
- We were converting back and forth between types unnecessarily.
2023-04-05 09:59:43 -04:00
Alex King 218ffbb2c5 [Cleanup] Delete unused strings in bot_command.cpp (#3251)
# Notes
- These are unused.
2023-04-05 09:59:24 -04:00
Chris Miles 3e30e78158 [Backups] Fix database dump error reporting (#3175)
* [Backups] Fix database dump error reporting

* Update database_dump_service.cpp
2023-04-04 00:14:23 -05:00
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
Aeadoin 090086f50c [Release] 22.9.0 (#3174) 2023-04-01 14:27:52 -04:00
Alex King 407b003f7d [Cleanup] Add client pointer validation to Zone::GetClosestZonePoint() (#3173)
# Notes
- We were not validating pointer here, could cause issues.
2023-04-01 14:22:52 -04:00
Alex King b6d315d803 [Cleanup] Remove unnecessary validation check in Zone::ClearBlockedSpells() (#3172)
# Notes
- This is unnecessary, since `safe_delete_array` checks for validity.
2023-04-01 13:59:03 -04:00
Aeadoin 6927177291 [Fix] Correct SE_SlayUndead & SE_HeadShotLevel limit Value when applied. (#3171) 2023-04-01 13:31:13 -04:00
Aeadoin 31ede355a8 [Cleanup] Cleanup excessive type casting: string -> char * -> string (#3169)
* [Cleanup] Cleanup excessive type casting: string -> char * -> string

* [Cleanup] Cleanup excessive type casting: string -> char * -> string
2023-04-01 12:45:16 -04:00
Aeadoin 0df84e1ee6 [Crash] Fix out of bound arrays, other potential crashes (#3166) 2023-04-01 12:44:41 -04:00
Aeadoin 0d509a7f3a [Crash] Add Checks for valid pointers or fix existing. (#3164) 2023-04-01 12:44:00 -04:00
Aeadoin 4c2271ff69 [Fix] Prevent VerifyGroup from setting OOZ membername to Null character. (#3168) 2023-04-01 12:40:55 -04:00
Aeadoin ca2072e7bf [Bots] Remove Bot Groups Functionality (#3165)
* [Bots] Remove Bot Groups Functionality

* in-class initializers for member variables.
2023-03-31 21:37:52 -04:00
Alex King e1eb1ff738 [Quest API] Add missing Luabind definitions to lua_general.cpp (#3167)
# Notes
- These definitions were missing somehow.
2023-03-31 21:05:01 -04:00
Aeadoin 25f5898bae [Release] 22.8.2 (#3161) 2023-03-30 09:22:58 -04:00
Aeadoin 934ff3dadf [Bug Fix] Correct logic checks for Bot rule AllowOwnerOptionAltCombat (#3158)
* [Bug Fix] Correct logic checks for Bot rule AllowOwnerOptionAltCombat

* fix ordering of raid/group checks
2023-03-30 08:31:57 -04:00
Aeadoin e4ff76dceb [Bug Fix] Fix for OOZ Group updates when removing/inviting Bots (#3159)
* [Bug Fix] Fix for Cross Zone Group updates with Bots when disbanding/joining groups.

* check for nullptr
2023-03-30 08:31:50 -04:00
Alex King 6960a1a682 [Bug Fix] Fix issues with Lua tables not starting at index 1 (#3160)
* [Bug Fix] Fix issues with Lua tables not starting at index 1

# Notes
- This would cause the first item in the table to be inaccessible since Lua tables start at index `1` instead of index `0`.
- All other spots using Lua tables have their indexes starting at `1`.

* Update lua_general.cpp
2023-03-30 06:02:53 -04:00
Aeadoin d4174ca236 [Fix] Fix strcpy-param-overlap (#3157) 2023-03-29 08:33:06 -04:00
Aeadoin 7854130a93 [Bug Fix] Check Rule "Bots Enabled" to prevent bot database calls on connect (#3154)
* [Bug Fix] Check for Rule "Bots Enabled" to prevent bot database calls if not enabled.

* formatting

* check if LoadBotsList failed, or is bots_list empty
2023-03-28 22:44:47 -04:00
Alex King e9c63c7d94 [Rules] Remove Guild Bank Zone ID Rule (#3156)
# notes
- This rule is useless as guild bank zone ID is hard-coded into the client.
2023-03-28 21:58:58 -04:00
Aeadoin 27e0665aae [Bug Fix] Fix bot_raid_members.sql for MYSQL. (#3155) 2023-03-28 15:25:16 -04:00
Alex King ea2f431fce [Fix] Fix an issue with EVENT_DISCONNECT not firing on regular /camp (#3153)
* [Fix] Fix an issue with EVENT_DISCONNECT not firing on regular /camp

# Notes
- We were only sending `EVENT_DISCONNECT` on GM instant camps or linkdeads.

* Update client_process.cpp
2023-03-27 21:45:02 -04:00
Aeadoin 8bdcf7cb94 [Crash] Add Checks for out of bounds & dereferencing nullptrs (#3151)
* [Crash] Add Checks for out of bounds/nullptr dereferences

* formatting

* formatting

* formatting

* Update bot.cpp

---------

Co-authored-by: Alex King <89047260+Kinglykrab@users.noreply.github.com>
2023-03-27 21:43:46 -04:00
Aeadoin 87cb74b851 [Release] 22.8.1 (#3152) 2023-03-27 17:55:48 -04:00
Alex King 26c267db1b [Cleanup] "equipped" not "equiped", "dual" not "duel". (#3149)
* [Cleanup] "equipped" not "equiped", "dual" not "duel".

# Notes
- These are spelled incorrectly.

* Update spdat.h

* Formatting further.

* Update api_service.cpp
2023-03-27 17:55:37 -04:00
Aeadoin 99f8e6cef5 [Bug Fix] Fix for NPCs having spells interrupted. (#3150) 2023-03-27 16:57:08 -04:00
Aeadoin b6917ec782 [Release] 22.8.0 (#3148) 2023-03-25 20:48:43 -04:00
Aeadoin eb51550109 [Cleanup] Cleanup Strings::ToInt uses. (#3142)
* [Cleanup] Cleanup Strings::ToInt uses.

* fix for conversion

* remove != 0

* cleanup
2023-03-25 20:32:30 -04:00
Alex King 9d1ace627c [Feature] Add support for -1 extradmgskill to allow all skills to be scaled. (#3136)
* [Feature] Add support for -1 extradmgskill to allow all skills to be scaled.

- `$mob->GetSkillDmgAmt(skill_id)` now uses `int` instead of `uint16`.

- `statbonuses:GetSkillDamageAmount(skill_id)` now uses `-1` properly.
- `mob:GetSkillDmgAmt(skill_id)` now uses `int` instead of `uint16`.

- A `-1` value in `extradmgskill` denotes the ability to scale all skills at once.
- Consolidated `AddItemBonuses()`, `AdditiveWornBonuses()`, `CalcItemBonuses()`, and `CalcRecommendedLevelBonus()` to mob-based methods to avoid code duplication.
- Bots, NPCs, and Mercs can now use additive worn effects if the rule is enabled, as well as all other proper stat bonuses that only clients had before.
- No SQL update required to change `extradmgskill` and `extradmgamt` to `int` as they already are this type in the database, just had to adjust `item_data.h` and `shareddb.cpp`.

* Update mob.cpp

* Cleanup.

* Cleanup.

* Move #include <vector> to header.

* Add method for GetExtraDamageSkills

* fix additembonuses

* Update bonuses.cpp

* Update mob.cpp

* Out of bounds.

* Update bonuses.cpp

---------

Co-authored-by: Aeadoin <109764533+Aeadoin@users.noreply.github.com>
2023-03-25 20:26:01 -04:00
Aeadoin ec3ef411a1 [Fix] Fix for SQL Query in npc_scale_global_base (#3144) 2023-03-25 20:08:40 -04:00
Aeadoin 1394b6a4d2 [Hotfix] Fix for Items looted from corpses. (#3147) 2023-03-25 20:00:31 -04:00
Aeadoin 7f41547963 [Crash] Fix for crash in Raid::QueuePacket (#3145)
* [Crash] Fix for crash in Raid::QueuePacket

* bots can't be a part of BalanceMana

* corrected additions

* adding additional is_bot gates

* updating raid for loops to be range based.

* typo

* formatting

* formatting
2023-03-25 18:02:05 -04:00
Alex King 2e4071cdcf [Cleanup] Remove extern bool Critical (#3146)
# Notes
- This is unused.
2023-03-25 17:48:40 -04:00
249 changed files with 5232 additions and 6976 deletions
+288
View File
@@ -1,3 +1,291 @@
## [22.11.0] - 04/29/2023
### Code
* Add check for owner in quest::pausetimer() ([#3304](https://github.com/EQEmu/Server/pull/3304)) @Kinglykrab 2023-04-23
* Add check for owner in quest::resumetimer() ([#3305](https://github.com/EQEmu/Server/pull/3305)) @Kinglykrab 2023-04-23
* Add initiator/owner checks to various methods in questmgr.cpp ([#3306](https://github.com/EQEmu/Server/pull/3306)) @Kinglykrab 2023-04-23
* Fix possible nullptr in quest::addloot() ([#3303](https://github.com/EQEmu/Server/pull/3303)) @Kinglykrab 2023-04-23
* Remove GetClassHPFactor() from zone/client_mods.cpp and zone/client.h ([#3313](https://github.com/EQEmu/Server/pull/3313)) @Kinglykrab 2023-04-30
* Remove GetClassHPFactor() from zone/merc.h ([#3314](https://github.com/EQEmu/Server/pull/3314)) @Kinglykrab 2023-04-30
* Remove pDontCastBefore_casting_spell from zone/npc.h ([#3311](https://github.com/EQEmu/Server/pull/3311)) @Kinglykrab 2023-04-30
* Remove unused code in zone/pets.cpp ([#3310](https://github.com/EQEmu/Server/pull/3310)) @Kinglykrab 2023-04-30
* Remove unused methods in zone/bot.cpp and zone/bot.h ([#3315](https://github.com/EQEmu/Server/pull/3315)) @Kinglykrab 2023-04-30
* Remove unused methods in zone/client.cpp and zone/client.h ([#3312](https://github.com/EQEmu/Server/pull/3312)) @Kinglykrab 2023-04-30
* Remove unused variable in common/crash.cpp ([#3308](https://github.com/EQEmu/Server/pull/3308)) @Kinglykrab 2023-04-30
* Use default ctor/dtor in oriented_bounding_box.h ([#3307](https://github.com/EQEmu/Server/pull/3307)) @Kinglykrab 2023-04-30
* quest::createBot() unnecessary check against nullptr ([#3302](https://github.com/EQEmu/Server/pull/3302)) @Kinglykrab 2023-04-23
* quest::setallskill() had always true condition. ([#3301](https://github.com/EQEmu/Server/pull/3301)) @Kinglykrab 2023-04-30
### Crash
* Fix UCS crash that occurs during log reloading ([#3324](https://github.com/EQEmu/Server/pull/3324)) @Akkadius 2023-04-30
* Fix possible dereference of nullptr in Client::CalcHPRegen ([#3316](https://github.com/EQEmu/Server/pull/3316)) @Aeadoin 2023-04-23
* Fix possible nullptr in Client::GetCharMaxLevelFromQGlobal() ([#3317](https://github.com/EQEmu/Server/pull/3317)) @Kinglykrab 2023-04-23
### Discord
* Add Discord webhook callback processing to world ([#3322](https://github.com/EQEmu/Server/pull/3322)) @Akkadius 2023-04-30
### Fixes
* Fix issue with NPCs no longer using some armor. ([#3318](https://github.com/EQEmu/Server/pull/3318)) @noudess 2023-04-24
* Fix issue with spawning Mercs ([#3327](https://github.com/EQEmu/Server/pull/3327)) @Aeadoin 2023-04-29
* Possible issues with SummonItem in Client::QuestReward() methods ([#3325](https://github.com/EQEmu/Server/pull/3325)) @Kinglykrab 2023-04-27
### Maps
* Update download with faster releases link ([#3321](https://github.com/EQEmu/Server/pull/3321)) @Akkadius 2023-04-30
### Messages
* Remove duplicate you have lost a level message ([#3323](https://github.com/EQEmu/Server/pull/3323)) @noudess 2023-04-25
### Quest API
* Add GetDefaultRaceSize() overloads to Perl/Lua ([#3320](https://github.com/EQEmu/Server/pull/3320)) @Kinglykrab 2023-04-30
* Add HasSpellEffect() to Perl/Lua ([#3319](https://github.com/EQEmu/Server/pull/3319)) @Kinglykrab 2023-04-30
## [22.10.0] - 04/22/2023
### Backups
* Fix database dump error reporting ([#3175](https://github.com/EQEmu/Server/pull/3175)) @Akkadius 2023-04-04
### Bots
* Cleanup GetBotTables() ([#3270](https://github.com/EQEmu/Server/pull/3270)) @Aeadoin 2023-04-06
### Cleanuo
* Only define row if we have results in Database::GetCharacterID() ([#3199](https://github.com/EQEmu/Server/pull/3199)) @Kinglykrab 2023-04-05
### Code
* Add missing breaks and returns in bonuses.cpp ([#3231](https://github.com/EQEmu/Server/pull/3231)) @Kinglykrab 2023-04-05
* Breaks in wrong spot in cases in spell_effects.cpp ([#3297](https://github.com/EQEmu/Server/pull/3297)) @Kinglykrab 2023-04-22
* Cleanup always true/false statements in shareddb.cpp ([#3189](https://github.com/EQEmu/Server/pull/3189)) @Kinglykrab 2023-04-05
* Cleanup cheap-to-copy reference to use value instead in eq_stream_ident.cpp/eq_stream_ident.h ([#3209](https://github.com/EQEmu/Server/pull/3209)) @Kinglykrab 2023-04-05
* Cleanup discord.cpp and discord_manager.cpp ([#3205](https://github.com/EQEmu/Server/pull/3205)) @Kinglykrab 2023-04-05
* Cleanup duplicate conditions in negate bonuses in bonuses.cpp ([#3226](https://github.com/EQEmu/Server/pull/3226)) @Kinglykrab 2023-04-05
* Cleanup item_instance.cpp always true statements and reassigning of same values ([#3187](https://github.com/EQEmu/Server/pull/3187)) @Kinglykrab 2023-04-05
* Cleanup macros in features.h ([#3185](https://github.com/EQEmu/Server/pull/3185)) @Kinglykrab 2023-04-05
* Cleanup string -> char* -> string conversions in bot_command.cpp ([#3252](https://github.com/EQEmu/Server/pull/3252)) @Kinglykrab 2023-04-05
* Cleanup unnecessary condition in Client::SendAlternateCurrencyValue() ([#3266](https://github.com/EQEmu/Server/pull/3266)) @Kinglykrab 2023-04-05
* Cleanup zone/zoning.cpp ([#3289](https://github.com/EQEmu/Server/pull/3289)) @Kinglykrab 2023-04-14
* Combine similar cases in Client::InitInnates() ([#3260](https://github.com/EQEmu/Server/pull/3260)) @Kinglykrab 2023-04-05
* Convert equipable_slot_list to std::vector from std::list in bot_command.cpp ([#3253](https://github.com/EQEmu/Server/pull/3253)) @Kinglykrab 2023-04-05
* Delete embxs.cpp/embxs.h ([#3284](https://github.com/EQEmu/Server/pull/3284)) @Kinglykrab 2023-04-14
* Delete unused strings in bot_command.cpp ([#3251](https://github.com/EQEmu/Server/pull/3251)) @Kinglykrab 2023-04-05
* Fix GetLastName() length check in Client::SendWindow() ([#3263](https://github.com/EQEmu/Server/pull/3263)) @Kinglykrab 2023-04-05
* Fix always false conditions in Client::IncStats() ([#3256](https://github.com/EQEmu/Server/pull/3256)) @Kinglykrab 2023-04-05
* Fix check for !this in Client::SendHPUpdateMarquee() ([#3257](https://github.com/EQEmu/Server/pull/3257)) @Kinglykrab 2023-04-05
* Fix filter condition in attack.cpp ([#3218](https://github.com/EQEmu/Server/pull/3218)) @Kinglykrab 2023-04-05
* Fix ornamentation augment icons in inspect requests ([#3264](https://github.com/EQEmu/Server/pull/3264)) @Kinglykrab 2023-04-05
* Fix possible nullptr inst in GetSharedBank() ([#3190](https://github.com/EQEmu/Server/pull/3190)) @Kinglykrab 2023-04-08
* Fix possible overflows in Client::AddPlatinum() and Client::TakePlatinum() ([#3255](https://github.com/EQEmu/Server/pull/3255)) @Kinglykrab 2023-04-05
* Fix shared_tasks.cpp/shared_tasks.cpp variable named same as class member ([#3192](https://github.com/EQEmu/Server/pull/3192)) @Kinglykrab 2023-04-05
* Fix skill_used being used as boolean in Mob::CommonDamage() ([#3220](https://github.com/EQEmu/Server/pull/3220)) @Kinglykrab 2023-04-05
* Identical conditions right beside each other in aa.cpp ([#3213](https://github.com/EQEmu/Server/pull/3213)) @Kinglykrab 2023-04-05
* Move unreachable code in ApplySpellsBonuses() ([#3229](https://github.com/EQEmu/Server/pull/3229)) @Kinglykrab 2023-04-05
* Move variable definition to more relevant scope in DatabaseDumpService::Dump() ([#3200](https://github.com/EQEmu/Server/pull/3200)) @Kinglykrab 2023-04-05
* Multiple cases with same outcome in GetDiscordPayloadFromEvent() ([#3184](https://github.com/EQEmu/Server/pull/3184)) @Kinglykrab 2023-04-05
* Remove ExportVarComplex() from embparser.cpp/embparser.h ([#3282](https://github.com/EQEmu/Server/pull/3282)) @Kinglykrab 2023-04-14
* Remove GetQGlobal() from qglobals.cpp/qglobals.h ([#3285](https://github.com/EQEmu/Server/pull/3285)) @Kinglykrab 2023-04-14
* Remove IsFullHP from mob.cpp/mob.h ([#3277](https://github.com/EQEmu/Server/pull/3277)) @Kinglykrab 2023-04-14
* Remove IsMeleeDmg() from skills.cpp/skills.h ([#3279](https://github.com/EQEmu/Server/pull/3279)) @Kinglykrab 2023-04-14
* Remove _GetMovementSpeed() from mob.h ([#3276](https://github.com/EQEmu/Server/pull/3276)) @Kinglykrab 2023-04-14
* Remove always true condition in Strings::Commify() ([#3193](https://github.com/EQEmu/Server/pull/3193)) @Kinglykrab 2023-04-05
* Remove always true conditions and unreachable code in Client::SendMercPersonalInfo() ([#3258](https://github.com/EQEmu/Server/pull/3258)) @Kinglykrab 2023-04-05
* Remove always true statement in say_link.cpp ([#3188](https://github.com/EQEmu/Server/pull/3188)) @Kinglykrab 2023-04-05
* Remove always true statements in task_client_state.cpp ([#3292](https://github.com/EQEmu/Server/pull/3292)) @Kinglykrab 2023-04-14
* Remove always true/false conditions from bot.cpp ([#3237](https://github.com/EQEmu/Server/pull/3237)) @Kinglykrab 2023-04-05
* Remove bool return from GetSharedPlatinum() ([#3191](https://github.com/EQEmu/Server/pull/3191)) @Kinglykrab 2023-04-05
* Remove extra assignment of current_endurance in Client ctor ([#3261](https://github.com/EQEmu/Server/pull/3261)) @Kinglykrab 2023-04-05
* Remove extraneous check for NegateAttacks in SE_NegateAttacks ([#3228](https://github.com/EQEmu/Server/pull/3228)) @Kinglykrab 2023-04-05
* Remove extraneous parentheses around math in Mob::ApplySpellsBonuses() ([#3227](https://github.com/EQEmu/Server/pull/3227)) @Kinglykrab 2023-04-05
* Remove getd(), geti(), InUse(), lasterr(), my_get_sv(), and VarExists() in embperl.cpp/embperl.h ([#3283](https://github.com/EQEmu/Server/pull/3283)) @Kinglykrab 2023-04-15
* Remove item_timers from questmgr.cpp/questmgr.h ([#3286](https://github.com/EQEmu/Server/pull/3286)) @Kinglykrab 2023-04-14
* Remove pendinggroup from mob.h ([#3278](https://github.com/EQEmu/Server/pull/3278)) @Kinglykrab 2023-04-14
* Remove position_same_update_count from client.cpp/client.h ([#3280](https://github.com/EQEmu/Server/pull/3280)) @Kinglykrab 2023-04-14
* Remove unnecessary break in while loop in Mob::AddToHateList() ([#3219](https://github.com/EQEmu/Server/pull/3219)) @Kinglykrab 2023-04-05
* Remove unnecessary check for IsStackable() in DeleteItem() ([#3186](https://github.com/EQEmu/Server/pull/3186)) @Kinglykrab 2023-04-05
* Remove unnecessary condition and cleanup variable name in tasks.cpp ([#3293](https://github.com/EQEmu/Server/pull/3293)) @Kinglykrab 2023-04-14
* Remove unnecessary conditions in Client::Consume() ([#3265](https://github.com/EQEmu/Server/pull/3265)) @Kinglykrab 2023-04-05
* Remove unnecessary conditions in Client::FilteredMessageCheck() ([#3262](https://github.com/EQEmu/Server/pull/3262)) @Kinglykrab 2023-04-05
* Remove unnecessary conditions in Client::SendFactionMessage() ([#3267](https://github.com/EQEmu/Server/pull/3267)) @Kinglykrab 2023-04-05
* Remove unnecessary setting of reuse variable in Bot::DoClassAttacks() ([#3233](https://github.com/EQEmu/Server/pull/3233)) @Kinglykrab 2023-04-05
* Remove unused SetConfigFile in common/eqemu_config.h ([#3208](https://github.com/EQEmu/Server/pull/3208)) @Kinglykrab 2023-04-05
* Remove unused code in eq_packet.cpp/eq_packet.h ([#3183](https://github.com/EQEmu/Server/pull/3183)) @Kinglykrab 2023-04-05
* Remove unused ctor and use default dtor in xtargetautohaters.h ([#3290](https://github.com/EQEmu/Server/pull/3290)) @Kinglykrab 2023-04-14
* Remove unused macros in common/types.h ([#3194](https://github.com/EQEmu/Server/pull/3194)) @Kinglykrab 2023-04-05
* Remove unused variable in Database::CopyCharacter() ([#3197](https://github.com/EQEmu/Server/pull/3197)) @Kinglykrab 2023-04-05
* Remove unused variables and use reference in task_manager.cpp ([#3291](https://github.com/EQEmu/Server/pull/3291)) @Kinglykrab 2023-04-14
* SE_AttackSpeed3 effect_value is always less than 0 ([#3222](https://github.com/EQEmu/Server/pull/3222)) @Kinglykrab 2023-04-05
* SE_StrikeThrough and SE_StrikeThrough2 are the same in bonuses.cpp ([#3223](https://github.com/EQEmu/Server/pull/3223)) @Kinglykrab 2023-04-05
* Set bonuses to use spell ID instead of boolean ([#3230](https://github.com/EQEmu/Server/pull/3230)) @Kinglykrab 2023-04-05
* Use .clear() and .empty() instead of comparing to empty string or setting to empty string in CheckDatabaseConvertPPBlob() ([#3201](https://github.com/EQEmu/Server/pull/3201)) @Kinglykrab 2023-04-05
* Use .clear() instead of setting string to empty in eqemu_command_handler.cpp ([#3195](https://github.com/EQEmu/Server/pull/3195)) @Kinglykrab 2023-04-05
* Use .empty() in Client::ScribeSpells() and Client::LearnDisciplines() ([#3259](https://github.com/EQEmu/Server/pull/3259)) @Kinglykrab 2023-04-05
* Use constant reference and check for empty string properly in dbcore.cpp ([#3203](https://github.com/EQEmu/Server/pull/3203)) @Kinglykrab 2023-04-05
* Use default ctor instead of an empty ctor. ([#3206](https://github.com/EQEmu/Server/pull/3206)) @Kinglykrab 2023-04-05
* Use default dtor instead of empty dtor for EQTime in eqtime.cpp/eqtime.h ([#3210](https://github.com/EQEmu/Server/pull/3210)) @Kinglykrab 2023-04-05
* Use variable for c->GetTarget() instead of calling multiple times in bot_command.cpp ([#3254](https://github.com/EQEmu/Server/pull/3254)) @Kinglykrab 2023-04-05
* Use variable for character instead of a loop ([#3268](https://github.com/EQEmu/Server/pull/3268)) @Kinglykrab 2023-04-05
* Utilize .empty() instead of checking for an empty string in Database::ReserveName() ([#3198](https://github.com/EQEmu/Server/pull/3198)) @Kinglykrab 2023-04-05
* Utilize IsTaunting(), SetPetPower(), SetPetType(), and SetTaunting() ([#3275](https://github.com/EQEmu/Server/pull/3275)) @Kinglykrab 2023-04-15
* Validate for nullptrs in bot.cpp ([#3232](https://github.com/EQEmu/Server/pull/3232)) @Kinglykrab 2023-04-05
* other is always defined in these cases in attack.cpp ([#3217](https://github.com/EQEmu/Server/pull/3217)) @Kinglykrab 2023-04-05
* results variable is assigned but never used in SaveCharacterCreate() ([#3180](https://github.com/EQEmu/Server/pull/3180)) @Kinglykrab 2023-04-05
### Crash
* Add additional raid integrity checks on Bot Spawn. ([#3295](https://github.com/EQEmu/Server/pull/3295)) @Aeadoin 2023-04-16
* Fix crash with uninitialized item instance, and Bot timeout ([#3296](https://github.com/EQEmu/Server/pull/3296)) @Aeadoin 2023-04-15
* Resolve crash due to uninitialized pointer. ([#3271](https://github.com/EQEmu/Server/pull/3271)) @Aeadoin 2023-04-08
### Feature
* Make ornamentations work with any augment type ([#3281](https://github.com/EQEmu/Server/pull/3281)) @Kinglykrab 2023-04-16
### Fixes
* Camping was causing player to leave raid, causing unexpected behavior ([#3299](https://github.com/EQEmu/Server/pull/3299)) @Aeadoin 2023-04-22
* Resolve loading of inventory ([#3272](https://github.com/EQEmu/Server/pull/3272)) @Aeadoin 2023-04-08
### Quest API
* Add ApplySpellRaid() and SetSpellDurationRaid() to Bots in Perl/Lua ([#3274](https://github.com/EQEmu/Server/pull/3274)) @Kinglykrab 2023-04-09
* Add GetBuffSpellIDs() to Perl/Lua ([#3273](https://github.com/EQEmu/Server/pull/3273)) @Kinglykrab 2023-04-09
* Fix LDoN Methods in Perl/Lua ([#3287](https://github.com/EQEmu/Server/pull/3287)) @Kinglykrab 2023-04-10
### Rules
* Optional summoning when already in melee range ([#3204](https://github.com/EQEmu/Server/pull/3204)) @trentdm 2023-04-08
### Telnet
* Telnet encoding fix ([#3269](https://github.com/EQEmu/Server/pull/3269)) @Akkadius 2023-04-05
## [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
### Bots
* Remove Bot Groups Functionality ([#3165](https://github.com/EQEmu/Server/pull/3165)) @Aeadoin 2023-04-01
### Code
* Cleanup excessive type casting: string -> char * -> string ([#3169](https://github.com/EQEmu/Server/pull/3169)) @Aeadoin 2023-04-01
### Crash
* Add Checks for valid pointers or fix existing. ([#3164](https://github.com/EQEmu/Server/pull/3164)) @Aeadoin 2023-04-01
* Fix out of bound arrays, other potential crashes ([#3166](https://github.com/EQEmu/Server/pull/3166)) @Aeadoin 2023-04-01
### Fixes
* Correct SE_SlayUndead & SE_HeadShotLevel limit Value when applied. ([#3171](https://github.com/EQEmu/Server/pull/3171)) @Aeadoin 2023-04-01
* Prevent VerifyGroup from setting OOZ membername to Null character. ([#3168](https://github.com/EQEmu/Server/pull/3168)) @Aeadoin 2023-04-01
### Quest API
* Add missing Luabind definitions to lua_general.cpp ([#3167](https://github.com/EQEmu/Server/pull/3167)) @Kinglykrab 2023-04-01
## [22.8.2] - 03/30/2023
### Code
* "equipped" not "equiped", "dual" not "duel". ([#3149](https://github.com/EQEmu/Server/pull/3149)) @Kinglykrab 2023-03-27
### Crash
* Add Checks for out of bounds & dereferencing nullptrs ([#3151](https://github.com/EQEmu/Server/pull/3151)) @Aeadoin 2023-03-28
### Fixes
* Check Rule "Bots Enabled" to prevent bot database calls on connect ([#3154](https://github.com/EQEmu/Server/pull/3154)) @Aeadoin 2023-03-29
* Correct logic checks for Bot rule AllowOwnerOptionAltCombat ([#3158](https://github.com/EQEmu/Server/pull/3158)) @Aeadoin 2023-03-30
* Fix an issue with EVENT_DISCONNECT not firing on regular /camp ([#3153](https://github.com/EQEmu/Server/pull/3153)) @Kinglykrab 2023-03-28
* Fix bot_raid_members.sql for MYSQL. ([#3155](https://github.com/EQEmu/Server/pull/3155)) @Aeadoin 2023-03-28
* Fix for OOZ Group updates when removing/inviting Bots ([#3159](https://github.com/EQEmu/Server/pull/3159)) @Aeadoin 2023-03-30
* Fix issues with Lua tables not starting at index 1 ([#3160](https://github.com/EQEmu/Server/pull/3160)) @Kinglykrab 2023-03-30
* Fix strcpy-param-overlap ([#3157](https://github.com/EQEmu/Server/pull/3157)) @Aeadoin 2023-03-29
### Rules
* Remove Guild Bank Zone ID Rule ([#3156](https://github.com/EQEmu/Server/pull/3156)) @Kinglykrab 2023-03-29
## [22.8.1] - 03/27/2023
### Fixes
* Fix for NPCs having spells interrupted. ([#3150](https://github.com/EQEmu/Server/pull/3150)) @Aeadoin 2023-03-27
## [22.8.0] - 03/25/2023
### Code
* Cleanup Strings::ToInt uses. ([#3142](https://github.com/EQEmu/Server/pull/3142)) @Aeadoin 2023-03-26
* Remove extern bool Critical ([#3146](https://github.com/EQEmu/Server/pull/3146)) @Kinglykrab 2023-03-25
### Crash
* Fix for crash in Raid::QueuePacket ([#3145](https://github.com/EQEmu/Server/pull/3145)) @Aeadoin 2023-03-25
### Feature
* Add support for -1 extradmgskill to allow all skills to be scaled. ([#3136](https://github.com/EQEmu/Server/pull/3136)) @Kinglykrab 2023-03-26
### Fixes
* Fix for Items looted from corpses. ([#3147](https://github.com/EQEmu/Server/pull/3147)) @Aeadoin 2023-03-26
* Fix for SQL Query in npc_scale_global_base ([#3144](https://github.com/EQEmu/Server/pull/3144)) @Aeadoin 2023-03-26
## [22.7.0] - 03/24/2023 ## [22.7.0] - 03/24/2023
### Bots ### Bots
+1 -1
View File
@@ -160,7 +160,7 @@ namespace EQEmuCommand {
*/ */
std::string command_section; std::string command_section;
for (auto &it: in_function_map) { for (auto &it: in_function_map) {
description = ""; description.clear();
(it.second)(argc, argv, cmd, description); (it.second)(argc, argv, cmd, description);
+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 -4
View File
@@ -41,9 +41,6 @@ void SendCrashReport(const std::string &crash_report)
r.set_connection_timeout(1, 0); r.set_connection_timeout(1, 0);
r.set_read_timeout(1, 0); r.set_read_timeout(1, 0);
r.set_write_timeout(1, 0); r.set_write_timeout(1, 0);
httplib::Headers headers = {
{"Content-Type", "application/json"}
};
// os info // os info
auto os = EQ::GetOS(); auto os = EQ::GetOS();
@@ -125,7 +122,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;
}; };
+50 -31
View File
@@ -353,7 +353,7 @@ bool Database::ReserveName(uint32 account_id, char* name) {
query = StringFormat("INSERT INTO `character_data` SET `account_id` = %i, `name` = '%s'", account_id, name); query = StringFormat("INSERT INTO `character_data` SET `account_id` = %i, `name` = '%s'", account_id, name);
results = QueryDatabase(query); results = QueryDatabase(query);
if (!results.Success() || results.ErrorMessage() != ""){ return false; } if (!results.Success() || !results.ErrorMessage().empty()){ return false; }
// Put character into the default guild if rule is being used. // Put character into the default guild if rule is being used.
int guild_id = RuleI(Character, DefaultGuild); int guild_id = RuleI(Character, DefaultGuild);
@@ -363,7 +363,7 @@ bool Database::ReserveName(uint32 account_id, char* name) {
if (character_id > -1) { if (character_id > -1) {
query = StringFormat("INSERT INTO `guild_members` SET `char_id` = %i, `guild_id` = '%i'", character_id, guild_id); query = StringFormat("INSERT INTO `guild_members` SET `char_id` = %i, `guild_id` = '%i'", character_id, guild_id);
results = QueryDatabase(query); results = QueryDatabase(query);
if (!results.Success() || results.ErrorMessage() != ""){ if (!results.Success() || !results.ErrorMessage().empty()){
LogInfo("Could not put character [{}] into default Guild", name); LogInfo("Could not put character [{}] into default Guild", name);
} }
} }
@@ -449,7 +449,8 @@ bool Database::DeleteCharacter(char *character_name)
return true; return true;
} }
bool Database::SaveCharacterCreate(uint32 character_id, uint32 account_id, PlayerProfile_Struct* pp){ bool Database::SaveCharacterCreate(uint32 character_id, uint32 account_id, PlayerProfile_Struct *pp)
{
std::string query = StringFormat( std::string query = StringFormat(
"REPLACE INTO `character_data` (" "REPLACE INTO `character_data` ("
"id," "id,"
@@ -725,10 +726,11 @@ bool Database::SaveCharacterCreate(uint32 character_id, uint32 account_id, Playe
pp->guildAutoconsent, // " guild_auto_consent, " pp->guildAutoconsent, // " guild_auto_consent, "
pp->RestTimer // " RestTimer) " pp->RestTimer // " RestTimer) "
); );
auto results = QueryDatabase(query); QueryDatabase(query);
/* Save Bind Points */ /* Save Bind Points */
query = StringFormat("REPLACE INTO `character_bind` (id, zone_id, instance_id, x, y, z, heading, slot)" query = StringFormat(
"REPLACE INTO `character_bind` (id, zone_id, instance_id, x, y, z, heading, slot)"
" VALUES (%u, %u, %u, %f, %f, %f, %f, %i), " " VALUES (%u, %u, %u, %f, %f, %f, %f, %i), "
"(%u, %u, %u, %f, %f, %f, %f, %i), " "(%u, %u, %u, %f, %f, %f, %f, %i), "
"(%u, %u, %u, %f, %f, %f, %f, %i), " "(%u, %u, %u, %f, %f, %f, %f, %i), "
@@ -739,13 +741,18 @@ bool Database::SaveCharacterCreate(uint32 character_id, uint32 account_id, Playe
character_id, pp->binds[2].zone_id, 0, pp->binds[2].x, pp->binds[2].y, pp->binds[2].z, pp->binds[2].heading, 2, character_id, pp->binds[2].zone_id, 0, pp->binds[2].x, pp->binds[2].y, pp->binds[2].z, pp->binds[2].heading, 2,
character_id, pp->binds[3].zone_id, 0, pp->binds[3].x, pp->binds[3].y, pp->binds[3].z, pp->binds[3].heading, 3, character_id, pp->binds[3].zone_id, 0, pp->binds[3].x, pp->binds[3].y, pp->binds[3].z, pp->binds[3].heading, 3,
character_id, pp->binds[4].zone_id, 0, pp->binds[4].x, pp->binds[4].y, pp->binds[4].z, pp->binds[4].heading, 4 character_id, pp->binds[4].zone_id, 0, pp->binds[4].x, pp->binds[4].y, pp->binds[4].z, pp->binds[4].heading, 4
); results = QueryDatabase(query); );
QueryDatabase(query);
/* HoTT Ability */ /* HoTT Ability */
if(RuleB(Character, GrantHoTTOnCreate)) if (RuleB(Character, GrantHoTTOnCreate)) {
{ query = StringFormat(
query = StringFormat("INSERT INTO `character_leadership_abilities` (id, slot, `rank`) VALUES (%u, %i, %i)", character_id, 14, 1); "INSERT INTO `character_leadership_abilities` (id, slot, `rank`) VALUES (%u, %i, %i)",
results = QueryDatabase(query); character_id,
14,
1
);
QueryDatabase(query);
} }
/* Save Skills */ /* Save Skills */
@@ -754,14 +761,18 @@ bool Database::SaveCharacterCreate(uint32 character_id, uint32 account_id, Playe
if (pp->skills[i] > 0) { if (pp->skills[i] > 0) {
if (firstquery != 1) { if (firstquery != 1) {
firstquery = 1; firstquery = 1;
query = StringFormat("REPLACE INTO `character_skills` (id, skill_id, value) VALUES (%u, %u, %u)", character_id, i, pp->skills[i]); query = StringFormat(
} "REPLACE INTO `character_skills` (id, skill_id, value) VALUES (%u, %u, %u)",
else{ character_id,
i,
pp->skills[i]
);
} else {
query = query + StringFormat(", (%u, %u, %u)", character_id, i, pp->skills[i]); query = query + StringFormat(", (%u, %u, %u)", character_id, i, pp->skills[i]);
} }
} }
} }
results = QueryDatabase(query); QueryDatabase(query);
/* Save Language */ /* Save Language */
firstquery = 0; firstquery = 0;
@@ -769,29 +780,36 @@ bool Database::SaveCharacterCreate(uint32 character_id, uint32 account_id, Playe
if (pp->languages[i] > 0) { if (pp->languages[i] > 0) {
if (firstquery != 1) { if (firstquery != 1) {
firstquery = 1; firstquery = 1;
query = StringFormat("REPLACE INTO `character_languages` (id, lang_id, value) VALUES (%u, %u, %u)", character_id, i, pp->languages[i]); query = StringFormat(
} "REPLACE INTO `character_languages` (id, lang_id, value) VALUES (%u, %u, %u)",
else{ character_id,
i,
pp->languages[i]
);
} else {
query = query + StringFormat(", (%u, %u, %u)", character_id, i, pp->languages[i]); query = query + StringFormat(", (%u, %u, %u)", character_id, i, pp->languages[i]);
} }
} }
} }
results = QueryDatabase(query); QueryDatabase(query);
return true; return true;
} }
uint32 Database::GetCharacterID(const char *name) { uint32 Database::GetCharacterID(const char *name) {
std::string query = StringFormat("SELECT `id` FROM `character_data` WHERE `name` = '%s'", name); const auto query = fmt::format(
"SELECT `id` FROM `character_data` WHERE `name` = '{}'",
Strings::Escape(name)
);
auto results = QueryDatabase(query); auto results = QueryDatabase(query);
auto row = results.begin(); if (!results.Success() || !results.RowCount()) {
if (results.RowCount() == 1)
{
return Strings::ToUnsignedInt(row[0]);
}
return 0; return 0;
} }
auto row = results.begin();
return Strings::ToUnsignedInt(row[0]);
}
/* /*
This function returns the account_id that owns the character with This function returns the account_id that owns the character with
the name "name" or zero if no character with that name was found the name "name" or zero if no character with that name was found
@@ -812,7 +830,7 @@ uint32 Database::GetAccountIDByChar(const char* charname, uint32* oCharID) {
auto row = results.begin(); auto row = results.begin();
uint32 accountId = Strings::ToInt(row[0]); uint32 accountId = Strings::ToUnsignedInt(row[0]);
if (oCharID) if (oCharID)
*oCharID = Strings::ToUnsignedInt(row[1]); *oCharID = Strings::ToUnsignedInt(row[1]);
@@ -999,7 +1017,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,12 +2061,14 @@ 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() {
std::string query = StringFormat("SELECT COUNT(*) FROM (SELECT * FROM `inventory_snapshots` a GROUP BY `charid`, `time_index`) b"); std::string query = StringFormat("SELECT COUNT(*) FROM (SELECT * FROM `inventory_snapshots` a GROUP BY `charid`, `time_index`) b");
auto results = QueryDatabase(query); auto results = QueryDatabase(query);
@@ -2272,7 +2292,6 @@ bool Database::CopyCharacter(
new_rows.emplace_back(new_values); new_rows.emplace_back(new_values);
} }
std::string insert_values;
std::vector<std::string> insert_rows; std::vector<std::string> insert_rows;
for (auto &r: new_rows) { for (auto &r: new_rows) {
@@ -2345,7 +2364,7 @@ void Database::SourceDatabaseTableFromUrl(std::string table_name, std::string ur
int sourced_queries = 0; int sourced_queries = 0;
if (auto res = cli.Get(request_uri.get_path().c_str())) { if (auto res = cli.Get(request_uri.get_path())) {
if (res->status == 200) { if (res->status == 200) {
for (auto &s: Strings::Split(res->body, ';')) { for (auto &s: Strings::Split(res->body, ';')) {
if (!Strings::Trim(s).empty()) { if (!Strings::Trim(s).empty()) {
+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 */
+41 -9
View File
@@ -28,6 +28,7 @@
#include "../database_schema.h" #include "../database_schema.h"
#include "../file.h" #include "../file.h"
#include "../process/process.h" #include "../process/process.h"
#include "../termcolor/rang.hpp"
#include <ctime> #include <ctime>
@@ -36,6 +37,7 @@
#else #else
#include <sys/time.h> #include <sys/time.h>
#include <thread>
#endif #endif
@@ -199,7 +201,7 @@ std::string DatabaseDumpService::GetDumpFileNameWithPath()
return GetSetDumpPath() + GetDumpFileName(); return GetSetDumpPath() + GetDumpFileName();
} }
void DatabaseDumpService::Dump() void DatabaseDumpService::DatabaseDump()
{ {
if (!IsMySQLInstalled()) { if (!IsMySQLInstalled()) {
LogError("MySQL is not installed; Please check your PATH for a valid MySQL installation"); LogError("MySQL is not installed; Please check your PATH for a valid MySQL installation");
@@ -293,14 +295,6 @@ void DatabaseDumpService::Dump()
pipe_file = fmt::format(" > {}.sql", GetDumpFileNameWithPath()); pipe_file = fmt::format(" > {}.sql", GetDumpFileNameWithPath());
} }
std::string execute_command = fmt::format(
"{} {} {} {}",
GetBaseMySQLDumpCommand(),
options,
tables_to_dump,
pipe_file
);
if (!File::Exists(GetSetDumpPath()) && !IsDumpOutputToConsole()) { if (!File::Exists(GetSetDumpPath()) && !IsDumpOutputToConsole()) {
File::Makedir(GetSetDumpPath()); File::Makedir(GetSetDumpPath());
} }
@@ -317,12 +311,40 @@ void DatabaseDumpService::Dump()
} }
} }
else { else {
const auto execute_command = fmt::format(
"{} {} {} {}",
GetBaseMySQLDumpCommand(),
options,
tables_to_dump,
pipe_file
);
std::string execution_result = Process::execute(execute_command); std::string execution_result = Process::execute(execute_command);
if (!execution_result.empty() && IsDumpOutputToConsole()) { if (!execution_result.empty() && IsDumpOutputToConsole()) {
std::cout << execution_result; std::cout << execution_result;
} }
} }
LogSys.EnableConsoleLogging();
if (!pipe_file.empty()) {
std::string file = fmt::format("{}.sql", GetDumpFileNameWithPath());
auto r = File::GetContents(file);
if (!r.error.empty()) {
LogError("{}", r.error);
}
for (auto &line: Strings::Split(r.contents, "\n")) {
if (Strings::Contains(line, "mysqldump:")) {
LogError("{}", line);
LogError("Database dump failed. Correct the error before continuing or trying again");
LogError("This is to prevent data loss on behalf of the server operator");
RemoveSqlBackup();
std::exit(1);
}
}
}
if (!tables_to_dump.empty()) { if (!tables_to_dump.empty()) {
LogInfo("Dumping Tables [{}]", Strings::Trim(tables_to_dump)); LogInfo("Dumping Tables [{}]", Strings::Trim(tables_to_dump));
} }
@@ -343,6 +365,7 @@ void DatabaseDumpService::Dump()
) )
); );
LogInfo("Compressed dump created at [{}.tar.gz]", GetDumpFileNameWithPath()); LogInfo("Compressed dump created at [{}.tar.gz]", GetDumpFileNameWithPath());
RemoveSqlBackup();
} }
else if (Is7ZipAvailable()) { else if (Is7ZipAvailable()) {
Process::execute( Process::execute(
@@ -353,6 +376,7 @@ void DatabaseDumpService::Dump()
) )
); );
LogInfo("Compressed dump created at [{}.zip]", GetDumpFileNameWithPath()); LogInfo("Compressed dump created at [{}.zip]", GetDumpFileNameWithPath());
RemoveSqlBackup();
} }
else { else {
LogInfo("Compression requested, but no available compression binary was found"); LogInfo("Compression requested, but no available compression binary was found");
@@ -535,3 +559,11 @@ void DatabaseDumpService::SetDumpMercTables(bool dump_merc_tables)
{ {
DatabaseDumpService::dump_merc_tables = dump_merc_tables; DatabaseDumpService::dump_merc_tables = dump_merc_tables;
} }
void DatabaseDumpService::RemoveSqlBackup()
{
std::string file = fmt::format("{}.sql", GetDumpFileNameWithPath());
if (File::Exists(file)) {
std::filesystem::remove(file);
}
}
+2 -1
View File
@@ -24,7 +24,7 @@
class DatabaseDumpService { class DatabaseDumpService {
public: public:
void Dump(); void DatabaseDump();
bool IsDumpAllTables() const; bool IsDumpAllTables() const;
void SetDumpAllTables(bool dump_all_tables); void SetDumpAllTables(bool dump_all_tables);
bool IsDumpWithNoData() const; bool IsDumpWithNoData() const;
@@ -92,6 +92,7 @@ private:
std::string GetDumpFileNameWithPath(); std::string GetDumpFileNameWithPath();
std::string GetSetDumpPath(); std::string GetSetDumpPath();
std::string GetQueryServTables(); std::string GetQueryServTables();
void RemoveSqlBackup();
}; };
+34 -34
View File
@@ -499,7 +499,7 @@ bool Database::CheckDatabaseConvertPPDeblob(){
ExtendedProfile_Struct* e_pp; ExtendedProfile_Struct* e_pp;
uint32 pplen = 0; uint32 pplen = 0;
uint32 i; uint32 i;
int character_id = 0; uint32 character_id = 0;
int account_id = 0; int account_id = 0;
int number_of_characters = 0; int number_of_characters = 0;
int printppdebug = 0; /* Prints Player Profile */ int printppdebug = 0; /* Prints Player Profile */
@@ -929,12 +929,12 @@ bool Database::CheckDatabaseConvertPPDeblob(){
for (auto row = results.begin(); row != results.end(); ++row) { for (auto row = results.begin(); row != results.end(); ++row) {
char_iter_count++; char_iter_count++;
squery = StringFormat("SELECT `id`, `profile`, `name`, `level`, `account_id`, `firstlogon`, `lfg`, `lfp`, `mailkey`, `xtargets`, `inspectmessage`, `extprofile` FROM `character_` WHERE `id` = %i", Strings::ToInt(row[0])); squery = StringFormat("SELECT `id`, `profile`, `name`, `level`, `account_id`, `firstlogon`, `lfg`, `lfp`, `mailkey`, `xtargets`, `inspectmessage`, `extprofile` FROM `character_` WHERE `id` = %i", Strings::ToUnsignedInt(row[0]));
auto results2 = QueryDatabase(squery); auto results2 = QueryDatabase(squery);
auto row2 = results2.begin(); auto row2 = results2.begin();
pp = (Convert::PlayerProfile_Struct*)row2[1]; pp = (Convert::PlayerProfile_Struct*)row2[1];
e_pp = (ExtendedProfile_Struct*)row2[11]; e_pp = (ExtendedProfile_Struct*)row2[11];
character_id = Strings::ToInt(row[0]); character_id = Strings::ToUnsignedInt(row[0]);
account_id = Strings::ToInt(row2[4]); account_id = Strings::ToInt(row2[4]);
/* Convert some data from the character_ table that is still relevant */ /* Convert some data from the character_ table that is still relevant */
firstlogon = Strings::ToUnsignedInt(row2[5]); firstlogon = Strings::ToUnsignedInt(row2[5]);
@@ -967,7 +967,7 @@ bool Database::CheckDatabaseConvertPPDeblob(){
loadbar(char_iter_count, number_of_characters, 50); loadbar(char_iter_count, number_of_characters, 50);
/* Run inspect message convert */ /* Run inspect message convert */
if (inspectmessage != ""){ if (!inspectmessage.empty()){
std::string rquery = StringFormat("REPLACE INTO `character_inspect_messages` (id, inspect_message)" std::string rquery = StringFormat("REPLACE INTO `character_inspect_messages` (id, inspect_message)"
"VALUES (%u, '%s')", "VALUES (%u, '%s')",
character_id, character_id,
@@ -1314,7 +1314,7 @@ bool Database::CheckDatabaseConvertPPDeblob(){
The speed difference is dramatic The speed difference is dramatic
*/ */
/* Run AA Convert */ /* Run AA Convert */
int first_entry = 0; rquery = ""; int first_entry = 0; rquery.clear();
for (i = 0; i < MAX_PP_AA_ARRAY; i++){ for (i = 0; i < MAX_PP_AA_ARRAY; i++){
if (pp->aa_array[i].AA > 0 && pp->aa_array[i].value > 0){ if (pp->aa_array[i].AA > 0 && pp->aa_array[i].value > 0){
if (first_entry != 1){ if (first_entry != 1){
@@ -1327,14 +1327,14 @@ bool Database::CheckDatabaseConvertPPDeblob(){
} }
} }
} }
if (rquery != ""){ results = QueryDatabase(rquery); } if (!rquery.empty()){ results = QueryDatabase(rquery); }
/* Run Bind Home Convert */ /* Run Bind Home Convert */
if (pp->binds[4].zone_id < 999 && !_ISNAN_(pp->binds[4].x) && !_ISNAN_(pp->binds[4].y) && !_ISNAN_(pp->binds[4].z) && !_ISNAN_(pp->binds[4].heading)) { if (pp->binds[4].zone_id < 999 && !_ISNAN_(pp->binds[4].x) && !_ISNAN_(pp->binds[4].y) && !_ISNAN_(pp->binds[4].z) && !_ISNAN_(pp->binds[4].heading)) {
rquery = StringFormat("REPLACE INTO `character_bind` (id, zone_id, instance_id, x, y, z, heading, is_home)" rquery = StringFormat("REPLACE INTO `character_bind` (id, zone_id, instance_id, x, y, z, heading, is_home)"
" VALUES (%u, %u, %u, %f, %f, %f, %f, 1)", " VALUES (%u, %u, %u, %f, %f, %f, %f, 1)",
character_id, pp->binds[4].zone_id, 0, pp->binds[4].x, pp->binds[4].y, pp->binds[4].z, pp->binds[4].heading); character_id, pp->binds[4].zone_id, 0, pp->binds[4].x, pp->binds[4].y, pp->binds[4].z, pp->binds[4].heading);
if (rquery != ""){ results = QueryDatabase(rquery); } if (!rquery.empty()){ results = QueryDatabase(rquery); }
} }
/* Run Bind Convert */ /* Run Bind Convert */
@@ -1342,10 +1342,10 @@ bool Database::CheckDatabaseConvertPPDeblob(){
rquery = StringFormat("REPLACE INTO `character_bind` (id, zone_id, instance_id, x, y, z, heading, is_home)" rquery = StringFormat("REPLACE INTO `character_bind` (id, zone_id, instance_id, x, y, z, heading, is_home)"
" VALUES (%u, %u, %u, %f, %f, %f, %f, 0)", " VALUES (%u, %u, %u, %f, %f, %f, %f, 0)",
character_id, pp->binds[0].zone_id, 0, pp->binds[0].x, pp->binds[0].y, pp->binds[0].z, pp->binds[0].heading); character_id, pp->binds[0].zone_id, 0, pp->binds[0].x, pp->binds[0].y, pp->binds[0].z, pp->binds[0].heading);
if (rquery != ""){ results = QueryDatabase(rquery); } if (!rquery.empty()){ results = QueryDatabase(rquery); }
} }
/* Run Language Convert */ /* Run Language Convert */
first_entry = 0; rquery = ""; first_entry = 0; rquery.clear();
for (i = 0; i < MAX_PP_LANGUAGE; i++){ for (i = 0; i < MAX_PP_LANGUAGE; i++){
if (pp->languages[i] > 0){ if (pp->languages[i] > 0){
if (first_entry != 1){ if (first_entry != 1){
@@ -1355,9 +1355,9 @@ bool Database::CheckDatabaseConvertPPDeblob(){
rquery = rquery + StringFormat(", (%u, %u, %u)", character_id, i, pp->languages[i]); rquery = rquery + StringFormat(", (%u, %u, %u)", character_id, i, pp->languages[i]);
} }
} }
if (rquery != ""){ results = QueryDatabase(rquery); } if (!rquery.empty()){ results = QueryDatabase(rquery); }
/* Run Skill Convert */ /* Run Skill Convert */
first_entry = 0; rquery = ""; first_entry = 0; rquery.clear();
for (i = 0; i < MAX_PP_SKILL; i++){ for (i = 0; i < MAX_PP_SKILL; i++){
if (pp->skills[i] > 0){ if (pp->skills[i] > 0){
if (first_entry != 1){ if (first_entry != 1){
@@ -1367,9 +1367,9 @@ bool Database::CheckDatabaseConvertPPDeblob(){
rquery = rquery + StringFormat(", (%u, %u, %u)", character_id, i, pp->skills[i]); rquery = rquery + StringFormat(", (%u, %u, %u)", character_id, i, pp->skills[i]);
} }
} }
if (rquery != ""){ results = QueryDatabase(rquery); } if (!rquery.empty()){ results = QueryDatabase(rquery); }
/* Run Spell Convert */ /* Run Spell Convert */
first_entry = 0; rquery = ""; first_entry = 0; rquery.clear();
for (i = 0; i < 480; i++){ for (i = 0; i < 480; i++){
if (pp->spell_book[i] > 0 && pp->spell_book[i] != 4294967295 && pp->spell_book[i] < 40000 && pp->spell_book[i] != 1){ if (pp->spell_book[i] > 0 && pp->spell_book[i] != 4294967295 && pp->spell_book[i] < 40000 && pp->spell_book[i] != 1){
if (first_entry != 1){ if (first_entry != 1){
@@ -1379,9 +1379,9 @@ bool Database::CheckDatabaseConvertPPDeblob(){
rquery = rquery + StringFormat(", (%u, %u, %u)", character_id, i, pp->spell_book[i]); rquery = rquery + StringFormat(", (%u, %u, %u)", character_id, i, pp->spell_book[i]);
} }
} }
if (rquery != ""){ results = QueryDatabase(rquery); } if (!rquery.empty()){ results = QueryDatabase(rquery); }
/* Run Max Memmed Spell Convert */ /* Run Max Memmed Spell Convert */
first_entry = 0; rquery = ""; first_entry = 0; rquery.clear();
for (i = 0; i < 9; i++){ for (i = 0; i < 9; i++){
if (pp->mem_spells[i] > 0 && pp->mem_spells[i] != 65535 && pp->mem_spells[i] != 4294967295){ if (pp->mem_spells[i] > 0 && pp->mem_spells[i] != 65535 && pp->mem_spells[i] != 4294967295){
if (first_entry != 1){ if (first_entry != 1){
@@ -1391,9 +1391,9 @@ bool Database::CheckDatabaseConvertPPDeblob(){
rquery = rquery + StringFormat(", (%u, %u, %u)", character_id, i, pp->mem_spells[i]); rquery = rquery + StringFormat(", (%u, %u, %u)", character_id, i, pp->mem_spells[i]);
} }
} }
if (rquery != ""){ results = QueryDatabase(rquery); } if (!rquery.empty()){ results = QueryDatabase(rquery); }
/* Run Discipline Convert */ /* Run Discipline Convert */
first_entry = 0; rquery = ""; first_entry = 0; rquery.clear();
for (i = 0; i < MAX_PP_DISCIPLINES; i++){ for (i = 0; i < MAX_PP_DISCIPLINES; i++){
if (pp->disciplines.values[i] > 0 && pp->disciplines.values[i] < 60000){ if (pp->disciplines.values[i] > 0 && pp->disciplines.values[i] < 60000){
if (first_entry != 1){ if (first_entry != 1){
@@ -1403,9 +1403,9 @@ bool Database::CheckDatabaseConvertPPDeblob(){
rquery = rquery + StringFormat(", (%u, %u, %u)", character_id, i, pp->disciplines.values[i]); rquery = rquery + StringFormat(", (%u, %u, %u)", character_id, i, pp->disciplines.values[i]);
} }
} }
if (rquery != ""){ results = QueryDatabase(rquery); } if (!rquery.empty()){ results = QueryDatabase(rquery); }
/* Run Material Color Convert */ /* Run Material Color Convert */
first_entry = 0; rquery = ""; first_entry = 0; rquery.clear();
for (i = EQ::textures::textureBegin; i < EQ::textures::materialCount; i++){ for (i = EQ::textures::textureBegin; i < EQ::textures::materialCount; i++){
if (pp->item_tint[i].color > 0){ if (pp->item_tint[i].color > 0){
if (first_entry != 1){ if (first_entry != 1){
@@ -1415,9 +1415,9 @@ bool Database::CheckDatabaseConvertPPDeblob(){
rquery = rquery + StringFormat(", (%u, %u, %u, %u, %u, %u, %u)", character_id, i, pp->item_tint[i].rgb.blue, pp->item_tint[i].rgb.green, pp->item_tint[i].rgb.red, pp->item_tint[i].rgb.use_tint, pp->item_tint[i].color); rquery = rquery + StringFormat(", (%u, %u, %u, %u, %u, %u, %u)", character_id, i, pp->item_tint[i].rgb.blue, pp->item_tint[i].rgb.green, pp->item_tint[i].rgb.red, pp->item_tint[i].rgb.use_tint, pp->item_tint[i].color);
} }
} }
if (rquery != ""){ results = QueryDatabase(rquery); } if (!rquery.empty()){ results = QueryDatabase(rquery); }
/* Run Tribute Convert */ /* Run Tribute Convert */
first_entry = 0; rquery = ""; first_entry = 0; rquery.clear();
for (i = 0; i < 5; i++){ for (i = 0; i < 5; i++){
if (pp->tributes[i].tribute > 0 && pp->tributes[i].tribute != 4294967295){ if (pp->tributes[i].tribute > 0 && pp->tributes[i].tribute != 4294967295){
if (first_entry != 1){ if (first_entry != 1){
@@ -1427,9 +1427,9 @@ bool Database::CheckDatabaseConvertPPDeblob(){
rquery = rquery + StringFormat(", (%u, %u, %u)", character_id, pp->tributes[i].tier, pp->tributes[i].tribute); rquery = rquery + StringFormat(", (%u, %u, %u)", character_id, pp->tributes[i].tier, pp->tributes[i].tribute);
} }
} }
if (rquery != ""){ results = QueryDatabase(rquery); } if (!rquery.empty()){ results = QueryDatabase(rquery); }
/* Run Bandolier Convert */ /* Run Bandolier Convert */
first_entry = 0; rquery = ""; first_entry = 0; rquery.clear();
for (i = 0; i < Convert::BANDOLIERS_SIZE; i++){ for (i = 0; i < Convert::BANDOLIERS_SIZE; i++){
if (strlen(pp->bandoliers[i].Name) < 32) { if (strlen(pp->bandoliers[i].Name) < 32) {
for (int si = 0; si < Convert::BANDOLIER_ITEM_COUNT; si++){ for (int si = 0; si < Convert::BANDOLIER_ITEM_COUNT; si++){
@@ -1443,9 +1443,9 @@ bool Database::CheckDatabaseConvertPPDeblob(){
} }
} }
} }
if (rquery != ""){ results = QueryDatabase(rquery); } if (!rquery.empty()){ results = QueryDatabase(rquery); }
/* Run Potion Belt Convert */ /* Run Potion Belt Convert */
first_entry = 0; rquery = ""; first_entry = 0; rquery.clear();
for (i = 0; i < Convert::POTION_BELT_ITEM_COUNT; i++){ for (i = 0; i < Convert::POTION_BELT_ITEM_COUNT; i++){
if (pp->potionbelt.Items[i].ID > 0){ if (pp->potionbelt.Items[i].ID > 0){
if (first_entry != 1){ if (first_entry != 1){
@@ -1456,9 +1456,9 @@ bool Database::CheckDatabaseConvertPPDeblob(){
} }
} }
if (rquery != ""){ results = QueryDatabase(rquery); } if (!rquery.empty()){ results = QueryDatabase(rquery); }
/* Run Leadership AA Convert */ /* Run Leadership AA Convert */
first_entry = 0; rquery = ""; first_entry = 0; rquery.clear();
for (i = 0; i < MAX_LEADERSHIP_AA_ARRAY; i++){ for (i = 0; i < MAX_LEADERSHIP_AA_ARRAY; i++){
if (pp->leader_abilities.ranks[i] > 0 && pp->leader_abilities.ranks[i] < 6){ if (pp->leader_abilities.ranks[i] > 0 && pp->leader_abilities.ranks[i] < 6){
if (first_entry != 1){ if (first_entry != 1){
@@ -1468,7 +1468,7 @@ bool Database::CheckDatabaseConvertPPDeblob(){
rquery = rquery + StringFormat(", (%i, %u, %u)", character_id, i, pp->leader_abilities.ranks[i]); rquery = rquery + StringFormat(", (%i, %u, %u)", character_id, i, pp->leader_abilities.ranks[i]);
} }
} }
if (rquery != ""){ results = QueryDatabase(rquery); } if (!rquery.empty()){ results = QueryDatabase(rquery); }
} }
} }
if (runconvert == 1){ if (runconvert == 1){
@@ -1672,10 +1672,10 @@ bool Database::CheckDatabaseConvertCorpseDeblob(){
dbpc->item_tint[8].color, dbpc->item_tint[8].color,
Strings::ToUnsignedInt(row2[0]) Strings::ToUnsignedInt(row2[0])
); );
if (scquery != ""){ auto sc_results = QueryDatabase(scquery); } if (!scquery.empty()){ auto sc_results = QueryDatabase(scquery); }
first_entry = 0; first_entry = 0;
scquery = ""; scquery.clear();
/* Print Items */ /* Print Items */
for (unsigned int i = 0; i < dbpc->itemcount; i++) { for (unsigned int i = 0; i < dbpc->itemcount; i++) {
if (first_entry != 1){ if (first_entry != 1){
@@ -1712,7 +1712,7 @@ bool Database::CheckDatabaseConvertCorpseDeblob(){
); );
} }
} }
if (scquery != ""){ auto sc_results = QueryDatabase(scquery); } if (!scquery.empty()){ auto sc_results = QueryDatabase(scquery); }
} }
else{ else{
/* Classic Converter */ /* Classic Converter */
@@ -1780,10 +1780,10 @@ bool Database::CheckDatabaseConvertCorpseDeblob(){
dbpc_c->item_tint[8].color, dbpc_c->item_tint[8].color,
Strings::ToUnsignedInt(row2[0]) Strings::ToUnsignedInt(row2[0])
); );
if (scquery != ""){ auto sc_results = QueryDatabase(scquery); } if (!scquery.empty()){ auto sc_results = QueryDatabase(scquery); }
first_entry = 0; first_entry = 0;
scquery = ""; scquery.clear();
/* Print Items */ /* Print Items */
for (unsigned int i = 0; i < dbpc_c->itemcount; i++) { for (unsigned int i = 0; i < dbpc_c->itemcount; i++) {
@@ -1821,7 +1821,7 @@ bool Database::CheckDatabaseConvertCorpseDeblob(){
); );
} }
} }
if (scquery != ""){ auto sc_results = QueryDatabase(scquery); } if (!scquery.empty()){ auto sc_results = QueryDatabase(scquery); }
} }
} }
} }
-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));
-3
View File
@@ -392,9 +392,6 @@ namespace DatabaseSchema {
"bot_command_settings", "bot_command_settings",
"bot_create_combinations", "bot_create_combinations",
"bot_data", "bot_data",
"bot_group_members",
"bot_groups",
"bot_guild_members",
"bot_heal_rotation_members", "bot_heal_rotation_members",
"bot_heal_rotation_targets", "bot_heal_rotation_targets",
"bot_heal_rotations", "bot_heal_rotations",
+3 -3
View File
@@ -74,13 +74,13 @@ 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;
} }
bool DBcore::DoesTableExist(std::string table_name) bool DBcore::DoesTableExist(const std::string& table_name)
{ {
auto results = QueryDatabase(fmt::format("SHOW TABLES LIKE '{}'", table_name)); auto results = QueryDatabase(fmt::format("SHOW TABLES LIKE '{}'", table_name));
@@ -136,7 +136,7 @@ MySQLRequestResult DBcore::QueryDatabase(const char *query, uint32 querylen, boo
/** /**
* Error logging * Error logging
*/ */
if (mysql_errno(mysql) > 0 && strlen(query) > 0) { if (mysql_errno(mysql) > 0 && query[0] != '\0') {
LogMySQLError("[{}] [{}]\n[{}]", mysql_errno(mysql), mysql_error(mysql), query); LogMySQLError("[{}] [{}]\n[{}]", mysql_errno(mysql), mysql_error(mysql), query);
} }
+2 -2
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();
@@ -35,7 +35,7 @@ public:
const std::string &GetOriginHost() const; const std::string &GetOriginHost() const;
void SetOriginHost(const std::string &origin_host); void SetOriginHost(const std::string &origin_host);
bool DoesTableExist(std::string table_name); bool DoesTableExist(const std::string& table_name);
void SetMySQL(const DBcore &o) void SetMySQL(const DBcore &o)
{ {
-6
View File
@@ -27,9 +27,6 @@ void Discord::SendWebhookMessage(const std::string &message, const std::string &
cli.set_connection_timeout(0, 15000000); // 15 sec cli.set_connection_timeout(0, 15000000); // 15 sec
cli.set_read_timeout(15, 0); // 15 seconds cli.set_read_timeout(15, 0); // 15 seconds
cli.set_write_timeout(15, 0); // 15 seconds cli.set_write_timeout(15, 0); // 15 seconds
httplib::Headers headers = {
{"Content-Type", "application/json"}
};
// payload // payload
Json::Value p; Json::Value p;
@@ -96,9 +93,6 @@ void Discord::SendPlayerEventMessage(
cli.set_connection_timeout(0, 15000000); // 15 sec cli.set_connection_timeout(0, 15000000); // 15 sec
cli.set_read_timeout(15, 0); // 15 seconds cli.set_read_timeout(15, 0); // 15 seconds
cli.set_write_timeout(15, 0); // 15 seconds cli.set_write_timeout(15, 0); // 15 seconds
httplib::Headers headers = {
{"Content-Type", "application/json"}
};
std::string payload = PlayerEventLogs::GetDiscordPayloadFromEvent(e); std::string payload = PlayerEventLogs::GetDiscordPayloadFromEvent(e);
if (payload.empty()) { if (payload.empty()) {
+2 -2
View File
@@ -37,7 +37,7 @@ void DiscordManager::ProcessMessageQueue()
message, message,
webhook.webhook_url webhook.webhook_url
); );
message = ""; message.clear();
} }
message += m; message += m;
@@ -51,7 +51,7 @@ void DiscordManager::ProcessMessageQueue()
webhook.webhook_url webhook.webhook_url
); );
} }
message = ""; message.clear();
} }
} }
// final flush // final flush
+35 -34
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,
-137
View File
@@ -236,26 +236,6 @@ uint32 EQApplicationPacket::serialize(uint16 opcode, unsigned char *dest) const
return size+OpCodeBytes; return size+OpCodeBytes;
} }
/*EQProtocolPacket::EQProtocolPacket(uint16 op, const unsigned char *buf, uint32 len)
: BasePacket(buf, len),
opcode(op)
{
uint32 offset;
opcode=ntohs(*(const uint16 *)buf);
offset=2;
if (len-offset) {
pBuffer= new unsigned char[len-offset];
memcpy(pBuffer,buf+offset,len-offset);
size=len-offset;
} else {
pBuffer=nullptr;
size=0;
}
OpMgr=&RawOpcodeManager;
}*/
bool EQProtocolPacket::combine(const EQProtocolPacket *rhs) bool EQProtocolPacket::combine(const EQProtocolPacket *rhs)
{ {
bool result=false; bool result=false;
@@ -287,74 +267,6 @@ bool result=false;
} }
/*
this is the code to do app-layer combining, instead of protocol layer.
this was taken out due to complex interactions with the opcode manager,
and will require a bit more thinking (likely moving into EQStream) to
get running again... but might be a good thing some day.
bool EQApplicationPacket::combine(const EQApplicationPacket *rhs)
{
uint32 newsize=0, offset=0;
unsigned char *tmpbuffer=nullptr;
if (opcode!=OP_AppCombined) {
newsize=app_opcode_size+size+(size>254?3:1)+app_opcode_size+rhs->size+(rhs->size>254?3:1);
tmpbuffer=new unsigned char [newsize];
offset=0;
if (size>254) {
tmpbuffer[offset++]=0xff;
*(uint16 *)(tmpbuffer+offset)=htons(size);
offset+=1;
} else {
tmpbuffer[offset++]=size;
}
offset+=serialize(tmpbuffer+offset);
} else {
newsize=size+app_opcode_size+rhs->size+(rhs->size>254?3:1);
tmpbuffer=new unsigned char [newsize];
memcpy(tmpbuffer,pBuffer,size);
offset=size;
}
if (rhs->size>254) {
tmpbuffer[offset++]=0xff;
*(uint16 *)(tmpbuffer+offset)=htons(rhs->size);
offset+=1;
} else {
tmpbuffer[offset++]=rhs->size;
}
offset+=rhs->serialize(tmpbuffer+offset);
size=offset;
opcode=OP_AppCombined;
delete[] pBuffer;
pBuffer=tmpbuffer;
return true;
}
*/
bool EQProtocolPacket::ValidateCRC(const unsigned char *buffer, int length, uint32 Key)
{
bool valid=false;
// OP_SessionRequest, OP_SessionResponse, OP_OutOfSession are not CRC'd
if (buffer[0]==0x00 && (buffer[1]==OP_SessionRequest || buffer[1]==OP_SessionResponse || buffer[1]==OP_OutOfSession)) {
valid=true;
} else {
uint16 comp_crc=CRC16(buffer,length-2,Key);
uint16 packet_crc=ntohs(*(const uint16 *)(buffer+length-2));
#ifdef EQN_DEBUG
if (packet_crc && comp_crc != packet_crc) {
std::cout << "CRC mismatch: comp=" << std::hex << comp_crc << ", packet=" << packet_crc << std::dec << std::endl;
}
#endif
valid = (!packet_crc || comp_crc == packet_crc);
}
return valid;
}
uint32 EQProtocolPacket::Decompress(const unsigned char *buffer, const uint32 length, unsigned char *newbuf, uint32 newbufsize) uint32 EQProtocolPacket::Decompress(const unsigned char *buffer, const uint32 length, unsigned char *newbuf, uint32 newbufsize)
{ {
uint32 newlen=0; uint32 newlen=0;
@@ -403,55 +315,6 @@ uint32 flag_offset=1,newlength;
return newlength; return newlength;
} }
void EQProtocolPacket::ChatDecode(unsigned char *buffer, int size, int DecodeKey)
{
if ((size >= 2) && buffer[1]!=0x01 && buffer[0]!=0x02 && buffer[0]!=0x1d) {
int Key=DecodeKey;
unsigned char *test=(unsigned char *)malloc(size);
buffer+=2;
size-=2;
int i;
for (i = 0 ; i+4 <= size ; i+=4)
{
int pt = (*(int*)&buffer[i])^(Key);
Key = (*(int*)&buffer[i]);
*(int*)&test[i]=pt;
}
unsigned char KC=Key&0xFF;
for ( ; i < size ; i++)
{
test[i]=buffer[i]^KC;
}
memcpy(buffer,test,size);
free(test);
}
}
void EQProtocolPacket::ChatEncode(unsigned char *buffer, int size, int EncodeKey)
{
if (buffer[1]!=0x01 && buffer[0]!=0x02 && buffer[0]!=0x1d) {
int Key=EncodeKey;
char *test=(char*)malloc(size);
int i;
buffer+=2;
size-=2;
for ( i = 0 ; i+4 <= size ; i+=4)
{
int pt = (*(int*)&buffer[i])^(Key);
Key = pt;
*(int*)&test[i]=pt;
}
unsigned char KC=Key&0xFF;
for ( ; i < size ; i++)
{
test[i]=buffer[i]^KC;
}
memcpy(buffer,test,size);
free(test);
}
}
EQApplicationPacket *EQApplicationPacket::Copy() const { EQApplicationPacket *EQApplicationPacket::Copy() const {
return(new EQApplicationPacket(*this)); return(new EQApplicationPacket(*this));
} }
-3
View File
@@ -80,11 +80,8 @@ public:
protected: protected:
static bool ValidateCRC(const unsigned char *buffer, int length, uint32 Key);
static uint32 Decompress(const unsigned char *buffer, const uint32 length, unsigned char *newbuf, uint32 newbufsize); static uint32 Decompress(const unsigned char *buffer, const uint32 length, unsigned char *newbuf, uint32 newbufsize);
static uint32 Compress(const unsigned char *buffer, const uint32 length, unsigned char *newbuf, uint32 newbufsize); static uint32 Compress(const unsigned char *buffer, const uint32 length, unsigned char *newbuf, uint32 newbufsize);
static void ChatDecode(unsigned char *buffer, int size, int DecodeKey);
static void ChatEncode(unsigned char *buffer, int size, int EncodeKey);
uint16 GetRawOpcode() const { return(opcode); } uint16 GetRawOpcode() const { return(opcode); }
+3 -3
View File
@@ -5524,9 +5524,9 @@ struct ServerLootItem_Struct {
uint32 aug_6; // uint32 aug_5; uint32 aug_6; // uint32 aug_5;
bool attuned; bool attuned;
std::string custom_data; std::string custom_data;
uint32 ornamenticon; uint32 ornamenticon {};
uint32 ornamentidfile; uint32 ornamentidfile {};
uint32 ornament_hero_model; uint32 ornament_hero_model {};
uint16 trivial_min_level; uint16 trivial_min_level;
uint16 trivial_max_level; uint16 trivial_max_level;
uint16 npc_min_level; uint16 npc_min_level;
+2 -2
View File
@@ -26,7 +26,7 @@ EQStreamIdentifier::~EQStreamIdentifier() {
} }
} }
void EQStreamIdentifier::RegisterPatch(const EQStreamInterface::Signature &sig, const char *name, OpcodeManager ** opcodes, const StructStrategy *structs) { void EQStreamIdentifier::RegisterPatch(EQStreamInterface::Signature sig, const char *name, OpcodeManager ** opcodes, const StructStrategy *structs) {
auto p = new Patch; auto p = new Patch;
p->signature = sig; p->signature = sig;
p->name = name; p->name = name;
@@ -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;
} }
+1 -1
View File
@@ -18,7 +18,7 @@ public:
~EQStreamIdentifier(); ~EQStreamIdentifier();
//registration interface. //registration interface.
void RegisterPatch(const EQStreamInterface::Signature &sig, const char *name, OpcodeManager ** opcodes, const StructStrategy *structs); void RegisterPatch(EQStreamInterface::Signature sig, const char *name, OpcodeManager ** opcodes, const StructStrategy *structs);
//main processing interface //main processing interface
void Process(); void Process();
-3
View File
@@ -23,9 +23,6 @@
EQDB EQDB::s_EQDB; EQDB EQDB::s_EQDB;
EQDB::EQDB() {
}
unsigned int EQDB::field_count() { unsigned int EQDB::field_count() {
return mysql_field_count(mysql_ref); return mysql_field_count(mysql_ref);
} }
+1 -1
View File
@@ -27,7 +27,7 @@
//this is the main object exported to perl. //this is the main object exported to perl.
class EQDB { class EQDB {
EQDB(); EQDB() = default;
public: public:
static EQDB *Singleton() { return(&s_EQDB); } static EQDB *Singleton() { return(&s_EQDB); }
+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
-6
View File
@@ -147,12 +147,6 @@ class EQEmuConfig
return (_config); return (_config);
} }
// Allow the use to set the conf file to be used.
static void SetConfigFile(std::string file)
{
EQEmuConfig::ConfigFile = file;
}
// Load the config // Load the config
static bool LoadConfig(const std::string& path = "") static bool LoadConfig(const std::string& path = "")
{ {
+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;
} }
-4
View File
@@ -58,10 +58,6 @@ EQTime::EQTime()
SetCurrentEQTimeOfDay(start, time(0)); SetCurrentEQTimeOfDay(start, time(0));
} }
EQTime::~EQTime()
{
}
//getEQTimeOfDay - Reads timeConvert and writes the result to eqTimeOfDay //getEQTimeOfDay - Reads timeConvert and writes the result to eqTimeOfDay
//This function was written by the ShowEQ Project. //This function was written by the ShowEQ Project.
//Input: Current Time (as a time_t), a pointer to the TimeOfDay_Struct that will be written to. //Input: Current Time (as a time_t), a pointer to the TimeOfDay_Struct that will be written to.
+1 -1
View File
@@ -18,7 +18,7 @@ public:
//Constructor/destructor //Constructor/destructor
EQTime(TimeOfDay_Struct start_eq, time_t start_real); EQTime(TimeOfDay_Struct start_eq, time_t start_real);
EQTime(); EQTime();
~EQTime(); ~EQTime() = default;
//Get functions //Get functions
int GetCurrentEQTimeOfDay( TimeOfDay_Struct *eqTimeOfDay ) { return(GetCurrentEQTimeOfDay(time(nullptr), eqTimeOfDay)); } int GetCurrentEQTimeOfDay( TimeOfDay_Struct *eqTimeOfDay ) { return(GetCurrentEQTimeOfDay(time(nullptr), eqTimeOfDay)); }
+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)));
} }
} }
+4 -10
View File
@@ -333,7 +333,10 @@ std::string PlayerEventLogs::GetDiscordPayloadFromEvent(const PlayerEvent::Playe
payload = PlayerEventDiscordFormatter::FormatDroppedItemEvent(e, n); payload = PlayerEventDiscordFormatter::FormatDroppedItemEvent(e, n);
break; break;
} }
case PlayerEvent::FISH_FAILURE: { case PlayerEvent::FISH_FAILURE:
case PlayerEvent::FORAGE_FAILURE:
case PlayerEvent::WENT_ONLINE:
case PlayerEvent::WENT_OFFLINE: {
payload = PlayerEventDiscordFormatter::FormatWithNodata(e); payload = PlayerEventDiscordFormatter::FormatWithNodata(e);
break; break;
} }
@@ -348,10 +351,6 @@ std::string PlayerEventLogs::GetDiscordPayloadFromEvent(const PlayerEvent::Playe
payload = PlayerEventDiscordFormatter::FormatFishSuccessEvent(e, n); payload = PlayerEventDiscordFormatter::FormatFishSuccessEvent(e, n);
break; break;
} }
case PlayerEvent::FORAGE_FAILURE: {
payload = PlayerEventDiscordFormatter::FormatWithNodata(e);
break;
}
case PlayerEvent::FORAGE_SUCCESS: { case PlayerEvent::FORAGE_SUCCESS: {
PlayerEvent::ForageSuccessEvent n{}; PlayerEvent::ForageSuccessEvent n{};
std::stringstream ss; std::stringstream ss;
@@ -550,11 +549,6 @@ std::string PlayerEventLogs::GetDiscordPayloadFromEvent(const PlayerEvent::Playe
payload = PlayerEventDiscordFormatter::FormatResurrectAcceptEvent(e, n); payload = PlayerEventDiscordFormatter::FormatResurrectAcceptEvent(e, n);
break; break;
} }
case PlayerEvent::WENT_ONLINE:
case PlayerEvent::WENT_OFFLINE: {
payload = PlayerEventDiscordFormatter::FormatWithNodata(e);
break;
}
case PlayerEvent::MERCHANT_PURCHASE: { case PlayerEvent::MERCHANT_PURCHASE: {
PlayerEvent::MerchantPurchaseEvent n{}; PlayerEvent::MerchantPurchaseEvent n{};
std::stringstream ss; std::stringstream ss;
+1 -1
View File
@@ -384,7 +384,7 @@ namespace PlayerEvent {
}; };
struct AAPurchasedEvent { struct AAPurchasedEvent {
int32 aa_id; uint32 aa_id;
int32 aa_cost; int32 aa_cost;
int32 aa_previous_id; int32 aa_previous_id;
int32 aa_next_id; int32 aa_next_id;
+3 -3
View File
@@ -218,14 +218,14 @@ enum { //some random constants
#define HARD_LEVEL_CAP 127 #define HARD_LEVEL_CAP 127
//the square of the maximum range at whihc you could possibly use NPC services (shop, tribute, etc) //the square of the maximum range at whihc you could possibly use NPC services (shop, tribute, etc)
#define USE_NPC_RANGE2 200*200 //arbitrary right now #define USE_NPC_RANGE2 40000 //arbitrary right now
// Squared range for rampage 75.0 * 75.0 for now // Squared range for rampage 75.0 * 75.0 for now
#define NPC_RAMPAGE_RANGE2 5625.0f #define NPC_RAMPAGE_RANGE2 5625.0f
//the formula for experience for killing a mob. //the formula for experience for killing a mob.
//level is the only valid variable to use //level is the only valid variable to use
#define EXP_FORMULA level*level*75*35/10 #define EXP_FORMULA (level * level * 75 * 35 / 10)
#define HIGHEST_AA_VALUE 35 #define HIGHEST_AA_VALUE 35
@@ -295,7 +295,7 @@ Developer configuration
#define COMMON_PROFILE #define COMMON_PROFILE
#define PROFILE_DUMP_TIME 3*60 #define PROFILE_DUMP_TIME 180
#endif //EQPROFILE #endif //EQPROFILE
+24
View File
@@ -37,6 +37,7 @@
#include <fmt/format.h> #include <fmt/format.h>
#include <filesystem> #include <filesystem>
#include <iostream>
namespace fs = std::filesystem; namespace fs = std::filesystem;
@@ -80,3 +81,26 @@ std::string File::GetCwd()
{ {
return fs::current_path().string(); return fs::current_path().string();
} }
FileContentsResult File::GetContents(const std::string &file_name)
{
std::string error;
std::ifstream f;
f.open(file_name);
std::string line;
std::string lines;
if (f.is_open()) {
while (f) {
std::getline(f, line);
lines += line + "\n";
}
}
else {
error = fmt::format("Couldn't open file [{}]", file_name);
}
return FileContentsResult{
.contents = lines,
.error = error,
};
}
+6
View File
@@ -25,10 +25,16 @@
namespace fs = std::filesystem; namespace fs = std::filesystem;
struct FileContentsResult {
std::string contents;
std::string error;
};
class File { class File {
public: public:
static bool Exists(const std::string &name); static bool Exists(const std::string &name);
static void Makedir(const std::string& directory_name); static void Makedir(const std::string& directory_name);
static FileContentsResult GetContents(const std::string &file_name);
static std::string FindEqemuConfigPath(); static std::string FindEqemuConfigPath();
static std::string GetCwd(); static std::string GetCwd();
}; };
+4 -4
View File
@@ -6690,7 +6690,7 @@ static WSInit wsinit_;
if (params.empty()) { return Get(path, headers); } if (params.empty()) { return Get(path, headers); }
std::string path_with_query = append_query_params(path, params); std::string path_with_query = append_query_params(path, params);
return Get(path_with_query.c_str(), headers, progress); return Get(path_with_query, headers, progress);
} }
inline Result ClientImpl::Get(const std::string &path, const Params &params, inline Result ClientImpl::Get(const std::string &path, const Params &params,
@@ -6710,7 +6710,7 @@ static WSInit wsinit_;
} }
std::string path_with_query = append_query_params(path, params); std::string path_with_query = append_query_params(path, params);
return Get(path_with_query.c_str(), headers, response_handler, return Get(path_with_query, headers, response_handler,
content_receiver, progress); content_receiver, progress);
} }
@@ -6807,7 +6807,7 @@ static WSInit wsinit_;
std::string content_type; std::string content_type;
const auto &body = detail::serialize_multipart_formdata( const auto &body = detail::serialize_multipart_formdata(
items, detail::make_multipart_data_boundary(), content_type); items, detail::make_multipart_data_boundary(), content_type);
return Post(path, headers, body, content_type.c_str()); return Post(path, headers, body, content_type);
} }
inline Result ClientImpl::Post(const std::string &path, const Headers &headers, inline Result ClientImpl::Post(const std::string &path, const Headers &headers,
@@ -6820,7 +6820,7 @@ static WSInit wsinit_;
std::string content_type; std::string content_type;
const auto &body = const auto &body =
detail::serialize_multipart_formdata(items, boundary, content_type); detail::serialize_multipart_formdata(items, boundary, content_type);
return Post(path, headers, body, content_type.c_str()); return Post(path, headers, body, content_type);
} }
inline Result ClientImpl::Put(const std::string &path) { inline Result ClientImpl::Put(const std::string &path) {
+5 -4
View File
@@ -412,10 +412,11 @@ bool EQ::InventoryProfile::DeleteItem(int16 slot_id, int16 quantity) {
// If there are no charges left on the item, // If there are no charges left on the item,
if (item_to_delete->GetCharges() <= 0) { if (item_to_delete->GetCharges() <= 0) {
// If the item is stackable (e.g arrows), or // If the item is stackable (e.g arrows), or
// the item is not stackable, and is not a charged item, or is expendable, delete it // the item is not a charged item, or is expendable, delete it
if (item_to_delete->IsStackable() || if (
(!item_to_delete->IsStackable() && item_to_delete->IsStackable() ||
((item_to_delete->GetItem()->MaxCharges == 0) || item_to_delete->IsExpendable())) item_to_delete->GetItem()->MaxCharges == 0 ||
item_to_delete->IsExpendable()
) { ) {
// Item can now be destroyed // Item can now be destroyed
InventoryProfile::MarkDirty(item_to_delete); InventoryProfile::MarkDirty(item_to_delete);
+164 -159
View File
@@ -355,181 +355,186 @@ namespace EQ
struct ItemData { struct ItemData {
// Non packet based fields // Non packet based fields
uint8 MinStatus; uint8 MinStatus {};
// Packet based fields // Packet based fields
uint8 ItemClass; // Item Type: 0=common, 1=container, 2=book uint8 ItemClass {}; // Item Type: 0=common, 1=container, 2=book
char Name[64]; // Name char Name[64] {}; // Name
char Lore[80]; // Lore Name: *=lore, &=summoned, #=artifact, ~=pending lore char Lore[80] {}; // Lore Name: *=lore, &=summoned, #=artifact, ~=pending lore
char IDFile[30]; // Visible model char IDFile[30] {}; // Visible model
uint32 ID; // Unique ID (also PK for DB) uint32 ID {}; // Unique ID (also PK for DB)
int32 Weight; // Item weight * 10 int32 Weight {}; // Item weight * 10
uint8 NoRent; // No Rent: 0=norent, 255=not norent uint8 NoRent{} ; // No Rent: 0=norent, 255=not norent
uint8 NoDrop; // No Drop: 0=nodrop, 255=not nodrop uint8 NoDrop {}; // No Drop: 0=nodrop, 255=not nodrop
uint8 Size; // Size: 0=tiny, 1=small, 2=medium, 3=large, 4=giant uint8 Size {}; // Size: 0=tiny, 1=small, 2=medium, 3=large, 4=giant
uint32 Slots; // Bitfield for which slots this item can be used in uint32 Slots {}; // Bitfield for which slots this item can be used in
uint32 Price; // Item cost (?) uint32 Price {}; // Item cost (?)
uint32 Icon; // Icon Number uint32 Icon {}; // Icon Number
int32 LoreGroup; // Later items use LoreGroup instead of LoreFlag. we might want to see about changing this to int32 since it is commonly -1 and is constantly being cast from signed (-1) to unsigned (4294967295) int32 LoreGroup {}; // Later items use LoreGroup instead of LoreFlag. we might want to see about changing this to int32 since it is commonly -1 and is constantly being cast from signed (-1) to unsigned (4294967295)
bool LoreFlag; // This will be true if LoreGroup is non-zero bool LoreFlag {}; // This will be true if LoreGroup is non-zero
bool PendingLoreFlag; bool PendingLoreFlag {};
bool ArtifactFlag; bool ArtifactFlag {};
bool SummonedFlag; bool SummonedFlag {};
uint8 FVNoDrop; // Firiona Vie nodrop flag uint8 FVNoDrop {}; // Firiona Vie nodrop flag
uint32 Favor; // Individual favor uint32 Favor {}; // Individual favor
uint32 GuildFavor; // Guild favor uint32 GuildFavor {}; // Guild favor
uint32 PointType; uint32 PointType {};
//uint32 Unk117; //uint32 Unk117;
//uint32 Unk118; //uint32 Unk118;
//uint32 Unk121; //uint32 Unk121;
//uint32 Unk124; //uint32 Unk124;
uint8 BagType; // 0:Small Bag, 1:Large Bag, 2:Quiver, 3:Belt Pouch ... there are 50 types uint8 BagType {}; // 0:Small Bag, 1:Large Bag, 2:Quiver, 3:Belt Pouch ... there are 50 types
uint8 BagSlots; // Number of slots: can only be 2, 4, 6, 8, or 10 uint8 BagSlots {}; // Number of slots: can only be 2, 4, 6, 8, or 10
uint8 BagSize; // 0:TINY, 1:SMALL, 2:MEDIUM, 3:LARGE, 4:GIANT uint8 BagSize {}; // 0:TINY, 1:SMALL, 2:MEDIUM, 3:LARGE, 4:GIANT
uint8 BagWR; // 0->100 uint8 BagWR {}; // 0->100
bool BenefitFlag; bool BenefitFlag {};
bool Tradeskills; // Is this a tradeskill item? bool Tradeskills {}; // Is this a tradeskill item?
int8 CR; // Save vs Cold int8 CR {}; // Save vs Cold
int8 DR; // Save vs Disease int8 DR {}; // Save vs Disease
int8 PR; // Save vs Poison int8 PR {}; // Save vs Poison
int8 MR; // Save vs Magic int8 MR {}; // Save vs Magic
int8 FR; // Save vs Fire int8 FR {}; // Save vs Fire
int8 AStr; // Strength int8 AStr {}; // Strength
int8 ASta; // Stamina int8 ASta {}; // Stamina
int8 AAgi; // Agility int8 AAgi {}; // Agility
int8 ADex; // Dexterity int8 ADex {}; // Dexterity
int8 ACha; // Charisma int8 ACha {}; // Charisma
int8 AInt; // Intelligence int8 AInt {}; // Intelligence
int8 AWis; // Wisdom int8 AWis {}; // Wisdom
int32 HP; // HP int32 HP {}; // HP
int32 Mana; // Mana int32 Mana {}; // Mana
int32 AC; // AC int32 AC {}; // AC
uint32 Deity; // Bitmask of Deities that can equip this item uint32 Deity {}; // Bitmask of Deities that can equip this item
//uint32 Unk033 //uint32 Unk033
int32 SkillModValue; // % Mod to skill specified in SkillModType int32 SkillModValue {}; // % Mod to skill specified in SkillModType
int32 SkillModMax; // Max skill point modification int32 SkillModMax {}; // Max skill point modification
uint32 SkillModType; // Type of skill for SkillModValue to apply to uint32 SkillModType {}; // Type of skill for SkillModValue to apply to
uint32 BaneDmgRace; // Bane Damage Race uint32 BaneDmgRace {}; // Bane Damage Race
int32 BaneDmgAmt; // Bane Damage Body Amount int32 BaneDmgAmt {}; // Bane Damage Body Amount
uint32 BaneDmgBody; // Bane Damage Body uint32 BaneDmgBody {}; // Bane Damage Body
bool Magic; // True=Magic Item, False=not bool Magic {}; // True=Magic Item, False=not
int32 CastTime_; int32 CastTime_ {};
uint8 ReqLevel; // Required Level to use item uint8 ReqLevel {}; // Required Level to use item
uint32 BardType; // Bard Skill Type uint32 BardType {}; // Bard Skill Type
int32 BardValue; // Bard Skill Amount int32 BardValue {}; // Bard Skill Amount
int8 Light; // Light int8 Light {}; // Light
uint8 Delay; // Delay * 10 uint8 Delay {}; // Delay * 10
uint8 RecLevel; // Recommended level to use item uint8 RecLevel {}; // Recommended level to use item
uint8 RecSkill; // Recommended skill to use item (refers to primary skill of item) uint8 RecSkill {}; // Recommended skill to use item (refers to primary skill of item)
uint8 ElemDmgType; // Elemental Damage Type (1=magic, 2=fire) uint8 ElemDmgType {}; // Elemental Damage Type (1=magic, 2=fire)
uint8 ElemDmgAmt; // Elemental Damage uint8 ElemDmgAmt {}; // Elemental Damage
uint8 Range; // Range of item uint8 Range {}; // Range of item
uint32 Damage; // Delay between item usage (in 0.1 sec increments) uint32 Damage {}; // Delay between item usage (in 0.1 sec increments)
uint32 Color; // RR GG BB 00 <-- as it appears in pc uint32 Color {}; // RR GG BB 00 <-- as it appears in pc
uint32 Classes; // Bitfield of classes that can equip item (1 << class#) uint32 Classes {}; // Bitfield of classes that can equip item (1 << class#)
uint32 Races; // Bitfield of races that can equip item (1 << race#) uint32 Races {}; // Bitfield of races that can equip item (1 << race#)
//uint32 Unk054; //uint32 Unk054 {};
int16 MaxCharges; // Maximum charges items can hold: -1 if not a chargeable item int16 MaxCharges {}; // Maximum charges items can hold: -1 if not a chargeable item
uint8 ItemType; // Item Type/Skill (itemClass* from above) uint8 ItemType {}; // Item Type/Skill (itemClass* from above)
int32 SubType; // Some items have sub types that can be used for other things (unbreakable fishing poles, SE_FFItemClass) int32 SubType {}; // Some items have sub types that can be used for other things (unbreakable fishing poles, SE_FFItemClass)
uint8 Material; // Item material type uint8 Material {}; // Item material type
uint32 HerosForgeModel;// Hero's Forge Armor Model Type (2-13?) uint32 HerosForgeModel {};// Hero's Forge Armor Model Type (2-13?)
float SellRate; // Sell rate float SellRate {}; // Sell rate
//uint32 Unk059; //uint32 Unk059 {};
union { union {
uint32 Fulfilment; // Food fulfilment (How long it lasts) uint32 Fulfilment; // Food fulfilment (How long it lasts)
uint32 CastTime; // Cast Time for clicky effects, in milliseconds uint32 CastTime; // Cast Time for clicky effects, in milliseconds
}; };
uint32 EliteMaterial; uint32 EliteMaterial {};
int32 ProcRate; int32 ProcRate {};
int8 CombatEffects; // PoP: Combat Effects + int8 CombatEffects {}; // PoP: Combat Effects +
int8 Shielding; // PoP: Shielding % int8 Shielding {}; // PoP: Shielding %
int8 StunResist; // PoP: Stun Resist % int8 StunResist {}; // PoP: Stun Resist %
int8 StrikeThrough; // PoP: Strike Through % int8 StrikeThrough {}; // PoP: Strike Through %
uint32 ExtraDmgSkill; int32 ExtraDmgSkill {};
uint32 ExtraDmgAmt; int32 ExtraDmgAmt {};
int8 SpellShield; // PoP: Spell Shield % int8 SpellShield {}; // PoP: Spell Shield %
int8 Avoidance; // PoP: Avoidance + int8 Avoidance {}; // PoP: Avoidance +
int8 Accuracy; // PoP: Accuracy + int8 Accuracy {}; // PoP: Accuracy +
uint32 CharmFileID; uint32 CharmFileID {};
int32 FactionMod1; // Faction Mod 1 int32 FactionMod1 {}; // Faction Mod 1
int32 FactionMod2; // Faction Mod 2 int32 FactionMod2 {}; // Faction Mod 2
int32 FactionMod3; // Faction Mod 3 int32 FactionMod3 {}; // Faction Mod 3
int32 FactionMod4; // Faction Mod 4 int32 FactionMod4 {}; // Faction Mod 4
int32 FactionAmt1; // Faction Amt 1 int32 FactionAmt1 {}; // Faction Amt 1
int32 FactionAmt2; // Faction Amt 2 int32 FactionAmt2 {}; // Faction Amt 2
int32 FactionAmt3; // Faction Amt 3 int32 FactionAmt3 {}; // Faction Amt 3
int32 FactionAmt4; // Faction Amt 4 int32 FactionAmt4 {}; // Faction Amt 4
char CharmFile[32]; // ? char CharmFile[32] {}; // ?
uint32 AugType; uint32 AugType {};
uint8 AugSlotType[invaug::SOCKET_COUNT]; // RoF: Augment Slot 1-6 Type uint8 AugSlotType[invaug::SOCKET_COUNT] {}; // RoF: Augment Slot 1-6 Type
uint8 AugSlotVisible[invaug::SOCKET_COUNT]; // RoF: Augment Slot 1-6 Visible uint8 AugSlotVisible[invaug::SOCKET_COUNT] {}; // RoF: Augment Slot 1-6 Visible
uint8 AugSlotUnk2[invaug::SOCKET_COUNT]; // RoF: Augment Slot 1-6 Unknown Most likely Powersource related uint8 AugSlotUnk2[invaug::SOCKET_COUNT] {}; // RoF: Augment Slot 1-6 Unknown Most likely Powersource related
uint32 LDoNTheme; uint32 LDoNTheme {};
uint32 LDoNPrice; uint32 LDoNPrice {};
uint32 LDoNSold; uint32 LDoNSold {};
uint32 BaneDmgRaceAmt; uint32 BaneDmgRaceAmt {};
uint32 AugRestrict; uint32 AugRestrict {};
int32 Endur; int32 Endur {};
int32 DotShielding; int32 DotShielding {};
int32 Attack; int32 Attack {};
int32 Regen; int32 Regen {};
int32 ManaRegen; int32 ManaRegen {};
int32 EnduranceRegen; int32 EnduranceRegen {};
int32 Haste; int32 Haste {};
int32 DamageShield; int32 DamageShield {};
uint32 RecastDelay; uint32 RecastDelay {};
int RecastType; int RecastType {};
uint32 AugDistiller; uint32 AugDistiller {};
bool Attuneable; bool Attuneable {};
bool NoPet; bool NoPet {};
bool PotionBelt; bool PotionBelt {};
bool Stackable; bool Stackable {};
bool NoTransfer; bool NoTransfer {};
bool QuestItemFlag; bool QuestItemFlag {};
int16 StackSize; int16 StackSize {};
uint8 PotionBeltSlots; uint8 PotionBeltSlots {};
item::ItemEffect_Struct Click, Proc, Worn, Focus, Scroll, Bard; item::ItemEffect_Struct Click {};
item::ItemEffect_Struct Proc {};
item::ItemEffect_Struct Worn {};
item::ItemEffect_Struct Focus {};
item::ItemEffect_Struct Scroll {};
item::ItemEffect_Struct Bard {};
uint8 Book; // 0=Not book, 1=Book uint8 Book {}; // 0=Not book, 1=Book
uint32 BookType; uint32 BookType {};
char Filename[33]; // Filename for book data char Filename[33] {}; // Filename for book data
// Begin SoF Fields // Begin SoF Fields
int32 SVCorruption; int32 SVCorruption {};
uint32 Purity; uint32 Purity {};
uint8 EvolvingItem; uint8 EvolvingItem {};
uint32 EvolvingID; uint32 EvolvingID {};
uint8 EvolvingLevel; uint8 EvolvingLevel {};
uint8 EvolvingMax; uint8 EvolvingMax {};
uint32 BackstabDmg; uint32 BackstabDmg {};
uint32 DSMitigation; uint32 DSMitigation {};
int32 HeroicStr; int32 HeroicStr {};
int32 HeroicInt; int32 HeroicInt {};
int32 HeroicWis; int32 HeroicWis {};
int32 HeroicAgi; int32 HeroicAgi {};
int32 HeroicDex; int32 HeroicDex {};
int32 HeroicSta; int32 HeroicSta {};
int32 HeroicCha; int32 HeroicCha {};
int32 HeroicMR; int32 HeroicMR {};
int32 HeroicFR; int32 HeroicFR {};
int32 HeroicCR; int32 HeroicCR {};
int32 HeroicDR; int32 HeroicDR {};
int32 HeroicPR; int32 HeroicPR {};
int32 HeroicSVCorrup; int32 HeroicSVCorrup {};
int32 HealAmt; int32 HealAmt {};
int32 SpellDmg; int32 SpellDmg {};
uint32 LDoNSellBackRate; uint32 LDoNSellBackRate {};
uint32 ScriptFileID; uint32 ScriptFileID {};
uint16 ExpendableArrow; uint16 ExpendableArrow {};
uint32 Clairvoyance; uint32 Clairvoyance {};
char ClickName[65]; char ClickName[65] {};
char ProcName[65]; char ProcName[65] {};
char WornName[65]; char WornName[65] {};
char FocusName[65]; char FocusName[65] {};
char ScrollName[65]; char ScrollName[65] {};
//BardName //BardName
bool IsEquipable(uint16 Race, uint16 Class) const; bool IsEquipable(uint16 Race, uint16 Class) const;
+134 -139
View File
@@ -17,6 +17,7 @@
*/ */
#include "inventory_profile.h" #include "inventory_profile.h"
#include "../common/data_verification.h"
//#include "classes.h" //#include "classes.h"
//#include "global_define.h" //#include "global_define.h"
//#include "item_instance.h" //#include "item_instance.h"
@@ -57,100 +58,53 @@ static inline int32 GetNextItemInstSerialNumber() {
// class EQ::ItemInstance // class EQ::ItemInstance
// //
EQ::ItemInstance::ItemInstance(const ItemData* item, int16 charges) { EQ::ItemInstance::ItemInstance(const ItemData* item, int16 charges) {
m_use_type = ItemInstNormal;
if (item) { if (item) {
m_item = new ItemData(*item); m_item = new ItemData(*item);
} else {
m_item = nullptr;
} }
m_charges = charges;
m_price = 0;
m_attuned = false;
m_merchantslot = 0;
if (m_item && m_item->IsClassCommon())
m_color = m_item->Color;
else
m_color = 0;
m_merchantcount = 1;
m_SerialNumber = GetNextItemInstSerialNumber();
m_exp = 0; m_charges = charges;
m_evolveLvl = 0;
m_activated = false; if (m_item && m_item->IsClassCommon()) {
m_scaledItem = nullptr; m_color = m_item->Color;
m_evolveInfo = nullptr; }
m_scaling = false;
m_ornamenticon = 0; m_SerialNumber = GetNextItemInstSerialNumber();
m_ornamentidfile = 0;
m_ornament_hero_model = 0;
m_recast_timestamp = 0;
m_new_id_file = 0;
} }
EQ::ItemInstance::ItemInstance(SharedDatabase *db, uint32 item_id, int16 charges) { EQ::ItemInstance::ItemInstance(SharedDatabase *db, uint32 item_id, int16 charges) {
m_use_type = ItemInstNormal;
m_item = db->GetItem(item_id); m_item = db->GetItem(item_id);
if (m_item) { if (m_item) {
m_item = new ItemData(*m_item); m_item = new ItemData(*m_item);
} }
else {
m_item = nullptr;
}
m_charges = charges; m_charges = charges;
m_price = 0;
m_merchantslot = 0;
m_attuned=false;
if (m_item && m_item->IsClassCommon())
m_color = m_item->Color;
else
m_color = 0;
m_merchantcount = 1;
m_SerialNumber = GetNextItemInstSerialNumber();
m_exp = 0; if (m_item && m_item->IsClassCommon()) {
m_evolveLvl = 0; m_color = m_item->Color;
m_activated = false; } else {
m_scaledItem = nullptr; m_color = 0;
m_evolveInfo = nullptr; }
m_scaling = false;
m_ornamenticon = 0; m_SerialNumber = GetNextItemInstSerialNumber();
m_ornamentidfile = 0;
m_ornament_hero_model = 0;
m_recast_timestamp = 0;
m_new_id_file = 0;
} }
EQ::ItemInstance::ItemInstance(ItemInstTypes use_type) { EQ::ItemInstance::ItemInstance(ItemInstTypes use_type) {
m_use_type = use_type; m_use_type = use_type;
m_item = nullptr;
m_charges = 0;
m_price = 0;
m_attuned = false;
m_merchantslot = 0;
m_color = 0;
m_exp = 0;
m_evolveLvl = 0;
m_activated = false;
m_scaledItem = nullptr;
m_evolveInfo = nullptr;
m_scaling = false;
m_ornamenticon = 0;
m_ornamentidfile = 0;
m_ornament_hero_model = 0;
m_recast_timestamp = 0;
m_new_id_file = 0;
} }
// Make a copy of an EQ::ItemInstance object // Make a copy of an EQ::ItemInstance object
EQ::ItemInstance::ItemInstance(const ItemInstance& copy) EQ::ItemInstance::ItemInstance(const ItemInstance& copy)
{ {
m_use_type = copy.m_use_type; m_use_type = copy.m_use_type;
if(copy.m_item)
if (copy.m_item) {
m_item = new ItemData(*copy.m_item); m_item = new ItemData(*copy.m_item);
else } else {
m_item = nullptr; m_item = nullptr;
}
m_charges = copy.m_charges; m_charges = copy.m_charges;
m_price = copy.m_price; m_price = copy.m_price;
@@ -159,6 +113,7 @@ EQ::ItemInstance::ItemInstance(const ItemInstance& copy)
m_currentslot = copy.m_currentslot; m_currentslot = copy.m_currentslot;
m_attuned = copy.m_attuned; m_attuned = copy.m_attuned;
m_merchantcount = copy.m_merchantcount; m_merchantcount = copy.m_merchantcount;
// Copy container contents // Copy container contents
for (auto it = copy.m_contents.begin(); it != copy.m_contents.end(); ++it) { for (auto it = copy.m_contents.begin(); it != copy.m_contents.end(); ++it) {
ItemInstance* inst_old = it->second; ItemInstance* inst_old = it->second;
@@ -168,14 +123,16 @@ EQ::ItemInstance::ItemInstance(const ItemInstance& copy)
inst_new = inst_old->Clone(); inst_new = inst_old->Clone();
} }
if (inst_new != nullptr) { if (inst_new) {
m_contents[it->first] = inst_new; m_contents[it->first] = inst_new;
} }
} }
std::map<std::string, std::string>::const_iterator iter; std::map<std::string, std::string>::const_iterator iter;
for (iter = copy.m_custom_data.begin(); iter != copy.m_custom_data.end(); ++iter) { for (iter = copy.m_custom_data.begin(); iter != copy.m_custom_data.end(); ++iter) {
m_custom_data[iter->first] = iter->second; m_custom_data[iter->first] = iter->second;
} }
m_SerialNumber = copy.m_SerialNumber; m_SerialNumber = copy.m_SerialNumber;
m_custom_data = copy.m_custom_data; m_custom_data = copy.m_custom_data;
m_timers = copy.m_timers; m_timers = copy.m_timers;
@@ -183,15 +140,18 @@ EQ::ItemInstance::ItemInstance(const ItemInstance& copy)
m_exp = copy.m_exp; m_exp = copy.m_exp;
m_evolveLvl = copy.m_evolveLvl; m_evolveLvl = copy.m_evolveLvl;
m_activated = copy.m_activated; m_activated = copy.m_activated;
if (copy.m_scaledItem)
m_scaledItem = new ItemData(*copy.m_scaledItem);
else
m_scaledItem = nullptr;
if(copy.m_evolveInfo) if (copy.m_scaledItem) {
m_scaledItem = new ItemData(*copy.m_scaledItem);
} else {
m_scaledItem = nullptr;
}
if (copy.m_evolveInfo) {
m_evolveInfo = new EvolveInfo(*copy.m_evolveInfo); m_evolveInfo = new EvolveInfo(*copy.m_evolveInfo);
else } else {
m_evolveInfo = nullptr; m_evolveInfo = nullptr;
}
m_scaling = copy.m_scaling; m_scaling = copy.m_scaling;
m_ornamenticon = copy.m_ornamenticon; m_ornamenticon = copy.m_ornamenticon;
@@ -216,11 +176,13 @@ bool EQ::ItemInstance::IsType(item::ItemClass item_class) const
// IsType(<ItemClassTypes>) does not protect against 'm_item = nullptr' // IsType(<ItemClassTypes>) does not protect against 'm_item = nullptr'
// Check usage type // Check usage type
if ((m_use_type == ItemInstWorldContainer) && (item_class == item::ItemClassBag)) if (m_use_type == ItemInstWorldContainer && item_class == item::ItemClassBag) {
return true; return true;
}
if (!m_item) if (!m_item) {
return false; return false;
}
return (m_item->ItemClass == item_class); return (m_item->ItemClass == item_class);
} }
@@ -243,22 +205,21 @@ bool EQ::ItemInstance::IsClassBook() const
// Is item stackable? // Is item stackable?
bool EQ::ItemInstance::IsStackable() const bool EQ::ItemInstance::IsStackable() const
{ {
if (!m_item) return (m_item && m_item->Stackable);
return false;
return m_item->Stackable;
} }
bool EQ::ItemInstance::IsCharged() const bool EQ::ItemInstance::IsCharged() const
{ {
if (!m_item) if (!m_item) {
return false; return false;
}
if (m_item->MaxCharges > 1) if (m_item->MaxCharges > 1) {
return true; return true;
else } else {
return false; return false;
} }
}
// Can item be equipped? // Can item be equipped?
bool EQ::ItemInstance::IsEquipable(uint16 race, uint16 class_) const bool EQ::ItemInstance::IsEquipable(uint16 race, uint16 class_) const
@@ -306,28 +267,32 @@ bool EQ::ItemInstance::IsEquipable(int16 slot_id) const
bool EQ::ItemInstance::IsAugmentable() const bool EQ::ItemInstance::IsAugmentable() const
{ {
if (!m_item) if (!m_item) {
return false; return false;
}
for (int index = invaug::SOCKET_BEGIN; index <= invaug::SOCKET_END; ++index) { for (int index = invaug::SOCKET_BEGIN; index <= invaug::SOCKET_END; ++index) {
if (m_item->AugSlotType[index] != 0) if (m_item->AugSlotType[index] != 0) {
return true; return true;
} }
}
return false; return false;
} }
bool EQ::ItemInstance::AvailableWearSlot(uint32 aug_wear_slots) const { bool EQ::ItemInstance::AvailableWearSlot(uint32 aug_wear_slots) const {
if (!m_item || !m_item->IsClassCommon()) if (!m_item || !m_item->IsClassCommon()) {
return false; return false;
}
int index = invslot::EQUIPMENT_BEGIN; int index = invslot::EQUIPMENT_BEGIN;
for (; index <= invslot::EQUIPMENT_END; ++index) { for (; index <= invslot::EQUIPMENT_END; ++index) {
if (m_item->Slots & (1 << index)) { if (m_item->Slots & (1 << index)) {
if (aug_wear_slots & (1 << index)) if (aug_wear_slots & (1 << index)) {
break; break;
} }
} }
}
return (index <= EQ::invslot::EQUIPMENT_END); return (index <= EQ::invslot::EQUIPMENT_END);
} }
@@ -394,9 +359,10 @@ EQ::ItemInstance* EQ::ItemInstance::GetItem(uint8 index) const
uint32 EQ::ItemInstance::GetItemID(uint8 slot) const uint32 EQ::ItemInstance::GetItemID(uint8 slot) const
{ {
ItemInstance *item = GetItem(slot); const auto item = GetItem(slot);
if (item) if (item) {
return item->GetID(); return item->GetID();
}
return 0; return 0;
} }
@@ -520,14 +486,21 @@ uint8 EQ::ItemInstance::FirstOpenSlot() const
uint8 EQ::ItemInstance::GetTotalItemCount() const uint8 EQ::ItemInstance::GetTotalItemCount() const
{ {
if (!m_item) if (!m_item) {
return 0; return 0;
}
uint8 item_count = 1; uint8 item_count = 1;
if (m_item && !m_item->IsClassBag()) { return item_count; } if (!m_item->IsClassBag()) {
return item_count;
}
for (int index = invbag::SLOT_BEGIN; index < m_item->BagSlots; ++index) { if (GetItem(index)) { ++item_count; } } for (int index = invbag::SLOT_BEGIN; index < m_item->BagSlots; ++index) {
if (GetItem(index)) {
++item_count;
}
}
return item_count; return item_count;
} }
@@ -555,78 +528,99 @@ EQ::ItemInstance* EQ::ItemInstance::GetAugment(uint8 augment_index) const
return nullptr; return nullptr;
} }
EQ::ItemInstance* EQ::ItemInstance::GetOrnamentationAug(int32 ornamentationAugtype) const bool EQ::ItemInstance::IsOrnamentationAugment(EQ::ItemInstance* augment) const
{ {
if (!m_item || !m_item->IsClassCommon()) { return nullptr; } if (!m_item || !m_item->IsClassCommon() || !augment) {
if (ornamentationAugtype == 0) { return nullptr; } return false;
for (int i = invaug::SOCKET_BEGIN; i <= invaug::SOCKET_END; i++)
{
if (GetAugment(i) && m_item->AugSlotType[i] == ornamentationAugtype)
{
const char *item_IDFile = GetAugment(i)->GetItem()->IDFile;
if (
(strncmp(item_IDFile, "IT64", strlen(item_IDFile)) == 0
|| strncmp(item_IDFile, "IT63", strlen(item_IDFile)) == 0)
&& GetAugment(i)->GetItem()->HerosForgeModel == 0
)
{
continue;
} }
return GetAugment(i);
const auto augment_item = augment->GetItem();
if (!augment_item) {
return false;
}
const std::string& idfile = augment_item->IDFile;
if (
EQ::ValueWithin(
augment->GetAugmentType(),
OrnamentationAugmentTypes::StandardOrnamentation,
OrnamentationAugmentTypes::SpecialOrnamentation
) ||
(
idfile != "IT63" &&
idfile != "IT64"
) ||
augment_item->HerosForgeModel
) {
return true;
}
return false;
}
EQ::ItemInstance* EQ::ItemInstance::GetOrnamentationAugment() const
{
if (!m_item || !m_item->IsClassCommon()) {
return nullptr;
}
for (int i = invaug::SOCKET_BEGIN; i <= invaug::SOCKET_END; i++) {
const auto augment = GetAugment(i);
if (augment && IsOrnamentationAugment(augment)) {
return augment;
} }
} }
return nullptr; return nullptr;
} }
uint32 EQ::ItemInstance::GetOrnamentHeroModel(int32 material_slot) const { uint32 EQ::ItemInstance::GetOrnamentHeroModel(int32 material_slot) const
{
// Not a Hero Forge item. // Not a Hero Forge item.
if (m_ornament_hero_model == 0 || material_slot < 0) if (m_ornament_hero_model == 0 || material_slot < 0) {
return 0; return 0;
}
// Item is using an explicit Hero Forge ID // Item is using an explicit Hero Forge ID
if (m_ornament_hero_model >= 1000) if (m_ornament_hero_model >= 1000) {
return m_ornament_hero_model; return m_ornament_hero_model;
}
// Item is using a shorthand ID // Item is using a shorthand ID
return (m_ornament_hero_model * 100) + material_slot; return (m_ornament_hero_model * 100) + material_slot;
} }
bool EQ::ItemInstance::UpdateOrnamentationInfo() { bool EQ::ItemInstance::UpdateOrnamentationInfo()
if (!m_item || !m_item->IsClassCommon()) {
if (!m_item || !m_item->IsClassCommon()) {
return false; return false;
bool ornamentSet = false;
int32 ornamentationAugtype = RuleI(Character, OrnamentationAugmentType);
if (GetOrnamentationAug(ornamentationAugtype))
{
const ItemData* ornamentItem;
ornamentItem = GetOrnamentationAug(ornamentationAugtype)->GetItem();
if (ornamentItem != nullptr)
{
SetOrnamentIcon(ornamentItem->Icon);
SetOrnamentHeroModel(ornamentItem->HerosForgeModel);
if (strlen(ornamentItem->IDFile) > 2)
{
SetOrnamentationIDFile(Strings::ToUnsignedInt(&ornamentItem->IDFile[2]));
} }
else
{ const auto augment = GetOrnamentationAugment();
if (augment) {
const auto augment_item = GetOrnamentationAugment()->GetItem();
if (augment_item) {
SetOrnamentIcon(augment_item->Icon);
SetOrnamentHeroModel(augment_item->HerosForgeModel);
if (strlen(augment_item->IDFile) > 2) {
SetOrnamentationIDFile(Strings::ToUnsignedInt(&augment_item->IDFile[2]));
} else {
SetOrnamentationIDFile(0); SetOrnamentationIDFile(0);
} }
ornamentSet = true;
return true;
} }
} }
else
{
SetOrnamentIcon(0); SetOrnamentIcon(0);
SetOrnamentHeroModel(0); SetOrnamentHeroModel(0);
SetOrnamentationIDFile(0); SetOrnamentationIDFile(0);
}
return ornamentSet; return false;
} }
bool EQ::ItemInstance::CanTransform(const ItemData *ItemToTry, const ItemData *Container, bool AllowAll) { bool EQ::ItemInstance::CanTransform(const ItemData *ItemToTry, const ItemData *Container, bool AllowAll) {
@@ -940,8 +934,9 @@ bool EQ::ItemInstance::IsDroppable(bool recurse) const
void EQ::ItemInstance::Initialize(SharedDatabase *db) { void EQ::ItemInstance::Initialize(SharedDatabase *db) {
// if there's no actual item, don't do anything // if there's no actual item, don't do anything
if (!m_item) if (!m_item) {
return; return;
}
// initialize scaling items // initialize scaling items
if (m_item->CharmFileID != 0) { if (m_item->CharmFileID != 0) {
@@ -950,7 +945,7 @@ void EQ::ItemInstance::Initialize(SharedDatabase *db) {
} }
// initialize evolving items // initialize evolving items
else if ((db) && m_item->LoreGroup >= 1000 && m_item->LoreGroup != -1) { else if (db && m_item->LoreGroup >= 1000) {
// not complete yet // not complete yet
} }
} }
+33 -28
View File
@@ -51,6 +51,11 @@ typedef enum {
byFlagNotSet //apply action if the flag is NOT set byFlagNotSet //apply action if the flag is NOT set
} byFlagSetting; } byFlagSetting;
enum OrnamentationAugmentTypes {
StandardOrnamentation = 20,
SpecialOrnamentation = 21
};
class SharedDatabase; class SharedDatabase;
// ######################################## // ########################################
@@ -136,7 +141,8 @@ namespace EQ
bool IsAugmented(); bool IsAugmented();
bool ContainsAugmentByID(uint32 item_id); bool ContainsAugmentByID(uint32 item_id);
int CountAugmentByID(uint32 item_id); int CountAugmentByID(uint32 item_id);
ItemInstance* GetOrnamentationAug(int32 ornamentationAugtype) const; bool IsOrnamentationAugment(EQ::ItemInstance* augment) const;
ItemInstance* GetOrnamentationAugment() const;
bool UpdateOrnamentationInfo(); bool UpdateOrnamentationInfo();
static bool CanTransform(const ItemData *ItemToTry, const ItemData *Container, bool AllowAll = false); static bool CanTransform(const ItemData *ItemToTry, const ItemData *Container, bool AllowAll = false);
@@ -304,34 +310,33 @@ namespace EQ
void _PutItem(uint8 index, ItemInstance* inst) { m_contents[index] = inst; } void _PutItem(uint8 index, ItemInstance* inst) { m_contents[index] = inst; }
ItemInstTypes m_use_type; // Usage type for item ItemInstTypes m_use_type {ItemInstNormal}; // Usage type for item
const ItemData* m_item; // Ptr to item data const ItemData* m_item {nullptr}; // Ptr to item data
int16 m_charges; // # of charges for chargeable items int16 m_charges {0}; // # of charges for chargeable items
uint32 m_price; // Bazaar /trader price uint32 m_price {0}; // Bazaar /trader price
uint32 m_color; uint32 m_color {0};
uint32 m_merchantslot; uint32 m_merchantslot {0};
int16 m_currentslot; int16 m_currentslot {0};
bool m_attuned; bool m_attuned {false};
int32 m_merchantcount; //number avaliable on the merchant, -1=unlimited int32 m_merchantcount {1}; //number avaliable on the merchant, -1=unlimited
int32 m_SerialNumber; // Unique identifier for this instance of an item. Needed for Bazaar. int32 m_SerialNumber {0}; // Unique identifier for this instance of an item. Needed for Bazaar.
uint32 m_exp; uint32 m_exp {0};
int8 m_evolveLvl; int8 m_evolveLvl {0};
bool m_activated; bool m_activated {false};
ItemData* m_scaledItem; ItemData* m_scaledItem {nullptr};
::EvolveInfo* m_evolveInfo; ::EvolveInfo* m_evolveInfo {nullptr};
bool m_scaling; bool m_scaling {false};
uint32 m_ornamenticon; uint32 m_ornamenticon {0};
uint32 m_ornamentidfile; uint32 m_ornamentidfile {0};
uint32 m_new_id_file; uint32 m_new_id_file {0};
uint32 m_ornament_hero_model; uint32 m_ornament_hero_model {0};
uint32 m_recast_timestamp; uint32 m_recast_timestamp {0};
int m_task_delivered_count = 0; int m_task_delivered_count {0};
// // Items inside of this item (augs or contents) {};
// Items inside of this item (augs or contents); std::map<uint8, ItemInstance*> m_contents {}; // Zero-based index: min=0, max=9
std::map<uint8, ItemInstance*> m_contents; // Zero-based index: min=0, max=9 std::map<std::string, std::string> m_custom_data {};
std::map<std::string, std::string> m_custom_data; std::map<std::string, ::Timer> m_timers {};
std::map<std::string, ::Timer> m_timers;
}; };
} }
+1 -1
View File
@@ -151,7 +151,7 @@ static char *temp=nullptr;
return false; return false;
} }
ptr++; ptr++;
uint32 id = Strings::ToUnsignedInt(field[id_pos].c_str()); uint32 id = Strings::ToUnsignedInt(field[id_pos]);
items[id]=field; items[id]=field;
for(i=0;i<10;i++) { for(i=0;i<10;i++) {
+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)
+1 -1
View File
@@ -142,7 +142,7 @@ void EQ::Net::TCPConnection::Write(const char *data, size_t count)
WriteBaton *baton = new WriteBaton; WriteBaton *baton = new WriteBaton;
baton->connection = this; baton->connection = this;
baton->buffer = new char[count];; baton->buffer = new char[count];
uv_write_t *write_req = new uv_write_t; uv_write_t *write_req = new uv_write_t;
memset(write_req, 0, sizeof(uv_write_t)); memset(write_req, 0, sizeof(uv_write_t));
-1
View File
@@ -5218,7 +5218,6 @@ namespace RoF
/** /**
* Ornamentation * Ornamentation
*/ */
int ornamentation_augment_type = RuleI(Character, OrnamentationAugmentType);
uint32 ornamentation_icon = (inst->GetOrnamentationIcon() ? inst->GetOrnamentationIcon() : 0); uint32 ornamentation_icon = (inst->GetOrnamentationIcon() ? inst->GetOrnamentationIcon() : 0);
uint32 hero_model = 0; uint32 hero_model = 0;
-1
View File
@@ -5477,7 +5477,6 @@ namespace RoF2
/** /**
* Ornamentation * Ornamentation
*/ */
int ornamentation_augment_type = RuleI(Character, OrnamentationAugmentType);
uint32 ornamentation_icon = (inst->GetOrnamentationIcon() ? inst->GetOrnamentationIcon() : 0); uint32 ornamentation_icon = (inst->GetOrnamentationIcon() ? inst->GetOrnamentationIcon() : 0);
uint32 hero_model = 0; uint32 hero_model = 0;
+9 -9
View File
@@ -3851,17 +3851,17 @@ namespace UF
ob.write((const char*)&evotop, sizeof(UF::structs::EvolvingItem)); ob.write((const char*)&evotop, sizeof(UF::structs::EvolvingItem));
} }
//ORNAMENT IDFILE / ICON - uint16 ornament_icon = 0;
int ornamentationAugtype = RuleI(Character, OrnamentationAugmentType); const auto augment = inst->GetOrnamentationAugment();
uint16 ornaIcon = 0;
if (inst->GetOrnamentationAug(ornamentationAugtype)) {
const EQ::ItemData *aug_weap = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem();
ornaIcon = aug_weap->Icon;
ob.write(aug_weap->IDFile, strlen(aug_weap->IDFile)); if (augment) {
const auto augment_item = augment->GetItem();
ornament_icon = augment_item->Icon;
ob.write(augment_item->IDFile, strlen(augment_item->IDFile));
} }
else if (inst->GetOrnamentationIDFile() && inst->GetOrnamentationIcon()) { else if (inst->GetOrnamentationIDFile() && inst->GetOrnamentationIcon()) {
ornaIcon = inst->GetOrnamentationIcon(); ornament_icon = inst->GetOrnamentationIcon();
char tmp[30]; memset(tmp, 0x0, 30); sprintf(tmp, "IT%d", inst->GetOrnamentationIDFile()); char tmp[30]; memset(tmp, 0x0, 30); sprintf(tmp, "IT%d", inst->GetOrnamentationIDFile());
ob.write(tmp, strlen(tmp)); ob.write(tmp, strlen(tmp));
@@ -3870,7 +3870,7 @@ namespace UF
UF::structs::ItemSerializationHeaderFinish hdrf; UF::structs::ItemSerializationHeaderFinish hdrf;
hdrf.ornamentIcon = ornaIcon; hdrf.ornamentIcon = ornament_icon;
hdrf.unknown060 = 0; //This is Always 0.. or it breaks shit.. hdrf.unknown060 = 0; //This is Always 0.. or it breaks shit..
hdrf.unknown061 = 0; //possibly ornament / special ornament hdrf.unknown061 = 0; //possibly ornament / special ornament
hdrf.isCopied = 0; //Flag for item to be 'Copied' hdrf.isCopied = 0; //Flag for item to be 'Copied'
+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);
} }
+2 -1
View File
@@ -4,7 +4,8 @@
std::string Process::execute(const std::string &cmd) std::string Process::execute(const std::string &cmd)
{ {
std::shared_ptr<FILE> pipe(popen(cmd.c_str(), "r"), pclose); std::string command = fmt::format("{} 2>&1", cmd);
std::shared_ptr<FILE> pipe(popen(command.c_str(), "r"), pclose);
if (!pipe) { return "ERROR"; } if (!pipe) { return "ERROR"; }
char buffer[128]; char buffer[128];
std::string result; std::string result;
+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);
}; };
+3 -3
View File
@@ -141,11 +141,11 @@ bool RuleManager::SetRule(const std::string &rule_name, const std::string &rule_
switch (type) { switch (type) {
case IntRule: case IntRule:
m_RuleIntValues[index] = Strings::ToInt(rule_value.c_str()); m_RuleIntValues[index] = Strings::ToInt(rule_value);
LogRules("Set rule [{}] to value [{}]", rule_name, m_RuleIntValues[index]); LogRules("Set rule [{}] to value [{}]", rule_name, m_RuleIntValues[index]);
break; break;
case RealRule: case RealRule:
m_RuleRealValues[index] = Strings::ToFloat(rule_value.c_str()); m_RuleRealValues[index] = Strings::ToFloat(rule_value);
LogRules("Set rule [{}] to value [{:.2f}]", rule_name, m_RuleRealValues[index]); LogRules("Set rule [{}] to value [{:.2f}]", rule_name, m_RuleRealValues[index]);
break; break;
case BoolRule: case BoolRule:
@@ -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 -2
View File
@@ -136,7 +136,6 @@ RULE_BOOL(Character, EnableFoodRequirement, true, "If disabled, food is no longe
RULE_INT(Character, BaseInstrumentSoftCap, 36, "Softcap for instrument mods, 36 commonly referred to as 3.6 as well") RULE_INT(Character, BaseInstrumentSoftCap, 36, "Softcap for instrument mods, 36 commonly referred to as 3.6 as well")
RULE_BOOL(Character, UseSpellFileSongCap, true, "When they removed the AA that increased the cap they removed the above and just use the spell field") RULE_BOOL(Character, UseSpellFileSongCap, true, "When they removed the AA that increased the cap they removed the above and just use the spell field")
RULE_INT(Character, BaseRunSpeedCap, 158, "Base Run Speed Cap, on live it's 158% which will give you a runspeed of 1.580 hard capped to 225") RULE_INT(Character, BaseRunSpeedCap, 158, "Base Run Speed Cap, on live it's 158% which will give you a runspeed of 1.580 hard capped to 225")
RULE_INT(Character, OrnamentationAugmentType, 20, "Ornamentation Augment Type")
RULE_REAL(Character, EnvironmentDamageMulipliter, 1, "Multiplier for environmental damage like fall damage.") RULE_REAL(Character, EnvironmentDamageMulipliter, 1, "Multiplier for environmental damage like fall damage.")
RULE_BOOL(Character, UnmemSpellsOnDeath, true, "Setting whether at death all memorized Spells are forgotten") RULE_BOOL(Character, UnmemSpellsOnDeath, true, "Setting whether at death all memorized Spells are forgotten")
RULE_REAL(Character, TradeskillUpAlchemy, 2.0, "Alchemy skillup rate adjustment. Lower is faster") RULE_REAL(Character, TradeskillUpAlchemy, 2.0, "Alchemy skillup rate adjustment. Lower is faster")
@@ -274,7 +273,6 @@ RULE_BOOL(World, EnableTutorialButton, true, "Setting whether the Tutorial butto
RULE_BOOL(World, EnableReturnHomeButton, true, "Setting whether the Return Home button should be active") RULE_BOOL(World, EnableReturnHomeButton, true, "Setting whether the Return Home button should be active")
RULE_INT(World, MaxLevelForTutorial, 10, "The highest level with which you can enter the tutorial") RULE_INT(World, MaxLevelForTutorial, 10, "The highest level with which you can enter the tutorial")
RULE_INT(World, TutorialZoneID, 189, "Zone ID of the tutorial") RULE_INT(World, TutorialZoneID, 189, "Zone ID of the tutorial")
RULE_INT(World, GuildBankZoneID, 345, "Zone ID of the guild bank")
RULE_INT(World, MinOfflineTimeToReturnHome, 21600, "Minimum offline time to activate the Return Home button. 21600 seconds is 6 Hours") RULE_INT(World, MinOfflineTimeToReturnHome, 21600, "Minimum offline time to activate the Return Home button. 21600 seconds is 6 Hours")
RULE_INT(World, MaxClientsPerIP, -1, "Maximum number of clients allowed to connect per IP address if account status is < AddMaxClientsStatus. Default value: -1 (feature disabled)") RULE_INT(World, MaxClientsPerIP, -1, "Maximum number of clients allowed to connect per IP address if account status is < AddMaxClientsStatus. Default value: -1 (feature disabled)")
RULE_INT(World, ExemptMaxClientsStatus, -1, "Exempt accounts from the MaxClientsPerIP and AddMaxClientsStatus rules, if their status is >= this value. Default value: -1 (feature disabled)") RULE_INT(World, ExemptMaxClientsStatus, -1, "Exempt accounts from the MaxClientsPerIP and AddMaxClientsStatus rules, if their status is >= this value. Default value: -1 (feature disabled)")
@@ -519,6 +517,7 @@ RULE_BOOL(Combat, HeadshotOnlyHumanoids, true, "Enable or disable Headshot only
RULE_BOOL(Combat, EnableWarriorShielding, true, "Enable or disable Warrior Shielding Ability (/shield), true by default.") RULE_BOOL(Combat, EnableWarriorShielding, true, "Enable or disable Warrior Shielding Ability (/shield), true by default.")
RULE_BOOL(Combat, BackstabIgnoresElemental, false, "Enable or disable Elemental weapon damage affecting backstab damage, false by default.") RULE_BOOL(Combat, BackstabIgnoresElemental, false, "Enable or disable Elemental weapon damage affecting backstab damage, false by default.")
RULE_BOOL(Combat, BackstabIgnoresBane, false, "Enable or disable Bane weapon damage affecting backstab damage, false by default.") RULE_BOOL(Combat, BackstabIgnoresBane, false, "Enable or disable Bane weapon damage affecting backstab damage, false by default.")
RULE_BOOL(Combat, SummonMeleeRange, true, "Enable or disable summoning of a player when already in melee range of the summoner.")
RULE_CATEGORY_END() RULE_CATEGORY_END()
RULE_CATEGORY(NPC) RULE_CATEGORY(NPC)
+1 -3
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;
@@ -403,7 +403,6 @@ SaylinkRepository::Saylink EQ::SayLinkEngine::GetOrSaveSaylink(std::string sayli
} }
// if not found in database - save // if not found in database - save
if (saylinks.empty()) {
auto new_saylink = SaylinkRepository::NewEntity(); auto new_saylink = SaylinkRepository::NewEntity();
new_saylink.phrase = saylink_text; new_saylink.phrase = saylink_text;
@@ -413,7 +412,6 @@ SaylinkRepository::Saylink EQ::SayLinkEngine::GetOrSaveSaylink(std::string sayli
g_cached_saylinks.emplace_back(link); g_cached_saylinks.emplace_back(link);
return link; return link;
} }
}
return {}; return {};
} }
+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();
+2 -2
View File
@@ -47,9 +47,9 @@ const SharedTasksRepository::SharedTasks &SharedTask::GetDbSharedTask() const
return m_db_shared_task; return m_db_shared_task;
} }
void SharedTask::SetDbSharedTask(const SharedTasksRepository::SharedTasks &m_db_shared_task) void SharedTask::SetDbSharedTask(const SharedTasksRepository::SharedTasks &t)
{ {
SharedTask::m_db_shared_task = m_db_shared_task; SharedTask::m_db_shared_task = t;
} }
SharedTaskRequest SharedTask::GetRequestCharacters(Database &db, uint32_t requested_character_id) SharedTaskRequest SharedTask::GetRequestCharacters(Database &db, uint32_t requested_character_id)
+1 -1
View File
@@ -216,7 +216,7 @@ public:
// active record of database shared task // active record of database shared task
const SharedTasksRepository::SharedTasks &GetDbSharedTask() const; const SharedTasksRepository::SharedTasks &GetDbSharedTask() const;
void SetDbSharedTask(const SharedTasksRepository::SharedTasks &m_db_shared_task); void SetDbSharedTask(const SharedTasksRepository::SharedTasks &t);
std::vector<SharedTaskActivityStateEntry> m_shared_task_activity_state; std::vector<SharedTaskActivityStateEntry> m_shared_task_activity_state;
std::vector<SharedTaskMember> m_members; std::vector<SharedTaskMember> m_members;
+60 -36
View File
@@ -425,17 +425,13 @@ bool SharedDatabase::DeleteSharedBankSlot(uint32 char_id, int16 slot_id) {
int32 SharedDatabase::GetSharedPlatinum(uint32 account_id) int32 SharedDatabase::GetSharedPlatinum(uint32 account_id)
{ {
const std::string query = StringFormat("SELECT sharedplat FROM account WHERE id = '%i'", account_id); const auto query = fmt::format("SELECT sharedplat FROM account WHERE id = {}", account_id);
auto results = QueryDatabase(query); auto results = QueryDatabase(query);
if (!results.Success()) { if (!results.Success() || !results.RowCount()) {
return false; return 0;
} }
if (results.RowCount() != 1) auto row = results.begin();
return 0;
auto& row = results.begin();
return Strings::ToInt(row[0]); return Strings::ToInt(row[0]);
} }
@@ -499,25 +495,32 @@ bool SharedDatabase::GetSharedBank(uint32 id, EQ::InventoryProfile *inv, bool is
{ {
std::string query; std::string query;
if (is_charid) if (is_charid) {
query = StringFormat("SELECT sb.slotid, sb.itemid, sb.charges, " query = fmt::format(
"SELECT sb.slotid, sb.itemid, sb.charges, "
"sb.augslot1, sb.augslot2, sb.augslot3, " "sb.augslot1, sb.augslot2, sb.augslot3, "
"sb.augslot4, sb.augslot5, sb.augslot6, sb.custom_data " "sb.augslot4, sb.augslot5, sb.augslot6, sb.custom_data "
"FROM sharedbank sb INNER JOIN character_data ch " "FROM sharedbank sb INNER JOIN character_data ch "
"ON ch.account_id=sb.acctid WHERE ch.id = %i ORDER BY sb.slotid", "ON ch.account_id = sb.acctid WHERE ch.id = {} ORDER BY sb.slotid",
id); id
else );
query = StringFormat("SELECT slotid, itemid, charges, " } else {
query = fmt::format(
"SELECT slotid, itemid, charges, "
"augslot1, augslot2, augslot3, " "augslot1, augslot2, augslot3, "
"augslot4, augslot5, augslot6, custom_data " "augslot4, augslot5, augslot6, custom_data "
"FROM sharedbank WHERE acctid=%i ORDER BY slotid", "FROM sharedbank WHERE acctid = {} ORDER BY slotid",
id); id
);
}
auto results = QueryDatabase(query); auto results = QueryDatabase(query);
// If we have no results we still need to return true
if (!results.Success()) { if (!results.Success()) {
return false; return false;
} }
for (auto& row = results.begin(); row != results.end(); ++row) { for (auto row : results) {
int16 slot_id = static_cast<int16>(Strings::ToInt(row[0])); int16 slot_id = static_cast<int16>(Strings::ToInt(row[0]));
uint32 item_id = Strings::ToUnsignedInt(row[1]); uint32 item_id = Strings::ToUnsignedInt(row[1]);
const int16 charges = static_cast<int16>(Strings::ToInt(row[2])); const int16 charges = static_cast<int16>(Strings::ToInt(row[2]));
@@ -533,18 +536,28 @@ bool SharedDatabase::GetSharedBank(uint32 id, EQ::InventoryProfile *inv, bool is
const EQ::ItemData *item = GetItem(item_id); const EQ::ItemData *item = GetItem(item_id);
if (!item) { if (!item) {
LogError("Warning: [{}] [{}] has an invalid item_id [{}] in inventory slot [{}]", LogError(
((is_charid == true) ? "charid" : "acctid"), id, item_id, slot_id); "Warning: [{}] [{}] has an invalid item_id [{}] in inventory slot [{}]",
is_charid ? "charid" : "acctid",
id,
item_id,
slot_id
);
continue;
}
auto inst = CreateBaseItem(item, charges);
if (!inst) {
continue; continue;
} }
EQ::ItemInstance *inst = CreateBaseItem(item, charges);
if (inst && item->IsClassCommon()) { if (inst && item->IsClassCommon()) {
for (int i = EQ::invaug::SOCKET_BEGIN; i <= EQ::invaug::SOCKET_END; i++) { for (int i = EQ::invaug::SOCKET_BEGIN; i <= EQ::invaug::SOCKET_END; i++) {
if (aug[i]) if (aug[i]) {
inst->PutAugment(this, i, aug[i]); inst->PutAugment(this, i, aug[i]);
} }
} }
}
if (inst && row[9]) { if (inst && row[9]) {
std::string data_str(row[9]); std::string data_str(row[9]);
@@ -556,15 +569,22 @@ bool SharedDatabase::GetSharedBank(uint32 id, EQ::InventoryProfile *inv, bool is
safe_delete(inst); safe_delete(inst);
// Save ptr to item in inventory // Save ptr to item in inventory
if (put_slot_id != INVALID_INDEX) if (put_slot_id != INVALID_INDEX) {
continue; continue;
}
LogError("Warning: Invalid slot_id for item in shared bank inventory: [{}]=[{}], item_id=[{}], slot_id=[{}]", LogError(
((is_charid == true) ? "charid" : "acctid"), id, item_id, slot_id); "Warning: Invalid slot_id for item in shared bank inventory: [{}]=[{}], item_id=[{}], slot_id=[{}]",
is_charid ? "charid" : "acctid",
id,
item_id,
slot_id
);
if (is_charid) if (is_charid) {
SaveInventory(id, nullptr, slot_id); SaveInventory(id, nullptr, slot_id);
} }
}
return true; return true;
} }
@@ -619,7 +639,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, EQ::InventoryProfile *inv)
} }
else if (slot_id <= EQ::invbag::BANK_BAGS_END && slot_id >= EQ::invbag::BANK_BAGS_BEGIN) { // Titanium check else if (slot_id <= EQ::invbag::BANK_BAGS_END && slot_id >= EQ::invbag::BANK_BAGS_BEGIN) { // Titanium check
const auto parent_index = ((slot_id - EQ::invbag::BANK_BAGS_BEGIN) / EQ::invbag::SLOT_COUNT); const auto parent_index = ((slot_id - EQ::invbag::BANK_BAGS_BEGIN) / EQ::invbag::SLOT_COUNT);
if (parent_index < EQ::invslot::SLOT_BEGIN || parent_index >= bank_size) { if (parent_index >= bank_size) {
cv_conflict = true; cv_conflict = true;
continue; continue;
} }
@@ -964,10 +984,10 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_
// Flags // Flags
item.ArtifactFlag = Strings::ToBool(row[ItemField::artifactflag]); item.ArtifactFlag = Strings::ToBool(row[ItemField::artifactflag]);
item.Attuneable = !disable_attuneable && Strings::ToInt(row[ItemField::attuneable]) != 0; item.Attuneable = !disable_attuneable && Strings::ToBool(row[ItemField::attuneable]);
item.BenefitFlag = Strings::ToBool(row[ItemField::benefitflag]) != 0; item.BenefitFlag = Strings::ToBool(row[ItemField::benefitflag]);
item.FVNoDrop = Strings::ToInt(row[ItemField::fvnodrop]) != 0; item.FVNoDrop = Strings::ToBool(row[ItemField::fvnodrop]);
item.Magic = Strings::ToBool(row[ItemField::magic]) != 0; item.Magic = Strings::ToBool(row[ItemField::magic]);
item.NoDrop = disable_no_drop ? static_cast<uint8>(255) : static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::nodrop])); item.NoDrop = disable_no_drop ? static_cast<uint8>(255) : static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::nodrop]));
item.NoPet = !disable_no_pet && Strings::ToBool(row[ItemField::nopet]); item.NoPet = !disable_no_pet && Strings::ToBool(row[ItemField::nopet]);
item.NoRent = disable_no_rent ? static_cast<uint8>(255) : static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::norent])); item.NoRent = disable_no_rent ? static_cast<uint8>(255) : static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::norent]));
@@ -1107,8 +1127,8 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_
item.SkillModType = Strings::ToUnsignedInt(row[ItemField::skillmodtype]); item.SkillModType = Strings::ToUnsignedInt(row[ItemField::skillmodtype]);
// Extra Damage Skill // Extra Damage Skill
item.ExtraDmgSkill = Strings::ToUnsignedInt(row[ItemField::extradmgskill]); item.ExtraDmgSkill = Strings::ToInt(row[ItemField::extradmgskill]);
item.ExtraDmgAmt = Strings::ToUnsignedInt(row[ItemField::extradmgamt]); item.ExtraDmgAmt = Strings::ToInt(row[ItemField::extradmgamt]);
// Bard // Bard
item.BardType = Strings::ToUnsignedInt(row[ItemField::bardtype]); item.BardType = Strings::ToUnsignedInt(row[ItemField::bardtype]);
@@ -1564,24 +1584,28 @@ EQ::ItemInstance* SharedDatabase::CreateBaseItem(const EQ::ItemData* item, int16
if (item) { if (item) {
// if maxcharges is -1 that means it is an unlimited use item. // if maxcharges is -1 that means it is an unlimited use item.
// set it to 1 charge so that it is usable on creation // set it to 1 charge so that it is usable on creation
if (charges == 0 && item->MaxCharges == -1) if (charges == 0 && item->MaxCharges == -1) {
charges = 1; charges = 1;
}
// Stackable items need a minimum charge of 1 to remain moveable. // Stackable items need a minimum charge of 1 to remain moveable.
if(charges <= 0 && item->Stackable) if (charges <= 0 && item->Stackable) {
charges = 1; charges = 1;
}
inst = new EQ::ItemInstance(item, charges); inst = new EQ::ItemInstance(item, charges);
if (inst == nullptr) { if (!inst) {
LogError("Error: valid item data returned a null reference for EQ::ItemInstance creation in SharedDatabase::CreateBaseItem()"); LogError("Error: valid item data returned a null reference for EQ::ItemInstance creation in SharedDatabase::CreateBaseItem()");
LogError("Item Data = ID: {}, Name: {}, Charges: {}", item->ID, item->Name, charges); LogError("Item Data = ID: {}, Name: {}, Charges: {}", item->ID, item->Name, charges);
return nullptr; return nullptr;
} }
if(item->CharmFileID != 0 || (item->LoreGroup >= 1000 && item->LoreGroup != -1)) { if (item->CharmFileID != 0 || item->LoreGroup >= 1000) {
inst->Initialize(this); inst->Initialize(this);
} }
} }
return inst; return inst;
} }
+19 -28
View File
@@ -148,33 +148,6 @@ int32 EQ::skills::GetBaseDamage(SkillType skill)
} }
} }
bool EQ::skills::IsMeleeDmg(SkillType skill)
{
switch (skill) {
case Skill1HBlunt:
case Skill1HSlashing:
case Skill2HBlunt:
case Skill2HSlashing:
case SkillBackstab:
case SkillBash:
case SkillDragonPunch:
case SkillEagleStrike:
case SkillFlyingKick:
case SkillHandtoHand:
case SkillKick:
case Skill1HPiercing:
case SkillRiposte:
case SkillRoundKick:
case SkillThrowing:
case SkillTigerClaw:
case SkillFrenzy:
case Skill2HPiercing:
return true;
default:
return false;
}
}
const std::map<EQ::skills::SkillType, std::string>& EQ::skills::GetSkillTypeMap() const std::map<EQ::skills::SkillType, std::string>& EQ::skills::GetSkillTypeMap()
{ {
static const std::map<SkillType, std::string> skill_type_map = { static const std::map<SkillType, std::string> skill_type_map = {
@@ -260,13 +233,31 @@ const std::map<EQ::skills::SkillType, std::string>& EQ::skills::GetSkillTypeMap(
return skill_type_map; return skill_type_map;
} }
const std::vector<EQ::skills::SkillType>& EQ::skills::GetExtraDamageSkills()
{
static const std::vector<EQ::skills::SkillType> v = {
EQ::skills::SkillBackstab,
EQ::skills::SkillBash,
EQ::skills::SkillDragonPunch, // Same ID as Tail Rake
EQ::skills::SkillEagleStrike,
EQ::skills::SkillFlyingKick,
EQ::skills::SkillKick,
EQ::skills::SkillRoundKick,
EQ::skills::SkillRoundKick,
EQ::skills::SkillTigerClaw,
EQ::skills::SkillFrenzy
};
return v;
}
std::string EQ::skills::GetSkillName(SkillType skill) std::string EQ::skills::GetSkillName(SkillType skill)
{ {
if (skill >= Skill1HBlunt && skill <= Skill2HPiercing) { if (skill >= Skill1HBlunt && skill <= Skill2HPiercing) {
auto skills = GetSkillTypeMap(); auto skills = GetSkillTypeMap();
return skills[skill]; return skills[skill];
} }
return std::string(); return {};
} }
EQ::SkillProfile::SkillProfile() EQ::SkillProfile::SkillProfile()
+2 -1
View File
@@ -24,6 +24,7 @@
#include <string> #include <string>
#include <map> #include <map>
#include <vector>
namespace EQ namespace EQ
@@ -167,9 +168,9 @@ namespace EQ
bool IsBardInstrumentSkill(SkillType skill); bool IsBardInstrumentSkill(SkillType skill);
bool IsCastingSkill(SkillType skill); bool IsCastingSkill(SkillType skill);
int32 GetBaseDamage(SkillType skill); int32 GetBaseDamage(SkillType skill);
bool IsMeleeDmg(SkillType skill);
extern const std::map<SkillType, std::string>& GetSkillTypeMap(); extern const std::map<SkillType, std::string>& GetSkillTypeMap();
extern const std::vector<SkillType>& GetExtraDamageSkills();
std::string GetSkillName(SkillType skill); std::string GetSkillName(SkillType skill);
} /*skills*/ } /*skills*/
+2 -2
View File
@@ -504,7 +504,7 @@ enum SpellRestriction
HAS_NO_ILLUSIONS_OF_GRANDEUR_BUFF = 12519, // HAS_NO_ILLUSIONS_OF_GRANDEUR_BUFF = 12519, //
IS_HP_ABOVE_50_PCT = 16010, // IS_HP_ABOVE_50_PCT = 16010, //
IS_HP_UNDER_50_PCT = 16031, // IS_HP_UNDER_50_PCT = 16031, //
IS_OFF_HAND_EQUIPED = 27672, // You must be wielding a weapon or shield in your offhand to use this ability. IS_OFF_HAND_EQUIPPED = 27672, // You must be wielding a weapon or shield in your offhand to use this ability.
HAS_NO_PACT_OF_FATE_RECOURSE_BUFF = 29556, // This spell will not work while Pact of Fate Recourse is active. | caster restriction | HAS_NO_PACT_OF_FATE_RECOURSE_BUFF = 29556, // This spell will not work while Pact of Fate Recourse is active. | caster restriction |
HAS_NO_SHROUD_OF_PRAYER_BUFF = 32339, // Your target cannot receive another Quiet Prayer this soon. HAS_NO_SHROUD_OF_PRAYER_BUFF = 32339, // Your target cannot receive another Quiet Prayer this soon.
IS_MANA_BELOW_20_PCT = 38311, // This ability requires you to be at or below 20% of your maximum mana. IS_MANA_BELOW_20_PCT = 38311, // This ability requires you to be at or below 20% of your maximum mana.
@@ -1211,7 +1211,7 @@ typedef enum {
#define SE_Double_Backstab_Front 473 // implemented - Chance to double backstab from front #define SE_Double_Backstab_Front 473 // implemented - Chance to double backstab from front
#define SE_Pet_Crit_Melee_Damage_Pct_Owner 474 // implemenetd - Critical damage mod applied to pets from owner #define SE_Pet_Crit_Melee_Damage_Pct_Owner 474 // implemenetd - Critical damage mod applied to pets from owner
#define SE_Trigger_Spell_Non_Item 475 // implemented - Trigger spell on cast only if not from item click. #define SE_Trigger_Spell_Non_Item 475 // implemented - Trigger spell on cast only if not from item click.
#define SE_Weapon_Stance 476 // implemented, @Misc, Apply a specific spell buffs automatically depending 2Hander, Shield or Duel Wield is equiped, base: spellid, base: 0=2H 1=Shield 2=DW, max: none #define SE_Weapon_Stance 476 // implemented, @Misc, Apply a specific spell buffs automatically depending 2Hander, Shield or Dual Wield is equipped, base: spellid, base: 0=2H 1=Shield 2=DW, max: none
#define SE_Hatelist_To_Top_Index 477 // Implemented - Chance to be set to top of rampage list #define SE_Hatelist_To_Top_Index 477 // Implemented - Chance to be set to top of rampage list
#define SE_Hatelist_To_Tail_Index 478 // Implemented - Chance to be set to bottom of rampage list #define SE_Hatelist_To_Tail_Index 478 // Implemented - Chance to be set to bottom of rampage list
#define SE_Ff_Value_Min 479 // implemented, @Ff, Minimum base value of a spell that can be focused, base: spells to be focused base1 value #define SE_Ff_Value_Min 479 // implemented, @Ff, Minimum base value of a spell that can be focused, base: spells to be focused base1 value
+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(
+2 -5
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;
} }
@@ -287,15 +287,12 @@ std::string Strings::Commify(const std::string &number)
for (i = string_length - 3; i >= 0; i -= 3) { for (i = string_length - 3; i >= 0; i -= 3) {
if (i > 0) { if (i > 0) {
temp_string = "," + number.substr(static_cast<unsigned long>(i), 3) + temp_string; temp_string = "," + number.substr(static_cast<unsigned long>(i), 3) + temp_string;
} } else {
else {
temp_string = number.substr(static_cast<unsigned long>(i), 3) + temp_string; temp_string = number.substr(static_cast<unsigned long>(i), 3) + temp_string;
} }
} }
if (i < 0) {
temp_string = number.substr(0, static_cast<unsigned long>(3 + i)) + temp_string; temp_string = number.substr(0, static_cast<unsigned long>(3 + i)) + temp_string;
}
return temp_string; return temp_string;
} }
+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(
"{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
-3
View File
@@ -57,9 +57,6 @@ typedef const char Const_char; //for perl XS
#define safe_delete(d) if(d) { delete d; d=nullptr; } #define safe_delete(d) if(d) { delete d; d=nullptr; }
#define safe_delete_array(d) if(d) { delete[] d; d=nullptr; } #define safe_delete_array(d) if(d) { delete[] d; d=nullptr; }
#define L32(i) ((uint32) i)
#define H32(i) ((uint32) (i >> 32))
#define L16(i) ((uint16) i)
#ifndef WIN32 #ifndef WIN32
// More WIN32 compatability // More WIN32 compatability
+3 -3
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.7.0-dev" // always append -dev to the current version for custom-builds #define CURRENT_VERSION "22.11.0-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__
@@ -42,9 +42,9 @@
* Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt * Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt
*/ */
#define CURRENT_BINARY_DATABASE_VERSION 9226 #define CURRENT_BINARY_DATABASE_VERSION 9227
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9038 #define CURRENT_BINARY_BOTS_DATABASE_VERSION 9039
#endif #endif
+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);
+5 -5
View File
@@ -32,7 +32,7 @@ Database::Database(
user.c_str(), user.c_str(),
pass.c_str(), pass.c_str(),
name.c_str(), name.c_str(),
Strings::ToInt(port), Strings::ToUnsignedInt(port),
&errnum, &errnum,
errbuf errbuf
) )
@@ -93,7 +93,7 @@ bool Database::GetLoginDataFromAccountInfo(
auto row = results.begin(); auto row = results.begin();
id = Strings::ToInt(row[0]); id = Strings::ToUnsignedInt(row[0]);
password = row[1]; password = row[1];
LogDebug( LogDebug(
@@ -145,7 +145,7 @@ bool Database::GetLoginTokenDataFromToken(
} }
if (strcmp(row[2], "login_server_id") == 0) { if (strcmp(row[2], "login_server_id") == 0) {
db_account_id = Strings::ToInt(row[3]); db_account_id = Strings::ToUnsignedInt(row[3]);
found_login_id = true; found_login_id = true;
continue; continue;
} }
@@ -373,7 +373,7 @@ Database::DbWorldRegistration Database::GetWorldRegistration(
r.server_list_type = Strings::ToInt(row[3]); r.server_list_type = Strings::ToInt(row[3]);
r.is_server_trusted = Strings::ToInt(row[2]) > 0; r.is_server_trusted = Strings::ToInt(row[2]) > 0;
r.server_list_description = row[4]; r.server_list_description = row[4];
r.server_admin_id = Strings::ToInt(row[5]); r.server_admin_id = Strings::ToUnsignedInt(row[5]);
if (r.server_admin_id <= 0) { if (r.server_admin_id <= 0) {
return r; return r;
@@ -513,7 +513,7 @@ bool Database::CreateWorldRegistration(
auto row = results.begin(); auto row = results.begin();
id = Strings::ToInt(row[0]); id = Strings::ToUnsignedInt(row[0]);
auto insert_query = fmt::format( auto insert_query = fmt::format(
"INSERT INTO login_world_servers SET id = {0}, long_name = '{1}', short_name = '{2}', last_ip_address = '{3}', \n" "INSERT INTO login_world_servers SET id = {0}, long_name = '{1}', short_name = '{2}', last_ip_address = '{3}', \n"
"login_server_list_type_id = 3, login_server_admin_id = {4}, is_server_trusted = 0, tag_description = ''", "login_server_list_type_id = 3, login_server_admin_id = {4}, is_server_trusted = 0, tag_description = ''",
+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.7.0", "version": "22.11.0",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/EQEmu/Server.git" "url": "https://github.com/EQEmu/Server.git"
+8 -8
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;
@@ -659,7 +659,7 @@ ChatChannel *ChatChannelList::RemoveClientFromChannel(const std::string& in_chan
std::string channel_name = in_channel_name; std::string channel_name = in_channel_name;
if (in_channel_name.length() > 0 && isdigit(channel_name[0])) { if (in_channel_name.length() > 0 && isdigit(channel_name[0])) {
channel_name = c->ChannelSlotName(Strings::ToInt(in_channel_name.c_str())); channel_name = c->ChannelSlotName(Strings::ToInt(in_channel_name));
} }
auto *required_channel = FindChannel(channel_name); auto *required_channel = FindChannel(channel_name);
@@ -701,11 +701,11 @@ void ChatChannelList::Process() {
LogDebug("Empty temporary password protected channel [{}] being destroyed", LogDebug("Empty temporary password protected channel [{}] being destroyed",
CurrentChannel->GetName().c_str()); CurrentChannel->GetName().c_str());
RemoveChannel(CurrentChannel); iterator.RemoveCurrent();
} }
else {
iterator.Advance(); iterator.Advance();
}
} }
} }
@@ -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
+25 -25
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) {
@@ -379,14 +379,14 @@ static void ProcessSetMessageStatus(std::string SetMessageCommand) {
if (NumEnd == std::string::npos) { if (NumEnd == std::string::npos) {
MessageNumber = Strings::ToInt(SetMessageCommand.substr(NumStart).c_str()); MessageNumber = Strings::ToInt(SetMessageCommand.substr(NumStart));
database.SetMessageStatus(MessageNumber, Status); database.SetMessageStatus(MessageNumber, Status);
break; break;
} }
MessageNumber = Strings::ToInt(SetMessageCommand.substr(NumStart, NumEnd - NumStart).c_str()); MessageNumber = Strings::ToInt(SetMessageCommand.substr(NumStart, NumEnd - NumStart));
database.SetMessageStatus(MessageNumber, Status); database.SetMessageStatus(MessageNumber, Status);
@@ -878,7 +878,7 @@ void Clientlist::ProcessOPMailCommand(Client *c, std::string command_string, boo
break; break;
case CommandGetBody: case CommandGetBody:
database.SendBody(c, Strings::ToInt(parameters.c_str())); database.SendBody(c, Strings::ToInt(parameters));
break; break;
case CommandMailTo: case CommandMailTo:
@@ -893,7 +893,7 @@ void Clientlist::ProcessOPMailCommand(Client *c, std::string command_string, boo
case CommandSelectMailBox: case CommandSelectMailBox:
{ {
std::string::size_type NumStart = parameters.find_first_of("0123456789"); std::string::size_type NumStart = parameters.find_first_of("0123456789");
c->ChangeMailBox(Strings::ToInt(parameters.substr(NumStart).c_str())); c->ChangeMailBox(Strings::ToInt(parameters.substr(NumStart)));
break; break;
} }
case CommandSetMailForwarding: case CommandSetMailForwarding:
@@ -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) {
@@ -1255,7 +1255,7 @@ void Client::ProcessChannelList(std::string Input) {
std::string ChannelName = Input; std::string ChannelName = Input;
if (isdigit(ChannelName[0])) if (isdigit(ChannelName[0]))
ChannelName = ChannelSlotName(Strings::ToInt(ChannelName.c_str())); ChannelName = ChannelSlotName(Strings::ToInt(ChannelName));
ChatChannel *RequiredChannel = ChannelList->FindChannel(ChannelName); ChatChannel *RequiredChannel = ChannelList->FindChannel(ChannelName);
@@ -1416,7 +1416,7 @@ void Client::SendChannelMessageByNumber(std::string Message) {
if (MessageStart == std::string::npos) if (MessageStart == std::string::npos)
return; return;
int ChannelNumber = Strings::ToInt(Message.substr(0, MessageStart).c_str()); int ChannelNumber = Strings::ToInt(Message.substr(0, MessageStart));
if ((ChannelNumber < 1) || (ChannelNumber > MAX_JOINED_CHANNELS)) { if ((ChannelNumber < 1) || (ChannelNumber > MAX_JOINED_CHANNELS)) {
@@ -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;
@@ -1659,7 +1659,7 @@ void Client::SetChannelPassword(std::string ChannelPassword) {
std::string ChannelName = ChannelPassword.substr(ChannelStart); std::string ChannelName = ChannelPassword.substr(ChannelStart);
if ((ChannelName.length() > 0) && isdigit(ChannelName[0])) if ((ChannelName.length() > 0) && isdigit(ChannelName[0]))
ChannelName = ChannelSlotName(Strings::ToInt(ChannelName.c_str())); ChannelName = ChannelSlotName(Strings::ToInt(ChannelName));
std::string Message; std::string Message;
@@ -1724,7 +1724,7 @@ void Client::SetChannelOwner(std::string CommandString) {
std::string ChannelName = CapitaliseName(CommandString.substr(ChannelStart)); std::string ChannelName = CapitaliseName(CommandString.substr(ChannelStart));
if ((ChannelName.length() > 0) && isdigit(ChannelName[0])) if ((ChannelName.length() > 0) && isdigit(ChannelName[0]))
ChannelName = ChannelSlotName(Strings::ToInt(ChannelName.c_str())); ChannelName = ChannelSlotName(Strings::ToInt(ChannelName));
LogInfo("Set owner of channel [[{}]] to [[{}]]", ChannelName.c_str(), NewOwner.c_str()); LogInfo("Set owner of channel [[{}]] to [[{}]]", ChannelName.c_str(), NewOwner.c_str());
@@ -1770,7 +1770,7 @@ void Client::OPList(std::string CommandString) {
std::string ChannelName = CapitaliseName(CommandString.substr(ChannelStart)); std::string ChannelName = CapitaliseName(CommandString.substr(ChannelStart));
if ((ChannelName.length() > 0) && isdigit(ChannelName[0])) if ((ChannelName.length() > 0) && isdigit(ChannelName[0]))
ChannelName = ChannelSlotName(Strings::ToInt(ChannelName.c_str())); ChannelName = ChannelSlotName(Strings::ToInt(ChannelName));
ChatChannel *RequiredChannel = ChannelList->FindChannel(ChannelName); ChatChannel *RequiredChannel = ChannelList->FindChannel(ChannelName);
@@ -1813,7 +1813,7 @@ void Client::ChannelInvite(std::string CommandString) {
std::string ChannelName = CapitaliseName(CommandString.substr(ChannelStart)); std::string ChannelName = CapitaliseName(CommandString.substr(ChannelStart));
if ((ChannelName.length() > 0) && isdigit(ChannelName[0])) if ((ChannelName.length() > 0) && isdigit(ChannelName[0]))
ChannelName = ChannelSlotName(Strings::ToInt(ChannelName.c_str())); ChannelName = ChannelSlotName(Strings::ToInt(ChannelName));
LogInfo("[[{}]] invites [[{}]] to channel [[{}]]", GetName().c_str(), Invitee.c_str(), ChannelName.c_str()); LogInfo("[[{}]] invites [[{}]] to channel [[{}]]", GetName().c_str(), Invitee.c_str(), ChannelName.c_str());
@@ -1883,7 +1883,7 @@ void Client::ChannelModerate(std::string CommandString) {
std::string ChannelName = CapitaliseName(CommandString.substr(ChannelStart)); std::string ChannelName = CapitaliseName(CommandString.substr(ChannelStart));
if ((ChannelName.length() > 0) && isdigit(ChannelName[0])) if ((ChannelName.length() > 0) && isdigit(ChannelName[0]))
ChannelName = ChannelSlotName(Strings::ToInt(ChannelName.c_str())); ChannelName = ChannelSlotName(Strings::ToInt(ChannelName));
ChatChannel *RequiredChannel = ChannelList->FindChannel(ChannelName); ChatChannel *RequiredChannel = ChannelList->FindChannel(ChannelName);
@@ -1941,7 +1941,7 @@ void Client::ChannelGrantModerator(std::string CommandString) {
std::string ChannelName = CapitaliseName(CommandString.substr(ChannelStart)); std::string ChannelName = CapitaliseName(CommandString.substr(ChannelStart));
if ((ChannelName.length() > 0) && isdigit(ChannelName[0])) if ((ChannelName.length() > 0) && isdigit(ChannelName[0]))
ChannelName = ChannelSlotName(Strings::ToInt(ChannelName.c_str())); ChannelName = ChannelSlotName(Strings::ToInt(ChannelName));
LogInfo("[[{}]] gives [[{}]] moderator rights to channel [[{}]]", GetName().c_str(), Moderator.c_str(), ChannelName.c_str()); LogInfo("[[{}]] gives [[{}]] moderator rights to channel [[{}]]", GetName().c_str(), Moderator.c_str(), ChannelName.c_str());
@@ -2022,7 +2022,7 @@ void Client::ChannelGrantVoice(std::string CommandString) {
std::string ChannelName = CapitaliseName(CommandString.substr(ChannelStart)); std::string ChannelName = CapitaliseName(CommandString.substr(ChannelStart));
if ((ChannelName.length() > 0) && isdigit(ChannelName[0])) if ((ChannelName.length() > 0) && isdigit(ChannelName[0]))
ChannelName = ChannelSlotName(Strings::ToInt(ChannelName.c_str())); ChannelName = ChannelSlotName(Strings::ToInt(ChannelName));
LogInfo("[[{}]] gives [[{}]] voice to channel [[{}]]", GetName().c_str(), Voicee.c_str(), ChannelName.c_str()); LogInfo("[[{}]] gives [[{}]] voice to channel [[{}]]", GetName().c_str(), Voicee.c_str(), ChannelName.c_str());
@@ -2110,7 +2110,7 @@ void Client::ChannelKick(std::string CommandString) {
std::string ChannelName = CapitaliseName(CommandString.substr(ChannelStart)); std::string ChannelName = CapitaliseName(CommandString.substr(ChannelStart));
if ((ChannelName.length() > 0) && isdigit(ChannelName[0])) if ((ChannelName.length() > 0) && isdigit(ChannelName[0]))
ChannelName = ChannelSlotName(Strings::ToInt(ChannelName.c_str())); ChannelName = ChannelSlotName(Strings::ToInt(ChannelName));
LogInfo("[[{}]] kicks [[{}]] from channel [[{}]]", GetName().c_str(), Kickee.c_str(), ChannelName.c_str()); LogInfo("[[{}]] kicks [[{}]] from channel [[{}]]", GetName().c_str(), Kickee.c_str(), ChannelName.c_str());
@@ -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();
+2
View File
@@ -144,6 +144,8 @@ int main() {
->LoadLogDatabaseSettings() ->LoadLogDatabaseSettings()
->StartFileLogs(); ->StartFileLogs();
player_event_logs.SetDatabase(&database)->Init();
char tmp[64]; char tmp[64];
// ucs has no 'reload rules' handler // ucs has no 'reload rules' handler
+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 -15
View File
@@ -1801,23 +1801,9 @@ sub fetch_peq_db_full
sub map_files_fetch_bulk sub map_files_fetch_bulk
{ {
print "[Install] Fetching Latest Maps... (This could take a few minutes...)\n"; print "[Install] Fetching Latest Maps... (This could take a few minutes...)\n";
get_remote_file("http://analytics.akkadius.com/maps.zip", "maps/maps.zip", 1); get_remote_file("https://github.com/Akkadius/eqemu-maps/releases/latest/download/maps.zip", "maps/maps.zip", 1);
unzip('maps/maps.zip', 'maps/'); unzip('maps/maps.zip', 'maps/');
my @files;
my $start_dir = "maps/EQEmuMaps-master/";
find(
sub { push @files, $File::Find::name unless -d; },
$start_dir
);
for my $file (@files) {
$destination_file = $file;
$destination_file =~ s/maps\/EQEmuMaps-master\///g;
print "[Install] Installing [" . $destination_file . "]\n";
copy_file($file, "maps/" . $destination_file);
}
print "[Install] Fetched Latest Maps\n"; print "[Install] Fetched Latest Maps\n";
rmtree('maps/EQEmuMaps-master');
unlink('maps/maps.zip'); unlink('maps/maps.zip');
} }
+1
View File
@@ -480,6 +480,7 @@
9224|2023_03_08_npc_scale_global_base_avoidance.sql|SHOW COLUMNS FROM `npc_scale_global_base` LIKE 'hp_regen_per_second'|empty| 9224|2023_03_08_npc_scale_global_base_avoidance.sql|SHOW COLUMNS FROM `npc_scale_global_base` LIKE 'hp_regen_per_second'|empty|
9225|2023_01_21_bots_raid_members.sql|SHOW COLUMNS FROM `raid_members` LIKE 'bot_id'|empty| 9225|2023_01_21_bots_raid_members.sql|SHOW COLUMNS FROM `raid_members` LIKE 'bot_id'|empty|
9226|2023_03_17_corpse_fields.sql|SHOW COLUMNS FROM `character_corpse_items` LIKE 'custom_data'|empty| 9226|2023_03_17_corpse_fields.sql|SHOW COLUMNS FROM `character_corpse_items` LIKE 'custom_data'|empty|
9227|2023_03_24_npc_scale_global_base_verify.sql|SHOW COLUMNS FROM `npc_scale_global_base` LIKE 'heroic_strikethrough'|not_empty|
# Upgrade conditions: # Upgrade conditions:
# This won't be needed after this system is implemented, but it is used database that are not # This won't be needed after this system is implemented, but it is used database that are not
@@ -37,6 +37,7 @@
9036|2023_01_19_drop_bot_views.sql|SHOW TABLES LIKE 'vw_groups'|not_empty| 9036|2023_01_19_drop_bot_views.sql|SHOW TABLES LIKE 'vw_groups'|not_empty|
9037|2023_01_22_add_name_index.sql||show index from bot_data WHERE key_name = 'name`|empty| 9037|2023_01_22_add_name_index.sql||show index from bot_data WHERE key_name = 'name`|empty|
9038|2023_02_16_add_caster_range.sql|SHOW COLUMNS FROM `bot_data` LIKE 'caster_range'|empty| 9038|2023_02_16_add_caster_range.sql|SHOW COLUMNS FROM `bot_data` LIKE 'caster_range'|empty|
9039|2023_03_31_remove_bot_groups.sql|SHOW TABLES LIKE 'bot_groups'|not_empty|
# Upgrade conditions: # Upgrade conditions:
# This won't be needed after this system is implemented, but it is used database that are not # This won't be needed after this system is implemented, but it is used database that are not
@@ -0,0 +1,4 @@
SET FOREIGN_KEY_CHECKS = 0;
DROP TABLE IF EXISTS `bot_groups`;
DROP TABLE IF EXISTS `bot_group_members`;
SET FOREIGN_KEY_CHECKS = 1;
@@ -1,4 +1,4 @@
DROP INDEX IF EXISTS `PRIMARY` ON `raid_members`; DROP INDEX `PRIMARY` ON `raid_members`;
CREATE UNIQUE INDEX IF NOT EXISTS `UNIQUE` ON `raid_members`(`name`); CREATE UNIQUE INDEX `UNIQUE` ON `raid_members`(`name`);
ALTER TABLE `raid_members` ADD COLUMN `bot_id` int(4) NOT NULL DEFAULT 0 AFTER `charid`; ALTER TABLE `raid_members` ADD COLUMN `bot_id` int(4) NOT NULL DEFAULT 0 AFTER `charid`;
ALTER TABLE `raid_members` ADD COLUMN `id` BIGINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT FIRST; ALTER TABLE `raid_members` ADD COLUMN `id` BIGINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT FIRST;
@@ -51,5 +51,5 @@ ALTER TABLE `npc_scale_global_base`
MODIFY COLUMN `attack_delay` int(11) NOT NULL DEFAULT 0 AFTER `hp_regen_rate`, MODIFY COLUMN `attack_delay` int(11) NOT NULL DEFAULT 0 AFTER `hp_regen_rate`,
MODIFY COLUMN `spell_scale` int(11) NOT NULL DEFAULT 100 AFTER `attack_delay`, MODIFY COLUMN `spell_scale` int(11) NOT NULL DEFAULT 100 AFTER `attack_delay`,
MODIFY COLUMN `heal_scale` int(11) NOT NULL DEFAULT 100 AFTER `spell_scale`, MODIFY COLUMN `heal_scale` int(11) NOT NULL DEFAULT 100 AFTER `spell_scale`,
MODIFY COLUMN `special_abilities` text CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' AFTER `heal_scale`, MODIFY COLUMN special_abilities text CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL AFTER heal_scale,
ADD COLUMN `heroic_strikethrough` int(11) NOT NULL DEFAULT 0 AFTER `heal_scale`; ADD COLUMN `heroic_strikethrough` int(11) NOT NULL DEFAULT 0 AFTER `heal_scale`;
@@ -0,0 +1,57 @@
UPDATE `npc_scale_global_base` SET ac = 0 WHERE ac IS NULL;
UPDATE `npc_scale_global_base` SET hp = 0 WHERE hp IS NULL;
UPDATE `npc_scale_global_base` SET accuracy = 0 WHERE accuracy IS NULL;
UPDATE `npc_scale_global_base` SET slow_mitigation = 0 WHERE slow_mitigation IS NULL;
UPDATE `npc_scale_global_base` SET attack = 0 WHERE attack IS NULL;
UPDATE `npc_scale_global_base` SET strength = 0 WHERE strength IS NULL;
UPDATE `npc_scale_global_base` SET stamina = 0 WHERE stamina IS NULL;
UPDATE `npc_scale_global_base` SET dexterity = 0 WHERE dexterity IS NULL;
UPDATE `npc_scale_global_base` SET agility = 0 WHERE agility IS NULL;
UPDATE `npc_scale_global_base` SET intelligence = 0 WHERE intelligence IS NULL;
UPDATE `npc_scale_global_base` SET wisdom = 0 WHERE wisdom IS NULL;
UPDATE `npc_scale_global_base` SET charisma = 0 WHERE charisma IS NULL;
UPDATE `npc_scale_global_base` SET magic_resist = 0 WHERE magic_resist IS NULL;
UPDATE `npc_scale_global_base` SET cold_resist = 0 WHERE cold_resist IS NULL;
UPDATE `npc_scale_global_base` SET fire_resist = 0 WHERE fire_resist IS NULL;
UPDATE `npc_scale_global_base` SET poison_resist = 0 WHERE poison_resist IS NULL;
UPDATE `npc_scale_global_base` SET disease_resist = 0 WHERE disease_resist IS NULL;
UPDATE `npc_scale_global_base` SET corruption_resist = 0 WHERE corruption_resist IS NULL;
UPDATE `npc_scale_global_base` SET physical_resist = 0 WHERE physical_resist IS NULL;
UPDATE `npc_scale_global_base` SET min_dmg = 0 WHERE min_dmg IS NULL;
UPDATE `npc_scale_global_base` SET max_dmg = 0 WHERE max_dmg IS NULL;
UPDATE `npc_scale_global_base` SET hp_regen_rate = 0 WHERE hp_regen_rate IS NULL;
UPDATE `npc_scale_global_base` SET attack_delay = 0 WHERE attack_delay IS NULL;
UPDATE `npc_scale_global_base` SET physical_resist = 0 WHERE physical_resist IS NULL;
UPDATE `npc_scale_global_base` SET spell_scale = 100 WHERE spell_scale IS NULL;
UPDATE `npc_scale_global_base` SET heal_scale = 100 WHERE heal_scale IS NULL;
UPDATE `npc_scale_global_base` SET special_abilities = '' WHERE special_abilities IS NULL;
ALTER TABLE `npc_scale_global_base`
MODIFY COLUMN `ac` int(11) NOT NULL DEFAULT 0 AFTER `instance_version_list`,
MODIFY COLUMN `hp` bigint(20) NOT NULL DEFAULT 0 AFTER `ac`,
MODIFY COLUMN `accuracy` int(11) NOT NULL DEFAULT 0 AFTER `hp`,
MODIFY COLUMN `slow_mitigation` int(11) NOT NULL DEFAULT 0 AFTER `accuracy`,
MODIFY COLUMN `attack` int(11) NOT NULL DEFAULT 0 AFTER `slow_mitigation`,
MODIFY COLUMN `strength` int(11) NOT NULL DEFAULT 0 AFTER `attack`,
MODIFY COLUMN `stamina` int(11) NOT NULL DEFAULT 0 AFTER `strength`,
MODIFY COLUMN `dexterity` int(11) NOT NULL DEFAULT 0 AFTER `stamina`,
MODIFY COLUMN `agility` int(11) NOT NULL DEFAULT 0 AFTER `dexterity`,
MODIFY COLUMN `intelligence` int(11) NOT NULL DEFAULT 0 AFTER `agility`,
MODIFY COLUMN `wisdom` int(11) NOT NULL DEFAULT 0 AFTER `intelligence`,
MODIFY COLUMN `charisma` int(11) NOT NULL DEFAULT 0 AFTER `wisdom`,
MODIFY COLUMN `magic_resist` int(11) NOT NULL DEFAULT 0 AFTER `charisma`,
MODIFY COLUMN `cold_resist` int(11) NOT NULL DEFAULT 0 AFTER `magic_resist`,
MODIFY COLUMN `fire_resist` int(11) NOT NULL DEFAULT 0 AFTER `cold_resist`,
MODIFY COLUMN `poison_resist` int(11) NOT NULL DEFAULT 0 AFTER `fire_resist`,
MODIFY COLUMN `disease_resist` int(11) NOT NULL DEFAULT 0 AFTER `poison_resist`,
MODIFY COLUMN `corruption_resist` int(11) NOT NULL DEFAULT 0 AFTER `disease_resist`,
MODIFY COLUMN `physical_resist` int(11) NOT NULL DEFAULT 0 AFTER `corruption_resist`,
MODIFY COLUMN `min_dmg` int(11) NOT NULL DEFAULT 0 AFTER `physical_resist`,
MODIFY COLUMN `max_dmg` int(11) NOT NULL DEFAULT 0 AFTER `min_dmg`,
MODIFY COLUMN `hp_regen_rate` bigint(20) NOT NULL DEFAULT 0 AFTER `max_dmg`,
MODIFY COLUMN `attack_delay` int(11) NOT NULL DEFAULT 0 AFTER `hp_regen_rate`,
MODIFY COLUMN `hp_regen_per_second` bigint(20) NOT NULL DEFAULT 0 AFTER `hp_regen_rate`,
MODIFY COLUMN `spell_scale` int(11) NOT NULL DEFAULT 100 AFTER `attack_delay`,
MODIFY COLUMN `heal_scale` int(11) NOT NULL DEFAULT 100 AFTER `spell_scale`,
MODIFY COLUMN `heroic_strikethrough` int(11) NOT NULL DEFAULT 0 AFTER `avoidance`,
MODIFY COLUMN `avoidance` int(11) unsigned NOT NULL DEFAULT 0 AFTER `heal_scale`,
MODIFY COLUMN special_abilities text CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL AFTER heroic_strikethrough;
+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();
+2 -8
View File
@@ -36,9 +36,7 @@ void WorldserverCLI::DatabaseDump(int argc, char **argv, argh::parser &cmd, std:
s->SetDumpPath(cmd("--dump-path").str()); s->SetDumpPath(cmd("--dump-path").str());
} }
/** // options
* Set Option
*/
s->SetDumpContentTables(cmd[{"--content-tables"}] || dump_all); s->SetDumpContentTables(cmd[{"--content-tables"}] || dump_all);
s->SetDumpLoginServerTables(cmd[{"--login-tables"}] || dump_all); s->SetDumpLoginServerTables(cmd[{"--login-tables"}] || dump_all);
s->SetDumpPlayerTables(cmd[{"--player-tables"}] || dump_all); s->SetDumpPlayerTables(cmd[{"--player-tables"}] || dump_all);
@@ -48,15 +46,11 @@ void WorldserverCLI::DatabaseDump(int argc, char **argv, argh::parser &cmd, std:
s->SetDumpSystemTables(cmd[{"--system-tables"}] || dump_all); s->SetDumpSystemTables(cmd[{"--system-tables"}] || dump_all);
s->SetDumpQueryServerTables(cmd[{"--query-serv-tables"}] || dump_all); s->SetDumpQueryServerTables(cmd[{"--query-serv-tables"}] || dump_all);
s->SetDumpAllTables(dump_all); s->SetDumpAllTables(dump_all);
s->SetDumpWithNoData(cmd[{"--table-structure-only"}]); s->SetDumpWithNoData(cmd[{"--table-structure-only"}]);
s->SetDumpTableLock(cmd[{"--table-lock"}]); s->SetDumpTableLock(cmd[{"--table-lock"}]);
s->SetDumpWithCompression(cmd[{"--compress"}]); s->SetDumpWithCompression(cmd[{"--compress"}]);
s->SetDumpOutputToConsole(cmd[{"--dump-output-to-console"}]); s->SetDumpOutputToConsole(cmd[{"--dump-output-to-console"}]);
s->SetDumpDropTableSyntaxOnly(cmd[{"--drop-table-syntax-only"}]); s->SetDumpDropTableSyntaxOnly(cmd[{"--drop-table-syntax-only"}]);
/** s->DatabaseDump();
* Dump
*/
s->Dump();
} }
+3 -3
View File
@@ -1258,7 +1258,7 @@ bool Client::ChecksumVerificationCRCEQGame(uint64 checksum)
std::string checksumvar; std::string checksumvar;
uint64_t checksumint; uint64_t checksumint;
if (database.GetVariable("crc_eqgame", checksumvar)) { if (database.GetVariable("crc_eqgame", checksumvar)) {
checksumint = Strings::ToBigInt(checksumvar.c_str()); checksumint = Strings::ToBigInt(checksumvar);
} }
else { else {
LogChecksumVerification("variable not set in variables table."); LogChecksumVerification("variable not set in variables table.");
@@ -1281,7 +1281,7 @@ bool Client::ChecksumVerificationCRCSkillCaps(uint64 checksum)
std::string checksumvar; std::string checksumvar;
uint64_t checksumint; uint64_t checksumint;
if (database.GetVariable("crc_skillcaps", checksumvar)) { if (database.GetVariable("crc_skillcaps", checksumvar)) {
checksumint = Strings::ToBigInt(checksumvar.c_str()); checksumint = Strings::ToBigInt(checksumvar);
} }
else { else {
LogChecksumVerification("[checksum_crc2_skillcaps] variable not set in variables table."); LogChecksumVerification("[checksum_crc2_skillcaps] variable not set in variables table.");
@@ -1304,7 +1304,7 @@ bool Client::ChecksumVerificationCRCBaseData(uint64 checksum)
std::string checksumvar; std::string checksumvar;
uint64_t checksumint; uint64_t checksumint;
if (database.GetVariable("crc_basedata", checksumvar)) { if (database.GetVariable("crc_basedata", checksumvar)) {
checksumint = Strings::ToBigInt(checksumvar.c_str()); checksumint = Strings::ToBigInt(checksumvar);
} }
else { else {
LogChecksumVerification("variable not set in variables table."); LogChecksumVerification("variable not set in variables table.");
+1 -1
View File
@@ -360,7 +360,7 @@ bool ClientListEntry::CheckAuth(uint32 loginserver_account_id, const char *key_p
} }
std::string lsworldadmin; std::string lsworldadmin;
if (database.GetVariable("honorlsworldadmin", lsworldadmin)) { if (database.GetVariable("honorlsworldadmin", lsworldadmin)) {
if (Strings::ToInt(lsworldadmin.c_str()) == 1 && pworldadmin != 0 && (padmin < pworldadmin || padmin == AccountStatus::Player)) { if (Strings::ToInt(lsworldadmin) == 1 && pworldadmin != 0 && (padmin < pworldadmin || padmin == AccountStatus::Player)) {
padmin = pworldadmin; padmin = pworldadmin;
} }
} }

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