Commit Graph
642 Commits
Author SHA1 Message Date
Treeston 4b588694ca Core/Creature: Fix an issue that sometimes prevented spellcast focus targets from being reacquired.
(cherry picked from commit fcce90508d899641494d7c281a0e08e411a0d5ab)
2021-12-18 20:29:05 +01:00
ccrs 31bf529667 Core/Creature: 4a219ed codestyle followup, for real this time
(cherry picked from commit 30f4aabf64897f11f212ea67a3192206fe97f7b0)
2021-12-18 15:39:58 +01:00
Treeston 51fbda4223 Core/Pooling: Quest pooling rewrite: (PR#23627)
- Split quest pooling from PoolMgr (into QuestPoolMgr)
- Proper saving/restoring on server restart
- No more hacking into sObjectMgr to insert/remove available quests

(cherry picked from commit a5e73e41c0e813e674bb0a644e0052052435494e)
2021-12-18 15:28:45 +01:00
Treeston a90073dadd no idea what happened there (4a219ed follow-up)
(cherry picked from commit b159921099e3d10fbe282d9496b9ffb56f28f16d)
2021-12-18 11:37:33 +01:00
Treeston 14c38a1c52 Core/Unit: Spell focusing now no longer nonsensical. HasSpellFocus always const. Error logs for various stuff.
(cherry picked from commit 4a219eda07c353139608065f7d0a016094ee4ce0)
2021-12-18 11:36:50 +01:00
ccrs 44e9572a77 Core/Creature: add a const spell-focus-check method and remove a nasty const_cast from IsMovementPreventedByCasting()
closes #23670
maybe #22857 ?

(cherry picked from commit 8e88f4501d8e3b537e96fa56ad7dd25a61dff968)
2021-12-18 00:35:14 +01:00
ccrs 4db13853f7 Core/Unit: rename more things
Workaround prework till actual facing system rework arrives

(cherry picked from commit 3a4021be50d37c1c967db1ee73defa509264d5bc)
2021-12-18 00:34:15 +01:00
ccrs a58881d6da Core/Unit: rename more methods
Workaround prework till actual facing system rework arrives

(cherry picked from commit 85ad0befc51879627f865c86a6b415ca12401fe3)
2021-12-18 00:29:38 +01:00
ccrs be4ed9152c Core/Unit: rename IsFocusing method
Workaround prework till actual facing system rework arrives

(cherry picked from commit ec9f15a5fff7830bf2aebc517654784a6d54bb74)
2021-12-18 00:25:14 +01:00
Treeston 3db58c4d96 Core/SmartAI: SmartAI creatures no longer process health-based hooks after death.
(cherry picked from commit 1faa54fe8b2690507e4177a9a7373c0b24855291)
2021-12-18 00:03:55 +01:00
Treeston 8c3eb07889 Scripts/FollowerAI: Some cleanup:
- FollowerAI properly resumes follow after evading.
- Removed duplicated getters from CreatureAI (IsEscorted vs IsEscortNPC), they were used to do the same thing
- FollowerAI properly assists in combat.
- FollowerAI properly despawns if quest is abandoned.
- FollowerAI now supports dynamic respawning for escort NPCs.

(cherry picked from commit 3d4bebd8d9210fbb84f8fc75742e248071192b09)
2021-12-17 23:05:55 +01:00
Treeston 917d9b7621 Scripts/ICC: Prevent Professor Putricide from displaying weird behavior during the Rotface/Festergut encounters as a result of his boss boundary
(cherry picked from commit 7fa990edc6cbae05e8b68da58313fd675ac5fa81)
2021-12-17 22:46:06 +01:00
Treeston 6b1ca0ca12 Core/Combat: Properly unset engagement flag on death.
(cherry picked from commit 9c603ea87f09c47d52f093ccc73ee75c15eff6f5)
2021-12-17 22:45:55 +01:00
Treeston c13d83796f Core/AI: Finally move the "is creature engaged" flag to be a property of the creature AI, where it honestly always belonged. Fixes #17981 and #23602 for real this time.
(cherry picked from commit 0e7c66cb4c7ff7d44e232d0b50703a48605ffd24)
2021-12-17 00:23:33 +01:00
Wyrserth 537b425377 Core/Creature: don't set guardian stats in Creature::UpdateEntry(), because stat calculation from guardians is already done in Guardian::InitStatsForLevel.
Closes #281.

Signed-off-by: Wyrserth <[email protected]>
(cherry picked from commit 5f5d2028df70e82d5cd70837953acd059f2ac7fb)
2021-12-16 21:57:19 +01:00
Treeston eee950cdd7 Core/Misc: Various dynspawn cleanup and refactors split off from pooling rewrite:
- Map::RemoveRespawnTime(SpawnObjectType, LowType, doRespawn) split into Map::Respawn and Map::RemoveRespawnTime, without the extra boolean
- Map::RemoveRespawnTime(RespawnInfo*) merged into Map::DeleteRespawnInfo(RespawnInfo*) and is now private
- Map::DeleteRespawnInfo(void) renamed to Map::UnloadAllRespawnInfos to properly describe what it does
- Map::ProcessRespawns now actually saves the delayed respawn time to DB if the respawn was delayed
- Map::AddRespawnInfo now takes const reference, and returns success as a boolean
- Map::AddRespawnInfo no longer offers an unused "replace" parameter
- Map::DeleteRespawnInfo no longer offers a variety of unused private overloads
- Map::SaveRespawnTime no longer offers a tantalizing writeDB parameter. Parameter is now called "startup" to properly describe what it does.
- Map::SaveRespawnInfoDB now takes RespawnInfo reference instead of all the various fields. Still public because compatibility mode. QQ.
- Map::GetWorldObjectBySpawnId sanitized
- Map::GetXRespawnTime methods sanitized to all go through Map::GetRespawnTime

(cherry picked from commit d60082ae866d77a12a9e6d09dfce27fc1cb5df90)
2021-12-16 01:33:09 +01:00
Treeston d5e58cef69 Core/Spawns: Exterminate CONFIG_SAVE_RESPAWN_TIME_IMMEDIATELY with extreme prejudice. (It didn't work anyway.)
(cherry picked from commit 26440857c1a74031ea0a0234ca0b0fcb09b6bcb0)
2021-12-16 01:18:15 +01:00
Treeston 2532de6acb Entities/Unit: Nuke Map::ForceRespawn from orbit, with the following implications:
- .npc respawn no longer causes stupid things to happen (Fixes #23014)
- ::DeleteFromDB methods on Creature and GameObject rewritten to be as sensible as such a colossally stupid method can ever be. They're static now.
- .npc delete and .gobj delete ported to new argument handling, and rewritten as per above. They can no longer crash the server when used in instances, too. Yay for that.
- Adjusted various dusty cobwebbed hacks around the core (why does waypoint visualization use permanent spawns *shudder*) to still work too.

(cherry picked from commit 84b7b2e08ea55575cbe62d795383d4a5341ffd4d)
2021-12-14 22:42:22 +01:00
Treeston 2225cb1201 Entities/Creature: Some asserts are now LOG_ERRORs that block spawning. Fix a group spawning bug exposed by the CoS merge. Improve some command output.
(cherry picked from commit ded18a2690063991d5440df7d3e5d526b884ec16)
2021-12-14 22:24:24 +01:00
Shauren d249a2a98a Warning fixes 2021-12-14 22:15:04 +01:00
Ovahlord 3fc20584bc Core/Creature: Reworked creature aggro radius calculation (#20615)
* Core/Creatures: rewrote creature aggro radius calculation
* Formulas are taken from WoW Wiki

(cherry picked from commit 980047763a685217e712f58b8713d48523d90ccb)
2021-12-14 21:09:11 +01:00
ForesterDev 104ec7a81a Core/Unit: Implement more helper methods (#23555)
(cherry picked from commit c44fb37f74347e3b6d399c941716971503af4cf8)
2021-12-14 20:42:32 +01:00
ccrs 4e6c59dca7 Core/Unit: rename several getters to follow codestyle
uint8 GetLevel()
        uint8 GetLevelForTarget(WorldObject const* /*target*/)
        void SetLevel(uint8 lvl)
        uint8 GetRace()
        uint32 GetRaceMask()
        uint8 GetClass()
        uint32 GetClassMask()
        uint8 GetGender()

(cherry picked from commit 5c09ff51f7015b775def8d5cc1f678eaef37200f)
2021-12-13 00:42:20 +01:00
Wyrserth 62f5d9b46b Core/SAI: do not pass old creatureData to UpdateEntry() and keep current health when changing a NPC's entry. (#23493)
(cherry picked from commit 8967cc96df4c1c5c7465e9fd1fa66400f3e992b3)
2021-12-13 00:42:17 +01:00
Treeston f29644efd5 some more cleanup, a5f8c0d follow-up
(cherry picked from commit 00728cef1565a78b39541fbaea5923dcfc243743)
2021-12-12 00:33:36 +01:00
Treeston e3411b4740 Core/Creature: Attach out-of-combat health regen to the Engaged system, not the Combat flag. Closes #21571.
(cherry picked from commit a5f8c0d30ca8793a0d1f97a16ab0e0a9f066dab4)
2021-12-12 00:33:23 +01:00
Treeston 35e55f1089 Core/Entities: Kick engagement logic upstairs to Unit (from ThreatManager), since all Units with AI need it (not just those with threat list). Fixes #17981.
(cherry picked from commit dbe3bbefe734f8824e8f07c302e256f0d446b974)
2021-12-12 00:31:15 +01:00
Wyrserth 3278f87789 Core/Loot: fix some other cases where a creature should not be able to set focus. (#23415)
(cherry picked from commit d50be8e020c235617cae6d85e214794c164a73c9)
2021-12-11 14:12:54 +01:00
Wyrserth 264373bb65 Core/Creature: prevent dead creatures from setting a focus target, so they won't turn when hit by certain spells. (#23367)
(cherry picked from commit 0a24a6571b7065d66afe52fc7b0b00f6366272bf)
2021-12-11 13:06:44 +01:00
Aokromes 1d22ade73f Core/Creature: equipment_id field on creature table is not working correctly, if it's set to 0 the npc still spawn with the equipement. (#23273)
By Malcrom
Closes #16416

(cherry picked from commit 61ba477c7733e2d69f1bc287f2bff853cbc67d16)
2021-12-05 18:20:36 +01:00
ccrs c22431936e Core/Creature: couple refactors/renaming
(cherry picked from commit 69c15f5ae769612c89346c6a308655d0987caae7)
2021-12-02 23:45:14 +01:00
Ovah d5daa2ad49 Core/Objects: use the actual collision height of players and creatures to get more accurate liquid status results (#23070)
(cherry picked from commit b9e9ccf93c63c3b27d7a6f9eced0beb4e14af40e)
2021-11-26 22:24:07 +01:00
Sorikoff a57ca5cea2 Core/Movement: Allow using run when moving randomly (#23081)
* Allow run when moving randomly

(cherry picked from commit 34cfa69efd1857540f1f44b118086bb02334c100)
2021-11-24 20:35:15 +01:00
Sorikoff 956158d299 Core/Movement: Allow using walk when chasing v2 (#23073)
* Allow walk when chasing

(cherry picked from commit dbadb6369cf0b6d394fffaa1dedc612dfb5cbe2a)
2021-11-24 20:34:54 +01:00
Giacomo Pozzoni 31dca39c05 3.3.5 threat assert (#23034)
* Core/Creature: Change assert about Threat to log

(cherry picked from commit cb8ff7976b1419c6a1334bb49783480d543aff16)
2021-11-23 22:48:39 +01:00
Shauren f2688f3abe Remove whitespace (63ea6a50e851f9df82381e254a7c56e1c575cfe2) 2021-11-21 20:01:49 +01:00
Giacomo Pozzoni ed88435494 3.3.5 UnitAI (#22911)
* Core/AI: Revamp how UnitAI changes are applied

Revamp how UnitAI changes are applied by storing current AI in a variable and all previous AIs plus current in a stack.
The callers can push/pop AIs on the stack that will take effect only in next Unit::Update() call.
The current AI will be a valid object for the whole duration of Unit::Update() and until next Unit::Update() call.

* Core/AI: Apply new AI change code

* Core/AI: Fix build

* Core/AI: Fix crash on Creature::AIM_Create()

* Core/AI: Fix crash

* Core/AI: Restore ASSERT

* Core/AI: Fix UnitAI not being popped properly when restoring a charmed AI

(cherry picked from commit 8f9654d8176646c3076482477fc4b91011fb83cc)
2021-11-21 15:36:57 +01:00
Giacomo Pozzoni d5c41d23e6 Core/Misc: Log more information in asserts (#22783)
* Core/Misc: Log more information in asserts

Add a new function GetDebugInfos() to types that could trigger an ASSERT() to easily include more useful information in crashlogs.
This is an initial commit that requires many more commits to implement the new GetDebugInfos() function in all required types.
If the type doesn't have the function, the global default one is picked which doesn't log anything.

* Core/Misc: Fix dynamic build

Add missing attribute for dynamic build

* Core/Misc: Fix gcc/clang build

* Core/Misc: Rename GetDebugInfos() to GetDebugInfo()

* Core/Misc: Fix FormatAssertionMessage() adding an extra '\0'

* Core/Misc: Add GetDebugInfo support to Unit

* Core/Misc: Add GetDebugInfo support to Creature

* Core/Misc: Add more info to GetDebugInfo for Creature

* Core/Misc: Add GetDebugInfo support to GameObject

* Core/Misc: Add GetDebugInfo support to Player

* Core/Misc: Add more GetDebugInfo info

* Core/Misc: Add GetDebugInfo support to Item

* Core/Misc: Add GetDebugInfo support to Bag

* Core/Misc: Add GetDebugInfo support to Transport

* Core/Misc: Add GetDebugInfo support to TempSummon, Minion, Guardian, Pet

* Core/Misc: Add GetDebugInfo support to Map, InstanceMap

* Core/Misc: Add GetDebugInfo support to Spell

* Core/Misc: Fix build warning

* Core/Misc: Add GetDebugInfo support to Aura

* Core/Misc: Add GetDebugInfo support to UnitAI

(cherry picked from commit 9a924fb9d557434c5a2e4020c80db6e6bfe466ad)
2021-11-16 20:36:58 +01:00
Treeston 1015f30704 Core/AI: Add some checks to catch if the AI changes mid-update for players. Tag #22731 #22629.
(cherry picked from commit d8fee3c46b70fed660aec905a496e56d6a327aaf)
2021-11-15 22:20:17 +01:00
HelloKitty 80d920dab5 Fix issue in Creature::UpdateEntry and CMSG_GOSSIP_SELECT_OPTION (#22469)
Address #22467 making it so that script doesn't look like it was reload
and thus causing gossip to fail once after update.

(cherry picked from commit d5888a5f8f498790dccde186325ab5bec87b066d)
2021-11-11 21:39:29 +01:00
Aokromes 3621482e44 kill some whitespaces
(cherry picked from commit cc49b7bb3024c6eb36d9bbbe7b151d7ae9ba91b7)
2021-10-26 23:55:38 +02:00
Treeston 26ca7b0fc2 Core/Creature: Get rid of a few Creature::getAttackerForHelper misuses. That's not what the function does, folks.
(cherry picked from commit 71c5569d186c4c24382b7c2846630da4a9edfb4f)
2021-10-26 23:51:12 +02:00
Treeston d57e74b3b5 Core/Scripting: Delay zone script's OnCreatureCreate until the creature has been added to map stores
(cherry picked from commit b4a1887c4d8df5a7729ed5c4126f6a7655a02127)
2021-10-23 14:53:14 +02:00
Treeston 392a644dc8 Core/Threat: Threat system adjustments:
* Online states are now re-evaluated before victim update instead of continuously. Closes #22226. Tagging #21501.
* Victim update now happens every 1s as opposed to every server tick unless current target goes away.
* Suppressed threat is no longer re-established until the victim gains additional threat (by hitting the target, for instance).
* Assistance threat is now split between non-controlled units threatened by target, as opposed to all units threatened by target.

(cherry picked from commit 5cea572a9ad524c6f28ff8519bee61d1ff4357d0)
2021-10-23 02:14:04 +02:00
Shauren ab95c5e9d7 Core/Creatures: Restored old initialization order: AI after movement
Closes #22307

(cherry picked from commit cdf4040f4fce4f1e5ebb33525c4618845605081c)
2021-10-22 23:51:59 +02:00
Treeston e4e8c1c59c Core/AI: Clean up charm AI handling, we now have two unique_ptr instead of a crapton of booleans
(cherry picked from commit 042f5515e4f3e52b0d2e23d9b9e147041849ce12)
2021-10-22 23:47:51 +02:00
Treeston 6a91fe3fbe Core/Creature: Fall back to combat list if calling for help without threat list
(cherry picked from commit 0e4a49b0a4c86eb4a2d0d128e24bc8aaabb47e31)
2021-10-22 23:21:01 +02:00
Treeston 6b8329f6af Core/Creature: Some adjustments to Creature::CallForHelp. Now works even if the Creature hasn't selected a victim yet.
(cherry picked from commit 79f0e55dcbe4a978363b4216188dd45e77512d1c)
2021-10-22 23:17:41 +02:00
jackpoz b6f28a7ebc Core/Packets: Reduce memory footprint of cached queries (#22297)
Ensure only the minimum required memory is used by caching query packets by calling shrink_to_fit()

(cherry picked from commit deabd4ab453ee8cf1f515bdb32bf9cf9de7f0591)
2021-10-22 23:15:27 +02:00
Treeston 3418a33a87 Misc: Pass std::chrono types by value everywhere.
(cherry picked from commit 2ef9d301f0869b443122e2ba543af054c5b0e53c)
2021-10-14 19:39:42 +02:00