Commit graph

267 commits

Author SHA1 Message Date
Machiavelli
21a3ee9267 [12079] Remove some redundant explicit NULL checks for pointers before delete or delete[] calls since this check is done implicitly when deleting
Signed-off-by: stfx <stfx@hotmail.de>
2012-08-03 14:30:18 +02:00
Schmoozerd
835d1c7479 [12069] Cleanup comment style 2012-07-22 14:39:31 +02:00
Schmoozerd
e32b9953a1 Cleanup Operator padding 2012-07-20 17:38:23 +02:00
Schmoozerd
8d0c106aa4 Various Cleanups (game L-M) 2012-07-19 21:46:40 +02:00
Reamer
ea30899db4 [12027] Add some VMap LoS checking functions to Map scope 2012-07-05 19:37:35 +02:00
Schmoozerd
414d432d24 [11990] More db-script command changes
* Allow SCRIPT_COMMAND_KILL_CREDIT to give the kill of an involved npc.
  This is marked by datalong (creature-entry) == 0
* Remove immediate execution of commands. This will prevent infinite loops when db-scripts trigger db-scripts which are executed immediately
* Add check for SCRIPT_COMMAND_PLAY_SOUND
* Add check to catch an invalid command

Signed-off-by: Schmoozerd <schmoozerd@scriptdev2.com>
2012-05-09 23:09:12 +02:00
Schmoozerd
83d7d86255 [11989] Add support to call spell_scripts in more cases
* Support to script Dummy spells with spell_scripts
* Support to script TriggerSpell spells which have no existing triggered spell
Note that the order which spell-effect actually triggers the DB script is well-defined (SCRIPT_EFFECT before DUMMY before other)

Signed-off-by: Schmoozerd <schmoozerd@scriptdev2.com>
2012-05-08 17:31:09 +02:00
stfx
f3f3349661 [11973] Various Cleanups
Signed-off-by: Schmoozerd <schmoozerd@scriptdev2.com>
2012-04-22 19:48:05 +02:00
Schmoozerd
8e0edc0383 [11940] Rewrite and cleanup DB Script Engine
* Moved actual script processing code to ScriptMgr
* Unifed and improved log output. Now table-name is passed to each script execution
* Added the "buddy concept" to all commands (except the outdated direct field change commands):
Now all commands support to search a creature (or go for some commands) in a radius, with which to do some stuff.
See doc/script_commands.txt for more details and information

Attention DB Devs:
Current DB-Scripts are converted automatically as far as possible, but some old target selecting mechanics were not reasonable to do automated.
For such cases the command is marked with data_flags & 0x10 (==16), which will throw DB-Errors to track them down faster

Thanks to NeatElves and especially Grz3s for testing!

Signed-off-by: Schmoozerd <schmoozerd@scriptdev2.com>
2012-04-06 22:04:30 +02:00
Schmoozerd
443050ffa1 [11927] Fix typo, also use shiny wrapper for ObjectGuid.GetString. Thanks to tyrnon for pointing 2012-02-09 00:40:34 +01:00
Schmoozerd
49bd484a41 [11922] Add ASSERT helper function to print entry and guid info
Use this in first cases: GetAngle and in PathFinder::BuildPolyPath

Signed-off-by: Schmoozerd <schmoozerd@scriptdev2.com>
2012-02-07 17:25:46 +01:00
faramir118
df3a5f2808 [11910] Implement loading for MMap Generator 2012-02-06 23:18:04 +01:00
Schmoozerd
8068dcf6dd [11875] Update Copyright notice to year 2012
Start timemachine and a Happy new year to all!
2012-01-16 17:43:59 +01:00
Schmoozerd
7d05ca0b79 [11859] Enable script command MOVE_TO to also change the orientation 2011-12-11 00:17:50 +01:00
Schmoozerd
6b355bd987 [11840] Fix script command modify_npc_flag
Thanks to faq for pointing.
I checked both udb and ytdb, and they don't use this command yet;
If however you use it already check your scripts. (The toggle/add/remove flag must be set in `data_flags`) Sorry for the inconvenience.
Alos added a forgotten break.

Signed-off-by: Schmoozerd <schmoozerd@scriptdev2.com>
2011-11-06 16:06:59 +01:00
Schmoozerd
46e604a089 [11823] Add SCRIPT_COMMAND_MODIFY_NPC_FLAG to change NPC flags by db-script
Note that the npc flags will be restored when the npc respawns

Signed-off-by: Schmoozerd <schmoozerd@scriptdev2.com>
2011-10-14 20:35:55 +02:00
SilverIce
df0715284f [11819] move SetActiveObjectState to WorldObject level 2011-10-13 20:08:49 +03:00
stfx
35ad6b2ae5 [11812] Add possibility to send sound only to a zone in Map::PlayDirectSoundToMap
Signed-off-by: Schmoozerd <schmoozerd@scriptdev2.com>
2011-10-06 16:18:59 +02:00
Schmoozerd
aa40cf687f [11783] Let scripting library decide if an encounter is in progress in instances
Replace wrong Group::InCombatToInstance check, this was preventing entering when any member is in any combat.

Signed-off-by: Schmoozerd <schmoozerd@scriptdev2.com>
2011-09-03 16:04:06 +02:00
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
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
NoFantasy
70d9d4ef24 [11582] Implement SCRIPT_COMMAND_STAND_STATE to use in *_scripts tables
Set the stand state (enum UnitStandStateType) of any Unit*

