Commit Graph

323 Commits

Author SHA1 Message Date
Treeston
532ab1c7f8 Core: Combat/threat system rewrite (PR #19930)
- PvE combat is now always mutual. UNIT_FLAG_IN_COMBAT is backed by actual references to the units we're in combat with.
- PvP combat is now also tracked, and almost always mutual; spells like Vanish and Feign Death can break this rule. That means we can easily determine a list of players we're fighting.
- By extension, IsInCombatWith now has sensible behavior when invoked on nonplayers.
- Threat and combat systems are no longer the same.
  - They still have an enforced relationship (threat implies combat - clearing combat clears threat)...
  - ...but we can have combat without threat. A creature (with threat list) isn't considered to be engaged until it has an entry on its threat list...
  - ...which means we can now faithfully replicate retail engage behavior. Combat on projectile launch - engagement start on projectile impact. Yay for progress!
- AI method refactor, as already ported in 6113b9d - `JustEngagedWith`, `JustEnteredCombat` and `JustExitedCombat`.
- Vehicle threat is now properly pooled on the main vehicle body (fixes #16542).
- Various edge case bug fixes for threat redirects (Misdirection "cancelling" Vigilance and similar).
- Target re-selection is now significantly faster.
- Fixed a ton of other smaller edge case bugs, probably.

Closes #7951 and #19998.
2018-01-03 20:04:19 +01:00
tkrokli
f6b6f57a6d Update copyright note for 2018
Best wishes for the new year.
2018-01-01 01:55:29 +01:00
Jeremy
e42903ec16 Core/Entities: Fix some weird movement due to los issues (#21125)
* Core/Entities: Fix some weird movement due to los issues
- Made LoS check use collisionHeight instead of midsection. Value was too low.
- Gnomes will now have a breath bar more quickly than for example a tauren.
- Changes have been made to checking for ground z as well, some tweeking might be needed but removed most of the scattered +2.0f/+0.5f/we
* Add 0.05f to isInAir check in Creature::UpdateMovementFlags
2017-12-29 22:32:07 +01:00
jackpoz
12701cb0c6 Core/Misc: Replace time(NULL) with GameTime::GetGameTime() 2017-12-24 22:50:59 +01:00
Gustavo
51c4196acf Core/Entities: add extra use of UPDATETYPE_CREATE_OBJECT2 (#20955) 2017-12-15 21:11:02 -03:00
ariel-
78a1c687a2 Core/Misc: minor typo and codestyle fixes
- Replace NULL uses in new code with nullptr
- Fix wrong (accumulated) load time log when loading calendar invites
- Make Creature::CanRegenerateHealth const as its just a getter
- Mark OnlyOnceAreaTriggerScript::OnTrigger as final in case someone wants to override that (you are supposed to use protected _OnTrigger hook)
2017-12-13 14:43:12 -03:00
jackpoz
925557d1c0 Core/Misc: Fix static analysis issues
Fix various coverity reported issues
2017-12-08 15:14:51 +01:00
Aokromes
5f2c5f2ed3 Misc: Kill trailing white spaces 2017-11-25 01:05:15 +01:00
r00ty-tc
3446424540 Core/Spawn: Limit saved/stored respawn time.
- Limit to time_t maximum, for the compiled-for architecture.

Closes #20834
2017-11-15 00:59:23 +01:00
r00ty-tc
55b9a3f65f Core/Spawns: Resolve crash in BattlegroundAV
- Correctly set spawngroup on spawned creatures in Alterac Valley BG
 - Sanity check on application of dynamic spawn rates (not for BG/Arena
   maps)
 - Check that spawndata exists before using it.

Closes #20535
2017-10-05 19:41:54 +02:00
Treeston
47af704f63 Core/Player: More cleanups to Player::UpdateZone, including correcting an oversight that was causing the last known zone id to not update when leaving map. Closes #20289 for real this time. 2017-09-10 01:10:40 +02:00
Treeston
f279207d48 Core/Spawn: Move spawn group state management from sObjectMgr to the Map object, which makes it actually function as intended with instances. Woops. 2017-08-26 13:14:25 +02:00
sirikfoll
e2565c2597 Core/Misc: Remove Whitespaces 2017-08-11 23:06:37 -03:00
Treeston
84590be26d Scripts/InstanceScript: Implement database framework for managing spawn groups based on boss state. (#20103) 2017-08-04 00:23:40 +02:00
r00ty-tc
59db2eeea0 Dynamic Creature/Go spawning:
- True blizzlike creature spawn/respawn behavior - new creature = new object
 - Toggleable spawn groups (with C++/SAI/command options to use them)
 - Custom feature: dynamic spawn rate scaling. Accelerates respawn rate based on players in the zone.
 - Backward compatibility mode (set via group and for summons)
   to support creatures/gos that currently don't work well with this
   (this should be removed once the exceptions are fixed)

Fixes and closes #2858
Tags #8661 as fixable.
Fixes and closes #13787
Fixes #15222.
2017-07-31 21:21:04 +02:00
ariel-
85a7d5ce9a Core: ported headers cleanup from master branch 2017-06-19 23:20:06 -03:00
Shauren
d6201e5dbb Core/Grids: Ported cmangos/mangos-wotlk@ea99457e50
(cherry picked from commit 9299e9bde0)
2017-06-19 13:16:13 -03:00
treeston
d57307f63d So, I came in trying to fix gameobject LoS. So I restructured some stuff.
Then it turned out that gameobject LoS is already fixed. So all this does, really, is restructure some stuff.
And remove the hack from Sapphiron because I could.
2017-06-10 15:08:35 +02:00
Golrag
a2c123b529 Core/Maps: Corrected GetWaterOrGroundLevel (#19863)
* When a gameobject was above water like in ToC. It would return water level
2017-06-08 19:25:26 +02:00
Treeston
f6c849729b [3.3.5] Get zone/area IDs from vmap data in the liquid update (#19840)
* Add new method Map::getFullVMapDataForPosition to get area info and liquid info in a single vmap lookup
* Use this lookup in Map:: relocation methods to update m_areaId and m_zoneId fields on WorldObject
* Adjust GetZoneId/GetAreaId on WorldObject to always return these cached fields
* Clean up liquid state handling on Unit and Player
* Hand floor's Z coord up through GetFullTerrainStatusForPosition, use it to update a new field in WorldObject, and use that to feed a new GetFloorZ call on WorldObject.

Closes #16489
2017-06-08 00:25:06 +02:00
ariel-
4c593f12ca Core/Instance: stop updating the instance resettimes based on creature respawns
- Rather update normal instance reset time to 2 hours after last creature kill
- This fixes yet another integer overflow due to the possibility of having time_t max showing up
- Also change respawntime and resettime fields to bigint on respawn/instance related tables
- Start using prepared statements on the InstanceSaveMgr
2017-04-12 02:19:55 -03:00
Shauren
74bb92a582 Core/Maps: Adjusted WorldObject::GetGridActivationRange() to never be less than map visibility distance for active objects to ensure equal ranges for activation/deactivation of grids
Updates #19072
2017-02-08 20:23:37 +01:00
xinef1
14dfc377b4 Core/Misc: Various crash fixes (#19059)
* Replaced some FindPlayer calls with GetPlayer
Fixed some more crashes

* Correction
2017-02-05 23:42:31 +01:00
xinef1
b955456008 Few small optimizations here and there (#18684)
Changes list:
- Added CharacterGuidByNameContainer which contains name -> guid unordered map (updated along CharacterInfo)
- Extended CharacterInfo structure with GuildId
- Extended CharacterInfo structure with ArenaTeamId[3], for all possible teams (2v2, 3v3, 5v5)
- Removed CHAR_SEL_GUID_BY_NAME and CHAR_SEL_CHAR_GUID_BY_NAME synchronous queries, name -> guid can be now retrieved in World::GetCharacterGuidByName
- Removed CHAR_SEL_GUID_RACE_ACC_BY_NAME synchronous query, guid can be retrieved by name and rest of the data can be retrieved by guid
- Removed CHAR_SEL_CHAR_LEVEL synchronous query, level can be retrieved by guid
- Changed CHAR_SEL_CHARACTER_ACTIONS_SPEC to asynchronous query, action bars are now loaded asynchronously
- Removed CHAR_SEL_CHARACTER_NAME_CLASS synchronous query, guid can be retrieved by name and rest of the data can be retrieved by guid
- Removed CHAR_SEL_PLAYER_ARENA_TEAMS and CHAR_SEL_ARENA_TEAM_ID_BY_PLAYER_GUID synchronous queries, arena teams are now stored in CharacterInfo
- Replaced synchronous db calls with CharacterInfo lookups
- Removed ObjectMgr::GetPlayerGUIDByName, as it used db query
- Replaced some unnecessary UpdateObjectVisibility() calls because they were either duplicated (called few lines above in other function) or it is enough to call DestroyForNearbyPlayers because object is being removed or should be invisible and DestroyForNearbyPlayers is faster
- Corrected typo in Player::DestroyForPlayer, only items in slots 0 to EQUIPMENT_SLOT_END are sent to other players
- Renamed Player::GetGuildIdFromDB to Player::GetGuildIdFromCharacterInfo and changed the function to use CharacterInfo structure
- Renamed Player::GetArenaTeamIdFromDB to Player::GetArenaTeamIdFromCharacterInfo and changed the function to use CharacterInfo structure
- Renamed Player::GetLevelFromDB to Player::GetLevelFromCharacterInfo and changed the function to use CharacterInfo structure
- Removed GameEventMgr::_questToEventLinks and associated functions, eventId is now stored in Quest class under _eventIdForQuest variable
- Changed some functions checking quest status to use other functions for quest status check instead of duplicating code
- Removed callback from add friend, because we can get the guid from appropriate storage, no need to make db query
- Removed callback from add ignore, because we can get the guid from appropriate storage, no need to make db query
- Added callback to unwrap wrapped items asynchronously
- Removed synchronous select in tutorials to check if we have any entries in db, if any entry exists in db, m_TutorialsChanged variable will have TUTORIALS_FLAG_LOADED_FROM_DB flag added and it is no longer necessary to query database
2017-01-28 01:00:28 -03:00
Shauren
c90882ed6e Core/Vmaps: Changed error message when loading outdated vmaps
Closes #18431
Closes #18857
2017-01-22 12:06:02 +01:00
HelloKitty
01d715eaef Core/Vmaps: Stop M2s from occluding for spellcast LoS
Closes #18528
2017-01-21 14:44:31 +01:00
tkrokli
6a51a88767 Update Copyright notice for 2017
Happy new year!
2017-01-02 19:52:45 +01:00
treeston
820e843391 Map/InstanceMap: Ease up on a somewhat overzealous error message regarding instance saves. 2016-09-21 15:36:21 +02:00
Treeston
cf628880d5 Map/Instances: Greatly simplify PermBindAllPlayers logic. (#17940) 2016-09-16 13:09:16 +02:00
Aokromes
fad58ad099 Core/Misc: Even better description for logs 2016-07-02 22:31:11 +02:00
Aokromes
bd7dc87b02 Core/Misc: Even better description for a log 2016-06-22 14:32:48 +02:00
Aokromes
54d4769d4b Core/Misc: Better description for a log 2016-06-22 14:24:11 +02:00
jackpoz
1347d7cf7a Core/VMaps: Fix some vmap height edge cases
Fix Map::GetWaterOrGroundLevel() checking dynamic object only in phase 1 instead of current Unit phase.
Improve DynamicMapTree::getHeight() dynamic object check by casting the ray at +0.5f from the passed Z coordinate, this value will be tuned to improve even more the results.
2016-06-04 15:01:39 +02:00
Treeston
9ad952c3bc Merge pull request #16736 from r00ty-tc/map_height
Solve many of the creature falling through floor issues.
2016-04-16 10:43:57 +02:00
r00ty-tc
87b4533046 [Core/Maps] Activate creatures and objects during opening cinematics and other flyby
cameras (sunwell etc).

Requires re-running map extractor to extract camera m2 files from data
files. These are very small.

Closes #4755
Closes #16772
2016-04-14 01:34:17 +02:00
Naios
131ef5f2d6 Core/Maps: Fix non PCH build 2016-04-11 23:12:23 +02:00
Naios
775e0764e8 Core/Game: Move scheduled map scripts counter methods into MapManager
* Since those have nothing to do with core scripts and are
  not wished inside the ScriptMgr

(cherry picked from commit 59e3cf82ac)
2016-04-11 21:40:38 +02:00
Naios
9f61b72679 Core/Game: Converted the game library to a shared library.
* There is still the possibility to static link against game.

(cherry picked from commit bf33159a70)
2016-03-24 02:46:42 +01:00
r00ty-tc
971f4ccab8 Core/Maps: Implement optional pre-loading of maps.
- Option to preload basemaps upon server load (BaseMapLoadAllGrids)
- Option to preload instance maps upon map load (InstanceMapLoadAllGrids)
- Change default logging to only log mmap errors to server log
- Add new public to map to load all cells in map
- change debug loadcells to use new function instead
2016-03-15 02:05:13 +01:00
ccrs
6a339ed5c9 Core/TempSummons: avoid use MoveInLineOfSight before InitSummon 2016-03-01 21:20:47 +01:00
r00ty-tc
10550fe8cf Solve many of the creature falling through floor issues.
This seems entirely wrong to discount the returned map height if we're
already below it. In many cases this is exactly why we want the height!
2016-02-26 22:02:20 +00:00
Shauren
ff45a422c5 Warning fix. 2016-02-12 20:45:09 +01:00
Shauren
fa3f106693 Core/Maps: Use map.dbc zone fallback if no area is found in grid files, not only if grid files don't exist
Closes #16583
Closes #16584

Extracting new maps is NOT needed.
2016-02-12 20:39:25 +01:00
treeston
62aff401f6 Merge branch '3.3.5-instanceextend' into 3.3.5 (PR #16392) 2016-02-10 22:23:39 +01:00
Shauren
89d8d50b2e Core/Maps: Moved min height calculation to worldserver for more precise results
Closes #16530
2016-02-10 21:25:28 +01:00
treeston
6102a7937d Maps/Instances: Implement handling of CMSG_SET_SAVED_INSTANCE_EXTEND 2016-02-10 19:35:11 +01:00
Shauren
25cdc5d980 Core/Maps: Parse MFBO adt chunk to properly handle height where player counts as falling under the map
* This fixes the height at which player is instantly killed when falling from The Frozen Throne
* Set PLAYER_FLAGS_IS_OUT_OF_BOUNDS on players under the map to enable release spirit button while still falling

Note: Extracting new maps is required
(cherry picked from commit 4f78efd463)

# Conflicts:
#	dep/PackageList.txt
#	src/server/game/DataStores/DBCStructure.h
#	src/server/game/Entities/Player/Player.cpp
#	src/server/game/Handlers/MovementHandler.cpp
#	src/tools/map_extractor/CMakeLists.txt
#	src/tools/map_extractor/System.cpp
#	src/tools/map_extractor/adt.h
#	src/tools/map_extractor/loadlib.cpp
2016-02-09 18:44:19 +01:00
Shauren
aa432db36d Core/Maps: Changed the way area data is stored in maps, it now uses ID field from AreaTable.dbc instead AreaBit used for exploration marker (and is not unique anymore on top of simply being stupidly confusing)
Note: Extracting maps is required
(cherry picked from commit db0b8bf24e)

# Conflicts:
#	src/server/game/Achievements/AchievementMgr.cpp
#	src/server/game/Chat/Chat.cpp
#	src/server/game/Conditions/ConditionMgr.cpp
#	src/server/game/DataStores/DBCStores.cpp
#	src/server/game/DataStores/DBCStores.h
#	src/server/game/DataStores/DBCfmt.h
#	src/server/game/Entities/Player/Player.cpp
#	src/server/game/Globals/ObjectMgr.cpp
#	src/server/game/Handlers/BattleGroundHandler.cpp
#	src/server/game/Handlers/MiscHandler.cpp
#	src/server/game/Maps/Map.cpp
#	src/server/game/Spells/Spell.cpp
#	src/server/game/Spells/SpellEffects.cpp
#	src/server/scripts/Commands/cs_go.cpp
#	src/server/scripts/Commands/cs_group.cpp
#	src/server/scripts/Commands/cs_lookup.cpp
#	src/server/scripts/Commands/cs_misc.cpp
#	src/tools/map_extractor/System.cpp
#	src/tools/mmaps_generator/TerrainBuilder.cpp
2016-02-09 18:19:28 +01:00
treeston
0f0a51b87a Game/Maps: Instance handling follow-up:
- Fix a bug where a player could maintain a conflicting non-perm solo bind if they were in the instance when invited to group. Closes #16150.
- If a group is created while the leader is in an instance that nobody is bound to, the group will take over the instance and bind to it. This stops the homebind timer when reforming group after disconnects and the like.
2016-01-04 15:48:53 +01:00
Rushor
923a368ac7 Update copyright note for 2016 2016-01-01 12:02:33 +01:00