Commit graph

337 commits

Author SHA1 Message Date
VladimirMangos
3e0cacbdaf [11743] Fixed auction crash in case missing localization for only some items
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.
2011-07-19 02:34:16 +04:00
SilverIce
a7fba67225 [11732] Interrupt movement state at dying
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
2011-07-10 22:17:08 +03:00
SilverIce
fc0eb7e9fa [11721] Simplify walk/run movement mode selection code 2011-07-08 19:30:00 +03:00
SilverIce
9d566398ad [11720] Implement spline movement subsystem
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.
2011-07-08 17:25:13 +03:00
SilverIce
984f16aedd [11710] Don't send movements of stopped creatues
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
2011-07-04 04:38:10 +03:00
VladimirMangos
753b0cd969 [11609] Add and use GetPrevDifficulty function.
Function return prev. difficulty in natural difficulty order for raid/dungeons/bg
2011-06-05 21:49:21 +04:00
VladimirMangos
8698ac207d [11573] Add CreatureInfo::GetObjectGuid
Also remove redundent CreatureData::GetHighGuid
2011-05-31 02:48:25 +04:00
VladimirMangos
249fb836ca [11490] Alow implicit cast ObjectGuid->uint64 and only explicit uint64->ObjectGuid
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.
2011-05-15 22:04:57 +04:00
VladimirMangos
b8bb108757 [11466] Use ObjectGuid in Map::m_objectsStore 2011-05-10 22:25:06 +04:00
VladimirMangos
ef6a48fe03 [11465] non-ObjectGuid guids in random places.
Only ChannelMgr code wide use uint64 guids now, and Map object stores.
2011-05-10 21:27:49 +04:00
NoFantasy
d68e8368f7 [11408] Do not ignore SHEATH_STATE_UNARMED when 0 defined in database *_addon
Signed-off-by: NoFantasy <nofantasy@nf.no>
2011-04-30 14:00:46 +02:00
zergtmn
2835aa5f20 [11385] Add support for static vehicle spawns
Signed-off-by: zergtmn <zerg@myisp.com>
2011-04-20 23:23:47 +06:00
Schmoozerd
5895cb38e3 [11376] Allow fallback to creature_template_addon of base entry
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>
2011-04-17 13:31:21 +02:00
NoFantasy
2c09c11091 [11357] Replace some 0-values with UNIT_DYNFLAG_NONE
Signed-off-by: NoFantasy <nofantasy@nf.no>
2011-04-15 11:07:55 +02:00
NoFantasy
520f420aed [11356] Some cleanup of JUST_ALIVED for creature and add comments.
Also restore npcflags after LoadCreatureAddon.