Signed-off-by: NoFantasy <nofantasy@nf.no>
2011-06-01 09:28:47 +02:00
Schmoozerd
2d82b4bccc [11575] Add support for simulating Yells to Map.
Including case when related creature not loaded.
For proper animation yell from loaded creature for near players
better use correct lowguid/guid if creature.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
2011-05-31 05:17:47 +04:00
Schmoozerd
0de4e302b3 [11558] Fixes and way work chnages for GO lock/interact state
* Not reset lock/interact state in instances (so until instance reset)
* Do unti-cheating checks for use attempts locked/non-intareactive GOs
* Implement SCRIPT_COMMAND_GO_LOCK_STATE for control lock/interact state of GOs from scripts.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
2011-05-29 04:31:34 +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
VladimirMangos
1cd48649c2 [11437] Fixed cases where forgotten that bags have TYPEID_CONTAINER != TYPEID_ITEM
Script case low chance affect real cases but for mail send from item can fix some problems.
2011-05-08 04:10:07 +04:00
unknown
82367bbdea [11398] Get rid of 2 useless timers and drop a problematic diff in session update
Signed-off-by: Neo2003 <Neo.2003@Hotmail.fr)>
2011-04-26 18:39:04 +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
SilverIce
75e1e7c3a3 [11384] Use SPLINEFLAG_FLYING for flying creatures, SPLINEFLAG_UNKNOWN7 is never used. Simplify Map::CreatureCellRelocation code 2011-04-20 02:55:30 +03:00
VladimirMangos
764345609e [11338] Remove trailing spaces.
.git/hooks/pre-commit.sample -> .git/hooks/pre-commit can catch this cases. ;)
2011-04-12 18:29:11 +04: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
acb6372d29 [11311] Add SCRIPT_COMMAND_ATTACK_START to initiate attack by creature.
../docs/script_commands.txt updated for details

Signed-off-by: NoFantasy <nofantasy@nf.no>
2011-04-03 19:52:43 +02:00
VladimirMangos
b92ebd994f [11310] Make .npc add/.gobject add commands work safe.
Reserve at server startup some guods follow last used in static DB spawns guid
for creatures/gameobjects for use in .npc add/.gobject add commands.
This allow safe select guids not used in all map copies. Guids for temporary spawns
used from range frollow after reserved guids range.

This also let select new static spawns guids (added in game chat command) near to already used static guids.
So it let avoid gaps in static guids lists.

Amount reserved guids set in new GuidReserveSize.* config options.
2011-04-03 21:22:58 +04:00
NoFantasy
c93256e477 [11309] Extend SCRIPT_COMMAND_EMOTE, allow search for nearby creature to do the emote
Also allow play emote on Player when player is source.
Gameobject may be source of script but are only allowed as searcher for creature when defined.

Signed-off-by: NoFantasy <nofantasy@nf.no>
2011-04-03 17:55:53 +02:00
crackm
cc24542aec [11294] corspe -> corpse typos fix.
Signed-off-by: VladimirMangos <vladimir@getmangos.com>
2011-03-27 23:45:50 +04:00
zergtmn
a6d155fc54 [11259] Move scheduled scripts counter to ScriptMgr
Also cleanup forward declarations.
2011-03-16 20:01:10 +05:00
SilverIce
fcc09483ad [11202] Schedule AI notify at adding to world
This fixes the problem, that creatures, added at grid loading, do not start attack each other
More shedule -> schedule fixes added, removed unused Map::PlayerRelocationNotify function
2011-02-23 17:04:54 +02:00
kbz
09c5b49cc4 [11194] Fix the word shedule -> schedule in function name
Signed-off-by: SilverIce <slifeleaf@gmail.com>
2011-02-22 03:53:29 +02: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
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
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
47060fe4b1 [11137] Fixed crash at reset normal dungeon while map loaded.
* Map Persistent noe have direct pointer back to map if map loaded.
  That let simplify some code and avoid map search.
* Crash showup in result changes in code logic related to reset processing.
* Also fix more old bug with reset normal dungeon with not loaded map.
* Reverse MapPersistentState::HasRespawnTimes and MapPersistentState::HasBounds() results
  to expected for function names and update related calls.

Thanks to Schmoozerd for help in research problem.
2011-02-12 06:44:52 +03:00
VladimirMangos
6d26ec0e7f [11129] Added WorldMap/WorldPersistentState subclass for non-instanceable maps.
This let have symmetric Map/MapPersistentState (sub)classes hierarchy.
2011-02-10 18:52:23 +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
01178b69e5 [11124] Avoid save in DB instance/respawn data for BGs/Arenas.
* Fixed bug with not unloaded InstanceSave for BGs/ArenasPartly.
  This bug introduced with recent InstanceSave creating for all maps.
* Avoid save respawn data to DB for BGs/Arenas.
  No reason save to DB because BGs/Arenas reset at map unload.
* Always create InstanceSave for Map without recheck suggested data integrity.
  Map::GetInstanceSave expected always return != NULL value.
2011-02-09 18:34:29 +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
VladimirMangos
852c4ddf32 [11122] Create InstanceSave for non-instanceable maps.
This preparation for use structure for store another map persistance data like respawn times.
2011-02-09 04:00:14 +03:00