Changeset 109

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

[svn] Update trinityscript to SD2 rev 700. Source: scriptdev2. Patch provided by SLG.

Original author: megamage
Date: 2008-10-25 11:40:10-05:00

Location:
trunk
Files:
1 added
49 modified

Legend:

Unmodified
Added
Removed
  • trunk/sql/world.sql

    r97 r109  
    570570  `content_loc8` text, 
    571571  `sound` mediumint(8) unsigned NOT NULL default '0', 
    572   `type` tinyint(3) unsigned NOT NULL default '0', 
    573   `language` tinyint(3) unsigned NOT NULL default '0', 
     572  `type` tinyint unsigned NOT NULL default '0', 
     573  `language` tinyint unsigned NOT NULL default '0', 
    574574  `comment` text, 
    575   PRIMARY KEY  (`entry`) 
     575  PRIMARY KEY (`entry`) 
    576576) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Custom Texts'; 
    577577 
     
    691691DROP TABLE IF EXISTS `eventai_scripts`; 
    692692CREATE TABLE `eventai_scripts` ( 
    693   `id` int(11) unsigned NOT NULL auto_increment COMMENT 'Identifier', 
     693  `id` int(11) unsigned NOT NULL COMMENT 'Identifier' AUTO_INCREMENT, 
    694694  `creature_id` int(11) unsigned NOT NULL default '0' COMMENT 'Creature Template Identifier', 
    695695  `event_type` tinyint(5) unsigned NOT NULL default '0' COMMENT 'Event Type', 
    696   `event_inverse_phase_mask` int(11) NOT NULL default '0' COMMENT 'Mask which phases this event will not trigger in', 
     696  `event_inverse_phase_mask` int(11) signed NOT NULL default '0' COMMENT 'Mask which phases this event will not trigger in', 
    697697  `event_chance` int(3) unsigned NOT NULL default '100', 
    698698  `event_flags` int(3) unsigned NOT NULL default '0', 
    699   `event_param1` int(11) NOT NULL default '0', 
    700   `event_param2` int(11) NOT NULL default '0', 
    701   `event_param3` int(11) NOT NULL default '0', 
    702   `event_param4` int(11) NOT NULL default '0', 
     699  `event_param1` int(11) signed NOT NULL default '0', 
     700  `event_param2` int(11) signed NOT NULL default '0', 
     701  `event_param3` int(11) signed NOT NULL default '0', 
     702  `event_param4` int(11) signed NOT NULL default '0', 
    703703  `action1_type` tinyint(5) unsigned NOT NULL default '0' COMMENT 'Action Type', 
    704   `action1_param1` int(11) NOT NULL default '0', 
    705   `action1_param2` int(11) NOT NULL default '0', 
    706   `action1_param3` int(11) NOT NULL default '0', 
     704  `action1_param1` int(11) signed NOT NULL default '0', 
     705  `action1_param2` int(11) signed NOT NULL default '0', 
     706  `action1_param3` int(11) signed NOT NULL default '0', 
    707707  `action2_type` tinyint(5) unsigned NOT NULL default '0' COMMENT 'Action Type', 
    708   `action2_param1` int(11) NOT NULL default '0', 
    709   `action2_param2` int(11) NOT NULL default '0', 
    710   `action2_param3` int(11) NOT NULL default '0', 
     708  `action2_param1` int(11) signed NOT NULL default '0', 
     709  `action2_param2` int(11) signed NOT NULL default '0', 
     710  `action2_param3` int(11) signed NOT NULL default '0', 
    711711  `action3_type` tinyint(5) unsigned NOT NULL default '0' COMMENT 'Action Type', 
    712   `action3_param1` int(11) NOT NULL default '0', 
    713   `action3_param2` int(11) NOT NULL default '0', 
    714   `action3_param3` int(11) NOT NULL default '0', 
     712  `action3_param1` int(11) signed NOT NULL default '0', 
     713  `action3_param2` int(11) signed NOT NULL default '0', 
     714  `action3_param3` int(11) signed NOT NULL default '0', 
    715715  `comment` varchar(255) NOT NULL default '' COMMENT 'Event Comment', 
    716   PRIMARY KEY  (`id`) 
     716  PRIMARY KEY (`id`) 
    717717) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='EventAI Scripts'; 
    718718 
     
    732732DROP TABLE IF EXISTS `eventai_summons`; 
    733733CREATE TABLE `eventai_summons` ( 
    734   `id` int(11) unsigned NOT NULL auto_increment COMMENT 'Location Identifier', 
     734  `id` int(11) unsigned NOT NULL COMMENT 'Location Identifier' AUTO_INCREMENT, 
    735735  `position_x` float NOT NULL default '0', 
    736736  `position_y` float NOT NULL default '0', 
     
    739739  `spawntimesecs` int(11) unsigned NOT NULL default '120', 
    740740  `comment` varchar(255) NOT NULL default '' COMMENT 'Summon Comment', 
    741   PRIMARY KEY  (`id`) 
     741  PRIMARY KEY (`id`) 
    742742) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='EventAI Summoning Locations'; 
    743743 
     
    757757DROP TABLE IF EXISTS `eventai_texts`; 
    758758CREATE TABLE `eventai_texts` ( 
    759   `id` int(11) unsigned NOT NULL default '0' COMMENT 'Identifier', 
    760   `text` varchar(255) NOT NULL default '', 
    761   `comment` varchar(255) NOT NULL default '' COMMENT 'Text Comment', 
    762   PRIMARY KEY  (`id`) 
    763 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Texts used in EventAI'; 
     759  `entry` mediumint(8) NOT NULL, 
     760  `content_default` text NOT NULL, 
     761  `content_loc1` text, 
     762  `content_loc2` text, 
     763  `content_loc3` text, 
     764  `content_loc4` text, 
     765  `content_loc5` text, 
     766  `content_loc6` text, 
     767  `content_loc7` text, 
     768  `content_loc8` text, 
     769  `sound` mediumint(8) unsigned NOT NULL default '0', 
     770  `type` tinyint unsigned NOT NULL default '0', 
     771  `language` tinyint unsigned NOT NULL default '0', 
     772  `comment` text, 
     773  PRIMARY KEY (`entry`) 
     774) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Script Texts'; 
    764775 
    765776-- 
     
    770781/*!40000 ALTER TABLE `eventai_texts` DISABLE KEYS */; 
    771782/*!40000 ALTER TABLE `eventai_texts` ENABLE KEYS */; 
     783UNLOCK TABLES; 
     784 
     785-- 
     786-- Table structure for table `script_texts` 
     787-- 
     788 
     789DROP TABLE IF EXISTS `script_texts`; 
     790CREATE TABLE `script_texts` ( 
     791  `entry` mediumint(8) NOT NULL, 
     792  `content_default` text NOT NULL, 
     793  `content_loc1` text, 
     794  `content_loc2` text, 
     795  `content_loc3` text, 
     796  `content_loc4` text, 
     797  `content_loc5` text, 
     798  `content_loc6` text, 
     799  `content_loc7` text, 
     800  `content_loc8` text, 
     801  `sound` mediumint(8) unsigned NOT NULL default '0', 
     802  `type` tinyint unsigned NOT NULL default '0', 
     803  `language` tinyint unsigned NOT NULL default '0', 
     804  `comment` text, 
     805  PRIMARY KEY  (`entry`) 
     806) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Script Texts'; 
     807 
     808-- 
     809-- Dumping data for table `script_texts` 
     810-- 
     811 
     812LOCK TABLES `eventai_texts` WRITE; 
     813/*!40000 ALTER TABLE `script_texts` DISABLE KEYS */; 
     814/*!40000 ALTER TABLE `script_texts` ENABLE KEYS */; 
    772815UNLOCK TABLES; 
    773816 
  • trunk/src/bindings/scripts/ScriptMgr.cpp

    r105 r109  
    2323DatabaseType TScriptDB; 
    2424Config TScriptConfig; 
    25 uint32 Locale; 
    2625 
    2726// String text additional data, used in TextMap 
     
    4443}; 
    4544 
    46 #define TEXT_SOURCE_RANGE   -100000                         //the amount of entries each text source has available 
     45#define TEXT_SOURCE_RANGE   -1000000                        //the amount of entries each text source has available 
    4746 
    4847// Text Maps 
    49 HM_NAMESPACE::hash_map<uint32, std::string> EventAI_Text_Map; 
    5048HM_NAMESPACE::hash_map<int32, StringTextData> TextMap; 
    5149 
    52 // Localized Text structure for storing locales (for EAI and SD2 scripts). 
    53 struct Localized_Text 
    54 { 
    55     std::string locale_1; 
    56     std::string locale_2; 
    57     std::string locale_3; 
    58     std::string locale_4; 
    59     std::string locale_5; 
    60     std::string locale_6; 
    61     std::string locale_7; 
    62     std::string locale_8; 
    63 }; 
     50 
    6451//*** End Global data *** 
    6552 
    6653//*** EventAI data *** 
    67 HM_NAMESPACE::hash_map<uint32, Localized_Text> EventAI_LocalizedTextMap; 
    68  
    6954//Event AI structure. Used exclusivly by mob_event_ai.cpp (60 bytes each) 
    7055std::list<EventAI_Event> EventAI_Event_List; 
     
    605590    char const* dbstring = NULL; 
    606591 
    607     if( !TScriptConfig.GetString("WorldDatabaseInfo", &dbstring) ) 
     592    if (!TScriptConfig.GetString("WorldDatabaseInfo", &dbstring) ) 
    608593    { 
    609594        error_log("TSCR: Missing world database info from configuration file. Load database aborted."); 
     
    612597 
    613598    //Initialize connection to DB 
    614     if( dbstring && TScriptDB.Initialize(dbstring) ) 
     599    if (dbstring && TScriptDB.Initialize(dbstring) ) 
    615600        outstring_log("TSCR: TrinityScript database: %s",dbstring); 
    616601    else 
     
    642627    TextMap.clear(); 
    643628 
    644     //TODO: Add load from eventai_texts here 
    645  
    646     // Load Script Text  
    647     outstring_log("TSCR: Loading Script Texts..."); 
    648     LoadTrinityStrings(TScriptDB,"script_texts",TEXT_SOURCE_RANGE,(TEXT_SOURCE_RANGE*2)+1); 
    649  
    650     // Gather Additional data from Script Texts 
    651     result = TScriptDB.PQuery("SELECT entry, sound, type, language FROM script_texts"); 
    652  
    653     outstring_log("TSCR: Loading Script Texts additional data..."); 
     629    // Load EventAI Text  
     630    outstring_log("TSCR: Loading EventAI Texts..."); 
     631    LoadTrinityStrings(TScriptDB,"eventai_texts",-1,1+(TEXT_SOURCE_RANGE)); 
     632 
     633    // Gather Additional data from EventAI Texts 
     634    result = TScriptDB.PQuery("SELECT entry, sound, type, language FROM eventai_texts"); 
     635 
     636    outstring_log("TSCR: Loading EventAI Texts additional data..."); 
    654637    if (result) 
    655638    { 
     
    670653            if (i >= 0) 
    671654            { 
     655                error_db_log("TSCR: Entry %i in table `eventai_texts` is not a negative value.",i); 
     656                continue; 
     657            } 
     658 
     659            if (i <= TEXT_SOURCE_RANGE) 
     660            { 
     661                error_db_log("TSCR: Entry %i in table `eventai_texts` is out of accepted entry range for table.",i); 
     662                continue; 
     663            } 
     664 
     665            if (temp.SoundId) 
     666            { 
     667                if (!GetSoundEntriesStore()->LookupEntry(temp.SoundId)) 
     668                    error_db_log("TSCR: Entry %i in table `eventai_texts` has soundId %u but sound does not exist.",i,temp.SoundId); 
     669            } 
     670 
     671            if (!GetLanguageDescByID(temp.Language)) 
     672                error_db_log("TSCR: Entry %i in table `eventai_texts` using Language %u but Language does not exist.",i,temp.Language); 
     673 
     674            if (temp.Type > CHAT_TYPE_BOSS_WHISPER) 
     675                error_db_log("TSCR: Entry %i in table `eventai_texts` has Type %u but this Chat Type does not exist.",i,temp.Type); 
     676 
     677            TextMap[i] = temp; 
     678            ++count; 
     679        } while (result->NextRow()); 
     680 
     681        delete result; 
     682 
     683        outstring_log(""); 
     684        outstring_log(">> TSCR: Loaded %u additional EventAI Texts data.", count); 
     685    }else 
     686    { 
     687        barGoLink bar(1); 
     688        bar.step(); 
     689        outstring_log(""); 
     690        outstring_log(">> Loaded 0 additional EventAI Texts data. DB table `eventai_texts` is empty."); 
     691    } 
     692 
     693    // Load Script Text  
     694    outstring_log("TSCR: Loading Script Texts..."); 
     695    LoadTrinityStrings(TScriptDB,"script_texts",TEXT_SOURCE_RANGE,1+(TEXT_SOURCE_RANGE*2)); 
     696 
     697    // Gather Additional data from Script Texts 
     698    result = TScriptDB.PQuery("SELECT entry, sound, type, language FROM script_texts"); 
     699 
     700    outstring_log("TSCR: Loading Script Texts additional data..."); 
     701    if (result) 
     702    { 
     703        barGoLink bar(result->GetRowCount()); 
     704        uint32 count = 0; 
     705 
     706        do 
     707        { 
     708            bar.step(); 
     709            Field* fields = result->Fetch(); 
     710            StringTextData temp; 
     711 
     712            int32 i             = fields[0].GetInt32(); 
     713            temp.SoundId        = fields[1].GetInt32(); 
     714            temp.Type           = fields[2].GetInt32(); 
     715            temp.Language       = fields[3].GetInt32(); 
     716 
     717            if (i >= 0) 
     718            { 
    672719                error_db_log("TSCR: Entry %i in table `script_texts` is not a negative value.",i); 
    673720                continue; 
     
    710757    // Load Custom Text  
    711758    outstring_log("TSCR: Loading Custom Texts..."); 
    712     LoadTrinityStrings(TScriptDB,"custom_texts",TEXT_SOURCE_RANGE*2,(TEXT_SOURCE_RANGE*3)+1); 
     759    LoadTrinityStrings(TScriptDB,"custom_texts",TEXT_SOURCE_RANGE*2,1+(TEXT_SOURCE_RANGE*3)); 
    713760 
    714761    // Gather Additional data from Custom Texts 
     
    772819    } 
    773820 
    774     // Drop existing Event AI Localized Text hash map 
    775     EventAI_LocalizedTextMap.clear(); 
    776  
    777     // Gather EventAI Localized Texts 
    778     result = TScriptDB.PQuery("SELECT id, locale_1, locale_2, locale_3, locale_4, locale_5, locale_6, locale_7, locale_8 " 
    779         "FROM eventai_localized_texts"); 
    780  
    781     outstring_log("TSCR: Loading EventAI Localized Texts..."); 
    782     if(result) 
    783     { 
    784         barGoLink bar(result->GetRowCount()); 
    785         uint32 count = 0; 
    786  
    787         do 
    788         { 
    789             Localized_Text temp; 
    790             bar.step(); 
    791  
    792             Field *fields = result->Fetch(); 
    793  
    794             uint32 i = fields[0].GetInt32(); 
    795  
    796             temp.locale_1 = fields[1].GetString(); 
    797             temp.locale_2 = fields[2].GetString(); 
    798             temp.locale_3 = fields[3].GetString(); 
    799             temp.locale_4 = fields[4].GetString(); 
    800             temp.locale_5 = fields[5].GetString(); 
    801             temp.locale_6 = fields[6].GetString(); 
    802             temp.locale_7 = fields[7].GetString(); 
    803             temp.locale_8 = fields[8].GetString(); 
    804  
    805             EventAI_LocalizedTextMap[i] = temp; 
    806             ++count; 
    807  
    808         }while(result->NextRow()); 
    809  
    810         delete result; 
    811  
    812         outstring_log(""); 
    813         outstring_log(">> Loaded %u EventAI Localized Texts", count); 
    814     }else 
    815     { 
    816         barGoLink bar(1); 
    817         bar.step(); 
    818         outstring_log(""); 
    819         outstring_log(">> Loaded 0 EventAI Localized Texts. DB table `eventai_localized_texts` is empty"); 
    820     } 
    821  
    822     //Drop existing EventAI Text hash map 
    823     EventAI_Text_Map.clear(); 
    824  
    825     //Gather EventAI Text Entries 
    826     result = TScriptDB.PQuery("SELECT id, text FROM eventai_texts"); 
    827  
    828     outstring_log("TSCR: Loading EventAI_Texts..."); 
    829     if (result) 
    830     { 
    831         barGoLink bar(result->GetRowCount()); 
    832         uint32 Count = 0; 
    833  
    834         do 
    835         { 
    836             bar.step(); 
    837             Field *fields = result->Fetch(); 
    838  
    839             uint32 i = fields[0].GetInt32(); 
    840  
    841             std::string text = fields[1].GetString(); 
    842  
    843             if (!strlen(text.c_str())) 
    844                 error_db_log("TSCR: EventAI text %u is empty", i); 
    845  
    846             EventAI_Text_Map[i] = text; 
    847             ++Count; 
    848  
    849         }while (result->NextRow()); 
    850  
    851         delete result; 
    852  
    853         outstring_log(""); 
    854         outstring_log(">> Loaded %u EventAI texts", Count); 
    855     }else 
    856     { 
    857         barGoLink bar(1); 
    858         bar.step(); 
    859         outstring_log(""); 
    860         outstring_log(">> Loaded 0 EventAI texts. DB table `eventai_texts` is empty."); 
    861     } 
    862  
    863     //Gather event data 
     821    //Gather additional data for EventAI 
    864822    result = TScriptDB.PQuery("SELECT id, position_x, position_y, position_z, orientation, spawntimesecs FROM eventai_summons"); 
    865823 
     
    867825    EventAI_Summon_Map.clear(); 
    868826 
    869     outstring_log("TSCR: Loading EventAI_Summons..."); 
     827    outstring_log("TSCR: Loading EventAI Summons..."); 
    870828    if (result) 
    871829    { 
     
    915873    EventAI_Event_List.clear(); 
    916874 
    917     outstring_log("TSCR: Loading EventAI_Scripts..."); 
     875    outstring_log("TSCR: Loading EventAI scripts..."); 
    918876    if (result) 
    919877    { 
     
    10551013                switch (temp.action[j].type) 
    10561014                { 
    1057                     case ACTION_T_SAY: 
    1058                     case ACTION_T_YELL: 
    1059                     case ACTION_T_TEXTEMOTE: 
    1060                         if (GetEventAIText(temp.action[j].param1) == DEFAULT_TEXT) 
    1061                             error_db_log("TSCR: Event %u Action %u refrences missing Localized_Text entry", i, j+1); 
     1015                    case ACTION_T_TEXT: 
     1016                        { 
     1017                            if (temp.action[j].param1_s < 0) 
     1018                            { 
     1019                                if (TextMap.find(temp.action[j].param1_s) == TextMap.end()) 
     1020                                    error_db_log("TSCR: Event %u Action %u param1 refrences non-existing entry in texts table.", i, j+1); 
     1021                            } 
     1022                            if (temp.action[j].param2_s < 0) 
     1023                            { 
     1024                                if (TextMap.find(temp.action[j].param2_s) == TextMap.end()) 
     1025                                    error_db_log("TSCR: Event %u Action %u param2 refrences non-existing entry in texts table.", i, j+1); 
     1026 
     1027                                if (!temp.action[j].param1_s) 
     1028                                    error_db_log("TSCR: Event %u Action %u has param2, but param1 is not set. Required for randomized text.", i, j+1); 
     1029                            } 
     1030                            if (temp.action[j].param3_s < 0) 
     1031                            { 
     1032                                if (TextMap.find(temp.action[j].param3_s) == TextMap.end()) 
     1033                                    error_db_log("TSCR: Event %u Action %u param3 refrences non-existing entry in texts table.", i, j+1); 
     1034 
     1035                                if (!temp.action[j].param1_s || !temp.action[j].param2_s) 
     1036                                    error_db_log("TSCR: Event %u Action %u has param3, but param1 and/or param2 is not set. Required for randomized text.", i, j+1); 
     1037                            } 
     1038                        } 
    10621039                        break; 
    10631040 
     
    10671044                        break; 
    10681045 
    1069                     case ACTION_T_RANDOM_SAY: 
    1070                     case ACTION_T_RANDOM_YELL: 
    1071                     case ACTION_T_RANDOM_TEXTEMOTE: 
    1072                         if ((temp.action[j].param1 != 0xffffffff && GetEventAIText(temp.action[j].param1) == DEFAULT_TEXT) || 
    1073                             (temp.action[j].param2 != 0xffffffff && GetEventAIText(temp.action[j].param2) == DEFAULT_TEXT) || 
    1074                             (temp.action[j].param3 != 0xffffffff && GetEventAIText(temp.action[j].param3) == DEFAULT_TEXT)) 
    1075                             error_db_log("TSCR: Event %u Action %u refrences missing Localized_Text entry", i, j+1); 
    1076                         break; 
     1046                    /*case ACTION_T_RANDOM_SOUND: 
     1047                        { 
     1048                            if(!GetSoundEntriesStore()->LookupEntry(temp.action[j].param1)) 
     1049                                error_db_log("TSCR: Event %u Action %u param1 uses non-existant SoundID %u.", i, j+1, temp.action[j].param1); 
     1050                            if(!GetSoundEntriesStore()->LookupEntry(temp.action[j].param2)) 
     1051                                error_db_log("TSCR: Event %u Action %u param2 uses non-existant SoundID %u.", i, j+1, temp.action[j].param2); 
     1052                            if(!GetSoundEntriesStore()->LookupEntry(temp.action[j].param3)) 
     1053                                error_db_log("TSCR: Event %u Action %u param3 uses non-existant SoundID %u.", i, j+1, temp.action[j].param3); 
     1054                        } 
     1055                        break;*/ 
    10771056 
    10781057                    case ACTION_T_CAST: 
     
    11531132                        break; 
    11541133 
     1134                    case ACTION_T_YELL: 
     1135                    case ACTION_T_TEXTEMOTE: 
     1136                    case ACTION_T_RANDOM_SAY: 
     1137                    case ACTION_T_RANDOM_YELL: 
     1138                    case ACTION_T_RANDOM_TEXTEMOTE: 
     1139                        error_db_log("TSCR: Event %u Action %u currently unused ACTION type. Did you forget to update database?", i, j+1); 
     1140                        break; 
     1141 
    11551142                    default: 
    11561143                        if (temp.action[j].type >= ACTION_T_END) 
     
    12231210    else outstring_log("TSCR: Using configuration file %s",_TRINITY_SCRIPT_CONFIG); 
    12241211 
    1225     //Locale 
    1226     Locale = TScriptConfig.GetIntDefault("Locale", 0); 
    1227  
    1228     if (Locale > 8) 
    1229     { 
    1230         Locale = 0; 
    1231         error_log("TSCR: Locale set to invalid language id. Defaulting to 0."); 
    1232     } 
    1233  
    1234     outstring_log("TSCR: Using locale %u", Locale); 
    1235  
    12361212    EAI_ErrorLevel = TScriptConfig.GetIntDefault("EAIErrorLevel", 1); 
    12371213 
    12381214    switch (EAI_ErrorLevel) 
    12391215    { 
    1240     case 0: 
    1241         outstring_log("TSCR: EventAI Error Reporting level set to 0 (Startup Errors only)"); 
    1242         break; 
    1243     case 1: 
    1244         outstring_log("TSCR: EventAI Error Reporting level set to 1 (Startup errors and Runtime event errors)"); 
    1245         break; 
    1246     case 2: 
    1247         outstring_log("TSCR: EventAI Error Reporting level set to 2 (Startup errors, Runtime event errors, and Creation errors)"); 
    1248         break; 
    1249     default: 
    1250         outstring_log("TSCR: Unknown EventAI Error Reporting level. Defaulting to 1 (Startup errors and Runtime event errors)"); 
    1251         EAI_ErrorLevel = 1; 
    1252         break; 
     1216        case 0: 
     1217            outstring_log("TSCR: EventAI Error Reporting level set to 0 (Startup Errors only)"); 
     1218            break; 
     1219        case 1: 
     1220            outstring_log("TSCR: EventAI Error Reporting level set to 1 (Startup errors and Runtime event errors)"); 
     1221            break; 
     1222        case 2: 
     1223            outstring_log("TSCR: EventAI Error Reporting level set to 2 (Startup errors, Runtime event errors, and Creation errors)"); 
     1224            break; 
     1225        default: 
     1226            outstring_log("TSCR: Unknown EventAI Error Reporting level. Defaulting to 1 (Startup errors and Runtime event errors)"); 
     1227            EAI_ErrorLevel = 1; 
     1228            break; 
    12531229    } 
    12541230 
     
    17951771 
    17961772//********************************* 
    1797 //*** Functions used internally *** 
    1798  
    1799 const char* GetEventAILocalizedText(uint32 entry) 
    1800 { 
    1801     if (entry == 0xffffffff) 
    1802         error_log("TSCR: Entry = -1, GetEventAILocalizedText should not be called in this case."); 
    1803  
    1804     const char* temp = NULL; 
    1805  
    1806     HM_NAMESPACE::hash_map<uint32, Localized_Text>::iterator i = EventAI_LocalizedTextMap.find(entry); 
    1807  
    1808     if (i == EventAI_LocalizedTextMap.end()) 
    1809     { 
    1810         error_log("TSCR: EventAI Localized Text %u not found", entry); 
    1811         return DEFAULT_TEXT; 
    1812     } 
    1813  
    1814     switch (Locale) 
    1815     { 
    1816         case 1: 
    1817             temp =  (*i).second.locale_1.c_str(); 
    1818             break; 
    1819  
    1820         case 2: 
    1821             temp =  (*i).second.locale_2.c_str(); 
    1822             break; 
    1823  
    1824         case 3: 
    1825             temp =  (*i).second.locale_3.c_str(); 
    1826             break; 
    1827  
    1828         case 4: 
    1829             temp =  (*i).second.locale_4.c_str(); 
    1830             break; 
    1831  
    1832         case 5: 
    1833             temp =  (*i).second.locale_5.c_str(); 
    1834             break; 
    1835  
    1836         case 6: 
    1837             temp =  (*i).second.locale_6.c_str(); 
    1838             break; 
    1839  
    1840         case 7: 
    1841             temp =  (*i).second.locale_7.c_str(); 
    1842             break; 
    1843  
    1844         case 8: 
    1845             temp =  (*i).second.locale_8.c_str(); 
    1846             break; 
    1847     }; 
    1848  
    1849     if (strlen(temp)) 
    1850         return temp; 
    1851  
    1852     return DEFAULT_TEXT; 
    1853 } 
    1854  
    1855 const char* GetEventAIText(uint32 entry) 
    1856 { 
    1857     if(entry == 0xffffffff) 
    1858         error_log("TSCR: Entry = -1, GetEventAIText should not be called in this case."); 
    1859  
    1860     const char* str = NULL; 
    1861  
    1862     HM_NAMESPACE::hash_map<uint32, std::string>::iterator itr = EventAI_Text_Map.find(entry); 
    1863     if(itr == EventAI_Text_Map.end()) 
    1864     { 
    1865         error_log("TSCR: Unable to find EventAI Text %u", entry); 
    1866         return DEFAULT_TEXT; 
    1867     } 
    1868  
    1869     str = (*itr).second.c_str(); 
    1870  
    1871     if(strlen(str)) 
    1872         return str; 
    1873  
    1874     if(strlen((*itr).second.c_str())) 
    1875         return (*itr).second.c_str(); 
    1876  
    1877     return DEFAULT_TEXT; 
    1878 } 
     1773//*** Functions used globally *** 
    18791774 
    18801775void DoScriptText(int32 textEntry, WorldObject* pSource, Unit* target) 
     
    18881783    if (textEntry >= 0) 
    18891784    { 
    1890         error_log("TSCR: DoScriptText attempts to process entry %i, but entry must be negative.",textEntry); 
     1785        error_log("TSCR: DoScriptText with source entry %u (TypeId=%u, guid=%u) attempts to process text entry %i, but text entry must be negative.",pSource->GetEntry(),pSource->GetTypeId(),pSource->GetGUIDLow(),textEntry); 
    18911786        return; 
    18921787    } 
     
    18961791    if (i == TextMap.end()) 
    18971792    { 
    1898         error_log("TSCR: DoScriptText could not find text entry %i.",textEntry); 
     1793        error_log("TSCR: DoScriptText with source entry %u (TypeId=%u, guid=%u) could not find text entry %i.",pSource->GetEntry(),pSource->GetTypeId(),pSource->GetGUIDLow(),textEntry); 
    18991794        return; 
    19001795    } 
     1796 
     1797    debug_log("TSCR: DoScriptText: text entry=%i, Sound=%u, Type=%u, Language=%u",textEntry,(*i).second.SoundId,(*i).second.Type,(*i).second.Language); 
    19011798 
    19021799    if((*i).second.SoundId) 
     
    19391836} 
    19401837 
     1838//********************************* 
     1839//*** Functions used internally *** 
     1840 
    19411841Script* GetScriptByName(std::string Name) 
    19421842{ 
    1943     if(Name.empty()) 
     1843    if (Name.empty()) 
    19441844        return NULL; 
    19451845 
    19461846    for(int i=0;i<MAX_SCRIPTS;i++) 
    19471847    { 
    1948         if( m_scripts[i] && m_scripts[i]->Name == Name ) 
     1848        if (m_scripts[i] && m_scripts[i]->Name == Name) 
    19491849            return m_scripts[i]; 
    19501850    } 
     
    19591859{ 
    19601860    Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); 
    1961     if(!tmpscript || !tmpscript->pGossipHello) return false; 
     1861    if (!tmpscript || !tmpscript->pGossipHello) return false; 
    19621862 
    19631863    player->PlayerTalkClass->ClearMenus(); 
     
    19711871 
    19721872    Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); 
    1973     if(!tmpscript || !tmpscript->pGossipSelect) return false; 
     1873    if (!tmpscript || !tmpscript->pGossipSelect) return false; 
    19741874 
    19751875    player->PlayerTalkClass->ClearMenus(); 
     
    19831883 
    19841884    Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); 
    1985     if(!tmpscript || !tmpscript->pGossipSelectWithCode) return false; 
     1885    if (!tmpscript || !tmpscript->pGossipSelectWithCode) return false; 
    19861886 
    19871887    player->PlayerTalkClass->ClearMenus(); 
     
    19931893{ 
    19941894    Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); 
    1995     if(!tmpscript || !tmpscript->pQuestAccept) return false; 
     1895    if (!tmpscript || !tmpscript->pQuestAccept) return false; 
    19961896 
    19971897    player->PlayerTalkClass->ClearMenus(); 
     
    20031903{ 
    20041904    Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); 
    2005     if(!tmpscript || !tmpscript->pQuestSelect) return false; 
     1905    if (!tmpscript || !tmpscript->pQuestSelect) return false; 
    20061906 
    20071907    player->PlayerTalkClass->ClearMenus(); 
     
    20131913{ 
    20141914    Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); 
    2015     if(!tmpscript || !tmpscript->pQuestComplete) return false; 
     1915    if (!tmpscript || !tmpscript->pQuestComplete) return false; 
    20161916 
    20171917    player->PlayerTalkClass->ClearMenus(); 
     
    20231923{ 
    20241924    Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); 
    2025     if(!tmpscript || !tmpscript->pChooseReward) return false; 
     1925    if (!tmpscript || !tmpscript->pChooseReward) return false; 
    20261926 
    20271927    player->PlayerTalkClass->ClearMenus(); 
     
    20331933{ 
    20341934    Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); 
    2035     if(!tmpscript || !tmpscript->pNPCDialogStatus) return 100; 
     1935    if (!tmpscript || !tmpscript->pNPCDialogStatus) return 100; 
    20361936 
    20371937    player->PlayerTalkClass->ClearMenus(); 
     
    20531953{ 
    20541954    Script *tmpscript = GetScriptByName(_Item->GetProto()->ScriptName); 
    2055     if(!tmpscript || !tmpscript->pItemHello) return false; 
     1955    if (!tmpscript || !tmpscript->pItemHello) return false; 
    20561956 
    20571957    player->PlayerTalkClass->ClearMenus(); 
     
    20631963{ 
    20641964    Script *tmpscript = GetScriptByName(_Item->GetProto()->ScriptName); 
    2065     if(!tmpscript || !tmpscript->pItemQuestAccept) return false; 
     1965    if (!tmpscript || !tmpscript->pItemQuestAccept) return false; 
    20661966 
    20671967    player->PlayerTalkClass->ClearMenus(); 
     
    20731973{ 
    20741974    Script *tmpscript = GetScriptByName(_GO->GetGOInfo()->ScriptName); 
    2075     if(!tmpscript || !tmpscript->pGOHello) return false; 
     1975    if (!tmpscript || !tmpscript->pGOHello) return false; 
    20761976 
    20771977    player->PlayerTalkClass->ClearMenus(); 
     
    20831983{ 
    20841984    Script *tmpscript = GetScriptByName(_GO->GetGOInfo()->ScriptName); 
    2085     if(!tmpscript || !tmpscript->pGOQuestAccept) return false; 
     1985    if (!tmpscript || !tmpscript->pGOQuestAccept) return false; 
    20861986 
    20871987    player->PlayerTalkClass->ClearMenus(); 
     
    20931993{ 
    20941994    Script *tmpscript = GetScriptByName(_GO->GetGOInfo()->ScriptName); 
    2095     if(!tmpscript || !tmpscript->pGOChooseReward) return false; 
     1995    if (!tmpscript || !tmpscript->pGOChooseReward) return false; 
    20961996 
    20971997    player->PlayerTalkClass->ClearMenus(); 
     
    21052005 
    21062006    tmpscript = GetScriptByName(GetAreaTriggerScriptNameById(atEntry->id)); 
    2107     if(!tmpscript || !tmpscript->pAreaTrigger) return false; 
     2007    if (!tmpscript || !tmpscript->pAreaTrigger) return false; 
    21082008 
    21092009    return tmpscript->pAreaTrigger(player, atEntry); 
     
    21152015    Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); 
    21162016 
    2117     if(!tmpscript || !tmpscript->GetAI) return NULL; 
     2017    if (!tmpscript || !tmpscript->GetAI) return NULL; 
    21182018    return tmpscript->GetAI(_Creature); 
    21192019} 
     
    21232023{ 
    21242024    Script *tmpscript = GetScriptByName(_Item->GetProto()->ScriptName); 
    2125     if(!tmpscript || !tmpscript->pItemUse) return false; 
     2025    if (!tmpscript || !tmpscript->pItemUse) return false; 
    21262026 
    21272027    return tmpscript->pItemUse(player,_Item,targets); 
     
    21322032{ 
    21332033    Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); 
    2134     if(!tmpscript || !tmpscript->pReceiveEmote) return false; 
     2034    if (!tmpscript || !tmpscript->pReceiveEmote) return false; 
    21352035 
    21362036    return tmpscript->pReceiveEmote(player, _Creature, emote); 
     
    21422042    Script *tmpscript = NULL; 
    21432043 
    2144     if(!map->IsDungeon()) return false; 
     2044    if (!map->IsDungeon()) return false; 
    21452045 
    21462046    tmpscript = GetScriptByName(((InstanceMap*)map)->GetScript()); 
    2147     if(!tmpscript || !tmpscript->GetInstanceData) return false; 
     2047    if (!tmpscript || !tmpscript->GetInstanceData) return false; 
    21482048 
    21492049    return tmpscript->GetInstanceData(map); 
  • trunk/src/bindings/scripts/ScriptMgr.h

    r44 r109  
    6666extern Script *m_scripts[MAX_SCRIPTS]; 
    6767 
    68 // Localized Text function 
    69 const char* GetEventAILocalizedText(uint32 entry); 
    70  
    71 //EventAI text function 
    72 const char* GetEventAIText(uint32 entry);                   // TODO: Locales 
    73  
    7468//Generic scripting text function 
    7569void DoScriptText(int32 textEntry, WorldObject* pSource, Unit* target = NULL); 
  • trunk/src/bindings/scripts/docs/EventAI.txt

    r37 r109  
    8383(#   Internal Name                     Param usage                     Discription) 
    84840    ACTION_T_NONE                     No Action                       Does Nothing 
    85 1    ACTION_T_SAY                      TextId                          Says Text 
    86 2    ACTION_T_YELL                     TextId                          Yells Text 
    87 3    ACTION_T_TEXTEMOTE                TextId                          Text Emotes Text 
     851    ACTION_T_TEXT                     -TextId1, -TextId2, -TextId3    Displays the -TextId as defined. In case -TextId2 and optionally -TextId3, the output will be randomized. Type text are defined in the text table itself(say, yell, whisper, etc) along with other options for the text. All values are required to be negative. 
     862    ACTION_T_YELL                                                     UNUSED 
     873    ACTION_T_TEXTEMOTE                                                UNUSED 
    88884    ACTION_T_SOUND                    SoundId                         Plays Sound 
    89895    ACTION_T_EMOTE                    EmoteId                         Does emote 
    90 6    ACTION_T_RANDOM_SAY               TextId1, TextId2, TextId3       Says random text between 3 params* 
    91 7    ACTION_T_RANDOM_YELL              TextId1, TextId2, TextId3       Yells random text between 3 params* 
    92 8    ACTION_T_RANDOM_TEXTEMOTE         TextId1, TextId2, TextId3       Text Emotes random text between 3 params* 
     906    ACTION_T_RANDOM_SAY                                               UNUSED 
     917    ACTION_T_RANDOM_YELL                                              UNUSED 
     928    ACTION_T_RANDOM_TEXTEMOTE                                         UNUSED 
    93939    ACTION_T_RANDOM_SOUND             SoundId1, SoundId2, SoundId3    Plays random sound between 3 params* 
    949410   ACTION_T_RANDOM_EMOTE             EmoteId1, EmoteId2, EmoteId3    Emotes random emote between 3 params 
     
    312312 
    313313----------------- 
    314 1 = ACTION_T_SAY: 
     3141 = ACTION_T_TEXT: 
    315315----------------- 
    316 Parameter 1: The ID of the text that the NPC should SAY from the Localized_Texts Table.  
    317  
    318 This action is pretty straightforward. When activated, the creature will SAY the specified text (Speech Bubble).  
     316Parameter 1: The entry of the text that the NPC should use from eventai_texts table. Optionally a entry from other tables can be used (such as custom_texts). 
     317             Entry are required to be negative and exist in a *_texts-table. The type text to be displayed are defined in the texts-table itself (Say, Yell, Whisper, Emote Text, Boss Whisper, Boss Emote) 
     318             Other options are also to be defined in the texts-table, such as a sound to be heard with the text and the language used in output (common, dwarvish, etc). 
     319             In case this entry has a localized version of the text, the localized text will be displayed in client that support this locale. 
     320 
     321Parameter 2: Optional. TextId can be defined in addition. The same apply to this as explained above, however eventAI will randomize between the two. 
     322Parameter 3: Optional, if Parameter 2 exist. In this case, eventAI will randomize between three. 
    319323 
    320324------------------ 
    3213252 = ACTION_T_YELL: 
    322326------------------ 
    323 Parameter 1: The ID of the text that the NPC should YELL from the Localized_Texts Table.  
    324  
    325 The creature will YELL the specified text (Red Speech Bubble).  
     327UNUSED       Can be reused to create new action type 
    326328 
    327329----------------------- 
    3283303 = ACTION_T_TEXTEMOTE: 
    329331----------------------- 
    330 Parameter 1: The ID of the text that the NPC should TEXTEMOTE from the Localized_Texts Table.   
    331  
    332 When activated, the creature will do a text emote using the specified text. A text emote is what you would regularly see by using the /em slash command.  
    333 NOTE: The text should be written with the assumption that the creature's name is the first word or words in the sentence (for example, "is doing a text emote" would appear as "XYZ is doing a text emote" for a creature named XYZ).  
     332UNUSED       Can be reused to create new action type 
    334333 
    335334------------------- 
     
    3523516 = ACTION_T_RANDOM_SAY: 
    353352------------------------ 
    354 Parameter 1: The ID of the text that the NPC should SAY from the Localized_Texts Table (Random Choice #1).  
    355 Parameter 2: The ID of the text that the NPC should SAY from the Localized_Texts Table (Random Choice #2).  
    356 Parameter 3: The ID of the text that the NPC should SAY from the Localized_Texts Table (Random Choice #3).  
    357  
    358 Similar to the ACTION_T_SAY action, it will choose at random a text entry to SAY. This action will pick a random entry from the three. 
    359 NOTE: If you want any of the options if selected to do nothing you set that Param to -1 value. Then if selected it will do nothing. 
    360 NOTE: When using Random Select Actions, ALL The Actions using Random in a Single Event (Action 1,2,3) will select the SAME Random Choice when it expires. This can come in handy if you are doing a ACTION_T_RANDOM_YELL for Action1 and then the corresponding sounds for ACTION_T_RANDOM_SOUND in Action2. If it selects Random Choice #2 for the Yell it will Select Random Choice #2 for the sound so you can match them up as required. 
    361 This is commonly used for NPC's who have several different Aggro Say's and you would like one of them selected at random. 
     353UNUSED       Can be reused to create new action type 
    362354 
    363355------------------------- 
    3643567 = ACTION_T_RANDOM_YELL: 
    365357------------------------- 
    366 Parameter 1: The ID of the text that the NPC should YELL from the Localized_Texts Table (Random Choice #1).  
    367 Parameter 2: The ID of the text that the NPC should YELL from the Localized_Texts Table (Random Choice #2).  
    368 Parameter 3: The ID of the text that the NPC should YELL from the Localized_Texts Table (Random Choice #3).  
    369  
    370 Similar to the ACTION_T_YELL action, it will choose at random a text entry to YELL.  
     358UNUSED       Can be reused to create new action type 
    371359 
    372360------------------------------ 
    3733618 = ACTION_T_RANDOM_TEXTEMOTE: 
    374362------------------------------ 
    375 Parameter 1: The ID of the text that the NPC should TEXTEMOTE from the Localized_Texts Table (Random Choice #1).  
    376 Parameter 2: The ID of the text that the NPC should TEXTEMOTE from the Localized_Texts Table (Random Choice #2).  
    377 Parameter 3: The ID of the text that the NPC should TEXTEMOTE from the Localized_Texts Table (Random Choice #3).  
    378  
    379 Similar to the ACTION_T_TEXTEMOTE action, it will choose at random a text entry to TEXTEMOTE.  
     363UNUSED       Can be reused to create new action type 
    380364 
    381365-------------------------- 
  • trunk/src/bindings/scripts/include/sc_creature.cpp

    r106 r109  
    1212// Spell summary for ScriptedAI::SelectSpell 
    1313struct TSpellSummary { 
    14     uint8 Targets;    // set of enum SelectTarget 
    15     uint8 Effects;    // set of enum SelectEffect 
     14    uint8 Targets;                                          // set of enum SelectTarget 
     15    uint8 Effects;                                          // set of enum SelectEffect 
    1616} *SpellSummary; 
    1717 
     
    2626void ScriptedAI::MoveInLineOfSight(Unit *who) 
    2727{ 
    28     if( !m_creature->getVictim() && who->isTargetableForAttack() && ( m_creature->IsHostileTo( who )) && who->isInAccessablePlaceFor(m_creature) ) 
     28    if (!m_creature->getVictim() && who->isTargetableForAttack() && ( m_creature->IsHostileTo( who )) && who->isInAccessablePlaceFor(m_creature)) 
    2929    { 
    3030        if (!m_creature->canFly() && m_creature->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) 
     
    3232 
    3333        float attackRadius = m_creature->GetAttackDistance(who); 
    34         if( m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who) ) 
    35         { 
    36             DoStartAttackAndMovement(who); 
     34        if (m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who)) 
     35        { 
    3736            who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); 
    38  
    39             if (!InCombat) 
    40             { 
    41                 InCombat = true; 
    42                 Aggro(who); 
    43             } 
    44         } 
    45     } 
    46 } 
    47  
    48 void ScriptedAI::AttackStart(Unit* who) 
     37            AttackStart(who); 
     38        } 
     39    } 
     40} 
     41 
     42void ScriptedAI::AttackStart(Unit* who, bool melee) 
    4943{ 
    5044    if (!who) 
    5145        return; 
    5246 
    53     if (who->isTargetableForAttack()) 
    54     { 
    55         //Begin attack 
    56         DoStartAttackAndMovement(who); 
     47    if (m_creature->Attack(who, melee)) 
     48    { 
     49        m_creature->AddThreat(who, 0.0f); 
     50        m_creature->SetInCombatWith(who); 
     51        who->SetInCombatWith(m_creature); 
    5752 
    5853        if (!InCombat) 
     
    6156            Aggro(who); 
    6257        } 
     58 
     59        if(melee) 
     60            DoStartMovement(who); 
     61        else 
     62            DoStartNoMovement(who); 
     63    } 
     64} 
     65 
     66void ScriptedAI::AttackStart(Unit* who) 
     67{ 
     68    if (!who) 
     69        return; 
     70 
     71    if (m_creature->Attack(who, true)) 
     72    { 
     73        m_creature->AddThreat(who, 0.0f); 
     74        m_creature->SetInCombatWith(who); 
     75        who->SetInCombatWith(m_creature); 
     76 
     77        if (!InCombat) 
     78        { 
     79            InCombat = true; 
     80            Aggro(who); 
     81        } 
     82 
     83        DoStartMovement(who); 
    6384    } 
    6485} 
     
    6788{ 
    6889    //Check if we have a current target 
    69     if( m_creature->isAlive() && m_creature->SelectHostilTarget() && m_creature->getVictim()) 
    70     { 
    71         if( m_creature->isAttackReady() ) 
     90    if (m_creature->isAlive() && m_creature->SelectHostilTarget() && m_creature->getVictim()) 
     91    { 
     92        if (m_creature->isAttackReady() ) 
    7293        { 
    7394            //If we are within range melee the target 
    74             if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) 
     95            if (m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) 
    7596            { 
    7697                m_creature->AttackerStateUpdate(m_creature->getVictim()); 
     
    89110    m_creature->LoadCreaturesAddon(); 
    90111 
    91     if( m_creature->isAlive() ) 
     112    if (m_creature->isAlive()) 
    92113        m_creature->GetMotionMaster()->MoveTargetedHome(); 
    93114 
     
    104125} 
    105126 
    106 void ScriptedAI::DoStartAttackAndMovement(Unit* victim, float distance, float angle) 
     127void ScriptedAI::DoStartMovement(Unit* victim, float distance, float angle) 
    107128{ 
    108129    if (!victim) 
    109130        return; 
    110131 
    111     if ( m_creature->Attack(victim, true) ) 
    112     { 
    113         m_creature->GetMotionMaster()->MoveChase(victim, distance, angle); 
    114         m_creature->AddThreat(victim, 0.0f); 
    115     } 
    116 } 
    117  
    118 void ScriptedAI::DoStartAttackNoMovement(Unit* victim) 
     132    m_creature->GetMotionMaster()->MoveChase(victim, distance, angle); 
     133} 
     134 
     135void ScriptedAI::DoStartNoMovement(Unit* victim) 
    119136{ 
    120137    if (!victim) 
    121138        return; 
    122139 
    123     if ( m_creature->Attack(victim, true) ) 
    124     { 
    125         m_creature->AddThreat(victim, 0.0f); 
    126     } 
     140    m_creature->GetMotionMaster()->MoveIdle(); 
     141    m_creature->StopMoving(); 
    127142} 
    128143 
     
    131146{ 
    132147    //Make sure our attack is ready and we aren't currently casting before checking distance 
    133     if( m_creature->isAttackReady() && !m_creature->IsNonMeleeSpellCasted(false)) 
     148    if (m_creature->isAttackReady() && !m_creature->IsNonMeleeSpellCasted(false)) 
    134149    { 
    135150        //If we are within range melee the target 
    136         if( m_creature->IsWithinCombatDist(m_creature->getVictim(), ATTACK_DISTANCE)) 
     151        if (m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) 
    137152        { 
    138153            m_creature->AttackerStateUpdate(m_creature->getVictim()); 
     
    144159void ScriptedAI::DoStopAttack() 
    145160{ 
    146     if( m_creature->getVictim() != NULL ) 
     161    if (m_creature->getVictim() != NULL) 
    147162    { 
    148163        m_creature->AttackStop(); 
     
    170185void ScriptedAI::DoSay(const char* text, uint32 language, Unit* target) 
    171186{ 
    172     if (target)m_creature->Say(text, language, target->GetGUID()); 
     187    if (target) m_creature->Say(text, language, target->GetGUID()); 
    173188    else m_creature->Say(text, language, 0); 
    174189} 
     
    176191void ScriptedAI::DoYell(const char* text, uint32 language, Unit* target) 
    177192{ 
    178     if (target)m_creature->Yell(text, language, target->GetGUID()); 
     193    if (target) m_creature->Yell(text, language, target->GetGUID()); 
    179194    else m_creature->Yell(text, language, 0); 
    180195} 
     
    182197void ScriptedAI::DoTextEmote(const char* text, Unit* target, bool IsBossEmote) 
    183198{ 
    184     if (target)m_creature->TextEmote(text, target->GetGUID(), IsBossEmote); 
     199    if (target) m_creature->TextEmote(text, target->GetGUID(), IsBossEmote); 
    185200    else m_creature->TextEmote(text, 0, IsBossEmote); 
    186201} 
     
    205220    } 
    206221 
    207     unit->SendPlaySound(sound, false); 
     222    WorldPacket data(4); 
     223    data.SetOpcode(SMSG_PLAY_SOUND); 
     224    data << uint32(sound); 
     225    unit->SendMessageToSet(&data,false); 
    208226} 
    209227 
     
    462480    { 
    463481        error_log("SD2: DoZoneInCombat called for creature that either cannot have threat list or has empty threat list (pUnit entry = %d)", pUnit->GetTypeId() == TYPEID_UNIT ? ((Creature*)pUnit)->GetEntry() : 0); 
     482 
    464483        return; 
    465484    }*/ 
     
    580599        if( m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who) ) 
    581600        { 
    582             DoStartAttackNoMovement(who); 
    583601            who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); 
    584  
    585             if (!InCombat) 
    586             { 
    587                 InCombat = true; 
    588                 Aggro(who); 
    589             } 
     602            AttackStart(who); 
    590603        } 
    591604    } 
     
    597610        return; 
    598611 
    599     if (who->isTargetableForAttack()) 
    600     { 
    601         //Begin attack 
    602         DoStartAttackNoMovement(who); 
     612    if (m_creature->Attack(who, true)) 
     613    { 
     614        m_creature->AddThreat(who, 0.0f); 
     615        m_creature->SetInCombatWith(who); 
     616        who->SetInCombatWith(m_creature); 
    603617 
    604618        if (!InCombat) 
     
    607621            Aggro(who); 
    608622        } 
    609     } 
    610 } 
     623 
     624        DoStartNoMovement(who); 
     625    } 
     626} 
  • trunk/src/bindings/scripts/include/sc_creature.h

    r55 r109  
    2626    //Called at each attack of m_creature by any victim 
    2727    void AttackStart(Unit *); 
     28    void AttackStart(Unit *, bool melee); 
    2829 
    2930    //Called at stoping attack by any attacker 
     
    9091    //************* 
    9192 
    92     //Start attack of victim and go to him 
    93     void DoStartAttackAndMovement(Unit* victim, float distance = 0, float angle = 0); 
     93    //Start movement toward victim 
     94    void DoStartMovement(Unit* victim, float distance = 0, float angle = 0); 
    9495 
    95     //Start attack on victim but do not move 
    96     void DoStartAttackNoMovement(Unit* victim); 
     96    //Start no movement on victim 
     97    void DoStartNoMovement(Unit* victim); 
    9798 
    9899    //Do melee swing of current victim if in rnage and ready and not casting 
  • trunk/src/bindings/scripts/scripts/creature/mob_event_ai.cpp

    r90 r109  
    524524        switch (type) 
    525525        { 
    526         case ACTION_T_SAY: 
    527             DoSay(GetEventAIText(param1), LANG_UNIVERSAL, pActionInvoker ? pActionInvoker : m_creature->getVictim()); 
    528             break; 
    529         case ACTION_T_YELL: 
    530             DoYell(GetEventAIText(param1), LANG_UNIVERSAL, pActionInvoker ? pActionInvoker : m_creature->getVictim()); 
    531             break; 
    532         case ACTION_T_TEXTEMOTE: 
    533             DoTextEmote(GetEventAIText(param1), pActionInvoker ? pActionInvoker : m_creature->getVictim()); 
     526        case ACTION_T_TEXT: 
     527            { 
     528                if (!param1) 
     529                    return; 
     530 
     531                uint32 temp = 0; 
     532 
     533                if (param2 && param3) 
     534                { 
     535                    switch( rand()%3 ) 
     536                    { 
     537                        case 0: temp = param1; break; 
     538                        case 2: temp = param2; break; 
     539                        case 3: temp = param3; break; 
     540                    } 
     541                }else if ( param2 && urand(0,1) ) 
     542                { 
     543                    temp = param2; 
     544                }else 
     545                { 
     546                    temp = param1; 
     547                } 
     548 
     549                if (temp) 
     550                { 
     551                    Unit* target = NULL; 
     552                    Unit* owner = NULL; 
     553 
     554                    if (pActionInvoker) 
     555                    { 
     556                        if (pActionInvoker->GetTypeId() == TYPEID_PLAYER) 
     557                            target = pActionInvoker; 
     558                        else if (owner = pActionInvoker->GetOwner()) 
     559                        { 
     560                            if (owner->GetTypeId() == TYPEID_PLAYER) 
     561                                target = owner; 
     562                        } 
     563                    } 
     564                    else if (target = m_creature->getVictim()) 
     565                    { 
     566                        if (target->GetTypeId() != TYPEID_PLAYER) 
     567                        { 
     568                            if (owner = target->GetOwner()) 
     569                            { 
     570                                if (owner->GetTypeId() == TYPEID_PLAYER) 
     571                                    target = owner; 
     572                            } 
     573                        } 
     574                    } 
     575 
     576                    DoScriptText(temp, m_creature, target); 
     577                } 
     578            } 
    534579            break; 
    535580        case ACTION_T_SOUND: 
     
    538583        case ACTION_T_EMOTE: 
    539584            m_creature->HandleEmoteCommand(param1); 
    540             break; 
    541         case ACTION_T_RANDOM_SAY: 
    542             { 
    543                 uint32 temp = GetRandActionParam(rnd, param1, param2, param3); 
    544  
    545                 if (temp != 0xffffffff) 
    546                     DoSay(GetEventAIText(temp), LANG_UNIVERSAL, pActionInvoker ? pActionInvoker : m_creature->getVictim()); 
    547             } 
    548             break; 
    549         case ACTION_T_RANDOM_YELL: 
    550             { 
    551                 uint32 temp = GetRandActionParam(rnd, param1, param2, param3); 
    552  
    553                 if (temp != 0xffffffff) 
    554                     DoYell(GetEventAIText(temp), LANG_UNIVERSAL, pActionInvoker ? pActionInvoker : m_creature->getVictim()); 
    555             } 
    556             break; 
    557         case ACTION_T_RANDOM_TEXTEMOTE: 
    558             { 
    559                 uint32 temp = GetRandActionParam(rnd, param1, param2, param3); 
    560  
    561                 if (temp != 0xffffffff) 
    562                     DoTextEmote(GetEventAIText(temp), pActionInvoker ? pActionInvoker : m_creature->getVictim()); 
    563             } 
    564585            break; 
    565586        case ACTION_T_RANDOM_SOUND: 
  • trunk/src/bindings/scripts/scripts/creature/mob_event_ai.h

    r90 r109  
    3131    EVENT_T_QUEST_ACCEPT            = 19,   //QuestID 
    3232    EVENT_T_QUEST_COMPLETE          = 20,   // 
    33      
     33 
    3434    EVENT_T_END, 
    3535}; 
     
    3838{ 
    3939    ACTION_T_NONE                   = 0,    //No action 
    40     ACTION_T_SAY                    = 1,    //TextId 
    41     ACTION_T_YELL                   = 2,    //TextId 
    42     ACTION_T_TEXTEMOTE              = 3,    //TextId 
     40    ACTION_T_TEXT                   = 1,    //-TextId1, optionally -TextId2, optionally -TextId3(if -TextId2 exist). If more than just -TextId1 is defined, randomize. Negative values. 
     41    ACTION_T_YELL                   = 2,    //UNUSED 
     42    ACTION_T_TEXTEMOTE              = 3,    //UNUSED 
    4343    ACTION_T_SOUND                  = 4,    //SoundId 
    4444    ACTION_T_EMOTE                  = 5,    //EmoteId 
    45     ACTION_T_RANDOM_SAY             = 6,    //TextId1, TextId2, TextId3 (-1 in any field means no output if randomed that field) 
    46     ACTION_T_RANDOM_YELL            = 7,    //TextId1, TextId2, TextId3 (-1 in any field means no output if randomed that field) 
    47     ACTION_T_RANDOM_TEXTEMOTE       = 8,    //TextId1, TextId2, TextId3 (-1 in any field means no output if randomed that field) 
     45    ACTION_T_RANDOM_SAY             = 6,    //UNUSED 
     46    ACTION_T_RANDOM_YELL            = 7,    //UNUSED 
     47    ACTION_T_RANDOM_TEXTEMOTE       = 8,    //UNUSED 
    4848    ACTION_T_RANDOM_SOUND           = 9,    //SoundId1, SoundId2, SoundId3 (-1 in any field means no output if randomed that field) 
    4949    ACTION_T_RANDOM_EMOTE           = 10,   //EmoteId1, EmoteId2, EmoteId3 (-1 in any field means no output if randomed that field) 
     
    209209 
    210210//Error prevention list 
    211 extern HM_NAMESPACE::hash_map<uint32, EventAI_CreatureError> EventAI_CreatureErrorPreventionList;  
     211extern HM_NAMESPACE::hash_map<uint32, EventAI_CreatureError> EventAI_CreatureErrorPreventionList; 
    212212 
    213213//Defines 
  • trunk/src/bindings/scripts/scripts/guard/guards.cpp

    r90 r109  
    530530                    } 
    531531                } 
    532                 DoStartAttackAndMovement(who); 
     532                DoStartMovement(who); 
    533533            } 
    534534        } 
  • trunk/src/bindings/scripts/scripts/zone/aunchindoun/auchenai_crypts/boss_exarch_maladaar.cpp

    r90 r109  
    198198            if( m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who) ) 
    199199            { 
    200                 DoStartAttackAndMovement(who); 
    201200                who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); 
    202  
    203                 if (!InCombat) 
    204                 { 
    205                     InCombat = true; 
    206                     Aggro(who); 
    207                 } 
     201                AttackStart(who); 
    208202            } 
    209203        } 
  • trunk/src/bindings/scripts/scripts/zone/aunchindoun/mana_tombs/boss_nexusprince_shaffar.cpp

    r90 r109  
    102102            if( m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who) ) 
    103103            { 
    104                 DoStartAttackAndMovement(who); 
    105104                who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); 
    106  
    107                 if (!InCombat) 
    108                 { 
    109                     InCombat = true; 
    110                     Aggro(who); 
    111                 } 
     105                AttackStart(who); 
    112106            } 
    113107        } 
  • trunk/src/bindings/scripts/scripts/zone/aunchindoun/sethekk_halls/boss_tailonking_ikiss.cpp

    r90 r109  
    111111            if( m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who) ) 
    112112            { 
    113                 DoStartAttackAndMovement(who); 
    114113                who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); 
    115  
    116                 if (!InCombat) 
    117                 { 
    118                     InCombat = true; 
    119                     Aggro(who); 
    120                 } 
     114                AttackStart(who); 
    121115            } 
    122116        } 
  • trunk/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/boss_grandmaster_vorpil.cpp

    r90 r109  
    215215                    who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); 
    216216 
    217                 DoStartAttackAndMovement(who); 
    218                 Aggro(who); 
     217                AttackStart(who); 
    219218            } 
    220219        } 
  • trunk/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/boss_murmur.cpp

    r90 r109  
    3333#define SPELL_SHOCKWAVE             33686 
    3434 
    35 struct TRINITY_DLL_DECL boss_murmurAI : public ScriptedAI 
     35struct TRINITY_DLL_DECL boss_murmurAI : public Scripted_NoMovementAI 
    3636{ 
    37     boss_murmurAI(Creature *c) : ScriptedAI(c) {Reset();} 
     37    boss_murmurAI(Creature *c) : Scripted_NoMovementAI(c) {Reset();} 
    3838 
    3939    uint32 SonicBoom_Timer; 
     
    6262 
    6363    void Aggro(Unit *who) { } 
    64  
    65     void AttackStart(Unit* who) 
    66     { 
    67         if (!who) 
    68             return; 
    69  
    70         if (who->isTargetableForAttack()) 
    71         { 
    72             //Begin attack 
    73             DoStartAttackNoMovement(who); 
    74  
    75             if (!InCombat) 
    76             { 
    77                 InCombat = true; 
    78                 Aggro(who); 
    79             } 
    80         } 
    81     } 
    82  
    83     void MoveInLineOfSight(Unit* who) 
    84     { 
    85         if( !m_creature->getVictim() && who->isTargetableForAttack() && ( m_creature->IsHostileTo( who )) && who->isInAccessablePlaceFor(m_creature) ) 
    86         { 
    87             if (!m_creature->canFly() && m_creature->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) 
    88                 return; 
    89  
    90             float attackRadius = m_creature->GetAttackDistance(who); 
    91             if(m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who)) 
    92             { 
    93                 DoStartAttackNoMovement(who); 
    94                 who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); 
    95  
    96                 if (!InCombat) 
    97                 { 
    98                     InCombat = true; 
    99                     Aggro(who); 
    100                 } 
    101             } 
    102         } 
    103     } 
    10464 
    10565    void UpdateAI(const uint32 diff) 
  • trunk/src/bindings/scripts/scripts/zone/black_temple/boss_illidan.cpp

    r108 r109  
    442442            return; 
    443443 
    444         if (who->isTargetableForAttack()) 
    445         { 
    446             if(Phase == PHASE_FLIGHT || Phase == PHASE_DEMON) 
    447                 m_creature->Attack(who, false); 
    448             else 
    449                 DoStartAttackAndMovement(who); 
    450  
    451             if (!InCombat) 
    452             { 
    453                 Aggro(who); 
    454                 InCombat = true; 
    455             } 
    456         } 
     444        if(Phase == PHASE_FLIGHT || Phase == PHASE_DEMON) 
     445            ScriptedAI::AttackStart(who, false); 
     446        else 
     447            ScriptedAI::AttackStart(who, true); 
    457448    } 
    458449 
     
    15111502            return; 
    15121503 
    1513         if (who->isTargetableForAttack()) 
    1514         { 
    1515             if(Phase == PHASE_TALK_SEQUENCE) 
    1516                 m_creature->Attack(who, false); 
    1517             else if(Phase == PHASE_DEMON || Phase == PHASE_TRANSFORM_SEQUENCE ) 
    1518             { 
    1519                 GETUNIT(Illidan, IllidanGUID); 
    1520                 if(Illidan && m_creature->IsWithinDistInMap(Illidan, 25)) 
    1521                     BlinkToPlayer();//Do not let dread aura hurt her. 
    1522                 m_creature->Attack(who, false); 
    1523             } 
    1524             else 
    1525                 DoStartAttackAndMovement(who); 
    1526  
    1527             if (!InCombat) 
    1528             { 
    1529                 Aggro(who); 
    1530                 InCombat = true; 
    1531             } 
    1532         } 
     1504        if(Phase == PHASE_TALK_SEQUENCE) 
     1505            ScriptedAI::AttackStart(who, false); 
     1506        else if(Phase == PHASE_DEMON || Phase == PHASE_TRANSFORM_SEQUENCE ) 
     1507        { 
     1508            GETUNIT(Illidan, IllidanGUID); 
     1509            if(Illidan && m_creature->IsWithinDistInMap(Illidan, 25)) 
     1510                BlinkToPlayer();//Do not let dread aura hurt her. 
     1511            ScriptedAI::AttackStart(who, false); 
     1512        } 
     1513        else 
     1514            ScriptedAI::AttackStart(who, true); 
    15331515    } 
    15341516 
  • trunk/src/bindings/scripts/scripts/zone/black_temple/boss_shade_of_akama.cpp

    r90 r109  
    261261 
    262262        if(who->isTargetableForAttack() && who != m_creature) 
    263             DoStartAttackAndMovement(who); 
     263            DoStartMovement(who); 
    264264    } 
    265265 
  • trunk/src/bindings/scripts/scripts/zone/blackwing_lair/boss_vaelastrasz.cpp

    r90 r109  
    120120        //Speach 
    121121        if (DoingSpeach) 
     122        { 
    122123            if (SpeachTimer < diff) 
    123         { 
    124             switch (SpeachNum) 
    125124            { 
    126                 case 0: 
    127                     //16 seconds till next line 
    128                     DoYell(SAY_LINE2,LANG_UNIVERSAL,NULL); 
    129                     DoPlaySoundToSet(m_creature,SOUND_LINE2); 
    130                     SpeachTimer = 16000; 
    131                     SpeachNum++; 
    132                     break; 
    133  
    134                 case 1: 
    135                     //This one is actually 16 seconds but we only go to 10 seconds because he starts attacking after he says "I must fight this!" 
    136                     DoYell(SAY_LINE3,LANG_UNIVERSAL,NULL); 
    137                     DoPlaySoundToSet(m_creature,SOUND_LINE3); 
    138                     SpeachTimer = 10000; 
    139                     SpeachNum++; 
    140                     break; 
    141  
    142                 case 2: 
    143                 default: 
    144                     m_creature->setFaction(103); 
    145                     m_creature->SetHealth(int(m_creature->GetMaxHealth()*.3)); 
    146                     if (PlayerGUID && Unit::GetUnit((*m_creature),PlayerGUID)) 
    147                     { 
    148                         DoStartAttackAndMovement(Unit::GetUnit((*m_creature),PlayerGUID)); 
    149                         DoCast(m_creature,SPELL_ESSENCEOFTHERED); 
    150                     } 
    151  
    152                     SpeachTimer = 0; 
    153                     DoingSpeach = false; 
    154                     break; 
    155             } 
    156         }else SpeachTimer -= diff; 
     125                switch (SpeachNum) 
     126                { 
     127                    case 0: 
     128                        //16 seconds till next line 
     129                        DoYell(SAY_LINE2,LANG_UNIVERSAL,NULL); 
     130                        DoPlaySoundToSet(m_creature,SOUND_LINE2); 
     131                        SpeachTimer = 16000; 
     132                        SpeachNum++; 
     133                        break; 
     134                    case 1: 
     135                        //This one is actually 16 seconds but we only go to 10 seconds because he starts attacking after he says "I must fight this!" 
     136                        DoYell(SAY_LINE3,LANG_UNIVERSAL,NULL); 
     137                        DoPlaySoundToSet(m_creature,SOUND_LINE3); 
     138                        SpeachTimer = 10000; 
     139                        SpeachNum++; 
     140                        break; 
     141                    case 2: 
     142                        m_creature->setFaction(103); 
     143                        m_creature->SetHealth(int(m_creature->GetMaxHealth()*.3)); 
     144                        if (PlayerGUID && Unit::GetUnit((*m_creature),PlayerGUID)) 
     145                        { 
     146                            AttackStart(Unit::GetUnit((*m_creature),PlayerGUID)); 
     147                            DoCast(m_creature,SPELL_ESSENCEOFTHERED); 
     148                        } 
     149                        SpeachTimer = 0; 
     150                        DoingSpeach = false; 
     151                        break; 
     152                } 
     153            }else SpeachTimer -= diff; 
     154        } 
    157155 
    158156        //Return since we have no target 
  • trunk/src/bindings/scripts/scripts/zone/blades_edge_mountains/blades_edge_mountains.cpp

    r90 r109  
    295295            if (m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who)) 
    296296            { 
    297                 if(who->HasStealthAura()) 
    298                     who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); 
    299  
    300                 //Begin melee attack if we are within range 
    301                 DoStartAttackAndMovement(who); 
     297                who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); 
     298                AttackStart(who); 
    302299            } 
    303300        } 
  • trunk/src/bindings/scripts/scripts/zone/burning_steppes/burning_steppes.cpp

    r90 r109  
    5757            if( m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who) ) 
    5858            { 
    59                 DoStartAttackAndMovement(who); 
    6059                who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); 
    61  
    62                 if (!InCombat) 
    63                 { 
    64                     InCombat = true; 
    65                     Aggro(who); 
    66                 } 
     60                AttackStart(who); 
    6761            } 
    6862        } 
  • trunk/src/bindings/scripts/scripts/zone/caverns_of_time/dark_portal/boss_temporus.cpp

    r90 r109  
    109109            if (m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who)) 
    110110            { 
    111                 if(who->HasStealthAura()) 
    112                     who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); 
    113  
    114                 DoStartAttackAndMovement(who); 
    115                 if (!InCombat) 
    116                 { 
    117                     DoYell(SAY_AGGRO, LANG_UNIVERSAL, NULL); 
    118                     DoPlaySoundToSet(m_creature, SOUND_AGGRO); 
    119                 } 
     111                who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); 
     112                AttackStart(who); 
    120113            } 
    121114        } 
  • trunk/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_fathomlord_karathress.cpp

    r90 r109  
    198198            if(target) 
    199199            { 
    200                 DoStartAttackAndMovement(target); 
    201  
     200                AttackStart(target); 
    202201                GetAdvisors(); 
    203  
    204                 DoPlaySoundToSet(m_creature, SOUND_AGGRO); 
    205                 DoYell(SAY_AGGRO, LANG_UNIVERSAL, NULL); 
    206202            } 
    207203        } 
     
    295291            if(target) 
    296292            { 
    297                 DoStartAttackAndMovement(target); 
     293                AttackStart(target); 
    298294            } 
    299295        } 
     
    376372            if(target) 
    377373            { 
    378                 DoStartAttackAndMovement(target); 
     374                AttackStart(target); 
    379375            } 
    380376        } 
     
    454450            if(target) 
    455451            { 
    456                 DoStartAttackAndMovement(target); 
     452                AttackStart(target); 
    457453            } 
    458454        } 
  • trunk/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_lady_vashj.cpp

    r90 r109  
    238238        //Begin melee attack if we are within range 
    239239        if(Phase != 2) 
    240             DoStartAttackAndMovement(who); 
     240            DoStartMovement(who); 
    241241 
    242242        StartEvent(); 
  • trunk/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_morogrim_tidewalker.cpp

    r90 r109  
    352352        { 
    353353            //no attack radius check - it attacks the first target that moves in his los 
    354             if(who->HasStealthAura()) 
    355                 who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); 
    356  
    357             DoStartAttackAndMovement(who); 
     354            who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); 
     355            AttackStart(who); 
    358356        } 
    359357    } 
  • trunk/src/bindings/scripts/scripts/zone/gruuls_lair/boss_high_king_maulgar.cpp

    r106 r109  
    189189 
    190190 
    191     void Aggro(Unit *who) { StartEvent(who); } 
     191    void Aggro(Unit *who) 
     192    { 
     193        StartEvent(who); 
     194    } 
    192195 
    193196    void GetCouncil() 
     
    225228            if(target) 
    226229            { 
    227                 DoStartAttackAndMovement(target); 
    228  
     230                AttackStart(target); 
    229231                GetCouncil(); 
    230  
    231                 DoPlaySoundToSet(m_creature, SOUND_AGGRO); 
    232232            } 
    233233        } 
     
    284284                Unit* target = NULL; 
    285285                target = SelectUnit(SELECT_TARGET_RANDOM, 0); 
    286                 if(target) 
    287                     DoStartAttackAndMovement(target); 
     286                if (target) 
     287                    AttackStart(target); 
    288288                                       DoCast(target, SPELL_BERSERKER_C);       
    289289 
     
    359359            if(target) 
    360360            { 
    361                 DoStartAttackAndMovement(target); 
     361                AttackStart(target); 
    362362            } 
    363363        } 
     
    466466                if(!InCombat) 
    467467                { 
    468                     DoStartAttackAndMovement(who); 
     468                    AttackStart(who); 
    469469                    if(pInstance) 
    470470                    { 
     
    486486            if(target) 
    487487            { 
    488                 DoStartAttackAndMovement(target); 
     488                AttackStart(target); 
    489489            } 
    490490        } 
     
    596596                if(!InCombat) 
    597597                { 
    598                     DoStartAttackAndMovement(who); 
     598                    AttackStart(who); 
    599599                    if(pInstance) 
    600600                    { 
     
    616616            if(target) 
    617617            { 
    618                 DoStartAttackAndMovement(target); 
     618                AttackStart(target); 
    619619            } 
    620620        } 
     
    710710                if(!InCombat) 
    711711                { 
    712                     DoStartAttackAndMovement(who); 
     712                    AttackStart(who); 
    713713                    if(pInstance) 
    714714                    { 
     
    730730            if(target) 
    731731            { 
    732                 DoStartAttackAndMovement(target); 
     732                AttackStart(target); 
    733733            } 
    734734        } 
  • trunk/src/bindings/scripts/scripts/zone/hellfire_citadel/hellfire_ramparts/boss_omor_the_unscarred.cpp

    r90 r109  
    5555#define SOUND_WIPE                  10283 
    5656 
    57 struct TRINITY_DLL_DECL boss_omor_the_unscarredAI : public ScriptedAI 
     57struct TRINITY_DLL_DECL boss_omor_the_unscarredAI : public Scripted_NoMovementAI 
    5858{ 
    59     boss_omor_the_unscarredAI(Creature *c) : ScriptedAI(c) {Reset();} 
     59    boss_omor_the_unscarredAI(Creature *c) : Scripted_NoMovementAI(c) {Reset();} 
    6060 
    6161    uint32 OrbitalStrike_Timer; 
     
    104104                DoPlaySoundToSet(m_creature,SOUND_AGGRO_3); 
    105105                break; 
    106         } 
    107     } 
    108  
    109     void AttackStart(Unit* who) 
    110     { 
    111         if (!who) 
    112             return; 
    113  
    114         if (who->isTargetableForAttack()) 
    115         { 
    116             DoStartAttackNoMovement(who); 
    117  
    118             if (!InCombat) 
    119             { 
    120                 InCombat = true; 
    121                 Aggro(who); 
    122             } 
    123         } 
    124     } 
    125  
    126     void MoveInLineOfSight(Unit* who) 
    127     { 
    128         if( !m_creature->getVictim() && who->isTargetableForAttack() && ( m_creature->IsHostileTo( who )) && who->isInAccessablePlaceFor(m_creature) ) 
    129         { 
    130             if (!m_creature->canFly() && m_creature->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) 
    131                 return; 
    132  
    133             float attackRadius = m_creature->GetAttackDistance(who); 
    134             if(m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who)) 
    135             { 
    136                 DoStartAttackNoMovement(who); 
    137                 who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); 
    138  
    139                 if (!InCombat) 
    140                 { 
    141                     InCombat = true; 
    142                     Aggro(who); 
    143                 } 
    144             } 
    145106        } 
    146107    } 
  • trunk/src/bindings/scripts/scripts/zone/hellfire_citadel/hellfire_ramparts/boss_watchkeeper_gargolmar.cpp

    r90 r109  
    104104            if(m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who)) 
    105105            { 
    106                 DoStartAttackAndMovement(who); 
    107106                who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); 
    108  
    109                 if (!InCombat) 
    110                 { 
    111                     InCombat = true; 
    112                     Aggro(who); 
    113                 } 
     107                AttackStart(who); 
    114108            } 
    115109            else if (!HasTaunted && m_creature->IsWithinDistInMap(who, 60.0f)) 
  • trunk/src/bindings/scripts/scripts/zone/hellfire_citadel/shattered_halls/boss_nethekurse.cpp

    r90 r109  
    194194            return; 
    195195 
    196         if( who->isTargetableForAttack() ) 
    197         { 
    198             if( Phase ) DoStartAttackNoMovement(who); 
    199             else DoStartAttackAndMovement(who); 
    200  
    201             if( !InCombat ) 
     196        if (m_creature->Attack(who, true)) 
     197        { 
     198            m_creature->AddThreat(who, 0.0f); 
     199            m_creature->SetInCombatWith(who); 
     200            who->SetInCombatWith(m_creature); 
     201 
     202            if (!InCombat) 
    202203            { 
    203204                InCombat = true; 
    204205                Aggro(who); 
    205206            } 
     207 
     208            if (Phase) DoStartNoMovement(who); 
     209            else DoStartMovement(who); 
    206210        } 
    207211    } 
     
    231235            if( m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who) ) 
    232236            { 
    233                 if( Phase ) DoStartAttackNoMovement(who); 
    234                 else DoStartAttackAndMovement(who); 
    235  
    236237                who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); 
    237  
    238                 if( !InCombat ) 
    239                 { 
    240                     InCombat = true; 
    241                     Aggro(who); 
    242                 } 
     238                AttackStart(who); 
    243239            } 
    244240        } 
  • trunk/src/bindings/scripts/scripts/zone/karazhan/boss_moroes.cpp

    r90 r109  
    1717/* ScriptData 
    1818SDName: Boss_Moroes 
    19 SD%Complete: 100 
     19SD%Complete: 95 
    2020SDComment: 
    2121SDCategory: Karazhan 
     
    4646#define SOUND_DEATH         9213 
    4747 
    48 #define SPELL_VANISH        24699 
     48#define SPELL_VANISH        29448 
    4949#define SPELL_GARROTE       37066 
    50 #define SPELL_BLIND         34654 
    51 #define SPELL_GOUGE         28456 
    52 #define SPELL_ENRAGE        37023 
    53  
    54 #define ORIENT              4.5784 
     50#define SPELL_BLIND         34694 
     51#define SPELL_GOUGE         29425 
     52#define SPELL_FRENZY        37023 
     53 
    5554#define POS_Z               81.73 
    5655 
    57 float Locations[4][2]= 
    58 { 
    59     {-10976.2793, -1878.1736}, 
    60     {-10979.7587, -1877.8706}, 
    61     {-10985.6650, -1877.2458}, 
    62     {-10989.1367, -1876.8309}, 
     56float Locations[4][3]= 
     57{ 
     58    {-10991.0, -1884.33, 0.614315}, 
     59    {-10989.4, -1885.88, 0.904913}, 
     60    {-10978.1, -1887.07, 2.035550}, 
     61    {-10975.9, -1885.81, 2.253890}, 
    6362}; 
    6463 
     
    160159        DoPlaySoundToSet(m_creature, SOUND_DEATH); 
    161160 
    162         if(pInstance) 
     161        if (pInstance) 
    163162            pInstance->SetData(DATA_MOROES_EVENT, DONE); 
    164163 
     
    169168    { 
    170169        Unit* pUnit = Unit::GetUnit((*m_creature), guid); 
    171         if(pUnit) 
    172         { 
    173             if(!pUnit->isAlive()) 
     170        if (pUnit) 
     171        { 
     172            if (!pUnit->isAlive()) 
    174173                return 1;                                   // Exists but is dead 
    175174            else 
    176175                return 2;                                   // Exists and is alive 
    177176        } 
    178  
    179177        return 0;                                           // Does not exist 
    180178    } 
     
    184182        Creature *pCreature = NULL; 
    185183 
    186         if(FirstTime) 
     184        if (FirstTime) 
    187185        { 
    188186            std::vector<uint32> AddList; 
     
    199197                uint32 entry = *itr; 
    200198 
    201                 pCreature = m_creature->SummonCreature(entry, Locations[i][0], Locations[i][1], POS_Z, ORIENT, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); 
    202                 if(pCreature) 
     199                pCreature = m_creature->SummonCreature(entry, Locations[i][0], Locations[i][1], POS_Z, Locations[i][2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); 
     200                if (pCreature) 
    203201                { 
    204202                    AddGUID[i] = pCreature->GetGUID(); 
     
    217215                { 
    218216                    case 0: 
    219                         pCreature = m_creature->SummonCreature(AddId[i], Locations[i][0], Locations[i][1], POS_Z, ORIENT, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); 
    220                         if(pCreature) 
     217                        pCreature = m_creature->SummonCreature(AddId[i], Locations[i][0], Locations[i][1], POS_Z, Locations[i][2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); 
     218                        if (pCreature) 
    221219                            AddGUID[i] = pCreature->GetGUID(); 
    222220                        break; 
    223221                    case 1: 
    224222                        pCreature = ((Creature*)Unit::GetUnit((*m_creature), AddGUID[i])); 
    225                         if(pCreature) 
     223                        if (pCreature) 
    226224                        { 
    227225                            pCreature->Respawn(); 
     
    231229                    case 2: 
    232230                        pCreature = ((Creature*)Unit::GetUnit((*m_creature), AddGUID[i])); 
    233                         if(!pCreature->IsInEvadeMode()) 
     231                        if (!pCreature->IsInEvadeMode()) 
    234232                            pCreature->AI()->EnterEvadeMode(); 
    235233                        break; 
     
    244242        { 
    245243            Unit* Temp = NULL; 
    246             if(AddGUID[i]) 
     244            if (AddGUID[i]) 
    247245            { 
    248246                Temp = Unit::GetUnit((*m_creature),AddGUID[i]); 
    249                 if(Temp && Temp->isAlive()) 
     247                if (Temp && Temp->isAlive()) 
    250248                    Temp->DealDamage(Temp, Temp->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); 
    251249            } 
     
    258256        { 
    259257            Unit* Temp = NULL; 
    260             if(AddGUID[i]) 
     258            if (AddGUID[i]) 
    261259            { 
    262260                Temp = Unit::GetUnit((*m_creature),AddGUID[i]); 
    263                 if(Temp && Temp->isAlive()) 
     261                if (Temp && Temp->isAlive()) 
    264262                    ((Creature*)Temp)->AI()->AttackStart(m_creature->getVictim()); 
    265263                else 
     
    279277        if(!Enrage && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 30) 
    280278        { 
    281             DoCast(m_creature, SPELL_ENRAGE); 
     279            DoCast(m_creature, SPELL_FRENZY); 
    282280            Enrage = true; 
    283281        } 
    284282 
    285         if(CheckAdds_Timer < diff) 
    286         { 
    287             for(uint8 i = 0; i < 4; ++i) 
     283        if (CheckAdds_Timer < diff) 
     284        { 
     285            for (uint8 i = 0; i < 4; ++i) 
    288286            { 
    289287                Unit* Temp = NULL; 
    290                 if(AddGUID[i]) 
     288                if (AddGUID[i]) 
    291289                { 
    292290                    Temp = Unit::GetUnit((*m_creature),AddGUID[i]); 
    293                     if(Temp && Temp->isAlive()) 
    294                         if(!Temp->SelectHostilTarget() || !Temp->getVictim() ) 
     291                    if (Temp && Temp->isAlive()) 
     292                        if (!Temp->SelectHostilTarget() || !Temp->getVictim() ) 
    295293                            ((Creature*)Temp)->AI()->AttackStart(m_creature->getVictim()); 
    296294                } 
     
    299297        }else CheckAdds_Timer -= diff; 
    300298 
    301         //Cast Vanish, then Garrote random victim 
    302         if(Vanish_Timer < diff) 
    303         { 
    304             m_creature->setFaction(35); 
    305             m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); 
    306             m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); 
    307             DoCast(m_creature, SPELL_VANISH); 
    308             InVanish = true; 
    309             Vanish_Timer = 30000; 
    310             Wait_Timer = 5000; 
    311         }else Vanish_Timer -= diff; 
    312  
    313         if(InVanish) 
    314         { 
    315             if(Wait_Timer < diff) 
    316             { 
    317                 switch(rand()%2) 
     299        if (!Enrage) 
     300        { 
     301            //Cast Vanish, then Garrote random victim 
     302            if (Vanish_Timer < diff) 
     303            { 
     304                m_creature->setFaction(35); 
     305                m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); 
     306                m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); 
     307                DoCast(m_creature, SPELL_VANISH); 
     308                InVanish = true; 
     309                Vanish_Timer = 30000; 
     310                Wait_Timer = 5000; 
     311            }else Vanish_Timer -= diff; 
     312 
     313            if (InVanish) 
     314            { 
     315                if (Wait_Timer < diff) 
    318316                { 
    319                     case 0: 
    320                         DoYell(SAY_SPECIAL_1, LANG_UNIVERSAL, NULL); 
    321                         DoPlaySoundToSet(m_creature, SOUND_SPECIAL_1); 
    322                         break; 
    323                     case 1: 
    324                         DoYell(SAY_SPECIAL_2, LANG_UNIVERSAL, NULL); 
    325                         DoPlaySoundToSet(m_creature, SOUND_SPECIAL_2); 
    326                         break; 
     317                    switch(rand()%2) 
     318                    { 
     319                        case 0: 
     320                            DoYell(SAY_SPECIAL_1, LANG_UNIVERSAL, NULL); 
     321                            DoPlaySoundToSet(m_creature, SOUND_SPECIAL_1); 
     322                            break; 
     323                        case 1: 
     324                            DoYell(SAY_SPECIAL_2, LANG_UNIVERSAL, NULL); 
     325                            DoPlaySoundToSet(m_creature, SOUND_SPECIAL_2); 
     326                            break; 
     327                    } 
     328 
     329                    Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0); 
     330                    if (target) 
     331                        target->CastSpell(target, SPELL_GARROTE,true); 
     332 
     333                    m_creature->setFaction(16); 
     334                    m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); 
     335                    m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); 
     336                    m_creature->AI()->AttackStart(m_creature->getVictim()); 
     337                    InVanish = false; 
     338                }else Wait_Timer -= diff; 
     339            } 
     340 
     341            //Blind highest aggro, and attack second highest 
     342            if (Gouge_Timer < diff) 
     343            { 
     344                DoCast(m_creature->getVictim(), SPELL_GOUGE); 
     345                if (m_creature->getThreatManager().getThreat(m_creature->getVictim())) 
     346                    m_creature->getThreatManager().modifyThreatPercent(m_creature->getVictim(),-100); 
     347                Gouge_Timer = 40000; 
     348            }else Gouge_Timer -= diff; 
     349 
     350            if (Blind_Timer < diff) 
     351            { 
     352                Unit* target = NULL; 
     353                std::list<HostilReference*> t_list = m_creature->getThreatManager().getThreatList(); 
     354 
     355                if (t_list.empty()) 
     356                    return; 
     357 
     358                std::vector<Unit*> target_list; 
     359                for (std::list<HostilReference*>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) 
     360                { 
     361                    target = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); 
     362                    if (target && target->GetDistance2d(m_creature) < 5) 
     363                        target_list.push_back(target); 
    327364                } 
    328  
    329                 Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0); 
    330                 if(target) 
    331                     target->CastSpell(target, SPELL_GARROTE,true); 
    332  
    333                 m_creature->setFaction(16); 
    334                 m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); 
    335                 m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); 
    336                 m_creature->AI()->AttackStart(m_creature->getVictim()); 
    337                 InVanish = false; 
    338             }else Wait_Timer -= diff; 
    339         } 
    340  
    341         //Blind highest aggro, and attack second highest 
    342         if(Gouge_Timer < diff) 
    343         { 
    344             DoCast(m_creature->getVictim(), SPELL_GOUGE); 
    345             if(m_creature->getThreatManager().getThreat(m_creature->getVictim())) 
    346                 m_creature->getThreatManager().modifyThreatPercent(m_creature->getVictim(),-100); 
    347             Gouge_Timer = 40000; 
    348         }else Gouge_Timer -= diff; 
    349  
    350         if(Blind_Timer < diff) 
    351         { 
    352             Unit* target = NULL; 
    353             std::list<HostilReference*> t_list = m_creature->getThreatManager().getThreatList(); 
    354  
    355             if(t_list.empty()) 
    356                 return; 
    357  
    358             std::vector<Unit*> target_list; 
    359             for(std::list<HostilReference*>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) 
    360             { 
    361                 target = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); 
    362                 if(target && target->GetDistance2d(m_creature) < 5) 
    363                     target_list.push_back(target); 
    364             } 
    365             if(target_list.size()) 
    366                 target = *(target_list.begin()+rand()%target_list.size()); 
    367  
    368             if(target) 
    369                 DoCast(target, SPELL_BLIND); 
    370  
    371             Blind_Timer = 40000; 
    372         }else Blind_Timer -= diff; 
    373  
    374         if(!InVanish) 
     365                if (target_list.size()) 
     366                    target = *(target_list.begin()+rand()%target_list.size()); 
     367 
     368                if (target) 
     369                    DoCast(target, SPELL_BLIND); 
     370 
     371                Blind_Timer = 40000; 
     372            }else Blind_Timer -= diff; 
     373        } 
     374 
     375        if (!InVanish) 
    375376            DoMeleeAttackIfReady(); 
    376377    } 
  • trunk/src/bindings/scripts/scripts/zone/karazhan/boss_terestian_illhoof.cpp

    r90 r109  
    1717/* ScriptData 
    1818SDName: Boss_Terestian_Illhoof 
    19 SD%Complete: 100 
    20 SDComment: Complete! 
     19SD%Complete: 95 
     20SDComment: Complete! Needs adjustments to use spell though. 
    2121SDCategory: Karazhan 
    2222EndScriptData */ 
     
    3232#define SPELL_BERSERK               32965                   // Increases attack speed by 75%. Periodically casts Shadow Bolt Volley. 
    3333 
     34#define SPELL_SUMMON_IMP            30066                   // Summons Kil'rek 
     35 
     36#define SPELL_FIENDISH_PORTAL       30171                   // Opens portal and summons Fiendish Portal, 2 sec cast 
     37#define SPELL_FIENDISH_PORTAL_1     30179                   // Opens portal and summons Fiendish Portal, instant cast 
     38 
    3439#define SPELL_FIREBOLT              18086                   // Blasts a target for 150 Fire damage. 
    3540 
     
    6267#define CREATURE_FIENDISHIMP    17267 
    6368#define CREATURE_PORTAL         17265 
    64  
    65 #define SACRIFICE_X     -11240.599 
    66 #define SACRIFICE_Y     -1694.2700 
    67 #define SACRIFICE_Z     179.720007 
    6869 
    6970#define PORTAL_Z        179.434 
     
    310311            { 
    311312                DoCast(target, SPELL_SACRIFICE, true); 
    312                 Creature* Chains = m_creature->SummonCreature(CREATURE_DEMONCHAINS, SACRIFICE_X, SACRIFICE_Y, SACRIFICE_Z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 21000); 
     313                Creature* Chains = m_creature->SummonCreature(CREATURE_DEMONCHAINS, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 21000); 
    313314                if(Chains) 
    314315                { 
  • trunk/src/bindings/scripts/scripts/zone/karazhan/bosses_opera.cpp

    r90 r109  
    11251125            { 
    11261126                m_creature->AddThreat(Julianne->getVictim(), 1.0f); 
    1127                 DoStartAttackAndMovement(Julianne->getVictim()); 
     1127                AttackStart(Julianne->getVictim()); 
    11281128            } 
    11291129        } 
  • trunk/src/bindings/scripts/scripts/zone/naxxramas/boss_anubrekhan.cpp

    r90 r109  
    108108            if (m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who)) 
    109109            { 
    110                 if(who->HasStealthAura()) 
    111                     who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); 
    112  
    113                 //Begin melee attack if we are within range 
    114                 DoStartAttackAndMovement(who); 
    115  
    116110                if (!InCombat) 
    117111                { 
     
    132126                    } 
    133127                } 
     128 
     129                who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); 
     130                AttackStart(who); 
    134131            } 
    135132            else if (!HasTaunted && m_creature->IsWithinDistInMap(who, 60.0f)) 
  • trunk/src/bindings/scripts/scripts/zone/naxxramas/boss_faerlina.cpp

    r90 r109  
    9898            if (m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who)) 
    9999            { 
    100                 if(who->HasStealthAura()) 
    101                     who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); 
    102  
    103                 DoStartAttackAndMovement(who); 
    104100                //Say our dialog on initial aggro 
    105101                if (!InCombat) 
     
    125121                    } 
    126122                } 
     123 
     124                who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); 
     125                AttackStart(who); 
    127126            } 
    128127            else if (!HasTaunted && m_creature->IsWithinDistInMap(who, 60.0f)) 
  • trunk/src/bindings/scripts/scripts/zone/stratholme/boss_timmy_the_cruel.cpp

    r90 r109  
    5555            if (m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->GetDistanceZ(who) <= CREATURE_Z_ATTACK_RANGE && m_creature->IsWithinLOSInMap(who)) 
    5656            { 
    57                 if(who->HasStealthAura()) 
    58                     who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); 
    59  
    6057                if (!HasYelled) 
    6158                { 
     
    6461                } 
    6562 
    66                 //Begin melee attack if we are within range 
    67                 DoStartAttackAndMovement(who); 
     63                who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); 
     64                AttackStart(who); 
    6865            } 
    6966        } 
  • trunk/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_eredar_twins.cpp

    r90 r109  
    418418            if (!InCombat) 
    419419            { 
    420                 DoStartAttackNoMovement(who); 
     420                DoStartNoMovement(who); 
    421421                Aggro(who); 
    422422                InCombat = true; 
     
    441441                if (!InCombat) 
    442442                { 
    443                     DoStartAttackNoMovement(who); 
     443                    DoStartNoMovement(who); 
    444444                    Aggro(who); 
    445445                    InCombat = true; 
  • trunk/src/bindings/scripts/scripts/zone/tempest_keep/arcatraz/arcatraz.cpp

    r90 r109  
    124124    } 
    125125 
    126     void MoveInLineOfSight(Unit *who) 
    127     { 
    128         if( !m_creature->getVictim() && who->isTargetableForAttack() && ( m_creature->IsHostileTo( who )) && who->isInAccessablePlaceFor(m_creature) ) 
    129         { 
    130             if (!m_creature->canFly() && m_creature->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) 
    131                 return; 
    132  
    133             float attackRadius = m_creature->GetAttackDistance(who); 
    134             if( m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who) ) 
    135             { 
    136                 DoStartAttackNoMovement(who); 
    137                 who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); 
    138  
    139                 if (!InCombat) 
    140                 { 
    141                     InCombat = true; 
    142                     Aggro(who); 
    143                 } 
    144             } 
    145         } 
    146     } 
    147  
    148126    void AttackStart(Unit* who) 
    149127    { 
    150         if (who->isTargetableForAttack()) 
    151         { 
    152             DoStartAttackNoMovement(who); 
     128        if (m_creature->Attack(who, true)) 
     129        { 
     130            m_creature->AddThreat(who, 0.0f); 
     131            m_creature->SetInCombatWith(who); 
     132            who->SetInCombatWith(m_creature); 
    153133 
    154134            if (!InCombat) 
     
    157137                Aggro(who); 
    158138            } 
     139 
     140            //TODO: Make it so he moves when target out of range 
     141            DoStartNoMovement(who); 
    159142        } 
    160143    } 
  • trunk/src/bindings/scripts/scripts/zone/tempest_keep/arcatraz/boss_harbinger_skyriss.cpp

    r90 r109  
    126126            if( m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who) ) 
    127127            { 
    128                 DoStartAttackAndMovement(who); 
    129128                who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); 
    130  
    131                 if (!InCombat) 
    132                 { 
    133                     InCombat = true; 
    134                     Aggro(who); 
    135                 } 
     129                AttackStart(who); 
    136130            } 
    137131        } 
     
    143137            return; 
    144138 
    145         if( who->isTargetableForAttack() ) 
    146         { 
    147             DoStartAttackAndMovement(who); 
    148  
    149             if( !InCombat ) 
     139        if (m_creature->Attack(who, true)) 
     140        { 
     141            m_creature->AddThreat(who, 0.0f); 
     142            m_creature->SetInCombatWith(who); 
     143            who->SetInCombatWith(m_creature); 
     144 
     145            if (!InCombat) 
    150146            { 
    151147                InCombat = true; 
    152148                Aggro(who); 
    153149            } 
     150 
     151            DoStartMovement(who); 
    154152        } 
    155153    } 
  • trunk/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/boss_alar.cpp

    r90 r109  
    157157            //Begin attack 
    158158            if(Phase1) 
    159                 DoStartAttackNoMovement(who); 
     159                DoStartNoMovement(who); 
    160160            else 
    161                 DoStartAttackAndMovement(who); 
     161                DoStartMovement(who); 
    162162 
    163163            if(!InCombat) 
  • trunk/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/boss_kaelthas.cpp

    r90 r109  
    211211            if(m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who) ) 
    212212            { 
    213                 DoStartAttackAndMovement(who); 
    214213                who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); 
    215  
    216                 if (!InCombat) 
    217                 { 
    218                     InCombat = true; 
    219                     Aggro(who); 
    220                 } 
     214                AttackStart(who); 
    221215            } 
    222216        } 
     
    228222            return; 
    229223 
    230         if (who->isTargetableForAttack()) 
    231         { 
    232             //Begin attack 
    233             DoStartAttackAndMovement(who); 
     224        if (m_creature->Attack(who, true)) 
     225        { 
     226            m_creature->AddThreat(who, 0.0f); 
     227            m_creature->SetInCombatWith(who); 
     228            who->SetInCombatWith(m_creature); 
    234229 
    235230            if (!InCombat) 
     
    238233                Aggro(who); 
    239234            } 
     235 
     236            DoStartMovement(who); 
    240237        } 
    241238    } 
     
    436433            if(target) 
    437434            { 
    438                 DoStartAttackAndMovement(target); 
     435                AttackStart(target); 
    439436            } 
    440437        }else 
     
    507504            if (Phase >= 4 && m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who)) 
    508505            { 
    509                 if(who->HasStealthAura()) 
    510                     who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); 
    511  
    512                 DoStartAttackAndMovement(who); 
     506                who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); 
     507                AttackStart(who); 
    513508            } 
    514509            else if(who->isAlive()) 
     
    775770                    if(target) 
    776771                    { 
    777                         DoStartAttackAndMovement(target); 
     772                        AttackStart(target); 
    778773                    } 
    779774                    Phase_Timer = 30000; 
     
    932927                        m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); 
    933928                        Phase = 6; 
    934                         DoStartAttackAndMovement(m_creature->getVictim()); 
     929                        AttackStart(m_creature->getVictim()); 
    935930                        m_creature->GetMotionMaster()->Clear(); 
    936931                        m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim()); 
     
    10381033                                GravityLapse_Timer = 60000; 
    10391034                                GravityLapse_Phase = 0; 
    1040                                 DoStartAttackAndMovement(m_creature->getVictim()); 
     1035                                AttackStart(m_creature->getVictim()); 
    10411036                                m_creature->GetMotionMaster()->Clear(); 
    10421037                                m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim()); 
     
    12421237            return; 
    12431238 
    1244         if (who->isTargetableForAttack()) 
    1245         { 
    1246             //Begin attack 
    1247             DoStartAttackAndMovement(who, CAPERNIAN_DISTANCE, M_PI/2); 
     1239        if (m_creature->Attack(who, true)) 
     1240        { 
     1241            m_creature->AddThreat(who, 0.0f); 
     1242            m_creature->SetInCombatWith(who); 
     1243            who->SetInCombatWith(m_creature); 
    12481244 
    12491245            if (!InCombat) 
     
    12521248                Aggro(who); 
    12531249            } 
     1250 
     1251            DoStartMovement(who, CAPERNIAN_DISTANCE, M_PI/2); 
    12541252        } 
    12551253    } 
  • trunk/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_bug_trio.cpp

    r90 r109  
    178178                DoCast(target, SPELL_CHARGE); 
    179179                m_creature->SendMonsterMove(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, true,1); 
    180                 DoStartAttackAndMovement(target); 
     180                AttackStart(target); 
    181181            } 
    182182 
  • trunk/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_sartura.cpp

    r90 r109  
    8181                target = SelectUnit(SELECT_TARGET_RANDOM,1); 
    8282                if (target) 
    83                     DoStartAttackAndMovement(target); 
     83                    AttackStart(target); 
    8484 
    8585                WhirlWindRandom_Timer = 3000 + rand()%4000; 
     
    220220                target = SelectUnit(SELECT_TARGET_RANDOM,1); 
    221221                if (target) 
    222                     DoStartAttackAndMovement(target); 
     222                    AttackStart(target); 
    223223 
    224224                AggroReset = true; 
  • trunk/src/bindings/scripts/scripts/zone/zulaman/boss_zuljin.cpp

    r90 r109  
    277277                m_creature->Attack(who, false); 
    278278            else 
    279                 DoStartAttackAndMovement(who); 
     279                DoStartMovement(who); 
    280280 
    281281            if (!InCombat) 
  • trunk/src/bindings/scripts/scripts/zone/zulgurub/boss_arlokk.cpp

    r90 r109  
    168168                    m_creature->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 35))); 
    169169                    m_creature->UpdateDamagePhysical(BASE_ATTACK); 
    170                     DoStartAttackAndMovement(target); 
     170                    AttackStart(target); 
    171171                    //The Panther Model 
    172172                    m_creature->SetUInt32Value(UNIT_FIELD_DISPLAYID,15215); 
  • trunk/src/bindings/scripts/scripts/zone/zulgurub/boss_grilek.cpp

    r90 r109  
    6363                m_creature->getThreatManager().modifyThreatPercent(m_creature->getVictim(),-50); 
    6464            if (target) 
    65                 DoStartAttackAndMovement(target); 
     65                AttackStart(target); 
    6666 
    6767            Avartar_Timer = 25000 + rand()%10000; 
  • trunk/src/bindings/scripts/scripts/zone/zulgurub/boss_jeklik.cpp

    r90 r109  
    110110                        m_creature->Relocate(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0); 
    111111                        m_creature->SendMonsterMove(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, true,1); 
    112                         DoStartAttackAndMovement(target); 
     112                        AttackStart(target); 
    113113                    } 
    114114 
  • trunk/src/bindings/scripts/scripts/zone/zulgurub/boss_mandokir.cpp

    r90 r109  
    143143                            DoCast(pUnit,SPELL_CHARGE); 
    144144                            m_creature->SendMonsterMove(pUnit->GetPositionX(), pUnit->GetPositionY(), pUnit->GetPositionZ(), 0, true,1); 
    145                             DoStartAttackAndMovement(pUnit); 
     145                            AttackStart(pUnit); 
    146146                        } 
    147147                    } 
  • trunk/src/bindings/scripts/scripts/zone/zulgurub/boss_marli.cpp

    r90 r109  
    166166                    } 
    167167                    if (target) 
     168                    { 
    168169                        DoCast(target, SPELL_CHARGE); 
    169                     //                    m_creature->Relocate(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0); 
    170                     //                    m_creature->SendMonsterMove(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, true,1); 
    171                     DoStartAttackAndMovement(target); 
     170                        //m_creature->Relocate(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0); 
     171                        //m_creature->SendMonsterMove(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, true,1); 
     172                        AttackStart(target); 
     173                    } 
    172174 
    173175                    Charge_Timer = 8000; 
  • trunk/src/bindings/scripts/scripts/zone/zulgurub/boss_renataki.cpp

    r90 r109  
    122122 
    123123            if (target) 
    124                 DoStartAttackAndMovement(target); 
     124                AttackStart(target); 
    125125 
    126126            Aggro_Timer = 7000 + rand()%13000; 
  • trunk/src/bindings/scripts/scripts/zone/zulgurub/boss_thekal.cpp

    r90 r109  
    206206                    DoCast(target,SPELL_CHARGE); 
    207207                    m_creature->SendMonsterMove(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, true,1); 
    208                     DoStartAttackAndMovement(target); 
    209208                    DoResetThreat(); 
     209                    AttackStart(target); 
    210210 
    211211                    Charge_Timer = 15000 + rand()%7000; 
  • trunk/src/bindings/scripts/sql/scripts_structure.sql

    r47 r109  
     1DROP TABLE IF EXISTS `custom_texts`; 
     2CREATE TABLE `custom_texts` ( 
     3  `entry` mediumint(8) NOT NULL, 
     4  `content_default` text NOT NULL, 
     5  `content_loc1` text, 
     6  `content_loc2` text, 
     7  `content_loc3` text, 
     8  `content_loc4` text, 
     9  `content_loc5` text, 
     10  `content_loc6` text, 
     11  `content_loc7` text, 
     12  `content_loc8` text, 
     13  `sound` mediumint(8) unsigned NOT NULL default '0', 
     14  `type` tinyint unsigned NOT NULL default '0', 
     15  `language` tinyint unsigned NOT NULL default '0', 
     16  `comment` text, 
     17  PRIMARY KEY (`entry`) 
     18) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Custom Texts'; 
     19 
    120DROP TABLE IF EXISTS `eventai_scripts`; 
    221CREATE TABLE `eventai_scripts` ( 
    3 `id` int(11) unsigned NOT NULL COMMENT 'Identifier' AUTO_INCREMENT, 
    4 `creature_id` int(11) unsigned NOT NULL default '0' COMMENT 'Creature Template Identifier', 
     22  `id` int(11) unsigned NOT NULL COMMENT 'Identifier' AUTO_INCREMENT, 
     23  `creature_id` int(11) unsigned NOT NULL default '0' COMMENT 'Creature Template Identifier', 
     24  `event_type` tinyint(5) unsigned NOT NULL default '0' COMMENT 'Event Type', 
     25  `event_inverse_phase_mask` int(11) signed NOT NULL default '0' COMMENT 'Mask which phases this event will not trigger in', 
     26  `event_chance` int(3) unsigned NOT NULL default '100', 
     27  `event_flags` int(3) unsigned NOT NULL default '0', 
     28  `event_param1` int(11) signed NOT NULL default '0', 
     29  `event_param2` int(11) signed NOT NULL default '0', 
     30  `event_param3` int(11) signed NOT NULL default '0', 
     31  `event_param4` int(11) signed NOT NULL default '0', 
     32  `action1_type` tinyint(5) unsigned NOT NULL default '0' COMMENT 'Action Type', 
     33  `action1_param1` int(11) signed NOT NULL default '0', 
     34  `action1_param2` int(11) signed NOT NULL default '0', 
     35  `action1_param3` int(11) signed NOT NULL default '0', 
     36  `action2_type` tinyint(5) unsigned NOT NULL default '0' COMMENT 'Action Type', 
     37  `action2_param1` int(11) signed NOT NULL default '0', 
     38  `action2_param2` int(11) signed NOT NULL default '0', 
     39  `action2_param3` int(11) signed NOT NULL default '0', 
     40  `action3_type` tinyint(5) unsigned NOT NULL default '0' COMMENT 'Action Type', 
     41  `action3_param1` int(11) signed NOT NULL default '0', 
     42  `action3_param2` int(11) signed NOT NULL default '0', 
     43  `action3_param3` int(11) signed NOT NULL default '0', 
     44  `comment` varchar(255) NOT NULL default '' COMMENT 'Event Comment', 
     45  PRIMARY KEY (`id`) 
     46) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='EventAI Scripts'; 
    547 
    6 `event_type` tinyint(5) unsigned NOT NULL default '0' COMMENT 'Event Type', 
    7 `event_inverse_phase_mask` int(11) signed NOT NULL default '0' COMMENT 'Mask which phases this event will not trigger in', 
    8 `event_chance` int(3) unsigned NOT NULL default '100', 
    9 `event_flags` int(3) unsigned NOT NULL default '0', 
    10 `event_param1` int(11) signed NOT NULL default '0', 
    11 `event_param2` int(11) signed NOT NULL default '0', 
    12 `event_param3` int(11) signed NOT NULL default '0', 
    13 `event_param4` int(11) signed NOT NULL default '0', 
    14  
    15 `action1_type` tinyint(5) unsigned NOT NULL default '0' COMMENT 'Action Type', 
    16 `action1_param1` int(11) signed NOT NULL default '0', 
    17 `action1_param2` int(11) signed NOT NULL default '0', 
    18 `action1_param3` int(11) signed NOT NULL default '0', 
    19  
    20 `action2_type` tinyint(5) unsigned NOT NULL default '0' COMMENT 'Action Type', 
    21 `action2_param1` int(11) signed NOT NULL default '0', 
    22 `action2_param2` int(11) signed NOT NULL default '0', 
    23 `action2_param3` int(11) signed NOT NULL default '0', 
    24  
    25 `action3_type` tinyint(5) unsigned NOT NULL default '0' COMMENT 'Action Type', 
    26 `action3_param1` int(11) signed NOT NULL default '0', 
    27 `action3_param2` int(11) signed NOT NULL default '0', 
    28 `action3_param3` int(11) signed NOT NULL default '0', 
    29  
    30 `comment` varchar(255) NOT NULL default '' COMMENT 'Event Comment', 
    31  
    32   PRIMARY KEY  (`id`) 
    33 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='EventAI Scripts'; 
     48DROP TABLE IF EXISTS `eventai_summons`; 
     49CREATE TABLE `eventai_summons` ( 
     50  `id` int(11) unsigned NOT NULL COMMENT 'Location Identifier' AUTO_INCREMENT, 
     51  `position_x` float NOT NULL default '0', 
     52  `position_y` float NOT NULL default '0', 
     53  `position_z` float NOT NULL default '0', 
     54  `orientation` float NOT NULL default '0', 
     55  `spawntimesecs` int(11) unsigned NOT NULL default '120', 
     56  `comment` varchar(255) NOT NULL default '' COMMENT 'Summon Comment', 
     57  PRIMARY KEY (`id`) 
     58) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='EventAI Summoning Locations'; 
    3459 
    3560DROP TABLE IF EXISTS `eventai_texts`; 
    3661CREATE TABLE `eventai_texts` ( 
    37  
    38 `id` int(11) unsigned NOT NULL default '0' COMMENT 'Identifier', 
    39 `text` varchar(255) character set utf8 NOT NULL default '',   
    40 `comment` varchar(255) character set utf8 NOT NULL default '' COMMENT 'Text Comment', 
    41  
    42 PRIMARY KEY (`id`) 
    43 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Texts used in EventAI'; 
    44  
    45 DROP TABLE IF EXISTS `eventai_localized_texts`; 
    46 CREATE TABLE `eventai_localized_texts` ( 
    47  
    48 `id` int(11) unsigned NOT NULL COMMENT 'Identifier' AUTO_INCREMENT, 
    49 `locale_1` varchar(255) NOT NULL default '', 
    50 `locale_2` varchar(255) NOT NULL default '', 
    51 `locale_3` varchar(255) NOT NULL default '', 
    52 `locale_4` varchar(255) NOT NULL default '', 
    53 `locale_5` varchar(255) NOT NULL default '', 
    54 `locale_6` varchar(255) NOT NULL default '', 
    55 `locale_7` varchar(255) NOT NULL default '', 
    56 `locale_8` varchar(255) NOT NULL default '', 
    57 `comment` varchar(255) NOT NULL default '' COMMENT 'Text Comment', 
    58  
    59 PRIMARY KEY  (`id`) 
    60 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='EventAI Localized Text'; 
    61  
    62 DROP TABLE IF EXISTS `eventai_summons`; 
    63 CREATE TABLE `eventai_summons` ( 
    64 `id` int(11) unsigned NOT NULL COMMENT 'Location Identifier' AUTO_INCREMENT, 
    65 `position_x` float NOT NULL default '0', 
    66 `position_y` float NOT NULL default '0', 
    67 `position_z` float NOT NULL default '0', 
    68 `orientation` float NOT NULL default '0', 
    69 `spawntimesecs` int(11) unsigned NOT NULL default '120', 
    70 `comment` varchar(255) NOT NULL default '' COMMENT 'Summon Comment', 
    71 PRIMARY KEY (`id`) 
    72 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='EventAI Summoning Locations'; 
     62  `entry` mediumint(8) NOT NULL, 
     63  `content_default` text NOT NULL, 
     64  `content_loc1` text, 
     65  `content_loc2` text, 
     66  `content_loc3` text, 
     67  `content_loc4` text, 
     68  `content_loc5` text, 
     69  `content_loc6` text, 
     70  `content_loc7` text, 
     71  `content_loc8` text, 
     72  `sound` mediumint(8) unsigned NOT NULL default '0', 
     73  `type` tinyint unsigned NOT NULL default '0', 
     74  `language` tinyint unsigned NOT NULL default '0', 
     75  `comment` text, 
     76  PRIMARY KEY (`entry`) 
     77) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Script Texts'; 
    7378 
    7479DROP TABLE IF EXISTS `script_texts`; 
     
    9196) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Script Texts'; 
    9297 
    93 DROP TABLE IF EXISTS `custom_texts`; 
    94 CREATE TABLE `custom_texts` ( 
    95   `entry` mediumint(8) NOT NULL, 
    96   `content_default` text NOT NULL, 
    97   `content_loc1` text, 
    98   `content_loc2` text, 
    99   `content_loc3` text, 
    100   `content_loc4` text, 
    101   `content_loc5` text, 
    102   `content_loc6` text, 
    103   `content_loc7` text, 
    104   `content_loc8` text, 
    105   `sound` mediumint(8) unsigned NOT NULL default '0', 
    106   `type` tinyint unsigned NOT NULL default '0', 
    107   `language` tinyint unsigned NOT NULL default '0', 
    108   `comment` text, 
    109   PRIMARY KEY  (`entry`) 
    110 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Custom Texts'; 
    111  
    11298DROP TABLE IF EXISTS `script_db_version`; 
    11399CREATE TABLE `script_db_version` ( 
    114 `version` varchar(255) NOT NULL default '' COMMENT 'Script Database version string' 
     100  `version` varchar(255) NOT NULL default '' COMMENT 'Script Database version string' 
    115101) ENGINE=MyISAM DEFAULT CHARSET=utf8;