Changeset 260

Show
Ignore:
Timestamp:
11/21/08 08:47:55 (17 years ago)
Author:
yumileroy
Message:

*DB script table stucture change. Source Mangos. Also fix some bugs. Hopefully this rev will make program usable again.

Original author: megamage
Date: 2008-11-20 10:43:20-06:00

Location:
trunk
Files:
6 added
352 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/bindings/scripts/ScriptMgr.cpp

    r223 r260  
    1818 
    1919//*** Global data *** 
    20 int nrscripts; 
     20int num_db_scripts; 
     21int num_sc_scripts; 
    2122Script *m_scripts[MAX_SCRIPTS]; 
    2223 
     
    4748// Text Maps 
    4849UNORDERED_MAP<int32, StringTextData> TextMap; 
    49  
    5050 
    5151//*** End Global data *** 
     
    11811181TRINITY_DLL_EXPORT 
    11821182void ScriptsFree() 
    1183 {    
     1183{ 
    11841184    // Free Spell Summary 
    11851185    delete []SpellSummary; 
    11861186 
    11871187    // Free resources before library unload 
    1188     for(int i=0;i<nrscripts;i++) 
     1188    for(int i=0;i<num_db_scripts;i++) 
    11891189        delete m_scripts[i]; 
    11901190 
    1191     nrscripts = 0; 
     1191    num_db_scripts = 0; 
     1192    num_sc_scripts = 0; 
    11921193} 
    11931194 
     
    12401241        LoadDatabase(); 
    12411242 
     1243    num_db_scripts = GetScriptNames().size(); 
     1244 
    12421245    outstring_log("TSCR: Loading C++ scripts"); 
    12431246    barGoLink bar(1); 
     
    12451248    outstring_log(""); 
    12461249 
    1247     nrscripts = 0; 
    12481250    for(int i=0;i<MAX_SCRIPTS;i++) 
    12491251        m_scripts[i]=NULL; 
     
    17761778    // ------------------- 
    17771779 
    1778     outstring_log("TSCR: Loaded %u C++ Scripts", nrscripts); 
    1779     outstring_log(""); 
     1780    outstring_log(">> Loaded %i C++ Scripts (of %i ScriptNames defined in Mangos database)", num_sc_scripts, num_db_scripts); 
    17801781} 
    17811782 
     
    18491850//*** Functions used internally *** 
    18501851 
    1851 TRINITY_DLL_EXPORT 
    1852 char const* ScriptsVersion() 
    1853 { 
    1854         return "Default Trinity scripting library"; 
    1855 } 
    1856  
    1857 Script* GetScriptByName(std::string Name) 
    1858 { 
    1859     if (Name.empty()) 
    1860         return NULL; 
    1861  
    1862     for(int i=0;i<MAX_SCRIPTS;i++) 
    1863     { 
    1864         if (m_scripts[i] && m_scripts[i]->Name == Name) 
    1865             return m_scripts[i]; 
    1866     } 
    1867     return NULL; 
     1852void Script::RegisterSelf() 
     1853{ 
     1854    int id = GetScriptId(Name.c_str()); 
     1855    if (id != 0) 
     1856    { 
     1857        m_scripts[id] = this; 
     1858        ++num_sc_scripts; 
     1859    } else 
     1860        debug_log("SD2: RegisterSelf, but script named %s does not have ScriptName assigned in database.",(this)->Name.c_str()); 
    18681861} 
    18691862 
     
    18721865 
    18731866TRINITY_DLL_EXPORT 
     1867char const* ScriptsVersion() 
     1868{ 
     1869        return "Default Trinity scripting library"; 
     1870} 
     1871TRINITY_DLL_EXPORT 
    18741872bool GossipHello ( Player * player, Creature *_Creature ) 
    18751873{ 
    1876     Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); 
     1874    Script *tmpscript = m_scripts[_Creature->GetScriptId()]; 
    18771875    if (!tmpscript || !tmpscript->pGossipHello) return false; 
    18781876 
     
    18861884    debug_log("TSCR: Gossip selection, sender: %d, action: %d",sender, action); 
    18871885 
    1888     Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); 
     1886    Script *tmpscript = m_scripts[_Creature->GetScriptId()]; 
    18891887    if (!tmpscript || !tmpscript->pGossipSelect) return false; 
    18901888 
     
    18981896    debug_log("TSCR: Gossip selection with code, sender: %d, action: %d",sender, action); 
    18991897 
    1900     Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); 
     1898    Script *tmpscript = m_scripts[_Creature->GetScriptId()]; 
    19011899    if (!tmpscript || !tmpscript->pGossipSelectWithCode) return false; 
    19021900 
     
    19081906bool QuestAccept( Player *player, Creature *_Creature, Quest const *_Quest ) 
    19091907{ 
    1910     Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); 
     1908    Script *tmpscript = m_scripts[_Creature->GetScriptId()]; 
    19111909    if (!tmpscript || !tmpscript->pQuestAccept) return false; 
    19121910 
     
    19181916bool QuestSelect( Player *player, Creature *_Creature, Quest const *_Quest ) 
    19191917{ 
    1920     Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); 
     1918    Script *tmpscript = m_scripts[_Creature->GetScriptId()]; 
    19211919    if (!tmpscript || !tmpscript->pQuestSelect) return false; 
    19221920 
     
    19281926bool QuestComplete( Player *player, Creature *_Creature, Quest const *_Quest ) 
    19291927{ 
    1930     Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); 
     1928    Script *tmpscript = m_scripts[_Creature->GetScriptId()]; 
    19311929    if (!tmpscript || !tmpscript->pQuestComplete) return false; 
    19321930 
     
    19381936bool ChooseReward( Player *player, Creature *_Creature, Quest const *_Quest, uint32 opt ) 
    19391937{ 
    1940     Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); 
     1938    Script *tmpscript = m_scripts[_Creature->GetScriptId()]; 
    19411939    if (!tmpscript || !tmpscript->pChooseReward) return false; 
    19421940 
     
    19481946uint32 NPCDialogStatus( Player *player, Creature *_Creature ) 
    19491947{ 
    1950     Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); 
     1948    Script *tmpscript = m_scripts[_Creature->GetScriptId()]; 
    19511949    if (!tmpscript || !tmpscript->pNPCDialogStatus) return 100; 
    19521950 
     
    19581956uint32 GODialogStatus( Player *player, GameObject *_GO ) 
    19591957{ 
    1960     Script *tmpscript = GetScriptByName(_GO->GetGOInfo()->ScriptName); 
    1961     if(!tmpscript || !tmpscript->pGODialogStatus) return 100; 
     1958    Script *tmpscript = m_scripts[_GO->GetGOInfo()->ScriptId]; 
     1959    if (!tmpscript || !tmpscript->pGODialogStatus) return 100; 
    19621960 
    19631961    player->PlayerTalkClass->ClearMenus(); 
     
    19681966bool ItemHello( Player *player, Item *_Item, Quest const *_Quest ) 
    19691967{ 
    1970     Script *tmpscript = GetScriptByName(_Item->GetProto()->ScriptName); 
     1968    Script *tmpscript = m_scripts[_Item->GetProto()->ScriptId]; 
    19711969    if (!tmpscript || !tmpscript->pItemHello) return false; 
    19721970 
     
    19781976bool ItemQuestAccept( Player *player, Item *_Item, Quest const *_Quest ) 
    19791977{ 
    1980     Script *tmpscript = GetScriptByName(_Item->GetProto()->ScriptName); 
     1978    Script *tmpscript = m_scripts[_Item->GetProto()->ScriptId]; 
    19811979    if (!tmpscript || !tmpscript->pItemQuestAccept) return false; 
    19821980 
     
    19881986bool GOHello( Player *player, GameObject *_GO ) 
    19891987{ 
    1990     Script *tmpscript = GetScriptByName(_GO->GetGOInfo()->ScriptName); 
     1988    Script *tmpscript = m_scripts[_GO->GetGOInfo()->ScriptId]; 
    19911989    if (!tmpscript || !tmpscript->pGOHello) return false; 
    19921990 
     
    19981996bool GOQuestAccept( Player *player, GameObject *_GO, Quest const *_Quest ) 
    19991997{ 
    2000     Script *tmpscript = GetScriptByName(_GO->GetGOInfo()->ScriptName); 
     1998    Script *tmpscript = m_scripts[_GO->GetGOInfo()->ScriptId]; 
    20011999    if (!tmpscript || !tmpscript->pGOQuestAccept) return false; 
    20022000 
     
    20082006bool GOChooseReward( Player *player, GameObject *_GO, Quest const *_Quest, uint32 opt ) 
    20092007{ 
    2010     Script *tmpscript = GetScriptByName(_GO->GetGOInfo()->ScriptName); 
     2008    Script *tmpscript = m_scripts[_GO->GetGOInfo()->ScriptId]; 
    20112009    if (!tmpscript || !tmpscript->pGOChooseReward) return false; 
    20122010 
     
    20182016bool AreaTrigger( Player *player, AreaTriggerEntry * atEntry) 
    20192017{ 
    2020     Script *tmpscript = NULL; 
    2021  
    2022     tmpscript = GetScriptByName(GetAreaTriggerScriptNameById(atEntry->id)); 
     2018    Script *tmpscript = m_scripts[GetAreaTriggerScriptId(atEntry->id)]; 
    20232019    if (!tmpscript || !tmpscript->pAreaTrigger) return false; 
    20242020 
     
    20292025CreatureAI* GetAI(Creature *_Creature) 
    20302026{ 
    2031     Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); 
    2032  
     2027    Script *tmpscript = m_scripts[_Creature->GetScriptId()]; 
    20332028    if (!tmpscript || !tmpscript->GetAI) return NULL; 
     2029 
    20342030    return tmpscript->GetAI(_Creature); 
    20352031} 
     
    20382034bool ItemUse( Player *player, Item* _Item, SpellCastTargets const& targets) 
    20392035{ 
    2040     Script *tmpscript = GetScriptByName(_Item->GetProto()->ScriptName); 
     2036    Script *tmpscript = m_scripts[_Item->GetProto()->ScriptId]; 
    20412037    if (!tmpscript || !tmpscript->pItemUse) return false; 
    20422038 
     
    20472043bool ReceiveEmote( Player *player, Creature *_Creature, uint32 emote ) 
    20482044{ 
    2049     Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); 
     2045    Script *tmpscript = m_scripts[_Creature->GetScriptId()]; 
    20502046    if (!tmpscript || !tmpscript->pReceiveEmote) return false; 
    20512047 
     
    20562052InstanceData* CreateInstanceData(Map *map) 
    20572053{ 
    2058     Script *tmpscript = NULL; 
    2059  
    2060     if (!map->IsDungeon()) return false; 
    2061  
    2062     tmpscript = GetScriptByName(((InstanceMap*)map)->GetScript()); 
    2063     if (!tmpscript || !tmpscript->GetInstanceData) return false; 
     2054    if (!map->IsDungeon()) return NULL; 
     2055 
     2056    Script *tmpscript = m_scripts[((InstanceMap*)map)->GetScriptId()]; 
     2057    if (!tmpscript || !tmpscript->GetInstanceData) return NULL; 
    20642058 
    20652059    return tmpscript->GetInstanceData(map); 
  • trunk/src/bindings/scripts/ScriptMgr.h

    r149 r260  
    2525class WorldObject; 
    2626 
    27 #define MAX_SCRIPTS         1000                            //72 bytes each (approx 71kb) 
     27#define MAX_SCRIPTS         5000                            //72 bytes each (approx 351kb) 
    2828#define VISIBLE_RANGE       (166.0f)                        //MAX visible range (size of grid) 
    2929#define DEFAULT_TEXT        "<Trinity Script Text Entry Missing!>" 
     
    3232{ 
    3333    Script() : 
    34 pGossipHello(NULL), pQuestAccept(NULL), pGossipSelect(NULL), pGossipSelectWithCode(NULL), 
    35 pQuestSelect(NULL), pQuestComplete(NULL), pNPCDialogStatus(NULL), pGODialogStatus(NULL), pChooseReward(NULL), 
    36 pItemHello(NULL), pGOHello(NULL), pAreaTrigger(NULL), pItemQuestAccept(NULL), pGOQuestAccept(NULL), 
    37 pGOChooseReward(NULL),pReceiveEmote(NULL),pItemUse(NULL), GetAI(NULL), GetInstanceData(NULL) 
    38 {} 
     34        pGossipHello(NULL), pQuestAccept(NULL), pGossipSelect(NULL), pGossipSelectWithCode(NULL), 
     35        pQuestSelect(NULL), pQuestComplete(NULL), pNPCDialogStatus(NULL), pGODialogStatus(NULL), pChooseReward(NULL), 
     36        pItemHello(NULL), pGOHello(NULL), pAreaTrigger(NULL), pItemQuestAccept(NULL), pGOQuestAccept(NULL), 
     37        pGOChooseReward(NULL),pReceiveEmote(NULL),pItemUse(NULL), GetAI(NULL), GetInstanceData(NULL) 
     38    {} 
    3939 
    40 std::string Name; 
     40    std::string Name; 
    4141 
    42 // Quest/gossip Methods to be scripted 
    43 bool (*pGossipHello         )(Player*, Creature*); 
    44 bool (*pQuestAccept         )(Player*, Creature*, Quest const* ); 
    45 bool (*pGossipSelect        )(Player*, Creature*, uint32 , uint32 ); 
    46 bool (*pGossipSelectWithCode)(Player*, Creature*, uint32 , uint32 , const char* ); 
    47 bool (*pQuestSelect         )(Player*, Creature*, Quest const* ); 
    48 bool (*pQuestComplete       )(Player*, Creature*, Quest const* ); 
    49 uint32 (*pNPCDialogStatus   )(Player*, Creature* ); 
    50 uint32 (*pGODialogStatus    )(Player *player, GameObject * _GO ); 
    51 bool (*pChooseReward        )(Player*, Creature*, Quest const*, uint32 ); 
    52 bool (*pItemHello           )(Player*, Item*, Quest const* ); 
    53 bool (*pGOHello             )(Player*, GameObject* ); 
    54 bool (*pAreaTrigger         )(Player*, AreaTriggerEntry* ); 
    55 bool (*pItemQuestAccept     )(Player*, Item *, Quest const* ); 
    56 bool (*pGOQuestAccept       )(Player*, GameObject*, Quest const* ); 
    57 bool (*pGOChooseReward      )(Player*, GameObject*_GO, Quest const*, uint32 ); 
    58 bool (*pReceiveEmote        )(Player*, Creature*, uint32 ); 
    59 bool (*pItemUse             )(Player*, Item*, SpellCastTargets const& ); 
     42    //Methods to be scripted 
     43    bool (*pGossipHello         )(Player*, Creature*); 
     44    bool (*pQuestAccept         )(Player*, Creature*, Quest const* ); 
     45    bool (*pGossipSelect        )(Player*, Creature*, uint32 , uint32 ); 
     46    bool (*pGossipSelectWithCode)(Player*, Creature*, uint32 , uint32 , const char* ); 
     47    bool (*pQuestSelect         )(Player*, Creature*, Quest const* ); 
     48    bool (*pQuestComplete       )(Player*, Creature*, Quest const* ); 
     49    uint32 (*pNPCDialogStatus   )(Player*, Creature* ); 
     50    uint32 (*pGODialogStatus    )(Player*, GameObject * _GO ); 
     51    bool (*pChooseReward        )(Player*, Creature*, Quest const*, uint32 ); 
     52    bool (*pItemHello           )(Player*, Item*, Quest const* ); 
     53    bool (*pGOHello             )(Player*, GameObject* ); 
     54    bool (*pAreaTrigger         )(Player*, AreaTriggerEntry* ); 
     55    bool (*pItemQuestAccept     )(Player*, Item *, Quest const* ); 
     56    bool (*pGOQuestAccept       )(Player*, GameObject*, Quest const* ); 
     57    bool (*pGOChooseReward      )(Player*, GameObject*, Quest const*, uint32 ); 
     58    bool (*pReceiveEmote        )(Player*, Creature*, uint32 ); 
     59    bool (*pItemUse             )(Player*, Item*, SpellCastTargets const& ); 
    6060 
    61 CreatureAI* (*GetAI)(Creature*); 
    62 InstanceData* (*GetInstanceData)(Map*); 
     61    CreatureAI* (*GetAI)(Creature*); 
     62    InstanceData* (*GetInstanceData)(Map*); 
     63 
     64    void RegisterSelf(); 
    6365}; 
    64  
    65 extern int nrscripts; 
    66 extern Script *m_scripts[MAX_SCRIPTS]; 
    6766 
    6867//Generic scripting text function 
  • trunk/src/bindings/scripts/scripts/areatrigger/areatrigger_scripts.cpp

    r90 r260  
    4141    newscript->Name="at_test"; 
    4242    newscript->pAreaTrigger = ATtest; 
    43     m_scripts[nrscripts++] = newscript; 
     43    newscript->RegisterSelf(); 
    4444} 
  • trunk/src/bindings/scripts/scripts/boss/boss_emeriss.cpp

    r90 r260  
    153153    newscript->Name="boss_emeriss"; 
    154154    newscript->GetAI = GetAI_boss_emeriss; 
    155     m_scripts[nrscripts++] = newscript; 
     155    newscript->RegisterSelf(); 
    156156} 
  • trunk/src/bindings/scripts/scripts/boss/boss_taerar.cpp

    r90 r260  
    298298    newscript->Name="boss_taerar"; 
    299299    newscript->GetAI = GetAI_boss_taerar; 
    300     m_scripts[nrscripts++] = newscript; 
     300    newscript->RegisterSelf(); 
    301301 
    302302    newscript = new Script; 
    303303    newscript->Name="boss_shade_of_taerar"; 
    304304    newscript->GetAI = GetAI_boss_shadeoftaerar; 
    305     m_scripts[nrscripts++] = newscript; 
     305    newscript->RegisterSelf(); 
    306306} 
  • trunk/src/bindings/scripts/scripts/boss/boss_ysondre.cpp

    r90 r260  
    238238    newscript->Name="boss_ysondre"; 
    239239    newscript->GetAI = GetAI_boss_ysondre; 
    240     m_scripts[nrscripts++] = newscript; 
     240    newscript->RegisterSelf(); 
    241241 
    242242    newscript = new Script; 
    243243    newscript->Name="mob_dementeddruids"; 
    244244    newscript->GetAI = GetAI_mob_dementeddruids; 
    245     m_scripts[nrscripts++] = newscript; 
     245    newscript->RegisterSelf(); 
    246246} 
  • trunk/src/bindings/scripts/scripts/creature/mob_event_ai.cpp

    r239 r260  
    14011401    newscript->Name="mob_eventai"; 
    14021402    newscript->GetAI = GetAI_Mob_EventAI; 
    1403     m_scripts[nrscripts++] = newscript; 
     1403    newscript->RegisterSelf(); 
    14041404} 
  • trunk/src/bindings/scripts/scripts/creature/mob_generic_creature.cpp

    r158 r260  
    169169    newscript->Name="generic_creature"; 
    170170    newscript->GetAI = GetAI_generic_creature; 
    171     m_scripts[nrscripts++] = newscript; 
     171    newscript->RegisterSelf(); 
    172172} 
  • trunk/src/bindings/scripts/scripts/custom/custom_example.cpp

    r90 r260  
    274274    newscript->pGossipSelect = &GossipSelect_custom_example; 
    275275    newscript->pReceiveEmote = &ReceiveEmote_custom_example; 
    276     m_scripts[nrscripts++] = newscript; 
    277 } 
     276    newscript->RegisterSelf(); 
     277} 
  • trunk/src/bindings/scripts/scripts/custom/custom_gossip_codebox.cpp

    r90 r260  
    7878    newscript->pGossipSelect =          &GossipSelect_custom_gossip_codebox; 
    7979    newscript->pGossipSelectWithCode =  &GossipSelectWithCode_custom_gossip_codebox; 
    80     m_scripts[nrscripts++] = newscript; 
     80    newscript->RegisterSelf(); 
    8181} 
  • trunk/src/bindings/scripts/scripts/custom/test.cpp

    r90 r260  
    197197    newscript->pGossipHello          = &GossipHello_npc_test; 
    198198    newscript->pGossipSelect         = &GossipSelect_npc_test; 
    199     m_scripts[nrscripts++] = newscript; 
    200 } 
     199    newscript->RegisterSelf(); 
     200} 
  • trunk/src/bindings/scripts/scripts/go/go_scripts.cpp

    r239 r260  
    166166    newscript->Name="go_northern_crystal_pylon"; 
    167167    newscript->pGOHello =           &GOHello_go_northern_crystal_pylon; 
    168     m_scripts[nrscripts++] = newscript; 
     168    newscript->RegisterSelf(); 
    169169 
    170170    newscript = new Script; 
    171171    newscript->Name="go_eastern_crystal_pylon"; 
    172172    newscript->pGOHello =           &GOHello_go_eastern_crystal_pylon; 
    173     m_scripts[nrscripts++] = newscript; 
     173    newscript->RegisterSelf(); 
    174174 
    175175    newscript = new Script; 
    176176    newscript->Name="go_western_crystal_pylon"; 
    177177    newscript->pGOHello =           &GOHello_go_western_crystal_pylon; 
    178     m_scripts[nrscripts++] = newscript; 
     178    newscript->RegisterSelf(); 
    179179 
    180180    newscript = new Script; 
    181181    newscript->Name="go_barov_journal"; 
    182182    newscript->pGOHello =           &GOHello_go_barov_journal; 
    183     m_scripts[nrscripts++] = newscript; 
     183    newscript->RegisterSelf(); 
    184184 
    185185    newscript = new Script; 
    186186    newscript->Name="go_field_repair_bot_74A"; 
    187187    newscript->pGOHello =           &GOHello_go_field_repair_bot_74A; 
    188     m_scripts[nrscripts++] = newscript; 
     188    newscript->RegisterSelf(); 
    189189 
    190190    newscript = new Script; 
    191191    newscript->Name="go_orb_of_command"; 
    192192    newscript->pGOHello =           &GOHello_go_orb_of_command; 
    193     m_scripts[nrscripts++] = newscript; 
     193    newscript->RegisterSelf(); 
    194194 
    195195    newscript = new Script; 
    196196    newscript->Name="go_tablet_of_madness"; 
    197197    newscript->pGOHello =           &GOHello_go_tablet_of_madness; 
    198     m_scripts[nrscripts++] = newscript; 
     198    newscript->RegisterSelf(); 
    199199 
    200200    newscript = new Script; 
    201201    newscript->Name="go_tablet_of_the_seven"; 
    202202    newscript->pGOHello =           &GOHello_go_tablet_of_the_seven; 
    203     m_scripts[nrscripts++] = newscript; 
     203    newscript->RegisterSelf(); 
    204204 
    205205    newscript = new Script; 
    206206    newscript->Name="go_teleporter"; 
    207207    newscript->pGOHello =           &GOHello_go_teleporter; 
    208     m_scripts[nrscripts++] = newscript; 
    209 } 
     208    newscript->RegisterSelf(); 
     209} 
  • trunk/src/bindings/scripts/scripts/guard/guards.cpp

    r159 r260  
    39813981    newscript->pGossipSelect         = &GossipSelect_guard_azuremyst; 
    39823982    newscript->GetAI = GetAI_guard_azuremyst; 
    3983     m_scripts[nrscripts++] = newscript; 
     3983    newscript->RegisterSelf(); 
    39843984 
    39853985    newscript = new Script; 
     
    39883988    newscript->pGossipSelect         = &GossipSelect_guard_bluffwatcher; 
    39893989    newscript->GetAI = GetAI_guard_bluffwatcher; 
    3990     m_scripts[nrscripts++] = newscript; 
     3990    newscript->RegisterSelf(); 
    39913991 
    39923992    newscript = new Script; 
    39933993    newscript->Name="guard_contested"; 
    39943994    newscript->GetAI = GetAI_guard_contested; 
    3995     m_scripts[nrscripts++] = newscript; 
     3995    newscript->RegisterSelf(); 
    39963996 
    39973997    newscript = new Script; 
     
    40004000    newscript->pGossipSelect         = &GossipSelect_guard_darnassus; 
    40014001    newscript->GetAI = GetAI_guard_darnassus; 
    4002     m_scripts[nrscripts++] = newscript; 
     4002    newscript->RegisterSelf(); 
    40034003 
    40044004    newscript = new Script; 
     
    40074007    newscript->pGossipSelect         = &GossipSelect_guard_dunmorogh; 
    40084008    newscript->GetAI = GetAI_guard_dunmorogh; 
    4009     m_scripts[nrscripts++] = newscript; 
     4009    newscript->RegisterSelf(); 
    40104010 
    40114011    newscript = new Script; 
     
    40144014    newscript->pGossipSelect         = &GossipSelect_guard_durotar; 
    40154015    newscript->GetAI = GetAI_guard_durotar; 
    4016     m_scripts[nrscripts++] = newscript; 
     4016    newscript->RegisterSelf(); 
    40174017 
    40184018    newscript = new Script; 
     
    40214021    newscript->pGossipSelect         = &GossipSelect_guard_elwynnforest; 
    40224022    newscript->GetAI = GetAI_guard_elwynnforest; 
    4023     m_scripts[nrscripts++] = newscript; 
     4023    newscript->RegisterSelf(); 
    40244024 
    40254025    newscript = new Script; 
     
    40284028    newscript->pGossipSelect         = &GossipSelect_guard_eversong; 
    40294029    newscript->GetAI = GetAI_guard_eversong; 
    4030     m_scripts[nrscripts++] = newscript; 
     4030    newscript->RegisterSelf(); 
    40314031 
    40324032    newscript = new Script; 
     
    40354035    newscript->pGossipSelect         = &GossipSelect_guard_exodar; 
    40364036    newscript->GetAI = GetAI_guard_exodar; 
    4037     m_scripts[nrscripts++] = newscript; 
     4037    newscript->RegisterSelf(); 
    40384038 
    40394039    newscript = new Script; 
     
    40424042    newscript->pGossipSelect         = &GossipSelect_guard_ironforge; 
    40434043    newscript->GetAI = GetAI_guard_ironforge; 
    4044     m_scripts[nrscripts++] = newscript; 
     4044    newscript->RegisterSelf(); 
    40454045 
    40464046    newscript = new Script; 
     
    40494049    newscript->pGossipSelect         = &GossipSelect_guard_mulgore; 
    40504050    newscript->GetAI = GetAI_guard_mulgore; 
    4051     m_scripts[nrscripts++] = newscript; 
     4051    newscript->RegisterSelf(); 
    40524052 
    40534053    newscript = new Script; 
     
    40574057    newscript->pReceiveEmote         = &ReceiveEmote_guard_orgrimmar; 
    40584058    newscript->GetAI = GetAI_guard_orgrimmar; 
    4059     m_scripts[nrscripts++] = newscript; 
     4059    newscript->RegisterSelf(); 
    40604060 
    40614061    newscript = new Script; 
     
    40644064    newscript->pGossipSelect         = &GossipSelect_guard_shattrath; 
    40654065    newscript->GetAI = GetAI_guard_shattrath; 
    4066     m_scripts[nrscripts++] = newscript; 
     4066    newscript->RegisterSelf(); 
    40674067 
    40684068    newscript = new Script; 
     
    40714071    newscript->pGossipHello          = &GossipHello_guard_shattrath_aldor; 
    40724072    newscript->pGossipSelect         = &GossipSelect_guard_shattrath_aldor; 
    4073     m_scripts[nrscripts++] = newscript; 
     4073    newscript->RegisterSelf(); 
    40744074 
    40754075    newscript = new Script; 
     
    40784078    newscript->pGossipHello          = &GossipHello_guard_shattrath_scryer; 
    40794079    newscript->pGossipSelect         = &GossipSelect_guard_shattrath_scryer; 
    4080     m_scripts[nrscripts++] = newscript; 
     4080    newscript->RegisterSelf(); 
    40814081 
    40824082    newscript = new Script; 
     
    40854085    newscript->pGossipSelect         = &GossipSelect_guard_silvermoon; 
    40864086    newscript->GetAI = GetAI_guard_silvermoon; 
    4087     m_scripts[nrscripts++] = newscript; 
     4087    newscript->RegisterSelf(); 
    40884088 
    40894089    newscript = new Script; 
     
    40934093    newscript->pReceiveEmote         = &ReceiveEmote_guard_stormwind; 
    40944094    newscript->GetAI = GetAI_guard_stormwind; 
    4095     m_scripts[nrscripts++] = newscript; 
     4095    newscript->RegisterSelf(); 
    40964096 
    40974097    newscript = new Script; 
     
    41004100    newscript->pGossipSelect         = &GossipSelect_guard_teldrassil; 
    41014101    newscript->GetAI = GetAI_guard_teldrassil; 
    4102     m_scripts[nrscripts++] = newscript; 
     4102    newscript->RegisterSelf(); 
    41034103 
    41044104    newscript = new Script; 
     
    41074107    newscript->pGossipSelect         = &GossipSelect_guard_tirisfal; 
    41084108    newscript->GetAI = GetAI_guard_tirisfal; 
    4109     m_scripts[nrscripts++] = newscript; 
     4109    newscript->RegisterSelf(); 
    41104110 
    41114111    newscript = new Script; 
     
    41144114    newscript->pGossipSelect         = &GossipSelect_guard_undercity; 
    41154115    newscript->GetAI = GetAI_guard_undercity; 
    4116     m_scripts[nrscripts++] = newscript; 
    4117 } 
     4116    newscript->RegisterSelf(); 
     4117} 
  • trunk/src/bindings/scripts/scripts/item/item_scripts.cpp

    r105 r260  
    456456    newscript->Name="item_area_52_special"; 
    457457    newscript->pItemUse = ItemUse_item_area_52_special; 
    458     m_scripts[nrscripts++] = newscript; 
     458    newscript->RegisterSelf(); 
    459459 
    460460    newscript = new Script; 
    461461    newscript->Name="item_arcane_charges"; 
    462462    newscript->pItemUse = ItemUse_item_arcane_charges; 
    463     m_scripts[nrscripts++] = newscript; 
     463    newscript->RegisterSelf(); 
    464464 
    465465    newscript = new Script; 
    466466    newscript->Name="item_attuned_crystal_cores"; 
    467467    newscript->pItemUse = ItemUse_item_attuned_crystal_cores; 
    468     m_scripts[nrscripts++] = newscript; 
     468    newscript->RegisterSelf(); 
    469469 
    470470    newscript = new Script; 
    471471    newscript->Name="item_blackwhelp_net"; 
    472472    newscript->pItemUse = ItemUse_item_blackwhelp_net; 
    473     m_scripts[nrscripts++] = newscript; 
     473    newscript->RegisterSelf(); 
    474474 
    475475    newscript = new Script; 
    476476    newscript->Name="item_disciplinary_rod"; 
    477477    newscript->pItemUse = ItemUse_item_disciplinary_rod; 
    478     m_scripts[nrscripts++] = newscript; 
     478    newscript->RegisterSelf(); 
    479479 
    480480    newscript = new Script; 
    481481    newscript->Name="item_draenei_fishing_net"; 
    482482    newscript->pItemUse = ItemUse_item_draenei_fishing_net; 
    483     m_scripts[nrscripts++] = newscript; 
     483    newscript->RegisterSelf(); 
    484484 
    485485    newscript = new Script; 
    486486    newscript->Name="item_nether_wraith_beacon"; 
    487487    newscript->pItemUse = ItemUse_item_nether_wraith_beacon; 
    488     m_scripts[nrscripts++] = newscript; 
     488    newscript->RegisterSelf(); 
    489489 
    490490    newscript = new Script; 
    491491    newscript->Name="item_flying_machine"; 
    492492    newscript->pItemUse = ItemUse_item_flying_machine; 
    493     m_scripts[nrscripts++] = newscript; 
     493    newscript->RegisterSelf(); 
    494494 
    495495    newscript = new Script; 
    496496    newscript->Name="item_gor_dreks_ointment"; 
    497497    newscript->pItemUse = ItemUse_item_gor_dreks_ointment; 
    498     m_scripts[nrscripts++] = newscript; 
     498    newscript->RegisterSelf(); 
    499499 
    500500    newscript = new Script; 
    501501    newscript->Name="item_muiseks_vessel"; 
    502502    newscript->pItemUse = ItemUse_item_muiseks_vessel; 
    503     m_scripts[nrscripts++] = newscript; 
     503    newscript->RegisterSelf(); 
    504504 
    505505    newscript = new Script; 
    506506    newscript->Name="item_razorthorn_flayer_gland"; 
    507507    newscript->pItemUse = ItemUse_item_razorthorn_flayer_gland; 
    508     m_scripts[nrscripts++] = newscript; 
     508    newscript->RegisterSelf(); 
    509509 
    510510    newscript = new Script; 
    511511    newscript->Name="item_tame_beast_rods"; 
    512512    newscript->pItemUse = ItemUse_item_tame_beast_rods; 
    513     m_scripts[nrscripts++] = newscript; 
     513    newscript->RegisterSelf(); 
    514514 
    515515    newscript = new Script; 
    516516    newscript->Name="item_protovoltaic_magneto_collector"; 
    517517    newscript->pItemUse = ItemUse_item_protovoltaic_magneto_collector; 
    518     m_scripts[nrscripts++] = newscript; 
     518    newscript->RegisterSelf(); 
    519519 
    520520    newscript = new Script; 
    521521    newscript->Name="item_soul_cannon"; 
    522522    newscript->pItemUse = ItemUse_item_soul_cannon; 
    523     m_scripts[nrscripts++] = newscript; 
     523    newscript->RegisterSelf(); 
    524524 
    525525    newscript = new Script; 
    526526    newscript->Name="item_sparrowhawk_net"; 
    527527    newscript->pItemUse = ItemUse_item_sparrowhawk_net; 
    528     m_scripts[nrscripts++] = newscript; 
     528    newscript->RegisterSelf(); 
    529529 
    530530    newscript = new Script; 
    531531    newscript->Name="item_voodoo_charm"; 
    532532    newscript->pItemUse = ItemUse_item_voodoo_charm; 
    533     m_scripts[nrscripts++] = newscript; 
     533    newscript->RegisterSelf(); 
    534534 
    535535    newscript = new Script; 
    536536    newscript->Name="item_vorenthals_presence"; 
    537537    newscript->pItemUse = ItemUse_item_vorenthals_presence; 
    538     m_scripts[nrscripts++] = newscript; 
     538    newscript->RegisterSelf(); 
    539539 
    540540    newscript = new Script; 
    541541    newscript->Name="item_yehkinyas_bramble"; 
    542542    newscript->pItemUse = ItemUse_item_yehkinyas_bramble; 
    543     m_scripts[nrscripts++] = newscript; 
     543    newscript->RegisterSelf(); 
    544544 
    545545    newscript = new Script; 
    546546    newscript->Name="item_zezzaks_shard"; 
    547547    newscript->pItemUse = ItemUse_item_zezzak_shard; 
    548     m_scripts[nrscripts++] = newscript; 
    549 } 
     548    newscript->RegisterSelf(); 
     549} 
  • trunk/src/bindings/scripts/scripts/item/item_test.cpp

    r90 r260  
    3939    newscript->Name="item_test"; 
    4040    newscript->pItemUse = ItemUse_item_test; 
    41     m_scripts[nrscripts++] = newscript; 
     41    newscript->RegisterSelf(); 
    4242} 
  • trunk/src/bindings/scripts/scripts/npc/npc_innkeeper.cpp

    r90 r260  
    141141    newscript->pGossipHello = &GossipHello_npc_innkeeper; 
    142142    newscript->pGossipSelect = &GossipSelect_npc_innkeeper; 
    143     m_scripts[nrscripts++] = newscript; 
     143    newscript->RegisterSelf(); 
    144144} 
  • trunk/src/bindings/scripts/scripts/npc/npc_professions.cpp

    r91 r260  
    11781178    newscript->pGossipHello =  &GossipHello_npc_prof_alchemy; 
    11791179    newscript->pGossipSelect = &GossipSelect_npc_prof_alchemy; 
    1180     m_scripts[nrscripts++] = newscript; 
     1180    newscript->RegisterSelf(); 
    11811181 
    11821182    newscript = new Script; 
     
    11841184    newscript->pGossipHello =  &GossipHello_npc_prof_blacksmith; 
    11851185    newscript->pGossipSelect = &GossipSelect_npc_prof_blacksmith; 
    1186     m_scripts[nrscripts++] = newscript; 
     1186    newscript->RegisterSelf(); 
    11871187 
    11881188    newscript = new Script; 
     
    11901190    newscript->pGossipHello =  &GossipHello_npc_prof_leather; 
    11911191    newscript->pGossipSelect = &GossipSelect_npc_prof_leather; 
    1192     m_scripts[nrscripts++] = newscript; 
     1192    newscript->RegisterSelf(); 
    11931193 
    11941194    newscript = new Script; 
     
    11961196    newscript->pGossipHello =  &GossipHello_npc_prof_tailor; 
    11971197    newscript->pGossipSelect = &GossipSelect_npc_prof_tailor; 
    1198     m_scripts[nrscripts++] = newscript; 
     1198    newscript->RegisterSelf(); 
    11991199 
    12001200    /*newscript = new Script; 
     
    12021202    newscript->pGOHello =  &GOHello_go_soothsaying_for_dummies; 
    12031203    //newscript->pGossipSelect = &GossipSelect_go_soothsaying_for_dummies; 
    1204     m_scripts[nrscripts++] = newscript;*/ 
    1205 } 
     1204    newscript->RegisterSelf();*/ 
     1205} 
  • trunk/src/bindings/scripts/scripts/npc/npcs_special.cpp

    r90 r260  
    836836    newscript->pQuestAccept =   &QuestAccept_npc_chicken_cluck; 
    837837    newscript->pQuestComplete = &QuestComplete_npc_chicken_cluck; 
    838     m_scripts[nrscripts++] = newscript; 
     838    newscript->RegisterSelf(); 
    839839 
    840840    newscript = new Script; 
    841841    newscript->Name="npc_dancing_flames"; 
    842842    newscript->pReceiveEmote =  &ReceiveEmote_npc_dancing_flames; 
    843     m_scripts[nrscripts++] = newscript; 
     843    newscript->RegisterSelf(); 
    844844 
    845845    newscript = new Script; 
    846846    newscript->Name="npc_injured_patient"; 
    847847    newscript->GetAI = GetAI_npc_injured_patient; 
    848     m_scripts[nrscripts++] = newscript; 
     848    newscript->RegisterSelf(); 
    849849 
    850850    newscript = new Script; 
     
    852852    newscript->GetAI = GetAI_npc_doctor; 
    853853    newscript->pQuestAccept = &QuestAccept_npc_doctor; 
    854     m_scripts[nrscripts++] = newscript; 
     854    newscript->RegisterSelf(); 
    855855 
    856856    newscript = new Script; 
    857857    newscript->Name="npc_guardian"; 
    858858    newscript->GetAI = GetAI_npc_guardian; 
    859     m_scripts[nrscripts++] = newscript; 
     859    newscript->RegisterSelf(); 
    860860 
    861861    newscript = new Script; 
     
    863863    newscript->pGossipHello =  &GossipHello_npc_mount_vendor; 
    864864    newscript->pGossipSelect = &GossipSelect_npc_mount_vendor; 
    865     m_scripts[nrscripts++] = newscript; 
     865    newscript->RegisterSelf(); 
    866866 
    867867    newscript = new Script; 
     
    869869    newscript->pGossipHello =  &GossipHello_npc_rogue_trainer; 
    870870    newscript->pGossipSelect = &GossipSelect_npc_rogue_trainer; 
    871     m_scripts[nrscripts++] = newscript; 
     871    newscript->RegisterSelf(); 
    872872 
    873873    newscript = new Script; 
     
    875875    newscript->pGossipHello = &GossipHello_npc_sayge; 
    876876    newscript->pGossipSelect = &GossipSelect_npc_sayge; 
    877     m_scripts[nrscripts++] = newscript; 
    878 } 
     877    newscript->RegisterSelf(); 
     878} 
  • trunk/src/bindings/scripts/scripts/zone/alterac_mountains/alterac_mountains.cpp

    r90 r260  
    5959    newscript->Name="npc_ravenholdt"; 
    6060    newscript->GetAI = GetAI_npc_ravenholdt; 
    61     m_scripts[nrscripts++] = newscript; 
     61    newscript->RegisterSelf(); 
    6262} 
  • trunk/src/bindings/scripts/scripts/zone/aunchindoun/auchenai_crypts/boss_exarch_maladaar.cpp

    r229 r260  
    349349    newscript->Name="boss_exarch_maladaar"; 
    350350    newscript->GetAI = GetAI_boss_exarch_maladaar; 
    351     m_scripts[nrscripts++] = newscript; 
     351    newscript->RegisterSelf(); 
    352352 
    353353    newscript = new Script; 
    354354    newscript->Name="mob_avatar_of_martyred"; 
    355355    newscript->GetAI = GetAI_mob_avatar_of_martyred; 
    356     m_scripts[nrscripts++] = newscript; 
     356    newscript->RegisterSelf(); 
    357357 
    358358    newscript = new Script; 
    359359    newscript->Name="mob_stolen_soul"; 
    360360    newscript->GetAI = GetAI_mob_stolen_soul; 
    361     m_scripts[nrscripts++] = newscript; 
     361    newscript->RegisterSelf(); 
    362362} 
  • trunk/src/bindings/scripts/scripts/zone/aunchindoun/mana_tombs/boss_nexusprince_shaffar.cpp

    r229 r260  
    272272    newscript->Name="boss_nexusprince_shaffar"; 
    273273    newscript->GetAI = GetAI_boss_nexusprince_shaffar; 
    274     m_scripts[nrscripts++] = newscript; 
     274    newscript->RegisterSelf(); 
    275275 
    276276    newscript = new Script; 
    277277    newscript->Name="mob_ethereal_beacon"; 
    278278    newscript->GetAI = GetAI_mob_ethereal_beacon; 
    279     m_scripts[nrscripts++] = newscript; 
     279    newscript->RegisterSelf(); 
    280280} 
  • trunk/src/bindings/scripts/scripts/zone/aunchindoun/mana_tombs/boss_pandemonius.cpp

    r115 r260  
    135135    newscript->Name="boss_pandemonius"; 
    136136    newscript->GetAI = GetAI_boss_pandemonius; 
    137     m_scripts[nrscripts++] = newscript; 
     137    newscript->RegisterSelf(); 
    138138} 
  • trunk/src/bindings/scripts/scripts/zone/aunchindoun/sethekk_halls/boss_darkweaver_syth.cpp

    r115 r260  
    393393    newscript->Name="boss_darkweaver_syth"; 
    394394    newscript->GetAI = GetAI_boss_darkweaver_syth; 
    395     m_scripts[nrscripts++] = newscript; 
     395    newscript->RegisterSelf(); 
    396396 
    397397    newscript = new Script; 
    398398    newscript->Name="mob_syth_fire"; 
    399399    newscript->GetAI = GetAI_mob_syth_arcane; 
    400     m_scripts[nrscripts++] = newscript; 
     400    newscript->RegisterSelf(); 
    401401 
    402402    newscript = new Script; 
    403403    newscript->Name="mob_syth_arcane"; 
    404404    newscript->GetAI = GetAI_mob_syth_arcane; 
    405     m_scripts[nrscripts++] = newscript; 
     405    newscript->RegisterSelf(); 
    406406 
    407407    newscript = new Script; 
    408408    newscript->Name="mob_syth_frost"; 
    409409    newscript->GetAI = GetAI_mob_syth_frost; 
    410     m_scripts[nrscripts++] = newscript; 
     410    newscript->RegisterSelf(); 
    411411 
    412412    newscript = new Script; 
    413413    newscript->Name="mob_syth_shadow"; 
    414414    newscript->GetAI = GetAI_mob_syth_shadow; 
    415     m_scripts[nrscripts++] = newscript; 
    416 } 
     415    newscript->RegisterSelf(); 
     416} 
  • trunk/src/bindings/scripts/scripts/zone/aunchindoun/sethekk_halls/boss_tailonking_ikiss.cpp

    r229 r260  
    220220    newscript->Name="boss_talon_king_ikiss"; 
    221221    newscript->GetAI = GetAI_boss_talon_king_ikiss; 
    222     m_scripts[nrscripts++] = newscript; 
     222    newscript->RegisterSelf(); 
    223223} 
  • trunk/src/bindings/scripts/scripts/zone/aunchindoun/sethekk_halls/instance_sethekk_halls.cpp

    r90 r260  
    7171    newscript->Name = "instance_sethekk_halls"; 
    7272    newscript->GetInstanceData = GetInstanceData_instance_sethekk_halls; 
    73     m_scripts[nrscripts++] = newscript; 
     73    newscript->RegisterSelf(); 
    7474} 
  • trunk/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/boss_ambassador_hellmaw.cpp

    r115 r260  
    195195    newscript->Name="boss_ambassador_hellmaw"; 
    196196    newscript->GetAI = GetAI_boss_ambassador_hellmaw; 
    197     m_scripts[nrscripts++] = newscript; 
     197    newscript->RegisterSelf(); 
    198198} 
  • trunk/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/boss_blackheart_the_inciter.cpp

    r115 r260  
    174174    newscript->Name="boss_blackheart_the_inciter"; 
    175175    newscript->GetAI = GetAI_boss_blackheart_the_inciter; 
    176     m_scripts[nrscripts++] = newscript; 
     176    newscript->RegisterSelf(); 
    177177} 
  • trunk/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/boss_grandmaster_vorpil.cpp

    r257 r260  
    364364    newscript->Name="boss_grandmaster_vorpil"; 
    365365    newscript->GetAI = GetAI_boss_grandmaster_vorpil; 
    366     m_scripts[nrscripts++] = newscript; 
     366    newscript->RegisterSelf(); 
    367367 
    368368    newscript = new Script; 
    369369    newscript->Name="mob_voidtraveler"; 
    370370    newscript->GetAI = GetAI_mob_voidtraveler; 
    371     m_scripts[nrscripts++] = newscript; 
     371    newscript->RegisterSelf(); 
    372372} 
  • trunk/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/boss_murmur.cpp

    r158 r260  
    149149    newscript->Name="boss_murmur"; 
    150150    newscript->GetAI = GetAI_boss_murmur; 
    151     m_scripts[nrscripts++] = newscript; 
     151    newscript->RegisterSelf(); 
    152152} 
  • trunk/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/instance_shadow_labyrinth.cpp

    r90 r260  
    175175    newscript->Name = "instance_shadow_labyrinth"; 
    176176    newscript->GetInstanceData = GetInstanceData_instance_shadow_labyrinth; 
    177     m_scripts[nrscripts++] = newscript; 
     177    newscript->RegisterSelf(); 
    178178} 
  • trunk/src/bindings/scripts/scripts/zone/azshara/azshara.cpp

    r204 r260  
    493493    newscript->Name="mobs_spitelashes"; 
    494494    newscript->GetAI = GetAI_mobs_spitelashes; 
    495     m_scripts[nrscripts++] = newscript; 
     495    newscript->RegisterSelf(); 
    496496 
    497497    newscript = new Script; 
     
    499499    newscript->pGossipHello =  &GossipHello_npc_loramus_thalipedes; 
    500500    newscript->pGossipSelect = &GossipSelect_npc_loramus_thalipedes; 
    501     m_scripts[nrscripts++] = newscript; 
     501    newscript->RegisterSelf(); 
    502502 
    503503        newscript = new Script; 
     
    506506    newscript->pGossipHello =  &GossipHello_mob_rizzle_sprysprocket; 
    507507    newscript->pGossipSelect = &GossipSelect_mob_rizzle_sprysprocket; 
    508     m_scripts[nrscripts++] = newscript; 
     508    newscript->RegisterSelf(); 
    509509 
    510510    newscript = new Script; 
    511511    newscript->Name="mob_depth_charge"; 
    512512    newscript->GetAI = GetAI_mob_depth_charge; 
    513     m_scripts[nrscripts++] = newscript; 
    514 } 
     513    newscript->RegisterSelf(); 
     514} 
  • trunk/src/bindings/scripts/scripts/zone/azshara/boss_azuregos.cpp

    r90 r260  
    150150    newscript->Name="boss_azuregos"; 
    151151    newscript->GetAI = GetAI_boss_azuregos; 
    152     m_scripts[nrscripts++] = newscript; 
     152    newscript->RegisterSelf(); 
    153153} 
  • trunk/src/bindings/scripts/scripts/zone/azuremyst_isle/azuremyst_isle.cpp

    r90 r260  
    351351    newscript->Name="npc_draenei_survivor"; 
    352352    newscript->GetAI = GetAI_npc_draenei_survivor; 
    353     m_scripts[nrscripts++] = newscript; 
     353    newscript->RegisterSelf(); 
    354354 
    355355    newscript = new Script; 
     
    358358    newscript->pGossipHello =  &GossipHello_npc_engineer_spark_overgrind; 
    359359    newscript->pGossipSelect = &GossipSelect_npc_engineer_spark_overgrind; 
    360     m_scripts[nrscripts++] = newscript; 
     360    newscript->RegisterSelf(); 
    361361 
    362362    newscript = new Script; 
    363363    newscript->Name="npc_injured_draenei"; 
    364364    newscript->GetAI = GetAI_npc_injured_draenei; 
    365     m_scripts[nrscripts++] = newscript; 
     365    newscript->RegisterSelf(); 
    366366 
    367367    newscript = new Script; 
     
    369369    newscript->pGossipHello =  &GossipHello_npc_susurrus; 
    370370    newscript->pGossipSelect = &GossipSelect_npc_susurrus; 
    371     m_scripts[nrscripts++] = newscript; 
    372 } 
     371    newscript->RegisterSelf(); 
     372} 
  • trunk/src/bindings/scripts/scripts/zone/barrens/the_barrens.cpp

    r92 r260  
    370370    newscript->pGossipHello = &GossipHello_npc_beaten_corpse; 
    371371    newscript->pGossipSelect = &GossipSelect_npc_beaten_corpse; 
    372     m_scripts[nrscripts++] = newscript; 
     372    newscript->RegisterSelf(); 
    373373 
    374374    newscript = new Script; 
     
    376376    newscript->pGossipHello = &GossipHello_npc_sputtervalve; 
    377377    newscript->pGossipSelect = &GossipSelect_npc_sputtervalve; 
    378     m_scripts[nrscripts++] = newscript; 
     378    newscript->RegisterSelf(); 
    379379 
    380380    newscript = new Script; 
     
    382382    newscript->GetAI = GetAI_npc_taskmaster_fizzule; 
    383383    newscript->pReceiveEmote = &ReciveEmote_npc_taskmaster_fizzule; 
    384     m_scripts[nrscripts++] = newscript; 
     384    newscript->RegisterSelf(); 
    385385 
    386386    newscript = new Script; 
    387387    newscript->Name="npc_twiggy_flathead"; 
    388388    newscript->GetAI = GetAI_npc_twiggy_flathead; 
    389     m_scripts[nrscripts++] = newscript; 
    390 } 
     389    newscript->RegisterSelf(); 
     390} 
  • trunk/src/bindings/scripts/scripts/zone/black_temple/black_temple.cpp

    r90 r260  
    6565    newscript->pGossipHello = GossipHello_npc_spirit_of_olum; 
    6666    newscript->pGossipSelect = GossipSelect_npc_spirit_of_olum; 
    67     m_scripts[nrscripts++] = newscript; 
     67    newscript->RegisterSelf(); 
    6868} 
  • trunk/src/bindings/scripts/scripts/zone/black_temple/boss_bloodboil.cpp

    r90 r260  
    362362    newscript->Name="boss_gurtogg_bloodboil"; 
    363363    newscript->GetAI = GetAI_boss_gurtogg_bloodboil; 
    364     m_scripts[nrscripts++] = newscript; 
     364    newscript->RegisterSelf(); 
    365365} 
  • trunk/src/bindings/scripts/scripts/zone/black_temple/boss_illidan.cpp

    r239 r260  
    22482248    newscript->Name = "boss_illidan_stormrage"; 
    22492249    newscript->GetAI = GetAI_boss_illidan_stormrage; 
    2250     m_scripts[nrscripts++] = newscript; 
     2250    newscript->RegisterSelf(); 
    22512251 
    22522252    newscript = new Script; 
     
    22552255    newscript->pGossipHello = GossipHello_npc_akama_at_illidan; 
    22562256    newscript->pGossipSelect = GossipSelect_npc_akama_at_illidan; 
    2257     m_scripts[nrscripts++] = newscript; 
     2257    newscript->RegisterSelf(); 
    22582258 
    22592259    newscript = new Script; 
    22602260    newscript->Name = "boss_maiev_shadowsong"; 
    22612261    newscript->GetAI = GetAI_boss_maiev; 
    2262     m_scripts[nrscripts++] = newscript; 
     2262    newscript->RegisterSelf(); 
    22632263 
    22642264    newscript = new Script; 
    22652265    newscript->Name = "mob_flame_of_azzinoth"; 
    22662266    newscript->GetAI = GetAI_mob_flame_of_azzinoth; 
    2267     m_scripts[nrscripts++] = newscript; 
     2267    newscript->RegisterSelf(); 
    22682268 
    22692269    newscript = new Script; 
    22702270    newscript->Name = "mob_blade_of_azzinoth"; 
    22712271    newscript->GetAI = GetAI_blade_of_azzinoth; 
    2272     m_scripts[nrscripts++] = newscript; 
     2272    newscript->RegisterSelf(); 
    22732273 
    22742274    newscript = new Script; 
    22752275    newscript->Name = "gameobject_cage_trap"; 
    22762276    newscript->pGOHello = GOHello_cage_trap; 
    2277     m_scripts[nrscripts++] = newscript; 
     2277    newscript->RegisterSelf(); 
    22782278 
    22792279    newscript = new Script; 
    22802280    newscript->Name="mob_cage_trap_trigger"; 
    22812281    newscript->GetAI = &GetAI_cage_trap_trigger; 
    2282     m_scripts[nrscripts++] = newscript; 
     2282    newscript->RegisterSelf(); 
    22832283 
    22842284    newscript = new Script; 
    22852285    newscript->Name = "mob_shadow_demon"; 
    22862286    newscript->GetAI = GetAI_shadow_demon; 
    2287     m_scripts[nrscripts++] = newscript; 
     2287    newscript->RegisterSelf(); 
    22882288 
    22892289    newscript = new Script; 
    22902290    newscript->Name="mob_demon_fire"; 
    22912291    newscript->GetAI = GetAI_demonfire; 
    2292     m_scripts[nrscripts++] = newscript; 
     2292    newscript->RegisterSelf(); 
    22932293 
    22942294    newscript = new Script; 
    22952295    newscript->Name = "mob_parasitic_shadowfiend"; 
    22962296    newscript->GetAI = GetAI_parasitic_shadowfiend; 
    2297     m_scripts[nrscripts++] = newscript; 
     2297    newscript->RegisterSelf(); 
    22982298} 
  • trunk/src/bindings/scripts/scripts/zone/black_temple/boss_mother_shahraz.cpp

    r90 r260  
    358358    newscript->Name="boss_mother_shahraz"; 
    359359    newscript->GetAI = GetAI_boss_shahraz; 
    360     m_scripts[nrscripts++] = newscript; 
     360    newscript->RegisterSelf(); 
    361361} 
  • trunk/src/bindings/scripts/scripts/zone/black_temple/boss_reliquary_of_souls.cpp

    r229 r260  
    724724    newscript->Name="boss_reliquary_of_souls"; 
    725725    newscript->GetAI = GetAI_boss_reliquary_of_souls; 
    726     m_scripts[nrscripts++] = newscript; 
     726    newscript->RegisterSelf(); 
    727727 
    728728    newscript = new Script; 
    729729    newscript->Name="boss_essence_of_suffering"; 
    730730    newscript->GetAI = GetAI_boss_essence_of_suffering; 
    731     m_scripts[nrscripts++] = newscript; 
     731    newscript->RegisterSelf(); 
    732732 
    733733    newscript = new Script; 
    734734    newscript->Name="boss_essence_of_desire"; 
    735735    newscript->GetAI = GetAI_boss_essence_of_desire; 
    736     m_scripts[nrscripts++] = newscript; 
     736    newscript->RegisterSelf(); 
    737737 
    738738    newscript = new Script; 
    739739    newscript->Name="boss_essence_of_anger"; 
    740740    newscript->GetAI = GetAI_boss_essence_of_anger; 
    741     m_scripts[nrscripts++] = newscript; 
     741    newscript->RegisterSelf(); 
    742742 
    743743    newscript = new Script; 
    744744    newscript->Name="npc_enslaved_soul"; 
    745745    newscript->GetAI = GetAI_npc_enslaved_soul; 
    746     m_scripts[nrscripts++] = newscript; 
     746    newscript->RegisterSelf(); 
    747747} 
  • trunk/src/bindings/scripts/scripts/zone/black_temple/boss_shade_of_akama.cpp

    r222 r260  
    797797    newscript->Name="boss_shade_of_akama"; 
    798798    newscript->GetAI = GetAI_boss_shade_of_akama; 
    799     m_scripts[nrscripts++] = newscript; 
     799    newscript->RegisterSelf(); 
    800800 
    801801    newscript = new Script; 
    802802    newscript->Name="mob_ashtongue_channeler"; 
    803803    newscript->GetAI = GetAI_mob_ashtongue_channeler; 
    804     m_scripts[nrscripts++] = newscript; 
     804    newscript->RegisterSelf(); 
    805805 
    806806    newscript = new Script; 
    807807    newscript->Name="mob_ashtongue_sorcerer"; 
    808808    newscript->GetAI = GetAI_mob_ashtongue_sorcerer; 
    809     m_scripts[nrscripts++] = newscript; 
     809    newscript->RegisterSelf(); 
    810810 
    811811    newscript = new Script; 
     
    814814    newscript->pGossipHello = &GossipHello_npc_akama; 
    815815    newscript->pGossipSelect = &GossipSelect_npc_akama; 
    816     m_scripts[nrscripts++] = newscript; 
     816    newscript->RegisterSelf(); 
    817817} 
  • trunk/src/bindings/scripts/scripts/zone/black_temple/boss_supremus.cpp

    r203 r260  
    237237    newscript->Name="boss_supremus"; 
    238238    newscript->GetAI = GetAI_boss_supremus; 
    239     m_scripts[nrscripts++] = newscript; 
     239    newscript->RegisterSelf(); 
    240240 
    241241    newscript = new Script; 
    242242    newscript->Name="molten_flame"; 
    243243    newscript->GetAI = GetAI_molten_flame; 
    244     m_scripts[nrscripts++] = newscript; 
     244    newscript->RegisterSelf(); 
    245245} 
  • trunk/src/bindings/scripts/scripts/zone/black_temple/boss_teron_gorefiend.cpp

    r229 r260  
    576576    newscript->Name = "mob_doom_blossom"; 
    577577    newscript->GetAI = GetAI_mob_doom_blossom; 
    578     m_scripts[nrscripts++] = newscript; 
     578    newscript->RegisterSelf(); 
    579579 
    580580    newscript = new Script; 
    581581    newscript->Name = "mob_shadowy_construct"; 
    582582    newscript->GetAI = GetAI_mob_shadowy_construct; 
    583     m_scripts[nrscripts++] = newscript; 
     583    newscript->RegisterSelf(); 
    584584 
    585585    newscript = new Script; 
    586586    newscript->Name="boss_teron_gorefiend"; 
    587587    newscript->GetAI = GetAI_boss_teron_gorefiend; 
    588     m_scripts[nrscripts++] = newscript; 
     588    newscript->RegisterSelf(); 
    589589} 
  • trunk/src/bindings/scripts/scripts/zone/black_temple/boss_warlord_najentus.cpp

    r160 r260  
    259259    newscript->Name="boss_najentus"; 
    260260    newscript->GetAI = GetAI_boss_najentus; 
    261     m_scripts[nrscripts++] = newscript; 
     261    newscript->RegisterSelf(); 
    262262 
    263263    newscript = new Script; 
    264264    newscript->Name = "go_najentus_spine"; 
    265265    newscript->pGOHello = &GOHello_go_najentus_spine; 
    266     m_scripts[nrscripts++] = newscript; 
     266    newscript->RegisterSelf(); 
    267267} 
  • trunk/src/bindings/scripts/scripts/zone/black_temple/illidari_council.cpp

    r108 r260  
    856856    newscript->Name="mob_illidari_council"; 
    857857    newscript->GetAI = GetAI_mob_illidari_council; 
    858     m_scripts[nrscripts++] = newscript; 
     858    newscript->RegisterSelf(); 
    859859 
    860860    newscript = new Script; 
    861861    newscript->Name = "mob_blood_elf_council_voice_trigger"; 
    862862    newscript->GetAI = GetAI_mob_blood_elf_council_voice_trigger; 
    863     m_scripts[nrscripts++] = newscript; 
     863    newscript->RegisterSelf(); 
    864864 
    865865    newscript = new Script; 
    866866    newscript->Name="boss_gathios_the_shatterer"; 
    867867    newscript->GetAI = GetAI_boss_gathios_the_shatterer; 
    868     m_scripts[nrscripts++] = newscript; 
     868    newscript->RegisterSelf(); 
    869869 
    870870    newscript = new Script; 
    871871    newscript->Name="boss_lady_malande"; 
    872872    newscript->GetAI = GetAI_boss_lady_malande; 
    873     m_scripts[nrscripts++] = newscript; 
     873    newscript->RegisterSelf(); 
    874874 
    875875    newscript = new Script; 
    876876    newscript->Name="boss_veras_darkshadow"; 
    877877    newscript->GetAI = GetAI_boss_veras_darkshadow; 
    878     m_scripts[nrscripts++] = newscript; 
     878    newscript->RegisterSelf(); 
    879879 
    880880    newscript = new Script; 
    881881    newscript->Name="boss_high_nethermancer_zerevor"; 
    882882    newscript->GetAI = GetAI_boss_high_nethermancer_zerevor; 
    883     m_scripts[nrscripts++] = newscript; 
     883    newscript->RegisterSelf(); 
    884884} 
  • trunk/src/bindings/scripts/scripts/zone/black_temple/instance_black_temple.cpp

    r178 r260  
    333333    newscript->Name = "instance_black_temple"; 
    334334    newscript->GetInstanceData = GetInstanceData_instance_black_temple; 
    335     m_scripts[nrscripts++] = newscript; 
     335    newscript->RegisterSelf(); 
    336336} 
  • trunk/src/bindings/scripts/scripts/zone/blackrock_depths/blackrock_depths.cpp

    r90 r260  
    222222    newscript->Name="phalanx"; 
    223223    newscript->GetAI = GetAI_mob_phalanx; 
    224     m_scripts[nrscripts++] = newscript; 
     224    newscript->RegisterSelf(); 
    225225 
    226226    newscript = new Script; 
     
    228228    newscript->pGossipHello =  &GossipHello_npc_kharan_mighthammer; 
    229229    newscript->pGossipSelect = &GossipSelect_npc_kharan_mighthammer; 
    230     m_scripts[nrscripts++] = newscript; 
     230    newscript->RegisterSelf(); 
    231231 
    232232    newscript = new Script; 
     
    234234    newscript->pGossipHello =  &GossipHello_npc_lokhtos_darkbargainer; 
    235235    newscript->pGossipSelect = &GossipSelect_npc_lokhtos_darkbargainer; 
    236     m_scripts[nrscripts++] = newscript; 
    237 } 
     236    newscript->RegisterSelf(); 
     237} 
  • trunk/src/bindings/scripts/scripts/zone/blackrock_depths/boss_ambassador_flamelash.cpp

    r90 r260  
    103103    newscript->Name="boss_ambassador_flamelash"; 
    104104    newscript->GetAI = GetAI_boss_ambassador_flamelash; 
    105     m_scripts[nrscripts++] = newscript; 
     105    newscript->RegisterSelf(); 
    106106} 
  • trunk/src/bindings/scripts/scripts/zone/blackrock_depths/boss_angerrel.cpp

    r90 r260  
    8888    newscript->Name="boss_angerrel"; 
    8989    newscript->GetAI = GetAI_boss_angerrel; 
    90     m_scripts[nrscripts++] = newscript; 
     90    newscript->RegisterSelf(); 
    9191} 
  • trunk/src/bindings/scripts/scripts/zone/blackrock_depths/boss_anubshiah.cpp

    r90 r260  
    112112    newscript->Name="boss_anubshiah"; 
    113113    newscript->GetAI = GetAI_boss_anubshiah; 
    114     m_scripts[nrscripts++] = newscript; 
     114    newscript->RegisterSelf(); 
    115115} 
  • trunk/src/bindings/scripts/scripts/zone/blackrock_depths/boss_doomrel.cpp

    r90 r260  
    136136    newscript->Name="boss_doomrel"; 
    137137    newscript->GetAI = GetAI_boss_doomrel; 
    138     m_scripts[nrscripts++] = newscript; 
     138    newscript->RegisterSelf(); 
    139139} 
  • trunk/src/bindings/scripts/scripts/zone/blackrock_depths/boss_doperel.cpp

    r90 r260  
    8888    newscript->Name="boss_doperel"; 
    8989    newscript->GetAI = GetAI_boss_doperel; 
    90     m_scripts[nrscripts++] = newscript; 
     90    newscript->RegisterSelf(); 
    9191} 
  • trunk/src/bindings/scripts/scripts/zone/blackrock_depths/boss_emperor_dagran_thaurissan.cpp

    r90 r260  
    101101    newscript->Name="boss_emperor_dagran_thaurissan"; 
    102102    newscript->GetAI = GetAI_boss_draganthaurissan; 
    103     m_scripts[nrscripts++] = newscript; 
     103    newscript->RegisterSelf(); 
    104104} 
  • trunk/src/bindings/scripts/scripts/zone/blackrock_depths/boss_general_angerforge.cpp

    r90 r260  
    164164    newscript->Name="boss_general_angerforge"; 
    165165    newscript->GetAI = GetAI_boss_general_angerforge; 
    166     m_scripts[nrscripts++] = newscript; 
     166    newscript->RegisterSelf(); 
    167167} 
  • trunk/src/bindings/scripts/scripts/zone/blackrock_depths/boss_gloomrel.cpp

    r90 r260  
    139139    newscript->pGossipHello = &GossipHello_boss_gloomrel; 
    140140    newscript->pGossipSelect = &GossipSelect_boss_gloomrel; 
    141     m_scripts[nrscripts++] = newscript; 
     141    newscript->RegisterSelf(); 
    142142} 
  • trunk/src/bindings/scripts/scripts/zone/blackrock_depths/boss_gorosh_the_dervish.cpp

    r90 r260  
    7878    newscript->Name="boss_gorosh_the_dervish"; 
    7979    newscript->GetAI = GetAI_boss_gorosh_the_dervish; 
    80     m_scripts[nrscripts++] = newscript; 
     80    newscript->RegisterSelf(); 
    8181} 
  • trunk/src/bindings/scripts/scripts/zone/blackrock_depths/boss_grizzle.cpp

    r90 r260  
    8383    newscript->Name="boss_grizzle"; 
    8484    newscript->GetAI = GetAI_boss_grizzle; 
    85     m_scripts[nrscripts++] = newscript; 
     85    newscript->RegisterSelf(); 
    8686} 
  • trunk/src/bindings/scripts/scripts/zone/blackrock_depths/boss_haterel.cpp

    r90 r260  
    102102    newscript->Name="boss_haterel"; 
    103103    newscript->GetAI = GetAI_boss_haterel; 
    104     m_scripts[nrscripts++] = newscript; 
     104    newscript->RegisterSelf(); 
    105105} 
  • trunk/src/bindings/scripts/scripts/zone/blackrock_depths/boss_high_interrogator_gerstahn.cpp

    r90 r260  
    102102    newscript->Name="boss_high_interrogator_gerstahn"; 
    103103    newscript->GetAI = GetAI_boss_high_interrogator_gerstahn; 
    104     m_scripts[nrscripts++] = newscript; 
     104    newscript->RegisterSelf(); 
    105105} 
  • trunk/src/bindings/scripts/scripts/zone/blackrock_depths/boss_magmus.cpp

    r90 r260  
    8181    newscript->Name="boss_magmus"; 
    8282    newscript->GetAI = GetAI_boss_magmus; 
    83     m_scripts[nrscripts++] = newscript; 
     83    newscript->RegisterSelf(); 
    8484} 
  • trunk/src/bindings/scripts/scripts/zone/blackrock_depths/boss_moira_bronzebeard.cpp

    r90 r260  
    9696    newscript->Name="boss_moira_bronzebeard"; 
    9797    newscript->GetAI = GetAI_boss_moira_bronzebeard; 
    98     m_scripts[nrscripts++] = newscript; 
     98    newscript->RegisterSelf(); 
    9999} 
  • trunk/src/bindings/scripts/scripts/zone/blackrock_depths/boss_seethrel.cpp

    r90 r260  
    112112    newscript->Name="boss_seethrel"; 
    113113    newscript->GetAI = GetAI_boss_seethrel; 
    114     m_scripts[nrscripts++] = newscript; 
     114    newscript->RegisterSelf(); 
    115115} 
  • trunk/src/bindings/scripts/scripts/zone/blackrock_depths/boss_vilerel.cpp

    r90 r260  
    9898    newscript->Name="boss_vilerel"; 
    9999    newscript->GetAI = GetAI_boss_vilerel; 
    100     m_scripts[nrscripts++] = newscript; 
     100    newscript->RegisterSelf(); 
    101101} 
  • trunk/src/bindings/scripts/scripts/zone/blackrock_spire/boss_drakkisath.cpp

    r90 r260  
    9898    newscript->Name="boss_drakkisath"; 
    9999    newscript->GetAI = GetAI_boss_drakkisath; 
    100     m_scripts[nrscripts++] = newscript; 
     100    newscript->RegisterSelf(); 
    101101} 
  • trunk/src/bindings/scripts/scripts/zone/blackrock_spire/boss_gyth.cpp

    r90 r260  
    202202    newscript->Name="boss_gyth"; 
    203203    newscript->GetAI = GetAI_boss_gyth; 
    204     m_scripts[nrscripts++] = newscript; 
     204    newscript->RegisterSelf(); 
    205205} 
  • trunk/src/bindings/scripts/scripts/zone/blackrock_spire/boss_halycon.cpp

    r90 r260  
    9292    newscript->Name="boss_halycon"; 
    9393    newscript->GetAI = GetAI_boss_halycon; 
    94     m_scripts[nrscripts++] = newscript; 
     94    newscript->RegisterSelf(); 
    9595} 
  • trunk/src/bindings/scripts/scripts/zone/blackrock_spire/boss_highlord_omokk.cpp

    r90 r260  
    128128    newscript->Name="boss_highlord_omokk"; 
    129129    newscript->GetAI = GetAI_boss_highlordomokk; 
    130     m_scripts[nrscripts++] = newscript; 
     130    newscript->RegisterSelf(); 
    131131} 
  • trunk/src/bindings/scripts/scripts/zone/blackrock_spire/boss_mother_smolderweb.cpp

    r90 r260  
    8383    newscript->Name="boss_mother_smolderweb"; 
    8484    newscript->GetAI = GetAI_boss_mothersmolderweb; 
    85     m_scripts[nrscripts++] = newscript; 
     85    newscript->RegisterSelf(); 
    8686} 
  • trunk/src/bindings/scripts/scripts/zone/blackrock_spire/boss_overlord_wyrmthalak.cpp

    r90 r260  
    124124    newscript->Name="boss_overlord_wyrmthalak"; 
    125125    newscript->GetAI = GetAI_boss_overlordwyrmthalak; 
    126     m_scripts[nrscripts++] = newscript; 
     126    newscript->RegisterSelf(); 
    127127} 
  • trunk/src/bindings/scripts/scripts/zone/blackrock_spire/boss_pyroguard_emberseer.cpp

    r90 r260  
    9090    newscript->Name="boss_pyroguard_emberseer"; 
    9191    newscript->GetAI = GetAI_boss_pyroguard_emberseer; 
    92     m_scripts[nrscripts++] = newscript; 
     92    newscript->RegisterSelf(); 
    9393} 
  • trunk/src/bindings/scripts/scripts/zone/blackrock_spire/boss_quartermaster_zigris.cpp

    r90 r260  
    8282    newscript->Name="quartermaster_zigris"; 
    8383    newscript->GetAI = GetAI_boss_quatermasterzigris; 
    84     m_scripts[nrscripts++] = newscript; 
     84    newscript->RegisterSelf(); 
    8585} 
  • trunk/src/bindings/scripts/scripts/zone/blackrock_spire/boss_rend_blackhand.cpp

    r90 r260  
    8888    newscript->Name="boss_rend_blackhand"; 
    8989    newscript->GetAI = GetAI_boss_rend_blackhand; 
    90     m_scripts[nrscripts++] = newscript; 
     90    newscript->RegisterSelf(); 
    9191} 
  • trunk/src/bindings/scripts/scripts/zone/blackrock_spire/boss_shadow_hunter_voshgajin.cpp

    r90 r260  
    9292    newscript->Name="boss_shadow_hunter_voshgajin"; 
    9393    newscript->GetAI = GetAI_boss_shadowvosh; 
    94     m_scripts[nrscripts++] = newscript; 
     94    newscript->RegisterSelf(); 
    9595} 
  • trunk/src/bindings/scripts/scripts/zone/blackrock_spire/boss_the_beast.cpp

    r90 r260  
    9090    newscript->Name="boss_the_beast"; 
    9191    newscript->GetAI = GetAI_boss_thebeast; 
    92     m_scripts[nrscripts++] = newscript; 
     92    newscript->RegisterSelf(); 
    9393} 
  • trunk/src/bindings/scripts/scripts/zone/blackrock_spire/boss_warmaster_voone.cpp

    r90 r260  
    118118    newscript->Name="boss_warmaster_voone"; 
    119119    newscript->GetAI = GetAI_boss_warmastervoone; 
    120     m_scripts[nrscripts++] = newscript; 
     120    newscript->RegisterSelf(); 
    121121} 
  • trunk/src/bindings/scripts/scripts/zone/blackwing_lair/boss_broodlord_lashlayer.cpp

    r125 r260  
    125125    newscript->Name="boss_broodlord"; 
    126126    newscript->GetAI = GetAI_boss_broodlord; 
    127     m_scripts[nrscripts++] = newscript; 
     127    newscript->RegisterSelf(); 
    128128} 
  • trunk/src/bindings/scripts/scripts/zone/blackwing_lair/boss_chromaggus.cpp

    r125 r260  
    311311    newscript->Name="boss_chromaggus"; 
    312312    newscript->GetAI = GetAI_boss_chromaggus; 
    313     m_scripts[nrscripts++] = newscript; 
     313    newscript->RegisterSelf(); 
    314314} 
  • trunk/src/bindings/scripts/scripts/zone/blackwing_lair/boss_ebonroc.cpp

    r90 r260  
    100100    newscript->Name="boss_ebonroc"; 
    101101    newscript->GetAI = GetAI_boss_ebonroc; 
    102     m_scripts[nrscripts++] = newscript; 
     102    newscript->RegisterSelf(); 
    103103} 
  • trunk/src/bindings/scripts/scripts/zone/blackwing_lair/boss_firemaw.cpp

    r90 r260  
    9191    newscript->Name="boss_firemaw"; 
    9292    newscript->GetAI = GetAI_boss_firemaw; 
    93     m_scripts[nrscripts++] = newscript; 
     93    newscript->RegisterSelf(); 
    9494} 
  • trunk/src/bindings/scripts/scripts/zone/blackwing_lair/boss_flamegor.cpp

    r90 r260  
    9191    newscript->Name="boss_flamegor"; 
    9292    newscript->GetAI = GetAI_boss_flamegor; 
    93     m_scripts[nrscripts++] = newscript; 
     93    newscript->RegisterSelf(); 
    9494} 
  • trunk/src/bindings/scripts/scripts/zone/blackwing_lair/boss_nefarian.cpp

    r125 r260  
    224224    newscript->Name="boss_nefarian"; 
    225225    newscript->GetAI = GetAI_boss_nefarian; 
    226     m_scripts[nrscripts++] = newscript; 
     226    newscript->RegisterSelf(); 
    227227} 
  • trunk/src/bindings/scripts/scripts/zone/blackwing_lair/boss_razorgore.cpp

    r125 r260  
    128128    newscript->Name="boss_razorgore"; 
    129129    newscript->GetAI = GetAI_boss_razorgore; 
    130     m_scripts[nrscripts++] = newscript; 
     130    newscript->RegisterSelf(); 
    131131} 
  • trunk/src/bindings/scripts/scripts/zone/blackwing_lair/boss_vaelastrasz.cpp

    r125 r260  
    258258    newscript->pGossipHello = &GossipHello_boss_vael; 
    259259    newscript->pGossipSelect = &GossipSelect_boss_vael; 
    260     m_scripts[nrscripts++] = newscript; 
    261 } 
     260    newscript->RegisterSelf(); 
     261} 
  • trunk/src/bindings/scripts/scripts/zone/blackwing_lair/boss_victor_nefarius.cpp

    r125 r260  
    391391    newscript->pGossipHello = &GossipHello_boss_victor_nefarius; 
    392392    newscript->pGossipSelect = &GossipSelect_boss_victor_nefarius; 
    393     m_scripts[nrscripts++] = newscript; 
     393    newscript->RegisterSelf(); 
    394394} 
  • trunk/src/bindings/scripts/scripts/zone/blades_edge_mountains/blades_edge_mountains.cpp

    r229 r260  
    407407    newscript->Name="mobs_bladespire_ogre"; 
    408408    newscript->GetAI = GetAI_mobs_bladespire_ogre; 
    409     m_scripts[nrscripts++] = newscript; 
     409    newscript->RegisterSelf(); 
    410410 
    411411    newscript = new Script; 
    412412    newscript->Name="mobs_nether_drake"; 
    413413    newscript->GetAI = GetAI_mobs_nether_drake; 
    414     m_scripts[nrscripts++] = newscript; 
     414    newscript->RegisterSelf(); 
    415415 
    416416    newscript = new Script; 
    417417    newscript->Name="npc_daranelle"; 
    418418    newscript->GetAI = GetAI_npc_daranelle; 
    419     m_scripts[nrscripts++] = newscript; 
     419    newscript->RegisterSelf(); 
    420420 
    421421    newscript = new Script; 
     
    423423    newscript->pGossipHello = &GossipHello_npc_overseer_nuaar; 
    424424    newscript->pGossipSelect = &GossipSelect_npc_overseer_nuaar; 
    425     m_scripts[nrscripts++] = newscript; 
     425    newscript->RegisterSelf(); 
    426426 
    427427    newscript = new Script; 
     
    429429    newscript->pGossipHello = &GossipHello_npc_saikkal_the_elder; 
    430430    newscript->pGossipSelect = &GossipSelect_npc_saikkal_the_elder; 
    431     m_scripts[nrscripts++] = newscript; 
     431    newscript->RegisterSelf(); 
    432432 
    433433    newscript = new Script; 
     
    435435    newscript->pGossipHello =  &GossipHello_npc_skyguard_handler_irena; 
    436436    newscript->pGossipSelect = &GossipSelect_npc_skyguard_handler_irena; 
    437     m_scripts[nrscripts++] = newscript; 
    438 } 
     437    newscript->RegisterSelf(); 
     438} 
  • trunk/src/bindings/scripts/scripts/zone/blasted_lands/blasted_lands.cpp

    r90 r260  
    150150    newscript->pGossipHello =  &GossipHello_npc_deathly_usher; 
    151151    newscript->pGossipSelect = &GossipSelect_npc_deathly_usher; 
    152     m_scripts[nrscripts++] = newscript; 
     152    newscript->RegisterSelf(); 
    153153 
    154154    newscript = new Script; 
     
    156156    newscript->pGossipHello =  &GossipHello_npc_fallen_hero_of_horde; 
    157157    newscript->pGossipSelect = &GossipSelect_npc_fallen_hero_of_horde; 
    158     m_scripts[nrscripts++] = newscript; 
     158    newscript->RegisterSelf(); 
    159159} 
  • trunk/src/bindings/scripts/scripts/zone/blasted_lands/boss_kruul.cpp

    r90 r260  
    179179    newscript->Name="boss_kruul"; 
    180180    newscript->GetAI = GetAI_boss_kruul; 
    181     m_scripts[nrscripts++] = newscript; 
     181    newscript->RegisterSelf(); 
    182182} 
  • trunk/src/bindings/scripts/scripts/zone/bloodmyst_isle/bloodmyst_isle.cpp

    r90 r260  
    132132    newscript->Name="mob_webbed_creature"; 
    133133    newscript->GetAI = GetAI_mob_webbed_creature; 
    134     m_scripts[nrscripts++] = newscript; 
     134    newscript->RegisterSelf(); 
    135135 
    136136    newscript = new Script; 
     
    138138    newscript->pGossipHello =  &GossipHello_npc_captured_sunhawk_agent; 
    139139    newscript->pGossipSelect = &GossipSelect_npc_captured_sunhawk_agent; 
    140     m_scripts[nrscripts++] = newscript; 
     140    newscript->RegisterSelf(); 
    141141} 
  • trunk/src/bindings/scripts/scripts/zone/burning_steppes/burning_steppes.cpp

    r229 r260  
    148148    newscript->pGossipHello =  &GossipHello_npc_ragged_john; 
    149149    newscript->pGossipSelect = &GossipSelect_npc_ragged_john; 
    150     m_scripts[nrscripts++] = newscript; 
     150    newscript->RegisterSelf(); 
    151151} 
  • trunk/src/bindings/scripts/scripts/zone/caverns_of_time/dark_portal/boss_aeonus.cpp

    r125 r260  
    118118    newscript->Name="boss_aeonus"; 
    119119    newscript->GetAI = GetAI_boss_aeonus; 
    120     m_scripts[nrscripts++] = newscript; 
     120    newscript->RegisterSelf(); 
    121121} 
  • trunk/src/bindings/scripts/scripts/zone/caverns_of_time/dark_portal/boss_chrono_lord_deja.cpp

    r125 r260  
    106106    newscript->Name="boss_chrono_lord_deja"; 
    107107    newscript->GetAI = GetAI_boss_chrono_lord_deja; 
    108     m_scripts[nrscripts++] = newscript; 
     108    newscript->RegisterSelf(); 
    109109} 
  • trunk/src/bindings/scripts/scripts/zone/caverns_of_time/dark_portal/boss_temporus.cpp

    r229 r260  
    140140    newscript->Name="boss_temporus"; 
    141141    newscript->GetAI = GetAI_boss_temporus; 
    142     m_scripts[nrscripts++] = newscript; 
     142    newscript->RegisterSelf(); 
    143143} 
  • trunk/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_archimonde.cpp

    r90 r260  
    770770    newscript->Name="boss_archimonde"; 
    771771    newscript->GetAI = GetAI_boss_archimonde; 
    772     m_scripts[nrscripts++] = newscript; 
     772    newscript->RegisterSelf(); 
    773773 
    774774    newscript = new Script; 
    775775    newscript->Name = "mob_doomfire"; 
    776776    newscript->GetAI = GetAI_mob_doomfire; 
    777     m_scripts[nrscripts++] = newscript; 
     777    newscript->RegisterSelf(); 
    778778 
    779779    newscript = new Script; 
    780780    newscript->Name = "mob_doomfire_targetting"; 
    781781    newscript->GetAI = GetAI_mob_doomfire_targetting; 
    782     m_scripts[nrscripts++] = newscript; 
     782    newscript->RegisterSelf(); 
    783783 
    784784    newscript = new Script; 
    785785    newscript->Name = "mob_ancient_wisp"; 
    786786    newscript->GetAI = GetAI_mob_ancient_wisp; 
    787     m_scripts[nrscripts++] = newscript; 
     787    newscript->RegisterSelf(); 
    788788} 
  • trunk/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjal.cpp

    r90 r260  
    201201    newscript->pGossipHello = &GossipHello_npc_jaina_proudmoore; 
    202202    newscript->pGossipSelect = &GossipSelect_npc_jaina_proudmoore; 
    203     m_scripts[nrscripts++] = newscript; 
     203    newscript->RegisterSelf(); 
    204204 
    205205    newscript = new Script; 
     
    208208    newscript->pGossipHello = &GossipHello_npc_thrall; 
    209209    newscript->pGossipSelect = &GossipSelect_npc_thrall; 
    210     m_scripts[nrscripts++] = newscript; 
     210    newscript->RegisterSelf(); 
    211211 
    212212    newscript = new Script; 
     
    214214    newscript->pGossipHello = &GossipHello_npc_tyrande_whisperwind; 
    215215    newscript->pGossipSelect = &GossipSelect_npc_tyrande_whisperwind; 
    216     m_scripts[nrscripts++] = newscript; 
    217 } 
     216    newscript->RegisterSelf(); 
     217} 
  • trunk/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/instance_hyjal.cpp

    r90 r260  
    200200    newscript->Name = "instance_hyjal"; 
    201201    newscript->GetInstanceData = GetInstanceData_instance_mount_hyjal; 
    202     m_scripts[nrscripts++] = newscript; 
     202    newscript->RegisterSelf(); 
    203203} 
  • trunk/src/bindings/scripts/scripts/zone/caverns_of_time/old_hillsbrad/boss_captain_skarloc.cpp

    r125 r260  
    153153    newscript->Name="boss_captain_skarloc"; 
    154154    newscript->GetAI = GetAI_boss_captain_skarloc; 
    155     m_scripts[nrscripts++] = newscript; 
     155    newscript->RegisterSelf(); 
    156156} 
  • trunk/src/bindings/scripts/scripts/zone/caverns_of_time/old_hillsbrad/boss_epoch_hunter.cpp

    r125 r260  
    147147    newscript->Name="boss_epoch_hunter"; 
    148148    newscript->GetAI = GetAI_boss_epoch_hunter; 
    149     m_scripts[nrscripts++] = newscript; 
     149    newscript->RegisterSelf(); 
    150150} 
  • trunk/src/bindings/scripts/scripts/zone/caverns_of_time/old_hillsbrad/boss_leutenant_drake.cpp

    r239 r260  
    195195    newscript->Name="go_barrel_old_hillsbrad"; 
    196196    newscript->pGOHello = &GOHello_go_barrel_old_hillsbrad; 
    197     m_scripts[nrscripts++] = newscript; 
     197    newscript->RegisterSelf(); 
    198198 
    199199    newscript = new Script; 
    200200    newscript->Name="boss_lieutenant_drake"; 
    201201    newscript->GetAI = GetAI_boss_lieutenant_drake; 
    202     m_scripts[nrscripts++] = newscript; 
     202    newscript->RegisterSelf(); 
    203203} 
  • trunk/src/bindings/scripts/scripts/zone/caverns_of_time/old_hillsbrad/instance_old_hillsbrad.cpp

    r90 r260  
    175175    newscript->Name = "instance_old_hillsbrad"; 
    176176    newscript->GetInstanceData = GetInstanceData_instance_old_hillsbrad; 
    177     m_scripts[nrscripts++] = newscript; 
     177    newscript->RegisterSelf(); 
    178178} 
  • trunk/src/bindings/scripts/scripts/zone/caverns_of_time/old_hillsbrad/old_hillsbrad.cpp

    r90 r260  
    894894    newscript->pGossipHello =   &GossipHello_npc_brazen; 
    895895    newscript->pGossipSelect =  &GossipSelect_npc_brazen; 
    896     m_scripts[nrscripts++] = newscript; 
     896    newscript->RegisterSelf(); 
    897897 
    898898    newscript = new Script; 
     
    900900    newscript->pGossipHello =   &GossipHello_npc_erozion; 
    901901    newscript->pGossipSelect =  &GossipSelect_npc_erozion; 
    902     m_scripts[nrscripts++] = newscript; 
     902    newscript->RegisterSelf(); 
    903903 
    904904    newscript = new Script; 
     
    907907    newscript->pGossipSelect = &GossipSelect_npc_thrall_old_hillsbrad; 
    908908    newscript->GetAI = GetAI_npc_thrall_old_hillsbrad; 
    909     m_scripts[nrscripts++] = newscript; 
     909    newscript->RegisterSelf(); 
    910910 
    911911    newscript = new Script; 
     
    913913    newscript->pGossipHello =   &GossipHello_npc_taretha; 
    914914    newscript->pGossipSelect =  &GossipSelect_npc_taretha; 
    915     m_scripts[nrscripts++] = newscript; 
    916 } 
     915    newscript->RegisterSelf(); 
     916} 
  • trunk/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_fathomlord_karathress.cpp

    r164 r260  
    745745    newscript->Name="boss_fathomlord_karathress"; 
    746746    newscript->GetAI = GetAI_boss_fathomlord_karathress; 
    747     m_scripts[nrscripts++] = newscript; 
     747    newscript->RegisterSelf(); 
    748748 
    749749    newscript = new Script; 
    750750    newscript->Name="boss_fathomguard_sharkkis"; 
    751751    newscript->GetAI = GetAI_boss_fathomguard_sharkkis; 
    752     m_scripts[nrscripts++] = newscript; 
     752    newscript->RegisterSelf(); 
    753753 
    754754    newscript = new Script; 
    755755    newscript->Name="boss_fathomguard_tidalvess"; 
    756756    newscript->GetAI = GetAI_boss_fathomguard_tidalvess; 
    757     m_scripts[nrscripts++] = newscript; 
     757    newscript->RegisterSelf(); 
    758758 
    759759    newscript = new Script; 
    760760    newscript->Name="boss_fathomguard_caribdis"; 
    761761    newscript->GetAI = GetAI_boss_fathomguard_caribdis; 
    762     m_scripts[nrscripts++] = newscript; 
     762    newscript->RegisterSelf(); 
    763763} 
  • trunk/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_hydross_the_unstable.cpp

    r182 r260  
    383383    newscript->Name="boss_hydross_the_unstable"; 
    384384    newscript->GetAI = GetAI_boss_hydross_the_unstable; 
    385     m_scripts[nrscripts++] = newscript; 
     385    newscript->RegisterSelf(); 
    386386} 
  • trunk/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_lady_vashj.cpp

    r257 r260  
    10301030    newscript->Name="boss_lady_vashj"; 
    10311031    newscript->GetAI = GetAI_boss_lady_vashj; 
    1032     m_scripts[nrscripts++] = newscript; 
     1032    newscript->RegisterSelf(); 
    10331033 
    10341034    newscript = new Script; 
    10351035    newscript->Name="mob_enchanted_elemental"; 
    10361036    newscript->GetAI = GetAI_mob_enchanted_elemental; 
    1037     m_scripts[nrscripts++] = newscript; 
     1037    newscript->RegisterSelf(); 
    10381038 
    10391039    newscript = new Script; 
    10401040    newscript->Name="mob_tainted_elemental"; 
    10411041    newscript->GetAI = GetAI_mob_tainted_elemental; 
    1042     m_scripts[nrscripts++] = newscript; 
     1042    newscript->RegisterSelf(); 
    10431043 
    10441044    newscript = new Script; 
    10451045    newscript->Name="mob_toxic_sporebat"; 
    10461046    newscript->GetAI = GetAI_mob_toxic_sporebat; 
    1047     m_scripts[nrscripts++] = newscript; 
     1047    newscript->RegisterSelf(); 
    10481048 
    10491049    newscript = new Script; 
    10501050    newscript->Name="mob_coilfang_elite"; 
    10511051    newscript->GetAI = GetAI_mob_coilfang_elite; 
    1052     m_scripts[nrscripts++] = newscript; 
     1052    newscript->RegisterSelf(); 
    10531053 
    10541054    newscript = new Script; 
    10551055    newscript->Name="mob_coilfang_strider"; 
    10561056    newscript->GetAI = GetAI_mob_coilfang_strider; 
    1057     m_scripts[nrscripts++] = newscript; 
     1057    newscript->RegisterSelf(); 
    10581058 
    10591059    newscript = new Script; 
    10601060    newscript->Name="mob_shield_generator_channel"; 
    10611061    newscript->GetAI = GetAI_mob_shield_generator_channel; 
    1062     m_scripts[nrscripts++] = newscript; 
     1062    newscript->RegisterSelf(); 
    10631063 
    10641064    newscript = new Script; 
    10651065    newscript->Name="item_tainted_core"; 
    10661066    newscript->pItemUse = ItemUse_item_tainted_core; 
    1067     m_scripts[nrscripts++] = newscript; 
     1067    newscript->RegisterSelf(); 
    10681068} 
    10691069 
  • trunk/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_leotheras_the_blind.cpp

    r257 r260  
    805805    newscript->Name="boss_leotheras_the_blind"; 
    806806    newscript->GetAI = GetAI_boss_leotheras_the_blind; 
    807     m_scripts[nrscripts++] = newscript; 
     807    newscript->RegisterSelf(); 
    808808 
    809809    newscript = new Script; 
    810810    newscript->Name="boss_leotheras_the_blind_demonform"; 
    811811    newscript->GetAI = GetAI_boss_leotheras_the_blind_demonform; 
    812     m_scripts[nrscripts++] = newscript; 
     812    newscript->RegisterSelf(); 
    813813 
    814814        newscript = new Script; 
    815815    newscript->Name="mob_greyheart_spellbinder"; 
    816816    newscript->GetAI = GetAI_mob_greyheart_spellbinder; 
    817     m_scripts[nrscripts++] = newscript; 
     817    newscript->RegisterSelf(); 
    818818 
    819819        newscript = new Script; 
    820820    newscript->Name="mob_inner_demon"; 
    821821    newscript->GetAI = GetAI_mob_inner_demon; 
    822     m_scripts[nrscripts++] = newscript; 
     822    newscript->RegisterSelf(); 
    823823} 
  • trunk/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_lurker_below.cpp

    r229 r260  
    168168    newscript->Name="boss_the_lurker_below"; 
    169169    newscript->GetAI = GetAI_boss_the_lurker_below; 
    170     m_scripts[nrscripts++] = newscript; 
     170    newscript->RegisterSelf(); 
    171171 
    172172        newscript = new Script; 
    173173    newscript->Name="mob_coilfang_guardian"; 
    174174    newscript->GetAI = GetAI_mob_coilfang_guardian; 
    175     m_scripts[nrscripts++] = newscript; 
     175    newscript->RegisterSelf(); 
    176176 
    177177        newscript = new Script; 
    178178    newscript->Name="mob_coilfang_ambusher"; 
    179179    newscript->GetAI = GetAI_mob_coilfang_ambusher; 
    180     m_scripts[nrscripts++] = newscript; 
     180    newscript->RegisterSelf(); 
    181181} 
    182182 
  • trunk/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_morogrim_tidewalker.cpp

    r229 r260  
    351351    newscript->Name="boss_morogrim_tidewalker"; 
    352352    newscript->GetAI = GetAI_boss_morogrim_tidewalker; 
    353     m_scripts[nrscripts++] = newscript; 
     353    newscript->RegisterSelf(); 
    354354 
    355355    newscript = new Script; 
    356356    newscript->Name="mob_water_globule"; 
    357357    newscript->GetAI = GetAI_mob_water_globule; 
    358     m_scripts[nrscripts++] = newscript; 
     358    newscript->RegisterSelf(); 
    359359} 
  • trunk/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/instance_serpent_shrine.cpp

    r187 r260  
    216216    newscript->Name = "instance_serpent_shrine"; 
    217217    newscript->GetInstanceData = GetInstanceData_instance_serpentshrine_cavern; 
    218     m_scripts[nrscripts++] = newscript; 
     218    newscript->RegisterSelf(); 
    219219} 
  • trunk/src/bindings/scripts/scripts/zone/coilfang_resevoir/steam_vault/boss_hydromancer_thespia.cpp

    r223 r260  
    189189    newscript->Name="boss_hydromancer_thespia"; 
    190190    newscript->GetAI = GetAI_boss_thespiaAI; 
    191     m_scripts[nrscripts++] = newscript; 
     191    newscript->RegisterSelf(); 
    192192 
    193193    newscript = new Script; 
    194194    newscript->Name="mob_coilfang_waterelemental"; 
    195195    newscript->GetAI = GetAI_mob_coilfang_waterelementalAI; 
    196     m_scripts[nrscripts++] = newscript; 
     196    newscript->RegisterSelf(); 
    197197} 
  • trunk/src/bindings/scripts/scripts/zone/coilfang_resevoir/steam_vault/boss_mekgineer_steamrigger.cpp

    r166 r260  
    272272    newscript->Name="boss_mekgineer_steamrigger"; 
    273273    newscript->GetAI = GetAI_boss_mekgineer_steamrigger; 
    274     m_scripts[nrscripts++] = newscript; 
     274    newscript->RegisterSelf(); 
    275275 
    276276    newscript = new Script; 
    277277    newscript->Name="mob_steamrigger_mechanic"; 
    278278    newscript->GetAI = GetAI_mob_steamrigger_mechanic; 
    279     m_scripts[nrscripts++] = newscript; 
     279    newscript->RegisterSelf(); 
    280280} 
  • trunk/src/bindings/scripts/scripts/zone/coilfang_resevoir/steam_vault/boss_warlord_kalithresh.cpp

    r223 r260  
    227227    newscript->Name="mob_naga_distiller"; 
    228228    newscript->GetAI = GetAI_mob_naga_distiller; 
    229     m_scripts[nrscripts++] = newscript; 
     229    newscript->RegisterSelf(); 
    230230 
    231231    newscript = new Script; 
    232232    newscript->Name="boss_warlord_kalithresh"; 
    233233    newscript->GetAI = GetAI_boss_warlord_kalithresh; 
    234     m_scripts[nrscripts++] = newscript; 
     234    newscript->RegisterSelf(); 
    235235} 
  • trunk/src/bindings/scripts/scripts/zone/coilfang_resevoir/steam_vault/instance_steam_vault.cpp

    r90 r260  
    167167    newscript->Name = "instance_steam_vault"; 
    168168    newscript->GetInstanceData = GetInstanceData_instance_steam_vault; 
    169     m_scripts[nrscripts++] = newscript; 
     169    newscript->RegisterSelf(); 
    170170} 
  • trunk/src/bindings/scripts/scripts/zone/coilfang_resevoir/underbog/boss_hungarfen.cpp

    r90 r260  
    148148    newscript->Name="boss_hungarfen"; 
    149149    newscript->GetAI = GetAI_boss_hungarfen; 
    150     m_scripts[nrscripts++] = newscript; 
     150    newscript->RegisterSelf(); 
    151151 
    152152    newscript = new Script; 
    153153    newscript->Name="mob_underbog_mushroom"; 
    154154    newscript->GetAI = GetAI_mob_underbog_mushroom; 
    155     m_scripts[nrscripts++] = newscript; 
     155    newscript->RegisterSelf(); 
    156156} 
  • trunk/src/bindings/scripts/scripts/zone/dun_morogh/dun_morogh.cpp

    r90 r260  
    9595    newscript->Name="npc_narm_faulk"; 
    9696    newscript->GetAI = GetAI_npc_narm_faulk; 
    97     m_scripts[nrscripts++] = newscript; 
     97    newscript->RegisterSelf(); 
    9898} 
  • trunk/src/bindings/scripts/scripts/zone/dustwallow_marsh/dustwallow_marsh.cpp

    r90 r260  
    205205    newscript->Name="mobs_risen_husk_spirit"; 
    206206    newscript->GetAI = GetAI_mobs_risen_husk_spirit; 
    207     m_scripts[nrscripts++] = newscript; 
     207    newscript->RegisterSelf(); 
    208208 
    209209    newscript = new Script; 
    210210    newscript->Name="npc_restless_apparition"; 
    211211    newscript->pGossipHello =   &GossipHello_npc_restless_apparition; 
    212     m_scripts[nrscripts++] = newscript; 
     212    newscript->RegisterSelf(); 
    213213 
    214214    newscript = new Script; 
     
    216216    newscript->GetAI = GetAI_npc_deserter_agitator; 
    217217    newscript->pGossipHello = &GossipHello_npc_deserter_agitator; 
    218     m_scripts[nrscripts++] = newscript; 
     218    newscript->RegisterSelf(); 
    219219 
    220220    newscript = new Script; 
     
    222222    newscript->pGossipHello = &GossipHello_npc_lady_jaina_proudmoore; 
    223223    newscript->pGossipSelect = &GossipSelect_npc_lady_jaina_proudmoore; 
    224     m_scripts[nrscripts++] = newscript; 
     224    newscript->RegisterSelf(); 
    225225 
    226226    newscript = new Script; 
     
    228228    newscript->pGossipHello = &GossipHello_npc_nat_pagle; 
    229229    newscript->pGossipSelect = &GossipSelect_npc_nat_pagle; 
    230     m_scripts[nrscripts++] = newscript; 
    231 } 
     230    newscript->RegisterSelf(); 
     231} 
  • trunk/src/bindings/scripts/scripts/zone/eastern_plaguelands/eastern_plaguelands.cpp

    r90 r260  
    159159    newscript->Name="mobs_ghoul_flayer"; 
    160160    newscript->GetAI = GetAI_mobs_ghoul_flayer; 
    161     m_scripts[nrscripts++] = newscript; 
     161    newscript->RegisterSelf(); 
    162162 
    163163    newscript = new Script; 
     
    165165    newscript->pGossipHello = &GossipHello_npc_augustus_the_touched; 
    166166    newscript->pGossipSelect = &GossipSelect_npc_augustus_the_touched; 
    167     m_scripts[nrscripts++] = newscript; 
     167    newscript->RegisterSelf(); 
    168168 
    169169    newscript = new Script; 
     
    171171    newscript->GetAI = GetAI_npc_darrowshire_spirit; 
    172172    newscript->pGossipHello = &GossipHello_npc_darrowshire_spirit; 
    173     m_scripts[nrscripts++] = newscript; 
     173    newscript->RegisterSelf(); 
    174174 
    175175    newscript = new Script; 
     
    177177    newscript->pGossipHello =  &GossipHello_npc_tirion_fordring; 
    178178    newscript->pGossipSelect = &GossipSelect_npc_tirion_fordring; 
    179     m_scripts[nrscripts++] = newscript; 
     179    newscript->RegisterSelf(); 
    180180} 
  • trunk/src/bindings/scripts/scripts/zone/elwynn_forest/elwynn_forest.cpp

    r90 r260  
    9595    newscript->Name="npc_henze_faulk"; 
    9696    newscript->GetAI = GetAI_npc_henze_faulk; 
    97     m_scripts[nrscripts++] = newscript; 
     97    newscript->RegisterSelf(); 
    9898} 
  • trunk/src/bindings/scripts/scripts/zone/eversong_woods/eversong_woods.cpp

    r90 r260  
    153153    newscript->Name="mobs_mana_tapped"; 
    154154    newscript->GetAI = GetAI_mobs_mana_tapped; 
    155     m_scripts[nrscripts++] = newscript; 
     155    newscript->RegisterSelf(); 
    156156 
    157157    newscript = new Script; 
     
    160160    newscript->pGossipHello =  &GossipHello_npc_prospector_anvilward; 
    161161    newscript->pGossipSelect = &GossipSelect_npc_prospector_anvilward; 
    162     m_scripts[nrscripts++] = newscript; 
     162    newscript->RegisterSelf(); 
    163163} 
  • trunk/src/bindings/scripts/scripts/zone/felwood/felwood.cpp

    r90 r260  
    8686    newscript->pGossipHello = &GossipHello_npcs_riverbreeze_and_silversky; 
    8787    newscript->pGossipSelect = &GossipSelect_npcs_riverbreeze_and_silversky; 
    88     m_scripts[nrscripts++] = newscript; 
     88    newscript->RegisterSelf(); 
    8989} 
  • trunk/src/bindings/scripts/scripts/zone/feralas/feralas.cpp

    r90 r260  
    7777    newscript->pGossipHello = &GossipHello_npc_gregan_brewspewer; 
    7878    newscript->pGossipSelect = &GossipSelect_npc_gregan_brewspewer; 
    79     m_scripts[nrscripts++] = newscript; 
     79    newscript->RegisterSelf(); 
    8080 
    8181    newscript = new Script; 
    8282    newscript->Name="npc_screecher_spirit"; 
    8383    newscript->pGossipHello = &GossipHello_npc_screecher_spirit; 
    84     m_scripts[nrscripts++] = newscript; 
     84    newscript->RegisterSelf(); 
    8585} 
  • trunk/src/bindings/scripts/scripts/zone/ghostlands/ghostlands.cpp

    r205 r260  
    134134    newscript->pGossipHello = &GossipHello_npc_blood_knight_dawnstar; 
    135135    newscript->pGossipSelect = &GossipSelect_npc_blood_knight_dawnstar; 
    136     m_scripts[nrscripts++] = newscript; 
     136    newscript->RegisterSelf(); 
    137137 
    138138    newscript = new Script; 
     
    140140    newscript->pGossipHello = &GossipHello_npc_budd_nedreck; 
    141141    newscript->pGossipSelect = &GossipSelect_npc_budd_nedreck; 
    142     m_scripts[nrscripts++] = newscript; 
     142    newscript->RegisterSelf(); 
    143143 
    144144    newscript = new Script; 
     
    146146    newscript->pGossipHello = &GossipHello_npc_rathis_tomber; 
    147147    newscript->pGossipSelect = &GossipSelect_npc_rathis_tomber; 
    148     m_scripts[nrscripts++] = newscript; 
     148    newscript->RegisterSelf(); 
    149149 
    150150    newscript = new Script; 
    151151    newscript->Name = "go_gilded_brazier"; 
    152152    newscript->pGOHello = &GOHello_gilded_brazier; 
    153     m_scripts[nrscripts++] = newscript; 
     153    newscript->RegisterSelf(); 
    154154} 
  • trunk/src/bindings/scripts/scripts/zone/gruuls_lair/boss_gruul.cpp

    r158 r260  
    301301    newscript->Name="boss_gruul"; 
    302302    newscript->GetAI = GetAI_boss_gruul; 
    303     m_scripts[nrscripts++] = newscript; 
     303    newscript->RegisterSelf(); 
    304304} 
  • trunk/src/bindings/scripts/scripts/zone/gruuls_lair/boss_high_king_maulgar.cpp

    r229 r260  
    818818    newscript->Name="boss_high_king_maulgar"; 
    819819    newscript->GetAI = GetAI_boss_high_king_maulgar; 
    820     m_scripts[nrscripts++] = newscript; 
     820    newscript->RegisterSelf(); 
    821821 
    822822    newscript = new Script; 
    823823    newscript->Name="boss_kiggler_the_crazed"; 
    824824    newscript->GetAI = GetAI_boss_kiggler_the_crazed; 
    825     m_scripts[nrscripts++] = newscript; 
     825    newscript->RegisterSelf(); 
    826826 
    827827    newscript = new Script; 
    828828    newscript->Name="boss_blindeye_the_seer"; 
    829829    newscript->GetAI = GetAI_boss_blindeye_the_seer; 
    830     m_scripts[nrscripts++] = newscript; 
     830    newscript->RegisterSelf(); 
    831831 
    832832    newscript = new Script; 
    833833    newscript->Name="boss_olm_the_summoner"; 
    834834    newscript->GetAI = GetAI_boss_olm_the_summoner; 
    835     m_scripts[nrscripts++] = newscript; 
     835    newscript->RegisterSelf(); 
    836836 
    837837    newscript = new Script; 
    838838    newscript->Name="boss_krosh_firehand"; 
    839839    newscript->GetAI = GetAI_boss_krosh_firehand; 
    840     m_scripts[nrscripts++] = newscript; 
     840    newscript->RegisterSelf(); 
    841841} 
  • trunk/src/bindings/scripts/scripts/zone/gruuls_lair/instance_gruuls_lair.cpp

    r98 r260  
    185185    newscript->Name = "instance_gruuls_lair"; 
    186186    newscript->GetInstanceData = GetInstanceData_instance_gruuls_lair; 
    187     m_scripts[nrscripts++] = newscript; 
     187    newscript->RegisterSelf(); 
    188188} 
  • trunk/src/bindings/scripts/scripts/zone/hellfire_citadel/blood_furnace/boss_broggok.cpp

    r166 r260  
    124124    newscript->Name="boss_broggok"; 
    125125    newscript->GetAI = GetAI_boss_broggokAI; 
    126     m_scripts[nrscripts++] = newscript; 
     126    newscript->RegisterSelf(); 
    127127 
    128128    newscript = new Script; 
    129129    newscript->Name="mob_broggok_poisoncloud"; 
    130130    newscript->GetAI = GetAI_mob_broggok_poisoncloudAI; 
    131     m_scripts[nrscripts++] = newscript; 
     131    newscript->RegisterSelf(); 
    132132} 
  • trunk/src/bindings/scripts/scripts/zone/hellfire_citadel/blood_furnace/boss_kelidan_the_breaker.cpp

    r223 r260  
    226226    newscript->Name="boss_kelidan_the_breaker"; 
    227227    newscript->GetAI = GetAI_boss_kelidan_the_breaker; 
    228     m_scripts[nrscripts++] = newscript; 
     228    newscript->RegisterSelf(); 
    229229 
    230230    newscript = new Script; 
    231231    newscript->Name="mob_shadowmoon_channeler"; 
    232232    newscript->GetAI = GetAI_mob_shadowmoon_channeler; 
    233     m_scripts[nrscripts++] = newscript; 
     233    newscript->RegisterSelf(); 
    234234} 
  • trunk/src/bindings/scripts/scripts/zone/hellfire_citadel/blood_furnace/boss_the_maker.cpp

    r223 r260  
    128128    newscript->Name="boss_the_maker"; 
    129129    newscript->GetAI = GetAI_boss_the_makerAI; 
    130     m_scripts[nrscripts++] = newscript; 
     130    newscript->RegisterSelf(); 
    131131} 
  • trunk/src/bindings/scripts/scripts/zone/hellfire_citadel/hellfire_ramparts/boss_omor_the_unscarred.cpp

    r166 r260  
    210210    newscript->Name="boss_omor_the_unscarred"; 
    211211    newscript->GetAI = GetAI_boss_omor_the_unscarredAI; 
    212     m_scripts[nrscripts++] = newscript; 
     212    newscript->RegisterSelf(); 
    213213} 
  • trunk/src/bindings/scripts/scripts/zone/hellfire_citadel/hellfire_ramparts/boss_watchkeeper_gargolmar.cpp

    r229 r260  
    165165    newscript->Name="boss_watchkeeper_gargolmar"; 
    166166    newscript->GetAI = GetAI_boss_watchkeeper_gargolmarAI; 
    167     m_scripts[nrscripts++] = newscript; 
     167    newscript->RegisterSelf(); 
    168168} 
  • trunk/src/bindings/scripts/scripts/zone/hellfire_citadel/magtheridons_lair/boss_magtheridon.cpp

    r203 r260  
    546546    newscript->Name="boss_magtheridon"; 
    547547    newscript->GetAI = GetAI_boss_magtheridon; 
    548     m_scripts[nrscripts++] = newscript; 
     548    newscript->RegisterSelf(); 
    549549 
    550550    newscript = new Script; 
    551551    newscript->Name="mob_hellfire_channeler"; 
    552552    newscript->GetAI = GetAI_mob_hellfire_channeler; 
    553     m_scripts[nrscripts++] = newscript; 
     553    newscript->RegisterSelf(); 
    554554 
    555555    newscript = new Script; 
    556556    newscript->Name="go_manticron_cube"; 
    557557    newscript->pGOHello = &GOHello_go_Manticron_Cube; 
    558     m_scripts[nrscripts++] = newscript; 
     558    newscript->RegisterSelf(); 
    559559 
    560560    newscript = new Script; 
    561561    newscript->Name="mob_abyssal"; 
    562562    newscript->GetAI = GetAI_mob_abyssalAI; 
    563     m_scripts[nrscripts++] = newscript; 
     563    newscript->RegisterSelf(); 
    564564 
    565565} 
  • trunk/src/bindings/scripts/scripts/zone/hellfire_citadel/magtheridons_lair/instance_magtheridons_lair.cpp

    r257 r260  
    283283    newscript->Name = "instance_magtheridons_lair"; 
    284284    newscript->GetInstanceData = GetInstanceData_instance_magtheridons_lair; 
    285     m_scripts[nrscripts++] = newscript; 
     285    newscript->RegisterSelf(); 
    286286} 
  • trunk/src/bindings/scripts/scripts/zone/hellfire_citadel/shattered_halls/boss_nethekurse.cpp

    r229 r260  
    445445    newscript->Name="boss_grand_warlock_nethekurse"; 
    446446    newscript->GetAI = GetAI_boss_grand_warlock_nethekurse; 
    447     m_scripts[nrscripts++] = newscript; 
     447    newscript->RegisterSelf(); 
    448448 
    449449    newscript = new Script; 
    450450    newscript->Name="mob_fel_orc_convert"; 
    451451    newscript->GetAI = GetAI_mob_fel_orc_convert; 
    452     m_scripts[nrscripts++] = newscript; 
     452    newscript->RegisterSelf(); 
    453453 
    454454    newscript = new Script; 
    455455    newscript->Name="mob_lesser_shadow_fissure"; 
    456456    newscript->GetAI = GetAI_mob_lesser_shadow_fissure; 
    457     m_scripts[nrscripts++] = newscript; 
     457    newscript->RegisterSelf(); 
    458458} 
  • trunk/src/bindings/scripts/scripts/zone/hellfire_citadel/shattered_halls/boss_warbringer_omrogg.cpp

    r166 r260  
    395395    newscript->Name="boss_warbringer_omrogg"; 
    396396    newscript->GetAI = GetAI_boss_warbringer_omrogg; 
    397     m_scripts[nrscripts++] = newscript; 
     397    newscript->RegisterSelf(); 
    398398 
    399399    newscript = new Script; 
    400400    newscript->Name="mob_omrogg_heads"; 
    401401    newscript->GetAI = GetAI_mob_omrogg_heads; 
    402     m_scripts[nrscripts++] = newscript; 
     402    newscript->RegisterSelf(); 
    403403} 
  • trunk/src/bindings/scripts/scripts/zone/hellfire_citadel/shattered_halls/instance_shattered_halls.cpp

    r90 r260  
    111111    newscript->Name = "instance_shattered_halls"; 
    112112    newscript->GetInstanceData = GetInstanceData_instance_shattered_halls; 
    113     m_scripts[nrscripts++] = newscript; 
     113    newscript->RegisterSelf(); 
    114114} 
  • trunk/src/bindings/scripts/scripts/zone/hellfire_peninsula/boss_doomlord_kazzak.cpp

    r90 r260  
    138138    newscript->Name="boss_doomlord_kazzak"; 
    139139    newscript->GetAI = GetAI_boss_doomlordkazzak; 
    140     m_scripts[nrscripts++] = newscript; 
     140    newscript->RegisterSelf(); 
    141141} 
  • trunk/src/bindings/scripts/scripts/zone/hellfire_peninsula/hellfire_peninsula.cpp

    r90 r260  
    172172    newscript->pGossipHello =   &GossipHello_npc_wing_commander_dabiree; 
    173173    newscript->pGossipSelect =  &GossipSelect_npc_wing_commander_dabiree; 
    174     m_scripts[nrscripts++] = newscript; 
     174    newscript->RegisterSelf(); 
    175175 
    176176    newscript = new Script; 
     
    178178    newscript->pGossipHello =   &GossipHello_npc_gryphoneer_windbellow; 
    179179    newscript->pGossipSelect =  &GossipSelect_npc_gryphoneer_windbellow; 
    180     m_scripts[nrscripts++] = newscript; 
     180    newscript->RegisterSelf(); 
    181181 
    182182    newscript = new Script; 
     
    184184    newscript->pGossipHello =   &GossipHello_npc_wing_commander_brack; 
    185185    newscript->pGossipSelect =  &GossipSelect_npc_wing_commander_brack; 
    186     m_scripts[nrscripts++] = newscript; 
     186    newscript->RegisterSelf(); 
    187187} 
  • trunk/src/bindings/scripts/scripts/zone/ironforge/ironforge.cpp

    r90 r260  
    9090    newscript->pGossipHello =  &GossipHello_npc_royal_historian_archesonus; 
    9191    newscript->pGossipSelect = &GossipSelect_npc_royal_historian_archesonus; 
    92     m_scripts[nrscripts++] = newscript; 
     92    newscript->RegisterSelf(); 
    9393} 
  • trunk/src/bindings/scripts/scripts/zone/isle_of_queldanas/isle_of_queldanas.cpp

    r90 r260  
    141141    newscript->pGossipHello = &GossipHello_npc_ayren_cloudbreaker; 
    142142    newscript->pGossipSelect = &GossipSelect_npc_ayren_cloudbreaker; 
    143     m_scripts[nrscripts++] = newscript; 
     143    newscript->RegisterSelf(); 
    144144 
    145145    newscript = new Script; 
    146146    newscript->Name="npc_converted_sentry"; 
    147147    newscript->GetAI = GetAI_npc_converted_sentry; 
    148     m_scripts[nrscripts++] = newscript; 
     148    newscript->RegisterSelf(); 
    149149 
    150150    newscript = new Script; 
     
    152152    newscript->pGossipHello = &GossipHello_npc_unrestrained_dragonhawk; 
    153153    newscript->pGossipSelect = &GossipSelect_npc_unrestrained_dragonhawk; 
    154     m_scripts[nrscripts++] = newscript; 
     154    newscript->RegisterSelf(); 
    155155} 
  • trunk/src/bindings/scripts/scripts/zone/karazhan/boss_curator.cpp

    r90 r260  
    197197    newscript->Name="boss_curator"; 
    198198    newscript->GetAI = GetAI_boss_curator; 
    199     m_scripts[nrscripts++] = newscript; 
     199    newscript->RegisterSelf(); 
    200200} 
  • trunk/src/bindings/scripts/scripts/zone/karazhan/boss_maiden_of_virtue.cpp

    r90 r260  
    180180    newscript->Name="boss_maiden_of_virtue"; 
    181181    newscript->GetAI = GetAI_boss_maiden_of_virtue; 
    182     m_scripts[nrscripts++] = newscript; 
     182    newscript->RegisterSelf(); 
    183183} 
  • trunk/src/bindings/scripts/scripts/zone/karazhan/boss_midnight.cpp

    r90 r260  
    363363    newscript->Name="boss_attumen"; 
    364364    newscript->GetAI = GetAI_boss_attumen; 
    365     m_scripts[nrscripts++] = newscript; 
     365    newscript->RegisterSelf(); 
    366366 
    367367    newscript = new Script; 
    368368    newscript->Name="boss_midnight"; 
    369369    newscript->GetAI = GetAI_boss_midnight; 
    370     m_scripts[nrscripts++] = newscript; 
     370    newscript->RegisterSelf(); 
    371371} 
  • trunk/src/bindings/scripts/scripts/zone/karazhan/boss_moroes.cpp

    r109 r260  
    836836    newscript->Name="boss_moroes"; 
    837837    newscript->GetAI = GetAI_boss_moroes; 
    838     m_scripts[nrscripts++] = newscript; 
     838    newscript->RegisterSelf(); 
    839839 
    840840    newscript = new Script; 
    841841    newscript->Name="boss_baroness_dorothea_millstipe"; 
    842842    newscript->GetAI = GetAI_baroness_dorothea_millstipe; 
    843     m_scripts[nrscripts++] = newscript; 
     843    newscript->RegisterSelf(); 
    844844 
    845845    newscript = new Script; 
    846846    newscript->Name="boss_baron_rafe_dreuger"; 
    847847    newscript->GetAI = GetAI_baron_rafe_dreuger; 
    848     m_scripts[nrscripts++] = newscript; 
     848    newscript->RegisterSelf(); 
    849849 
    850850    newscript = new Script; 
    851851    newscript->Name="boss_lady_catriona_von_indi"; 
    852852    newscript->GetAI = GetAI_lady_catriona_von_indi; 
    853     m_scripts[nrscripts++] = newscript; 
     853    newscript->RegisterSelf(); 
    854854 
    855855    newscript = new Script; 
    856856    newscript->Name="boss_lady_keira_berrybuck"; 
    857857    newscript->GetAI = GetAI_lady_keira_berrybuck; 
    858     m_scripts[nrscripts++] = newscript; 
     858    newscript->RegisterSelf(); 
    859859 
    860860    newscript = new Script; 
    861861    newscript->Name="boss_lord_robin_daris"; 
    862862    newscript->GetAI = GetAI_lord_robin_daris; 
    863     m_scripts[nrscripts++] = newscript; 
     863    newscript->RegisterSelf(); 
    864864 
    865865    newscript = new Script; 
    866866    newscript->Name="boss_lord_crispin_ference"; 
    867867    newscript->GetAI = GetAI_lord_crispin_ference; 
    868     m_scripts[nrscripts++] = newscript; 
     868    newscript->RegisterSelf(); 
    869869} 
  • trunk/src/bindings/scripts/scripts/zone/karazhan/boss_prince_malchezaar.cpp

    r158 r260  
    667667    newscript->Name="boss_malchezaar"; 
    668668    newscript->GetAI = GetAI_boss_malchezaar; 
    669     m_scripts[nrscripts++] = newscript; 
     669    newscript->RegisterSelf(); 
    670670 
    671671    newscript = new Script; 
    672672    newscript->Name="netherspite_infernal"; 
    673673    newscript->GetAI = GetAI_netherspite_infernal; 
    674     m_scripts[nrscripts++] = newscript; 
     674    newscript->RegisterSelf(); 
    675675} 
  • trunk/src/bindings/scripts/scripts/zone/karazhan/boss_shade_of_aran.cpp

    r90 r260  
    655655    newscript->Name="boss_shade_of_aran"; 
    656656    newscript->GetAI = GetAI_boss_aran; 
    657     m_scripts[nrscripts++] = newscript; 
     657    newscript->RegisterSelf(); 
    658658 
    659659    newscript = new Script; 
    660660    newscript->Name="mob_shadow_of_aran"; 
    661661    newscript->GetAI = GetAI_shadow_of_aran; 
    662     m_scripts[nrscripts++] = newscript; 
     662    newscript->RegisterSelf(); 
    663663 
    664664    newscript = new Script; 
    665665    newscript->Name="mob_aran_elemental"; 
    666666    newscript->GetAI = GetAI_water_elemental; 
    667     m_scripts[nrscripts++] = newscript; 
     667    newscript->RegisterSelf(); 
    668668 
    669669    //newscript = new Script; 
    670670    //newscript->Name="mob_aran_blizzard"; 
    671671    //newscript->GetAI = GetAI_boss_aran; 
    672     //m_scripts[nrscripts++] = newscript; 
     672    //newscript->RegisterSelf(); 
    673673} 
  • trunk/src/bindings/scripts/scripts/zone/karazhan/boss_terestian_illhoof.cpp

    r109 r260  
    437437    newscript->Name="boss_terestian_illhoof"; 
    438438    newscript->GetAI = GetAI_boss_terestian_illhoof; 
    439     m_scripts[nrscripts++] = newscript; 
     439    newscript->RegisterSelf(); 
    440440 
    441441    newscript = new Script; 
    442442    newscript->Name="mob_karazhan_imp"; 
    443443    newscript->GetAI = GetAI_mob_karazhan_imp; 
    444     m_scripts[nrscripts++] = newscript; 
     444    newscript->RegisterSelf(); 
    445445 
    446446    newscript = new Script; 
    447447    newscript->Name="mob_kilrek"; 
    448448    newscript->GetAI = GetAI_mob_kilrek; 
    449     m_scripts[nrscripts++] = newscript; 
     449    newscript->RegisterSelf(); 
    450450 
    451451    newscript = new Script; 
    452452    newscript->Name = "mob_demon_chain"; 
    453453    newscript->GetAI = GetAI_mob_demon_chain; 
    454     m_scripts[nrscripts++] = newscript; 
     454    newscript->RegisterSelf(); 
    455455} 
  • trunk/src/bindings/scripts/scripts/zone/karazhan/bosses_opera.cpp

    r109 r260  
    14151415    newscript->GetAI = GetAI_boss_dorothee; 
    14161416    newscript->Name = "boss_dorothee"; 
    1417     m_scripts[nrscripts++] = newscript; 
     1417    newscript->RegisterSelf(); 
    14181418 
    14191419    newscript = new Script; 
    14201420    newscript->GetAI = GetAI_boss_strawman; 
    14211421    newscript->Name = "boss_strawman"; 
    1422     m_scripts[nrscripts++] = newscript; 
     1422    newscript->RegisterSelf(); 
    14231423 
    14241424    newscript = new Script; 
    14251425    newscript->GetAI = GetAI_boss_tinhead; 
    14261426    newscript->Name = "boss_tinhead"; 
    1427     m_scripts[nrscripts++] = newscript; 
     1427    newscript->RegisterSelf(); 
    14281428 
    14291429    newscript = new Script; 
    14301430    newscript->GetAI = GetAI_boss_roar; 
    14311431    newscript->Name = "boss_roar"; 
    1432     m_scripts[nrscripts++] = newscript; 
     1432    newscript->RegisterSelf(); 
    14331433 
    14341434    newscript = new Script; 
    14351435    newscript->GetAI = GetAI_boss_crone; 
    14361436    newscript->Name = "boss_crone"; 
    1437     m_scripts[nrscripts++] = newscript; 
     1437    newscript->RegisterSelf(); 
    14381438 
    14391439    newscript = new Script; 
    14401440    newscript->GetAI = GetAI_mob_tito; 
    14411441    newscript->Name = "mob_tito"; 
    1442     m_scripts[nrscripts++] = newscript; 
     1442    newscript->RegisterSelf(); 
    14431443 
    14441444    newscript = new Script; 
    14451445    newscript->GetAI = GetAI_mob_cyclone; 
    14461446    newscript->Name = "mob_cyclone"; 
    1447     m_scripts[nrscripts++] = newscript; 
     1447    newscript->RegisterSelf(); 
    14481448 
    14491449    // Hood 
     
    14521452    newscript->pGossipSelect = GossipSelect_npc_grandmother; 
    14531453    newscript->Name = "npc_grandmother"; 
    1454     m_scripts[nrscripts++] = newscript; 
     1454    newscript->RegisterSelf(); 
    14551455 
    14561456    newscript = new Script; 
    14571457    newscript->GetAI = GetAI_boss_bigbadwolf; 
    14581458    newscript->Name = "boss_bigbadwolf"; 
    1459     m_scripts[nrscripts++] = newscript; 
     1459    newscript->RegisterSelf(); 
    14601460 
    14611461    // Romeo And Juliet 
     
    14631463    newscript->GetAI = GetAI_boss_julianne; 
    14641464    newscript->Name = "boss_julianne"; 
    1465     m_scripts[nrscripts++] = newscript; 
     1465    newscript->RegisterSelf(); 
    14661466 
    14671467    newscript = new Script; 
    14681468    newscript->GetAI = GetAI_boss_romulo; 
    14691469    newscript->Name = "boss_romulo"; 
    1470     m_scripts[nrscripts++] = newscript; 
    1471 } 
     1470    newscript->RegisterSelf(); 
     1471} 
  • trunk/src/bindings/scripts/scripts/zone/karazhan/instance_karazhan.cpp

    r90 r260  
    250250    newscript->Name = "instance_karazhan"; 
    251251    newscript->GetInstanceData = GetInstanceData_instance_karazhan; 
    252     m_scripts[nrscripts++] = newscript; 
     252    newscript->RegisterSelf(); 
    253253} 
  • trunk/src/bindings/scripts/scripts/zone/karazhan/karazhan.cpp

    r257 r260  
    461461    newscript->pGossipHello = GossipHello_npc_barnes; 
    462462    newscript->pGossipSelect = GossipSelect_npc_barnes; 
    463     m_scripts[nrscripts++] = newscript; 
     463    newscript->RegisterSelf(); 
    464464 
    465465    newscript = new Script; 
     
    467467    newscript->pGossipHello = GossipHello_npc_berthold; 
    468468    newscript->pGossipSelect = GossipSelect_npc_berthold; 
    469     m_scripts[nrscripts++] = newscript; 
    470 } 
     469    newscript->RegisterSelf(); 
     470} 
  • trunk/src/bindings/scripts/scripts/zone/loch_modan/loch_modan.cpp

    r90 r260  
    8888    newscript->pGossipHello =  &GossipHello_npc_mountaineer_pebblebitty; 
    8989    newscript->pGossipSelect = &GossipSelect_npc_mountaineer_pebblebitty; 
    90     m_scripts[nrscripts++] = newscript; 
     90    newscript->RegisterSelf(); 
    9191} 
  • trunk/src/bindings/scripts/scripts/zone/magisters_terrace/boss_felblood_kaelthas.cpp

    r257 r260  
    762762    newscript->Name = "boss_felblood_kaelthas"; 
    763763    newscript->GetAI = GetAI_boss_felblood_kaelthas; 
    764     m_scripts[nrscripts++] = newscript; 
     764    newscript->RegisterSelf(); 
    765765 
    766766    newscript = new Script; 
    767767    newscript->Name = "mob_arcane_sphere"; 
    768768    newscript->GetAI = GetAI_mob_arcane_sphere; 
    769     m_scripts[nrscripts++] = newscript; 
     769    newscript->RegisterSelf(); 
    770770 
    771771    newscript = new Script; 
    772772    newscript->Name="mob_felkael_phoenix"; 
    773773    newscript->GetAI = GetAI_mob_felkael_phoenix; 
    774     m_scripts[nrscripts++] = newscript; 
     774    newscript->RegisterSelf(); 
    775775 
    776776    newscript = new Script; 
    777777    newscript->Name="mob_felkael_phoenix_egg"; 
    778778    newscript->GetAI = GetAI_mob_felkael_phoenix_egg; 
    779     m_scripts[nrscripts++] = newscript; 
     779    newscript->RegisterSelf(); 
    780780 
    781781    newscript = new Script; 
    782782    newscript->Name="mob_felkael_flamestrike"; 
    783783    newscript->GetAI = GetAI_mob_felkael_flamestrike; 
    784     m_scripts[nrscripts++] = newscript; 
     784    newscript->RegisterSelf(); 
    785785 
    786786        newscript = new Script; 
    787787    newscript->Name="go_kael_orb"; 
    788788    newscript->pGOHello = &GOHello_go_kael_orb; 
    789     m_scripts[nrscripts++] = newscript; 
     789    newscript->RegisterSelf(); 
    790790 
    791791        newscript = new Script; 
    792792    newscript->Name="go_movie_orb"; 
    793793    newscript->pGOHello = &GOHello_go_movie_orb; 
    794     m_scripts[nrscripts++] = newscript; 
     794    newscript->RegisterSelf(); 
    795795} 
  • trunk/src/bindings/scripts/scripts/zone/magisters_terrace/boss_priestess_delrissa.cpp

    r137 r260  
    13561356    newscript->Name="boss_priestess_delrissa"; 
    13571357    newscript->GetAI = GetAI_boss_priestess_delrissa; 
    1358     m_scripts[nrscripts++] = newscript; 
     1358    newscript->RegisterSelf(); 
    13591359 
    13601360    newscript = new Script; 
    13611361    newscript->Name="boss_kagani_nightstrike"; 
    13621362    newscript->GetAI = GetAI_boss_kagani_nightstrike; 
    1363     m_scripts[nrscripts++] = newscript; 
     1363    newscript->RegisterSelf(); 
    13641364 
    13651365    newscript = new Script; 
    13661366    newscript->Name="boss_ellris_duskhallow"; 
    13671367    newscript->GetAI = GetAI_ellris_duskhallow; 
    1368     m_scripts[nrscripts++] = newscript; 
     1368    newscript->RegisterSelf(); 
    13691369 
    13701370    newscript = new Script; 
    13711371    newscript->Name="boss_eramas_brightblaze"; 
    13721372    newscript->GetAI = GetAI_eramas_brightblaze; 
    1373     m_scripts[nrscripts++] = newscript; 
     1373    newscript->RegisterSelf(); 
    13741374 
    13751375    newscript = new Script; 
    13761376    newscript->Name="boss_yazzai"; 
    13771377    newscript->GetAI = GetAI_yazzai; 
    1378     m_scripts[nrscripts++] = newscript; 
     1378    newscript->RegisterSelf(); 
    13791379 
    13801380    newscript = new Script; 
    13811381    newscript->Name="boss_warlord_salaris"; 
    13821382    newscript->GetAI = GetAI_warlord_salaris; 
    1383     m_scripts[nrscripts++] = newscript; 
     1383    newscript->RegisterSelf(); 
    13841384 
    13851385    newscript = new Script; 
    13861386    newscript->Name="boss_garaxxas"; 
    13871387    newscript->GetAI = GetAI_garaxxas; 
    1388     m_scripts[nrscripts++] = newscript; 
     1388    newscript->RegisterSelf(); 
    13891389 
    13901390    newscript = new Script; 
    13911391    newscript->Name="boss_apoko"; 
    13921392    newscript->GetAI = GetAI_apoko; 
    1393     m_scripts[nrscripts++] = newscript; 
     1393    newscript->RegisterSelf(); 
    13941394 
    13951395    newscript = new Script; 
    13961396    newscript->Name="boss_zelfan"; 
    13971397    newscript->GetAI = GetAI_zelfan; 
    1398     m_scripts[nrscripts++] = newscript; 
     1398    newscript->RegisterSelf(); 
    13991399 
    14001400    /*newscript = new Script; 
    14011401    newscript->Name="mob_high_explosive_sheep"; 
    14021402    newscript->GetAI = GetAI_mob_high_explosive_sheep; 
    1403     m_scripts[nrscripts++] = newscript;*/ 
     1403    newscript->RegisterSelf();*/ 
    14041404 
    14051405    /*newscript = new Script; 
    14061406    newscript->Name="mob_fizzle"; 
    14071407    newscript->GetAI = GetAI_mob_fizzle; 
    1408     m_scripts[nrscripts++] = newscript;*/ 
     1408    newscript->RegisterSelf();*/ 
    14091409 
    14101410    /*newscript = new Script; 
    14111411    newscript->Name="mob_sliver"; 
    14121412    newscript->GetAI = GetAI_mob_sliver; 
    1413     m_scripts[nrscripts++] = newscript;*/ 
     1413    newscript->RegisterSelf();*/ 
    14141414} 
  • trunk/src/bindings/scripts/scripts/zone/magisters_terrace/boss_selin_fireheart.cpp

    r137 r260  
    404404    newscript->Name="boss_selin_fireheart"; 
    405405    newscript->GetAI = GetAI_boss_selin_fireheart; 
    406     m_scripts[nrscripts++] = newscript; 
     406    newscript->RegisterSelf(); 
    407407 
    408408    newscript = new Script; 
    409409    newscript->Name="mob_fel_crystal"; 
    410410    newscript->GetAI = GetAI_mob_fel_crystal; 
    411     m_scripts[nrscripts++] = newscript; 
     411    newscript->RegisterSelf(); 
    412412} 
  • trunk/src/bindings/scripts/scripts/zone/magisters_terrace/boss_vexallus.cpp

    r137 r260  
    239239    newscript->Name="boss_vexallus"; 
    240240    newscript->GetAI = GetAI_boss_vexallus; 
    241     m_scripts[nrscripts++] = newscript; 
     241    newscript->RegisterSelf(); 
    242242 
    243243    newscript = new Script; 
    244244    newscript->Name="mob_pure_energy"; 
    245245    newscript->GetAI = GetAI_mob_pure_energy; 
    246     m_scripts[nrscripts++] = newscript; 
     246    newscript->RegisterSelf(); 
    247247} 
  • trunk/src/bindings/scripts/scripts/zone/magisters_terrace/instance_magisters_terrace.cpp

    r137 r260  
    250250    newscript->Name = "instance_magisters_terrace"; 
    251251    newscript->GetInstanceData = GetInstanceData_instance_magisters_terrace; 
    252     m_scripts[nrscripts++] = newscript; 
     252    newscript->RegisterSelf(); 
    253253} 
  • trunk/src/bindings/scripts/scripts/zone/maraudon/boss_celebras_the_cursed.cpp

    r90 r260  
    9494    newscript->Name="celebras_the_cursed"; 
    9595    newscript->GetAI = GetAI_celebras_the_cursed; 
    96     m_scripts[nrscripts++] = newscript; 
     96    newscript->RegisterSelf(); 
    9797} 
  • trunk/src/bindings/scripts/scripts/zone/maraudon/boss_landslide.cpp

    r90 r260  
    9191    newscript->Name="boss_landslide"; 
    9292    newscript->GetAI = GetAI_boss_landslide; 
    93     m_scripts[nrscripts++] = newscript; 
     93    newscript->RegisterSelf(); 
    9494} 
  • trunk/src/bindings/scripts/scripts/zone/maraudon/boss_noxxion.cpp

    r90 r260  
    146146    newscript->Name="boss_noxxion"; 
    147147    newscript->GetAI = GetAI_boss_noxxion; 
    148     m_scripts[nrscripts++] = newscript; 
     148    newscript->RegisterSelf(); 
    149149} 
  • trunk/src/bindings/scripts/scripts/zone/maraudon/boss_princess_theradras.cpp

    r90 r260  
    105105    newscript->Name="boss_princess_theradras"; 
    106106    newscript->GetAI = GetAI_boss_ptheradras; 
    107     m_scripts[nrscripts++] = newscript; 
     107    newscript->RegisterSelf(); 
    108108} 
  • trunk/src/bindings/scripts/scripts/zone/molten_core/boss_baron_geddon.cpp

    r90 r260  
    102102    newscript->Name="boss_baron_geddon"; 
    103103    newscript->GetAI = GetAI_boss_baron_geddon; 
    104     m_scripts[nrscripts++] = newscript; 
     104    newscript->RegisterSelf(); 
    105105} 
  • trunk/src/bindings/scripts/scripts/zone/molten_core/boss_garr.cpp

    r90 r260  
    141141    newscript->Name="boss_garr"; 
    142142    newscript->GetAI = GetAI_boss_garr; 
    143     m_scripts[nrscripts++] = newscript; 
     143    newscript->RegisterSelf(); 
    144144 
    145145    newscript = new Script; 
    146146    newscript->Name="mob_firesworn"; 
    147147    newscript->GetAI = GetAI_mob_firesworn; 
    148     m_scripts[nrscripts++] = newscript; 
     148    newscript->RegisterSelf(); 
    149149} 
  • trunk/src/bindings/scripts/scripts/zone/molten_core/boss_gehennas.cpp

    r90 r260  
    8888    newscript->Name="boss_gehennas"; 
    8989    newscript->GetAI = GetAI_boss_gehennas; 
    90     m_scripts[nrscripts++] = newscript; 
     90    newscript->RegisterSelf(); 
    9191} 
  • trunk/src/bindings/scripts/scripts/zone/molten_core/boss_golemagg.cpp

    r90 r260  
    193193    newscript->Name="boss_golemagg"; 
    194194    newscript->GetAI = GetAI_boss_golemagg; 
    195     m_scripts[nrscripts++] = newscript; 
     195    newscript->RegisterSelf(); 
    196196 
    197197    newscript = new Script; 
    198198    newscript->Name="mob_core_rager"; 
    199199    newscript->GetAI = GetAI_mob_core_rager; 
    200     m_scripts[nrscripts++] = newscript; 
     200    newscript->RegisterSelf(); 
    201201} 
  • trunk/src/bindings/scripts/scripts/zone/molten_core/boss_lucifron.cpp

    r90 r260  
    8787    newscript->Name="boss_lucifron"; 
    8888    newscript->GetAI = GetAI_boss_lucifron; 
    89     m_scripts[nrscripts++] = newscript; 
     89    newscript->RegisterSelf(); 
    9090} 
  • trunk/src/bindings/scripts/scripts/zone/molten_core/boss_magmadar.cpp

    r90 r260  
    9494    newscript->Name="boss_magmadar"; 
    9595    newscript->GetAI = GetAI_boss_magmadar; 
    96     m_scripts[nrscripts++] = newscript; 
     96    newscript->RegisterSelf(); 
    9797} 
  • trunk/src/bindings/scripts/scripts/zone/molten_core/boss_majordomo_executus.cpp

    r90 r260  
    130130    newscript->Name="boss_majordomo"; 
    131131    newscript->GetAI = GetAI_boss_majordomo; 
    132     m_scripts[nrscripts++] = newscript; 
     132    newscript->RegisterSelf(); 
    133133} 
  • trunk/src/bindings/scripts/scripts/zone/molten_core/boss_ragnaros.cpp

    r158 r260  
    314314    newscript->Name="boss_ragnaros"; 
    315315    newscript->GetAI = GetAI_boss_ragnaros; 
    316     m_scripts[nrscripts++] = newscript; 
     316    newscript->RegisterSelf(); 
    317317} 
  • trunk/src/bindings/scripts/scripts/zone/molten_core/boss_shazzrah.cpp

    r90 r260  
    118118    newscript->Name="boss_shazzrah"; 
    119119    newscript->GetAI = GetAI_boss_shazzrah; 
    120     m_scripts[nrscripts++] = newscript; 
     120    newscript->RegisterSelf(); 
    121121} 
  • trunk/src/bindings/scripts/scripts/zone/molten_core/boss_sulfuron_harbinger.cpp

    r90 r260  
    207207    newscript->Name="boss_sulfuron"; 
    208208    newscript->GetAI = GetAI_boss_sulfuron; 
    209     m_scripts[nrscripts++] = newscript; 
     209    newscript->RegisterSelf(); 
    210210 
    211211    newscript = new Script; 
    212212    newscript->Name="mob_flamewaker_priest"; 
    213213    newscript->GetAI = GetAI_mob_flamewaker_priest; 
    214     m_scripts[nrscripts++] = newscript; 
     214    newscript->RegisterSelf(); 
    215215} 
  • trunk/src/bindings/scripts/scripts/zone/molten_core/instance_molten_core.cpp

    r90 r260  
    254254    newscript->Name="instance_molten_core"; 
    255255    newscript->GetInstanceData = &GetInstance_instance_molten_core; 
    256     m_scripts[nrscripts++] = newscript; 
     256    newscript->RegisterSelf(); 
    257257} 
  • trunk/src/bindings/scripts/scripts/zone/molten_core/molten_core.cpp

    r90 r260  
    8585    newscript->Name="mob_ancient_core_hound"; 
    8686    newscript->GetAI = GetAI_mob_ancient_core_hound; 
    87     m_scripts[nrscripts++] = newscript; 
     87    newscript->RegisterSelf(); 
    8888} 
  • trunk/src/bindings/scripts/scripts/zone/moonglade/moonglade.cpp

    r204 r260  
    546546    newscript->pGossipHello =  &GossipHello_npc_bunthen_plainswind; 
    547547    newscript->pGossipSelect = &GossipSelect_npc_bunthen_plainswind; 
    548     m_scripts[nrscripts++] = newscript; 
     548    newscript->RegisterSelf(); 
    549549 
    550550    newscript = new Script; 
     
    552552    newscript->pGossipHello =  &GossipHello_npc_great_bear_spirit; 
    553553    newscript->pGossipSelect = &GossipSelect_npc_great_bear_spirit; 
    554     m_scripts[nrscripts++] = newscript; 
     554    newscript->RegisterSelf(); 
    555555 
    556556    newscript = new Script; 
     
    558558    newscript->pGossipHello =  &GossipHello_npc_silva_filnaveth; 
    559559    newscript->pGossipSelect = &GossipSelect_npc_silva_filnaveth; 
    560     m_scripts[nrscripts++] = newscript; 
     560    newscript->RegisterSelf(); 
    561561 
    562562        newscript = new Script; 
    563563    newscript->Name="npc_clintar_dreamwalker"; 
    564564    newscript->pQuestAccept = &QuestAccept_npc_clintar_dreamwalker; 
    565     m_scripts[nrscripts++] = newscript; 
     565    newscript->RegisterSelf(); 
    566566 
    567567    newscript = new Script; 
    568568    newscript->Name="npc_clintar_spirit"; 
    569569    newscript->GetAI = GetAI_npc_clintar_spirit; 
    570     m_scripts[nrscripts++] = newscript; 
    571 } 
     570    newscript->RegisterSelf(); 
     571} 
  • trunk/src/bindings/scripts/scripts/zone/mulgore/mulgore.cpp

    r90 r260  
    6161    newscript->pGossipHello          = &GossipHello_npc_skorn_whitecloud; 
    6262    newscript->pGossipSelect         = &GossipSelect_npc_skorn_whitecloud; 
    63     m_scripts[nrscripts++] = newscript; 
     63    newscript->RegisterSelf(); 
    6464} 
  • trunk/src/bindings/scripts/scripts/zone/nagrand/nagrand.cpp

    r204 r260  
    632632    newscript->Name="mob_shattered_rumbler"; 
    633633    newscript->GetAI = GetAI_mob_shattered_rumbler; 
    634     m_scripts[nrscripts++] = newscript; 
     634    newscript->RegisterSelf(); 
    635635 
    636636    newscript = new Script; 
     
    639639    newscript->pGossipHello =  &GossipHello_mob_lump; 
    640640    newscript->pGossipSelect = &GossipSelect_mob_lump; 
    641     m_scripts[nrscripts++] = newscript; 
     641    newscript->RegisterSelf(); 
    642642 
    643643    newscript = new Script; 
    644644    newscript->Name="mob_sunspring_villager"; 
    645645    newscript->GetAI = GetAI_mob_sunspring_villager; 
    646     m_scripts[nrscripts++] = newscript; 
     646    newscript->RegisterSelf(); 
    647647 
    648648    newscript = new Script; 
     
    651651    newscript->pGossipSelect = &GossipSelect_npc_altruis_the_sufferer; 
    652652    newscript->pQuestAccept =  &QuestAccept_npc_altruis_the_sufferer; 
    653     m_scripts[nrscripts++] = newscript; 
     653    newscript->RegisterSelf(); 
    654654 
    655655    newscript = new Script; 
     
    657657    newscript->pGossipHello =  &GossipHello_npc_greatmother_geyah; 
    658658    newscript->pGossipSelect = &GossipSelect_npc_greatmother_geyah; 
    659     m_scripts[nrscripts++] = newscript; 
     659    newscript->RegisterSelf(); 
    660660 
    661661    newscript = new Script; 
     
    663663    newscript->pGossipHello =  &GossipHello_npc_lantresor_of_the_blade; 
    664664    newscript->pGossipSelect = &GossipSelect_npc_lantresor_of_the_blade; 
    665     m_scripts[nrscripts++] = newscript; 
     665    newscript->RegisterSelf(); 
    666666 
    667667    newscript = new Script; 
    668668    newscript->Name="npc_creditmarker_visit_with_ancestors"; 
    669669    newscript->GetAI = GetAI_npc_creditmarker_visit_with_ancestors; 
    670     m_scripts[nrscripts++] = newscript; 
     670    newscript->RegisterSelf(); 
    671671 
    672672    newscript = new Script; 
    673673    newscript->Name="mob_sparrowhawk"; 
    674674    newscript->GetAI = GetAI_mob_sparrowhawk; 
    675     m_scripts[nrscripts++] = newscript; 
    676 } 
     675    newscript->RegisterSelf(); 
     676} 
  • trunk/src/bindings/scripts/scripts/zone/naxxramas/boss_anubrekhan.cpp

    r229 r260  
    209209    newscript->Name="boss_anubrekhan"; 
    210210    newscript->GetAI = GetAI_boss_anubrekhan; 
    211     m_scripts[nrscripts++] = newscript; 
     211    newscript->RegisterSelf(); 
    212212} 
  • trunk/src/bindings/scripts/scripts/zone/naxxramas/boss_faerlina.cpp

    r229 r260  
    198198    newscript->Name="boss_faerlina"; 
    199199    newscript->GetAI = GetAI_boss_faerlina; 
    200     m_scripts[nrscripts++] = newscript; 
     200    newscript->RegisterSelf(); 
    201201} 
  • trunk/src/bindings/scripts/scripts/zone/naxxramas/boss_gluth.cpp

    r90 r260  
    171171    newscript->Name="boss_gluth"; 
    172172    newscript->GetAI = GetAI_boss_gluth; 
    173     m_scripts[nrscripts++] = newscript; 
     173    newscript->RegisterSelf(); 
    174174} 
  • trunk/src/bindings/scripts/scripts/zone/naxxramas/boss_highlord_mograine.cpp

    r90 r260  
    175175    newscript->Name="boss_highlord_mograine"; 
    176176    newscript->GetAI = GetAI_boss_highlord_mograine; 
    177     m_scripts[nrscripts++] = newscript; 
     177    newscript->RegisterSelf(); 
    178178} 
  • trunk/src/bindings/scripts/scripts/zone/naxxramas/boss_kelthuzad.cpp

    r90 r260  
    538538    newscript->Name="boss_kelthuzad"; 
    539539    newscript->GetAI = GetAI_boss_kelthuzadAI; 
    540     m_scripts[nrscripts++] = newscript; 
     540    newscript->RegisterSelf(); 
    541541    */ 
    542542} 
  • trunk/src/bindings/scripts/scripts/zone/naxxramas/boss_lady_blaumeux.cpp

    r90 r260  
    144144    newscript->Name="boss_lady_blaumeux"; 
    145145    newscript->GetAI = GetAI_boss_lady_blaumeux; 
    146     m_scripts[nrscripts++] = newscript; 
     146    newscript->RegisterSelf(); 
    147147} 
  • trunk/src/bindings/scripts/scripts/zone/naxxramas/boss_loatheb.cpp

    r90 r260  
    213213    newscript->Name="boss_loatheb"; 
    214214    newscript->GetAI = GetAI_boss_loatheb; 
    215     m_scripts[nrscripts++] = newscript; 
     215    newscript->RegisterSelf(); 
    216216} 
  • trunk/src/bindings/scripts/scripts/zone/naxxramas/boss_maexxna.cpp

    r90 r260  
    238238    newscript->Name="boss_maexxna"; 
    239239    newscript->GetAI = GetAI_boss_maexxna; 
    240     m_scripts[nrscripts++] = newscript; 
     240    newscript->RegisterSelf(); 
    241241 
    242242    newscript = new Script; 
    243243    newscript->Name="mob_webwrap"; 
    244244    newscript->GetAI = GetAI_mob_webwrap; 
    245     m_scripts[nrscripts++] = newscript; 
     245    newscript->RegisterSelf(); 
    246246} 
  • trunk/src/bindings/scripts/scripts/zone/naxxramas/boss_noth.cpp

    r90 r260  
    177177    newscript->Name="boss_noth"; 
    178178    newscript->GetAI = GetAI_boss_noth; 
    179     m_scripts[nrscripts++] = newscript; 
     179    newscript->RegisterSelf(); 
    180180} 
  • trunk/src/bindings/scripts/scripts/zone/naxxramas/boss_patchwerk.cpp

    r90 r260  
    157157    newscript->Name="boss_patchwerk"; 
    158158    newscript->GetAI = GetAI_boss_patchwerk; 
    159     m_scripts[nrscripts++] = newscript; 
     159    newscript->RegisterSelf(); 
    160160} 
  • trunk/src/bindings/scripts/scripts/zone/naxxramas/boss_razuvious.cpp

    r90 r260  
    164164    newscript->Name="boss_razuvious"; 
    165165    newscript->GetAI = GetAI_boss_razuvious; 
    166     m_scripts[nrscripts++] = newscript; 
     166    newscript->RegisterSelf(); 
    167167} 
  • trunk/src/bindings/scripts/scripts/zone/naxxramas/boss_sapphiron.cpp

    r158 r260  
    196196    newscript->Name="boss_sapphiron"; 
    197197    newscript->GetAI = GetAI_boss_sapphiron; 
    198     m_scripts[nrscripts++] = newscript; 
     198    newscript->RegisterSelf(); 
    199199} 
  • trunk/src/bindings/scripts/scripts/zone/naxxramas/boss_sir_zeliek.cpp

    r90 r260  
    143143    newscript->Name="boss_sir_zeliek"; 
    144144    newscript->GetAI = GetAI_boss_sir_zeliek; 
    145     m_scripts[nrscripts++] = newscript; 
     145    newscript->RegisterSelf(); 
    146146} 
  • trunk/src/bindings/scripts/scripts/zone/naxxramas/boss_thane_korthazz.cpp

    r90 r260  
    144144    newscript->Name="boss_thane_korthazz"; 
    145145    newscript->GetAI = GetAI_boss_thane_korthazz; 
    146     m_scripts[nrscripts++] = newscript; 
     146    newscript->RegisterSelf(); 
    147147} 
  • trunk/src/bindings/scripts/scripts/zone/netherstorm/netherstorm.cpp

    r90 r260  
    401401    newscript->Name="go_manaforge_control_console"; 
    402402    newscript->pGOHello = &GOHello_go_manaforge_control_console; 
    403     m_scripts[nrscripts++] = newscript; 
     403    newscript->RegisterSelf(); 
    404404 
    405405    newscript = new Script; 
    406406    newscript->Name="npc_manaforge_control_console"; 
    407407    newscript->GetAI = GetAI_npc_manaforge_control_console; 
    408     m_scripts[nrscripts++] = newscript; 
     408    newscript->RegisterSelf(); 
    409409 
    410410    newscript = new Script; 
     
    412412    newscript->pGossipHello =   &GossipHello_npc_protectorate_nether_drake; 
    413413    newscript->pGossipSelect =  &GossipSelect_npc_protectorate_nether_drake; 
    414     m_scripts[nrscripts++] = newscript; 
     414    newscript->RegisterSelf(); 
    415415 
    416416    newscript = new Script; 
     
    418418    newscript->pGossipHello =   &GossipHello_npc_veronia; 
    419419    newscript->pGossipSelect =  &GossipSelect_npc_veronia; 
    420     m_scripts[nrscripts++] = newscript; 
    421 } 
     420    newscript->RegisterSelf(); 
     421} 
  • trunk/src/bindings/scripts/scripts/zone/onyxias_lair/boss_onyxia.cpp

    r223 r260  
    230230    newscript->Name="boss_onyxia"; 
    231231    newscript->GetAI = GetAI_boss_onyxiaAI; 
    232     m_scripts[nrscripts++] = newscript; 
     232    newscript->RegisterSelf(); 
    233233} 
  • trunk/src/bindings/scripts/scripts/zone/orgrimmar/orgrimmar.cpp

    r90 r260  
    248248    newscript->pGossipHello =  &GossipHello_npc_neeru_fireblade; 
    249249    newscript->pGossipSelect = &GossipSelect_npc_neeru_fireblade; 
    250     m_scripts[nrscripts++] = newscript; 
     250    newscript->RegisterSelf(); 
    251251 
    252252    newscript = new Script; 
     
    255255    newscript->pQuestAccept =  &QuestAccept_npc_shenthul; 
    256256    newscript->pReceiveEmote = &ReciveEmote_npc_shenthul; 
    257     m_scripts[nrscripts++] = newscript; 
     257    newscript->RegisterSelf(); 
    258258 
    259259    newscript = new Script; 
     
    262262    newscript->pGossipHello =  &GossipHello_npc_thrall_warchief; 
    263263    newscript->pGossipSelect = &GossipSelect_npc_thrall_warchief; 
    264     m_scripts[nrscripts++] = newscript; 
    265 } 
     264    newscript->RegisterSelf(); 
     265} 
  • trunk/src/bindings/scripts/scripts/zone/razorfen_downs/boss_amnennar_the_coldbringer.cpp

    r90 r260  
    137137    newscript->Name="boss_amnennar_the_coldbringer"; 
    138138    newscript->GetAI = GetAI_boss_amnennar_the_coldbringer; 
    139     m_scripts[nrscripts++] = newscript; 
     139    newscript->RegisterSelf(); 
    140140} 
  • trunk/src/bindings/scripts/scripts/zone/ruins_of_ahnqiraj/boss_ayamiss.cpp

    r90 r260  
    104104    newscript->Name="boss_ayamiss"; 
    105105    newscript->GetAI = GetAI_boss_ayamiss; 
    106     m_scripts[nrscripts++] = newscript; 
     106    newscript->RegisterSelf(); 
    107107} 
  • trunk/src/bindings/scripts/scripts/zone/ruins_of_ahnqiraj/boss_kurinnaxx.cpp

    r90 r260  
    9090    newscript->Name="boss_kurinnaxx"; 
    9191    newscript->GetAI = GetAI_boss_kurinnaxx; 
    92     m_scripts[nrscripts++] = newscript; 
     92    newscript->RegisterSelf(); 
    9393} 
  • trunk/src/bindings/scripts/scripts/zone/ruins_of_ahnqiraj/boss_moam.cpp

    r90 r260  
    114114    newscript->Name="boss_moam"; 
    115115    newscript->GetAI = GetAI_boss_moam; 
    116     m_scripts[nrscripts++] = newscript; 
     116    newscript->RegisterSelf(); 
    117117} 
  • trunk/src/bindings/scripts/scripts/zone/scarlet_monastery/boss_arcanist_doan.cpp

    r90 r260  
    168168    newscript->Name="boss_arcanist_doan"; 
    169169    newscript->GetAI = GetAI_boss_arcanist_doan; 
    170     m_scripts[nrscripts++] = newscript; 
     170    newscript->RegisterSelf(); 
    171171} 
  • trunk/src/bindings/scripts/scripts/zone/scarlet_monastery/boss_azshir_the_sleepless.cpp

    r90 r260  
    9494    newscript->Name="boss_azshir_the_sleepless"; 
    9595    newscript->GetAI = GetAI_boss_azshir_the_sleepless; 
    96     m_scripts[nrscripts++] = newscript; 
     96    newscript->RegisterSelf(); 
    9797} 
  • trunk/src/bindings/scripts/scripts/zone/scarlet_monastery/boss_bloodmage_thalnos.cpp

    r90 r260  
    133133    newscript->Name="boss_bloodmage_thalnos"; 
    134134    newscript->GetAI = GetAI_boss_bloodmage_thalnos; 
    135     m_scripts[nrscripts++] = newscript; 
     135    newscript->RegisterSelf(); 
    136136} 
  • trunk/src/bindings/scripts/scripts/zone/scarlet_monastery/boss_herod.cpp

    r90 r260  
    194194    newscript->Name="boss_herod"; 
    195195    newscript->GetAI = GetAI_boss_herod; 
    196     m_scripts[nrscripts++] = newscript; 
     196    newscript->RegisterSelf(); 
    197197} 
  • trunk/src/bindings/scripts/scripts/zone/scarlet_monastery/boss_high_inquisitor_fairbanks.cpp

    r90 r260  
    129129    newscript->Name="boss_high_inquisitor_fairbanks"; 
    130130    newscript->GetAI = GetAI_boss_high_inquisitor_fairbanks; 
    131     m_scripts[nrscripts++] = newscript; 
     131    newscript->RegisterSelf(); 
    132132} 
  • trunk/src/bindings/scripts/scripts/zone/scarlet_monastery/boss_high_inquisitor_whitemane.cpp

    r90 r260  
    174174    newscript->Name="boss_high_inquisitor_whitemane"; 
    175175    newscript->GetAI = GetAI_boss_high_inquisitor_whitemane; 
    176     m_scripts[nrscripts++] = newscript; 
     176    newscript->RegisterSelf(); 
    177177} 
  • trunk/src/bindings/scripts/scripts/zone/scarlet_monastery/boss_houndmaster_loksey.cpp

    r90 r260  
    7575    newscript->Name="boss_houndmaster_loksey"; 
    7676    newscript->GetAI = GetAI_boss_houndmaster_loksey; 
    77     m_scripts[nrscripts++] = newscript; 
     77    newscript->RegisterSelf(); 
    7878} 
  • trunk/src/bindings/scripts/scripts/zone/scarlet_monastery/boss_interrogator_vishas.cpp

    r90 r260  
    110110    newscript->Name="boss_interrogator_vishas"; 
    111111    newscript->GetAI = GetAI_boss_interrogator_vishas; 
    112     m_scripts[nrscripts++] = newscript; 
     112    newscript->RegisterSelf(); 
    113113} 
  • trunk/src/bindings/scripts/scripts/zone/scarlet_monastery/boss_scarlet_commander_mograine.cpp

    r90 r260  
    157157    newscript->Name="boss_scarlet_commander_mograine"; 
    158158    newscript->GetAI = GetAI_boss_scarlet_commander_mograine; 
    159     m_scripts[nrscripts++] = newscript; 
     159    newscript->RegisterSelf(); 
    160160} 
  • trunk/src/bindings/scripts/scripts/zone/scarlet_monastery/boss_scorn.cpp

    r90 r260  
    9797    newscript->Name="boss_scorn"; 
    9898    newscript->GetAI = GetAI_boss_scorn; 
    99     m_scripts[nrscripts++] = newscript; 
     99    newscript->RegisterSelf(); 
    100100} 
  • trunk/src/bindings/scripts/scripts/zone/scholomance/boss_darkmaster_gandling.cpp

    r90 r260  
    189189    newscript->Name="boss_darkmaster_gandling"; 
    190190    newscript->GetAI = GetAI_boss_darkmaster_gandling; 
    191     m_scripts[nrscripts++] = newscript; 
     191    newscript->RegisterSelf(); 
    192192} 
  • trunk/src/bindings/scripts/scripts/zone/scholomance/boss_death_knight_darkreaver.cpp

    r90 r260  
    5656    newscript->Name="boss_death_knight_darkreaver"; 
    5757    newscript->GetAI = GetAI_boss_death_knight_darkreaver; 
    58     m_scripts[nrscripts++] = newscript; 
     58    newscript->RegisterSelf(); 
    5959} 
  • trunk/src/bindings/scripts/scripts/zone/scholomance/boss_doctor_theolen_krastinov.cpp

    r90 r260  
    105105    newscript->Name="boss_doctor_theolen_krastinov"; 
    106106    newscript->GetAI = GetAI_boss_theolenkrastinov; 
    107     m_scripts[nrscripts++] = newscript; 
     107    newscript->RegisterSelf(); 
    108108} 
  • trunk/src/bindings/scripts/scripts/zone/scholomance/boss_illucia_barov.cpp

    r90 r260  
    113113    newscript->Name="boss_illucia_barov"; 
    114114    newscript->GetAI = GetAI_boss_illuciabarov; 
    115     m_scripts[nrscripts++] = newscript; 
     115    newscript->RegisterSelf(); 
    116116} 
  • trunk/src/bindings/scripts/scripts/zone/scholomance/boss_instructor_malicia.cpp

    r90 r260  
    149149    newscript->Name="boss_instructor_malicia"; 
    150150    newscript->GetAI = GetAI_boss_instructormalicia; 
    151     m_scripts[nrscripts++] = newscript; 
     151    newscript->RegisterSelf(); 
    152152} 
  • trunk/src/bindings/scripts/scripts/zone/scholomance/boss_jandice_barov.cpp

    r223 r260  
    213213    newscript->Name="boss_jandice_barov"; 
    214214    newscript->GetAI = GetAI_boss_jandicebarov; 
    215     m_scripts[nrscripts++] = newscript; 
     215    newscript->RegisterSelf(); 
    216216 
    217217    newscript = new Script; 
    218218    newscript->Name="mob_illusionofjandicebarov"; 
    219219    newscript->GetAI = GetAI_mob_illusionofjandicebarov; 
    220     m_scripts[nrscripts++] = newscript; 
     220    newscript->RegisterSelf(); 
    221221} 
  • trunk/src/bindings/scripts/scripts/zone/scholomance/boss_kormok.cpp

    r90 r260  
    152152    newscript->Name="boss_kormok"; 
    153153    newscript->GetAI = GetAI_boss_kormok; 
    154     m_scripts[nrscripts++] = newscript; 
     154    newscript->RegisterSelf(); 
    155155} 
  • trunk/src/bindings/scripts/scripts/zone/scholomance/boss_lord_alexei_barov.cpp

    r90 r260  
    9595    newscript->Name="boss_lord_alexei_barov"; 
    9696    newscript->GetAI = GetAI_boss_lordalexeibarov; 
    97     m_scripts[nrscripts++] = newscript; 
     97    newscript->RegisterSelf(); 
    9898} 
  • trunk/src/bindings/scripts/scripts/zone/scholomance/boss_lorekeeper_polkelt.cpp

    r90 r260  
    110110    newscript->Name="boss_lorekeeper_polkelt"; 
    111111    newscript->GetAI = GetAI_boss_lorekeeperpolkelt; 
    112     m_scripts[nrscripts++] = newscript; 
     112    newscript->RegisterSelf(); 
    113113} 
  • trunk/src/bindings/scripts/scripts/zone/scholomance/boss_ras_frostwhisper.cpp

    r90 r260  
    122122    newscript->Name="boss_boss_ras_frostwhisper"; 
    123123    newscript->GetAI = GetAI_boss_rasfrost; 
    124     m_scripts[nrscripts++] = newscript; 
     124    newscript->RegisterSelf(); 
    125125} 
  • trunk/src/bindings/scripts/scripts/zone/scholomance/boss_the_ravenian.cpp

    r90 r260  
    115115    newscript->Name="boss_the_ravenian"; 
    116116    newscript->GetAI = GetAI_boss_theravenian; 
    117     m_scripts[nrscripts++] = newscript; 
     117    newscript->RegisterSelf(); 
    118118} 
  • trunk/src/bindings/scripts/scripts/zone/scholomance/boss_vectus.cpp

    r90 r260  
    9292    newscript->Name="boss_vectus"; 
    9393    newscript->GetAI = GetAI_boss_vectus; 
    94     m_scripts[nrscripts++] = newscript; 
     94    newscript->RegisterSelf(); 
    9595} 
  • trunk/src/bindings/scripts/scripts/zone/scholomance/instance_scholomance.cpp

    r90 r260  
    9999    newscript->Name = "instance_scholomance"; 
    100100    newscript->GetInstanceData = GetInstanceData_instance_scholomance; 
    101     m_scripts[nrscripts++] = newscript; 
     101    newscript->RegisterSelf(); 
    102102} 
  • trunk/src/bindings/scripts/scripts/zone/searing_gorge/searing_gorge.cpp

    r90 r260  
    144144    newscript->pGossipHello =  &GossipHello_npc_kalaran_windblade; 
    145145    newscript->pGossipSelect = &GossipSelect_npc_kalaran_windblade; 
    146     m_scripts[nrscripts++] = newscript; 
     146    newscript->RegisterSelf(); 
    147147 
    148148    newscript = new Script; 
     
    150150    newscript->pGossipHello          = &GossipHello_npc_lothos_riftwaker; 
    151151    newscript->pGossipSelect         = &GossipSelect_npc_lothos_riftwaker; 
    152     m_scripts[nrscripts++] = newscript; 
     152    newscript->RegisterSelf(); 
    153153 
    154154    newscript = new Script; 
     
    156156    newscript->pGossipHello =  &GossipHello_npc_zamael_lunthistle; 
    157157    newscript->pGossipSelect = &GossipSelect_npc_zamael_lunthistle; 
    158     m_scripts[nrscripts++] = newscript; 
     158    newscript->RegisterSelf(); 
    159159} 
  • trunk/src/bindings/scripts/scripts/zone/shadowfang_keep/instance_shadowfang_keep.cpp

    r90 r260  
    149149    newscript->Name = "instance_shadowfang_keep"; 
    150150    newscript->GetInstanceData = GetInstanceData_instance_shadowfang_keep; 
    151     m_scripts[nrscripts++] = newscript; 
     151    newscript->RegisterSelf(); 
    152152} 
  • trunk/src/bindings/scripts/scripts/zone/shadowfang_keep/shadowfang_keep.cpp

    r90 r260  
    114114    newscript->pGossipSelect = &GossipSelect_npc_shadowfang_prisoner; 
    115115    newscript->GetAI = GetAI_npc_shadowfang_prisoner; 
    116     m_scripts[nrscripts++] = newscript; 
     116    newscript->RegisterSelf(); 
    117117} 
  • trunk/src/bindings/scripts/scripts/zone/shadowmoon_valley/boss_doomwalker.cpp

    r223 r260  
    213213    newscript->Name="boss_doomwalker"; 
    214214    newscript->GetAI = GetAI_boss_doomwalker; 
    215     m_scripts[nrscripts++] = newscript; 
     215    newscript->RegisterSelf(); 
    216216} 
  • trunk/src/bindings/scripts/scripts/zone/shadowmoon_valley/shadowmoon_valley.cpp

    r141 r260  
    11071107    newscript->Name = "mob_mature_netherwing_drake"; 
    11081108    newscript->GetAI = GetAI_mob_mature_netherwing_drake; 
    1109     m_scripts[nrscripts++] = newscript; 
     1109    newscript->RegisterSelf(); 
    11101110 
    11111111    newscript = new Script; 
    11121112    newscript->Name = "mob_enslaved_netherwing_drake"; 
    11131113    newscript->GetAI = GetAI_mob_enslaved_netherwing_drake; 
    1114     m_scripts[nrscripts++] = newscript; 
     1114    newscript->RegisterSelf(); 
    11151115 
    11161116        newscript = new Script; 
    11171117        newscript->Name = "mob_dragonmaw_peon"; 
    11181118        newscript->GetAI = GetAI_mob_dragonmaw_peon; 
    1119         m_scripts[nrscripts++] = newscript; 
     1119        newscript->RegisterSelf(); 
    11201120 
    11211121    newscript = new Script; 
     
    11231123    newscript->pGossipHello =  &GossipHello_npc_drake_dealer_hurlunk; 
    11241124    newscript->pGossipSelect = &GossipSelect_npc_drake_dealer_hurlunk; 
    1125     m_scripts[nrscripts++] = newscript; 
     1125    newscript->RegisterSelf(); 
    11261126 
    11271127    newscript = new Script; 
    11281128    newscript->Name="npc_invis_legion_teleporter"; 
    11291129    newscript->GetAI = GetAI_npc_invis_legion_teleporter; 
    1130     m_scripts[nrscripts++] = newscript; 
     1130    newscript->RegisterSelf(); 
    11311131 
    11321132    newscript = new Script; 
     
    11341134    newscript->pGossipHello =  &GossipHello_npcs_flanis_swiftwing_and_kagrosh; 
    11351135    newscript->pGossipSelect = &GossipSelect_npcs_flanis_swiftwing_and_kagrosh; 
    1136     m_scripts[nrscripts++] = newscript; 
     1136    newscript->RegisterSelf(); 
    11371137 
    11381138    newscript = new Script; 
     
    11401140    newscript->pGossipHello =  &GossipHello_npc_murkblood_overseer; 
    11411141    newscript->pGossipSelect = &GossipSelect_npc_murkblood_overseer; 
    1142     m_scripts[nrscripts++] = newscript; 
     1142    newscript->RegisterSelf(); 
    11431143 
    11441144    newscript = new Script; 
     
    11461146    newscript->pGossipHello =  &GossipHello_npc_neltharaku; 
    11471147    newscript->pGossipSelect = &GossipSelect_npc_neltharaku; 
    1148     m_scripts[nrscripts++] = newscript; 
     1148    newscript->RegisterSelf(); 
    11491149 
    11501150    newscript = new Script; 
    11511151    newscript->Name = "npc_karynaku"; 
    11521152    newscript->pQuestAccept = &QuestAccept_npc_karynaku; 
    1153     m_scripts[nrscripts++] = newscript; 
     1153    newscript->RegisterSelf(); 
    11541154 
    11551155    newscript = new Script; 
     
    11571157    newscript->pGossipHello =  &GossipHello_npc_oronok_tornheart; 
    11581158    newscript->pGossipSelect = &GossipSelect_npc_oronok_tornheart; 
    1159     m_scripts[nrscripts++] = newscript; 
     1159    newscript->RegisterSelf(); 
    11601160 
    11611161        newscript = new Script; 
     
    11631163        newscript->GetAI = GetAI_Overlord_Morghor; 
    11641164        newscript->pQuestAccept = &QuestAccept_Overlord_Morghor; 
    1165         m_scripts[nrscripts++] = newscript; 
     1165        newscript->RegisterSelf(); 
    11661166 
    11671167        newscript = new Script; 
    11681168        newscript->Name = "npc_lord_illidan_stormrage"; 
    11691169        newscript->GetAI = GetAI_Lord_Illidan; 
    1170         m_scripts[nrscripts++] = newscript; 
     1170        newscript->RegisterSelf(); 
    11711171 
    11721172        newscript = new Script; 
     
    11751175        newscript->pGossipHello = &GossipHello_npc_yarzill_fly; 
    11761176        newscript->pGossipSelect = &GossipSelect_npc_yarzill_fly; 
    1177         m_scripts[nrscripts++] = newscript; 
    1178 } 
     1177        newscript->RegisterSelf(); 
     1178} 
  • trunk/src/bindings/scripts/scripts/zone/shattrath/shattrath_city.cpp

    r90 r260  
    415415    newscript->pGossipHello =  &GossipHello_npc_raliq_the_drunk; 
    416416    newscript->pGossipSelect = &GossipSelect_npc_raliq_the_drunk; 
    417     m_scripts[nrscripts++] = newscript; 
     417    newscript->RegisterSelf(); 
    418418 
    419419    newscript = new Script; 
     
    421421    newscript->GetAI = GetAI_npc_salsalabim; 
    422422    newscript->pGossipHello =  &GossipHello_npc_salsalabim; 
    423     m_scripts[nrscripts++] = newscript; 
     423    newscript->RegisterSelf(); 
    424424 
    425425    newscript = new Script; 
     
    427427    newscript->pGossipHello =  &GossipHello_npc_shattrathflaskvendors; 
    428428    newscript->pGossipSelect = &GossipSelect_npc_shattrathflaskvendors; 
    429     m_scripts[nrscripts++] = newscript; 
     429    newscript->RegisterSelf(); 
    430430 
    431431    newscript = new Script; 
     
    433433    newscript->pGossipHello =  &GossipHello_npc_zephyr; 
    434434    newscript->pGossipSelect = &GossipSelect_npc_zephyr; 
    435     m_scripts[nrscripts++] = newscript; 
     435    newscript->RegisterSelf(); 
    436436 
    437437       newscript = new Script; 
    438438    newscript->Name="npc_kservant"; 
    439439    newscript->GetAI = GetAI_npc_kservantAI; 
    440     m_scripts[nrscripts++] = newscript; 
    441 } 
     440    newscript->RegisterSelf(); 
     441} 
  • trunk/src/bindings/scripts/scripts/zone/silithus/silithus.cpp

    r90 r260  
    146146    newscript->pGossipHello =   &GossipHello_npcs_rutgar_and_frankal; 
    147147    newscript->pGossipSelect =  &GossipSelect_npcs_rutgar_and_frankal; 
    148     m_scripts[nrscripts++] = newscript; 
     148    newscript->RegisterSelf(); 
    149149} 
  • trunk/src/bindings/scripts/scripts/zone/silvermoon/silvermoon_city.cpp

    r101 r260  
    100100    newscript->Name="npc_blood_knight_stillblade"; 
    101101    newscript->GetAI = GetAI_npc_blood_knight_stillblade; 
    102     m_scripts[nrscripts++] = newscript; 
     102    newscript->RegisterSelf(); 
    103103} 
  • trunk/src/bindings/scripts/scripts/zone/silverpine_forest/silverpine_forest.cpp

    r90 r260  
    9797    newscript->pGossipSelect = &GossipSelect_npc_astor_hadren; 
    9898    newscript->GetAI = GetAI_npc_astor_hadren; 
    99     m_scripts[nrscripts++] = newscript; 
     99    newscript->RegisterSelf(); 
    100100} 
  • trunk/src/bindings/scripts/scripts/zone/stonetalon_mountains/stonetalon_mountains.cpp

    r90 r260  
    7777    newscript->pGossipHello = &GossipHello_npc_braug_dimspirit; 
    7878    newscript->pGossipSelect = &GossipSelect_npc_braug_dimspirit; 
    79     m_scripts[nrscripts++] = newscript; 
     79    newscript->RegisterSelf(); 
    8080} 
  • trunk/src/bindings/scripts/scripts/zone/stormwind/stormwind_city.cpp

    r90 r260  
    246246    newscript->pGossipHello = &GossipHello_npc_archmage_malin; 
    247247    newscript->pGossipSelect = &GossipSelect_npc_archmage_malin; 
    248     m_scripts[nrscripts++] = newscript; 
     248    newscript->RegisterSelf(); 
    249249 
    250250    newscript = new Script; 
     
    252252    newscript->GetAI = GetAI_npc_bartleby; 
    253253    newscript->pQuestAccept = &QuestAccept_npc_bartleby; 
    254     m_scripts[nrscripts++] = newscript; 
     254    newscript->RegisterSelf(); 
    255255 
    256256    newscript = new Script; 
     
    258258    newscript->GetAI = GetAI_npc_dashel_stonefist; 
    259259    newscript->pQuestAccept = &QuestAccept_npc_dashel_stonefist; 
    260     m_scripts[nrscripts++] = newscript; 
     260    newscript->RegisterSelf(); 
    261261 
    262262    newscript = new Script; 
    263263    newscript->Name = "npc_general_marcus_jonathan"; 
    264264    newscript->pReceiveEmote = &ReceiveEmote_npc_general_marcus_jonathan; 
    265     m_scripts[nrscripts++] = newscript; 
     265    newscript->RegisterSelf(); 
    266266 
    267267    newscript = new Script; 
     
    269269    newscript->pGossipHello = &GossipHello_npc_lady_katrana_prestor; 
    270270    newscript->pGossipSelect = &GossipSelect_npc_lady_katrana_prestor; 
    271     m_scripts[nrscripts++] = newscript; 
    272 } 
     271    newscript->RegisterSelf(); 
     272} 
  • trunk/src/bindings/scripts/scripts/zone/stranglethorn_vale/stranglethorn_vale.cpp

    r90 r260  
    104104    newscript->Name = "mob_yenniku"; 
    105105    newscript->GetAI = GetAI_mob_yenniku; 
    106     m_scripts[nrscripts++] = newscript; 
     106    newscript->RegisterSelf(); 
    107107} 
  • trunk/src/bindings/scripts/scripts/zone/stratholme/boss_baron_rivendare.cpp

    r90 r260  
    212212    newscript->Name="boss_baron_rivendare"; 
    213213    newscript->GetAI = GetAI_boss_baron_rivendare; 
    214     m_scripts[nrscripts++] = newscript; 
     214    newscript->RegisterSelf(); 
    215215} 
  • trunk/src/bindings/scripts/scripts/zone/stratholme/boss_baroness_anastari.cpp

    r90 r260  
    121121    newscript->Name="boss_baroness_anastari"; 
    122122    newscript->GetAI = GetAI_boss_baroness_anastari; 
    123     m_scripts[nrscripts++] = newscript; 
     123    newscript->RegisterSelf(); 
    124124} 
  • trunk/src/bindings/scripts/scripts/zone/stratholme/boss_cannon_master_willey.cpp

    r90 r260  
    218218    newscript->Name="boss_cannon_master_willey"; 
    219219    newscript->GetAI = GetAI_boss_cannon_master_willey; 
    220     m_scripts[nrscripts++] = newscript; 
     220    newscript->RegisterSelf(); 
    221221} 
  • trunk/src/bindings/scripts/scripts/zone/stratholme/boss_dathrohan_balnazzar.cpp

    r90 r260  
    313313    newscript->Name="boss_dathrohan_balnazzar"; 
    314314    newscript->GetAI = GetAI_boss_dathrohan_balnazzar; 
    315     m_scripts[nrscripts++] = newscript; 
     315    newscript->RegisterSelf(); 
    316316} 
  • trunk/src/bindings/scripts/scripts/zone/stratholme/boss_magistrate_barthilas.cpp

    r90 r260  
    111111    newscript->Name="boss_magistrate_barthilas"; 
    112112    newscript->GetAI = GetAI_boss_magistrate_barthilas; 
    113     m_scripts[nrscripts++] = newscript; 
     113    newscript->RegisterSelf(); 
    114114} 
  • trunk/src/bindings/scripts/scripts/zone/stratholme/boss_maleki_the_pallid.cpp

    r90 r260  
    116116    newscript->Name="boss_maleki_the_pallid"; 
    117117    newscript->GetAI = GetAI_boss_maleki_the_pallid; 
    118     m_scripts[nrscripts++] = newscript; 
     118    newscript->RegisterSelf(); 
    119119} 
  • trunk/src/bindings/scripts/scripts/zone/stratholme/boss_nerubenkan.cpp

    r90 r260  
    135135    newscript->Name="boss_nerubenkan"; 
    136136    newscript->GetAI = GetAI_boss_nerubenkan; 
    137     m_scripts[nrscripts++] = newscript; 
     137    newscript->RegisterSelf(); 
    138138} 
  • trunk/src/bindings/scripts/scripts/zone/stratholme/boss_order_of_silver_hand.cpp

    r90 r260  
    158158    newscript->Name="boss_silver_hand_bosses"; 
    159159    newscript->GetAI = GetAI_boss_silver_hand_bossesAI; 
    160     m_scripts[nrscripts++] = newscript; 
     160    newscript->RegisterSelf(); 
    161161} 
  • trunk/src/bindings/scripts/scripts/zone/stratholme/boss_postmaster_malown.cpp

    r90 r260  
    141141    newscript->Name="boss_postmaster_malown"; 
    142142    newscript->GetAI = GetAI_boss_postmaster_malown; 
    143     m_scripts[nrscripts++] = newscript; 
     143    newscript->RegisterSelf(); 
    144144} 
  • trunk/src/bindings/scripts/scripts/zone/stratholme/boss_ramstein_the_gorger.cpp

    r90 r260  
    8989    newscript->Name="boss_ramstein_the_gorger"; 
    9090    newscript->GetAI = GetAI_boss_ramstein_the_gorger; 
    91     m_scripts[nrscripts++] = newscript; 
     91    newscript->RegisterSelf(); 
    9292} 
  • trunk/src/bindings/scripts/scripts/zone/stratholme/boss_timmy_the_cruel.cpp

    r229 r260  
    9797    newscript->Name="boss_timmy_the_cruel"; 
    9898    newscript->GetAI = GetAI_boss_timmy_the_cruel; 
    99     m_scripts[nrscripts++] = newscript; 
     99    newscript->RegisterSelf(); 
    100100} 
  • trunk/src/bindings/scripts/scripts/zone/stratholme/instance_stratholme.cpp

    r90 r260  
    7474    newscript->Name = "instance_stratholme"; 
    7575    newscript->GetInstanceData = GetInstanceData_instance_stratholme; 
    76     m_scripts[nrscripts++] = newscript; 
     76    newscript->RegisterSelf(); 
    7777} 
  • trunk/src/bindings/scripts/scripts/zone/stratholme/stratholme.cpp

    r90 r260  
    311311    newscript->Name="mob_freed_soul"; 
    312312    newscript->GetAI = GetAI_mob_freed_soul; 
    313     m_scripts[nrscripts++] = newscript; 
     313    newscript->RegisterSelf(); 
    314314 
    315315    newscript = new Script; 
    316316    newscript->Name="mob_restless_soul"; 
    317317    newscript->GetAI = GetAI_mob_restless_soul; 
    318     m_scripts[nrscripts++] = newscript; 
     318    newscript->RegisterSelf(); 
    319319 
    320320    newscript = new Script; 
     
    322322    newscript->GetAI = GetAI_mobs_spectral_ghostly_citizen; 
    323323    newscript->pReceiveEmote = &ReciveEmote_mobs_spectral_ghostly_citizen; 
    324     m_scripts[nrscripts++] = newscript; 
     324    newscript->RegisterSelf(); 
    325325 
    326326    newscript = new Script; 
    327327    newscript->Name="mob_mindless_skeleton"; 
    328328    newscript->GetAI = GetAI_mob_mindless_skeleton; 
    329     m_scripts[nrscripts++] = newscript; 
     329    newscript->RegisterSelf(); 
    330330 
    331331    newscript = new Script; 
    332332    newscript->Name="mob_thuzadin_acolyte"; 
    333333    newscript->GetAI = GetAI_mob_thuzadin_acolyte; 
    334     m_scripts[nrscripts++] = newscript; 
    335 } 
     334    newscript->RegisterSelf(); 
     335} 
  • trunk/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_brutallus.cpp

    r141 r260  
    179179    newscript->Name="boss_brutallus"; 
    180180    newscript->GetAI = GetAI_boss_brutallus; 
    181     m_scripts[nrscripts++] = newscript; 
     181    newscript->RegisterSelf(); 
    182182} 
  • trunk/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_eredar_twins.cpp

    r229 r260  
    762762    newscript->Name="boss_sacrolash"; 
    763763    newscript->GetAI = GetAI_boss_sacrolash; 
    764     m_scripts[nrscripts++] = newscript; 
     764    newscript->RegisterSelf(); 
    765765 
    766766    newscript = new Script; 
    767767    newscript->Name="boss_alythess"; 
    768768    newscript->GetAI = GetAI_boss_alythess; 
    769     m_scripts[nrscripts++] = newscript; 
     769    newscript->RegisterSelf(); 
    770770 
    771771    newscript = new Script; 
    772772    newscript->Name="mob_shadow_image"; 
    773773    newscript->GetAI = GetAI_mob_shadow_image; 
    774     m_scripts[nrscripts++] = newscript; 
     774    newscript->RegisterSelf(); 
    775775} 
  • trunk/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_felmyst.cpp

    r257 r260  
    575575    newscript->Name="boss_felmyst"; 
    576576    newscript->GetAI = GetAI_boss_felmyst; 
    577     m_scripts[nrscripts++] = newscript; 
     577    newscript->RegisterSelf(); 
    578578 
    579579    newscript = new Script; 
    580580    newscript->Name="mob_felmyst_vapor"; 
    581581    newscript->GetAI = GetAI_mob_felmyst_vapor; 
    582     m_scripts[nrscripts++] = newscript; 
     582    newscript->RegisterSelf(); 
    583583 
    584584    newscript = new Script; 
    585585    newscript->Name="mob_felmyst_trail"; 
    586586    newscript->GetAI = GetAI_mob_felmyst_trail; 
    587     m_scripts[nrscripts++] = newscript; 
     587    newscript->RegisterSelf(); 
    588588} 
  • trunk/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_kalecgos.cpp

    r257 r260  
    681681    newscript->Name="boss_kalecgos"; 
    682682    newscript->GetAI = GetAI_boss_kalecgos; 
    683     m_scripts[nrscripts++] = newscript; 
     683    newscript->RegisterSelf(); 
    684684 
    685685    newscript = new Script; 
    686686    newscript->Name="boss_sathrovarr"; 
    687687    newscript->GetAI = GetAI_boss_Sathrovarr; 
    688     m_scripts[nrscripts++] = newscript; 
     688    newscript->RegisterSelf(); 
    689689 
    690690    newscript = new Script; 
    691691    newscript->Name="boss_kalec"; 
    692692    newscript->GetAI = GetAI_boss_kalec; 
    693     m_scripts[nrscripts++] = newscript; 
     693    newscript->RegisterSelf(); 
    694694 
    695695    newscript = new Script; 
    696696    newscript->Name="kalocegos_teleporter"; 
    697697    newscript->pGOHello = &GOkalocegos_teleporter; 
    698     m_scripts[nrscripts++] = newscript; 
     698    newscript->RegisterSelf(); 
    699699} 
  • trunk/src/bindings/scripts/scripts/zone/sunwell_plateau/instance_sunwell_plateau.cpp

    r239 r260  
    193193    newscript->Name = "instance_sunwell_plateau"; 
    194194    newscript->GetInstanceData = GetInstanceData_instance_sunwell_plateau; 
    195     m_scripts[nrscripts++] = newscript; 
     195    newscript->RegisterSelf(); 
    196196} 
  • trunk/src/bindings/scripts/scripts/zone/tanaris/tanaris.cpp

    r90 r260  
    375375    newscript->Name="mob_aquementas"; 
    376376    newscript->GetAI = GetAI_mob_aquementas; 
    377     m_scripts[nrscripts++] = newscript; 
     377    newscript->RegisterSelf(); 
    378378 
    379379    newscript = new Script; 
    380380    newscript->Name="npc_custodian_of_time"; 
    381381    newscript->GetAI = GetAI_npc_custodian_of_time; 
    382     m_scripts[nrscripts++] = newscript; 
     382    newscript->RegisterSelf(); 
    383383 
    384384    newscript = new Script; 
     
    386386    newscript->pGossipHello =  &GossipHello_npc_marin_noggenfogger; 
    387387    newscript->pGossipSelect = &GossipSelect_npc_marin_noggenfogger; 
    388     m_scripts[nrscripts++] = newscript; 
     388    newscript->RegisterSelf(); 
    389389 
    390390    newscript = new Script; 
     
    393393    newscript->pGossipSelect = &GossipSelect_npc_steward_of_time; 
    394394    newscript->pQuestAccept =  &QuestAccept_npc_steward_of_time; 
    395     m_scripts[nrscripts++] = newscript; 
     395    newscript->RegisterSelf(); 
    396396 
    397397    newscript = new Script; 
     
    399399    newscript->pGossipHello =  &GossipHello_npc_stone_watcher_of_norgannon; 
    400400    newscript->pGossipSelect = &GossipSelect_npc_stone_watcher_of_norgannon; 
    401     m_scripts[nrscripts++] = newscript; 
    402 } 
     401    newscript->RegisterSelf(); 
     402} 
  • trunk/src/bindings/scripts/scripts/zone/tempest_keep/arcatraz/arcatraz.cpp

    r229 r260  
    576576    newscript->Name="npc_millhouse_manastorm"; 
    577577    newscript->GetAI = GetAI_npc_millhouse_manastorm; 
    578     m_scripts[nrscripts++] = newscript; 
     578    newscript->RegisterSelf(); 
    579579 
    580580    newscript = new Script; 
    581581    newscript->Name="npc_warden_mellichar"; 
    582582    newscript->GetAI = GetAI_npc_warden_mellichar; 
    583     m_scripts[nrscripts++] = newscript; 
     583    newscript->RegisterSelf(); 
    584584 
    585585    newscript = new Script; 
    586586    newscript->Name="mob_zerekethvoidzone"; 
    587587    newscript->GetAI = GetAI_mob_zerekethvoidzoneAI; 
    588     m_scripts[nrscripts++] = newscript; 
     588    newscript->RegisterSelf(); 
    589589} 
  • trunk/src/bindings/scripts/scripts/zone/tempest_keep/arcatraz/boss_harbinger_skyriss.cpp

    r229 r260  
    368368    newscript->Name="boss_harbinger_skyriss"; 
    369369    newscript->GetAI = GetAI_boss_harbinger_skyriss; 
    370     m_scripts[nrscripts++] = newscript; 
     370    newscript->RegisterSelf(); 
    371371 
    372372    newscript = new Script; 
    373373    newscript->Name="boss_harbinger_skyriss_illusion"; 
    374374    newscript->GetAI = GetAI_boss_harbinger_skyriss_illusion; 
    375     m_scripts[nrscripts++] = newscript; 
     375    newscript->RegisterSelf(); 
    376376} 
  • trunk/src/bindings/scripts/scripts/zone/tempest_keep/arcatraz/instance_arcatraz.cpp

    r90 r260  
    221221    newscript->Name = "instance_arcatraz"; 
    222222    newscript->GetInstanceData = GetInstanceData_instance_arcatraz; 
    223     m_scripts[nrscripts++] = newscript; 
     223    newscript->RegisterSelf(); 
    224224} 
  • trunk/src/bindings/scripts/scripts/zone/tempest_keep/botanica/boss_high_botanist_freywinn.cpp

    r90 r260  
    212212    newscript->Name="boss_high_botanist_freywinn"; 
    213213    newscript->GetAI = GetAI_boss_high_botanist_freywinn; 
    214     m_scripts[nrscripts++] = newscript; 
     214    newscript->RegisterSelf(); 
    215215} 
  • trunk/src/bindings/scripts/scripts/zone/tempest_keep/botanica/boss_laj.cpp

    r90 r260  
    195195    newscript->Name="boss_laj"; 
    196196    newscript->GetAI = GetAI_boss_laj; 
    197     m_scripts[nrscripts++] = newscript; 
     197    newscript->RegisterSelf(); 
    198198} 
  • trunk/src/bindings/scripts/scripts/zone/tempest_keep/botanica/boss_warp_splinter.cpp

    r223 r260  
    294294    newscript->Name="boss_warp_splinter"; 
    295295    newscript->GetAI = GetAI_boss_warp_splinter; 
    296     m_scripts[nrscripts++] = newscript; 
     296    newscript->RegisterSelf(); 
    297297 
    298298    newscript = new Script; 
    299299    newscript->Name="mob_warp_splinter_treant"; 
    300300    newscript->GetAI = GetAI_mob_treant; 
    301     m_scripts[nrscripts++] = newscript; 
     301    newscript->RegisterSelf(); 
    302302} 
  • trunk/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/boss_alar.cpp

    r158 r260  
    506506    newscript->Name="boss_alar"; 
    507507    newscript->GetAI = GetAI_boss_alar; 
    508     m_scripts[nrscripts++] = newscript; 
     508    newscript->RegisterSelf(); 
    509509 
    510510    newscript = new Script; 
    511511    newscript->Name="mob_ember_of_alar"; 
    512512    newscript->GetAI = GetAI_mob_ember_of_alar; 
    513     m_scripts[nrscripts++] = newscript; 
     513    newscript->RegisterSelf(); 
    514514 
    515515    newscript = new Script; 
    516516    newscript->Name="mob_flame_patch_alar"; 
    517517    newscript->GetAI = GetAI_mob_flame_patch_alar; 
    518     m_scripts[nrscripts++] = newscript; 
     518    newscript->RegisterSelf(); 
    519519} 
  • trunk/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/boss_astromancer.cpp

    r204 r260  
    537537    newscript->Name="boss_high_astromancer_solarian"; 
    538538    newscript->GetAI = GetAI_boss_high_astromancer_solarian; 
    539     m_scripts[nrscripts++] = newscript; 
     539    newscript->RegisterSelf(); 
    540540 
    541541    newscript = new Script; 
    542542    newscript->Name="mob_solarium_priest"; 
    543543    newscript->GetAI = GetAI_mob_solarium_priest; 
    544     m_scripts[nrscripts++] = newscript; 
     544    newscript->RegisterSelf(); 
    545545} 
  • trunk/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/boss_kaelthas.cpp

    r229 r260  
    15821582    newscript->Name="boss_kaelthas"; 
    15831583    newscript->GetAI = GetAI_boss_kaelthas; 
    1584     m_scripts[nrscripts++] = newscript; 
     1584    newscript->RegisterSelf(); 
    15851585 
    15861586    newscript = new Script; 
    15871587    newscript->Name="boss_thaladred_the_darkener"; 
    15881588    newscript->GetAI = GetAI_boss_thaladred_the_darkener; 
    1589     m_scripts[nrscripts++] = newscript; 
     1589    newscript->RegisterSelf(); 
    15901590 
    15911591    newscript = new Script; 
    15921592    newscript->Name="boss_lord_sanguinar"; 
    15931593    newscript->GetAI = GetAI_boss_lord_sanguinar; 
    1594     m_scripts[nrscripts++] = newscript; 
     1594    newscript->RegisterSelf(); 
    15951595 
    15961596    newscript = new Script; 
    15971597    newscript->Name="boss_grand_astromancer_capernian"; 
    15981598    newscript->GetAI = GetAI_boss_grand_astromancer_capernian; 
    1599     m_scripts[nrscripts++] = newscript; 
     1599    newscript->RegisterSelf(); 
    16001600 
    16011601    newscript = new Script; 
    16021602    newscript->Name="boss_master_engineer_telonicus"; 
    16031603    newscript->GetAI = GetAI_boss_master_engineer_telonicus; 
    1604     m_scripts[nrscripts++] = newscript; 
     1604    newscript->RegisterSelf(); 
    16051605 
    16061606    newscript = new Script; 
    16071607    newscript->Name= "mob_kael_flamestrike"; 
    16081608    newscript->GetAI = GetAI_mob_kael_flamestrike; 
    1609     m_scripts[nrscripts++] = newscript; 
     1609    newscript->RegisterSelf(); 
    16101610 
    16111611    newscript = new Script; 
    16121612    newscript->Name="mob_phoenix"; 
    16131613    newscript->GetAI = GetAI_mob_phoenix; 
    1614     m_scripts[nrscripts++] = newscript; 
     1614    newscript->RegisterSelf(); 
    16151615} 
  • trunk/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/boss_void_reaver.cpp

    r204 r260  
    196196    newscript->Name="boss_void_reaver"; 
    197197    newscript->GetAI = GetAI_boss_void_reaver; 
    198     m_scripts[nrscripts++] = newscript; 
     198    newscript->RegisterSelf(); 
    199199} 
  • trunk/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/instance_the_eye.cpp

    r204 r260  
    173173    newscript->Name = "instance_the_eye"; 
    174174    newscript->GetInstanceData = GetInstanceData_instance_the_eye; 
    175     m_scripts[nrscripts++] = newscript; 
     175    newscript->RegisterSelf(); 
    176176} 
  • trunk/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/the_eye.cpp

    r90 r260  
    9595    newscript->Name="mob_crystalcore_devastator"; 
    9696    newscript->GetAI = GetAI_mob_crystalcore_devastator; 
    97     m_scripts[nrscripts++] = newscript; 
     97    newscript->RegisterSelf(); 
    9898} 
  • trunk/src/bindings/scripts/scripts/zone/tempest_keep/the_mechanar/boss_gatewatcher_ironhand.cpp

    r223 r260  
    158158    newscript->Name="boss_gatewatcher_iron_hand";     
    159159    newscript->GetAI = GetAI_boss_gatewatcher_iron_hand;     
    160     m_scripts[nrscripts++] = newscript; 
     160    newscript->RegisterSelf(); 
    161161} 
  • trunk/src/bindings/scripts/scripts/zone/tempest_keep/the_mechanar/boss_nethermancer_sepethrea.cpp

    r223 r260  
    278278    newscript->Name="boss_nethermancer_sepethrea";     
    279279    newscript->GetAI = GetAI_boss_nethermancer_sepethrea;     
    280     m_scripts[nrscripts++] = newscript; 
     280    newscript->RegisterSelf(); 
    281281 
    282282    newscript = new Script;     
    283283    newscript->Name="mob_ragin_flames";     
    284284    newscript->GetAI = GetAI_mob_ragin_flames;     
    285     m_scripts[nrscripts++] = newscript; 
     285    newscript->RegisterSelf(); 
    286286} 
  • trunk/src/bindings/scripts/scripts/zone/tempest_keep/the_mechanar/boss_pathaleon_the_calculator.cpp

    r223 r260  
    298298    newscript->Name="boss_pathaleon_the_calculator";     
    299299    newscript->GetAI = GetAI_boss_pathaleon_the_calculator;     
    300     m_scripts[nrscripts++] = newscript; 
     300    newscript->RegisterSelf(); 
    301301 
    302302    newscript = new Script;     
    303303    newscript->Name="mob_nether_wraith";     
    304304    newscript->GetAI = GetAI_mob_nether_wraith;     
    305     m_scripts[nrscripts++] = newscript; 
     305    newscript->RegisterSelf(); 
    306306} 
  • trunk/src/bindings/scripts/scripts/zone/tempest_keep/the_mechanar/instance_mechanar.cpp

    r223 r260  
    8787    newscript->Name = "instance_mechanar"; 
    8888    newscript->GetInstanceData = GetInstanceData_instance_mechanar; 
    89     m_scripts[nrscripts++] = newscript; 
     89    newscript->RegisterSelf(); 
    9090} 
  • trunk/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_bug_trio.cpp

    r109 r260  
    335335    newscript->Name="boss_kri"; 
    336336    newscript->GetAI = GetAI_boss_kri; 
    337     m_scripts[nrscripts++] = newscript; 
     337    newscript->RegisterSelf(); 
    338338 
    339339    newscript = new Script; 
    340340    newscript->Name="boss_vem"; 
    341341    newscript->GetAI = GetAI_boss_vem; 
    342     m_scripts[nrscripts++] = newscript; 
     342    newscript->RegisterSelf(); 
    343343 
    344344    newscript = new Script; 
    345345    newscript->Name="boss_yauj"; 
    346346    newscript->GetAI = GetAI_boss_yauj; 
    347     m_scripts[nrscripts++] = newscript; 
     347    newscript->RegisterSelf(); 
    348348} 
  • trunk/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_cthun.cpp

    r257 r260  
    13301330    newscript->Name="boss_eye_of_cthun"; 
    13311331    newscript->GetAI = GetAI_eye_of_cthun; 
    1332     m_scripts[nrscripts++] = newscript; 
     1332    newscript->RegisterSelf(); 
    13331333 
    13341334    newscript = new Script; 
    13351335    newscript->Name="boss_cthun"; 
    13361336    newscript->GetAI = GetAI_cthun; 
    1337     m_scripts[nrscripts++] = newscript; 
     1337    newscript->RegisterSelf(); 
    13381338 
    13391339    newscript = new Script; 
    13401340    newscript->Name="mob_eye_tentacle"; 
    13411341    newscript->GetAI = GetAI_eye_tentacle; 
    1342     m_scripts[nrscripts++] = newscript; 
     1342    newscript->RegisterSelf(); 
    13431343 
    13441344    newscript = new Script; 
    13451345    newscript->Name="mob_claw_tentacle"; 
    13461346    newscript->GetAI = GetAI_claw_tentacle; 
    1347     m_scripts[nrscripts++] = newscript; 
     1347    newscript->RegisterSelf(); 
    13481348 
    13491349    newscript = new Script; 
    13501350    newscript->Name="mob_giant_claw_tentacle"; 
    13511351    newscript->GetAI = GetAI_giant_claw_tentacle; 
    1352     m_scripts[nrscripts++] = newscript; 
     1352    newscript->RegisterSelf(); 
    13531353 
    13541354    newscript = new Script; 
    13551355    newscript->Name="mob_giant_eye_tentacle"; 
    13561356    newscript->GetAI = GetAI_giant_eye_tentacle; 
    1357     m_scripts[nrscripts++] = newscript; 
     1357    newscript->RegisterSelf(); 
    13581358 
    13591359    newscript = new Script; 
    13601360    newscript->Name="mob_giant_flesh_tentacle"; 
    13611361    newscript->GetAI = GetAI_flesh_tentacle; 
    1362     m_scripts[nrscripts++] = newscript; 
     1362    newscript->RegisterSelf(); 
    13631363} 
  • trunk/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_fankriss.cpp

    r90 r260  
    187187    newscript->Name="boss_fankriss"; 
    188188    newscript->GetAI = GetAI_boss_fankriss; 
    189     m_scripts[nrscripts++] = newscript; 
     189    newscript->RegisterSelf(); 
    190190} 
  • trunk/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_huhuran.cpp

    r90 r260  
    140140    newscript->Name="boss_huhuran"; 
    141141    newscript->GetAI = GetAI_boss_huhuran; 
    142     m_scripts[nrscripts++] = newscript; 
     142    newscript->RegisterSelf(); 
    143143} 
  • trunk/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_ouro.cpp

    r90 r260  
    137137    newscript->Name="boss_ouro"; 
    138138    newscript->GetAI = GetAI_boss_ouro; 
    139     m_scripts[nrscripts++] = newscript; 
     139    newscript->RegisterSelf(); 
    140140} 
  • trunk/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_sartura.cpp

    r223 r260  
    260260    newscript->Name="boss_sartura"; 
    261261    newscript->GetAI = GetAI_boss_sartura; 
    262     m_scripts[nrscripts++] = newscript; 
     262    newscript->RegisterSelf(); 
    263263 
    264264    newscript = new Script; 
    265265    newscript->Name="mob_sartura_royal_guard"; 
    266266    newscript->GetAI = GetAI_mob_sartura_royal_guard; 
    267     m_scripts[nrscripts++] = newscript; 
     267    newscript->RegisterSelf(); 
    268268} 
  • trunk/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_skeram.cpp

    r158 r260  
    311311    newscript->Name="boss_skeram"; 
    312312    newscript->GetAI = GetAI_boss_skeram; 
    313     m_scripts[nrscripts++] = newscript; 
     313    newscript->RegisterSelf(); 
    314314} 
  • trunk/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_twinemperors.cpp

    r229 r260  
    690690    newscript->Name="boss_veknilash"; 
    691691    newscript->GetAI = GetAI_boss_veknilash; 
    692     m_scripts[nrscripts++] = newscript; 
     692    newscript->RegisterSelf(); 
    693693 
    694694    newscript = new Script; 
    695695    newscript->Name="boss_veklor"; 
    696696    newscript->GetAI = GetAI_boss_veklor; 
    697     m_scripts[nrscripts++] = newscript; 
     697    newscript->RegisterSelf(); 
    698698} 
  • trunk/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/instance_temple_of_ahnqiraj.cpp

    r90 r260  
    162162    newscript->Name = "instance_temple_of_ahnqiraj"; 
    163163    newscript->GetInstanceData = GetInstanceData_instance_temple_of_ahnqiraj; 
    164     m_scripts[nrscripts++] = newscript; 
     164    newscript->RegisterSelf(); 
    165165} 
  • trunk/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/mob_anubisath_sentinel.cpp

    r90 r260  
    310310    newscript->Name="mob_anubisath_sentinel"; 
    311311    newscript->GetAI = GetAI_mob_anubisath_sentinelAI; 
    312     m_scripts[nrscripts++] = newscript; 
     312    newscript->RegisterSelf(); 
    313313} 
    314314 
  • trunk/src/bindings/scripts/scripts/zone/terokkar_forest/terokkar_forest.cpp

    r90 r260  
    369369    newscript->Name="mob_unkor_the_ruthless"; 
    370370    newscript->GetAI = GetAI_mob_unkor_the_ruthless; 
    371     m_scripts[nrscripts++] = newscript; 
     371    newscript->RegisterSelf(); 
    372372 
    373373    newscript = new Script; 
    374374    newscript->Name="mob_infested_root_walker"; 
    375375    newscript->GetAI = GetAI_mob_infested_root_walker; 
    376     m_scripts[nrscripts++] = newscript; 
     376    newscript->RegisterSelf(); 
    377377 
    378378    newscript = new Script; 
    379379    newscript->Name="mob_rotting_forest_rager"; 
    380380    newscript->GetAI = GetAI_mob_rotting_forest_rager; 
    381     m_scripts[nrscripts++] = newscript; 
     381    newscript->RegisterSelf(); 
    382382 
    383383    newscript = new Script; 
    384384    newscript->Name="mob_netherweb_victim"; 
    385385    newscript->GetAI = GetAI_mob_netherweb_victim; 
    386     m_scripts[nrscripts++] = newscript; 
     386    newscript->RegisterSelf(); 
    387387 
    388388    newscript = new Script; 
     
    390390    newscript->pGossipHello =  &GossipHello_npc_floon; 
    391391    newscript->pGossipSelect = &GossipSelect_npc_floon; 
    392     m_scripts[nrscripts++] = newscript; 
     392    newscript->RegisterSelf(); 
    393393 
    394394    newscript = new Script; 
     
    396396    newscript->pGossipHello =  &GossipHello_npc_skyguard_handler_deesak; 
    397397    newscript->pGossipSelect = &GossipSelect_npc_skyguard_handler_deesak; 
    398     m_scripts[nrscripts++] = newscript; 
    399 } 
     398    newscript->RegisterSelf(); 
     399} 
  • trunk/src/bindings/scripts/scripts/zone/thunder_bluff/thunder_bluff.cpp

    r90 r260  
    133133    newscript->pGossipHello = &GossipHello_npc_cairne_bloodhoof; 
    134134    newscript->pGossipSelect = &GossipSelect_npc_cairne_bloodhoof; 
    135     m_scripts[nrscripts++] = newscript; 
     135    newscript->RegisterSelf(); 
    136136} 
  • trunk/src/bindings/scripts/scripts/zone/tirisfal_glades/tirisfal_glades.cpp

    r90 r260  
    8585    newscript->GetAI = GetAI_npc_calvin_montague; 
    8686    newscript->pQuestAccept = &QuestAccept_npc_calvin_montague; 
    87     m_scripts[nrscripts++] = newscript; 
     87    newscript->RegisterSelf(); 
    8888} 
  • trunk/src/bindings/scripts/scripts/zone/uldaman/boss_ironaya.cpp

    r90 r260  
    104104    newscript->Name="boss_ironaya"; 
    105105    newscript->GetAI = GetAI_boss_ironaya; 
    106     m_scripts[nrscripts++] = newscript; 
     106    newscript->RegisterSelf(); 
    107107} 
  • trunk/src/bindings/scripts/scripts/zone/uldaman/uldaman.cpp

    r90 r260  
    178178    newscript->Name="mob_jadespine_basilisk"; 
    179179    newscript->GetAI = GetAI_mob_jadespine_basilisk; 
    180     m_scripts[nrscripts++] = newscript; 
     180    newscript->RegisterSelf(); 
    181181 
    182182    newscript = new Script; 
     
    184184    newscript->pGossipHello = &GossipHello_npc_lore_keeper_of_norgannon; 
    185185    newscript->pGossipSelect = &GossipSelect_npc_lore_keeper_of_norgannon; 
    186     m_scripts[nrscripts++] = newscript; 
     186    newscript->RegisterSelf(); 
    187187} 
  • trunk/src/bindings/scripts/scripts/zone/undercity/undercity.cpp

    r90 r260  
    246246    newscript->GetAI = GetAI_npc_lady_sylvanas_windrunner; 
    247247    newscript->pChooseReward = &ChooseReward_npc_lady_sylvanas_windrunner; 
    248     m_scripts[nrscripts++] = newscript; 
     248    newscript->RegisterSelf(); 
    249249 
    250250    newscript = new Script; 
    251251    newscript->Name="npc_highborne_lamenter"; 
    252252    newscript->GetAI = GetAI_npc_highborne_lamenter; 
    253     m_scripts[nrscripts++] = newscript; 
     253    newscript->RegisterSelf(); 
    254254 
    255255    newscript = new Script; 
     
    257257    newscript->pGossipHello = &GossipHello_npc_parqual_fintallas; 
    258258    newscript->pGossipSelect = &GossipSelect_npc_parqual_fintallas; 
    259     m_scripts[nrscripts++] = newscript; 
    260 } 
     259    newscript->RegisterSelf(); 
     260} 
  • trunk/src/bindings/scripts/scripts/zone/western_plaguelands/western_plaguelands.cpp

    r90 r260  
    168168    newscript->pGossipHello = &GossipHello_npcs_dithers_and_arbington; 
    169169    newscript->pGossipSelect = &GossipSelect_npcs_dithers_and_arbington; 
    170     m_scripts[nrscripts++] = newscript; 
     170    newscript->RegisterSelf(); 
    171171 
    172172    newscript = new Script; 
    173173    newscript->Name="npc_the_scourge_cauldron"; 
    174174    newscript->GetAI = GetAI_npc_the_scourge_cauldron; 
    175     m_scripts[nrscripts++] = newscript; 
     175    newscript->RegisterSelf(); 
    176176} 
  • trunk/src/bindings/scripts/scripts/zone/winterspring/winterspring.cpp

    r90 r260  
    142142    newscript->pGossipHello =  &GossipHello_npc_lorax; 
    143143    newscript->pGossipSelect = &GossipSelect_npc_lorax; 
    144     m_scripts[nrscripts++] = newscript; 
     144    newscript->RegisterSelf(); 
    145145 
    146146    newscript = new Script; 
     
    148148    newscript->pGossipHello =  &GossipHello_npc_rivern_frostwind; 
    149149    newscript->pGossipSelect = &GossipSelect_npc_rivern_frostwind; 
    150     m_scripts[nrscripts++] = newscript; 
     150    newscript->RegisterSelf(); 
    151151 
    152152    newscript = new Script; 
     
    154154    newscript->pGossipHello =  &GossipHello_npc_witch_doctor_mauari; 
    155155    newscript->pGossipSelect = &GossipSelect_npc_witch_doctor_mauari; 
    156     m_scripts[nrscripts++] = newscript; 
     156    newscript->RegisterSelf(); 
    157157} 
  • trunk/src/bindings/scripts/scripts/zone/zangarmarsh/zangarmarsh.cpp

    r90 r260  
    262262    newscript->pGossipHello =  &GossipHello_npcs_ashyen_and_keleth; 
    263263    newscript->pGossipSelect = &GossipSelect_npcs_ashyen_and_keleth; 
    264     m_scripts[nrscripts++] = newscript; 
     264    newscript->RegisterSelf(); 
    265265 
    266266    newscript = new Script; 
     
    268268    newscript->pGossipHello =  &GossipHello_npc_cooshcoosh; 
    269269    newscript->pGossipSelect = &GossipSelect_npc_cooshcoosh; 
    270     m_scripts[nrscripts++] = newscript; 
     270    newscript->RegisterSelf(); 
    271271 
    272272    newscript = new Script; 
     
    274274    newscript->pGossipHello =  &GossipHello_npc_elder_kuruti; 
    275275    newscript->pGossipSelect = &GossipSelect_npc_elder_kuruti; 
    276     m_scripts[nrscripts++] = newscript; 
     276    newscript->RegisterSelf(); 
    277277 
    278278    newscript = new Script; 
     
    280280    newscript->pGossipHello =  &GossipHello_npc_mortog_steamhead; 
    281281    newscript->pGossipSelect = &GossipSelect_npc_mortog_steamhead; 
    282     m_scripts[nrscripts++] = newscript; 
    283 } 
     282    newscript->RegisterSelf(); 
     283} 
  • trunk/src/bindings/scripts/scripts/zone/zulaman/boss_akilzon.cpp

    r154 r260  
    462462    newscript->Name="boss_akilzon"; 
    463463    newscript->GetAI = GetAI_boss_akilzon; 
    464     m_scripts[nrscripts++] = newscript; 
     464    newscript->RegisterSelf(); 
    465465 
    466466    newscript = new Script; 
    467467    newscript->Name="mob_akilzon_eagle"; 
    468468    newscript->GetAI = GetAI_mob_soaring_eagle; 
    469     m_scripts[nrscripts++] = newscript; 
     469    newscript->RegisterSelf(); 
    470470} 
  • trunk/src/bindings/scripts/scripts/zone/zulaman/boss_halazzi.cpp

    r154 r260  
    395395    newscript->Name="boss_halazzi"; 
    396396    newscript->GetAI = GetAI_boss_halazziAI; 
    397     m_scripts[nrscripts++] = newscript; 
     397    newscript->RegisterSelf(); 
    398398 
    399399    newscript = new Script; 
    400400    newscript->Name="mob_halazzi_lynx"; 
    401401    newscript->GetAI = GetAI_boss_spiritlynxAI; 
    402     m_scripts[nrscripts++] = newscript; 
     402    newscript->RegisterSelf(); 
    403403} 
  • trunk/src/bindings/scripts/scripts/zone/zulaman/boss_hexlord.cpp

    r257 r260  
    869869    newscript->Name="boss_hexlord_malacrass"; 
    870870    newscript->GetAI = GetAI_boss_hex_lord_malacrass; 
    871     m_scripts[nrscripts++] = newscript; 
     871    newscript->RegisterSelf(); 
    872872 
    873873    newscript = new Script; 
    874874    newscript->Name="boss_thurg"; 
    875875    newscript->GetAI = GetAI_boss_thurg; 
    876     m_scripts[nrscripts++] = newscript; 
     876    newscript->RegisterSelf(); 
    877877 
    878878    newscript = new Script; 
    879879    newscript->Name="boss_gazakroth"; 
    880880    newscript->GetAI = GetAI_boss_gazakroth; 
    881     m_scripts[nrscripts++] = newscript; 
     881    newscript->RegisterSelf(); 
    882882 
    883883    newscript = new Script; 
    884884    newscript->Name="boss_lord_raadan"; 
    885885    newscript->GetAI = GetAI_boss_lord_raadan; 
    886     m_scripts[nrscripts++] = newscript; 
     886    newscript->RegisterSelf(); 
    887887 
    888888    newscript = new Script; 
    889889    newscript->Name="boss_darkheart"; 
    890890    newscript->GetAI = GetAI_boss_darkheart; 
    891     m_scripts[nrscripts++] = newscript; 
     891    newscript->RegisterSelf(); 
    892892 
    893893    newscript = new Script; 
    894894    newscript->Name="boss_slither"; 
    895895    newscript->GetAI = GetAI_boss_slither; 
    896     m_scripts[nrscripts++] = newscript; 
     896    newscript->RegisterSelf(); 
    897897 
    898898    newscript = new Script; 
    899899    newscript->Name="boss_fenstalker"; 
    900900    newscript->GetAI = GetAI_boss_fenstalker; 
    901     m_scripts[nrscripts++] = newscript; 
     901    newscript->RegisterSelf(); 
    902902 
    903903    newscript = new Script; 
    904904    newscript->Name="boss_koragg"; 
    905905    newscript->GetAI = GetAI_boss_koragg; 
    906     m_scripts[nrscripts++] = newscript; 
     906    newscript->RegisterSelf(); 
    907907 
    908908    newscript = new Script; 
    909909    newscript->Name="boss_alyson_antille"; 
    910910    newscript->GetAI = GetAI_boss_alyson_antille; 
    911     m_scripts[nrscripts++] = newscript; 
     911    newscript->RegisterSelf(); 
    912912} 
  • trunk/src/bindings/scripts/scripts/zone/zulaman/boss_janalai.cpp

    r257 r260  
    707707    newscript->Name="boss_janalai"; 
    708708    newscript->GetAI = GetAI_boss_janalaiAI; 
    709     m_scripts[nrscripts++] = newscript 
     709    newscript->RegisterSelf() 
    710710 
    711711    newscript = new Script; 
    712712    newscript->Name="mob_janalai_firebomb"; 
    713713    newscript->GetAI = GetAI_mob_jandalai_firebombAI; 
    714     m_scripts[nrscripts++] = newscript 
     714    newscript->RegisterSelf() 
    715715 
    716716    newscript = new Script; 
    717717    newscript->Name="mob_janalai_hatcher"; 
    718718    newscript->GetAI = GetAI_mob_amanishi_hatcherAI; 
    719     m_scripts[nrscripts++] = newscript;  
     719    newscript->RegisterSelf();  
    720720 
    721721    newscript = new Script; 
    722722    newscript->Name="mob_janalai_hatchling"; 
    723723    newscript->GetAI = GetAI_mob_hatchlingAI; 
    724     m_scripts[nrscripts++] = newscript; 
     724    newscript->RegisterSelf(); 
    725725 
    726726    newscript = new Script; 
    727727    newscript->Name="mob_janalai_egg"; 
    728728    newscript->GetAI = GetAI_mob_eggAI; 
    729     m_scripts[nrscripts++] = newscript;  
     729    newscript->RegisterSelf();  
    730730} 
  • trunk/src/bindings/scripts/scripts/zone/zulaman/boss_nalorakk.cpp

    r90 r260  
    301301    newscript->Name="boss_nalorakk"; 
    302302    newscript->GetAI = GetAI_boss_nalorakk; 
    303     m_scripts[nrscripts++] = newscript; 
     303    newscript->RegisterSelf(); 
    304304} 
  • trunk/src/bindings/scripts/scripts/zone/zulaman/boss_zuljin.cpp

    r158 r260  
    630630    newscript->Name="boss_zuljin"; 
    631631    newscript->GetAI = GetAI_boss_zuljin; 
    632     m_scripts[nrscripts++] = newscript; 
     632    newscript->RegisterSelf(); 
    633633 
    634634    newscript = new Script; 
    635635    newscript->Name="do_nothing"; 
    636636    newscript->GetAI = GetAI_do_nothing; 
    637     m_scripts[nrscripts++] = newscript; 
     637    newscript->RegisterSelf(); 
    638638 
    639639    newscript = new Script; 
    640640    newscript->Name="mob_zuljin_vortex"; 
    641641    newscript->GetAI = GetAI_feather_vortexAI; 
    642     m_scripts[nrscripts++] = newscript; 
     642    newscript->RegisterSelf(); 
    643643} 
  • trunk/src/bindings/scripts/scripts/zone/zulaman/instance_zulaman.cpp

    r257 r260  
    329329    newscript->Name = "instance_zulaman"; 
    330330    newscript->GetInstanceData = GetInstanceData_instance_zulaman; 
    331     m_scripts[nrscripts++] = newscript; 
     331    newscript->RegisterSelf(); 
    332332} 
  • trunk/src/bindings/scripts/scripts/zone/zulaman/zulaman.cpp

    r90 r260  
    172172    newscript->Name="npc_forest_frog"; 
    173173    newscript->GetAI = GetAI_npc_forest_frog; 
    174     m_scripts[nrscripts++] = newscript; 
     174    newscript->RegisterSelf(); 
    175175 
    176176    newscript = new Script; 
     
    179179    newscript->pGossipHello = GossipHello_npc_zulaman_hostage; 
    180180    newscript->pGossipSelect = GossipSelect_npc_zulaman_hostage; 
    181     m_scripts[nrscripts++] = newscript; 
     181    newscript->RegisterSelf(); 
    182182} 
  • trunk/src/bindings/scripts/scripts/zone/zulfarrak/zulfarrak.cpp

    r90 r260  
    214214    newscript->pGossipHello =  &GossipHello_npc_sergeant_bly; 
    215215    newscript->pGossipSelect = &GossipSelect_npc_sergeant_bly; 
    216     m_scripts[nrscripts++] = newscript; 
     216    newscript->RegisterSelf(); 
    217217 
    218218    newscript = new Script; 
     
    221221    newscript->pGossipHello =  &GossipHello_npc_weegli_blastfuse; 
    222222    newscript->pGossipSelect = &GossipSelect_npc_weegli_blastfuse; 
    223     m_scripts[nrscripts++] = newscript; 
    224 } 
     223    newscript->RegisterSelf(); 
     224} 
  • trunk/src/bindings/scripts/scripts/zone/zulgurub/boss_arlokk.cpp

    r109 r260  
    208208    newscript->Name="boss_arlokk"; 
    209209    newscript->GetAI = GetAI_boss_arlokk; 
    210     m_scripts[nrscripts++] = newscript; 
     210    newscript->RegisterSelf(); 
    211211} 
  • trunk/src/bindings/scripts/scripts/zone/zulgurub/boss_gahzranka.cpp

    r90 r260  
    8989    newscript->Name="boss_gahzranka"; 
    9090    newscript->GetAI = GetAI_boss_gahzranka; 
    91     m_scripts[nrscripts++] = newscript; 
     91    newscript->RegisterSelf(); 
    9292} 
  • trunk/src/bindings/scripts/scripts/zone/zulgurub/boss_grilek.cpp

    r109 r260  
    8989    newscript->Name="boss_grilek"; 
    9090    newscript->GetAI = GetAI_boss_grilek; 
    91     m_scripts[nrscripts++] = newscript; 
     91    newscript->RegisterSelf(); 
    9292} 
  • trunk/src/bindings/scripts/scripts/zone/zulgurub/boss_hakkar.cpp

    r90 r260  
    253253    newscript->Name="boss_hakkar"; 
    254254    newscript->GetAI = GetAI_boss_hakkar; 
    255     m_scripts[nrscripts++] = newscript; 
     255    newscript->RegisterSelf(); 
    256256} 
  • trunk/src/bindings/scripts/scripts/zone/zulgurub/boss_hazzarah.cpp

    r90 r260  
    9797    newscript->Name="boss_hazzarah"; 
    9898    newscript->GetAI = GetAI_boss_hazzarah; 
    99     m_scripts[nrscripts++] = newscript; 
     99    newscript->RegisterSelf(); 
    100100} 
  • trunk/src/bindings/scripts/scripts/zone/zulgurub/boss_jeklik.cpp

    r109 r260  
    289289    newscript->Name="boss_jeklik"; 
    290290    newscript->GetAI = GetAI_boss_jeklik; 
    291     m_scripts[nrscripts++] = newscript; 
     291    newscript->RegisterSelf(); 
    292292 
    293293    newscript = new Script; 
    294294    newscript->Name="mob_batrider"; 
    295295    newscript->GetAI = GetAI_mob_batrider; 
    296     m_scripts[nrscripts++] = newscript; 
     296    newscript->RegisterSelf(); 
    297297} 
  • trunk/src/bindings/scripts/scripts/zone/zulgurub/boss_jindo.cpp

    r90 r260  
    259259    newscript->Name="boss_jindo"; 
    260260    newscript->GetAI = GetAI_boss_jindo; 
    261     m_scripts[nrscripts++] = newscript; 
     261    newscript->RegisterSelf(); 
    262262 
    263263    newscript = new Script; 
    264264    newscript->Name="mob_healing_ward"; 
    265265    newscript->GetAI = GetAI_mob_healing_ward; 
    266     m_scripts[nrscripts++] = newscript; 
     266    newscript->RegisterSelf(); 
    267267 
    268268    newscript = new Script; 
    269269    newscript->Name="mob_shade_of_jindo"; 
    270270    newscript->GetAI = GetAI_mob_shade_of_jindo; 
    271     m_scripts[nrscripts++] = newscript; 
    272 } 
     271    newscript->RegisterSelf(); 
     272} 
  • trunk/src/bindings/scripts/scripts/zone/zulgurub/boss_mandokir.cpp

    r109 r260  
    303303    newscript->Name="boss_mandokir"; 
    304304    newscript->GetAI = GetAI_boss_mandokir; 
    305     m_scripts[nrscripts++] = newscript; 
     305    newscript->RegisterSelf(); 
    306306 
    307307    newscript = new Script; 
    308308    newscript->Name="mob_ohgan"; 
    309309    newscript->GetAI = GetAI_mob_ohgan; 
    310     m_scripts[nrscripts++] = newscript; 
     310    newscript->RegisterSelf(); 
    311311} 
  • trunk/src/bindings/scripts/scripts/zone/zulgurub/boss_marli.cpp

    r109 r260  
    245245    newscript->Name="boss_marli"; 
    246246    newscript->GetAI = GetAI_boss_marli; 
    247     m_scripts[nrscripts++] = newscript; 
     247    newscript->RegisterSelf(); 
    248248 
    249249    newscript = new Script; 
    250250    newscript->Name="mob_spawn_of_marli"; 
    251251    newscript->GetAI = GetAI_mob_spawn_of_marli; 
    252     m_scripts[nrscripts++] = newscript; 
     252    newscript->RegisterSelf(); 
    253253} 
  • trunk/src/bindings/scripts/scripts/zone/zulgurub/boss_renataki.cpp

    r109 r260  
    148148    newscript->Name="boss_renataki"; 
    149149    newscript->GetAI = GetAI_boss_renataki; 
    150     m_scripts[nrscripts++] = newscript; 
     150    newscript->RegisterSelf(); 
    151151} 
  • trunk/src/bindings/scripts/scripts/zone/zulgurub/boss_thekal.cpp

    r109 r260  
    532532    newscript->Name="boss_thekal"; 
    533533    newscript->GetAI = GetAI_boss_thekal; 
    534     m_scripts[nrscripts++] = newscript; 
     534    newscript->RegisterSelf(); 
    535535 
    536536    newscript = new Script; 
    537537    newscript->Name="mob_zealot_lorkhan"; 
    538538    newscript->GetAI = GetAI_mob_zealot_lorkhan; 
    539     m_scripts[nrscripts++] = newscript; 
     539    newscript->RegisterSelf(); 
    540540 
    541541    newscript = new Script; 
    542542    newscript->Name="mob_zealot_zath"; 
    543543    newscript->GetAI = GetAI_mob_zealot_zath; 
    544     m_scripts[nrscripts++] = newscript; 
     544    newscript->RegisterSelf(); 
    545545} 
  • trunk/src/bindings/scripts/scripts/zone/zulgurub/boss_venoxis.cpp

    r90 r260  
    197197    newscript->Name="boss_venoxis"; 
    198198    newscript->GetAI = GetAI_boss_venoxis; 
    199     m_scripts[nrscripts++] = newscript; 
     199    newscript->RegisterSelf(); 
    200200} 
  • trunk/src/bindings/scripts/scripts/zone/zulgurub/boss_wushoolay.cpp

    r90 r260  
    8181    newscript->Name="boss_wushoolay"; 
    8282    newscript->GetAI = GetAI_boss_wushoolay; 
    83     m_scripts[nrscripts++] = newscript; 
     83    newscript->RegisterSelf(); 
    8484} 
  • trunk/src/bindings/scripts/scripts/zone/zulgurub/instance_zulgurub.cpp

    r90 r260  
    235235    newscript->Name = "instance_zulgurub"; 
    236236    newscript->GetInstanceData = GetInstanceData_instance_zulgurub; 
    237     m_scripts[nrscripts++] = newscript; 
     237    newscript->RegisterSelf(); 
    238238} 
  • trunk/src/game/AuctionHouse.cpp

    r229 r260  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1919 */ 
    2020 
     
    9090        return false; 
    9191    } 
    92     data << auction->Id; 
    93     data << pItem->GetUInt32Value(OBJECT_FIELD_ENTRY); 
     92    data << (uint32) auction->Id; 
     93    data << (uint32) pItem->GetEntry(); 
    9494 
    9595    for (uint8 i = 0; i < MAX_INSPECTED_ENCHANTMENT_SLOT; i++) 
     
    246246        return; 
    247247    } 
    248     // prevent sending bag with items (cheat: can be placed in bag after adding equipped empty bag to auction) 
     248    // prevent sending bag with items (cheat: can be placed in bag after adding equiped empty bag to auction) 
    249249    if(!it) 
    250250    { 
     
    717717                                            if (il) 
    718718                                            { 
    719                                                 if (il->Name.size() > loc_idx && !il->Name[loc_idx].empty()) 
     719                                                if (il->Name.size() > size_t(loc_idx) && !il->Name[loc_idx].empty()) 
    720720                                                    name = il->Name[loc_idx]; 
    721721                                            } 
  • trunk/src/game/Bag.cpp

    r177 r260  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1919 */ 
    2020 
     
    4242    for(int i = 0; i < MAX_BAG_SIZE; ++i) 
    4343        if (m_bagslot[i]) 
    44              delete m_bagslot[i]; 
     44            delete m_bagslot[i]; 
    4545} 
    4646 
     
    7272    Object::_Create( guidlow, 0, HIGHGUID_CONTAINER ); 
    7373 
    74     SetUInt32Value(OBJECT_FIELD_ENTRY, itemid); 
     74    SetEntry(itemid); 
    7575    SetFloatValue(OBJECT_FIELD_SCALE_X, 1.0f); 
    7676 
     
    8686    SetUInt32Value(CONTAINER_FIELD_NUM_SLOTS, itemProto->ContainerSlots); 
    8787 
    88     // Cleanning 20 slots 
     88    // Cleaning 20 slots 
    8989    for (uint8 i = 0; i < MAX_BAG_SIZE; i++) 
    9090    { 
     
    214214            if(m_bagslot[i]->GetGUID() == guid) 
    215215                return i; 
     216 
    216217    return NULL_SLOT; 
    217218} 
     
    221222    if( slot < GetBagSize() ) 
    222223        return m_bagslot[slot]; 
    223          
     224 
    224225    return NULL; 
    225226} 
  • trunk/src/game/Chat.cpp

    r233 r260  
    6464    }; 
    6565 
     66    static ChatCommand serverIdleRestartCommandTable[] = 
     67    { 
     68        { "cancel",         SEC_ADMINISTRATOR,  true,  &ChatHandler::HandleServerShutDownCancelCommand,"", NULL }, 
     69        { ""   ,            SEC_ADMINISTRATOR,  true,  &ChatHandler::HandleServerIdleRestartCommand,   "", NULL }, 
     70        { NULL,             0,                  false, NULL,                                           "", NULL } 
     71    }; 
     72 
     73    static ChatCommand serverIdleShutdownCommandTable[] = 
     74    { 
     75        { "cancel",         SEC_ADMINISTRATOR,  true,  &ChatHandler::HandleServerShutDownCancelCommand,"", NULL }, 
     76        { ""   ,            SEC_ADMINISTRATOR,  true,  &ChatHandler::HandleServerIdleShutDownCommand,  "", NULL }, 
     77        { NULL,             0,                  false, NULL,                                           "", NULL } 
     78    }; 
     79 
     80    static ChatCommand serverRestartCommandTable[] = 
     81    { 
     82        { "cancel",         SEC_ADMINISTRATOR,  true,  &ChatHandler::HandleServerShutDownCancelCommand,"", NULL }, 
     83        { ""   ,            SEC_ADMINISTRATOR,  true,  &ChatHandler::HandleServerRestartCommand,       "", NULL }, 
     84        { NULL,             0,                  false, NULL,                                           "", NULL } 
     85    }; 
     86 
     87    static ChatCommand serverShutdownCommandTable[] = 
     88    { 
     89        { "cancel",         SEC_ADMINISTRATOR,  true,  &ChatHandler::HandleServerShutDownCancelCommand,"", NULL }, 
     90        { ""   ,            SEC_ADMINISTRATOR,  true,  &ChatHandler::HandleServerShutDownCommand,      "", NULL }, 
     91        { NULL,             0,                  false, NULL,                                           "", NULL } 
     92    }; 
     93 
    6694    static ChatCommand serverCommandTable[] = 
    6795    { 
    6896        { "corpses",        SEC_GAMEMASTER,     true,  &ChatHandler::HandleServerCorpsesCommand,       "", NULL }, 
    6997        { "exit",           SEC_CONSOLE,        true,  &ChatHandler::HandleServerExitCommand,          "", NULL }, 
    70         { "idlerestart",    SEC_ADMINISTRATOR,  true,  &ChatHandler::HandleIdleRestartCommand,         "", NULL }, 
    71         { "idleshutdown",   SEC_ADMINISTRATOR,  true,  &ChatHandler::HandleIdleShutDownCommand,        "", NULL }, 
     98        { "idlerestart",    SEC_ADMINISTRATOR,  true,  NULL,                                           "", serverIdleRestartCommandTable }, 
     99        { "idleshutdown",   SEC_ADMINISTRATOR,  true,  NULL,                                           "", serverShutdownCommandTable }, 
    72100        { "info",           SEC_PLAYER,         true,  &ChatHandler::HandleServerInfoCommand,          "", NULL }, 
    73101        { "motd",           SEC_PLAYER,         true,  &ChatHandler::HandleServerMotdCommand,          "", NULL }, 
    74         { "restart",        SEC_ADMINISTRATOR,  true,  &ChatHandler::HandleRestartCommand,             "", NULL }, 
    75         { "shutdown",       SEC_ADMINISTRATOR,  true,  &ChatHandler::HandleShutDownCommand,            "", NULL }, 
     102        { "restart",        SEC_ADMINISTRATOR,  true,  NULL,                                           "", serverRestartCommandTable }, 
     103        { "shutdown",       SEC_ADMINISTRATOR,  true,  NULL,                                           "", serverShutdownCommandTable }, 
    76104        { "set",            SEC_ADMINISTRATOR,  true,  NULL,                                           "", serverSetCommandTable }, 
    77105        { NULL,             0,                  false, NULL,                                           "", NULL } 
  • trunk/src/game/Chat.h

    r233 r260  
    176176        bool HandleModifyRepCommand(const char* args); 
    177177        bool HandleModifyArenaCommand(const char* args); 
     178        bool HandleModifyGenderCommand(const char* args); 
    178179 
    179180        bool HandleNpcAddCommand(const char* args); 
     
    192193        bool HandleNpcSpawnDistCommand(const char* args); 
    193194        bool HandleNpcSpawnTimeCommand(const char* args); 
     195        bool HandleNpcTameCommand(const char* args); 
    194196        bool HandleNpcTextEmoteCommand(const char* args); 
    195197        bool HandleNpcUnFollowCommand(const char* args); 
     
    216218        bool HandleReloadCreatureQuestRelationsCommand(const char* args); 
    217219        bool HandleReloadCreatureQuestInvRelationsCommand(const char* args); 
     220        bool HandleReloadDbScriptStringCommand(const char* args); 
    218221        bool HandleReloadGameGraveyardZoneCommand(const char* args); 
    219222        bool HandleReloadGameObjectScriptsCommand(const char* args); 
     
    271274        bool HandleServerCorpsesCommand(const char* args); 
    272275        bool HandleServerExitCommand(const char* args); 
     276        bool HandleServerIdleRestartCommand(const char* args); 
     277        bool HandleServerIdleShutDownCommand(const char* args); 
    273278        bool HandleServerInfoCommand(const char* args); 
    274279        bool HandleServerMotdCommand(const char* args); 
     280        bool HandleServerRestartCommand(const char* args); 
    275281        bool HandleServerSetMotdCommand(const char* args); 
    276282        bool HandleServerSetLogLevelCommand(const char* args); 
     283        bool HandleServerShutDownCommand(const char* args); 
     284        bool HandleServerShutDownCancelCommand(const char* args); 
    277285 
    278286        bool HandleAddHonorCommand(const char* args); 
     
    328336        bool HandleBanListCharacterCommand(const char* args); 
    329337        bool HandleBanListIPCommand(const char* args); 
    330         bool HandleIdleRestartCommand(const char* args); 
    331         bool HandleIdleShutDownCommand(const char* args); 
    332         bool HandleShutDownCommand(const char* args); 
    333         bool HandleRestartCommand(const char* args); 
    334         bool HandleSecurityCommand(const char* args); 
    335338        bool HandleGoXYCommand(const char* args); 
    336339        bool HandleGoXYZCommand(const char* args); 
     
    366369        bool HandleAddItemCommand(const char* args); 
    367370        bool HandleAddItemSetCommand(const char* args); 
    368         bool HandleModifyGenderCommand(const char* args); 
    369371        bool HandlePetTpCommand(const char* args); 
    370372        bool HandlePetUnlearnCommand(const char* args); 
  • trunk/src/game/Creature.cpp

    r230 r260  
    178178    float x,y,z,o; 
    179179    GetRespawnCoord(x, y, z, &o); 
    180     MapManager::Instance().GetMap(GetMapId(), this)->CreatureRelocation(this,x,y,z,o); 
     180    GetMap()->CreatureRelocation(this,x,y,z,o); 
    181181} 
    182182 
     
    210210    } 
    211211 
    212     SetUInt32Value(OBJECT_FIELD_ENTRY, Entry);              // normal entry always 
     212    SetEntry(Entry);                                        // normal entry always 
    213213    m_creatureInfo = cinfo;                                 // map mode related always 
    214214 
     
    353353                lootForBody         = false; 
    354354 
    355                 if(m_originalEntry != GetUInt32Value(OBJECT_FIELD_ENTRY)) 
     355                if(m_originalEntry != GetEntry()) 
    356356                    UpdateEntry(m_originalEntry); 
    357357 
     
    372372 
    373373                //Call AI respawn virtual function 
    374                 AI()->JustRespawned(); 
    375  
    376                 MapManager::Instance().GetMap(GetMapId(), this)->Add(this); 
     374                i_AI->JustRespawned(); 
     375 
     376                GetMap()->Add(this); 
    377377            } 
    378378            break; 
     
    436436                // do not allow the AI to be changed during update 
    437437                m_AI_locked = true; 
    438                 AI()->UpdateAI(diff); 
     438                i_AI->UpdateAI(diff); 
    439439                m_AI_locked = false; 
    440440            } 
     
    20972097} 
    20982098 
    2099 char const* Creature::GetScriptName() const 
    2100 { 
    2101     return ObjectMgr::GetCreatureTemplate(GetEntry())->ScriptName; 
     2099std::string Creature::GetScriptName() 
     2100{ 
     2101    return objmgr.GetScriptName(GetScriptId()); 
     2102} 
     2103 
     2104uint32 Creature::GetScriptId() 
     2105{ 
     2106    return ObjectMgr::GetCreatureTemplate(GetEntry())->ScriptID; 
    21022107} 
    21032108 
  • trunk/src/game/Creature.h

    r230 r260  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1919 */ 
    2020 
     
    206206    uint32  MechanicImmuneMask; 
    207207    uint32  flags_extra; 
    208     char const* ScriptName; 
     208    uint32  ScriptID; 
    209209    uint32 GetRandomValidModelId() const; 
    210210    uint32 GetFirstValidModelId() const; 
    211      
     211 
     212    // helpers 
    212213    SkillType GetRequiredLootSkill() const 
    213214    { 
     
    219220            return SKILL_SKINNING;                          // normal case 
    220221    } 
    221      
     222 
    222223    bool isTameable() const 
    223224    { 
     
    499500        CreatureInfo const *GetCreatureInfo() const { return m_creatureInfo; } 
    500501        CreatureDataAddon const* GetCreatureAddon() const; 
    501         char const* GetScriptName() const; 
     502 
     503        std::string GetScriptName(); 
     504        uint32 GetScriptId(); 
    502505 
    503506        void prepareGossipMenu( Player *pPlayer, uint32 gossipid = 0 ); 
     
    525528        // overwrite WorldObject function for proper name localization 
    526529        const char* GetNameForLocaleIdx(int32 locale_idx) const; 
    527      
     530 
    528531        void setDeathState(DeathState s);                   // overwrite virtual Unit::setDeathState 
    529532 
  • trunk/src/game/CreatureAI.cpp

    r207 r260  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1919 */ 
    2020 
  • trunk/src/game/CreatureAIImpl.h

    r102 r260  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1919 */ 
    2020#ifndef CREATUREAIIMPL_H 
  • trunk/src/game/CreatureAIRegistry.cpp

    r174 r260  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1919 */ 
    2020 
  • trunk/src/game/CreatureAISelector.cpp

    r174 r260  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1919 */ 
    2020 
  • trunk/src/game/Formulas.h

    r111 r260  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1919 */ 
    2020 
     
    3030        inline uint32 hk_honor_at_level(uint32 level, uint32 count=1) 
    3131        { 
    32             return (uint32) ceil(count*(-0.53177f + 0.59357f * exp((level +23.54042f) / 26.07859f ))); 
     32            return (uint32)ceil(count*(-0.53177f + 0.59357f * exp((level +23.54042f) / 26.07859f ))); 
    3333        } 
    3434    } 
     
    8181        inline uint32 BaseGain(uint32 pl_level, uint32 mob_level, ContentLevels content) 
    8282        { 
     83            //TODO: need modifier for CONTENT_71_80 different from CONTENT_61_70? 
    8384            const uint32 nBaseExp = content == CONTENT_1_60 ? 45 : 235; 
    8485            if( mob_level >= pl_level ) 
  • trunk/src/game/GMTicketHandler.cpp

    r229 r260  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1919 */ 
    2020 
     
    6767    recv_data >> ticketText; 
    6868 
    69     CharacterDatabase.escape_string(ticketText); 
    70  
    7169    if(GMTicket* ticket = ticketmgr.GetGMTicket(GetPlayer()->GetGUIDLow())) 
    7270        ticket->SetText(ticketText.c_str()); 
     
    106104    sLog.outDebug("TicketCreate: map %u, x %f, y %f, z %f, text %s, unk1 %u, unk2 %u", map, x, y, z, ticketText.c_str(), unk1, unk2); 
    107105 
    108     CharacterDatabase.escape_string(ticketText); 
    109  
    110     if(GMTicket* ticket = ticketmgr.GetGMTicket(GetPlayer()->GetGUIDLow())) 
     106    if(ticketmgr.GetGMTicket(GetPlayer()->GetGUIDLow())) 
    111107    { 
    112108        WorldPacket data( SMSG_GMTICKET_CREATE, 4 ); 
  • trunk/src/game/GMTicketMgr.h

    r229 r260  
    5151            m_text = text ? text : ""; 
    5252            m_lastUpdate = time(NULL); 
    53             CharacterDatabase.PExecute("UPDATE character_ticket SET ticket_text = '%s' WHERE guid = '%u'", m_text.c_str(), m_guid); 
     53 
     54            std::string escapedString = m_text; 
     55            CharacterDatabase.escape_string(escapedString); 
     56            CharacterDatabase.PExecute("UPDATE character_ticket SET ticket_text = '%s' WHERE guid = '%u'", escapedString.c_str(), m_guid); 
    5457        } 
    5558 
     
    6366            CharacterDatabase.BeginTransaction(); 
    6467            DeleteFromDB(); 
    65             CharacterDatabase.PExecute("INSERT INTO character_ticket (guid, ticket_text) VALUES ('%u', '%s')", m_guid, GetText()); 
     68 
     69            std::string escapedString = m_text; 
     70            CharacterDatabase.escape_string(escapedString); 
     71 
     72            CharacterDatabase.PExecute("INSERT INTO character_ticket (guid, ticket_text) VALUES ('%u', '%s')", m_guid, escapedString.c_str()); 
    6673            CharacterDatabase.CommitTransaction(); 
    6774        } 
  • trunk/src/game/GameObject.h

    r230 r260  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1919 */ 
    2020 
     
    358358        } raw; 
    359359    }; 
    360     char   *ScriptName; 
     360    uint32 ScriptId; 
    361361}; 
    362362 
  • trunk/src/game/Item.cpp

    r102 r260  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1919 */ 
    2020 
     
    180180                    return true; 
    181181                case ITEM_SUBCLASS_SOUL_CONTAINER: 
    182                     if(!(pProto->BagFamily & BAG_FAMILY_MASK_SHARDS)) 
     182                    if(!(pProto->BagFamily & BAG_FAMILY_MASK_SOUL_SHARDS)) 
    183183                        return false; 
    184184                    return true; 
     
    248248    Object::_Create( guidlow, 0, HIGHGUID_ITEM ); 
    249249 
    250     SetUInt32Value(OBJECT_FIELD_ENTRY, itemid); 
     250    SetEntry(itemid); 
    251251    SetFloatValue(OBJECT_FIELD_SCALE_X, 1.0f); 
    252252 
     
    430430ItemPrototype const *Item::GetProto() const 
    431431{ 
    432     return objmgr.GetItemPrototype(GetUInt32Value(OBJECT_FIELD_ENTRY)); 
     432    return objmgr.GetItemPrototype(GetEntry()); 
    433433} 
    434434 
     
    763763{ 
    764764    // Better lost small time at check in comparison lost time at item save to DB. 
    765     if( GetUInt32Value(ITEM_FIELD_ENCHANTMENT + slot*MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_ID_OFFSET)==id && 
    766         GetUInt32Value(ITEM_FIELD_ENCHANTMENT + slot*MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_DURATION_OFFSET)==duration && 
    767         GetUInt32Value(ITEM_FIELD_ENCHANTMENT + slot*MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_CHARGES_OFFSET)==charges ) 
     765    if((GetEnchantmentId(slot) == id) && (GetEnchantmentDuration(slot) == duration) && (GetEnchantmentCharges(slot) == charges)) 
    768766        return; 
    769767 
     
    776774void Item::SetEnchantmentDuration(EnchantmentSlot slot, uint32 duration) 
    777775{ 
    778     if(GetUInt32Value(ITEM_FIELD_ENCHANTMENT + slot*MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_DURATION_OFFSET)==duration) 
     776    if(GetEnchantmentDuration(slot) == duration) 
    779777        return; 
    780778 
     
    785783void Item::SetEnchantmentCharges(EnchantmentSlot slot, uint32 charges) 
    786784{ 
     785    if(GetEnchantmentCharges(slot) == charges) 
     786        return; 
     787 
    787788    SetUInt32Value(ITEM_FIELD_ENCHANTMENT + slot*MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_CHARGES_OFFSET,charges); 
    788789    SetState(ITEM_CHANGED); 
     
    791792void Item::ClearEnchantment(EnchantmentSlot slot) 
    792793{ 
    793     if(!GetUInt32Value(ITEM_FIELD_ENCHANTMENT + slot*MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_ID_OFFSET)) 
    794         return; 
    795  
    796     for(int x=0;x<3;x++) 
    797         SetUInt32Value(ITEM_FIELD_ENCHANTMENT + slot*MAX_ENCHANTMENT_OFFSET + x,0); 
     794    if(!GetEnchantmentId(slot)) 
     795        return; 
     796 
     797    for(uint8 x = 0; x < 3; ++x) 
     798        SetUInt32Value(ITEM_FIELD_ENCHANTMENT + slot*MAX_ENCHANTMENT_OFFSET + x, 0); 
    798799    SetState(ITEM_CHANGED); 
    799800} 
  • trunk/src/game/Item.h

    r102 r260  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1919 */ 
    2020 
     
    229229        bool GemsFitSockets() const; 
    230230 
    231         uint32 GetEntry() const { return GetUInt32Value(OBJECT_FIELD_ENTRY); } 
    232231        uint32 GetCount() const { return GetUInt32Value (ITEM_FIELD_STACK_COUNT); } 
    233232        void SetCount(uint32 value) { SetUInt32Value (ITEM_FIELD_STACK_COUNT, value); } 
  • trunk/src/game/ItemEnchantmentMgr.cpp

    r206 r260  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1919 */ 
    2020 
  • trunk/src/game/ItemEnchantmentMgr.h

    r102 r260  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1919 */ 
    2020 
  • trunk/src/game/ItemHandler.cpp

    r229 r260  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1919 */ 
    2020 
     
    314314            if (il) 
    315315            { 
    316                 if (il->Name.size() > loc_idx && !il->Name[loc_idx].empty()) 
     316                if (il->Name.size() > size_t(loc_idx) && !il->Name[loc_idx].empty()) 
    317317                    Name = il->Name[loc_idx]; 
    318                 if (il->Description.size() > loc_idx && !il->Description[loc_idx].empty()) 
     318                if (il->Description.size() > size_t(loc_idx) && !il->Description[loc_idx].empty()) 
    319319                    Description = il->Description[loc_idx]; 
    320320            } 
     
    361361            data << pProto->Damage[i].DamageType; 
    362362        } 
     363 
     364        // resistances (7) 
    363365        data << pProto->Armor; 
    364366        data << pProto->HolyRes; 
     
    368370        data << pProto->ShadowRes; 
    369371        data << pProto->ArcaneRes; 
     372 
    370373        data << pProto->Delay; 
    371374        data << pProto->Ammo_type; 
    372  
    373         data << (float)pProto->RangedModRange; 
     375        data << pProto->RangedModRange; 
     376 
    374377        for(int s = 0; s < 5; s++) 
    375378        { 
     
    977980            if (il) 
    978981            { 
    979                 if (il->Name.size() > loc_idx && !il->Name[loc_idx].empty()) 
     982                if (il->Name.size() > size_t(loc_idx) && !il->Name[loc_idx].empty()) 
    980983                    Name = il->Name[loc_idx]; 
    981984            } 
     
    10281031    } 
    10291032 
    1030     if(item==gift)                                          // not possible with pacjket from real client 
     1033    if(item==gift)                                          // not possable with pacjket from real client 
    10311034    { 
    10321035        _player->SendEquipError( EQUIP_ERR_WRAPPED_CANT_BE_WRAPPED, item, NULL ); 
     
    10731076    CharacterDatabase.BeginTransaction(); 
    10741077    CharacterDatabase.PExecute("INSERT INTO character_gifts VALUES ('%u', '%u', '%u', '%u')", GUID_LOPART(item->GetOwnerGUID()), item->GetGUIDLow(), item->GetEntry(), item->GetUInt32Value(ITEM_FIELD_FLAGS)); 
    1075     item->SetUInt32Value(OBJECT_FIELD_ENTRY, gift->GetUInt32Value(OBJECT_FIELD_ENTRY)); 
     1078    item->SetEntry(gift->GetEntry()); 
    10761079 
    10771080    switch (item->GetEntry()) 
    10781081    { 
    1079         case 5042:  item->SetUInt32Value(OBJECT_FIELD_ENTRY, 5043); break; 
    1080         case 5048:  item->SetUInt32Value(OBJECT_FIELD_ENTRY, 5044); break; 
    1081         case 17303: item->SetUInt32Value(OBJECT_FIELD_ENTRY, 17302); break; 
    1082         case 17304: item->SetUInt32Value(OBJECT_FIELD_ENTRY, 17305); break; 
    1083         case 17307: item->SetUInt32Value(OBJECT_FIELD_ENTRY, 17308); break; 
    1084         case 21830: item->SetUInt32Value(OBJECT_FIELD_ENTRY, 21831); break; 
     1082        case 5042:  item->SetEntry( 5043); break; 
     1083        case 5048:  item->SetEntry( 5044); break; 
     1084        case 17303: item->SetEntry(17302); break; 
     1085        case 17304: item->SetEntry(17305); break; 
     1086        case 17307: item->SetEntry(17308); break; 
     1087        case 21830: item->SetEntry(21831); break; 
    10851088    } 
    10861089    item->SetUInt64Value(ITEM_FIELD_GIFTCREATOR, _player->GetGUID()); 
  • trunk/src/game/ItemPrototype.h

    r257 r260  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1919 */ 
    2020 
     
    100100    ITEM_FLAGS_USEABLE_IN_ARENA               = 0x00200000, 
    101101    ITEM_FLAGS_THROWABLE                      = 0x00400000, // not used in game for check trow possibility, only for item in game tooltip 
    102     ITEM_FLAGS_SPECIALUSE                     = 0x00800000  // last used flag in 2.3.0 
     102    ITEM_FLAGS_SPECIALUSE                     = 0x00800000, // last used flag in 2.3.0 
     103    ITEM_FLAGS_BOA                            = 0x08000000, // bind on account 
     104    ITEM_FLAGS_MILLABLE                       = 0x20000000 
    103105}; 
    104106 
     
    107109    BAG_FAMILY_MASK_ARROWS                    = 0x00000001, 
    108110    BAG_FAMILY_MASK_BULLETS                   = 0x00000002, 
    109     BAG_FAMILY_MASK_SHARDS                    = 0x00000004, 
     111    BAG_FAMILY_MASK_SOUL_SHARDS               = 0x00000004, 
    110112    BAG_FAMILY_MASK_LEATHERWORKING_SUPP       = 0x00000008, 
    111     BAG_FAMILY_MASK_UNUSED                    = 0x00000010, // not used currently 
     113    BAG_FAMILY_MASK_INSCRIPTION_SUPP          = 0x00000010, 
    112114    BAG_FAMILY_MASK_HERBS                     = 0x00000020, 
    113115    BAG_FAMILY_MASK_ENCHANTING_SUPP           = 0x00000040, 
     
    117119    BAG_FAMILY_MASK_MINING_SUPP               = 0x00000400, 
    118120    BAG_FAMILY_MASK_SOULBOUND_EQUIPMENT       = 0x00000800, 
    119     BAG_FAMILY_MASK_VANITY_PETS               = 0x00001000 
    120 }; 
    121  
    122 /* TODO: Not entirely positive on need for this?? 
    123 enum SOCKET_CONTENT (); 
    124 */ 
     121    BAG_FAMILY_MASK_VANITY_PETS               = 0x00001000, 
     122    BAG_FAMILY_MASK_CURRENCY_TOKENS           = 0x00002000, 
     123    BAG_FAMILY_MASK_QUEST_ITEMS               = 0x00004000 
     124}; 
    125125 
    126126enum SocketColor 
     
    276276}; 
    277277 
    278 #define MAX_ITEM_SUBCLASS_ARMOR                  10 
     278#define MAX_ITEM_SUBCLASS_ARMOR                   10 
    279279 
    280280enum ItemSubclassReagent 
     
    390390 
    391391#define MAX_ITEM_SUBCLASS_JUNK                    6 
     392 
     393enum ItemSubclassGlyph 
     394{ 
     395    ITEM_SUBCLASS_GLYPH_WARRIOR                 = 1, 
     396    ITEM_SUBCLASS_GLYPH_PALADIN                 = 2, 
     397    ITEM_SUBCLASS_GLYPH_HUNTER                  = 3, 
     398    ITEM_SUBCLASS_GLYPH_ROGUE                   = 4, 
     399    ITEM_SUBCLASS_GLYPH_PRIEST                  = 5, 
     400    ITEM_SUBCLASS_GLYPH_DEATH_KNIGHT            = 6, 
     401    ITEM_SUBCLASS_GLYPH_SHAMAN                  = 7, 
     402    ITEM_SUBCLASS_GLYPH_MAGE                    = 8, 
     403    ITEM_SUBCLASS_GLYPH_WARLOCK                 = 9, 
     404    ITEM_SUBCLASS_GLYPH_DRUID                   = 11 
     405}; 
     406 
     407#define MAX_ITEM_SUBCLASS_GLYPH                   12 
    392408 
    393409const uint32 MaxItemSubclassValues[MAX_ITEM_CLASS] = 
     
    525541    uint32 RequiredDisenchantSkill; 
    526542    float  ArmorDamageModifier; 
    527     char* ScriptName; 
     543    uint32 ScriptId; 
    528544    uint32 DisenchantID; 
    529545    uint32 FoodType; 
  • trunk/src/game/Level2.cpp

    r230 r260  
    23622362    // Check 
    23632363    // Remember: "show" must also be the name of a column! 
    2364     if( (show != "emote") && (show != "spell") && (show != "text1") && (show != "text2") 
    2365         && (show != "text3") && (show != "text4") && (show != "text5") 
     2364    if( (show != "emote") && (show != "spell") && (show != "textid1") && (show != "textid2") 
     2365        && (show != "textid3") && (show != "textid4") && (show != "textid5") 
    23662366        && (show != "waittime") && (show != "del") && (show != "move") && (show != "add") 
    23672367        && (show != "model1") && (show != "model2") && (show != "orientation")) 
     
    27032703        PSendSysMessage(LANG_WAYPOINT_CREATNOTFOUND, lowguid); 
    27042704        SetSentErrorMessage(true); 
     2705        return false; 
     2706    } 
     2707 
     2708    // set in game textids not supported 
     2709    if( show == "textid1" || show == "textid2" || show == "textid3" || 
     2710        show == "textid4" || show == "textid5" ) 
     2711    { 
    27052712        return false; 
    27062713    } 
     
    28432850 
    28442851        QueryResult *result = 
    2845             WorldDatabase.PQuery( "SELECT id, point, waittime, emote, spell, text1, text2, text3, text4, text5, model1, model2 FROM creature_movement WHERE wpguid = %u", 
     2852            WorldDatabase.PQuery( "SELECT id, point, waittime, emote, spell, textid1, textid2, textid3, textid4, textid5, model1, model2 FROM creature_movement WHERE wpguid = %u", 
    28462853            target->GetGUIDLow() ); 
    28472854        if(!result) 
     
    28552862            PSendSysMessage(LANG_WAYPOINT_NOTFOUNDSEARCH, target->GetGUID()); 
    28562863 
    2857             result = WorldDatabase.PQuery( "SELECT id, point, waittime, emote, spell, text1, text2, text3, text4, text5, model1, model2 FROM creature_movement WHERE (abs(position_x - %f) <= %s ) and (abs(position_y - %f) <= %s ) and (abs(position_z - %f) <= %s )", 
     2864            result = WorldDatabase.PQuery( "SELECT id, point, waittime, emote, spell, textid1, textid2, textid3, textid4, textid5, model1, model2 FROM creature_movement WHERE (abs(position_x - %f) <= %s ) and (abs(position_y - %f) <= %s ) and (abs(position_z - %f) <= %s )", 
    28582865                target->GetPositionX(), maxDIFF, target->GetPositionY(), maxDIFF, target->GetPositionZ(), maxDIFF); 
    28592866            if(!result) 
     
    28722879            uint32 emote            = fields[3].GetUInt32(); 
    28732880            uint32 spell            = fields[4].GetUInt32(); 
    2874             const char * text1      = fields[5].GetString(); 
    2875             const char * text2      = fields[6].GetString(); 
    2876             const char * text3      = fields[7].GetString(); 
    2877             const char * text4      = fields[8].GetString(); 
    2878             const char * text5      = fields[9].GetString(); 
     2881            uint32 textid[MAX_WAYPOINT_TEXT]; 
     2882            for(int i = 0;  i < MAX_WAYPOINT_TEXT; ++i) 
     2883                textid[i]           = fields[5+i].GetUInt32(); 
    28792884            uint32 model1           = fields[10].GetUInt32(); 
    28802885            uint32 model2           = fields[11].GetUInt32(); 
     
    28892894            PSendSysMessage(LANG_WAYPOINT_INFO_EMOTE, emote); 
    28902895            PSendSysMessage(LANG_WAYPOINT_INFO_SPELL, spell); 
    2891             PSendSysMessage(LANG_WAYPOINT_INFO_TEXT, 1, text1); 
    2892             PSendSysMessage(LANG_WAYPOINT_INFO_TEXT, 2, text2); 
    2893             PSendSysMessage(LANG_WAYPOINT_INFO_TEXT, 3, text3); 
    2894             PSendSysMessage(LANG_WAYPOINT_INFO_TEXT, 4, text4); 
    2895             PSendSysMessage(LANG_WAYPOINT_INFO_TEXT, 5, text5); 
     2896            for(int i = 0;  i < MAX_WAYPOINT_TEXT; ++i) 
     2897                PSendSysMessage(LANG_WAYPOINT_INFO_TEXT, i+1, textid[i], (textid[i] ? GetTrinityString(textid[i]) : "")); 
    28962898 
    28972899        }while( result->NextRow() ); 
     
    32143216 
    32153217    QueryResult *result = WorldDatabase.PQuery( 
    3216     //          0      1           2           3           4            5       6       7         8      9      10     11     12     13     14     15 
    3217         "SELECT point, position_x, position_y, position_z, orientation, model1, model2, waittime, emote, spell, text1, text2, text3, text4, text5, id FROM creature_movement WHERE id = '%u' ORDER BY point", lowguid ); 
     3218    //          0      1           2           3           4            5       6       7         8      9      10       11       12       13       14       15 
     3219        "SELECT point, position_x, position_y, position_z, orientation, model1, model2, waittime, emote, spell, textid1, textid2, textid3, textid4, textid5, id FROM creature_movement WHERE id = '%u' ORDER BY point", lowguid ); 
    32183220 
    32193221    if (!result) 
     
    32323234 
    32333235        outfile << "INSERT INTO creature_movement "; 
    3234         outfile << "( id, point, position_x, position_y, position_z, orientation, model1, model2, waittime, emote, spell, text1, text2, text3, text4, text5 ) VALUES "; 
     3236        outfile << "( id, point, position_x, position_y, position_z, orientation, model1, model2, waittime, emote, spell, textid1, textid2, textid3, textid4, textid5 ) VALUES "; 
    32353237 
    32363238        outfile << "( "; 
     
    32573259        outfile << fields[9].GetUInt32();                   // spell 
    32583260        outfile << ", "; 
    3259         const char *tmpChar = fields[10].GetString(); 
    3260         if( !tmpChar ) 
    3261         { 
    3262             outfile << "NULL";                              // text1 
    3263         } 
    3264         else 
    3265         { 
    3266             outfile << "'"; 
    3267             outfile << tmpChar;                             // text1 
    3268             outfile << "'"; 
    3269         } 
     3261        outfile << fields[10].GetUInt32();                  // textid1 
    32703262        outfile << ", "; 
    3271         tmpChar = fields[11].GetString(); 
    3272         if( !tmpChar ) 
    3273         { 
    3274             outfile << "NULL";                              // text2 
    3275         } 
    3276         else 
    3277         { 
    3278             outfile << "'"; 
    3279             outfile << tmpChar;                             // text2 
    3280             outfile << "'"; 
    3281         } 
     3263        outfile << fields[11].GetUInt32();                  // textid2 
    32823264        outfile << ", "; 
    3283         tmpChar = fields[12].GetString(); 
    3284         if( !tmpChar ) 
    3285         { 
    3286             outfile << "NULL";                              // text3 
    3287         } 
    3288         else 
    3289         { 
    3290             outfile << "'"; 
    3291             outfile << tmpChar;                             // text3 
    3292             outfile << "'"; 
    3293         } 
     3265        outfile << fields[12].GetUInt32();                  // textid3 
    32943266        outfile << ", "; 
    3295         tmpChar = fields[13].GetString(); 
    3296         if( !tmpChar ) 
    3297         { 
    3298             outfile << "NULL";                              // text4 
    3299         } 
    3300         else 
    3301         { 
    3302             outfile << "'"; 
    3303             outfile << tmpChar;                             // text4 
    3304             outfile << "'"; 
    3305         } 
     3267        outfile << fields[13].GetUInt32();                  // textid4 
    33063268        outfile << ", "; 
    3307         tmpChar = fields[14].GetString(); 
    3308         if( !tmpChar ) 
    3309         { 
    3310             outfile << "NULL";                              // text5 
    3311         } 
    3312         else 
    3313         { 
    3314             outfile << "'"; 
    3315             outfile << tmpChar;                             // text5 
    3316             outfile << "'"; 
    3317         } 
     3269        outfile << fields[14].GetUInt32();                  // textid5 
    33183270        outfile << ");\n "; 
    33193271 
  • trunk/src/game/Level3.cpp

    r235 r260  
    136136    HandleReloadSpellScriptsCommand("a"); 
    137137    SendGlobalSysMessage("DB tables `*_scripts` reloaded."); 
     138    HandleReloadDbScriptStringCommand("a"); 
    138139    return true; 
    139140} 
     
    599600        SendGlobalSysMessage("DB table `spell_scripts` reloaded."); 
    600601 
     602    return true; 
     603} 
     604 
     605bool ChatHandler::HandleReloadDbScriptStringCommand(const char* arg) 
     606{ 
     607    sLog.outString( "Re-Loading Script strings from `db_script_string`..."); 
     608    objmgr.LoadDbScriptStrings(); 
     609    SendGlobalSysMessage("DB table `db_script_string` reloaded."); 
    601610    return true; 
    602611} 
     
    17681777        // search highest talent rank 
    17691778        uint32 spellid = 0; 
    1770         for(int rank = 4; rank >= 0; --rank) 
     1779        int rank = 4; 
     1780        for(; rank >= 0; --rank) 
    17711781        { 
    17721782            if(talentInfo->RankID[rank]!=0) 
     
    46464656} 
    46474657 
    4648 bool ChatHandler::HandleShutDownCommand(const char* args) 
     4658bool ChatHandler::HandleServerShutDownCancelCommand(const char* args) 
     4659{ 
     4660    sWorld.ShutdownCancel(); 
     4661    return true; 
     4662} 
     4663 
     4664bool ChatHandler::HandleServerShutDownCommand(const char* args) 
    46494665{ 
    46504666    if(!*args) 
    46514667        return false; 
    46524668 
    4653     if(std::string(args)=="cancel") 
    4654     { 
    4655         sWorld.ShutdownCancel(); 
     4669    char* time_str = strtok ((char*) args, " "); 
     4670    char* exitcode_str = strtok (NULL, ""); 
     4671 
     4672    int32 time = atoi (time_str); 
     4673 
     4674    ///- Prevent interpret wrong arg value as 0 secs shutdown time 
     4675    if(time == 0 && (time_str[0]!='0' || time_str[1]!='\0') || time < 0) 
     4676        return false; 
     4677 
     4678    if (exitcode_str) 
     4679    { 
     4680        int32 exitcode = atoi (exitcode_str); 
     4681 
     4682        // Handle atoi() errors 
     4683        if (exitcode == 0 && (exitcode_str[0] != '0' || exitcode_str[1] != '\0')) 
     4684            return false; 
     4685 
     4686        // Exit code should be in range of 0-125, 126-255 is used 
     4687        // in many shells for their own return codes and code > 255 
     4688        // is not supported in many others 
     4689        if (exitcode < 0 || exitcode > 125) 
     4690            return false; 
     4691 
     4692        sWorld.ShutdownServ (time, 0, exitcode); 
    46564693    } 
    46574694    else 
    4658     { 
    4659         int32 time = atoi(args); 
    4660  
    4661         ///- Prevent interpret wrong arg value as 0 secs shutdown time 
    4662         if(time == 0 && (args[0]!='0' || args[1]!='\0') || time < 0) 
     4695        sWorld.ShutdownServ(time,0,SHUTDOWN_EXIT_CODE); 
     4696    return true; 
     4697} 
     4698 
     4699bool ChatHandler::HandleServerRestartCommand(const char* args) 
     4700{ 
     4701    if(!*args) 
     4702        return false; 
     4703 
     4704    char* time_str = strtok ((char*) args, " "); 
     4705    char* exitcode_str = strtok (NULL, ""); 
     4706 
     4707    int32 time = atoi (time_str); 
     4708 
     4709    ///- Prevent interpret wrong arg value as 0 secs shutdown time 
     4710    if(time == 0 && (time_str[0]!='0' || time_str[1]!='\0') || time < 0) 
     4711        return false; 
     4712 
     4713    if (exitcode_str) 
     4714    { 
     4715        int32 exitcode = atoi (exitcode_str); 
     4716 
     4717        // Handle atoi() errors 
     4718        if (exitcode == 0 && (exitcode_str[0] != '0' || exitcode_str[1] != '\0')) 
    46634719            return false; 
    46644720 
    4665         sWorld.ShutdownServ(time); 
    4666     } 
    4667     return true; 
    4668 } 
    4669  
    4670 bool ChatHandler::HandleRestartCommand(const char* args) 
     4721        // Exit code should be in range of 0-125, 126-255 is used 
     4722        // in many shells for their own return codes and code > 255 
     4723        // is not supported in many others 
     4724        if (exitcode < 0 || exitcode > 125) 
     4725            return false; 
     4726 
     4727        sWorld.ShutdownServ (time, SHUTDOWN_MASK_RESTART, exitcode); 
     4728    } 
     4729    else 
     4730        sWorld.ShutdownServ(time, SHUTDOWN_MASK_RESTART, RESTART_EXIT_CODE); 
     4731    return true; 
     4732} 
     4733 
     4734bool ChatHandler::HandleServerIdleRestartCommand(const char* args) 
    46714735{ 
    46724736    if(!*args) 
    46734737        return false; 
    46744738 
    4675     if(std::string(args)=="cancel") 
    4676     { 
    4677         sWorld.ShutdownCancel(); 
     4739    char* time_str = strtok ((char*) args, " "); 
     4740    char* exitcode_str = strtok (NULL, ""); 
     4741 
     4742    int32 time = atoi (time_str); 
     4743 
     4744    ///- Prevent interpret wrong arg value as 0 secs shutdown time 
     4745    if(time == 0 && (time_str[0]!='0' || time_str[1]!='\0') || time < 0) 
     4746        return false; 
     4747 
     4748    if (exitcode_str) 
     4749    { 
     4750        int32 exitcode = atoi (exitcode_str); 
     4751 
     4752        // Handle atoi() errors 
     4753        if (exitcode == 0 && (exitcode_str[0] != '0' || exitcode_str[1] != '\0')) 
     4754            return false; 
     4755 
     4756        // Exit code should be in range of 0-125, 126-255 is used 
     4757        // in many shells for their own return codes and code > 255 
     4758        // is not supported in many others 
     4759        if (exitcode < 0 || exitcode > 125) 
     4760            return false; 
     4761 
     4762        sWorld.ShutdownServ (time, SHUTDOWN_MASK_RESTART|SHUTDOWN_MASK_IDLE, exitcode); 
    46784763    } 
    46794764    else 
    4680     { 
    4681         int32 time = atoi(args); 
    4682  
    4683         ///- Prevent interpret wrong arg value as 0 secs shutdown time 
    4684         if(time == 0 && (args[0]!='0' || args[1]!='\0') || time < 0) 
     4765        sWorld.ShutdownServ(time,SHUTDOWN_MASK_RESTART|SHUTDOWN_MASK_IDLE,RESTART_EXIT_CODE); 
     4766    return true; 
     4767} 
     4768 
     4769bool ChatHandler::HandleServerIdleShutDownCommand(const char* args) 
     4770{ 
     4771    if(!*args) 
     4772        return false; 
     4773 
     4774    char* time_str = strtok ((char*) args, " "); 
     4775    char* exitcode_str = strtok (NULL, ""); 
     4776 
     4777    int32 time = atoi (time_str); 
     4778 
     4779    ///- Prevent interpret wrong arg value as 0 secs shutdown time 
     4780    if(time == 0 && (time_str[0]!='0' || time_str[1]!='\0') || time < 0) 
     4781        return false; 
     4782 
     4783    if (exitcode_str) 
     4784    { 
     4785        int32 exitcode = atoi (exitcode_str); 
     4786 
     4787        // Handle atoi() errors 
     4788        if (exitcode == 0 && (exitcode_str[0] != '0' || exitcode_str[1] != '\0')) 
    46854789            return false; 
    46864790 
    4687         sWorld.ShutdownServ(time, SHUTDOWN_MASK_RESTART); 
    4688     } 
    4689     return true; 
    4690 } 
    4691  
    4692 bool ChatHandler::HandleIdleRestartCommand(const char* args) 
    4693 { 
    4694     if(!*args) 
    4695         return false; 
    4696  
    4697     if(std::string(args)=="cancel") 
    4698     { 
    4699         sWorld.ShutdownCancel(); 
     4791        // Exit code should be in range of 0-125, 126-255 is used 
     4792        // in many shells for their own return codes and code > 255 
     4793        // is not supported in many others 
     4794        if (exitcode < 0 || exitcode > 125) 
     4795            return false; 
     4796 
     4797        sWorld.ShutdownServ (time, SHUTDOWN_MASK_IDLE, exitcode); 
    47004798    } 
    47014799    else 
    4702     { 
    4703         int32 time = atoi(args); 
    4704  
    4705         ///- Prevent interpret wrong arg value as 0 secs shutdown time 
    4706         if(time == 0 && (args[0]!='0' || args[1]!='\0') || time < 0) 
    4707             return false; 
    4708  
    4709         sWorld.ShutdownServ(time,SHUTDOWN_MASK_RESTART+SHUTDOWN_MASK_IDLE); 
    4710     } 
    4711     return true; 
    4712 } 
    4713  
    4714 bool ChatHandler::HandleIdleShutDownCommand(const char* args) 
    4715 { 
    4716     if(!*args) 
    4717         return false; 
    4718  
    4719     if(std::string(args)=="cancel") 
    4720     { 
    4721         sWorld.ShutdownCancel(); 
    4722     } 
    4723     else 
    4724     { 
    4725         int32 time = atoi(args); 
    4726  
    4727         ///- Prevent interpret wrong arg value as 0 secs shutdown time 
    4728         if(time == 0 && (args[0]!='0' || args[1]!='\0') || time < 0) 
    4729             return false; 
    4730  
    4731         sWorld.ShutdownServ(time,SHUTDOWN_MASK_IDLE); 
    4732     } 
     4800        sWorld.ShutdownServ(time,SHUTDOWN_MASK_IDLE,SHUTDOWN_EXIT_CODE); 
    47334801    return true; 
    47344802} 
  • trunk/src/game/Mail.cpp

    r229 r260  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1919 */ 
    2020 
     
    188188                return; 
    189189            } 
    190  
    191190            if (mailItem.item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_CONJURED) || mailItem.item->GetUInt32Value(ITEM_FIELD_DURATION)) 
    192191            { 
     
    195194            } 
    196195 
    197                         if(COD && mailItem.item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_WRAPPED)) 
    198                         { 
    199                                 pl->SendMailResult(0, 0, MAIL_ERR_CANT_SEND_WRAPPED_COD); 
    200                                 return; 
    201                         } 
     196            if(COD && mailItem.item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_WRAPPED)) 
     197            { 
     198                pl->SendMailResult(0, 0, MAIL_ERR_CANT_SEND_WRAPPED_COD); 
     199                return; 
     200            } 
    202201        } 
    203202    } 
  • trunk/src/game/Map.cpp

    r257 r260  
    17141714    if (mInstance) 
    17151715    { 
    1716         i_script = mInstance->script; 
     1716        i_script_id = mInstance->script_id; 
    17171717        i_data = Script->CreateInstanceData(this); 
    17181718    } 
     
    17311731            if(data) 
    17321732            { 
    1733                 sLog.outDebug("Loading instance data for `%s` with id %u", i_script.c_str(), i_InstanceId); 
     1733                sLog.outDebug("Loading instance data for `%s` with id %u", objmgr.GetScriptName(i_script_id), i_InstanceId); 
    17341734                i_data->Load(data); 
    17351735            } 
     
    17391739    else 
    17401740    { 
    1741         sLog.outDebug("New instance data, \"%s\" ,initialized!",i_script.c_str()); 
     1741        sLog.outDebug("New instance data, \"%s\" ,initialized!", objmgr.GetScriptName(i_script_id)); 
    17421742        i_data->Initialize(); 
    17431743    } 
  • trunk/src/game/Map.h

    r257 r260  
    106106    float startLocZ; 
    107107    float startLocO; 
    108     char const* script; 
     108    uint32 script_id; 
    109109}; 
    110110 
     
    344344        void CreateInstanceData(bool load); 
    345345        bool Reset(uint8 method); 
    346         std::string GetScript() { return i_script; } 
     346        uint32 GetScriptId() { return i_script_id; } 
    347347        InstanceData* GetInstanceData() { return i_data; } 
    348348        void PermBindAllPlayers(Player *player); 
     
    356356        bool m_unloadWhenEmpty; 
    357357        InstanceData* i_data; 
    358         std::string i_script; 
    359         // only online players that are inside the instance currently 
    360         // TODO ? - use the grid instead to access the players 
    361         PlayerList i_Players; 
     358        uint32 i_script_id; 
    362359}; 
    363360 
  • trunk/src/game/MapManager.cpp

    r257 r260  
    223223} 
    224224 
    225 void MapManager::DeleteInstance(uint32 mapid, uint32 instanceId, uint8 mode) 
     225void MapManager::DeleteInstance(uint32 mapid, uint32 instanceId) 
    226226{ 
    227227    Map *m = _GetBaseMap(mapid); 
  • trunk/src/game/MapManager.h

    r206 r260  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1919 */ 
    2020 
     
    2828#include "Map.h" 
    2929#include "GridStates.h" 
     30 
    3031class Transport; 
    3132 
     
    4546        // only const version for outer users 
    4647        Map const* GetBaseMap(uint32 id) const { return const_cast<MapManager*>(this)->_GetBaseMap(id); } 
    47         void DeleteInstance(uint32 mapid, uint32 instanceId, uint8 mode); 
     48        void DeleteInstance(uint32 mapid, uint32 instanceId); 
    4849 
    4950        inline uint16 GetAreaFlag(uint32 mapid, float x, float y) const 
  • trunk/src/game/ObjectMgr.cpp

    r230 r260  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1919 */ 
    2020 
     
    2222#include "Database/DatabaseEnv.h" 
    2323#include "Database/SQLStorage.h" 
     24#include "Database/SQLStorageImpl.h" 
    2425 
    2526#include "Log.h" 
     
    117118    m_hiDoGuid          = 1; 
    118119    m_hiCorpseGuid      = 1; 
    119  
    120120    m_hiPetNumber       = 1; 
     121    m_ItemTextId        = 1; 
     122    m_mailid            = 1; 
     123    m_auctionid         = 1; 
     124    m_guildId           = 1; 
     125    m_arenaTeamId       = 1; 
    121126 
    122127    mGuildBankTabPrice.resize(GUILD_BANK_MAX_TABS); 
     
    416421 
    417422        //prepare mail data... : 
    418         uint32 itemTextId = this->CreateItemText( msgAuctionWonBody.str() ); 
     423        uint32 itemTextId = CreateItemText( msgAuctionWonBody.str() ); 
    419424 
    420425        // set owner to bidder (to prevent delete item with sender char deleting) 
     
    467472        sLog.outDebug("AuctionSalePending body string : %s", msgAuctionSalePendingBody.str().c_str()); 
    468473 
    469         uint32 itemTextId = this->CreateItemText( msgAuctionSalePendingBody.str() ); 
     474        uint32 itemTextId = CreateItemText( msgAuctionSalePendingBody.str() ); 
    470475 
    471476        WorldSession::SendMailTo(owner, MAIL_AUCTION, MAIL_STATIONERY_AUCTION, auction->location, auction->owner, msgAuctionSalePendingSubject.str(), itemTextId, NULL, 0, 0, MAIL_CHECK_MASK_AUCTION); 
     
    499504        sLog.outDebug("AuctionSuccessful body string : %s", auctionSuccessfulBody.str().c_str()); 
    500505 
    501         uint32 itemTextId = this->CreateItemText( auctionSuccessfulBody.str() ); 
     506        uint32 itemTextId = CreateItemText( auctionSuccessfulBody.str() ); 
    502507 
    503508        uint32 profit = auction->bid + auction->deposit - auctionCut; 
     
    546551        // will delete item or place to receiver mail list 
    547552        WorldSession::SendMailTo(owner, MAIL_AUCTION, MAIL_STATIONERY_AUCTION, auction->location, GUID_LOPART(owner_guid), subject.str(), 0, &mi, 0, 0, MAIL_CHECK_MASK_NONE); 
    548  
    549553    } 
    550554    // owner not found 
     
    564568void ObjectMgr::LoadCreatureLocales() 
    565569{ 
    566     mCreatureLocaleMap.clear(); 
    567      
     570    mCreatureLocaleMap.clear();                              // need for reload case 
     571 
    568572    QueryResult *result = WorldDatabase.Query("SELECT entry,name_loc1,subname_loc1,name_loc2,subname_loc2,name_loc3,subname_loc3,name_loc4,subname_loc4,name_loc5,subname_loc5,name_loc6,subname_loc6,name_loc7,subname_loc7,name_loc8,subname_loc8 FROM locales_creature"); 
    569573 
     
    624628    sLog.outString( ">> Loaded %u creature locale strings", mCreatureLocaleMap.size() ); 
    625629} 
    626  
     630    
    627631void ObjectMgr::LoadNpcOptionLocales() 
    628632{ 
     
    693697} 
    694698 
     699struct SQLCreatureLoader : public SQLStorageLoaderBase<SQLCreatureLoader> 
     700{ 
     701    template<class D> 
     702    void convert_from_str(uint32 field_pos, char *src, D &dst) 
     703    { 
     704        dst = D(objmgr.GetScriptId(src)); 
     705    } 
     706}; 
     707 
    695708void ObjectMgr::LoadCreatureTemplates() 
    696709{ 
    697     sCreatureStorage.Load(); 
     710    SQLCreatureLoader loader; 
     711    loader.Load(sCreatureStorage); 
    698712 
    699713    sLog.outString( ">> Loaded %u creature definitions", sCreatureStorage.RecordCount ); 
     
    15131527        aItem->location = fields[11].GetUInt8(); 
    15141528        //check if sold item exists 
    1515         if ( this->GetAItem( aItem->item_guidlow ) ) 
     1529        if ( GetAItem( aItem->item_guidlow ) ) 
    15161530        { 
    15171531            GetAuctionsMap( aItem->location )->AddAuction(aItem); 
     
    15331547void ObjectMgr::LoadItemLocales() 
    15341548{ 
    1535     mItemLocaleMap.clear(); 
    1536      
     1549    mItemLocaleMap.clear();                                 // need for reload case 
     1550 
    15371551    QueryResult *result = WorldDatabase.Query("SELECT entry,name_loc1,description_loc1,name_loc2,description_loc2,name_loc3,description_loc3,name_loc4,description_loc4,name_loc5,description_loc5,name_loc6,description_loc6,name_loc7,description_loc7,name_loc8,description_loc8 FROM locales_item"); 
    15381552 
     
    15951609} 
    15961610 
     1611struct SQLItemLoader : public SQLStorageLoaderBase<SQLItemLoader> 
     1612{ 
     1613    template<class D> 
     1614    void convert_from_str(uint32 field_pos, char *src, D &dst) 
     1615    { 
     1616        dst = D(objmgr.GetScriptId(src)); 
     1617    } 
     1618}; 
     1619 
    15971620void ObjectMgr::LoadItemPrototypes() 
    15981621{ 
    1599     sItemStorage.Load (); 
     1622    SQLItemLoader loader; 
     1623    loader.Load(sItemStorage); 
    16001624    sLog.outString( ">> Loaded %u item prototypes", sItemStorage.RecordCount ); 
    16011625    sLog.outString(); 
     
    25072531            if (sWorld.getConfig(CONFIG_EXPANSION) < 1 && (race == RACE_BLOODELF || race == RACE_DRAENEI)) 
    25082532                continue; 
    2509                  
     2533 
    25102534            // skip expansion classes if not playing with expansion 
    25112535            if (sWorld.getConfig(CONFIG_EXPANSION) < 2 && class_ == CLASS_DEATH_KNIGHT) 
     
    35563580void ObjectMgr::LoadQuestLocales() 
    35573581{ 
    3558     mQuestLocaleMap.clear(); 
     3582    mQuestLocaleMap.clear();                                // need for reload case 
    35593583 
    35603584    QueryResult *result = WorldDatabase.Query("SELECT entry," 
     
    37503774    scripts.clear();                                        // need for reload support 
    37513775 
    3752     QueryResult *result = WorldDatabase.PQuery( "SELECT id,delay,command,datalong,datalong2,datatext, x, y, z, o FROM %s", tablename ); 
     3776    QueryResult *result = WorldDatabase.PQuery( "SELECT id,delay,command,datalong,datalong2,dataint, x, y, z, o FROM %s", tablename ); 
    37533777 
    37543778    uint32 count = 0; 
     
    37723796        Field *fields = result->Fetch(); 
    37733797        ScriptInfo tmp; 
    3774         tmp.id = fields[0].GetUInt32(); 
    3775         tmp.delay = fields[1].GetUInt32(); 
    3776         tmp.command = fields[2].GetUInt32(); 
    3777         tmp.datalong = fields[3].GetUInt32(); 
     3798        tmp.id        = fields[0].GetUInt32(); 
     3799        tmp.delay     = fields[1].GetUInt32(); 
     3800        tmp.command   = fields[2].GetUInt32(); 
     3801        tmp.datalong  = fields[3].GetUInt32(); 
    37783802        tmp.datalong2 = fields[4].GetUInt32(); 
    3779         tmp.datatext = fields[5].GetCppString(); 
    3780         tmp.x = fields[6].GetFloat(); 
    3781         tmp.y = fields[7].GetFloat(); 
    3782         tmp.z = fields[8].GetFloat(); 
    3783         tmp.o = fields[9].GetFloat(); 
     3803        tmp.dataint   = fields[5].GetInt32(); 
     3804        tmp.x         = fields[6].GetFloat(); 
     3805        tmp.y         = fields[7].GetFloat(); 
     3806        tmp.z         = fields[8].GetFloat(); 
     3807        tmp.o         = fields[9].GetFloat(); 
    37843808 
    37853809        // generic command args check 
     
    37933817                    continue; 
    37943818                } 
     3819                if(tmp.dataint==0) 
     3820                { 
     3821                    sLog.outErrorDb("Table `%s` has invalid talk text id (dataint = %i) in SCRIPT_COMMAND_TALK for script id %u",tablename,tmp.dataint,tmp.id); 
     3822                    continue; 
     3823                } 
     3824                if(tmp.dataint < MIN_DB_SCRIPT_STRING_ID || tmp.dataint >= MAX_DB_SCRIPT_STRING_ID) 
     3825                { 
     3826                    sLog.outErrorDb("Table `%s` has out of range text id (dataint = %i expected %u-%u) in SCRIPT_COMMAND_TALK for script id %u",tablename,tmp.dataint,MIN_DB_SCRIPT_STRING_ID,MAX_DB_SCRIPT_STRING_ID,tmp.id); 
     3827                    continue; 
     3828                } 
     3829 
     3830                // if(!objmgr.GetMangosStringLocale(tmp.dataint)) will checked after db_script_string loading 
    37953831                break; 
    37963832            } 
     
    41574193void ObjectMgr::LoadPageTextLocales() 
    41584194{ 
    4159     mPageTextLocaleMap.clear(); 
    4160      
     4195    mPageTextLocaleMap.clear();                             // need for reload case 
     4196 
    41614197    QueryResult *result = WorldDatabase.Query("SELECT entry,text_loc1,text_loc2,text_loc3,text_loc4,text_loc5,text_loc6,text_loc7,text_loc8 FROM locales_page_text"); 
    41624198 
     
    42074243} 
    42084244 
     4245struct SQLInstanceLoader : public SQLStorageLoaderBase<SQLInstanceLoader> 
     4246{ 
     4247    template<class D> 
     4248    void convert_from_str(uint32 field_pos, char *src, D &dst) 
     4249    { 
     4250        dst = D(objmgr.GetScriptId(src)); 
     4251    } 
     4252}; 
     4253 
    42094254void ObjectMgr::LoadInstanceTemplate() 
    42104255{ 
    4211     sInstanceTemplate.Load(); 
     4256    SQLInstanceLoader loader; 
     4257    loader.Load(sInstanceTemplate); 
    42124258 
    42134259    for(uint32 i = 0; i < sInstanceTemplate.MaxEntry; i++) 
     
    43254371void ObjectMgr::LoadNpcTextLocales() 
    43264372{ 
    4327     mNpcTextLocaleMap.clear(); 
    4328      
     4373    mNpcTextLocaleMap.clear();                              // need for reload case 
     4374 
    43294375    QueryResult *result = WorldDatabase.Query("SELECT entry," 
    43304376        "Text0_0_loc1,Text0_1_loc1,Text1_0_loc1,Text1_1_loc1,Text2_0_loc1,Text2_1_loc1,Text3_0_loc1,Text3_1_loc1,Text4_0_loc1,Text4_1_loc1,Text5_0_loc1,Text5_1_loc1,Text6_0_loc1,Text6_1_loc1,Text7_0_loc1,Text7_1_loc1," 
     
    46234669 
    46244670        uint32 Trigger_ID      = fields[0].GetUInt32(); 
    4625         std::string scriptName = fields[1].GetCppString(); 
     4671        const char *scriptName = fields[1].GetString(); 
    46264672 
    46274673        AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(Trigger_ID); 
     
    46314677            continue; 
    46324678        } 
    4633         mAreaTriggerScripts[Trigger_ID] = scriptName; 
     4679        mAreaTriggerScripts[Trigger_ID] = GetScriptId(scriptName); 
    46344680    } while( result->NextRow() ); 
    46354681 
     
    46394685    sLog.outString( ">> Loaded %u areatrigger scripts", count ); 
    46404686} 
     4687 
    46414688uint32 ObjectMgr::GetNearestTaxiNode( float x, float y, float z, uint32 mapid ) 
    46424689{ 
     
    46974744uint16 ObjectMgr::GetTaxiMount( uint32 id, uint32 team ) 
    46984745{ 
    4699     uint32 mount_entry = 0; 
    4700     uint32 mount_id = 0; 
     4746    uint16 mount_entry = 0; 
     4747    uint16 mount_id = 0; 
    47014748 
    47024749    TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(id); 
    4703     if (node) 
     4750    if(node) 
    47044751    { 
    47054752        if (team == ALLIANCE) mount_entry = node->alliance_mount_type; 
     
    49404987    } 
    49414988 
    4942             // find now nearest graveyard at same map 
    49434989    if(entryNear) 
    49444990        return entryNear; 
     
    51815227    { 
    51825228        m_hiCharGuid = (*result)[0].GetUInt32()+1; 
    5183  
    51845229        delete result; 
    51855230    } 
     
    51895234    { 
    51905235        m_hiCreatureGuid = (*result)[0].GetUInt32()+1; 
    5191  
    51925236        delete result; 
    51935237    } 
    51945238 
    5195     result = CharacterDatabase.Query( "SELECT MAX(id) FROM character_pet" ); 
    5196     if( result ) 
    5197     { 
    5198         m_hiPetGuid = (*result)[0].GetUInt32()+1; 
    5199  
    5200         delete result; 
    5201     } 
     5239    // pet guids are not saved to DB, set to 0 (pet guid != pet id) 
     5240    m_hiPetGuid = 0; 
    52025241 
    52035242    result = CharacterDatabase.Query( "SELECT MAX(guid) FROM item_instance" ); 
     
    52055244    { 
    52065245        m_hiItemGuid = (*result)[0].GetUInt32()+1; 
    5207  
    52085246        delete result; 
    52095247    } 
     
    52195257    { 
    52205258        m_hiGoGuid = (*result)[0].GetUInt32()+1; 
    5221  
    52225259        delete result; 
    52235260    } 
     
    52275264    { 
    52285265        m_auctionid = (*result)[0].GetUInt32()+1; 
    5229  
    52305266        delete result; 
    52315267    } 
    5232     else 
    5233     { 
    5234         m_auctionid = 0; 
    5235     } 
     5268 
    52365269    result = CharacterDatabase.Query( "SELECT MAX(id) FROM mail" ); 
    52375270    if( result ) 
    52385271    { 
    52395272        m_mailid = (*result)[0].GetUInt32()+1; 
    5240  
    52415273        delete result; 
    52425274    } 
    5243     else 
    5244     { 
    5245         m_mailid = 0; 
    5246     } 
     5275 
    52475276    result = CharacterDatabase.Query( "SELECT MAX(id) FROM item_text" ); 
    52485277    if( result ) 
    52495278    { 
    5250         m_ItemTextId = (*result)[0].GetUInt32(); 
    5251  
     5279        m_ItemTextId = (*result)[0].GetUInt32()+1; 
    52525280        delete result; 
    52535281    } 
    5254     else 
    5255         m_ItemTextId = 0; 
    52565282 
    52575283    result = CharacterDatabase.Query( "SELECT MAX(guid) FROM corpse" ); 
     
    52595285    { 
    52605286        m_hiCorpseGuid = (*result)[0].GetUInt32()+1; 
    5261  
    52625287        delete result; 
    52635288    } 
     5289 
     5290    result = CharacterDatabase.Query("SELECT MAX(arenateamid) FROM arena_team"); 
     5291    if (result) 
     5292    { 
     5293        m_arenaTeamId = (*result)[0].GetUInt32()+1; 
     5294        delete result; 
     5295    } 
     5296 
     5297    result = CharacterDatabase.Query( "SELECT MAX(guildid) FROM guild" ); 
     5298    if (result) 
     5299    { 
     5300        m_guildId = (*result)[0].GetUInt32()+1; 
     5301        delete result; 
     5302    } 
     5303} 
     5304 
     5305uint32 ObjectMgr::GenerateArenaTeamId() 
     5306{ 
     5307    if(m_arenaTeamId>=0xFFFFFFFE) 
     5308    { 
     5309        sLog.outError("Arena team ids overflow!! Can't continue, shutting down server. "); 
     5310        World::StopNow(ERROR_EXIT_CODE); 
     5311    } 
     5312    return m_arenaTeamId++; 
     5313} 
     5314 
     5315uint32 ObjectMgr::GenerateGuildId() 
     5316{ 
     5317    if(m_guildId>=0xFFFFFFFE) 
     5318    { 
     5319        sLog.outError("Guild ids overflow!! Can't continue, shutting down server. "); 
     5320        World::StopNow(ERROR_EXIT_CODE); 
     5321    } 
     5322    return m_guildId++; 
    52645323} 
    52655324 
    52665325uint32 ObjectMgr::GenerateAuctionID() 
    52675326{ 
    5268     ++m_auctionid; 
    5269     if(m_auctionid>=0xFFFFFFFF) 
     5327    if(m_auctionid>=0xFFFFFFFE) 
    52705328    { 
    52715329        sLog.outError("Auctions ids overflow!! Can't continue, shutting down server. "); 
    5272         sWorld.m_stopEvent = true; 
    5273     } 
    5274     return m_auctionid; 
     5330        World::StopNow(ERROR_EXIT_CODE); 
     5331    } 
     5332    return m_auctionid++; 
    52755333} 
    52765334 
    52775335uint32 ObjectMgr::GenerateMailID() 
    52785336{ 
    5279     ++m_mailid; 
    5280     if(m_mailid>=0xFFFFFFFF) 
     5337    if(m_mailid>=0xFFFFFFFE) 
    52815338    { 
    52825339        sLog.outError("Mail ids overflow!! Can't continue, shutting down server. "); 
    5283         sWorld.m_stopEvent = true; 
    5284     } 
    5285     return m_mailid; 
     5340        World::StopNow(ERROR_EXIT_CODE); 
     5341    } 
     5342    return m_mailid++; 
    52865343} 
    52875344 
    52885345uint32 ObjectMgr::GenerateItemTextID() 
    52895346{ 
    5290     ++m_ItemTextId; 
    5291     if(m_ItemTextId>=0xFFFFFFFF) 
     5347    if(m_ItemTextId>=0xFFFFFFFE) 
    52925348    { 
    52935349        sLog.outError("Item text ids overflow!! Can't continue, shutting down server. "); 
    5294         sWorld.m_stopEvent = true; 
    5295     } 
    5296     return m_ItemTextId; 
     5350        World::StopNow(ERROR_EXIT_CODE); 
     5351    } 
     5352    return m_ItemTextId++; 
    52975353} 
    52985354 
     
    53165372    { 
    53175373        case HIGHGUID_ITEM: 
    5318             ++m_hiItemGuid; 
    5319             if(m_hiItemGuid>=0xFFFFFFFF) 
     5374            if(m_hiItemGuid>=0xFFFFFFFE) 
    53205375            { 
    53215376                sLog.outError("Item guid overflow!! Can't continue, shutting down server. "); 
    5322                 sWorld.m_stopEvent = true; 
    5323             } 
    5324             return m_hiItemGuid; 
     5377                World::StopNow(ERROR_EXIT_CODE); 
     5378            } 
     5379            return m_hiItemGuid++; 
    53255380        case HIGHGUID_UNIT: 
    5326             ++m_hiCreatureGuid; 
    5327             if(m_hiCreatureGuid>=0x00FFFFFF) 
     5381            if(m_hiCreatureGuid>=0x00FFFFFE) 
    53285382            { 
    53295383                sLog.outError("Creature guid overflow!! Can't continue, shutting down server. "); 
    5330                 sWorld.m_stopEvent = true; 
    5331             } 
    5332             return m_hiCreatureGuid; 
     5384                World::StopNow(ERROR_EXIT_CODE); 
     5385            } 
     5386            return m_hiCreatureGuid++; 
    53335387        case HIGHGUID_PET: 
    5334             ++m_hiPetGuid; 
    5335             if(m_hiPetGuid>=0x00FFFFFF) 
     5388            if(m_hiPetGuid>=0x00FFFFFE) 
    53365389            { 
    53375390                sLog.outError("Pet guid overflow!! Can't continue, shutting down server. "); 
    5338                 sWorld.m_stopEvent = true; 
    5339             } 
    5340             return m_hiPetGuid; 
     5391                World::StopNow(ERROR_EXIT_CODE); 
     5392            } 
     5393            return m_hiPetGuid++; 
    53415394        case HIGHGUID_PLAYER: 
    5342             ++m_hiCharGuid; 
    5343             if(m_hiCharGuid>=0xFFFFFFFF) 
     5395            if(m_hiCharGuid>=0xFFFFFFFE) 
    53445396            { 
    53455397                sLog.outError("Players guid overflow!! Can't continue, shutting down server. "); 
    5346                 sWorld.m_stopEvent = true; 
    5347             } 
    5348             return m_hiCharGuid; 
     5398                World::StopNow(ERROR_EXIT_CODE); 
     5399            } 
     5400            return m_hiCharGuid++; 
    53495401        case HIGHGUID_GAMEOBJECT: 
    5350             ++m_hiGoGuid; 
    5351             if(m_hiGoGuid>=0x00FFFFFF) 
     5402            if(m_hiGoGuid>=0x00FFFFFE) 
    53525403            { 
    53535404                sLog.outError("Gameobject guid overflow!! Can't continue, shutting down server. "); 
    5354                 sWorld.m_stopEvent = true; 
    5355             } 
    5356             return m_hiGoGuid; 
     5405                World::StopNow(ERROR_EXIT_CODE); 
     5406            } 
     5407            return m_hiGoGuid++; 
    53575408        case HIGHGUID_CORPSE: 
    5358             ++m_hiCorpseGuid; 
    5359             if(m_hiCorpseGuid>=0xFFFFFFFF) 
     5409            if(m_hiCorpseGuid>=0xFFFFFFFE) 
    53605410            { 
    53615411                sLog.outError("Corpse guid overflow!! Can't continue, shutting down server. "); 
    5362                 sWorld.m_stopEvent = true; 
    5363             } 
    5364             return m_hiCorpseGuid; 
     5412                World::StopNow(ERROR_EXIT_CODE); 
     5413            } 
     5414            return m_hiCorpseGuid++; 
    53655415        case HIGHGUID_DYNAMICOBJECT: 
    5366             ++m_hiDoGuid; 
    5367             if(m_hiDoGuid>=0xFFFFFFFF) 
     5416            if(m_hiDoGuid>=0xFFFFFFFE) 
    53685417            { 
    53695418                sLog.outError("DynamicObject guid overflow!! Can't continue, shutting down server. "); 
    5370                 sWorld.m_stopEvent = true; 
    5371             } 
    5372             return m_hiDoGuid; 
     5419                World::StopNow(ERROR_EXIT_CODE); 
     5420            } 
     5421            return m_hiDoGuid++; 
    53735422        default: 
    53745423            ASSERT(0); 
     
    53815430void ObjectMgr::LoadGameObjectLocales() 
    53825431{ 
    5383     mGameObjectLocaleMap.clear(); 
    5384      
     5432    mGameObjectLocaleMap.clear();                           // need for reload case 
     5433 
    53855434    QueryResult *result = WorldDatabase.Query("SELECT entry," 
    53865435        "name_loc1,name_loc2,name_loc3,name_loc4,name_loc5,name_loc6,name_loc7,name_loc8," 
     
    54505499} 
    54515500 
     5501struct SQLGameObjectLoader : public SQLStorageLoaderBase<SQLGameObjectLoader> 
     5502{ 
     5503    template<class D> 
     5504    void convert_from_str(uint32 field_pos, char *src, D &dst) 
     5505    { 
     5506        dst = D(objmgr.GetScriptId(src)); 
     5507    } 
     5508}; 
     5509 
    54525510void ObjectMgr::LoadGameobjectInfo() 
    54535511{ 
    5454     sGOStorage.Load(); 
     5512    SQLGameObjectLoader loader; 
     5513    loader.Load(sGOStorage); 
    54555514 
    54565515    // some checks 
     
    66256684} 
    66266685 
    6627 const char* ObjectMgr::GetAreaTriggerScriptName(uint32 id) 
    6628 { 
    6629     AreaTriggerScriptMap::const_iterator i = mAreaTriggerScripts.find(id); 
     6686uint32 ObjectMgr::GetAreaTriggerScriptId(uint32 trigger_id) 
     6687{ 
     6688    AreaTriggerScriptMap::const_iterator i = mAreaTriggerScripts.find(trigger_id); 
    66306689    if(i!= mAreaTriggerScripts.end()) 
    6631         return i->second.c_str(); 
    6632     return ""; 
     6690        return i->second; 
     6691    return 0; 
    66336692} 
    66346693 
     
    66756734            return false; 
    66766735        } 
    6677                 case CONDITION_NO_AURA: 
    6678                         return !player->HasAura(value1, value2); 
    6679                 case CONDITION_ACTIVE_EVENT: 
    6680                         return gameeventmgr.IsActiveEvent(value1); 
     6736        case CONDITION_NO_AURA: 
     6737            return !player->HasAura(value1, value2); 
     6738        case CONDITION_ACTIVE_EVENT: 
     6739            return gameeventmgr.IsActiveEvent(value1); 
    66816740        default: 
    66826741            return false; 
     
    67996858            break; 
    68006859        } 
    6801                 case CONDITION_NO_AURA: 
    6802                 { 
    6803                         if(!sSpellStore.LookupEntry(value1)) 
    6804                         { 
    6805                                 sLog.outErrorDb("Aura condition requires to have non existing spell (Id: %d), skipped", value1); 
    6806                                 return false; 
    6807                         } 
    6808                         if(value2 > 2) 
    6809                         { 
    6810                                 sLog.outErrorDb("Aura condition requires to have non existing effect index (%u) (must be 0..2), skipped", value2); 
    6811                                 return false; 
    6812                         } 
    6813                         break; 
    6814                 } 
    6815                 case CONDITION_ACTIVE_EVENT: 
    6816                 { 
    6817                         GameEvent::GameEventDataMap const& events = gameeventmgr.GetEventMap(); 
    6818                         if(value1 >=events.size() || !events[value1].isValid()) 
    6819                         { 
    6820                                 sLog.outErrorDb("Active event condition requires existed event id (%u), skipped", value1); 
    6821                                 return false; 
    6822                         } 
    6823                         break; 
    6824                 } 
     6860        case CONDITION_NO_AURA: 
     6861        { 
     6862            if(!sSpellStore.LookupEntry(value1)) 
     6863            { 
     6864                sLog.outErrorDb("Aura condition requires to have non existing spell (Id: %d), skipped", value1); 
     6865                return false; 
     6866            } 
     6867            if(value2 > 2) 
     6868            { 
     6869                sLog.outErrorDb("Aura condition requires to have non existing effect index (%u) (must be 0..2), skipped", value2); 
     6870                return false; 
     6871            } 
     6872            break; 
     6873        } 
     6874        case CONDITION_ACTIVE_EVENT: 
     6875        { 
     6876            GameEvent::GameEventDataMap const& events = gameeventmgr.GetEventMap(); 
     6877            if(value1 >=events.size() || !events[value1].isValid()) 
     6878            { 
     6879                sLog.outErrorDb("Active event condition requires existed event id (%u), skipped", value1); 
     6880                return false; 
     6881            } 
     6882            break; 
     6883        } 
    68256884    } 
    68266885    return true; 
     
    69527011        if(itr->first > new_id) 
    69537012            new_id = itr->first; 
    6954      
     7013 
    69557014    // use next 
    69567015    ++new_id; 
     
    69927051void ObjectMgr::LoadTrainerSpell() 
    69937052{ 
    6994     // For reload case  
     7053    // For reload case 
    69957054    for (CacheTrainerSpellMap::iterator itr = m_mCacheTrainerSpellMap.begin(); itr != m_mCacheTrainerSpellMap.end(); ++itr) 
    69967055        itr->second.Clear(); 
     
    70837142void ObjectMgr::LoadVendors() 
    70847143{ 
    7085     // For reload case  
     7144    // For reload case 
    70867145    for (CacheVendorItemMap::iterator itr = m_mCacheVendorItemMap.begin(); itr != m_mCacheVendorItemMap.end(); ++itr) 
    70877146        itr->second.Clear(); 
     
    71907249        "SELECT id,gossip_id,npcflag,icon,action,box_money,coded,option_text,box_text " 
    71917250        "FROM npc_option"); 
     7251 
    71927252    if( !result ) 
    71937253    { 
     
    73427402} 
    73437403 
     7404void ObjectMgr::LoadScriptNames() 
     7405{ 
     7406    m_scriptNames.push_back(""); 
     7407    QueryResult *result = WorldDatabase.Query( 
     7408      "SELECT DISTINCT(ScriptName) FROM creature_template WHERE ScriptName <> '' " 
     7409      "UNION " 
     7410      "SELECT DISTINCT(ScriptName) FROM gameobject_template WHERE ScriptName <> '' " 
     7411      "UNION " 
     7412      "SELECT DISTINCT(ScriptName) FROM item_template WHERE ScriptName <> '' " 
     7413      "UNION " 
     7414      "SELECT DISTINCT(ScriptName) FROM areatrigger_scripts WHERE ScriptName <> '' " 
     7415      "UNION " 
     7416      "SELECT DISTINCT(script) FROM instance_template WHERE script <> ''"); 
     7417    if(result) 
     7418    { 
     7419        do 
     7420        { 
     7421            m_scriptNames.push_back((*result)[0].GetString()); 
     7422        } while (result->NextRow()); 
     7423        delete result; 
     7424    } 
     7425 
     7426    std::sort(m_scriptNames.begin(), m_scriptNames.end()); 
     7427} 
     7428 
     7429uint32 ObjectMgr::GetScriptId(const char *name) 
     7430{ 
     7431    // use binary search to find the script name in the sorted vector 
     7432    // assume "" is the first element 
     7433    if(!name) return 0; 
     7434    ScriptNameMap::const_iterator itr = 
     7435        std::lower_bound(m_scriptNames.begin(), m_scriptNames.end(), name); 
     7436    if(itr == m_scriptNames.end()) return 0; 
     7437    return itr - m_scriptNames.begin(); 
     7438} 
     7439 
     7440void ObjectMgr::CheckScripts(ScriptMapMap const& scripts,std::set<int32>& ids) 
     7441{ 
     7442    for(ScriptMapMap::const_iterator itrMM = scripts.begin(); itrMM != scripts.end(); ++itrMM) 
     7443    { 
     7444        for(ScriptMap::const_iterator itrM = itrMM->second.begin(); itrM != itrMM->second.end(); ++itrM) 
     7445        { 
     7446            if(itrM->second.dataint) 
     7447            { 
     7448                if(!GetTrinityStringLocale (itrM->second.dataint)) 
     7449                    sLog.outErrorDb( "Table `db_script_string` has not existed string id  %u", *itrM); 
     7450 
     7451                if(ids.count(itrM->second.dataint)) 
     7452                    ids.erase(itrM->second.dataint); 
     7453            } 
     7454        } 
     7455    } 
     7456} 
     7457 
     7458void ObjectMgr::LoadDbScriptStrings() 
     7459{ 
     7460    LoadTrinityStrings(WorldDatabase,"db_script_string",MIN_DB_SCRIPT_STRING_ID,MAX_DB_SCRIPT_STRING_ID); 
     7461 
     7462    std::set<int32> ids; 
     7463 
     7464    for(int32 i = MIN_DB_SCRIPT_STRING_ID; i < MAX_DB_SCRIPT_STRING_ID; ++i) 
     7465        if(GetTrinityStringLocale(i)) 
     7466            ids.insert(i); 
     7467 
     7468    CheckScripts(sQuestEndScripts,ids); 
     7469    CheckScripts(sQuestStartScripts,ids); 
     7470    CheckScripts(sSpellScripts,ids); 
     7471    CheckScripts(sGameObjectScripts,ids); 
     7472    CheckScripts(sEventScripts,ids); 
     7473 
     7474    for(std::set<int32>::const_iterator itr = ids.begin(); itr != ids.end(); ++itr) 
     7475        sLog.outErrorDb( "Table `db_script_string` has unused string id  %u", *itr); 
     7476} 
     7477 
    73447478// Functions for scripting access 
    7345 const char* GetAreaTriggerScriptNameById(uint32 id) 
    7346 { 
    7347     return objmgr.GetAreaTriggerScriptName(id); 
     7479uint32 GetAreaTriggerScriptId(uint32 trigger_id) 
     7480{ 
     7481    return objmgr.GetAreaTriggerScriptId(trigger_id); 
    73487482} 
    73497483 
     
    73607494    return objmgr.LoadTrinityStrings(db,table,end_value,start_value); 
    73617495} 
     7496 
     7497uint32 TRINITY_DLL_SPEC GetScriptId(const char *name) 
     7498{ 
     7499    return objmgr.GetScriptId(name); 
     7500} 
     7501 
     7502ObjectMgr::ScriptNameMap & GetScriptNames() 
     7503{ 
     7504    return objmgr.GetScriptNames(); 
     7505} 
  • trunk/src/game/ObjectMgr.h

    r206 r260  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1919 */ 
    2020 
     
    8585    uint32 datalong; 
    8686    uint32 datalong2; 
    87     std::string datatext; 
     87    int32  dataint; 
    8888    float x; 
    8989    float y; 
     
    128128 
    129129typedef UNORDERED_MAP<uint64/*(instance,guid) pair*/,time_t> RespawnTimes; 
     130 
     131 
     132// mangos string ranges 
     133#define MIN_TRINITY_STRING_ID    1 
     134#define MAX_TRINITY_STRING_ID    2000000000 
     135#define MIN_DB_SCRIPT_STRING_ID MAX_TRINITY_STRING_ID 
     136#define MAX_DB_SCRIPT_STRING_ID 2000010000 
    130137 
    131138struct TrinityStringLocale 
     
    208215    CONDITION_QUESTTAKEN            = 9,                    // quest_id     0,      for condition true while quest active. 
    209216    CONDITION_AD_COMMISSION_AURA    = 10,                   // 0            0,      for condition true while one from AD ñommission aura active 
    210         CONDITION_NO_AURA               = 11,                   // spell_id     effindex 
    211         CONDITION_ACTIVE_EVENT          = 12,                   // event_id 
     217    CONDITION_NO_AURA               = 11,                   // spell_id     effindex 
     218    CONDITION_ACTIVE_EVENT          = 12,                   // event_id 
    212219}; 
    213220 
     
    251258// NPC gossip text id 
    252259typedef UNORDERED_MAP<uint32, uint32> CacheNpcTextIdMap; 
    253  
     260typedef std::list<GossipOption> CacheNpcOptionList; 
    254261 
    255262typedef UNORDERED_MAP<uint32, VendorItemData> CacheVendorItemMap; 
     
    300307        typedef UNORDERED_MAP<uint32, Quest*> QuestMap; 
    301308 
     309 
    302310        typedef UNORDERED_MAP<uint32, AreaTrigger> AreaTriggerMap; 
    303311 
    304         typedef UNORDERED_MAP<uint32, std::string> AreaTriggerScriptMap; 
     312        typedef UNORDERED_MAP<uint32, uint32> AreaTriggerScriptMap; 
    305313 
    306314        typedef UNORDERED_MAP<uint32, ReputationOnKillEntry> RepOnKillMap; 
     
    309317 
    310318        typedef UNORDERED_MAP<uint32, PetCreateSpellEntry> PetCreateSpellMap; 
     319 
     320        typedef std::vector<std::string> ScriptNameMap; 
    311321 
    312322        Player* GetPlayer(const char* name) const { return ObjectAccessor::Instance().FindPlayerByName(name);} 
     
    477487        AreaTrigger const* GetGoBackTrigger(uint32 Map) const; 
    478488 
    479         const char* GetAreaTriggerScriptName(uint32 id); 
     489        uint32 GetAreaTriggerScriptId(uint32 trigger_id); 
    480490 
    481491        ReputationOnKillEntry const* GetReputationOnKilEntry(uint32 id) const 
     
    523533 
    524534        bool LoadTrinityStrings(DatabaseType& db, char const* table, int32 min_value, int32 max_value); 
    525         bool LoadTrinityStrings() { return LoadTrinityStrings(WorldDatabase,"trinity_string",1,std::numeric_limits<int32>::max()); } 
     535        bool LoadTrinityStrings() { return LoadTrinityStrings(WorldDatabase,"trinity_string",MIN_TRINITY_STRING_ID,MAX_TRINITY_STRING_ID); } 
     536        void LoadDbScriptStrings(); 
    526537        void LoadPetCreateSpells(); 
    527538        void LoadCreatureLocales(); 
     
    593604        uint32 GenerateItemTextID(); 
    594605        uint32 GeneratePetNumber(); 
     606        uint32 GenerateArenaTeamId(); 
     607        uint32 GenerateGuildId(); 
    595608         
    596609        void LoadPlayerInfoInCache(); 
     
    669682            return &itr->second; 
    670683        } 
    671          
    672684        NpcOptionLocale const* GetNpcOptionLocale(uint32 entry) const 
    673685        { 
     
    694706        const char *GetTrinityString(int32 entry, int locale_idx) const; 
    695707        const char *GetTrinityStringForDBCLocale(int32 entry) const { return GetTrinityString(entry,DBCLocaleIndex); } 
    696                 int32 GetDBCLocaleIndex() const { return DBCLocaleIndex; } 
     708        int32 GetDBCLocaleIndex() const { return DBCLocaleIndex; } 
    697709        void SetDBCLocaleIndex(uint32 lang) { DBCLocaleIndex = GetIndexForLocale(LocaleConstant(lang)); } 
    698710 
     
    733745        LocaleConstant GetLocaleForIndex(int i); 
    734746        // guild bank tabs 
    735         const uint32 GetGuildBankTabPrice(uint8 Index) { return Index < GUILD_BANK_MAX_TABS ? mGuildBankTabPrice[Index] : 0; } 
     747        uint32 GetGuildBankTabPrice(uint8 Index) const { return Index < GUILD_BANK_MAX_TABS ? mGuildBankTabPrice[Index] : 0; } 
    736748 
    737749        uint16 GetConditionId(ConditionType condition, uint32 value1, uint32 value2); 
     
    754766        bool AddGameTele(GameTele& data); 
    755767        bool DeleteGameTele(std::string name); 
    756          
     768 
    757769        CacheNpcOptionList const& GetNpcOptions() const { return m_mCacheNpcOptionList; } 
    758770 
     
    762774            if(iter == m_mCacheNpcTextIdMap.end()) 
    763775                return 0; 
    764              
     776 
    765777            return iter->second; 
    766778        } 
     
    783795            return &iter->second; 
    784796        } 
    785         void AddVendorItem(uint32 entry,uint32 item, uint32 maxcount, uint32 incrtime, uint32 ExtendedCost, bool savetodb = true); 
    786         bool RemoveVendorItem(uint32 entry,uint32 item, bool savetodb = true); 
    787         bool IsVendorItemValid( uint32 vendor_entry, uint32 item, uint32 maxcount, uint32 ptime, uint32 ExtendedCost, Player* pl = NULL, std::set<uint32>* skip_vendors = NULL, uint32 ORnpcflag = 0) const; 
    788  
     797        void AddVendorItem(uint32 entry,uint32 item, uint32 maxcount, uint32 incrtime, uint32 ExtendedCost, bool savetodb = true); // for event 
     798        bool RemoveVendorItem(uint32 entry,uint32 item, bool savetodb = true); // for event 
     799        bool IsVendorItemValid( uint32 vendor_entry, uint32 item, uint32 maxcount, uint32 ptime, uint32 ExtendedCost, Player* pl = NULL, std::set<uint32>* skip_vendors = NULL, uint32 ORnpcflag = 0 ) const; 
     800 
     801        void LoadScriptNames(); 
     802        ScriptNameMap &GetScriptNames() { return m_scriptNames; } 
     803        const char * GetScriptName(uint32 id) { return id < m_scriptNames.size() ? m_scriptNames[id].c_str() : ""; } 
     804        uint32 GetScriptId(const char *name); 
    789805    protected: 
     806 
     807        // first free id for selected id type 
    790808        uint32 m_auctionid; 
    791809        uint32 m_mailid; 
    792810        uint32 m_ItemTextId; 
    793  
     811        uint32 m_arenaTeamId; 
     812        uint32 m_guildId; 
     813        uint32 m_hiPetNumber; 
     814 
     815        // first free low guid for seelcted guid type 
    794816        uint32 m_hiCharGuid; 
    795817        uint32 m_hiCreatureGuid; 
     
    800822        uint32 m_hiCorpseGuid; 
    801823 
    802         uint32 m_hiPetNumber; 
    803  
    804         QuestMap mQuestTemplates; 
     824        QuestMap            mQuestTemplates; 
    805825 
    806826        typedef UNORDERED_MAP<uint32, GossipText*> GossipTextMap; 
     
    849869        GameTeleMap         m_GameTeleMap; 
    850870 
     871        ScriptNameMap       m_scriptNames; 
     872 
    851873        typedef             std::vector<LocaleConstant> LocalForIndex; 
    852874        LocalForIndex        m_LocalForIndex; 
     
    856878    private: 
    857879        void LoadScripts(ScriptMapMap& scripts, char const* tablename); 
     880        void CheckScripts(ScriptMapMap const& scripts,std::set<int32>& ids); 
    858881        void ConvertCreatureAddonAuras(CreatureDataAddon* addon, char const* table, char const* guidEntryStr); 
    859882        void LoadQuestRelationsHelper(QuestRelations& map,char const* table); 
     
    908931 
    909932// scripting access functions 
    910 bool TRINITY_DLL_SPEC LoadTrinityStrings(DatabaseType& db, char const* table,int32 start_value = -1, int32 end_value = std::numeric_limits<int32>::min()); 
    911 TRINITY_DLL_SPEC const char* GetAreaTriggerScriptNameById(uint32 id); 
     933TRINITY_DLL_SPEC bool LoadTrinityStrings(DatabaseType& db, char const* table,int32 start_value = -1, int32 end_value = std::numeric_limits<int32>::min()); 
     934TRINITY_DLL_SPEC uint32 GetAreaTriggerScriptId(uint32 trigger_id); 
     935TRINITY_DLL_SPEC uint32 GetScriptId(const char *name); 
     936TRINITY_DLL_SPEC ObjectMgr::ScriptNameMap& GetScriptNames(); 
    912937 
    913938#endif 
  • trunk/src/game/PlayerDump.cpp

    r112 r260  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1919 */ 
    2020 
     
    278278    // for guid set stop if set is empty 
    279279    if(guids && guids->empty()) 
    280         return;                                        // nothing to do 
     280        return;                                             // nothing to do 
    281281 
    282282    // setup for guids case start position 
     
    344344    FILE *fout = fopen(file.c_str(), "w"); 
    345345    if (!fout) 
    346                 return DUMP_FILE_OPEN_ERROR; 
     346        return DUMP_FILE_OPEN_ERROR; 
    347347 
    348348    std::string dump = GetDump(guid); 
     
    372372        } 
    373373    } 
     374 
    374375    FILE *fin = fopen(file.c_str(), "r"); 
    375376    if(!fin) 
    376                 return DUMP_FILE_OPEN_ERROR; 
     377        return DUMP_FILE_OPEN_ERROR; 
    377378 
    378379    QueryResult * result = NULL; 
     
    391392        else incHighest = false; 
    392393    } 
    393     else guid = objmgr.m_hiCharGuid; 
     394    else 
     395        guid = objmgr.m_hiCharGuid; 
    394396 
    395397    // normalize the name if specified and check if it exists 
     
    469471            case DTT_CHAR_TABLE: 
    470472                if(!changenth(line, 1, newguid)) 
    471                                         ROLLBACK(DUMP_FILE_BROKEN); 
     473                    ROLLBACK(DUMP_FILE_BROKEN); 
    472474                break; 
    473475 
     
    475477            { 
    476478                if(!changenth(line, 1, newguid)) 
    477                                         ROLLBACK(DUMP_FILE_BROKEN); 
     479                    ROLLBACK(DUMP_FILE_BROKEN); 
    478480 
    479481                // guid, data field:guid, items 
    480482                if(!changenth(line, 2, chraccount)) 
    481                                         ROLLBACK(DUMP_FILE_BROKEN); 
    482  
     483                    ROLLBACK(DUMP_FILE_BROKEN); 
    483484                std::string vals = getnth(line, 3); 
    484485                if(!changetoknth(vals, OBJECT_FIELD_GUID+1, newguid)) 
    485                                         ROLLBACK(DUMP_FILE_BROKEN); 
    486  
     486                    ROLLBACK(DUMP_FILE_BROKEN); 
    487487                for(uint16 field = PLAYER_FIELD_INV_SLOT_HEAD; field < PLAYER_FARSIGHT; field++) 
    488488                    if(!changetokGuid(vals, field+1, items, objmgr.m_hiItemGuid, true)) 
    489                                                 ROLLBACK(DUMP_FILE_BROKEN); 
    490  
     489                        ROLLBACK(DUMP_FILE_BROKEN); 
    491490                if(!changenth(line, 3, vals.c_str())) 
    492                                         ROLLBACK(DUMP_FILE_BROKEN); 
    493  
     491                    ROLLBACK(DUMP_FILE_BROKEN); 
    494492                if (name == "") 
    495493                { 
     
    504502                                                            // rename on login: `at_login` field 30 in raw field list 
    505503                        if(!changenth(line, 30, "1")) 
    506                                                         ROLLBACK(DUMP_FILE_BROKEN); 
     504                            ROLLBACK(DUMP_FILE_BROKEN); 
    507505                    } 
    508506                } 
    509507                else if(!changenth(line, 4, name.c_str())) 
    510                                         ROLLBACK(DUMP_FILE_BROKEN); 
     508                    ROLLBACK(DUMP_FILE_BROKEN); 
    511509 
    512510                break; 
     
    515513            { 
    516514                if(!changenth(line, 1, newguid)) 
    517                                         ROLLBACK(DUMP_FILE_BROKEN); 
     515                    ROLLBACK(DUMP_FILE_BROKEN); 
    518516 
    519517                // bag, item 
    520518                if(!changeGuid(line, 2, items, objmgr.m_hiItemGuid, true)) 
    521                                         ROLLBACK(DUMP_FILE_BROKEN); 
    522                                 if(!changeGuid(line, 4, items, objmgr.m_hiItemGuid)) 
    523                                         ROLLBACK(DUMP_FILE_BROKEN); 
     519                    ROLLBACK(DUMP_FILE_BROKEN); 
     520                if(!changeGuid(line, 4, items, objmgr.m_hiItemGuid)) 
     521                    ROLLBACK(DUMP_FILE_BROKEN); 
    524522                break; 
    525523            } 
     
    528526                // item, owner, data field:item, owner guid 
    529527                if(!changeGuid(line, 1, items, objmgr.m_hiItemGuid)) 
    530                                         ROLLBACK(DUMP_FILE_BROKEN); 
    531                                 if(!changenth(line, 2, newguid)) 
    532                                         ROLLBACK(DUMP_FILE_BROKEN); 
    533  
     528                    ROLLBACK(DUMP_FILE_BROKEN); 
     529                if(!changenth(line, 2, newguid)) 
     530                    ROLLBACK(DUMP_FILE_BROKEN); 
    534531                std::string vals = getnth(line,3); 
    535532                if(!changetokGuid(vals, OBJECT_FIELD_GUID+1, items, objmgr.m_hiItemGuid)) 
    536                                         ROLLBACK(DUMP_FILE_BROKEN); 
    537                                 if(!changetoknth(vals, ITEM_FIELD_OWNER+1, newguid)) 
    538                                         ROLLBACK(DUMP_FILE_BROKEN); 
    539                                 if(!changenth(line, 3, vals.c_str())) 
    540                                         ROLLBACK(DUMP_FILE_BROKEN); 
     533                    ROLLBACK(DUMP_FILE_BROKEN); 
     534                if(!changetoknth(vals, ITEM_FIELD_OWNER+1, newguid)) 
     535                    ROLLBACK(DUMP_FILE_BROKEN); 
     536                if(!changenth(line, 3, vals.c_str())) 
     537                    ROLLBACK(DUMP_FILE_BROKEN); 
    541538                break; 
    542539            } 
     
    545542                // guid,item_guid, 
    546543                if(!changenth(line, 1, newguid)) 
    547                                         ROLLBACK(DUMP_FILE_BROKEN); 
    548                                 if(!changeGuid(line, 2, items, objmgr.m_hiItemGuid)) 
    549                                         ROLLBACK(DUMP_FILE_BROKEN); 
     544                    ROLLBACK(DUMP_FILE_BROKEN); 
     545                if(!changeGuid(line, 2, items, objmgr.m_hiItemGuid)) 
     546                    ROLLBACK(DUMP_FILE_BROKEN); 
    550547                break; 
    551548            } 
     
    570567                // item, entry, owner, ... 
    571568                if(!changenth(line, 1, newpetid)) 
    572                                         ROLLBACK(DUMP_FILE_BROKEN); 
    573                                 if(!changenth(line, 3, newguid)) 
    574                                         ROLLBACK(DUMP_FILE_BROKEN); 
     569                    ROLLBACK(DUMP_FILE_BROKEN); 
     570                if(!changenth(line, 3, newguid)) 
     571                    ROLLBACK(DUMP_FILE_BROKEN); 
    575572 
    576573                break; 
     
    583580                std::map<uint32, uint32> :: const_iterator petids_iter = petids.find(atoi(currpetid)); 
    584581                if(petids_iter == petids.end())             // couldn't find new inserted id 
    585                                         ROLLBACK(DUMP_FILE_BROKEN); 
     582                    ROLLBACK(DUMP_FILE_BROKEN); 
    586583 
    587584                snprintf(newpetid, 20, "%d", petids_iter->second); 
    588585 
    589586                if(!changenth(line, 1, newpetid)) 
    590                                         ROLLBACK(DUMP_FILE_BROKEN); 
     587                    ROLLBACK(DUMP_FILE_BROKEN); 
    591588 
    592589                break; 
     
    596593                // id,messageType,stationery,sender,receiver 
    597594                if(!changeGuid(line, 1, mails, objmgr.m_mailid)) 
    598                                         ROLLBACK(DUMP_FILE_BROKEN); 
    599                                 if(!changenth(line, 5, newguid)) 
    600                                         ROLLBACK(DUMP_FILE_BROKEN); 
     595                    ROLLBACK(DUMP_FILE_BROKEN); 
     596                if(!changenth(line, 5, newguid)) 
     597                    ROLLBACK(DUMP_FILE_BROKEN); 
    601598                break; 
    602599            } 
     
    605602                // mail_id,item_guid,item_template,receiver 
    606603                if(!changeGuid(line, 1, mails, objmgr.m_mailid)) 
    607                                         ROLLBACK(DUMP_FILE_BROKEN); 
    608                                 if(!changeGuid(line, 2, items, objmgr.m_hiItemGuid)) 
    609                                         ROLLBACK(DUMP_FILE_BROKEN); 
    610                                 if(!changenth(line, 4, newguid)) 
    611                                         ROLLBACK(DUMP_FILE_BROKEN); 
     604                    ROLLBACK(DUMP_FILE_BROKEN); 
     605                if(!changeGuid(line, 2, items, objmgr.m_hiItemGuid)) 
     606                    ROLLBACK(DUMP_FILE_BROKEN); 
     607                if(!changenth(line, 4, newguid)) 
     608                    ROLLBACK(DUMP_FILE_BROKEN); 
    612609                break; 
    613610            } 
     
    618615 
    619616        if(!CharacterDatabase.Execute(line.c_str())) 
    620                         ROLLBACK(DUMP_FILE_BROKEN); 
     617            ROLLBACK(DUMP_FILE_BROKEN); 
    621618    } 
    622619 
  • trunk/src/game/SpellHandler.cpp

    r252 r260  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1919 */ 
    2020 
     
    5555    } 
    5656 
     57    if(pItem->GetGUID() != item_guid) 
     58    { 
     59        pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL ); 
     60        return; 
     61    } 
     62 
    5763    sLog.outDetail("WORLD: CMSG_USE_ITEM packet, bagIndex: %u, slot: %u, spell_count: %u , cast_count: %u, Item: %u, data length = %i", bagIndex, slot, spell_count, cast_count, pItem->GetEntry(), recvPacket.size()); 
    5864 
     
    238244 
    239245            pItem->SetUInt64Value(ITEM_FIELD_GIFTCREATOR, 0); 
    240             pItem->SetUInt32Value(OBJECT_FIELD_ENTRY, entry); 
     246            pItem->SetEntry(entry); 
    241247            pItem->SetUInt32Value(ITEM_FIELD_FLAGS, flags); 
    242248            pItem->SetState(ITEM_CHANGED, pUser); 
     
    260266 
    261267    uint64 guid; 
    262     uint32 spellId = OPEN_CHEST; 
    263268 
    264269    recv_data >> guid; 
     
    323328 
    324329    Spell *spell = new Spell(_player, spellInfo, false); 
    325     spell->m_cast_count = cast_count;                       //set count of casts 
     330    spell->m_cast_count = cast_count;                       // set count of casts 
    326331    spell->prepare(&targets); 
    327332} 
  • trunk/src/game/WaypointManager.cpp

    r207 r260  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1919 */ 
    2020 
     
    2525#include "ProgressBar.h" 
    2626#include "MapManager.h" 
     27#include "ObjectMgr.h" 
    2728 
    2829INSTANTIATE_SINGLETON_1(WaypointManager); 
     
    3031bool WaypointBehavior::isEmpty() 
    3132{ 
    32     return emote == 0 && spell == 0 && model1 == 0 && model2 == 0 && text[0].empty() && 
    33         text[1].empty() && text[2].empty() && text[3].empty() && text[4].empty(); 
     33    if (emote || spell || model1 || model2) 
     34        return false; 
     35 
     36    for(int i = 0; i < MAX_WAYPOINT_TEXT; ++i) 
     37        if(textid[i]) 
     38            return false; 
     39 
     40    return true; 
    3441} 
    3542 
    3643WaypointBehavior::WaypointBehavior(const WaypointBehavior &b) 
    3744{ 
    38     emote = b.emote; spell = b.spell; model1 = b.model1; model2 = b.model2; 
    39     text[0] = b.text[0]; text[1] = b.text[1]; text[2] = b.text[2]; 
    40     text[3] = b.text[3]; text[4] = b.text[4]; 
     45    emote = b.emote; 
     46    spell = b.spell; 
     47    model1 = b.model1; 
     48    model2 = b.model2; 
     49    for(int i=0; i < MAX_WAYPOINT_TEXT; ++i) 
     50        textid[i] = b.textid[i]; 
    4151} 
    4252 
     
    6777    } 
    6878 
    69     result = WorldDatabase.Query("SELECT position_x, position_y, position_z, orientation, model1, model2, waittime, emote, spell, text1, text2, text3, text4, text5, id, point FROM creature_movement"); 
     79    result = WorldDatabase.Query("SELECT position_x, position_y, position_z, orientation, model1, model2, waittime, emote, spell, textid1, textid2, textid3, textid4, textid5, id, point FROM creature_movement"); 
    7080    if(result) 
    7181    { 
     
    114124            be.emote            = fields[7].GetUInt32(); 
    115125            be.spell            = fields[8].GetUInt32(); 
    116             be.text[0]          = fields[9].GetCppString(); 
    117             be.text[1]          = fields[10].GetCppString(); 
    118             be.text[2]          = fields[11].GetCppString(); 
    119             be.text[3]          = fields[12].GetCppString(); 
    120             be.text[4]          = fields[13].GetCppString(); 
     126 
     127            // load and store without holes in array 
     128            int j = 0; 
     129            for(int i = 0; i < MAX_WAYPOINT_TEXT; ++i) 
     130            { 
     131                be.textid[j]        = fields[9+i].GetUInt32(); 
     132                if(be.textid[j]) 
     133                { 
     134                    if (be.textid[j] < MIN_DB_SCRIPT_STRING_ID || be.textid[j] >= MAX_DB_SCRIPT_STRING_ID) 
     135                    { 
     136                        sLog.outErrorDb( "Table `db_script_string` not have string id  %u", be.textid[j]); 
     137                        continue; 
     138                    } 
     139 
     140                    if (!objmgr.GetTrinityStringLocale (be.textid[j])) 
     141                    { 
     142                        sLog.outErrorDb("ERROR: Waypoint path %d (point %d), have invalid text id (%i) in `textid%d, ignored.", 
     143                            id, point, be.textid[j], i+1); 
     144                        continue; 
     145                    } 
     146 
     147                    ++j;                                    // to next internal field 
     148                } 
     149            } 
     150            // fill array tail 
     151            for(; j < MAX_WAYPOINT_TEXT; ++j) 
     152                be.textid[j] = 0; 
    121153 
    122154            // save memory by not storing empty behaviors 
     
    266298        if(!node.behavior) node.behavior = new WaypointBehavior(); 
    267299 
    268         if(field == "text1") node.behavior->text[0] = text ? text : ""; 
    269         if(field == "text2") node.behavior->text[1] = text ? text : ""; 
    270         if(field == "text3") node.behavior->text[2] = text ? text : ""; 
    271         if(field == "text4") node.behavior->text[3] = text ? text : ""; 
    272         if(field == "text5") node.behavior->text[4] = text ? text : ""; 
     300//        if(field == "text1") node.behavior->text[0] = text ? text : ""; 
     301//        if(field == "text2") node.behavior->text[1] = text ? text : ""; 
     302//        if(field == "text3") node.behavior->text[2] = text ? text : ""; 
     303//        if(field == "text4") node.behavior->text[3] = text ? text : ""; 
     304//        if(field == "text5") node.behavior->text[4] = text ? text : ""; 
    273305        if(field == "emote") node.behavior->emote   = text ? atoi(text) : 0; 
    274306        if(field == "spell") node.behavior->spell   = text ? atoi(text) : 0; 
  • trunk/src/game/WaypointManager.h

    r206 r260  
    2626#include "Utilities/UnorderedMap.h" 
    2727 
     28#define MAX_WAYPOINT_TEXT 5 
    2829struct WaypointBehavior 
    2930{ 
    3031    uint32 emote; 
    3132    uint32 spell; 
    32     std::string text[5]; 
     33    int32  textid[MAX_WAYPOINT_TEXT]; 
    3334    uint32 model1; 
    3435    uint32 model2; 
  • trunk/src/game/WaypointMovementGenerator.cpp

    r229 r260  
    2222creature_movement Table 
    2323 
    24 alter table creature_movement add `text1` varchar(255) default NULL; 
    25 alter table creature_movement add `text2` varchar(255) default NULL; 
    26 alter table creature_movement add `text3` varchar(255) default NULL; 
    27 alter table creature_movement add `text4` varchar(255) default NULL; 
    28 alter table creature_movement add `text5` varchar(255) default NULL; 
     24alter table creature_movement add `textid1` int(11) NOT NULL default '0'; 
     25alter table creature_movement add `textid2` int(11) NOT NULL default '0'; 
     26alter table creature_movement add `textid3` int(11) NOT NULL default '0'; 
     27alter table creature_movement add `textid4` int(11) NOT NULL default '0'; 
     28alter table creature_movement add `textid5` int(11) NOT NULL default '0'; 
    2929alter table creature_movement add `emote` int(10) unsigned default '0'; 
    3030alter table creature_movement add `spell` int(5) unsigned default '0'; 
     
    149149                if(behavior->model1 != 0) 
    150150                    creature.SetDisplayId(behavior->model1); 
    151                 if(!behavior->text[0].empty()) 
     151                if(behavior->textid[0]) 
    152152                { 
    153                     // Only one text is set 
    154                     if( !behavior->text[1].empty() ) 
     153                    // Not only one text is set 
     154                    if( behavior->textid[1] ) 
    155155                    { 
    156156                        // Select one from max 5 texts (0 and 1 already checked) 
    157157                        int i = 2; 
    158                         for( ; i < 5; ++i ) 
    159                             if( behavior->text[i].empty() ) 
     158                        for( ; i < MAX_WAYPOINT_TEXT; ++i ) 
     159                            if( !behavior->textid[i] ) 
    160160                                break; 
    161161 
    162                         creature.Say(behavior->text[rand() % i].c_str(), 0, 0); 
    163  
     162                        creature.Say(behavior->textid[rand() % i], 0, 0); 
    164163                    } 
    165164                    else 
    166                         creature.Say(behavior->text[0].c_str(), 0, 0); 
     165                        creature.Say(behavior->textid[0], 0, 0); 
    167166                } 
    168167            }                                               // wpBehaviour found 
  • trunk/src/game/World.cpp

    r230 r260  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1919 */ 
    2020 
     
    6767 
    6868volatile bool World::m_stopEvent = false; 
     69uint8 World::m_ExitCode = SHUTDOWN_EXIT_CODE; 
    6970volatile uint32 World::m_worldLoopCounter = 0; 
    7071 
     
    543544        m_configs[CONFIG_SOCKET_SELECTTIME] = sConfig.GetIntDefault("SocketSelectTime", DEFAULT_SOCKET_SELECT_TIME); 
    544545 
    545  
    546546    m_configs[CONFIG_GROUP_XP_DISTANCE] = sConfig.GetIntDefault("MaxGroupXPDistance", 74); 
    547547    /// \todo Add MonsterSight and GuarderSight (with meaning) in Trinityd.conf or put them as define 
     
    606606    } 
    607607 
    608  
    609608    if(reload) 
    610609    { 
     
    770769    m_configs[CONFIG_THREAT_RADIUS] = sConfig.GetIntDefault("ThreatRadius", 100); 
    771770 
    772     // always use declined names in the Russian client 
    773     m_configs[CONFIG_DECLINED_NAMES_USED] =  
     771    // always use declined names in the russian client 
     772    m_configs[CONFIG_DECLINED_NAMES_USED] = 
    774773        (m_configs[CONFIG_REALM_ZONE] == REALM_ZONE_RUSSIAN) ? true : sConfig.GetBoolDefault("DeclinedNames", false); 
    775774 
     
    966965    DetectDBCLang(); 
    967966 
     967    sLog.outString( "Loading Script Names..."); 
     968    objmgr.LoadScriptNames(); 
     969 
    968970    sLog.outString( "Loading InstanceTemplate" ); 
    969971    objmgr.LoadInstanceTemplate(); 
     
    10811083    sLog.outString( "Loading Tavern Area Triggers..." ); 
    10821084    objmgr.LoadTavernAreaTriggers(); 
    1083      
     1085 
    10841086    sLog.outString( "Loading AreaTrigger script names..." ); 
    10851087    objmgr.LoadAreaTriggerScripts(); 
    1086  
    10871088 
    10881089    sLog.outString( "Loading Graveyard-zone links..."); 
     
    11651166    sLog.outString( "Loading Npc Text Id..." ); 
    11661167    objmgr.LoadNpcTextId();                                 // must be after load Creature and NpcText 
    1167      
     1168 
    11681169    sLog.outString( "Loading Npc Options..." ); 
    11691170    objmgr.LoadNpcOptions(); 
     
    11931194    objmgr.LoadEventScripts();                              // must be after load Creature/Gameobject(Template/Data) 
    11941195 
     1196    sLog.outString( "Loading Scripts text locales..." );    // must be after Load*Scripts calls 
     1197    objmgr.LoadDbScriptStrings(); 
     1198 
    11951199    sLog.outString( "Initializing Scripts..." ); 
    11961200    if(!LoadScriptingModule()) 
     
    12631267    sLog.outString( "WORLD: World initialized" ); 
    12641268} 
     1269 
    12651270void World::DetectDBCLang() 
    12661271{ 
     
    14631468    } 
    14641469 
    1465     MapManager::Instance().DoDelayedMovesAndRemoves(); ///- Move all creatures with "delayed move" and remove and delete all objects with "delayed remove" 
     1470    /// </ul> 
     1471    ///- Move all creatures with "delayed move" and remove and delete all objects with "delayed remove" 
     1472    MapManager::Instance().DoDelayedMovesAndRemoves(); 
    14661473 
    14671474    // update the instance reset times 
     
    15831590        } 
    15841591 
     1592        //if(source && !source->IsInWorld()) source = NULL; 
     1593 
    15851594        Object* target = NULL; 
    15861595 
     
    16101619        } 
    16111620 
     1621        //if(target && !target->IsInWorld()) target = NULL; 
     1622 
    16121623        switch (step.script->command) 
    16131624        { 
     
    16371648                { 
    16381649                    case 0:                                 // Say 
    1639                         ((Creature *)source)->Say(step.script->datatext.c_str(), LANG_UNIVERSAL, unit_target); 
     1650                        ((Creature *)source)->Say(step.script->dataint, LANG_UNIVERSAL, unit_target); 
    16401651                        break; 
    16411652                    case 1:                                 // Whisper 
     
    16451656                            break; 
    16461657                        } 
    1647                         ((Creature *)source)->Whisper(step.script->datatext.c_str(),unit_target); 
     1658                        ((Creature *)source)->Whisper(step.script->dataint,unit_target); 
    16481659                        break; 
    16491660                    case 2:                                 // Yell 
    1650                         ((Creature *)source)->Yell(step.script->datatext.c_str(), LANG_UNIVERSAL, unit_target); 
     1661                        ((Creature *)source)->Yell(step.script->dataint, LANG_UNIVERSAL, unit_target); 
    16511662                        break; 
    16521663                    case 3:                                 // Emote text 
    1653                         ((Creature *)source)->TextEmote(step.script->datatext.c_str(), unit_target); 
     1664                        ((Creature *)source)->TextEmote(step.script->dataint, unit_target); 
    16541665                        break; 
    16551666                    default: 
     
    17021713                } 
    17031714                ((Unit *)source)->SendMonsterMoveWithSpeed(step.script->x, step.script->y, step.script->z, ((Unit *)source)->GetUnitMovementFlags(), step.script->datalong2 ); 
    1704                 MapManager::Instance().GetMap(((Unit *)source)->GetMapId(), ((Unit *)source))->CreatureRelocation(((Creature *)source), step.script->x, step.script->y, step.script->z, 0); 
     1715                ((Unit *)source)->GetMap()->CreatureRelocation(((Creature *)source), step.script->x, step.script->y, step.script->z, 0); 
    17051716                break; 
    17061717            case SCRIPT_COMMAND_FLAG_SET: 
     
    18521863                go->SetRespawnTime(time_to_despawn);        //despawn object in ? seconds 
    18531864 
    1854                 MapManager::Instance().GetMap(go->GetMapId(), go)->Add(go); 
     1865                go->GetMap()->Add(go); 
    18551866                break; 
    18561867            } 
     
    23742385 
    23752386    ///- if there is a shutdown timer 
    2376     if(m_ShutdownTimer > 0 && elapsed > 0) 
     2387    if(!m_stopEvent && m_ShutdownTimer > 0 && elapsed > 0) 
    23772388    { 
    23782389        ///- ... and it is overdue, stop the world (set m_stopEvent) 
     
    23802391        { 
    23812392            if(!(m_ShutdownMask & SHUTDOWN_MASK_IDLE) || GetActiveAndQueuedSessionCount()==0) 
    2382                 m_stopEvent = true; 
     2393                m_stopEvent = true;                         // exist code already set 
    23832394            else 
    23842395                m_ShutdownTimer = 1;                        // minimum timer value to wait idle state 
     
    23952406 
    23962407/// Shutdown the server 
    2397 void World::ShutdownServ(uint32 time, uint32 options) 
    2398 { 
     2408void World::ShutdownServ(uint32 time, uint32 options, uint8 exitcode) 
     2409{ 
     2410    // ignore if server shutdown at next tick 
     2411    if(m_stopEvent) 
     2412        return; 
     2413 
    23992414    m_ShutdownMask = options; 
     2415    m_ExitCode = exitcode; 
    24002416 
    24012417    ///- If the shutdown time is 0, set m_stopEvent (except if shutdown is 'idle' with remaining sessions) 
     
    24032419    { 
    24042420        if(!(options & SHUTDOWN_MASK_IDLE) || GetActiveAndQueuedSessionCount()==0) 
    2405             m_stopEvent = true; 
     2421            m_stopEvent = true;                             // exist code already set 
    24062422        else 
    24072423            m_ShutdownTimer = 1;                            //So that the session count is re-evaluated at next world tick 
     
    24482464void World::ShutdownCancel() 
    24492465{ 
    2450     if(!m_ShutdownTimer) 
     2466    // nothing cancel or too later 
     2467    if(!m_ShutdownTimer || m_stopEvent) 
    24512468        return; 
    24522469 
     
    24552472    m_ShutdownMask = 0; 
    24562473    m_ShutdownTimer = 0; 
     2474    m_ExitCode = SHUTDOWN_EXIT_CODE;                       // to default value 
    24572475    SendServerMessage(msgid); 
    24582476 
    2459     DEBUG_LOG("Server %s canceled.",(m_ShutdownMask & SHUTDOWN_MASK_RESTART ? "restart" : "shuttingdown")); 
     2477    DEBUG_LOG("Server %s cancelled.",(m_ShutdownMask & SHUTDOWN_MASK_RESTART ? "restart" : "shuttingdown")); 
    24602478} 
    24612479 
     
    25022520        if(!itr->second->Update(diff))                      // As interval = 0 
    25032521        { 
     2522            RemoveQueuedPlayer (itr->second); 
    25042523            delete itr->second; 
    25052524            m_sessions.erase(itr); 
  • trunk/src/game/World.h

    r229 r260  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1919 */ 
    2020 
     
    5252}; 
    5353 
     54enum ShutdownExitCode 
     55{ 
     56    SHUTDOWN_EXIT_CODE = 0, 
     57    ERROR_EXIT_CODE    = 1, 
     58    RESTART_EXIT_CODE  = 2, 
     59}; 
     60 
    5461/// Timers for different object refresh rates 
    5562enum WorldTimers 
     
    6269    WUPDATE_CORPSES     = 5, 
    6370    WUPDATE_EVENTS      = 6, 
    64     WUPDATE_COUNT       = 7, 
    65  
     71    WUPDATE_COUNT       = 7 
    6672}; 
    6773 
     
    106112    CONFIG_INSTANCE_IGNORE_RAID, 
    107113    CONFIG_BATTLEGROUND_CAST_DESERTER, 
     114    CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE, 
     115    CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_PLAYERONLY, 
    108116    CONFIG_INSTANCE_RESET_TIME_HOUR, 
    109117    CONFIG_INSTANCE_UNLOAD_DELAY, 
     
    144152    CONFIG_QUEST_LOW_LEVEL_HIDE_DIFF, 
    145153    CONFIG_QUEST_HIGH_LEVEL_HIDE_DIFF, 
     154    CONFIG_DETECT_POS_COLLISION, 
    146155    CONFIG_RESTRICTED_LFG_CHANNEL, 
    147156    CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL, 
     
    317326struct CliCommandHolder 
    318327{ 
    319         typedef void Print(const char*); 
    320  
    321         char *m_command; 
    322         Print* m_print; 
    323  
    324         CliCommandHolder(const char *command, Print* zprint) 
    325                 : m_print(zprint) 
    326         { 
    327                 size_t len = strlen(command)+1; 
    328                 m_command = new char[len]; 
    329                 memcpy(m_command, command, len); 
    330         } 
    331  
    332         ~CliCommandHolder() { delete[] m_command; } 
     328    typedef void Print(const char*); 
     329 
     330    char *m_command; 
     331    Print* m_print; 
     332 
     333    CliCommandHolder(const char *command, Print* zprint) 
     334        : m_print(zprint) 
     335    { 
     336        size_t len = strlen(command)+1; 
     337        m_command = new char[len]; 
     338        memcpy(m_command, command, len); 
     339    } 
     340 
     341    ~CliCommandHolder() { delete[] m_command; } 
    333342}; 
    334343 
     
    337346{ 
    338347    public: 
    339         static volatile bool m_stopEvent; 
    340348        static volatile uint32 m_worldLoopCounter; 
    341349 
     
    345353        WorldSession* FindSession(uint32 id) const; 
    346354        void AddSession(WorldSession *s); 
    347  
    348355        bool RemoveSession(uint32 id); 
    349356        /// Get the number of current active sessions 
     
    408415        void LoadConfigSettings(bool reload = false); 
    409416 
    410         void SendWorldText(int32 string_id, ...);  
     417        void SendWorldText(int32 string_id, ...); 
    411418        void SendGlobalMessage(WorldPacket *packet, WorldSession *self = 0, uint32 team = 0); 
    412419        void SendZoneMessage(uint32 zone, WorldPacket *packet, WorldSession *self = 0, uint32 team = 0); 
     
    415422 
    416423        /// Are we in the middle of a shutdown? 
    417         uint32 GetShutdownMask() const { return m_ShutdownMask; } 
    418424        bool IsShutdowning() const { return m_ShutdownTimer > 0; } 
    419         void ShutdownServ(uint32 time, uint32 options = 0); 
     425        void ShutdownServ(uint32 time, uint32 options, uint8 exitcode); 
    420426        void ShutdownCancel(); 
    421427        void ShutdownMsg(bool show = false, Player* player = NULL); 
     428        static uint8 GetExitCode() { return m_ExitCode; } 
     429        static void StopNow(uint8 exitcode) { m_stopEvent = true; m_ExitCode = exitcode; } 
     430        static bool IsStopped() { return m_stopEvent; } 
    422431 
    423432        void Update(time_t diff); 
     
    454463        void KickAllQueued(); 
    455464        BanReturn BanAccount(BanMode mode, std::string nameOrIP, std::string duration, std::string reason, std::string author); 
    456                 bool RemoveBanAccount(BanMode mode, std::string nameOrIP); 
     465        bool RemoveBanAccount(BanMode mode, std::string nameOrIP); 
    457466 
    458467        void ScriptsStart(std::map<uint32, std::multimap<uint32, ScriptInfo> > const& scripts, uint32 id, Object* source, Object* target); 
     
    482491        LocaleConstant GetAvailableDbcLocale(LocaleConstant locale) const { if(m_availableDbcLocaleMask & (1 << locale)) return locale; else return m_defaultDbcLocale; } 
    483492 
    484                 //used World DB version 
    485                 void LoadDBVersion(); 
    486                 char const* GetDBVersion() { return m_DBVersion.c_str(); } 
    487  
    488                 //used Script version 
    489                 void SetScriptsVersion(char const* version) { m_ScriptsVersion = version ? version : "unknown scripting library"; } 
    490                 char const* GetScriptsVersion() { return m_ScriptsVersion.c_str(); } 
     493        //used World DB version 
     494        void LoadDBVersion(); 
     495        char const* GetDBVersion() { return m_DBVersion.c_str(); } 
     496 
     497        //used Script version 
     498        void SetScriptsVersion(char const* version) { m_ScriptsVersion = version ? version : "unknown scripting library"; } 
     499        char const* GetScriptsVersion() { return m_ScriptsVersion.c_str(); } 
    491500 
    492501    protected: 
     
    499508        void ResetDailyQuests(); 
    500509    private: 
     510        static volatile bool m_stopEvent; 
     511        static uint8 m_ExitCode; 
     512        uint32 m_ShutdownTimer; 
     513        uint32 m_ShutdownMask; 
     514 
    501515        time_t m_startTime; 
    502516        time_t m_gameTime; 
     
    526540        std::set<uint32> m_forbiddenMapIds; 
    527541 
    528         uint32 m_ShutdownTimer; 
    529         uint32 m_ShutdownMask; 
    530  
    531542        // for max speed access 
    532543        static float m_MaxVisibleDistanceForCreature; 
     
    546557        //Player Queue 
    547558        Queue m_QueuedPlayer; 
    548          
     559 
    549560        //sessions that are added async 
    550561        void AddSession_(WorldSession* s); 
    551562        ZThread::LockedQueue<WorldSession*, ZThread::FastMutex> addSessQueue; 
    552563 
    553                 //used versions 
    554                 std::string m_DBVersion; 
    555                 std::string m_ScriptsVersion; 
     564        //used versions 
     565        std::string m_DBVersion; 
     566        std::string m_ScriptsVersion; 
    556567}; 
    557568 
  • trunk/src/shared/Database/DBCStores.cpp

    r229 r260  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1919 */ 
    2020 
     
    122122// DBC used only for initialization sTaxiPathSetBySource at startup. 
    123123TaxiPathNodesByPath sTaxiPathNodesByPath; 
    124 struct TaxiPathNodeEntry 
    125 { 
    126     uint32    path; 
    127     uint32    index; 
    128     uint32    mapid; 
    129     float     x; 
    130     float     y; 
    131     float     z; 
    132     uint32    actionFlag; 
    133     uint32    delay; 
    134 }; 
     124 
    135125static DBCStorage <TaxiPathNodeEntry> sTaxiPathNodeStore(TaxiPathNodeEntryfmt); 
    136  
    137126DBCStorage <TotemCategoryEntry> sTotemCategoryStore(TotemCategoryEntryfmt); 
    138  
    139127DBCStorage <WorldMapAreaEntry>  sWorldMapAreaStore(WorldMapAreaEntryfmt); 
    140128DBCStorage <WorldSafeLocsEntry> sWorldSafeLocsStore(WorldSafeLocsEntryfmt); 
     
    236224        } 
    237225    } 
    238      
     226 
    239227    LoadDBC(availableDbcLocales,bar,bad_dbc_files,sFactionTemplateStore,     dbcPath,"FactionTemplate.dbc"); 
    240228    LoadDBC(availableDbcLocales,bar,bad_dbc_files,sGemPropertiesStore,       dbcPath,"GemProperties.dbc"); 
     
    284272    { 
    285273        SkillLineAbilityEntry const *skillLine = sSkillLineAbilityStore.LookupEntry(j); 
    286      
     274 
    287275        if(!skillLine) 
    288276            continue; 
     
    291279 
    292280        if(spellInfo && (spellInfo->Attributes & 0x1D0) == 0x1D0) 
    293         {       
     281        { 
    294282            for (unsigned int i = 1; i < sCreatureFamilyStore.GetNumRows(); ++i) 
    295283            { 
     
    298286                    continue; 
    299287 
    300                 if(skillLine->skillId != cFamily->skillLine && skillLine->skillId != cFamily->skillLine2) 
     288                if(skillLine->skillId != cFamily->skillLine[0] && skillLine->skillId != cFamily->skillLine[1]) 
    301289                    continue; 
    302290 
     
    310298    LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellFocusObjectStore,    dbcPath,"SpellFocusObject.dbc"); 
    311299    LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellItemEnchantmentStore,dbcPath,"SpellItemEnchantment.dbc"); 
    312      
    313300    LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellItemEnchantmentConditionStore,dbcPath,"SpellItemEnchantmentCondition.dbc"); 
    314301    LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellRadiusStore,         dbcPath,"SpellRadius.dbc"); 
     
    456443    // check at up-to-date DBC files (71 is last char title added in 2.4.3) 
    457444    // check at up-to-date DBC files (1768 is last area added in 2.4.3) 
    458     if( !sSpellStore.LookupEntry(53085)            ||  
    459         !sSkillLineAbilityStore.LookupEntry(17514) ||  
     445    if( !sSpellStore.LookupEntry(53085)            || 
     446        !sSkillLineAbilityStore.LookupEntry(17514) || 
    460447        !sMapStore.LookupEntry(598)                || 
    461         !sGemPropertiesStore.LookupEntry(1127)     ||  
    462         !sItemExtendedCostStore.LookupEntry(2425)  ||  
     448        !sGemPropertiesStore.LookupEntry(1127)     || 
     449        !sItemExtendedCostStore.LookupEntry(2425)  || 
    463450        !sCharTitlesStore.LookupEntry(71)          || 
    464451        !sAreaStore.LookupEntry(1768)              ) 
  • trunk/src/shared/Database/DBCStores.h

    r102 r260  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1919 */ 
    2020 
     
    7676        bool Load(char const* fn) 
    7777        { 
    78  
    7978            DBCFile dbc; 
    8079            // Check if load was sucessful, only then continue 
  • trunk/src/shared/Database/DBCStructure.h

    r230 r260  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1919 */ 
    2020 
     
    2222#define DBCSTRUCTURE_H 
    2323 
     24#include "DBCEnums.h" 
    2425#include "Platform/Define.h" 
    2526 
     
    3637#pragma pack(push,1) 
    3738#endif 
    38  
    39 enum AreaTeams 
    40 { 
    41     AREATEAM_NONE  = 0, 
    42     AREATEAM_ALLY  = 2, 
    43     AREATEAM_HORDE = 4 
    44 }; 
    45  
    46 enum AreaFlags 
    47 { 
    48     AREA_FLAG_SNOW             = 0x00000001,                // snow (only Dun Morogh, Naxxramas, Razorfen Downs and Winterspring) 
    49     AREA_FLAG_UNK1             = 0x00000002,                // unknown, (only Naxxramas and Razorfen Downs) 
    50     AREA_FLAG_UNK2             = 0x00000004,                // Only used on development map 
    51     AREA_FLAG_SLAVE_CAPITAL    = 0x00000008,                // slave capital city flag? 
    52     AREA_FLAG_UNK3             = 0x00000010,                // unknown 
    53     AREA_FLAG_SLAVE_CAPITAL2   = 0x00000020,                // slave capital city flag? 
    54     AREA_FLAG_UNK4             = 0x00000040,                // many zones have this flag 
    55     AREA_FLAG_ARENA            = 0x00000080,                // arena, both instanced and world arenas 
    56     AREA_FLAG_CAPITAL          = 0x00000100,                // main capital city flag 
    57     AREA_FLAG_CITY             = 0x00000200,                // only for one zone named "City" (where it located?) 
    58     AREA_FLAG_OUTLAND          = 0x00000400,                // outland zones? (only Eye of the Storm not have this flag, but have 0x00004000 flag) 
    59     AREA_FLAG_SANCTUARY        = 0x00000800,                // sanctuary area (PvP disabled) 
    60     AREA_FLAG_NEED_FLY         = 0x00001000,                // only Netherwing Ledge, Socrethar's Seat, Tempest Keep, The Arcatraz, The Botanica, The Mechanar, Sorrow Wing Point, Dragonspine Ridge, Netherwing Mines, Dragonmaw Base Camp, Dragonmaw Skyway 
    61     AREA_FLAG_UNUSED1          = 0x00002000,                // not used now (no area/zones with this flag set in 2.4.2) 
    62     AREA_FLAG_OUTLAND2         = 0x00004000,                // outland zones? (only Circle of Blood Arena not have this flag, but have 0x00000400 flag) 
    63     AREA_FLAG_PVP              = 0x00008000,                // pvp objective area? (Death's Door also has this flag although it's no pvp object area) 
    64     AREA_FLAG_ARENA_INSTANCE   = 0x00010000,                // used by instanced arenas only 
    65     AREA_FLAG_UNUSED2          = 0x00020000,                // not used now (no area/zones with this flag set in 2.4.2) 
    66     AREA_FLAG_UNK5             = 0x00040000,                // just used for Amani Pass, Hatchet Hills 
    67     AREA_FLAG_LOWLEVEL         = 0x00100000                 // used for some starting areas with area_level <=15 
    68 }; 
    69  
    70 enum FactionTemplateFlags 
    71 { 
    72     FACTION_TEMPLATE_FLAG_CONTESTED_GUARD   =   0x00001000, // faction will attack players that were involved in PvP combats 
    73 }; 
    7439 
    7540struct AreaTableEntry 
     
    180145                                                            // 64 string flags, unused 
    181146                                                            // 65-67 unused 
    182     uint32    addon;                                         // 68 (0 - original race, 1 - tbc addon, ...) 
     147    uint32      addon;                                      // 68 (0 - original race, 1 - tbc addon, ...) 
    183148}; 
    184149 
     
    194159{ 
    195160    uint32    ID;                                           // 0 
    196     float     minScale;                                     // 1   
    197     uint32    minScaleLevel;                                // 2 0/1       
     161    float     minScale;                                     // 1 
     162    uint32    minScaleLevel;                                // 2 0/1 
    198163    float     maxScale;                                     // 3 
    199164    uint32    maxScaleLevel;                                // 4 0/60 
    200     uint32    skillLine;                                    // 5 
    201     uint32    skillLine2;                                   // 6 
     165    uint32    skillLine[2];                                 // 5-6 
    202166    uint32    petFoodMask;                                  // 7 
    203167    char*     Name[16];                                     // 8-23 
     
    243207    //char*     description[16];                            // 36-51 unused 
    244208                                                            // 52 string flags, unused 
    245 }; 
    246  
    247 enum FactionMasks 
    248 { 
    249     FACTION_MASK_PLAYER   = 1,                              // any player 
    250     FACTION_MASK_ALLIANCE = 2,                              // player or creature from alliance team 
    251     FACTION_MASK_HORDE    = 4,                              // player or creature from horde team 
    252     FACTION_MASK_MONSTER  = 8                               // aggressive creature from monster team 
    253                                                             // if none flags set then non-aggressive creature 
    254209}; 
    255210 
     
    302257 
    303258#define GT_MAX_LEVEL    100 
     259 
    304260struct GtCombatRatingsEntry 
    305261{ 
     
    430386                                                            // 17 name flags, unused 
    431387    //char*       content[16];                              // 18-33 
    432 }; 
    433  
    434 enum MapTypes 
    435 { 
    436     MAP_COMMON          = 0, 
    437     MAP_INSTANCE        = 1, 
    438     MAP_RAID            = 2, 
    439     MAP_BATTLEGROUND    = 3, 
    440     MAP_ARENA           = 4 
    441388}; 
    442389 
     
    544491                                                            // 36 string flags, not used 
    545492    uint32    spellIcon;                                    // 37 
    546 }; 
    547  
    548 enum AbilytyLearnType 
    549 { 
    550     ABILITY_LEARNED_ON_GET_PROFESSION_SKILL     = 1, 
    551     ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL  = 2 
    552493}; 
    553494 
     
    759700}; 
    760701 
    761 enum ItemEnchantmentType 
    762 { 
    763     ITEM_ENCHANTMENT_TYPE_NONE         = 0, 
    764     ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL = 1, 
    765     ITEM_ENCHANTMENT_TYPE_DAMAGE       = 2, 
    766     ITEM_ENCHANTMENT_TYPE_EQUIP_SPELL  = 3, 
    767     ITEM_ENCHANTMENT_TYPE_RESISTANCE   = 4, 
    768     ITEM_ENCHANTMENT_TYPE_STAT         = 5, 
    769     ITEM_ENCHANTMENT_TYPE_TOTEM        = 6 
    770 }; 
    771  
    772702struct SpellItemEnchantmentEntry 
    773703{ 
     
    827757}; 
    828758 
    829 struct TaxiPathEntry 
    830 { 
    831     uint32    ID; 
    832     uint32    from; 
    833     uint32    to; 
    834     uint32    price; 
    835 }; 
    836  
    837759struct TaxiNodesEntry 
    838760{ 
     
    848770}; 
    849771 
    850 enum TotemCategoryType 
    851 { 
    852     TOTEM_CATEGORY_TYPE_KNIFE   = 1, 
    853     TOTEM_CATEGORY_TYPE_TOTEM   = 2, 
    854     TOTEM_CATEGORY_TYPE_ROD     = 3, 
    855     TOTEM_CATEGORY_TYPE_PICK    = 21, 
    856     TOTEM_CATEGORY_TYPE_STONE   = 22, 
    857     TOTEM_CATEGORY_TYPE_HAMMER  = 23, 
    858     TOTEM_CATEGORY_TYPE_SPANNER = 24 
     772struct TaxiPathEntry 
     773{ 
     774    uint32    ID; 
     775    uint32    from; 
     776    uint32    to; 
     777    uint32    price; 
     778}; 
     779 
     780struct TaxiPathNodeEntry 
     781{ 
     782    uint32    path; 
     783    uint32    index; 
     784    uint32    mapid; 
     785    float     x; 
     786    float     y; 
     787    float     z; 
     788    uint32    actionFlag; 
     789    uint32    delay; 
    859790}; 
    860791 
  • trunk/src/shared/Database/SQLStorage.cpp

    r102 r260  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1919 */ 
    2020 
    2121#include "SQLStorage.h" 
    22 #include "ProgressBar.h" 
    23 #include "Log.h" 
    24 #include "dbcfile.h" 
     22#include "SQLStorageImpl.h" 
    2523 
    2624#ifdef DO_POSTGRESQL 
     
    3028#endif 
    3129 
    32 const char CreatureInfofmt[]="iiiiiisssiiiiiiiiiiffiffiiiiiiiiiiiffiiiiiiiiiiiiiiiiiiisiilliiis"; 
     30const char CreatureInfosrcfmt[]="iiiiiisssiiiiiiiiiiffiffiiiiiiiiiiiffiiiiiiiiiiiiiiiiiiisiilliiis"; 
     31const char CreatureInfodstfmt[]="iiiiiisssiiiiiiiiiiffiffiiiiiiiiiiiffiiiiiiiiiiiiiiiiiiisiilliiii"; 
    3332const char CreatureDataAddonInfofmt[]="iiiiiiis"; 
    3433const char CreatureModelfmt[]="iffbi"; 
    3534const char CreatureInfoAddonInfofmt[]="iiiiiiis"; 
    3635const char EquipmentInfofmt[]="iiiiiiiiii"; 
    37 const char GameObjectInfofmt[]="iiissiifiiiiiiiiiiiiiiiiiiiiiiiis"; 
    38 const char ItemPrototypefmt[]="iiiisiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiffiffiffiffiffiiiiiiiiiifiiifiiiiiifiiiiiifiiiiiifiiiiiifiiiisiiiiiiiiiiiiiiiiiiiiiiiiifsiiiii"; 
     36const char GameObjectInfosrcfmt[]="iiissiifiiiiiiiiiiiiiiiiiiiiiiiis"; 
     37const char GameObjectInfodstfmt[]="iiissiifiiiiiiiiiiiiiiiiiiiiiiiii"; 
     38const char ItemPrototypesrcfmt[]="iiiisiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiffiffiffiffiffiiiiiiiiiifiiifiiiiiifiiiiiifiiiiiifiiiiiifiiiisiiiiiiiiiiiiiiiiiiiiiiiiifsiiiii"; 
     39const char ItemPrototypedstfmt[]="iiiisiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiffiffiffiffiffiiiiiiiiiifiiifiiiiiifiiiiiifiiiiiifiiiiiifiiiisiiiiiiiiiiiiiiiiiiiiiiiiifiiiiii"; 
    3940const char PageTextfmt[]="isi"; 
    4041const char SpellThreatfmt[]="ii"; 
    41 const char InstanceTemplatefmt[]="iiiiiiffffs"; 
     42const char InstanceTemplatesrcfmt[]="iiiiiiffffs"; 
     43const char InstanceTemplatedstfmt[]="iiiiiiffffi"; 
    4244 
    43 SQLStorage sCreatureStorage(CreatureInfofmt,"entry","creature_template"); 
     45SQLStorage sCreatureStorage(CreatureInfosrcfmt, CreatureInfodstfmt, "entry","creature_template"); 
    4446SQLStorage sCreatureDataAddonStorage(CreatureDataAddonInfofmt,"guid","creature_addon"); 
    4547SQLStorage sCreatureModelStorage(CreatureModelfmt,"modelid","creature_model_info"); 
    4648SQLStorage sCreatureInfoAddonStorage(CreatureInfoAddonInfofmt,"entry","creature_template_addon"); 
    4749SQLStorage sEquipmentStorage(EquipmentInfofmt,"entry","creature_equip_template"); 
    48 SQLStorage sGOStorage(GameObjectInfofmt,"entry","gameobject_template"); 
    49 SQLStorage sItemStorage(ItemPrototypefmt,"entry","item_template"); 
     50SQLStorage sGOStorage(GameObjectInfosrcfmt, GameObjectInfodstfmt, "entry","gameobject_template"); 
     51SQLStorage sItemStorage(ItemPrototypesrcfmt, ItemPrototypedstfmt, "entry","item_template"); 
    5052SQLStorage sPageTextStore(PageTextfmt,"entry","page_text"); 
    5153SQLStorage sSpellThreatStore(SpellThreatfmt,"entry","spell_threat"); 
    52 SQLStorage sInstanceTemplate(InstanceTemplatefmt,"map","instance_template"); 
     54SQLStorage sInstanceTemplate(InstanceTemplatesrcfmt, InstanceTemplatedstfmt, "map","instance_template"); 
    5355 
    5456void SQLStorage::Free () 
     
    5658    uint32 offset=0; 
    5759    for(uint32 x=0;x<iNumFields;x++) 
    58         if (format[x]==FT_STRING) 
     60        if (dst_format[x]==FT_STRING) 
    5961        { 
    6062            for(uint32 y=0;y<MaxEntry;y++) 
     
    6264                    delete [] *(char**)((char*)(pIndex[y])+offset); 
    6365 
    64             offset+=sizeof(char*); 
     66            offset += sizeof(char*); 
    6567        } 
    66         else if (format[x]==FT_LOGIC) 
    67             offset+=sizeof(bool); 
    68         else if (format[x]==FT_BYTE) 
    69             offset+=sizeof(char); 
     68        else if (dst_format[x]==FT_LOGIC) 
     69            offset += sizeof(bool); 
     70        else if (dst_format[x]==FT_BYTE) 
     71            offset += sizeof(char); 
    7072        else 
    71             offset+=4; 
     73            offset += 4; 
    7274 
    7375    delete [] pIndex; 
     
    7577} 
    7678 
    77 void SQLStorage::Load () 
     79void SQLStorage::Load() 
    7880{ 
    79     uint32 maxi; 
    80     Field *fields; 
    81     QueryResult *result  = WorldDatabase.PQuery("SELECT MAX(%s) FROM %s",entry_field,table); 
    82     if(!result) 
    83     { 
    84         sLog.outError("Error loading %s table (not exist?)\n",table); 
    85         exit(1);                                            // Stop server at loading non exited table or not accessable table 
    86     } 
    87  
    88     maxi= (*result)[0].GetUInt32()+1; 
    89     delete result; 
    90  
    91     result = WorldDatabase.PQuery("SELECT COUNT(*) FROM %s",table); 
    92     if(result) 
    93     { 
    94         fields = result->Fetch(); 
    95         RecordCount=fields[0].GetUInt32(); 
    96         delete result; 
    97     } 
    98     else 
    99         RecordCount = 0; 
    100  
    101     result = WorldDatabase.PQuery("SELECT * FROM %s",table); 
    102  
    103     if(!result) 
    104     { 
    105         sLog.outError("%s table is empty!\n",table); 
    106         RecordCount = 0; 
    107         return; 
    108     } 
    109  
    110     uint32 recordsize=0; 
    111     uint32 offset=0; 
    112  
    113     if(iNumFields!=result->GetFieldCount()) 
    114     { 
    115         RecordCount = 0; 
    116         sLog.outError("Error in %s table, probably sql file format was updated (there should be %d fields in sql).\n",table,iNumFields); 
    117         delete result; 
    118         exit(1);                                            // Stop server at loading broken or non-compatiable table. 
    119     } 
    120  
    121     //get struct size 
    122     uint32 sc=0; 
    123     uint32 bo=0; 
    124     uint32 bb=0; 
    125     for(uint32 x=0;x<iNumFields;x++) 
    126         if(format[x]==FT_STRING) 
    127             ++sc; 
    128         else if (format[x]==FT_LOGIC) 
    129             ++bo; 
    130         else if (format[x]==FT_BYTE) 
    131             ++bb; 
    132     recordsize=(iNumFields-sc-bo-bb)*4+sc*sizeof(char*)+bo*sizeof(bool)+bb*sizeof(char); 
    133  
    134     char** newIndex=new char*[maxi]; 
    135     memset(newIndex,0,maxi*sizeof(char*)); 
    136  
    137     char * _data= new char[RecordCount *recordsize]; 
    138     uint32 count=0; 
    139     barGoLink bar( RecordCount ); 
    140     do 
    141     { 
    142         fields = result->Fetch(); 
    143         bar.step(); 
    144         char *p=(char*)&_data[recordsize*count]; 
    145         newIndex[fields[0].GetUInt32()]=p; 
    146  
    147         offset=0; 
    148         for(uint32 x=0;x<iNumFields;x++) 
    149             switch(format[x]) 
    150             { 
    151                 case FT_LOGIC: 
    152                     *((bool*)(&p[offset]))=(fields[x].GetUInt32()>0); 
    153                     offset+=sizeof(bool); 
    154                     break; 
    155                 case FT_BYTE: 
    156                     *((char*)(&p[offset]))=(fields[x].GetUInt8()); 
    157                     offset+=sizeof(char); 
    158                     break; 
    159                 case FT_INT: 
    160                     *((uint32*)(&p[offset]))=fields[x].GetUInt32(); 
    161                     offset+=sizeof(uint32); 
    162                     break; 
    163                 case FT_FLOAT: 
    164                     *((float*)(&p[offset]))=fields[x].GetFloat(); 
    165                     offset+=sizeof(float); 
    166                     break; 
    167                 case FT_STRING: 
    168                     char const* tmp = fields[x].GetString(); 
    169                     char* st; 
    170                     if(!tmp) 
    171                     { 
    172                         st=new char[1]; 
    173                         *st=0; 
    174                     } 
    175                     else 
    176                     { 
    177                         uint32 l=strlen(tmp)+1; 
    178                         st=new char[l]; 
    179                         memcpy(st,tmp,l); 
    180                     } 
    181                     *((char**)(&p[offset]))=st; 
    182                     offset+=sizeof(char*); 
    183                     break; 
    184             } 
    185         ++count; 
    186     }while( result->NextRow() ); 
    187  
    188     delete result; 
    189  
    190     pIndex =newIndex; 
    191     MaxEntry=maxi; 
    192     data=_data; 
     81    SQLStorageLoader loader; 
     82    loader.Load(*this); 
    19383} 
  • trunk/src/shared/Database/SQLStorage.h

    r102 r260  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1919 */ 
    2020 
     
    2727class SQLStorage 
    2828{ 
     29    template<class T> 
     30    friend struct SQLStorageLoaderBase; 
     31 
    2932    public: 
    3033 
    31         SQLStorage(const char*fmt,const char * _entry_field,const char * sqlname) 
     34        SQLStorage(const char* fmt, const char * _entry_field, const char * sqlname) 
    3235        { 
    33             format=fmt; 
    34             entry_field = _entry_field; 
    35             table=sqlname; 
    36             data=NULL; 
    37             pIndex=NULL; 
    38             iNumFields =strlen(fmt); 
    39             MaxEntry = 0; 
     36            src_format = fmt; 
     37            dst_format = fmt; 
     38            init(_entry_field, sqlname); 
    4039        } 
     40 
     41        SQLStorage(const char* src_fmt, const char* dst_fmt, const char * _entry_field, const char * sqlname) 
     42        { 
     43            src_format = src_fmt; 
     44            dst_format = dst_fmt; 
     45            init(_entry_field, sqlname); 
     46        } 
     47 
     48 
    4149        ~SQLStorage() 
    4250        { 
     
    5765        uint32 MaxEntry; 
    5866        uint32 iNumFields; 
     67 
    5968        void Load(); 
    6069        void Free(); 
     70 
    6171    private: 
     72        void init(const char * _entry_field, const char * sqlname) 
     73        { 
     74            entry_field = _entry_field; 
     75            table=sqlname; 
     76            data=NULL; 
     77            pIndex=NULL; 
     78            iNumFields = strlen(src_format); 
     79            MaxEntry = 0; 
     80        } 
     81 
    6282        char** pIndex; 
    6383 
    6484        char *data; 
    65         const char *format; 
     85        const char *src_format; 
     86        const char *dst_format; 
    6687        const char *table; 
    6788        const char *entry_field; 
    6889        //bool HasString; 
    6990}; 
     91 
     92template <class T> 
     93struct SQLStorageLoaderBase 
     94{ 
     95    public: 
     96        void Load(SQLStorage &storage); 
     97 
     98        template<class S, class D> 
     99            void convert(uint32 field_pos, S src, D &dst); 
     100        template<class S> 
     101            void convert_to_str(uint32 field_pos, S src, char * & dst); 
     102        template<class D> 
     103            void convert_from_str(uint32 field_pos, char * src, D& dst); 
     104        void convert_str_to_str(uint32 field_pos, char *src, char *&dst); 
     105 
     106    private: 
     107        template<class V> 
     108            void storeValue(V value, SQLStorage &store, char *p, int x, uint32 &offset); 
     109        void storeValue(char * value, SQLStorage &store, char *p, int x, uint32 &offset); 
     110}; 
     111 
     112struct SQLStorageLoader : public SQLStorageLoaderBase<SQLStorageLoader> 
     113{ 
     114}; 
     115 
    70116#endif 
  • trunk/src/shared/Database/dbcfile.cpp

    r102 r260  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1919 */ 
    2020 
  • trunk/src/shared/Database/dbcfile.h

    r102 r260  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1919 */ 
    2020 
  • trunk/src/shared/ProgressBar.cpp

    r102 r260  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1919 */ 
    2020 
  • trunk/src/shared/ProgressBar.h

    r102 r260  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1919 */ 
    2020#ifndef TRINITYCORE_PROGRESSBAR_H 
  • trunk/src/trinitycore/CliRunnable.cpp

    r237 r260  
    170170{ 
    171171    SendSysMessage(LANG_COMMAND_EXIT); 
    172     World::m_stopEvent = true; 
     172    World::StopNow(SHUTDOWN_EXIT_CODE); 
    173173    return true; 
    174174} 
     
    311311 
    312312    ///- As long as the World is running (no World::m_stopEvent), get the command line and handle it 
    313     while (!World::m_stopEvent) 
     313    while (!World::IsStopped()) 
    314314    { 
    315315        fflush(stdout); 
    316316        #ifdef linux 
    317         while (!kb_hit_return() && !World::m_stopEvent) 
     317        while (!kb_hit_return() && !World::IsStopped()) 
    318318            // With this, we limit CLI to 10commands/second 
    319319            usleep(100); 
    320         if (World::m_stopEvent) 
     320        if (World::IsStopped()) 
    321321            break; 
    322322        #endif 
     
    349349        else if (feof(stdin)) 
    350350        { 
    351             World::m_stopEvent = true; 
     351            World::StopNow(SHUTDOWN_EXIT_CODE); 
    352352        } 
    353353    } 
  • trunk/src/trinitycore/Master.cpp

    r237 r260  
    7878        m_lastchange = 0; 
    7979        w_lastchange = 0; 
    80         while(!World::m_stopEvent) 
     80        while(!World::IsStopped()) 
    8181        { 
    8282            ZThread::Thread::sleep(1000); 
     
    173173    // if use ra spend time waiting for io, if not use ra ,just sleep 
    174174    if (usera) 
    175       while (!World::m_stopEvent) 
     175      while (!World::IsStopped()) 
    176176        { 
    177177          h.Select (0, socketSelecttime); 
     
    179179        } 
    180180    else 
    181       while (!World::m_stopEvent) 
     181      while (!World::IsStopped()) 
    182182        { 
    183183          ZThread::Thread::sleep (static_cast<unsigned long> (socketSelecttime / 1000)); 
     
    324324    { 
    325325      sLog.outError ("Failed to start network"); 
    326       World::m_stopEvent = true; 
     326      World::StopNow(ERROR_EXIT_CODE); 
    327327      // go down and shutdown the server 
    328328    } 
     
    395395    UnloadScriptingModule(); 
    396396 
    397     return sWorld.GetShutdownMask() & SHUTDOWN_MASK_RESTART ? 2 : 0; 
     397    // Exit the process with specified return value 
     398    return World::GetExitCode(); 
    398399} 
    399400 
     
    478479 
    479480/// Handle termination signals 
    480 /** Put the World::m_stopEvent to 'true' if a termination signal is caught **/ 
    481481void Master::_OnSignal(int s) 
    482482{ 
     
    484484    { 
    485485        case SIGINT: 
     486            World::StopNow(RESTART_EXIT_CODE); 
     487            break; 
    486488        case SIGTERM: 
    487489        #ifdef _WIN32 
    488490        case SIGBREAK: 
    489491        #endif 
    490             World::m_stopEvent = true; 
     492            World::StopNow(SHUTDOWN_EXIT_CODE); 
    491493            break; 
    492494    } 
  • trunk/src/trinitycore/WorldRunnable.cpp

    r237 r260  
    5252 
    5353    ///- While we have not World::m_stopEvent, update the world 
    54     while (!World::m_stopEvent) 
     54    while (!World::IsStopped()) 
    5555    { 
    5656        ++World::m_worldLoopCounter;