Source crash in missing locale strings array size check before access
to it in locale structure.
Also move repeating code for access to wide used localization string arrays to ObjectMgr functions.
TODO: proper solution would be update creatures while in corpse state.
This also would solve problems with death persistent auras that not get updated for died creatures
Spline movement controls movements of server-side controlled units (monster movement, taxi movement, etc).
Proper implementation of effects such as charge, jump, cyclic movement will rely on it.
However, need improve our states system before.
Technical changes:
1. Added linear, catmullrom and bezier3 splines which based on client's algorthims. They can be reused for proper transport position interpolation.
2. Precission increased. There are no more position desync issues since client's position calculation formulas used.
3. Now possible to move by paths with multiple points, send whole path to client.
destination holder still contains info about current destination point, even when movement is disabled/stopped
as a result, creature moves somewhere on client, while stopped on server-side
Now safe allow this casts in like way after completed convertion to ObjectGuid use.
Also simplify code in result allowed auto cast to uint64.
Please _not_ add new uint64 storages (local and in structures) for guid values.
Use creature_template_addon from base entry when addon for difficulty_entry_N does not exist.
It is easier to create data for the exceptions rather than the general.
Signed-off-by: NoFantasy <nofantasy@nf.no>
* Creature regeneration code moved to new virtual function RegenerateAll
* Pet instead direct call own regeneration code overwrite now RegenerateAll
Big thanks to Vladskywolf for problem research and original patch version.
This already checked at apply to creature but startup check more helpful for DB devs.
Also remove use single field structure use for store addon.auras data
This helper change for allow have in future static spawned vehicles as `creature` table data.
Added CreatureInfo::GetHighGuid() high guid selector, and wrapper CreatureData::GetHighGuid()
for most real cases of usage. Also easy get expected guid form by CreatureData::GetObjectGuid(lowguid).
Also fixed some memory lost cases at creature spawn fail.
A new specialized function SetFactionTemporary for creatures are added. It work just like setFaction but has in addition option to set flags.
The flags determine if default faction should be restored and when; most commonly just before respawn and when reaching home after evade.
SCRIPT_COMMAND_SET_FACTION for DB scripts and ACTION_T_SET_FACTION for creature_ai_scripts are now capable of using the system (documentation updated)
The intention of the system is to be able to solve basic events that include faction changes, with the use of database only and in easier ways.
It is advised that DB devs revise current database scripts to check if changes should be made. The same goes for EventAI devs regarding ACTION_T_SET_FACTION.
Signed-off-by: NoFantasy <nofantasy@nf.no>
* CreatureCreatePos work in 3 modes:
- exactly provided coordinates/orientation/map/phasemask
- exactly object + orientation as coordinates/map/phasemask
- delayed position calculation near provided object at specific dist/angle.
* Use in similar way and for Pet/Vehicle Create functions.
For Totem created new Totem::Create function with some moved in to it totem specific code.
* This let resolve recent problems with creature spawn and preserve fix for cases when
Creature::Create addon/script code expected known correct possition for creature.
Some called from Create code can req. proper pos setup for creature.
Bad side: But in way how currently code orginized impossible setup excetly position for most
Creature sublasses. So in this part need more work.
You need to update your config file, new "Visibility.RelocationLowerLimit" and "Visibility.AIRelocationNotifyDelay' options added
Special thanks to Ambal for code hints and advices
Thanks to Undergarun and kero99 for making tests
* Direct store pool system dynamic data in sPoolMgr replaced by
shared pool system data object (for all non instanceable maps)
into WorldPersistentState, and own copies of pool system data
object in DungeonPersistentState/BattlegroundPersistentState.
This let have pools with object at many non-instanceable maps,
and single map pools with unique state for each instance.
* Avoid direct global grid data modify from pool system, and use for this also
recently added local for MapPersistentState grid spawn data.
* Implemented proper API for update pool system data in MapPersistentStates
from GameEvent system.
* Initialize pool system state at MapPersistendState creating.
For shared pool system state for non-instanceable maps initilized at first map state
creating.
Now pool system propertly work in instance also!
Now any creatures/gameobjects loaded base at DB data
in non-instanceable/instanceable maps always have same guid
as in DB data.
* Also remove useless by same reasons MaNGOS::GameObjectWithDbGUIDCheck
* Creature/GameObject guid generators moved to Map
* For avoid wrong not converted cases generic function in ObjectMgr has been replaced by
specilized guid generation function like sObjectMgr.GeneratePlayerLowGuid().
This let catch all cases that need update in custom code or scripts.
* Drop many ObjectAcessor.h now dead code. This is also make mangos more thread safe.
* Restore one more time unix build broken in prev. commits.
Note: many cases when something not wotk in instance but work in continents
possible magicly start work after this commit. For example, some gm commands.
From large systems that need more chnages for start work in full power in instances
can be referecned pool/gamevent system. Last need just small hacks drop changes but
in will addded in independent commit.
* Pool System for correct full power work in instance need implement
MapPersistentState local pool system state for instanceable maps.
Unit this not implemented pool system must avoid creating/despawn/touch
instance map objects. Currently this work because instance map object use
dynamic generated guids and "invisible" for Pool System, with explcitly forbiden
for it spawn directly new objects. Code changes add explicit checks for preserve
this way work for time when instance object will use static guids. When local pool
state storing in persistent state this protection checks will possible drop.
Non-instanced working cases converted in local map object search calls.
* GameEvent Systems currently have code that work correctly only with objects at
non-instanced maps by same reasons as Pool System. But in different Pool System
case game event activate/deactivate expected applied to _all_ object copies in all
existed instanceable map copies. Code modified for work in expected way.
Direct spawn disabled for instanceable maps until swith to static guids.
Despawn code will make affect only for non-instanceavble maps unit swithc to static guids as-is.
This is preserve current code working result.
* Convert last case usage global creature search in aura code to map local case.
Player case also possible not need now after including caster damage/heal mods
part to aura base damage/heal. In any cases player case preserved in old way work.
NOTE: this last places dependent from global creature/gameobject guid search so look like this
make possible start direct work to switch instances use static guids instead dynamic generated
* For better fit name to related map type class InstanceMap renamed -> DungeonMap.
This clarify usage Instanceable()/IsDungeon() because BG/Arenas maps also instanceable maps.
* InstanceSave have many code related to only DungeonMap case, so it replaced by 3 new classes:
- MapPersistentState as base class, used for non-instanceable maps (continents and some other) (!Instenceable())
- DungeonPersistentState subclass of MapPersistentState, used for DungeonMap states (IsDungoen())
- BattlegroundPersistentState subclass of MapPersistentState, used for BattlegroundMap states (IsBattleGroundOrArena())
Now all dungeon resets code moved to subclass and all player/gpoup bound functions/structures also use it.
* Map::GetInstanceSave renamed to Map::GetPersistentState and DungeonMap have specialized version
return DungeonPersistentState (same pointer in fact with proper subcalss type)
* InstanceResetScheduler renamed to DungeonResetScheduler
This will remove death persistent auras and AI does no longer need to remove any such auras at respawn manually (GM will still see the death persistent aura all until creature respawn).
Signed-off-by: NoFantasy <nofantasy@nf.no>
* New table added for non-instanced maps (except BG/arena):
- `mangos`.`world_template` (script mapping to non instanced data)
- `characters`.`world` (saved script data string storage)
* InstancedData created for any map types including BGs/arenas, that allow have scripts
state for any maps, but BG/arena instance data not saved.
Note: Possible structures will renamed later for clarify apply to any type maps,
but avoid for now for simplify changes and hard affect to script library sources.
Also fix wrong use INVALID_HEIGHT as height value.
It must be used only for _check_ height, and DON'T must use as real height value.
Must fix some wrong height check results.
Signed-off-by: VladimirMangos <vladimir@getmangos.com>
* Table `game_event_model_equip` renamed to `game_event_creature_data`
* Table allow now store same creatures for different events, BUT
expected that related events no active in same time.
* Added possibility switch entry at gameevent time.
This let have diff factions/loot and etc for creatures.
* Added possibility cast spells at gameevent start/end.
Exist some spells that expected casted to creature at gameevent start
for model replace, and for animation in other cases.
Note: `game_event_creature_data`.`modelid` field posisble will removed soon in fowor related spell use.
Ofc, when spells will implemented in core.