Signed-off-by: NoFantasy <nofantasy@nf.no>
2011-04-15 11:00:58 +02:00
VladimirMangos
6f8aa617d0 [11354] Resolve porblems with Pet regeneration timer conflict with Creature version.
* 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.
2011-04-15 02:15:29 +04:00
VladimirMangos
b4ab2b2441 [11344] Make .npc delete safe for instances and complete no static creatures code cases. 2011-04-13 19:17:14 +04:00
VladimirMangos
6c8efb4458 [11343] Check creature*_addon.auras duplicates at loading.
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
2011-04-13 15:27:14 +04:00
VladimirMangos
96045a86e3 [11325] Made recently added coordinates check only for debug build mode. 2011-04-08 00:12:25 +04:00
VladimirMangos
ba77d85a30 [11323] Avoid explicit use HIGHGUID_UNIT as creature high guid in guids or creature creating.
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.
2011-04-07 21:15:27 +04:00
Ambal
f46f4e1b87 [11320] Check if Creature::GetRespawnCoord() function returns valid map coordinates. Invalid data might cause crashes with movement generators.
Signed-off-by: Ambal <pogrebniak@gala.net>
2011-04-06 10:53:51 +03:00
NoFantasy
889ce13264 [11316] Implement a basic system to restore default faction for creatures after changes
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>
2011-04-05 15:04:39 +02:00
NoFantasy
492dd35606 [11313] Add m_ prefix for a few values in Creature class
Signed-off-by: NoFantasy <nofantasy@nf.no>
2011-04-04 17:05:43 +02:00
VladimirMangos
b588ea9db3 [11260] Add wrapper for creature vistual item set. 2011-03-16 20:21:45 +03:00
VladimirMangos
2b65cdb3bb [11244] Collect in CreatureCreatePos data for delayed pos setup into Creature::Create.
* 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.
2011-03-14 06:18:34 +03:00
NoFantasy
44915f6f13 [11243] Allow riding training from other team factions when exalted
Signed-off-by: NoFantasy <nofantasy@nf.no>
2011-03-14 00:01:35 +01:00
VladimirMangos
5aeda4f28b [11223] Replace direct auras adding from creature*_addon tables by cast spell. 2011-03-06 12:49:17 +03:00
VladimirMangos
51b4556c4b [11222] Move possition setup for Creature and subclases before Create call.
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.
2011-03-06 12:47:37 +03:00
zergtmn
02c1bc6557 [11217] Drop effect indexes from *_addon.auras field 2011-03-05 01:50:49 +05:00
SilverIce
724092d9e5 [11193] Optimize visibility update and AI notification code. Optimization decreases amount of visibility and AI notification operations in 8-10 times, and as a result, lowers CPU usage by 30-40%
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
2011-02-22 02:37:08 +02:00
VladimirMangos
8feaf211f1 [11168] Use MapPersistentState for access to Pool System dynamic data.
* 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!
2011-02-15 14:40:56 +03:00
VladimirMangos
04c21c95d3 [11159] Remove now redundent GetDBTableGUIDLow support.
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
2011-02-14 07:20:09 +03:00
Darkknight900
4709c7ecb3 [11151] Fixed typo in AddCreatureToRemoveListInMapsWorker.
Signed-off-by: VladimirMangos <vladimir@getmangos.com>
2011-02-12 21:09:00 +03:00
VladimirMangos
cf685da47a [11139] Use for Creature/GameObject local per-map guids
* 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.
2011-02-12 09:52:16 +03:00
VladimirMangos
9a8a74c2ad [11138] Make sure GameEvent/Pool systems work with static instance object guids
* 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
2011-02-12 07:24:04 +03:00
VladimirMangos
5858aae4d9 [11136] Add Creature::FillGuidsListFromThreatList for safe guid iteration from threat list.
Often not 100%-safe iterate by live threat list because called code can modify threat list (reset for example).
2011-02-11 21:37:12 +03:00
VladimirMangos
3bfe4bbd3b [11134] Make GCC happy and restore build at *nix. 2011-02-11 18:15:50 +03:00
VladimirMangos
da1b616312 [11133] Implement template functions for call functor for all Map/MapPersistentState with some map id. 2011-02-11 04:05:18 +03:00
VladimirMangos
108feb993d [11127] Rename src/game/InstanceSaveMgr.* -> src/game/MapPersistentStateMgr.* 2011-02-10 05:35:07 +03:00
VladimirMangos
dde16bc48c [11126] Rewrite InstanceSaveMgr related code.
* 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
2011-02-10 05:20:56 +03:00
VladimirMangos
6cfa64db97 [11123] Move respawn data to InstanceSave.
This make prev commit more useful.
In future InstanceSave also planned store local pools state.
2011-02-09 06:09:32 +03:00
NoFantasy
e3387ec6b0 [11120] Remove all auras at creature respawn.
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>
2011-02-08 21:21:08 +01:00
VladimirMangos
f73868a703 [11117] Allow for non-instancable maps have InstanceData and instance scripts.
* 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.
2011-02-08 04:15:13 +03:00
NoFantasy
3251f39684 [11081] Beautify some SQL log queries and remove not needed enclose character
Signed-off-by: NoFantasy <nofantasy@nf.no>
2011-01-29 10:40:36 +01:00
mns
d699d0973b [11068] Prevent infinity creature fall at fail get heght.
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>
2011-01-25 01:17:53 +03:00
Schmoozerd
54cb8f1a63 [11032] Implement CREATURE_FLAG_EXTRA_AGGRO_ZONE.
This let control zone wide aggro in DB data instead
need special script code.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
2011-01-18 13:48:46 +03:00
XTZGZoReX
2d87d68b4e [10626] CONFIG_BOOL_SAVE_RESPAWN_TIME_IMMEDIATLY -> CONFIG_BOOL_SAVE_RESPAWN_TIME_IMMEDIATELY 2011-01-16 18:47:52 +01:00
VladimirMangos
a0e298179c [10952] Don't use singleton to access static functions. 2011-01-03 14:55:55 +03:00
VladimirMangos
bf0ecf6e71 [10947] Update copyright notice for 2011 year. 2011-01-01 20:33:43 +03:00
VladimirMangos
d38df50a7e [10932] Imporvments gameevent creature morphing.
* 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.
2010-12-29 01:38:49 +03:00