40 Commits

Author SHA1 Message Date
Chris Miles
d01d091b47
[Quests] Fix issue with Lua encounters loading in certain circumstances (#4378)
* [Quests] Fix issue with Lua encounters loading in certain circumstances

* Update quest_parser_collection.cpp

* Constant

* Move constant

* Fix

* Update quest_parser_collection.cpp
2024-06-01 18:07:38 -05:00
hg
b2d9de8d96
[Quests] Avoid Player and Bot quests in unloaded zone (#4232)
If a mob has a target when a zone is shutdown it will crash while trying
to dispatch EVENT_TARGET_CHANGE when the Mob destructor cleans up hatelists
if a quest interface isn't loaded for the type (in this case no bot scripts):

 	zone.exe!fmt::v10::format<std::string const &,char const *>(fmt::v10::basic_format_string<char,std::string const &,char const *> fmt={...}, const std::string & <args_0>={...}, const char * && <args_1>=0x0000000000000000) Line 2835	C++
>	zone.exe!QuestParserCollection::GetQIByBotQuest(std::string & filename={...}) Line 1138	C++
 	zone.exe!QuestParserCollection::BotHasQuestSubLocal(QuestEventID event_id=EVENT_TARGET_CHANGE) Line 353	C++
 	zone.exe!QuestParserCollection::BotHasQuestSub(QuestEventID event_id=EVENT_TARGET_CHANGE) Line 389	C++
 	zone.exe!Mob::SetTarget(Mob * mob=0x0000000000000000) Line 5431	C++
 	zone.exe!NPC::SetTarget(Mob * mob=0x0000000000000000) Line 575	C++
 	zone.exe!Mob::RemoveFromHateList(Mob * mob=0x000001bfbdc66040) Line 4894	C++
 	zone.exe!EntityList::RemoveFromTargets(Mob * mob=0x000001bfbdc66040, bool RemoveFromXTargets=true) Line 1530	C++
 	zone.exe!Mob::~Mob() Line 547	C++
 	zone.exe!NPC::~NPC() Line 537	C++
 	zone.exe!NPC::`scalar deleting destructor'(unsigned int)	C++
 	zone.exe!EntityList::RemoveAllMobs() Line 2678	C++
 	zone.exe!EntityList::Clear() Line 3090	C++
 	zone.exe!Zone::~Zone() Line 1103	C++
 	zone.exe!Zone::`scalar deleting destructor'(unsigned int)	C++
 	zone.exe!Zone::Shutdown(bool quiet=false) Line 928	C++

This is caused by the Zone destructor deleting short_name before calling
entity_list.Clear(). With an unloaded quest interface BotHasQuestSubLocal
calls GetQIByBotQuest which gets a null zone->GetShortName() and crashes
while formatting strings.

The immediate regressing commit for this crash is because a check for
zone->IsLoaded() was removed in 74f1eac4 with others that were removed
to fix a regression by #4025. GetQIByBotQuest and GetQIByPlayerQuest
always had this check and should have remained for them.

This restores the zone->IsLoaded() checks for GetQIByBotQuest/PlayerQuest.
The other functions cannot have that check added until the other issues
mentioned in #4149 are addressed.
2024-03-31 22:49:13 -05:00
Alex King
74f1eac401
[Bug Fix] Fix Spawns Not Parsing Quest on Zone Bootup (#4149)
* Update zone.cpp

* Fix

---------

Co-authored-by: Natedog2012 <jwalters_06@yahoo.com>
2024-03-05 18:20:42 -05:00
Chris Miles
d182fc3613
[Expansions] Zone Expansion Version Routing (#4084)
* Expansion version routing

* CheckForImproperContentFiles rule

* Update world_content_service.cpp

* Update client.cpp

* Update client.cpp

* Update CheckForImproperContentFiles

* Remove nek pok check

* Remove file checking

* Remove

* Command and dev tools menu tweaks

* Update world_content_service.cpp

* Update world_content_service.cpp

* Update version path

* Update content_filter_criteria.h

* Update content_filter_criteria.h

* Update quest_parser_collection.cpp

* Update comments

* PR feedback

* Update client_packet.cpp

* Remove notes column for display cleanliness
2024-02-19 20:35:17 -06:00
Alex King
331e04fbf8
[Quests] Cleanup Quest Parser Logic (#4025)
* [Quests] Cleanup Quest Parser Logic

# Notes
- Consolidate duplicated code into loops to make it easier to read and easier to add on to.

# Images

* Update quest_parser_collection.cpp

* Push

* Push

* Update embperl.cpp

* Push

* Additional cleanup, use File::Exists utility

* Range based loops

* Update embparser.cpp

* Cleanup

* Update embparser.cpp

---------

Co-authored-by: Akkadius <akkadius1@gmail.com>
2024-02-05 19:53:16 -05:00
Akkadius
54050924d8 Revert "[Quest API] Cleanup string copies and push_backs. (#2807)"
This reverts commit bcc2e022dcc41261ff2f1a7643ee6ed3e376e678.
2023-01-31 20:30:34 -06:00
Alex King
a25952910a
[Quest API] Add EVENT_ITEM_CLICK_CLIENT and EVENT_ITEM_CLICK_CAST_CLIENT to Perl/Lua. (#2810)
* [Quest API] Add EVENT_ITEM_CLICK_CLIENT and EVENT_ITEM_CLICK_CAST_CLIENT to Perl/Lua.

# Perl
- Add `EVENT_ITEM_CLICK_CLIENT`.
- Add `EVENT_ITEM_CLICK_CAST_CLIENT`.
- Both events export `$item_id`, `$item_name`, `$slot_id`, and `$spell_id`.

# Lua
- Add `event_item_click_client`.
- Add `event_item_click_cast_client`.
- Both events export `e.item_id`, `e.item_name`, `e.slot_id`, `e.spell_id`, and `e.item`.

# Notes
- Allows operators to handle item clicks in player scripts instead of item-specific scripts.

* Update lua_parser_events.cpp

* Remove optional bool.
2023-01-30 05:01:12 -06:00
Alex King
bcc2e022dc
[Quest API] Cleanup string copies and push_backs. (#2807)
# Notes
- Several places use `push_back` instead of `emplace_back`.
- Several places use `std::string` instead of `const std::string&`.
2023-01-29 15:14:49 -05:00
Alex King
3335cacac1
[Bots] Cleanup and remove preprocessors. (#2757)
* [Bots] Cleanup and remove preprocessors.

- Removes every `#ifdef BOTS` we have and locks bots behind `Bots:AllowBots` rule.
- Bot updates are now done by default similar to regular database updates.
- Modify `CMakeLists.txt`, `.drone.yml`, and `BUILD.md` to match the removal of `EQEMU_ENABLE_BOTS`.

* Cleanup

- Add SQL for enabling bots for servers with bots.
- Add message that tells players/operators bots are disabled.

* Suggested changes.

* Bot injection stuff

* Change SQL to bot SQL.

* Tweaks

* Remove `is_bot`

* Update version.h

* Update main.cpp

* Update database.cpp

* Fix name availability crash

* Remove bots from update script

Co-authored-by: Akkadius <akkadius1@gmail.com>
2023-01-20 12:35:33 -06:00
Chris Miles
d9e5056657
[Repositories] Migrate LoadPerlEventExportSettings to use repositories (#2637)
* [Repositories] Migrate LoadPerlEventExportSettings to use repositories

* Update quest_parser_collection.cpp
2022-12-14 22:26:14 -06:00
Aeadoin
99052aec8b
[Bot] Add EVENT_TRADE Support to Bots. (#2560)
* [Bot] Add EVENT_TRADE Support to Bots.

* Fixed issue with duplicate items after Event Trade

* Update logic

* Add CalcBotStats call after Bot Trade Event

* Fix Lua EVENT_TRADE.

* Formatting.

* More formatting.

Co-authored-by: Kinglykrab <kinglykrab@gmail.com>
2022-11-25 15:09:08 -05:00
Kinglykrab
856aa51cb8
[Bots] Add support for Bot scripting. (#2515)
* [Bots] Add support for Bot scripting.

# Perl
- Add support for `zone/bot.pl` and `zone/bot_v#.pl`.
- Add support for `global/global_bot.pl`.
- Add `$bot->SignalBot(signal_id)` to Perl.
- Add `$bot->OwnerMessage(message)` to Perl.
- Add `$entity_list->SignalAllBotsByOwnerCharacterID(character_id, signal_id)` to Perl.
- Add `$entity_list->SignalBotByBotID(bot_id, signal_id)` to Perl.
- Add `$entity_list->SignalBotByBotName(bot_name, signal_id)` to Perl.
- Add `EVENT_SPELL_EFFECT_BOT` to Perl.
- Add `EVENT_SPELL_EFFECT_BUFF_TIC_BOT` to Perl.

# Lua
- Add support for `zone/bot.lua` and `zone/bot_v#.lua`.
- Add support for `global/global_bot.lua`.
- Add `bot:SignalBot(signal_id)` to Lua.
- Add `bot:OwnerMessage(message)` to Lua.
- Add `entity_list:SignalAllBotsByOwnerCharacterID(character_id, signal_id)` to Lua.
- Add `entity_list:SignalBotByBotID(bot_id, signal_id)` to Lua.
- Add `entity_list:SignalBotByBotName(bot_name, signal_id)` to Lua.
- Add `EVENT_SPELL_EFFECT_BOT` to Lua.
- Add `EVENT_SPELL_EFFECT_BUFF_TIC_BOT` to Lua.

# Supported Bot Events
1. `EVENT_CAST`
2. `EVENT_CAST_BEGIN`
3. `EVENT_CAST_ON`
4. `EVENT_COMBAT`
5. `EVENT_DEATH`
6. `EVENT_DEATH_COMPLETE`
7. `EVENT_SAY`
8. `EVENT_SIGNAL`
9. `EVENT_SLAY`
10. `EVENT_SLAY_NPC`
11. `EVENT_SPAWN`
12. `EVENT_TARGET_CHANGE`
13. `EVENT_TIMER`
14. `EVENT_USE_SKILL`

# Common
- Convert NPC pointers in common events to Mob pointers so bots are supported.
- Convert signal IDs to `int` where it wasn't already, allowing negative signals to be sent properly.

* Add EVENT_POPUP_RESPONSE.

* Cleanup and fix EVENT_COMBAT/EVENT_SLAY/EVENT_NPC_SLAY.

* Fix DoNPCEmote calls.

* Update attack.cpp

* Update event_codes.h

* Update bot_command.cpp
2022-11-16 21:02:16 -06:00
Chris Miles
f8e7576ae7
[File Paths] Implement Path Manager (#2440)
* Push up branch for testing

* Path manager

* Tweaks

* Changes

* More path work

* Update paths for eqemu_server.pl

* More path work

* Import and export client files

* Path remove

* More path work

* Update eqemu_config.h

* Fix tests

* Tests disable temp

* Update eqemu_config.h

* Update .drone.yml

* Hook tests back up

* Update main.cpp

* Platform tests

* Fix include

* Use std::filesystem on windows

* Fix IPCMutex name on windows

* std::filesystem changes

* Update path_manager.cpp

* Explicit string cast

* Explicit string cast

* Update path_manager.cpp

* Windows fixes

* Mapped files

* Relative fixes

* Use relative paths off of cwd

* Update Debian image to Debian 11 (updates GCC)

Co-authored-by: hg <4683435+hgtw@users.noreply.github.com>
2022-09-28 04:08:59 -05:00
hg
dbf8440a32
[Quest API] Let HasQuestSub check encounters (#2435)
This fixes an edge case where trading would not detect the npc had a
quest handler if it was registered inside a Lua encounter.
2022-09-20 13:21:48 -04:00
Michael Cook (mackal)
5331f4d841
[CPP] Update C++ standard to C++17 (#2308)
* Update C++ standard to C++17

* Nuke EQ::Any in favor of std::any

* Remove std::iterator due to deprecation

* Replace result_of with invoke_result due to deprecation
2022-07-27 09:00:09 -05:00
Kinglykrab
7d89c05a48
[Commmands] Cleanup #questerrors Command. (#2116)
- Cleanup messages and logic.
2022-05-06 20:42:47 -04:00
Kinglykrab
81e7cf5a32
[Quest API] Convert Spell Events to similar formats and exports. (#1618)
* [Quest API] Convert Spell Events to similar formats and exports.
Export spell ID, caster ID, caster level, tics remaining, and buff slot to Perl/Lua spell events.
- Export e.buff_slot, e.caster_id, e.caster_level, e.spell_id, and e.tics_remaining to `event_spell_buff_tic`, `event_spell_effect`, and `event_spell_fade` in Lua.
- Export $buff_slot, $caster_id, $caster_level, $spell_id, $tics_remaining to `EVENT_SPELL_EFFECT_BUFF_TIC_CLIENT`, `EVENT_SPELL_EFFECT_BUFF_TIC_NPC`, `EVENT_SPELL_EFFECT_CLIENT`, `EVENT_SPELL_EFFECT_NPC`, and `EVENT_SPELL_FADE` in Perl.

* Formatting.

* Remove debug variable.
2021-10-20 16:02:12 -04:00
Michael Cook (mackal)
43fade82e5 Fix ReloadQuest on Shutdown crash related to encounters
Basically, EntityList::RemoveAllEncounters is called before ReloadQuests
resulting in stale pointers in the lua_encounters map.

We just have to remove the entry from the map.
2021-02-24 01:03:38 -05:00
Akkadius
3f62da4573 Merge branch 'master' of https://github.com/EQEmu/Server into integration/multi-tenancy-expansions-repository 2020-05-23 22:33:34 -05:00
KimLS
2fbd5aaccc Rename namespace EQEmu to namespace EQ (so we don't have two similar but different namespaces anymore) 2020-05-17 18:36:06 -07:00
Akkadius
286c08b8d5 Migrate spawn tables [skip ci] 2020-03-12 00:00:39 -05:00
Akkadius
98cbb7d781 Simplify log calls 2019-09-01 21:04:58 -05:00
Akkadius
d3803045bc Add log aliases to make logging much easier to use (All FMT driven) 2019-09-01 20:47:26 -05:00
Akkadius
7aa1d243b0 [Performance] Reworked how all log calls are made in the source, see changelog.txt for more details 2017-04-01 03:51:46 -05:00
Akkadius
9d0308c9bf [Performance] Fixed an overhead issue where many hot paths would trigger quest subroutines and beneath that the code would try to see if a quest existed perpetually (checking if file exists) even though it should have determined the quest didn't exist the first time.
- This caused a lot of overhead in an instance where an entire zone of NPC's is pathing, triggering EVENT_WAYPOINT_ARRIVE and EVENT_WAYPOINT_DEPART when there is no global_npc.pl/lua, or all NPC's pathing don't have a quest assigned, similar behavior would occur. This goes for any other type of quests: spells, items, encounters etc.
2017-03-30 05:22:47 -05:00
Uleat
8b5dd58e96 Renamed struct EQEmu::ItemBase to EQEmu::ItemData and class ItemInst to EQEmu::ItemInstance 2016-10-16 05:10:54 -04:00
Michael Cook (mackal)
60da544d3a clang-tidy modernize-use-auto 2016-05-25 16:10:28 -04:00
phredi
b997a040d7 Config File Update Initial Update 2016-05-20 21:03:34 -05:00
Akkadius
8425607460 Implemented standardized zone controller scripts (Rule Zone, UseZoneController) Defaulted to true
- When a zone boots, it will spawn an invisible npc by the name of zone_controller
	- Lua and Perl scripts can be represented with this npc as zone_controller.pl/lua
	- This NPC's ID is ruled be define ZONE_CONTROLLER_NPC_ID 10
	- Two EVENT's uniquely are handled with this NPC/controller (They only work with the zone_controller NPC)
		- EVENT_SPAWN_ZONE :: All NPC spawns in the zone trigger the controller and pass the following variables:
			$spawned_entity_id
			$spawned_npc_id
		- EVENT_DEATH_ZONE :: All NPC deaths in the zone trigger the controller event and pass the following variables:
			$killer_id
			$killer_damage
			$killer_spell
			$killer_skill
			$killed_npc_id
2015-12-29 04:08:10 -06:00
Akkadius
53c8d63981 Implement Perl Export Variable settings map (Huge performance boost) (Preliminary) 2015-11-01 15:59:24 -06:00
Russell Kinasz
2c6fd44811 Implemented encounter timers - no spawn required 2015-06-02 12:25:09 -07:00
Akkadius
1966324112 Changed NPCTypes Data to bulk load when the zone loads or Repops, this bulk loading is stored in the npc_types cache 2015-02-12 19:57:24 -06:00
Akkadius
c5447778a6 Merge remote-tracking branch 'remotes/origin/master' into logging_changes
Conflicts:
	world/client.cpp
	world/worlddb.cpp
	zone/aggro.cpp
	zone/bot.cpp
	zone/client.cpp
	zone/client_packet.cpp
	zone/client_process.cpp
	zone/doors.cpp
	zone/entity.cpp
	zone/inventory.cpp
	zone/mob_ai.cpp
	zone/perl_client.cpp
	zone/spells.cpp
	zone/waypoints.cpp
	zone/zone.cpp
	zone/zonedb.cpp
	zone/zoning.cpp
2015-01-21 17:29:30 -06:00
Akkadius
0d9b6703a6 Rename debug.h to global_define.h, update cmakelists and such 2015-01-19 04:12:09 -06:00
Michael Cook (mackal)
f4224b296a We don't need to cast these anymore 2015-01-18 18:29:37 -05:00
Uleat
34ab3e10f5 Added some nullptr checks for ItemInst* in a few places (tradeskills.cpp - particularly augments - needs a better review) 2014-12-23 10:14:45 -05:00
Akkadius
e7911df851 quest_parser_collection.cpp & .h header include cleanup 2014-12-15 18:33:23 -06:00
KimLS
6597967acd Changed void* to EQEmu::Any in quest interface. Been meaning to change from void* for a while to a structure that data hides instead. 2014-08-25 22:59:52 -07:00
Uleat
52ae78709b First attempt at fixing zone shutdown crashes. (Mob timer processing accessing released resources.) 2014-08-24 05:42:43 -04:00
KimLS
07a2cbe9a5 Renamed zone files 2014-08-21 23:46:01 -07:00