8902 Commits

Author SHA1 Message Date
hg
dadc1b2843
[Expeditions] Refactor expedition caching (#1315)
Add common expedition base class

Use repository for zone and world expedition caching

World now stores members and leader as Member objects instead of ids

This improves readability of the caching methods and lets world cache
expedition dzs and members like zone. World also now caches expeditions
as unique_ptr which will be necessary for future dz callback lambdas
that capture 'this' so addresses don't change on cache vector resizes.
2021-04-07 01:20:35 -05:00
Michael Cook (mackal)
0534a2c6be
Switch scheduled hot zone check to search instead of split (#1313)
Using search_deliminated_string here is significantly faster than
splitting, most likely because of dynamic memory management

Some tests on my system:

----------------------------------------------------
Benchmark             Time           CPU Iterations
----------------------------------------------------
bench_split         864 ns        864 ns     807922
bench_search         35 ns         35 ns   20265205

This test was a case where the string was present somewhere in the
middle which gave a ~96% speed up

----------------------------------------------------
Benchmark             Time           CPU Iterations
----------------------------------------------------
bench_split         936 ns        936 ns     725518
bench_search         61 ns         61 ns   11156359

This test was when the string was not present, which will be the vast
majority of times this is actually checked, was ~93% speed up
2021-04-07 01:17:30 -05:00
RoTPvP
050e78b1b6
Added a check to stop Bard song for Mezz/Stun (#1319)
* Added a check to stop Bard song for Mezz/Stun

* Cleaned Song stun / mezz stop

* Update client_process.cpp

* removed bard check & added else where

* code clean up

Co-authored-by: ProducerZekServer <go@away.com>
2021-04-02 23:44:59 -04:00
Michael Cook (mackal)
084b253ff7
Hack to fix repulsable bard charms (#1320)
This isn't the exactly the right way, but it's behavior is much closer
to live than current for Solon's Song of the Sirens (725), the other
bard charms don't repulse due to mana cost
2021-04-01 14:19:47 -04:00
Michael Cook (mackal)
a9a83a2052
[Bug Fix] Misc Bard Song Fixes (#1317)
* Bards song with a mana cost shouldn't repulse

* Bard songs with SE_TemporaryPets shouldn't repulse

This is mostly just an issue with Vet AAs, the actually songs have a
recast, so are already handled

* SE_Familiar should be prevented as well
2021-04-01 14:19:29 -04:00
Akkadius
d117ce0bf2 [Hotfix] Incorrect Perl usage method (docs) 2021-03-31 00:18:43 -05:00
hg
10b1f7e1ca
Add missing includes to fix windows compile (#1314) 2021-03-29 18:09:36 -05:00
Akkadius
4ac32d89e8 [Hotfix] DB Manifest 2021-03-29 03:01:07 -05:00
Chris Miles
7aa5308f9c
[Scheduler] Event scheduler implementation (#1257)
* Event scheduler implementation

* Create 2021_02_17_server_scheduled_events.sql

* Tweak

* Remove unused event [skip ci]

* Cleanup [skip ci]

* PR adjustments

* Database manifest
2021-03-29 02:52:57 -05:00
Michael Cook (mackal)
f51bc4daaf
[Fix] Clean up Filtered/MessageString functions (#1311)
This solves the OOB issue pointed out in #1304 and cleans up the code a
bit so it should be less error prone
2021-03-29 02:18:03 -05:00
hg
049fe55c7f
[Expeditions] Create common dz abstract class (#1312)
This creates an abstract class in common so zone and world can share
most of the implementation. World now has access to the same dz data and
api as zone.

Rename CharacterChange to AddRemoveCharacter for clarity

Rename GetRemainingDuration to GetDurationRemaining for consistency

Move dynamic zone queries to custom repository methods
2021-03-29 02:17:36 -05:00
hg
f5cf566fca
[Expeditions] Let dz process its expired state (#1310)
Move early empty shutdown and process rate rules to DynamicZone scope

This decouples the expired status check from expeditions into an
internal dz method that can be called by its owning system
2021-03-28 20:43:09 -05:00
Alex
97c11a1199
[Quest API] Add new zone name methods to Perl and Lua. (#1309)
- Add quest::GetZoneShortName(zone_id) to Perl.
- Add quest::GetZoneLongNameByID(zone_id) to Perl.
- Add eq.get_zone_id_by_name(zone_name) to Lua.
- Add eq.get_zone_short_name_by_id(zone_id) to Lua.
- Add eq.get_zone_long_name_by_id(zone_id) to Lua.
- Add eq.get_zone_long_name_by_name(zone_name) to Lua.
2021-03-28 20:25:50 -05:00
Akkadius
ba64d6f494 [Installer] Swap unstable powershell download for Perl LWP::Simple call 2021-03-28 20:04:34 -05:00
Alex
410ba4b19a
[Rules] Cleanup all unused rules. (#1308) 2021-03-28 18:37:21 -05:00
Paul Coene
74076078bb
[Boats] Fix x/y offsets from client to reflect EQ x/y instead of boat heading… (#1296)
* Fix x/y offsets from client to reflect EQ x/y instead of boat heading x/y

* Use std version of math calls and reduce the # of calls

* Remove errant instrumentation

Co-authored-by: Noudess <noudess@gmail.com>
2021-03-28 18:20:02 -05:00
hg
d9e23a0303
[Expeditions] Decouple dz updates from expeditions (#1303)
Use internal dz messages to process duration and location changes

Add world DynamicZone class (later this will inherit from a base)

Add FindDynamicZoneByID to get dz from zone and world system caches
2021-03-28 18:14:36 -05:00
Thalix
dbb9c1d4f4
Minor ruletypes.h cleanup (#1306)
Minor ruletypes.h cleanup
2021-03-28 18:06:56 -05:00
Michael Cook (mackal)
d202695e88
[Cleanup] Only link Lua with zone (#1288)
Only zone requires to be linked to lua, so let's not link EVERYTHING.

There is probably more clean up we could do, but I know for a fact Lua
is only used by zone.

This probably has some measurable benefits that probably don't really
matter that much :)
2021-03-19 00:12:46 -05:00
Michael Cook (mackal)
323f5ea92e
[Bug Fix] Add Bounds Checking to OP_LFGCommand Comment Processing
Theoretically this could be used to corrupt memory, but they would have
to get extremely lucky to actually execute a successful attack
2021-03-18 23:43:13 -05:00
hg
5b74f1e756
[Expeditions] Refactor expedition requests (#1301)
Move ExpeditionLockoutTimer to common

This simplifies expedition request conflict checks and uses repository
for the queries instead of processing the query result directly.
2021-03-18 23:42:41 -05:00
hg
ee4af65268
[Expeditions] Cleanup client dz safe return methods (#1300)
This changes Zone::GetDynamicZone to return a pointer instead of a copy
and also lets DynamicZone be forward declared in zone.h
2021-03-18 23:42:20 -05:00
hg
739b975cad
[Expeditions] [Quest API] Add expedition IsLocked to Quest API (#1292) 2021-03-16 00:04:08 -05:00
Thalix
5035451af7
[Crash] Bugfix for zone crash caused by #flymode -1 (#1291)
* Update command.cpp

Fixed typo in the command description.

* Bugfix for #flymode zone crash

Bugfix for #flymode zone crash when invalid values are passed. Also, when entering #flymode without parameters, the correct syntax is now displayed.

* Changed as requested
2021-03-16 00:03:35 -05:00
hg
18a3ff5f12
Throttle auto expedition leader changes (#1293)
This fixes unnecessary leader processing on mass dzquits

Also marks leader dirty for empty expeditions in case something goes
wrong (shouldn't be possible after 62e480fe)
2021-03-16 00:01:48 -05:00
hg
0d12bf0b1f
[Expeditions] Store description and leader name on dz (#1294)
* Rename dynamic zone source files

* Store description and leader name on dz

Removes the DynamicZoneInfo struct used for switch list window. This
data can be stored on DynamicZone and kept updated by its owning system

* Separate create compass packet method

Cleanup MarkSingleCompassLoc
2021-03-16 00:00:55 -05:00
splose
b3fbe1b015
add quest::get_spell_level(uint16 spell_id, uint8 class_id) (#1295) 2021-03-15 23:59:09 -05:00
splose
e9cd0b15a2
setting spawn2.version to -1 will now properly spawn mobs in all zone versions (#1299) 2021-03-15 23:57:54 -05:00
Alex
cd08c96fa4
[Quest API] Add secondstotime(duration) to Perl and Lua. (#1281)
- Add quest::converttime(duration) to Perl.
- Add eq.convert_time(duration) to Lua.
2021-03-11 21:38:47 -05:00
Paul Coene
ac4a993259
Remove unneeded calls to DoAnim() for spells/bardsong (#1290)
* Removed DoAnim() call from spells and bard song.  Tested on rof2 and titanium

Co-authored-by: Noudess <noudess@gmail.com>
2021-03-10 00:07:30 -05:00
Thalix
435bac5599
Update command.cpp (#1289)
Fixed typo in the command description.
2021-03-07 14:40:50 -05:00
Michael Cook (mackal)
d5d6b911b0
Merge pull request #1286 from EQEmu/bug_fix/petonspawn_copypasteerror
Fix copy and paste error
2021-03-06 20:09:12 -05:00
Michael Cook (mackal)
29cdca380f Fix copy and paste error 2021-03-06 19:58:18 -05:00
Alex
e5f5db69b4
Merge pull request #1280 from EQEmu/bug_fix/strcpy_overlap_GetGroupLeadershipInfo
[ASan] Fix strcpy-param-overlap with GetGroupLeadershipInfo calls
2021-03-05 19:24:42 -08:00
Alex
d635e69ee3
Merge pull request #1283 from EQEmu/cleanup/Wformat-overflow
[Cleanup] Make code -Wformat-overflow safe
2021-03-05 19:23:48 -08:00
Alex
a1531aa057
Merge pull request #1282 from EQEmu/bug_fix/spawngroup_leak_repop
[Leak] Port SpawnGroup stuff to unique_ptr to fix leak
2021-03-05 19:23:00 -08:00
Alex
b24ba221e9
Merge pull request #1279 from EQEmu/bug_fix/group_delete
[ASan] Fix heap-use-after-free issue with groups
2021-03-05 19:20:34 -08:00
Alex
253f0594e4
Merge pull request #1278 from EQEmu/akkadius/fix-skill-caps-loading-consistency
[Bugfix] Fix Skill Caps Loading References
2021-03-05 19:20:11 -08:00
Alex
02517bf6ab
Merge pull request #1276 from EQEmu/cleanup/uv_handle_cast_deletes
[ASan] Use casts to silence ASan complaints
2021-03-05 19:19:42 -08:00
Alex
184128a79b
Merge pull request #1275 from EQEmu/bug_fix/stack-buffer-overflow_StopLFP
[ASan] Fix stack-buffer-overflow thanks to StopLFP
2021-03-05 19:17:12 -08:00
Alex
93869dbef6
Merge pull request #1273 from EQEmu/hate_list_quest_api
[Quest API] Add GetHateClosest() and GetHateListByDistance(distance) to Perl and Lua.
2021-03-05 19:16:38 -08:00
Alex
af82a6c5d5
Merge pull request #1272 from noudess/master
[Bug Fix] Do not summon pet or set new pet state when PC summoned by a mob
2021-03-05 19:16:03 -08:00
Alex
fdca333280
Merge pull request #1271 from EQEmu/cleanup/world_client_clearance
[ASan] Make Client::Clearance less gross
2021-03-05 19:14:26 -08:00
Alex
c954c08c07
Merge pull request #1267 from EQEmu/bug_fix/realodquest_encounter_crash
[Crash] Fix ReloadQuest on Shutdown crash related to encounters
2021-03-05 19:13:58 -08:00
Michael Cook (mackal)
0b8220be32 Clean up last name handling in NPC::PetOnSpawn
Same as last time
2021-03-05 15:51:59 -05:00
Michael Cook (mackal)
f7d40ec88e Clean up Merc::LoadMerc lastname processing
This is still less than ideal, but client's name restrictions should
prevent this from being an actual problem
2021-03-05 15:43:06 -05:00
Michael Cook (mackal)
316336d1cf Nuke ZoneDatabase::GetEventLogs
This wasn't called anywhere and was throwing format-overflow warnings
2021-03-05 15:25:32 -05:00
Michael Cook (mackal)
224c26620e Clean up MOTD processing 2021-03-05 15:24:40 -05:00
Michael Cook (mackal)
c6d5864aa9 Port SpawnGroup stuff to unique_ptr to fix leak
This was leaking on #repop, unsure of other cases, smart pointers should
cover us though.

Direct leak of 3600 byte(s) in 18 object(s) allocated from:
    #0 0x7f2b3dbe0d30 in operator new(unsigned long) (/lib/x86_64-linux-gnu/libasan.so.5+0xead30)
    #1 0x5645dc7c9dff in ZoneDatabase::LoadSpawnGroups(char const*, unsigned short, SpawnGroupList*) ../zone/spawngroup.cpp:241
    #2 0x5645dc9db3f5 in Zone::Depop(bool) ../zone/zone.cpp:1746
    #3 0x5645dca1ba6b in Zone::Repop(unsigned int) ../zone/zone.cpp:1777
    #4 0x5645db4624b7 in command_repop(Client*, Seperator const*) ../zone/command.cpp:5683

Indirect leak of 6552 byte(s) in 273 object(s) allocated from:
    #0 0x7f26f2ff8d30 in operator new(unsigned long) (/lib/x86_64-linux-gnu/libasan.so.5+0xead30)
    #1 0x558d00490bc6 in __gnu_cxx::new_allocator<std::_List_node<SpawnEntry*> >::allocate(unsigned long, void const*) /usr/include/c++/8/ext/new_allocator.h:111
    #2 0x558d00490bc6 in std::allocator_traits<std::allocator<std::_List_node<SpawnEntry*> > >::allocate(std::allocator<std::_List_node<SpawnEntry*> >&, unsigned long) /usr/include/c++/8/bits/alloc_traits.h:436
    #3 0x558d00490bc6 in std::__cxx11::_List_base<SpawnEntry*, std::allocator<SpawnEntry*> >::_M_get_node() /usr/include/c++/8/bits/stl_list.h:450
    #4 0x558d00490bc6 in std::_List_node<SpawnEntry*>* std::__cxx11::list<SpawnEntry*, std::allocator<SpawnEntry*> >::_M_create_node<SpawnEntry* const&>(SpawnEntry* const&) /usr/include/c++/8/bits/stl_list.h:642
    #5 0x558d00490bc6 in void std::__cxx11::list<SpawnEntry*, std::allocator<SpawnEntry*> >::_M_insert<SpawnEntry* const&>(std::_List_iterator<SpawnEntry*>, SpawnEntry* const&) /usr/include/c++/8/bits/stl_list.h:1903
    #6 0x558d00490bc6 in std::__cxx11::list<SpawnEntry*, std::allocator<SpawnEntry*> >::push_back(SpawnEntry* const&) /usr/include/c++/8/bits/stl_list.h:1220
    #7 0x558d00490bc6 in SpawnGroup::AddSpawnEntry(SpawnEntry*) ../zone/spawngroup.cpp:122
    #8 0x558d00490bc6 in ZoneDatabase::LoadSpawnGroups(char const*, unsigned short, SpawnGroupList*) ../zone/spawngroup.cpp:291
    #9 0x558d006a1465 in Zone::Depop(bool) ../zone/zone.cpp:1746
    #10 0x558d006e1adb in Zone::Repop(unsigned int) ../zone/zone.cpp:1777
2021-03-02 12:39:04 -05:00
Michael Cook (mackal)
c45395be95 Fix strcpy-param-overlap with GetGroupLeadershipInfo calls
==1810==ERROR: AddressSanitizer: strcpy-param-overlap: memory ranges [0x7ffef04baf90,0x7ffef04baf98) and [0x7ffef04baf90, 0x7ffef04baf98) overlap
    #0 0x7f163bb9509e  (/lib/x86_64-linux-gnu/libasan.so.5+0x4f09e)
    #1 0x5652caed27b3 in Client::Handle_Connect_OP_ZoneEntry(EQApplicationPacket const*) ../zone/client_packet.cpp:1535

==1918==ERROR: AddressSanitizer: strcpy-param-overlap: memory ranges [0x7ffddc8057c0,0x7ffddc8057c8) and [0x7ffddc8057c0, 0x7ffddc8057c8) overlap
    #0 0x7fc61ee0e09e  (/lib/x86_64-linux-gnu/libasan.so.5+0x4f09e)
    #1 0x56023c149698 in WorldServer::HandleMessage(unsigned short, EQ::Net::Packet const&) ../zone/worldserver.cpp:1055
2021-02-28 21:42:51 -05:00