TrinityCore Development Standards

Edit 14/09/2014:
Moved to the wiki

The following methods of coding are deprecated, please use alternative ways:

[ul][li]All *_scripts table (except event_script and spell_scripts since there are no alternative yet and smart_scripts); (db)[/li]
[li]ItemScript (script the spell the item casts instead, when applicable); Spell (cpp)[/li]
[li]Dummy and script spell fixes inside switch cases (use proper spell scripts, /scripts folder);[/li]
[li]Hungarian notation.[/li]
[li]Massive blocks of defines, (unsigned) ints from 8 to 32 bit should be in enums if possible. Sample (sample of conversion)[/li]
[li]Script hardcored texts/waypoints must use creature_text and waypoints table/s. Sample (a sample of deprecated code) Sample of conversion.[/li]
[li]C++ gossip scripts (if possible, write it with conditions+SAI+gossip tables) Sample[/li]
[li]Sample of Conversion: Sample[/li]
[li]#include “ScriptPCH.h” on scripts, move them to proper headers. Sample (a sample of proper header), Scripts/kalimdor sample of conversion. No new scripts will be acepted adding #include “ScriptPCH.h”.[/li]
[li]Magic numbers, use enums instead.[/li]
[li]creaturescript, use BossAI instead, example of conversion: http://git.io/IgmeLA Sample.[/li]
[li]hardcoded heroic spells on c++, use spelldificulty_dbc instead: Sample[/li]
[li]use creature_template_addon instead of creature_addon; use creature_addon if you need to overwrite some specific template[/li]
[li]More to come…[/li]

	Any conversion from this deprecated methods is welcome.

[/ul]

Updated with creaturescript, use BossAI instead, example of conversion: http://git.io/IgmeLA

Updated with https://github.com/TrinityCore/TrinityCore/commit/4596fc776e876c2ff131197ba0ab603e74d07144

Updated with:

[ul][li]use creature_template_addon instead of creature_addon; use creature_addon if you need to overwrite some specific template[/li][/ul]

from now on GetVictim() result will need to be checked for NULL instead of just using UpdateVictim()

https://github.com/TrinityCore/TrinityCore/commit/fb6365ac689419a2e5dd758d4bf70c1a20ff41ff

Added sample of conversion of gossips from c++ to db.

When creating PRs you can use c++11 features added on VS 2015 AND GCC up to 4.9, for a list of then look at:

http://gcc.gnu.org/projects/cxx0x.html

Future:
http://i.imgur.com/1Tysvs2.png