Changeset 5

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

[svn] * Continue Trinity Script conversion.

Original author: Seline
Date: 2008-10-03 19:21:26-05:00

Location:
trunk/src/bindings/scripts
Files:
5 modified

Legend:

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

    r2 r5  
    8181//*** End EventAI data *** 
    8282 
    83 DatabaseMysql ScriptDev2DB; 
    84 Config SD2Config; 
     83DatabaseMysql TScriptDB; 
     84Config TScriptConfig; 
    8585uint32 Locale; 
    8686 
     
    598598    //Get db string from file 
    599599    char const* dbstring = NULL; 
    600     if (!SD2Config.GetString("ScriptDev2DatabaseInfo", &dbstring)) 
    601         error_log("SD2: Missing ScriptDev2 Database Info from configuration file"); 
     600    if(!TScriptConfig.GetString("TScriptDatabaseInfo", &dbstring)) 
     601        error_log("TSCR: Missing Trinity Script Database Info in configuration file"); 
    602602 
    603603    //Initilize connection to DB 
    604     if (!dbstring || !ScriptDev2DB.Initialize(dbstring)) 
    605         error_db_log("SD2: Unable to connect to Database"); 
     604    if(!dbstring || !TScriptDB.Initialize(dbstring)) 
     605        error_db_log("TSCR: Unable to connect to Database"); 
    606606    else 
    607607    { 
     
    610610 
    611611        //Get Version information 
    612         result = ScriptDev2DB.PQuery("SELECT `version`" 
    613             "FROM `sd2_db_version`"); 
     612        result = TScriptDB.PQuery("SELECT `version`" 
     613            "FROM `script_db_version`"); 
    614614 
    615615        if (result) 
     
    617617            Field *fields = result->Fetch(); 
    618618            outstring_log(" "); 
    619             outstring_log("SD2: Database version is: %s", fields[0].GetString()); 
     619            outstring_log("TSCR: Database version is: %s", fields[0].GetString()); 
    620620            outstring_log(" "); 
    621621            delete result; 
    622622 
    623         }else error_db_log("SD2: Missing sd2_db_version information."); 
     623        }else error_db_log("TSCR: Missing script_db_version information."); 
    624624 
    625625        // Drop existing Event AI Localized Text hash map 
     
    627627 
    628628        // Gather EventAI Localized Texts 
    629         result = ScriptDev2DB.PQuery("SELECT `id`,`locale_1`,`locale_2`,`locale_3`,`locale_4`,`locale_5`,`locale_6`,`locale_7`,`locale_8`" 
     629        result = TScriptDB.PQuery("SELECT `id`,`locale_1`,`locale_2`,`locale_3`,`locale_4`,`locale_5`,`locale_6`,`locale_7`,`locale_8`" 
    630630            "FROM `eventai_localized_texts`"); 
    631631 
    632632        if(result) 
    633633        { 
    634             outstring_log("Loading EAI Localized Texts...."); 
     634            outstring_log("TSCR: Loading EAI Localized Texts...."); 
    635635            barGoLink bar(result->GetRowCount()); 
    636636            uint32 count = 0; 
     
    662662 
    663663            outstring_log(""); 
    664             outstring_log("SD2: Loaded %u EventAI Localized Texts", count); 
    665         }else outstring_log("SD2: WARNING >> Loaded 0 EventAI Localized Texts. Database table `eventai_localized_texts` is empty"); 
     664            outstring_log("TSCR: Loaded %u EventAI Localized Texts", count); 
     665        }else outstring_log("TSCR: WARNING >> Loaded 0 EventAI Localized Texts. Database table `eventai_localized_texts` is empty"); 
    666666 
    667667        // Drop Existing Script Localized Text Hash Map 
     
    669669 
    670670        // Gather Script Localized Texts 
    671         result = ScriptDev2DB.PQuery("SELECT `id`,`locale_1`,`locale_2`,`locale_3`,`locale_4`,`locale_5`,`locale_6`,`locale_7`,`locale_8`" 
     671        result = TScriptDB.PQuery("SELECT `id`,`locale_1`,`locale_2`,`locale_3`,`locale_4`,`locale_5`,`locale_6`,`locale_7`,`locale_8`" 
    672672            "FROM `script_localized_texts`"); 
    673673 
    674674        if(result) 
    675675        { 
    676             outstring_log("Loading Script Localized Texts...."); 
     676            outstring_log("TSCR: Loading Script Localized Texts...."); 
    677677            barGoLink bar(result->GetRowCount()); 
    678678            uint32 count = 0; 
     
    704704 
    705705            outstring_log(""); 
    706             outstring_log("SD2: Loaded %u Script Localized Texts", count); 
    707         }else outstring_log("SD2: WARNING >> Loaded 0 Script Localized Texts. Database table `script_localized_texts` is empty"); 
     706            outstring_log("TSCR: Loaded %u Script Localized Texts", count); 
     707        }else outstring_log("TSCR: WARNING >> Loaded 0 Script Localized Texts. Database table `script_localized_texts` is empty"); 
    708708 
    709709        //Drop existing EventAI Text hash map 
     
    711711 
    712712        //Gather EventAI Text Entries 
    713         result = ScriptDev2DB.PQuery("SELECT `id`,`text` FROM `eventai_texts`"); 
     713        result = TScriptDB.PQuery("SELECT `id`,`text` FROM `eventai_texts`"); 
    714714 
    715715        if (result) 
    716716        { 
    717             outstring_log( "SD2: Loading EventAI_Texts..."); 
     717            outstring_log( "TSCR: Loading EventAI_Texts..."); 
    718718            barGoLink bar(result->GetRowCount()); 
    719719            uint32 Count = 0; 
     
    729729 
    730730                if (!strlen(text.c_str())) 
    731                     error_db_log("SD2: EventAI text %u is empty", i); 
     731                    error_db_log("TSCR: EventAI text %u is empty", i); 
    732732 
    733733                EventAI_Text_Map[i] = text; 
     
    739739 
    740740            outstring_log(""); 
    741             outstring_log("SD2: >> Loaded %u EventAI_Texts", Count); 
    742  
    743         }else outstring_log("SD2: WARNING >> Loaded 0 EventAI_Texts. DB table `EventAI_Texts` is empty."); 
     741            outstring_log("TSCR: >> Loaded %u EventAI_Texts", Count); 
     742 
     743        }else outstring_log("TSCR: WARNING >> Loaded 0 EventAI_Texts. DB table `EventAI_Texts` is empty."); 
    744744 
    745745        //Gather event data 
    746         result = ScriptDev2DB.PQuery("SELECT `id`,`position_x`,`position_y`,`position_z`,`orientation`,`spawntimesecs`" 
     746        result = TScriptDB.PQuery("SELECT `id`,`position_x`,`position_y`,`position_z`,`orientation`,`spawntimesecs`" 
    747747            "FROM `eventai_summons`"); 
    748748 
     
    752752        if (result) 
    753753        { 
    754             outstring_log( "SD2: Loading EventAI_Summons..."); 
     754            outstring_log( "TSCR: Loading EventAI_Summons..."); 
    755755            barGoLink bar(result->GetRowCount()); 
    756756            uint32 Count = 0; 
     
    778778            delete result; 
    779779            outstring_log(""); 
    780             outstring_log("SD2: >> Loaded %u EventAI_Summons", Count); 
    781  
    782         }else outstring_log("SD2: WARNING >> Loaded 0 EventAI_Summons. DB table `EventAI_Summons` is empty."); 
     780            outstring_log("TSCR: >> Loaded %u EventAI_Summons", Count); 
     781 
     782        }else outstring_log("TSCR: WARNING >> Loaded 0 EventAI_Summons. DB table `EventAI_Summons` is empty."); 
    783783 
    784784        //Gather event data 
    785         result = ScriptDev2DB.PQuery("SELECT `id`,`creature_id`,`event_type`,`event_inverse_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action1_type`,`action1_param1`,`action1_param2`,`action1_param3`,`action2_type`,`action2_param1`,`action2_param2`,`action2_param3`,`action3_type`,`action3_param1`,`action3_param2`,`action3_param3`" 
     785        result = TScriptDB.PQuery("SELECT `id`,`creature_id`,`event_type`,`event_inverse_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action1_type`,`action1_param1`,`action1_param2`,`action1_param3`,`action2_type`,`action2_param1`,`action2_param2`,`action2_param3`,`action3_type`,`action3_param1`,`action3_param2`,`action3_param3`" 
    786786            "FROM `eventai_scripts`"); 
    787787 
     
    791791        if (result) 
    792792        { 
    793             outstring_log( "SD2: Loading EventAI_Scripts..."); 
     793            outstring_log( "TSCR: Loading EventAI_Scripts..."); 
    794794            barGoLink bar(result->GetRowCount()); 
    795795            uint32 Count = 0; 
     
    816816                //Report any errors in event 
    817817                if (temp.event_type >= EVENT_T_END) 
    818                     error_db_log("SD2: Event %u has incorrect event type. Maybe DB requires updated version of SD2.", i); 
     818                    error_db_log("TSCR: Event %u has incorrect event type. Maybe DB requires updated version of SD2.", i); 
    819819 
    820820                //No chance of this event occuring 
    821821                if (temp.event_chance == 0) 
    822                     error_db_log("SD2: Event %u has 0 percent chance. Event will never trigger!", i); 
     822                    error_db_log("TSCR: Event %u has 0 percent chance. Event will never trigger!", i); 
    823823                //Chance above 100, force it to be 100 
    824824                if (temp.event_chance > 100) 
    825825                { 
    826                     error_db_log("SD2: Creature %u are using event %u with more than 100 percent chance. Adjusting to 100 percent.", temp.creature_id, i); 
     826                    error_db_log("TSCR: Creature %u are using event %u with more than 100 percent chance. Adjusting to 100 percent.", temp.creature_id, i); 
    827827                    temp.event_chance = 100; 
    828828                } 
     
    831831                switch (temp.event_type) 
    832832                { 
    833                 case EVENT_T_HP: 
    834                 case EVENT_T_MANA: 
    835                 case EVENT_T_TARGET_HP: 
    836                     { 
    837                         if (temp.event_param2 > 100) 
    838                             error_db_log("SD2: Creature %u are using percentage event(%u) with param2 (MinPercent) > 100. Event will never trigger! ", temp.creature_id, i); 
    839  
    840                         if (temp.event_param1 <= temp.event_param2) 
    841                             error_db_log("SD2: Creature %u are using percentage event(%u) with param1 <= param2 (MaxPercent <= MinPercent). Event will never trigger! ", temp.creature_id, i); 
    842  
    843                         if (temp.event_flags & EFLAG_REPEATABLE && !temp.event_param3 && !temp.event_param4) 
     833                    case EVENT_T_HP: 
     834                    case EVENT_T_MANA: 
     835                    case EVENT_T_TARGET_HP: 
    844836                        { 
    845                             error_db_log("SD2: Creature %u has param3 and param4=0 (RepeatMin/RepeatMax) but cannot be repeatable without timers. Removing EFLAG_REPEATABLE for event %u.", temp.creature_id, i); 
    846                             temp.event_flags &= ~EFLAG_REPEATABLE; 
     837                            if (temp.event_param2 > 100) 
     838                                error_db_log("TSCR: Creature %u are using percentage event(%u) with param2 (MinPercent) > 100. Event will never trigger! ", temp.creature_id, i); 
     839 
     840                            if (temp.event_param1 <= temp.event_param2) 
     841                                error_db_log("TSCR: Creature %u are using percentage event(%u) with param1 <= param2 (MaxPercent <= MinPercent). Event will never trigger! ", temp.creature_id, i); 
     842 
     843                            if (temp.event_flags & EFLAG_REPEATABLE && !temp.event_param3 && !temp.event_param4) 
     844                            { 
     845                                error_db_log("TSCR: Creature %u has param3 and param4=0 (RepeatMin/RepeatMax) but cannot be repeatable without timers. Removing EFLAG_REPEATABLE for event %u.", temp.creature_id, i); 
     846                                temp.event_flags &= ~EFLAG_REPEATABLE; 
     847                            } 
    847848                        } 
    848                     } 
    849                     break; 
    850  
    851                 case EVENT_T_SPELLHIT: 
    852                     { 
    853                         if (temp.event_param1) 
     849                        break; 
     850 
     851                    case EVENT_T_SPELLHIT: 
    854852                        { 
    855                             SpellEntry const* pSpell = GetSpellStore()->LookupEntry(temp.event_param1); 
    856                             if (!pSpell) 
     853                            if (temp.event_param1) 
    857854                            { 
    858                                 error_db_log("SD2: Creature %u has non-existant SpellID(%u) defined in event %u.", temp.creature_id, temp.event_param1, i); 
    859                                 continue; 
     855                                SpellEntry const* pSpell = GetSpellStore()->LookupEntry(temp.event_param1); 
     856                                if (!pSpell) 
     857                                { 
     858                                    error_db_log("TSCR: Creature %u has non-existant SpellID(%u) defined in event %u.", temp.creature_id, temp.event_param1, i); 
     859                                    continue; 
     860                                } 
     861 
     862                                if (temp.event_param2_s != -1 && temp.event_param2 != pSpell->SchoolMask) 
     863                                    error_db_log("TSCR: Creature %u has param1(spellId %u) but param2 is not -1 and not equal to spell's school mask. Event %u can never trigger.", temp.creature_id, temp.event_param1, i); 
    860864                            } 
    861865 
    862                             if (temp.event_param2_s != -1 && temp.event_param2 != pSpell->SchoolMask) 
    863                                 error_db_log("SD2: Creature %u has param1(spellId %u) but param2 is not -1 and not equal to spell's school mask. Event %u can never trigger.", temp.creature_id, temp.event_param1, i); 
     866                            //TODO: fix this system with SPELL_SCHOOL_MASK. Current complicate things, using int32(-1) instead of just 0 
     867                            //SPELL_SCHOOL_MASK_NONE = 0 and does not exist, thus it can not ever trigger or be used in SpellHit() 
     868                            if (temp.event_param2_s != -1 && temp.event_param2_s > SPELL_SCHOOL_MASK_ALL) 
     869                                error_db_log("TSCR: Creature %u is using invalid SpellSchoolMask(%u) defined in event %u.", temp.creature_id, temp.event_param2, i); 
     870 
     871                            if (temp.event_param4 < temp.event_param3) 
     872                                error_db_log("TSCR: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); 
    864873                        } 
    865  
    866                         //TODO: fix this system with SPELL_SCHOOL_MASK. Current complicate things, using int32(-1) instead of just 0 
    867                         //SPELL_SCHOOL_MASK_NONE = 0 and does not exist, thus it can not ever trigger or be used in SpellHit() 
    868                         if (temp.event_param2_s != -1 && temp.event_param2_s > SPELL_SCHOOL_MASK_ALL) 
    869                             error_db_log("SD2: Creature %u is using invalid SpellSchoolMask(%u) defined in event %u.", temp.creature_id, temp.event_param2, i); 
    870  
    871                         if (temp.event_param4 < temp.event_param3) 
    872                             error_db_log("SD2: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); 
    873                     } 
    874                     break; 
    875  
    876                 case EVENT_T_RANGE: 
    877                 case EVENT_T_OOC_LOS: 
    878                 case EVENT_T_FRIENDLY_HP: 
    879                 case EVENT_T_FRIENDLY_IS_CC: 
    880                 case EVENT_T_FRIENDLY_MISSING_BUFF: 
    881                     { 
    882                         if (temp.event_param4 < temp.event_param3) 
    883                             error_db_log("SD2: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); 
    884                     } 
    885                     break; 
    886  
    887                 case EVENT_T_TIMER: 
    888                 case EVENT_T_TIMER_OOC: 
    889                     { 
    890                         if (temp.event_param2 < temp.event_param1) 
    891                             error_db_log("SD2: Creature %u are using timed event(%u) with param2 < param1 (InitialMax < InitialMin). Event will never repeat.", temp.creature_id, i); 
    892  
    893                         if (temp.event_param4 < temp.event_param3) 
    894                             error_db_log("SD2: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); 
    895                     } 
    896                     break; 
    897  
    898                 case EVENT_T_KILL: 
    899                 case EVENT_T_TARGET_CASTING: 
    900                     { 
    901                         if (temp.event_param2 < temp.event_param1) 
    902                             error_db_log("SD2: Creature %u are using event(%u) with param2 < param1 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); 
    903                     } 
    904                     break; 
    905  
    906                 case EVENT_T_AGGRO: 
    907                 case EVENT_T_DEATH: 
    908                 case EVENT_T_EVADE: 
    909                 case EVENT_T_SPAWNED: 
    910                     { 
    911                         if (temp.event_flags & EFLAG_REPEATABLE) 
     874                        break; 
     875 
     876                    case EVENT_T_RANGE: 
     877                    case EVENT_T_OOC_LOS: 
     878                    case EVENT_T_FRIENDLY_HP: 
     879                    case EVENT_T_FRIENDLY_IS_CC: 
     880                    case EVENT_T_FRIENDLY_MISSING_BUFF: 
    912881                        { 
    913                             error_db_log("SD2: Creature %u has EFLAG_REPEATABLE set. Event can never be repeatable. Removing flag for event %u.", temp.creature_id, i); 
    914                             temp.event_flags &= ~EFLAG_REPEATABLE; 
     882                            if (temp.event_param4 < temp.event_param3) 
     883                                error_db_log("TSCR: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); 
    915884                        } 
    916                     } 
    917                     break; 
     885                        break; 
     886 
     887                    case EVENT_T_TIMER: 
     888                    case EVENT_T_TIMER_OOC: 
     889                        { 
     890                            if (temp.event_param2 < temp.event_param1) 
     891                                error_db_log("TSCR: Creature %u are using timed event(%u) with param2 < param1 (InitialMax < InitialMin). Event will never repeat.", temp.creature_id, i); 
     892 
     893                            if (temp.event_param4 < temp.event_param3) 
     894                                error_db_log("TSCR: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); 
     895                        } 
     896                        break; 
     897 
     898                    case EVENT_T_KILL: 
     899                    case EVENT_T_TARGET_CASTING: 
     900                        { 
     901                            if (temp.event_param2 < temp.event_param1) 
     902                                error_db_log("TSCR: Creature %u are using event(%u) with param2 < param1 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); 
     903                        } 
     904                        break; 
     905 
     906                    case EVENT_T_AGGRO: 
     907                    case EVENT_T_DEATH: 
     908                    case EVENT_T_EVADE: 
     909                    case EVENT_T_SPAWNED: 
     910                        { 
     911                            if (temp.event_flags & EFLAG_REPEATABLE) 
     912                            { 
     913                                error_db_log("TSCR: Creature %u has EFLAG_REPEATABLE set. Event can never be repeatable. Removing flag for event %u.", temp.creature_id, i); 
     914                                temp.event_flags &= ~EFLAG_REPEATABLE; 
     915                            } 
     916                        } 
     917                        break; 
    918918                }; 
    919919 
     
    928928                    switch (temp.action[j].type) 
    929929                    { 
    930                     case ACTION_T_SAY: 
    931                     case ACTION_T_YELL: 
    932                     case ACTION_T_TEXTEMOTE: 
    933                         if (GetEventAIText(temp.action[j].param1) == DEFAULT_TEXT) 
    934                             error_db_log("SD2: Event %u Action %u refrences missing Localized_Text entry", i, j+1); 
    935                         break; 
    936  
    937                     case ACTION_T_SOUND: 
    938                         if (!GetSoundEntriesStore()->LookupEntry(temp.action[j].param1)) 
    939                             error_db_log("SD2: Event %u Action %u uses non-existant SoundID %u.", i, j+1, temp.action[j].param1); 
    940                         break; 
    941  
    942                     case ACTION_T_RANDOM_SAY: 
    943                     case ACTION_T_RANDOM_YELL: 
    944                     case ACTION_T_RANDOM_TEXTEMOTE: 
    945                         if ((temp.action[j].param1 != 0xffffffff && GetEventAIText(temp.action[j].param1) == DEFAULT_TEXT) || 
    946                             (temp.action[j].param2 != 0xffffffff && GetEventAIText(temp.action[j].param2) == DEFAULT_TEXT) || 
    947                             (temp.action[j].param3 != 0xffffffff && GetEventAIText(temp.action[j].param3) == DEFAULT_TEXT)) 
    948                             error_db_log("SD2: Event %u Action %u refrences missing Localized_Text entry", i, j+1); 
    949                         break; 
    950  
    951                     case ACTION_T_CAST: 
    952                         { 
    953                             if (!GetSpellStore()->LookupEntry(temp.action[j].param1)) 
    954                                 error_db_log("SD2: Event %u Action %u uses non-existant SpellID %u.", i, j+1, temp.action[j].param1); 
    955  
     930                        case ACTION_T_SAY: 
     931                        case ACTION_T_YELL: 
     932                        case ACTION_T_TEXTEMOTE: 
     933                            if (GetEventAIText(temp.action[j].param1) == DEFAULT_TEXT) 
     934                                error_db_log("TSCR: Event %u Action %u refrences missing Localized_Text entry", i, j+1); 
     935                            break; 
     936 
     937                        case ACTION_T_SOUND: 
     938                            if (!GetSoundEntriesStore()->LookupEntry(temp.action[j].param1)) 
     939                                error_db_log("TSCR: Event %u Action %u uses non-existant SoundID %u.", i, j+1, temp.action[j].param1); 
     940                            break; 
     941 
     942                        case ACTION_T_RANDOM_SAY: 
     943                        case ACTION_T_RANDOM_YELL: 
     944                        case ACTION_T_RANDOM_TEXTEMOTE: 
     945                            if ((temp.action[j].param1 != 0xffffffff && GetEventAIText(temp.action[j].param1) == DEFAULT_TEXT) || 
     946                                (temp.action[j].param2 != 0xffffffff && GetEventAIText(temp.action[j].param2) == DEFAULT_TEXT) || 
     947                                (temp.action[j].param3 != 0xffffffff && GetEventAIText(temp.action[j].param3) == DEFAULT_TEXT)) 
     948                                error_db_log("TSCR: Event %u Action %u refrences missing Localized_Text entry", i, j+1); 
     949                            break; 
     950 
     951                        case ACTION_T_CAST: 
     952                            { 
     953                                if (!GetSpellStore()->LookupEntry(temp.action[j].param1)) 
     954                                    error_db_log("TSCR: Event %u Action %u uses non-existant SpellID %u.", i, j+1, temp.action[j].param1); 
     955 
     956                                if (temp.action[j].param2 >= TARGET_T_END) 
     957                                    error_db_log("TSCR: Event %u Action %u uses incorrect Target type", i, j+1); 
     958                            } 
     959                            break; 
     960 
     961                        case ACTION_T_REMOVEAURASFROMSPELL: 
     962                            { 
     963                                if (!GetSpellStore()->LookupEntry(temp.action[j].param2)) 
     964                                    error_db_log("TSCR: Event %u Action %u uses non-existant SpellID %u.", i, j+1, temp.action[j].param2); 
     965 
     966                                if (temp.action[j].param1 >= TARGET_T_END) 
     967                                    error_db_log("TSCR: Event %u Action %u uses incorrect Target type", i, j+1); 
     968                            } 
     969                            break; 
     970 
     971                        case ACTION_T_CASTCREATUREGO: 
     972                            { 
     973                                if (!GetSpellStore()->LookupEntry(temp.action[j].param2)) 
     974                                    error_db_log("TSCR: Event %u Action %u uses non-existant SpellID %u.", i, j+1, temp.action[j].param2); 
     975 
     976                                if (temp.action[j].param3 >= TARGET_T_END) 
     977                                    error_db_log("TSCR: Event %u Action %u uses incorrect Target type", i, j+1); 
     978                            } 
     979                            break; 
     980 
     981                        //2nd param target 
     982                        case ACTION_T_SUMMON_ID: 
     983                            { 
     984                                if (EventAI_Summon_Map.find(temp.action[j].param3) == EventAI_Summon_Map.end()) 
     985                                    error_db_log("TSCR: Event %u Action %u summons missing EventAI_Summon %u", i, j+1, temp.action[j].param3); 
     986 
     987                                if (temp.action[j].param2 >= TARGET_T_END) 
     988                                    error_db_log("TSCR: Event %u Action %u uses incorrect Target type", i, j+1); 
     989                            } 
     990                            break; 
     991 
     992                        case ACTION_T_SUMMON: 
     993                        case ACTION_T_THREAT_SINGLE_PCT: 
     994                        case ACTION_T_QUEST_EVENT: 
     995                        case ACTION_T_SET_UNIT_FLAG: 
     996                        case ACTION_T_REMOVE_UNIT_FLAG: 
     997                        case ACTION_T_SET_INST_DATA64: 
    956998                            if (temp.action[j].param2 >= TARGET_T_END) 
    957                                 error_db_log("SD2: Event %u Action %u uses incorrect Target type", i, j+1); 
    958                         } 
    959                         break; 
    960  
    961                     case ACTION_T_REMOVEAURASFROMSPELL: 
    962                         { 
    963                             if (!GetSpellStore()->LookupEntry(temp.action[j].param2)) 
    964                                 error_db_log("SD2: Event %u Action %u uses non-existant SpellID %u.", i, j+1, temp.action[j].param2); 
    965  
    966                             if (temp.action[j].param1 >= TARGET_T_END) 
    967                                 error_db_log("SD2: Event %u Action %u uses incorrect Target type", i, j+1); 
    968                         } 
    969                         break; 
    970  
    971                     case ACTION_T_CASTCREATUREGO: 
    972                         { 
    973                             if (!GetSpellStore()->LookupEntry(temp.action[j].param2)) 
    974                                 error_db_log("SD2: Event %u Action %u uses non-existant SpellID %u.", i, j+1, temp.action[j].param2); 
    975  
     999                                error_db_log("TSCR: Event %u Action %u uses incorrect Target type", i, j+1); 
     1000                            break; 
     1001 
     1002                        //3rd param target 
     1003                        case ACTION_T_SET_UNIT_FIELD: 
    9761004                            if (temp.action[j].param3 >= TARGET_T_END) 
    977                                 error_db_log("SD2: Event %u Action %u uses incorrect Target type", i, j+1); 
    978                         } 
    979                         break; 
    980  
    981                     //2nd param target 
    982                     case ACTION_T_SUMMON_ID: 
    983                         { 
    984                             if (EventAI_Summon_Map.find(temp.action[j].param3) == EventAI_Summon_Map.end()) 
    985                                 error_db_log("SD2: Event %u Action %u summons missing EventAI_Summon %u", i, j+1, temp.action[j].param3); 
    986  
    987                             if (temp.action[j].param2 >= TARGET_T_END) 
    988                                 error_db_log("SD2: Event %u Action %u uses incorrect Target type", i, j+1); 
    989                         } 
    990                         break; 
    991  
    992                     case ACTION_T_SUMMON: 
    993                     case ACTION_T_THREAT_SINGLE_PCT: 
    994                     case ACTION_T_QUEST_EVENT: 
    995                     case ACTION_T_SET_UNIT_FLAG: 
    996                     case ACTION_T_REMOVE_UNIT_FLAG: 
    997                     case ACTION_T_SET_INST_DATA64: 
    998                         if (temp.action[j].param2 >= TARGET_T_END) 
    999                             error_db_log("SD2: Event %u Action %u uses incorrect Target type", i, j+1); 
    1000                         break; 
    1001  
    1002                     //3rd param target 
    1003                     case ACTION_T_SET_UNIT_FIELD: 
    1004                         if (temp.action[j].param3 >= TARGET_T_END) 
    1005                             error_db_log("SD2: Event %u Action %u uses incorrect Target type", i, j+1); 
    1006                         break; 
    1007  
    1008                     case ACTION_T_SET_PHASE: 
    1009                         if (temp.action[j].param1 > 31) 
    1010                             error_db_log("SD2: Event %u Action %u attempts to set phase > 31. Phase mask cannot be used past phase 31.", i, j+1); 
    1011                         break; 
    1012  
    1013                     case ACTION_T_INC_PHASE: 
    1014                         if (!temp.action[j].param1) 
    1015                             error_db_log("SD2: Event %u Action %u is incrementing phase by 0. Was this intended?", i, j+1); 
    1016                         break; 
    1017  
    1018                     case ACTION_T_KILLED_MONSTER: 
    1019                         if (temp.event_type != EVENT_T_DEATH) 
    1020                             outstring_log("SD2 WARNING: Event %u Action %u calling ACTION_T_KILLED_MONSTER outside of EVENT_T_DEATH", i, j+1); 
    1021                         break; 
    1022  
    1023                     case ACTION_T_SET_INST_DATA: 
    1024                         if (temp.action[j].param2 > 3) 
    1025                             error_db_log("SD2: Event %u Action %u attempts to set instance data above encounter state 3. Custom case?", i, j+1); 
    1026                         break; 
    1027  
    1028                     default: 
    1029                         break; 
     1005                                error_db_log("TSCR: Event %u Action %u uses incorrect Target type", i, j+1); 
     1006                            break; 
     1007 
     1008                        case ACTION_T_SET_PHASE: 
     1009                            if (temp.action[j].param1 > 31) 
     1010                                error_db_log("TSCR: Event %u Action %u attempts to set phase > 31. Phase mask cannot be used past phase 31.", i, j+1); 
     1011                            break; 
     1012 
     1013                        case ACTION_T_INC_PHASE: 
     1014                            if (!temp.action[j].param1) 
     1015                                error_db_log("TSCR: Event %u Action %u is incrementing phase by 0. Was this intended?", i, j+1); 
     1016                            break; 
     1017 
     1018                        case ACTION_T_KILLED_MONSTER: 
     1019                            if (temp.event_type != EVENT_T_DEATH) 
     1020                                outstring_log("TSCR WARNING: Event %u Action %u calling ACTION_T_KILLED_MONSTER outside of EVENT_T_DEATH", i, j+1); 
     1021                            break; 
     1022 
     1023                        case ACTION_T_SET_INST_DATA: 
     1024                            if (temp.action[j].param2 > 3) 
     1025                                error_db_log("TSCR: Event %u Action %u attempts to set instance data above encounter state 3. Custom case?", i, j+1); 
     1026                            break; 
     1027 
     1028                        default: 
     1029                            break; 
    10301030                    } 
    10311031 
    10321032                    if (temp.action[j].type >= ACTION_T_END) 
    1033                         error_db_log("SD2: Event %u Action %u has incorrect action type. Maybe DB requires updated version of SD2.", i, j+1); 
     1033                        error_db_log("TSCR: Event %u Action %u has incorrect action type. Maybe DB requires updated version of SD2.", i, j+1); 
    10341034                } 
    10351035 
     
    10421042            delete result; 
    10431043            outstring_log(""); 
    1044             outstring_log("SD2: >> Loaded %u EventAI_Events", Count); 
    1045  
    1046         }else outstring_log("SD2: WARNING >> Loaded 0 EventAI_Scripts. DB table `EventAI_Scripts` is empty."); 
     1044            outstring_log("TSCR: >> Loaded %u EventAI_Events", Count); 
     1045 
     1046        }else outstring_log("TSCR: WARNING >> Loaded 0 EventAI_Scripts. DB table `EventAI_Scripts` is empty."); 
    10471047 
    10481048        // Gather Script Text  
    1049         result = ScriptDev2DB.PQuery("SELECT `id`, `sound`, `type`, `language`, `text`" 
     1049        result = TScriptDB.PQuery("SELECT `id`, `sound`, `type`, `language`, `text`" 
    10501050            "FROM `script_texts`;"); 
    10511051 
     
    10551055        if(result) 
    10561056        { 
    1057             outstring_log("SD2: Loading Script Text..."); 
     1057            outstring_log("TSCR: Loading Script Text..."); 
    10581058            barGoLink bar(result->GetRowCount()); 
    10591059            uint32 count = 0; 
     
    10741074                { 
    10751075                    if (!GetSoundEntriesStore()->LookupEntry(temp.SoundId)) 
    1076                         error_db_log("SD2: Id %u in table script_texts has soundid %u but sound does not exist.",i,temp.SoundId); 
     1076                        error_db_log("TSCR: Id %u in table script_texts has soundid %u but sound does not exist.",i,temp.SoundId); 
    10771077                } 
    10781078 
    10791079                if(!strlen(temp.Text.c_str())) 
    1080                     error_db_log("SD2: Id %u in table script_texts has no text.", i); 
     1080                    error_db_log("TSCR: Id %u in table script_texts has no text.", i); 
    10811081 
    10821082                Script_TextMap[i] = temp; 
     
    10881088 
    10891089            outstring_log(""); 
    1090             outstring_log("SD2: Loaded %u Script Texts", count); 
    1091  
    1092         }else outstring_log("SD2 WARNING >> Loaded 0 Script Texts. Database table `script_texts` is empty."); 
     1090            outstring_log("TSCR: Loaded %u Script Texts", count); 
     1091 
     1092        }else outstring_log("TSCR WARNING >> Loaded 0 Script Texts. Database table `script_texts` is empty."); 
    10931093 
    10941094        //Free database thread and resources 
    1095         ScriptDev2DB.HaltDelayThread(); 
     1095        TScriptDB.HaltDelayThread(); 
    10961096 
    10971097        //***End DB queries*** 
     
    11201120void ScriptsInit() 
    11211121{ 
    1122     //ScriptDev2 startup 
     1122    //Trinity Script startup  
     1123    outstring_log("|_   _| __(_)_ __ (_) |_ _   _/ ___|  ___ _ __(_)_ __ | |_ "); 
     1124    outstring_log("  | || '__| | '_ \\| | __| | | \\___ \\ / __| \\'__| | \\'_ \\| __|"); 
     1125    outstring_log("  | || |  | | | | | | |_| |_| |___) | (__| |  | | |_) | |_ "); 
     1126    outstring_log("  |_||_|  |_|_| |_|_|\\__|\\__, |____/ \\___|_|  |_| .__/ \\__|"); 
     1127    outstring_log("                         |___/                  |_|        "); 
     1128    outstring_log("Trinity Script initializing %s", _FULLVERSION); 
    11231129    outstring_log(""); 
    1124     outstring_log(" MMM  MMM    MM"); 
    1125     outstring_log("M  MM M  M  M  M"); 
    1126     outstring_log("MM    M   M   M"); 
    1127     outstring_log(" MMM  M   M  M"); 
    1128     outstring_log("   MM M   M MMMM"); 
    1129     outstring_log("MM  M M  M "); 
    1130     outstring_log(" MMM  MMM  http://www.scriptdev2.com"); 
    1131     outstring_log(""); 
    1132  
    1133     outstring_log("ScriptDev2 initializing %s", _FULLVERSION); 
    1134  
    1135     outstring_log(""); 
    11361130 
    11371131    //Get configuration file 
    1138     if (!SD2Config.SetSource(_TRINITY_SCRIPT_CONFIG)) 
    1139         error_log("SD2: Unable to open configuration file, Database will be unaccessible"); 
    1140     else outstring_log("SD2: Using configuration file %s", _TRINITY_SCRIPT_CONFIG); 
     1132    if (!TScriptConfig.SetSource(_TRINITY_SCRIPT_CONFIG)) 
     1133        error_log("TSCR: Unable to open configuration file, Database will be unaccessible"); 
     1134    else outstring_log("TSCR: Using configuration file %s", _TRINITY_SCRIPT_CONFIG); 
    11411135 
    11421136 
    11431137    //Check config file version 
    1144     if (SD2Config.GetIntDefault("ConfVersion", 0) != _TSCRIPTCONFVERSION) 
    1145         error_log("SD2: Configuration file version doesn't match expected version. Some config variables may be wrong or missing."); 
     1138    if (TScriptConfig.GetIntDefault("ConfVersion", 0) != _TSCRIPTCONFVERSION) 
     1139        error_log("TSCR: Configuration file version doesn't match expected version. Some config variables may be wrong or missing."); 
    11461140 
    11471141    //Locale 
    1148     Locale = SD2Config.GetIntDefault("Locale", 0); 
     1142    Locale = TScriptConfig.GetIntDefault("Locale", 0); 
    11491143 
    11501144    if (Locale > 8) 
    11511145    { 
    11521146        Locale = 0; 
    1153         error_log("SD2: Locale set to invalid language id. Defaulting to 0."); 
     1147        error_log("TSCR: Locale set to invalid language id. Defaulting to 0."); 
    11541148    } 
    11551149 
    1156     outstring_log("SD2: Using locale %u", Locale); 
     1150    outstring_log("TSCR: Using locale %u", Locale); 
    11571151    outstring_log(""); 
    11581152 
    1159     EAI_ErrorLevel = SD2Config.GetIntDefault("EAIErrorLevel", 1); 
     1153    EAI_ErrorLevel = TScriptConfig.GetIntDefault("EAIErrorLevel", 1); 
    11601154 
    11611155    switch (EAI_ErrorLevel) 
    11621156    { 
    1163     case 0: 
    1164         outstring_log("SD2: EventAI Error Reporting level set to 0 (Startup Errors only)"); 
    1165         break; 
    1166  
    1167     case 1: 
    1168         outstring_log("SD2: EventAI Error Reporting level set to 1 (Startup errors and Runtime event errors)"); 
    1169         break; 
    1170  
    1171     case 2: 
    1172         outstring_log("SD2: EventAI Error Reporting level set to 2 (Startup errors, Runtime event errors, and Creation errors)"); 
    1173         break; 
    1174  
    1175     default: 
    1176         outstring_log("SD2: Unknown EventAI Error Reporting level. Defaulting to 1 (Startup errors and Runtime event errors)"); 
    1177         EAI_ErrorLevel = 1; 
    1178         break; 
     1157        case 0: 
     1158            outstring_log("TSCR: EventAI Error Reporting level set to 0 (Startup Errors only)"); 
     1159            break; 
     1160 
     1161        case 1: 
     1162            outstring_log("TSCR: EventAI Error Reporting level set to 1 (Startup errors and Runtime event errors)"); 
     1163            break; 
     1164 
     1165        case 2: 
     1166            outstring_log("TSCR: EventAI Error Reporting level set to 2 (Startup errors, Runtime event errors, and Creation errors)"); 
     1167            break; 
     1168 
     1169        default: 
     1170            outstring_log("TSCR: Unknown EventAI Error Reporting level. Defaulting to 1 (Startup errors and Runtime event errors)"); 
     1171            EAI_ErrorLevel = 1; 
     1172            break; 
    11791173    } 
    11801174    outstring_log(""); 
    11811175 
    1182     //Load database (must be called after SD2Config.SetSource) 
     1176    //Load database (must be called after TScriptConfig.SetSource) 
    11831177    LoadDatabase(); 
    11841178 
     
    16981692    // ------------------- 
    16991693 
    1700     outstring_log("SD2: Loaded %u C++ Scripts", nrscripts); 
     1694    outstring_log("TSCR: Loaded %u C++ Scripts", nrscripts); 
    17011695    outstring_log(""); 
    17021696} 
     
    17081702{ 
    17091703    if (entry == 0xffffffff) 
    1710         error_log("SD2: Entry = -1, GetEventAILocalizedText should not be called in this case."); 
     1704        error_log("TSCR: Entry = -1, GetEventAILocalizedText should not be called in this case."); 
    17111705 
    17121706    const char* temp = NULL; 
     
    17161710    if (i == EventAI_LocalizedTextMap.end()) 
    17171711    { 
    1718         error_log("SD2: EventAI Localized Text %u not found", entry); 
     1712        error_log("TSCR: EventAI Localized Text %u not found", entry); 
    17191713        return DEFAULT_TEXT; 
    17201714    } 
     
    17691763    if (i == Script_LocalizedTextMap.end()) 
    17701764    { 
    1771         error_log("SD2: Script Localized Text %u not found", entry); 
     1765        error_log("TSCR: Script Localized Text %u not found", entry); 
    17721766        return DEFAULT_TEXT; 
    17731767    } 
     
    18171811{ 
    18181812    if(entry == 0xffffffff) 
    1819         error_log("SD2: Entry = -1, GetEventAIText should not be called in this case."); 
     1813        error_log("TSCR: Entry = -1, GetEventAIText should not be called in this case."); 
    18201814 
    18211815    const char* str = NULL; 
     
    18241818    if(itr == EventAI_Text_Map.end()) 
    18251819    { 
    1826         error_log("SD2 ERROR: Unable to find EventAI Text %u", entry); 
     1820        error_log("TSCR: Unable to find EventAI Text %u", entry); 
    18271821        return DEFAULT_TEXT; 
    18281822    } 
     
    18431837    if (!pSource) 
    18441838    { 
    1845         error_log("SD2: ProcessScriptText invalid Source pointer."); 
     1839        error_log("TSCR: ProcessScriptText invalid Source pointer."); 
    18461840        return; 
    18471841    } 
     
    18511845    if (i == Script_TextMap.end()) 
    18521846    { 
    1853         error_log("SD2: ProcessScriptText could not find id %u.",id); 
     1847        error_log("TSCR: ProcessScriptText could not find id %u.",id); 
    18541848        return; 
    18551849    } 
     
    18651859        } 
    18661860        else 
    1867             error_log("SD2: ProcessScriptText id %u tried to process invalid soundid %u.",id,(*i).second.SoundId); 
     1861            error_log("TSCR: ProcessScriptText id %u tried to process invalid soundid %u.",id,(*i).second.SoundId); 
    18681862    } 
    18691863 
     
    18901884                if (target && target->GetTypeId() == TYPEID_PLAYER) 
    18911885                    pSource->MonsterWhisper((*i).second.Text.c_str(), target->GetGUID()); 
    1892                 else error_log("SD2: ProcessScriptText id %u cannot whisper without target unit (TYPEID_PLAYER).", id); 
     1886                else error_log("TSCR: ProcessScriptText id %u cannot whisper without target unit (TYPEID_PLAYER).", id); 
    18931887            }break; 
    18941888 
     
    18971891                if (target && target->GetTypeId() == TYPEID_PLAYER) 
    18981892                    pSource->MonsterWhisper((*i).second.Text.c_str(), target->GetGUID(), true); 
    1899                 else error_log("SD2: ProcessScriptText id %u cannot whisper without target unit (TYPEID_PLAYER).", id); 
     1893                else error_log("TSCR: ProcessScriptText id %u cannot whisper without target unit (TYPEID_PLAYER).", id); 
    19001894            }break; 
    19011895    } 
     
    19311925bool GossipSelect( Player *player, Creature *_Creature, uint32 sender, uint32 action ) 
    19321926{ 
    1933     debug_log("SD2: Gossip selection, sender: %d, action: %d",sender, action); 
     1927    debug_log("TSCR: Gossip selection, sender: %d, action: %d",sender, action); 
    19341928 
    19351929    Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); 
     
    19431937bool GossipSelectWithCode( Player *player, Creature *_Creature, uint32 sender, uint32 action, const char* sCode ) 
    19441938{ 
    1945     debug_log("SD2: Gossip selection with code, sender: %d, action: %d",sender, action); 
     1939    debug_log("TSCR: Gossip selection with code, sender: %d, action: %d",sender, action); 
    19461940 
    19471941    Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); 
  • trunk/src/bindings/scripts/ScriptMgr.h

    r2 r5  
    2727#define VISIBLE_RANGE   (166.0f) 
    2828 
    29 #define DEFAULT_TEXT    "<ScriptDev2 Text Entry Missing!>" 
     29#define DEFAULT_TEXT    "<Trinity Script Text Entry Missing!>" 
    3030 
    3131// 
  • trunk/src/bindings/scripts/sql/create_database.sql

    r2 r5  
    1 CREATE DATABASE `scriptdev2` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; 
     1CREATE DATABASE `trinityscript` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; 
    22 
    3 GRANT ALL PRIVILEGES ON `scriptdev2` . * TO 'mangos'@'localhost' WITH GRANT OPTION; 
    4  
     3GRANT ALL PRIVILEGES ON `trinityscript` . * TO 'trinity'@'localhost' WITH GRANT OPTION; 
  • trunk/src/bindings/scripts/sql/scriptdev2_structure.sql

    r2 r5  
    100100 
    101101 
    102 DROP TABLE IF EXISTS `sd2_db_version`; 
    103 CREATE TABLE `sd2_db_version` ( 
    104 `version` varchar(255) NOT NULL default '' COMMENT 'Database version string' 
     102DROP TABLE IF EXISTS `script_db_version`; 
     103CREATE TABLE `script_db_version` ( 
     104`version` varchar(255) NOT NULL default '' COMMENT 'Script Database version string' 
    105105) ENGINE=MyISAM DEFAULT CHARSET=utf8; 
  • trunk/src/bindings/scripts/trinityscript.conf.dist

    r2 r5  
    1 # ScriptDev2 Configuration file 
    2 # This file must be placed within the directory which holds mangosd.conf and realmd.conf 
     1# TrinityScript Configuration file 
     2# This file must be placed within the directory which holds TrinityCore.conf and TrinityRealm.conf 
    33ConfVersion=2008100201 
    44 
     
    99#          .;/path/to/unix_socket;username;password;database - use Unix sockets at Unix/Linux 
    1010#                Unix sockets: experimental, not tested 
    11 ScriptDev2DatabaseInfo     = "127.0.0.1;3306;mangos;mangos;scriptdev2" 
     11TScriptDatabaseInfo = "127.0.0.1;3306;trinity;trinity;trinityscript" 
    1212 
    1313# Setting for current locale to use