Changeset 109
- Timestamp:
- 11/19/08 13:36:49 (17 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 49 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/sql/world.sql
r97 r109 570 570 `content_loc8` text, 571 571 `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', 574 574 `comment` text, 575 PRIMARY KEY 575 PRIMARY KEY (`entry`) 576 576 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Custom Texts'; 577 577 … … 691 691 DROP TABLE IF EXISTS `eventai_scripts`; 692 692 CREATE 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, 694 694 `creature_id` int(11) unsigned NOT NULL default '0' COMMENT 'Creature Template Identifier', 695 695 `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', 697 697 `event_chance` int(3) unsigned NOT NULL default '100', 698 698 `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', 703 703 `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', 707 707 `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', 711 711 `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', 715 715 `comment` varchar(255) NOT NULL default '' COMMENT 'Event Comment', 716 PRIMARY KEY 716 PRIMARY KEY (`id`) 717 717 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='EventAI Scripts'; 718 718 … … 732 732 DROP TABLE IF EXISTS `eventai_summons`; 733 733 CREATE 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, 735 735 `position_x` float NOT NULL default '0', 736 736 `position_y` float NOT NULL default '0', … … 739 739 `spawntimesecs` int(11) unsigned NOT NULL default '120', 740 740 `comment` varchar(255) NOT NULL default '' COMMENT 'Summon Comment', 741 PRIMARY KEY 741 PRIMARY KEY (`id`) 742 742 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='EventAI Summoning Locations'; 743 743 … … 757 757 DROP TABLE IF EXISTS `eventai_texts`; 758 758 CREATE 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'; 764 775 765 776 -- … … 770 781 /*!40000 ALTER TABLE `eventai_texts` DISABLE KEYS */; 771 782 /*!40000 ALTER TABLE `eventai_texts` ENABLE KEYS */; 783 UNLOCK TABLES; 784 785 -- 786 -- Table structure for table `script_texts` 787 -- 788 789 DROP TABLE IF EXISTS `script_texts`; 790 CREATE 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 812 LOCK TABLES `eventai_texts` WRITE; 813 /*!40000 ALTER TABLE `script_texts` DISABLE KEYS */; 814 /*!40000 ALTER TABLE `script_texts` ENABLE KEYS */; 772 815 UNLOCK TABLES; 773 816 -
trunk/src/bindings/scripts/ScriptMgr.cpp
r105 r109 23 23 DatabaseType TScriptDB; 24 24 Config TScriptConfig; 25 uint32 Locale;26 25 27 26 // String text additional data, used in TextMap … … 44 43 }; 45 44 46 #define TEXT_SOURCE_RANGE -100000 45 #define TEXT_SOURCE_RANGE -1000000 //the amount of entries each text source has available 47 46 48 47 // Text Maps 49 HM_NAMESPACE::hash_map<uint32, std::string> EventAI_Text_Map;50 48 HM_NAMESPACE::hash_map<int32, StringTextData> TextMap; 51 49 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 64 51 //*** End Global data *** 65 52 66 53 //*** EventAI data *** 67 HM_NAMESPACE::hash_map<uint32, Localized_Text> EventAI_LocalizedTextMap;68 69 54 //Event AI structure. Used exclusivly by mob_event_ai.cpp (60 bytes each) 70 55 std::list<EventAI_Event> EventAI_Event_List; … … 605 590 char const* dbstring = NULL; 606 591 607 if (!TScriptConfig.GetString("WorldDatabaseInfo", &dbstring) )592 if (!TScriptConfig.GetString("WorldDatabaseInfo", &dbstring) ) 608 593 { 609 594 error_log("TSCR: Missing world database info from configuration file. Load database aborted."); … … 612 597 613 598 //Initialize connection to DB 614 if (dbstring && TScriptDB.Initialize(dbstring) )599 if (dbstring && TScriptDB.Initialize(dbstring) ) 615 600 outstring_log("TSCR: TrinityScript database: %s",dbstring); 616 601 else … … 642 627 TextMap.clear(); 643 628 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..."); 654 637 if (result) 655 638 { … … 670 653 if (i >= 0) 671 654 { 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 { 672 719 error_db_log("TSCR: Entry %i in table `script_texts` is not a negative value.",i); 673 720 continue; … … 710 757 // Load Custom Text 711 758 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)); 713 760 714 761 // Gather Additional data from Custom Texts … … 772 819 } 773 820 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 864 822 result = TScriptDB.PQuery("SELECT id, position_x, position_y, position_z, orientation, spawntimesecs FROM eventai_summons"); 865 823 … … 867 825 EventAI_Summon_Map.clear(); 868 826 869 outstring_log("TSCR: Loading EventAI _Summons...");827 outstring_log("TSCR: Loading EventAI Summons..."); 870 828 if (result) 871 829 { … … 915 873 EventAI_Event_List.clear(); 916 874 917 outstring_log("TSCR: Loading EventAI _Scripts...");875 outstring_log("TSCR: Loading EventAI scripts..."); 918 876 if (result) 919 877 { … … 1055 1013 switch (temp.action[j].type) 1056 1014 { 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 } 1062 1039 break; 1063 1040 … … 1067 1044 break; 1068 1045 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;*/ 1077 1056 1078 1057 case ACTION_T_CAST: … … 1153 1132 break; 1154 1133 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 1155 1142 default: 1156 1143 if (temp.action[j].type >= ACTION_T_END) … … 1223 1210 else outstring_log("TSCR: Using configuration file %s",_TRINITY_SCRIPT_CONFIG); 1224 1211 1225 //Locale1226 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 1236 1212 EAI_ErrorLevel = TScriptConfig.GetIntDefault("EAIErrorLevel", 1); 1237 1213 1238 1214 switch (EAI_ErrorLevel) 1239 1215 { 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; 1253 1229 } 1254 1230 … … 1795 1771 1796 1772 //********************************* 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 *** 1879 1774 1880 1775 void DoScriptText(int32 textEntry, WorldObject* pSource, Unit* target) … … 1888 1783 if (textEntry >= 0) 1889 1784 { 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); 1891 1786 return; 1892 1787 } … … 1896 1791 if (i == TextMap.end()) 1897 1792 { 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); 1899 1794 return; 1900 1795 } 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); 1901 1798 1902 1799 if((*i).second.SoundId) … … 1939 1836 } 1940 1837 1838 //********************************* 1839 //*** Functions used internally *** 1840 1941 1841 Script* GetScriptByName(std::string Name) 1942 1842 { 1943 if (Name.empty())1843 if (Name.empty()) 1944 1844 return NULL; 1945 1845 1946 1846 for(int i=0;i<MAX_SCRIPTS;i++) 1947 1847 { 1948 if ( m_scripts[i] && m_scripts[i]->Name == Name)1848 if (m_scripts[i] && m_scripts[i]->Name == Name) 1949 1849 return m_scripts[i]; 1950 1850 } … … 1959 1859 { 1960 1860 Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); 1961 if (!tmpscript || !tmpscript->pGossipHello) return false;1861 if (!tmpscript || !tmpscript->pGossipHello) return false; 1962 1862 1963 1863 player->PlayerTalkClass->ClearMenus(); … … 1971 1871 1972 1872 Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); 1973 if (!tmpscript || !tmpscript->pGossipSelect) return false;1873 if (!tmpscript || !tmpscript->pGossipSelect) return false; 1974 1874 1975 1875 player->PlayerTalkClass->ClearMenus(); … … 1983 1883 1984 1884 Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); 1985 if (!tmpscript || !tmpscript->pGossipSelectWithCode) return false;1885 if (!tmpscript || !tmpscript->pGossipSelectWithCode) return false; 1986 1886 1987 1887 player->PlayerTalkClass->ClearMenus(); … … 1993 1893 { 1994 1894 Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); 1995 if (!tmpscript || !tmpscript->pQuestAccept) return false;1895 if (!tmpscript || !tmpscript->pQuestAccept) return false; 1996 1896 1997 1897 player->PlayerTalkClass->ClearMenus(); … … 2003 1903 { 2004 1904 Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); 2005 if (!tmpscript || !tmpscript->pQuestSelect) return false;1905 if (!tmpscript || !tmpscript->pQuestSelect) return false; 2006 1906 2007 1907 player->PlayerTalkClass->ClearMenus(); … … 2013 1913 { 2014 1914 Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); 2015 if (!tmpscript || !tmpscript->pQuestComplete) return false;1915 if (!tmpscript || !tmpscript->pQuestComplete) return false; 2016 1916 2017 1917 player->PlayerTalkClass->ClearMenus(); … … 2023 1923 { 2024 1924 Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); 2025 if (!tmpscript || !tmpscript->pChooseReward) return false;1925 if (!tmpscript || !tmpscript->pChooseReward) return false; 2026 1926 2027 1927 player->PlayerTalkClass->ClearMenus(); … … 2033 1933 { 2034 1934 Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); 2035 if (!tmpscript || !tmpscript->pNPCDialogStatus) return 100;1935 if (!tmpscript || !tmpscript->pNPCDialogStatus) return 100; 2036 1936 2037 1937 player->PlayerTalkClass->ClearMenus(); … … 2053 1953 { 2054 1954 Script *tmpscript = GetScriptByName(_Item->GetProto()->ScriptName); 2055 if (!tmpscript || !tmpscript->pItemHello) return false;1955 if (!tmpscript || !tmpscript->pItemHello) return false; 2056 1956 2057 1957 player->PlayerTalkClass->ClearMenus(); … … 2063 1963 { 2064 1964 Script *tmpscript = GetScriptByName(_Item->GetProto()->ScriptName); 2065 if (!tmpscript || !tmpscript->pItemQuestAccept) return false;1965 if (!tmpscript || !tmpscript->pItemQuestAccept) return false; 2066 1966 2067 1967 player->PlayerTalkClass->ClearMenus(); … … 2073 1973 { 2074 1974 Script *tmpscript = GetScriptByName(_GO->GetGOInfo()->ScriptName); 2075 if (!tmpscript || !tmpscript->pGOHello) return false;1975 if (!tmpscript || !tmpscript->pGOHello) return false; 2076 1976 2077 1977 player->PlayerTalkClass->ClearMenus(); … … 2083 1983 { 2084 1984 Script *tmpscript = GetScriptByName(_GO->GetGOInfo()->ScriptName); 2085 if (!tmpscript || !tmpscript->pGOQuestAccept) return false;1985 if (!tmpscript || !tmpscript->pGOQuestAccept) return false; 2086 1986 2087 1987 player->PlayerTalkClass->ClearMenus(); … … 2093 1993 { 2094 1994 Script *tmpscript = GetScriptByName(_GO->GetGOInfo()->ScriptName); 2095 if (!tmpscript || !tmpscript->pGOChooseReward) return false;1995 if (!tmpscript || !tmpscript->pGOChooseReward) return false; 2096 1996 2097 1997 player->PlayerTalkClass->ClearMenus(); … … 2105 2005 2106 2006 tmpscript = GetScriptByName(GetAreaTriggerScriptNameById(atEntry->id)); 2107 if (!tmpscript || !tmpscript->pAreaTrigger) return false;2007 if (!tmpscript || !tmpscript->pAreaTrigger) return false; 2108 2008 2109 2009 return tmpscript->pAreaTrigger(player, atEntry); … … 2115 2015 Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); 2116 2016 2117 if (!tmpscript || !tmpscript->GetAI) return NULL;2017 if (!tmpscript || !tmpscript->GetAI) return NULL; 2118 2018 return tmpscript->GetAI(_Creature); 2119 2019 } … … 2123 2023 { 2124 2024 Script *tmpscript = GetScriptByName(_Item->GetProto()->ScriptName); 2125 if (!tmpscript || !tmpscript->pItemUse) return false;2025 if (!tmpscript || !tmpscript->pItemUse) return false; 2126 2026 2127 2027 return tmpscript->pItemUse(player,_Item,targets); … … 2132 2032 { 2133 2033 Script *tmpscript = GetScriptByName(_Creature->GetScriptName()); 2134 if (!tmpscript || !tmpscript->pReceiveEmote) return false;2034 if (!tmpscript || !tmpscript->pReceiveEmote) return false; 2135 2035 2136 2036 return tmpscript->pReceiveEmote(player, _Creature, emote); … … 2142 2042 Script *tmpscript = NULL; 2143 2043 2144 if (!map->IsDungeon()) return false;2044 if (!map->IsDungeon()) return false; 2145 2045 2146 2046 tmpscript = GetScriptByName(((InstanceMap*)map)->GetScript()); 2147 if (!tmpscript || !tmpscript->GetInstanceData) return false;2047 if (!tmpscript || !tmpscript->GetInstanceData) return false; 2148 2048 2149 2049 return tmpscript->GetInstanceData(map); -
trunk/src/bindings/scripts/ScriptMgr.h
r44 r109 66 66 extern Script *m_scripts[MAX_SCRIPTS]; 67 67 68 // Localized Text function69 const char* GetEventAILocalizedText(uint32 entry);70 71 //EventAI text function72 const char* GetEventAIText(uint32 entry); // TODO: Locales73 74 68 //Generic scripting text function 75 69 void DoScriptText(int32 textEntry, WorldObject* pSource, Unit* target = NULL); -
trunk/src/bindings/scripts/docs/EventAI.txt
r37 r109 83 83 (# Internal Name Param usage Discription) 84 84 0 ACTION_T_NONE No Action Does Nothing 85 1 ACTION_T_ SAY TextId Says Text86 2 ACTION_T_YELL TextId Yells Text87 3 ACTION_T_TEXTEMOTE TextId Text Emotes Text85 1 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. 86 2 ACTION_T_YELL UNUSED 87 3 ACTION_T_TEXTEMOTE UNUSED 88 88 4 ACTION_T_SOUND SoundId Plays Sound 89 89 5 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*90 6 ACTION_T_RANDOM_SAY UNUSED 91 7 ACTION_T_RANDOM_YELL UNUSED 92 8 ACTION_T_RANDOM_TEXTEMOTE UNUSED 93 93 9 ACTION_T_RANDOM_SOUND SoundId1, SoundId2, SoundId3 Plays random sound between 3 params* 94 94 10 ACTION_T_RANDOM_EMOTE EmoteId1, EmoteId2, EmoteId3 Emotes random emote between 3 params … … 312 312 313 313 ----------------- 314 1 = ACTION_T_ SAY:314 1 = ACTION_T_TEXT: 315 315 ----------------- 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). 316 Parameter 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 321 Parameter 2: Optional. TextId can be defined in addition. The same apply to this as explained above, however eventAI will randomize between the two. 322 Parameter 3: Optional, if Parameter 2 exist. In this case, eventAI will randomize between three. 319 323 320 324 ------------------ 321 325 2 = ACTION_T_YELL: 322 326 ------------------ 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). 327 UNUSED Can be reused to create new action type 326 328 327 329 ----------------------- 328 330 3 = ACTION_T_TEXTEMOTE: 329 331 ----------------------- 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). 332 UNUSED Can be reused to create new action type 334 333 335 334 ------------------- … … 352 351 6 = ACTION_T_RANDOM_SAY: 353 352 ------------------------ 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. 353 UNUSED Can be reused to create new action type 362 354 363 355 ------------------------- 364 356 7 = ACTION_T_RANDOM_YELL: 365 357 ------------------------- 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. 358 UNUSED Can be reused to create new action type 371 359 372 360 ------------------------------ 373 361 8 = ACTION_T_RANDOM_TEXTEMOTE: 374 362 ------------------------------ 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. 363 UNUSED Can be reused to create new action type 380 364 381 365 -------------------------- -
trunk/src/bindings/scripts/include/sc_creature.cpp
r106 r109 12 12 // Spell summary for ScriptedAI::SelectSpell 13 13 struct TSpellSummary { 14 uint8 Targets; // set of enum SelectTarget15 uint8 Effects; // set of enum SelectEffect14 uint8 Targets; // set of enum SelectTarget 15 uint8 Effects; // set of enum SelectEffect 16 16 } *SpellSummary; 17 17 … … 26 26 void ScriptedAI::MoveInLineOfSight(Unit *who) 27 27 { 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)) 29 29 { 30 30 if (!m_creature->canFly() && m_creature->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) … … 32 32 33 33 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 { 37 36 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 42 void ScriptedAI::AttackStart(Unit* who, bool melee) 49 43 { 50 44 if (!who) 51 45 return; 52 46 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); 57 52 58 53 if (!InCombat) … … 61 56 Aggro(who); 62 57 } 58 59 if(melee) 60 DoStartMovement(who); 61 else 62 DoStartNoMovement(who); 63 } 64 } 65 66 void 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); 63 84 } 64 85 } … … 67 88 { 68 89 //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() ) 72 93 { 73 94 //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)) 75 96 { 76 97 m_creature->AttackerStateUpdate(m_creature->getVictim()); … … 89 110 m_creature->LoadCreaturesAddon(); 90 111 91 if ( m_creature->isAlive())112 if (m_creature->isAlive()) 92 113 m_creature->GetMotionMaster()->MoveTargetedHome(); 93 114 … … 104 125 } 105 126 106 void ScriptedAI::DoStart AttackAndMovement(Unit* victim, float distance, float angle)127 void ScriptedAI::DoStartMovement(Unit* victim, float distance, float angle) 107 128 { 108 129 if (!victim) 109 130 return; 110 131 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 135 void ScriptedAI::DoStartNoMovement(Unit* victim) 119 136 { 120 137 if (!victim) 121 138 return; 122 139 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(); 127 142 } 128 143 … … 131 146 { 132 147 //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)) 134 149 { 135 150 //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)) 137 152 { 138 153 m_creature->AttackerStateUpdate(m_creature->getVictim()); … … 144 159 void ScriptedAI::DoStopAttack() 145 160 { 146 if ( m_creature->getVictim() != NULL)161 if (m_creature->getVictim() != NULL) 147 162 { 148 163 m_creature->AttackStop(); … … 170 185 void ScriptedAI::DoSay(const char* text, uint32 language, Unit* target) 171 186 { 172 if (target) m_creature->Say(text, language, target->GetGUID());187 if (target) m_creature->Say(text, language, target->GetGUID()); 173 188 else m_creature->Say(text, language, 0); 174 189 } … … 176 191 void ScriptedAI::DoYell(const char* text, uint32 language, Unit* target) 177 192 { 178 if (target) m_creature->Yell(text, language, target->GetGUID());193 if (target) m_creature->Yell(text, language, target->GetGUID()); 179 194 else m_creature->Yell(text, language, 0); 180 195 } … … 182 197 void ScriptedAI::DoTextEmote(const char* text, Unit* target, bool IsBossEmote) 183 198 { 184 if (target) m_creature->TextEmote(text, target->GetGUID(), IsBossEmote);199 if (target) m_creature->TextEmote(text, target->GetGUID(), IsBossEmote); 185 200 else m_creature->TextEmote(text, 0, IsBossEmote); 186 201 } … … 205 220 } 206 221 207 unit->SendPlaySound(sound, false); 222 WorldPacket data(4); 223 data.SetOpcode(SMSG_PLAY_SOUND); 224 data << uint32(sound); 225 unit->SendMessageToSet(&data,false); 208 226 } 209 227 … … 462 480 { 463 481 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 464 483 return; 465 484 }*/ … … 580 599 if( m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who) ) 581 600 { 582 DoStartAttackNoMovement(who);583 601 who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); 584 585 if (!InCombat) 586 { 587 InCombat = true; 588 Aggro(who); 589 } 602 AttackStart(who); 590 603 } 591 604 } … … 597 610 return; 598 611 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); 603 617 604 618 if (!InCombat) … … 607 621 Aggro(who); 608 622 } 609 } 610 } 623 624 DoStartNoMovement(who); 625 } 626 } -
trunk/src/bindings/scripts/include/sc_creature.h
r55 r109 26 26 //Called at each attack of m_creature by any victim 27 27 void AttackStart(Unit *); 28 void AttackStart(Unit *, bool melee); 28 29 29 30 //Called at stoping attack by any attacker … … 90 91 //************* 91 92 92 //Start attack of victim and go to him93 void DoStart AttackAndMovement(Unit* victim, float distance = 0, float angle = 0);93 //Start movement toward victim 94 void DoStartMovement(Unit* victim, float distance = 0, float angle = 0); 94 95 95 //Start attack on victim but do not move96 void DoStart AttackNoMovement(Unit* victim);96 //Start no movement on victim 97 void DoStartNoMovement(Unit* victim); 97 98 98 99 //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 524 524 switch (type) 525 525 { 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 } 534 579 break; 535 580 case ACTION_T_SOUND: … … 538 583 case ACTION_T_EMOTE: 539 584 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 }564 585 break; 565 586 case ACTION_T_RANDOM_SOUND: -
trunk/src/bindings/scripts/scripts/creature/mob_event_ai.h
r90 r109 31 31 EVENT_T_QUEST_ACCEPT = 19, //QuestID 32 32 EVENT_T_QUEST_COMPLETE = 20, // 33 33 34 34 EVENT_T_END, 35 35 }; … … 38 38 { 39 39 ACTION_T_NONE = 0, //No action 40 ACTION_T_ SAY = 1, //TextId41 ACTION_T_YELL = 2, // TextId42 ACTION_T_TEXTEMOTE = 3, // TextId40 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 43 43 ACTION_T_SOUND = 4, //SoundId 44 44 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 48 48 ACTION_T_RANDOM_SOUND = 9, //SoundId1, SoundId2, SoundId3 (-1 in any field means no output if randomed that field) 49 49 ACTION_T_RANDOM_EMOTE = 10, //EmoteId1, EmoteId2, EmoteId3 (-1 in any field means no output if randomed that field) … … 209 209 210 210 //Error prevention list 211 extern HM_NAMESPACE::hash_map<uint32, EventAI_CreatureError> EventAI_CreatureErrorPreventionList; 211 extern HM_NAMESPACE::hash_map<uint32, EventAI_CreatureError> EventAI_CreatureErrorPreventionList; 212 212 213 213 //Defines -
trunk/src/bindings/scripts/scripts/guard/guards.cpp
r90 r109 530 530 } 531 531 } 532 DoStart AttackAndMovement(who);532 DoStartMovement(who); 533 533 } 534 534 } -
trunk/src/bindings/scripts/scripts/zone/aunchindoun/auchenai_crypts/boss_exarch_maladaar.cpp
r90 r109 198 198 if( m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who) ) 199 199 { 200 DoStartAttackAndMovement(who);201 200 who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); 202 203 if (!InCombat) 204 { 205 InCombat = true; 206 Aggro(who); 207 } 201 AttackStart(who); 208 202 } 209 203 } -
trunk/src/bindings/scripts/scripts/zone/aunchindoun/mana_tombs/boss_nexusprince_shaffar.cpp
r90 r109 102 102 if( m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who) ) 103 103 { 104 DoStartAttackAndMovement(who);105 104 who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); 106 107 if (!InCombat) 108 { 109 InCombat = true; 110 Aggro(who); 111 } 105 AttackStart(who); 112 106 } 113 107 } -
trunk/src/bindings/scripts/scripts/zone/aunchindoun/sethekk_halls/boss_tailonking_ikiss.cpp
r90 r109 111 111 if( m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who) ) 112 112 { 113 DoStartAttackAndMovement(who);114 113 who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); 115 116 if (!InCombat) 117 { 118 InCombat = true; 119 Aggro(who); 120 } 114 AttackStart(who); 121 115 } 122 116 } -
trunk/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/boss_grandmaster_vorpil.cpp
r90 r109 215 215 who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); 216 216 217 DoStartAttackAndMovement(who); 218 Aggro(who); 217 AttackStart(who); 219 218 } 220 219 } -
trunk/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/boss_murmur.cpp
r90 r109 33 33 #define SPELL_SHOCKWAVE 33686 34 34 35 struct TRINITY_DLL_DECL boss_murmurAI : public Scripted AI35 struct TRINITY_DLL_DECL boss_murmurAI : public Scripted_NoMovementAI 36 36 { 37 boss_murmurAI(Creature *c) : Scripted AI(c) {Reset();}37 boss_murmurAI(Creature *c) : Scripted_NoMovementAI(c) {Reset();} 38 38 39 39 uint32 SonicBoom_Timer; … … 62 62 63 63 void Aggro(Unit *who) { } 64 65 void AttackStart(Unit* who)66 {67 if (!who)68 return;69 70 if (who->isTargetableForAttack())71 {72 //Begin attack73 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 }104 64 105 65 void UpdateAI(const uint32 diff) -
trunk/src/bindings/scripts/scripts/zone/black_temple/boss_illidan.cpp
r108 r109 442 442 return; 443 443 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); 457 448 } 458 449 … … 1511 1502 return; 1512 1503 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); 1533 1515 } 1534 1516 -
trunk/src/bindings/scripts/scripts/zone/black_temple/boss_shade_of_akama.cpp
r90 r109 261 261 262 262 if(who->isTargetableForAttack() && who != m_creature) 263 DoStart AttackAndMovement(who);263 DoStartMovement(who); 264 264 } 265 265 -
trunk/src/bindings/scripts/scripts/zone/blackwing_lair/boss_vaelastrasz.cpp
r90 r109 120 120 //Speach 121 121 if (DoingSpeach) 122 { 122 123 if (SpeachTimer < diff) 123 {124 switch (SpeachNum)125 124 { 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 } 157 155 158 156 //Return since we have no target -
trunk/src/bindings/scripts/scripts/zone/blades_edge_mountains/blades_edge_mountains.cpp
r90 r109 295 295 if (m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who)) 296 296 { 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); 302 299 } 303 300 } -
trunk/src/bindings/scripts/scripts/zone/burning_steppes/burning_steppes.cpp
r90 r109 57 57 if( m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who) ) 58 58 { 59 DoStartAttackAndMovement(who);60 59 who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); 61 62 if (!InCombat) 63 { 64 InCombat = true; 65 Aggro(who); 66 } 60 AttackStart(who); 67 61 } 68 62 } -
trunk/src/bindings/scripts/scripts/zone/caverns_of_time/dark_portal/boss_temporus.cpp
r90 r109 109 109 if (m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who)) 110 110 { 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); 120 113 } 121 114 } -
trunk/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_fathomlord_karathress.cpp
r90 r109 198 198 if(target) 199 199 { 200 DoStartAttackAndMovement(target); 201 200 AttackStart(target); 202 201 GetAdvisors(); 203 204 DoPlaySoundToSet(m_creature, SOUND_AGGRO);205 DoYell(SAY_AGGRO, LANG_UNIVERSAL, NULL);206 202 } 207 203 } … … 295 291 if(target) 296 292 { 297 DoStartAttackAndMovement(target);293 AttackStart(target); 298 294 } 299 295 } … … 376 372 if(target) 377 373 { 378 DoStartAttackAndMovement(target);374 AttackStart(target); 379 375 } 380 376 } … … 454 450 if(target) 455 451 { 456 DoStartAttackAndMovement(target);452 AttackStart(target); 457 453 } 458 454 } -
trunk/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_lady_vashj.cpp
r90 r109 238 238 //Begin melee attack if we are within range 239 239 if(Phase != 2) 240 DoStart AttackAndMovement(who);240 DoStartMovement(who); 241 241 242 242 StartEvent(); -
trunk/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_morogrim_tidewalker.cpp
r90 r109 352 352 { 353 353 //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); 358 356 } 359 357 } -
trunk/src/bindings/scripts/scripts/zone/gruuls_lair/boss_high_king_maulgar.cpp
r106 r109 189 189 190 190 191 void Aggro(Unit *who) { StartEvent(who); } 191 void Aggro(Unit *who) 192 { 193 StartEvent(who); 194 } 192 195 193 196 void GetCouncil() … … 225 228 if(target) 226 229 { 227 DoStartAttackAndMovement(target); 228 230 AttackStart(target); 229 231 GetCouncil(); 230 231 DoPlaySoundToSet(m_creature, SOUND_AGGRO);232 232 } 233 233 } … … 284 284 Unit* target = NULL; 285 285 target = SelectUnit(SELECT_TARGET_RANDOM, 0); 286 if (target)287 DoStartAttackAndMovement(target);286 if (target) 287 AttackStart(target); 288 288 DoCast(target, SPELL_BERSERKER_C); 289 289 … … 359 359 if(target) 360 360 { 361 DoStartAttackAndMovement(target);361 AttackStart(target); 362 362 } 363 363 } … … 466 466 if(!InCombat) 467 467 { 468 DoStartAttackAndMovement(who);468 AttackStart(who); 469 469 if(pInstance) 470 470 { … … 486 486 if(target) 487 487 { 488 DoStartAttackAndMovement(target);488 AttackStart(target); 489 489 } 490 490 } … … 596 596 if(!InCombat) 597 597 { 598 DoStartAttackAndMovement(who);598 AttackStart(who); 599 599 if(pInstance) 600 600 { … … 616 616 if(target) 617 617 { 618 DoStartAttackAndMovement(target);618 AttackStart(target); 619 619 } 620 620 } … … 710 710 if(!InCombat) 711 711 { 712 DoStartAttackAndMovement(who);712 AttackStart(who); 713 713 if(pInstance) 714 714 { … … 730 730 if(target) 731 731 { 732 DoStartAttackAndMovement(target);732 AttackStart(target); 733 733 } 734 734 } -
trunk/src/bindings/scripts/scripts/zone/hellfire_citadel/hellfire_ramparts/boss_omor_the_unscarred.cpp
r90 r109 55 55 #define SOUND_WIPE 10283 56 56 57 struct TRINITY_DLL_DECL boss_omor_the_unscarredAI : public Scripted AI57 struct TRINITY_DLL_DECL boss_omor_the_unscarredAI : public Scripted_NoMovementAI 58 58 { 59 boss_omor_the_unscarredAI(Creature *c) : Scripted AI(c) {Reset();}59 boss_omor_the_unscarredAI(Creature *c) : Scripted_NoMovementAI(c) {Reset();} 60 60 61 61 uint32 OrbitalStrike_Timer; … … 104 104 DoPlaySoundToSet(m_creature,SOUND_AGGRO_3); 105 105 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 }145 106 } 146 107 } -
trunk/src/bindings/scripts/scripts/zone/hellfire_citadel/hellfire_ramparts/boss_watchkeeper_gargolmar.cpp
r90 r109 104 104 if(m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who)) 105 105 { 106 DoStartAttackAndMovement(who);107 106 who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); 108 109 if (!InCombat) 110 { 111 InCombat = true; 112 Aggro(who); 113 } 107 AttackStart(who); 114 108 } 115 109 else if (!HasTaunted && m_creature->IsWithinDistInMap(who, 60.0f)) -
trunk/src/bindings/scripts/scripts/zone/hellfire_citadel/shattered_halls/boss_nethekurse.cpp
r90 r109 194 194 return; 195 195 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) 202 203 { 203 204 InCombat = true; 204 205 Aggro(who); 205 206 } 207 208 if (Phase) DoStartNoMovement(who); 209 else DoStartMovement(who); 206 210 } 207 211 } … … 231 235 if( m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who) ) 232 236 { 233 if( Phase ) DoStartAttackNoMovement(who);234 else DoStartAttackAndMovement(who);235 236 237 who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); 237 238 if( !InCombat ) 239 { 240 InCombat = true; 241 Aggro(who); 242 } 238 AttackStart(who); 243 239 } 244 240 } -
trunk/src/bindings/scripts/scripts/zone/karazhan/boss_moroes.cpp
r90 r109 17 17 /* ScriptData 18 18 SDName: Boss_Moroes 19 SD%Complete: 10019 SD%Complete: 95 20 20 SDComment: 21 21 SDCategory: Karazhan … … 46 46 #define SOUND_DEATH 9213 47 47 48 #define SPELL_VANISH 2 469948 #define SPELL_VANISH 29448 49 49 #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 55 54 #define POS_Z 81.73 56 55 57 float Locations[4][ 2]=58 { 59 {-109 76.2793, -1878.1736},60 {-109 79.7587, -1877.8706},61 {-109 85.6650, -1877.2458},62 {-109 89.1367, -1876.8309},56 float 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}, 63 62 }; 64 63 … … 160 159 DoPlaySoundToSet(m_creature, SOUND_DEATH); 161 160 162 if (pInstance)161 if (pInstance) 163 162 pInstance->SetData(DATA_MOROES_EVENT, DONE); 164 163 … … 169 168 { 170 169 Unit* pUnit = Unit::GetUnit((*m_creature), guid); 171 if (pUnit)172 { 173 if (!pUnit->isAlive())170 if (pUnit) 171 { 172 if (!pUnit->isAlive()) 174 173 return 1; // Exists but is dead 175 174 else 176 175 return 2; // Exists and is alive 177 176 } 178 179 177 return 0; // Does not exist 180 178 } … … 184 182 Creature *pCreature = NULL; 185 183 186 if (FirstTime)184 if (FirstTime) 187 185 { 188 186 std::vector<uint32> AddList; … … 199 197 uint32 entry = *itr; 200 198 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) 203 201 { 204 202 AddGUID[i] = pCreature->GetGUID(); … … 217 215 { 218 216 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) 221 219 AddGUID[i] = pCreature->GetGUID(); 222 220 break; 223 221 case 1: 224 222 pCreature = ((Creature*)Unit::GetUnit((*m_creature), AddGUID[i])); 225 if (pCreature)223 if (pCreature) 226 224 { 227 225 pCreature->Respawn(); … … 231 229 case 2: 232 230 pCreature = ((Creature*)Unit::GetUnit((*m_creature), AddGUID[i])); 233 if (!pCreature->IsInEvadeMode())231 if (!pCreature->IsInEvadeMode()) 234 232 pCreature->AI()->EnterEvadeMode(); 235 233 break; … … 244 242 { 245 243 Unit* Temp = NULL; 246 if (AddGUID[i])244 if (AddGUID[i]) 247 245 { 248 246 Temp = Unit::GetUnit((*m_creature),AddGUID[i]); 249 if (Temp && Temp->isAlive())247 if (Temp && Temp->isAlive()) 250 248 Temp->DealDamage(Temp, Temp->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); 251 249 } … … 258 256 { 259 257 Unit* Temp = NULL; 260 if (AddGUID[i])258 if (AddGUID[i]) 261 259 { 262 260 Temp = Unit::GetUnit((*m_creature),AddGUID[i]); 263 if (Temp && Temp->isAlive())261 if (Temp && Temp->isAlive()) 264 262 ((Creature*)Temp)->AI()->AttackStart(m_creature->getVictim()); 265 263 else … … 279 277 if(!Enrage && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 30) 280 278 { 281 DoCast(m_creature, SPELL_ ENRAGE);279 DoCast(m_creature, SPELL_FRENZY); 282 280 Enrage = true; 283 281 } 284 282 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) 288 286 { 289 287 Unit* Temp = NULL; 290 if (AddGUID[i])288 if (AddGUID[i]) 291 289 { 292 290 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() ) 295 293 ((Creature*)Temp)->AI()->AttackStart(m_creature->getVictim()); 296 294 } … … 299 297 }else CheckAdds_Timer -= diff; 300 298 301 //Cast Vanish, then Garrote random victim302 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) 318 316 { 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); 327 364 } 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) 375 376 DoMeleeAttackIfReady(); 376 377 } -
trunk/src/bindings/scripts/scripts/zone/karazhan/boss_terestian_illhoof.cpp
r90 r109 17 17 /* ScriptData 18 18 SDName: Boss_Terestian_Illhoof 19 SD%Complete: 10020 SDComment: Complete! 19 SD%Complete: 95 20 SDComment: Complete! Needs adjustments to use spell though. 21 21 SDCategory: Karazhan 22 22 EndScriptData */ … … 32 32 #define SPELL_BERSERK 32965 // Increases attack speed by 75%. Periodically casts Shadow Bolt Volley. 33 33 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 34 39 #define SPELL_FIREBOLT 18086 // Blasts a target for 150 Fire damage. 35 40 … … 62 67 #define CREATURE_FIENDISHIMP 17267 63 68 #define CREATURE_PORTAL 17265 64 65 #define SACRIFICE_X -11240.59966 #define SACRIFICE_Y -1694.270067 #define SACRIFICE_Z 179.72000768 69 69 70 #define PORTAL_Z 179.434 … … 310 311 { 311 312 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); 313 314 if(Chains) 314 315 { -
trunk/src/bindings/scripts/scripts/zone/karazhan/bosses_opera.cpp
r90 r109 1125 1125 { 1126 1126 m_creature->AddThreat(Julianne->getVictim(), 1.0f); 1127 DoStartAttackAndMovement(Julianne->getVictim());1127 AttackStart(Julianne->getVictim()); 1128 1128 } 1129 1129 } -
trunk/src/bindings/scripts/scripts/zone/naxxramas/boss_anubrekhan.cpp
r90 r109 108 108 if (m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who)) 109 109 { 110 if(who->HasStealthAura())111 who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH);112 113 //Begin melee attack if we are within range114 DoStartAttackAndMovement(who);115 116 110 if (!InCombat) 117 111 { … … 132 126 } 133 127 } 128 129 who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); 130 AttackStart(who); 134 131 } 135 132 else if (!HasTaunted && m_creature->IsWithinDistInMap(who, 60.0f)) -
trunk/src/bindings/scripts/scripts/zone/naxxramas/boss_faerlina.cpp
r90 r109 98 98 if (m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who)) 99 99 { 100 if(who->HasStealthAura())101 who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH);102 103 DoStartAttackAndMovement(who);104 100 //Say our dialog on initial aggro 105 101 if (!InCombat) … … 125 121 } 126 122 } 123 124 who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); 125 AttackStart(who); 127 126 } 128 127 else if (!HasTaunted && m_creature->IsWithinDistInMap(who, 60.0f)) -
trunk/src/bindings/scripts/scripts/zone/stratholme/boss_timmy_the_cruel.cpp
r90 r109 55 55 if (m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->GetDistanceZ(who) <= CREATURE_Z_ATTACK_RANGE && m_creature->IsWithinLOSInMap(who)) 56 56 { 57 if(who->HasStealthAura())58 who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH);59 60 57 if (!HasYelled) 61 58 { … … 64 61 } 65 62 66 //Begin melee attack if we are within range67 DoStartAttackAndMovement(who);63 who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); 64 AttackStart(who); 68 65 } 69 66 } -
trunk/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_eredar_twins.cpp
r90 r109 418 418 if (!InCombat) 419 419 { 420 DoStart AttackNoMovement(who);420 DoStartNoMovement(who); 421 421 Aggro(who); 422 422 InCombat = true; … … 441 441 if (!InCombat) 442 442 { 443 DoStart AttackNoMovement(who);443 DoStartNoMovement(who); 444 444 Aggro(who); 445 445 InCombat = true; -
trunk/src/bindings/scripts/scripts/zone/tempest_keep/arcatraz/arcatraz.cpp
r90 r109 124 124 } 125 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 }145 }146 }147 148 126 void AttackStart(Unit* who) 149 127 { 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); 153 133 154 134 if (!InCombat) … … 157 137 Aggro(who); 158 138 } 139 140 //TODO: Make it so he moves when target out of range 141 DoStartNoMovement(who); 159 142 } 160 143 } -
trunk/src/bindings/scripts/scripts/zone/tempest_keep/arcatraz/boss_harbinger_skyriss.cpp
r90 r109 126 126 if( m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who) ) 127 127 { 128 DoStartAttackAndMovement(who);129 128 who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); 130 131 if (!InCombat) 132 { 133 InCombat = true; 134 Aggro(who); 135 } 129 AttackStart(who); 136 130 } 137 131 } … … 143 137 return; 144 138 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) 150 146 { 151 147 InCombat = true; 152 148 Aggro(who); 153 149 } 150 151 DoStartMovement(who); 154 152 } 155 153 } -
trunk/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/boss_alar.cpp
r90 r109 157 157 //Begin attack 158 158 if(Phase1) 159 DoStart AttackNoMovement(who);159 DoStartNoMovement(who); 160 160 else 161 DoStart AttackAndMovement(who);161 DoStartMovement(who); 162 162 163 163 if(!InCombat) -
trunk/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/boss_kaelthas.cpp
r90 r109 211 211 if(m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who) ) 212 212 { 213 DoStartAttackAndMovement(who);214 213 who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); 215 216 if (!InCombat) 217 { 218 InCombat = true; 219 Aggro(who); 220 } 214 AttackStart(who); 221 215 } 222 216 } … … 228 222 return; 229 223 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); 234 229 235 230 if (!InCombat) … … 238 233 Aggro(who); 239 234 } 235 236 DoStartMovement(who); 240 237 } 241 238 } … … 436 433 if(target) 437 434 { 438 DoStartAttackAndMovement(target);435 AttackStart(target); 439 436 } 440 437 }else … … 507 504 if (Phase >= 4 && m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who)) 508 505 { 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); 513 508 } 514 509 else if(who->isAlive()) … … 775 770 if(target) 776 771 { 777 DoStartAttackAndMovement(target);772 AttackStart(target); 778 773 } 779 774 Phase_Timer = 30000; … … 932 927 m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); 933 928 Phase = 6; 934 DoStartAttackAndMovement(m_creature->getVictim());929 AttackStart(m_creature->getVictim()); 935 930 m_creature->GetMotionMaster()->Clear(); 936 931 m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim()); … … 1038 1033 GravityLapse_Timer = 60000; 1039 1034 GravityLapse_Phase = 0; 1040 DoStartAttackAndMovement(m_creature->getVictim());1035 AttackStart(m_creature->getVictim()); 1041 1036 m_creature->GetMotionMaster()->Clear(); 1042 1037 m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim()); … … 1242 1237 return; 1243 1238 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); 1248 1244 1249 1245 if (!InCombat) … … 1252 1248 Aggro(who); 1253 1249 } 1250 1251 DoStartMovement(who, CAPERNIAN_DISTANCE, M_PI/2); 1254 1252 } 1255 1253 } -
trunk/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_bug_trio.cpp
r90 r109 178 178 DoCast(target, SPELL_CHARGE); 179 179 m_creature->SendMonsterMove(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, true,1); 180 DoStartAttackAndMovement(target);180 AttackStart(target); 181 181 } 182 182 -
trunk/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_sartura.cpp
r90 r109 81 81 target = SelectUnit(SELECT_TARGET_RANDOM,1); 82 82 if (target) 83 DoStartAttackAndMovement(target);83 AttackStart(target); 84 84 85 85 WhirlWindRandom_Timer = 3000 + rand()%4000; … … 220 220 target = SelectUnit(SELECT_TARGET_RANDOM,1); 221 221 if (target) 222 DoStartAttackAndMovement(target);222 AttackStart(target); 223 223 224 224 AggroReset = true; -
trunk/src/bindings/scripts/scripts/zone/zulaman/boss_zuljin.cpp
r90 r109 277 277 m_creature->Attack(who, false); 278 278 else 279 DoStart AttackAndMovement(who);279 DoStartMovement(who); 280 280 281 281 if (!InCombat) -
trunk/src/bindings/scripts/scripts/zone/zulgurub/boss_arlokk.cpp
r90 r109 168 168 m_creature->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 35))); 169 169 m_creature->UpdateDamagePhysical(BASE_ATTACK); 170 DoStartAttackAndMovement(target);170 AttackStart(target); 171 171 //The Panther Model 172 172 m_creature->SetUInt32Value(UNIT_FIELD_DISPLAYID,15215); -
trunk/src/bindings/scripts/scripts/zone/zulgurub/boss_grilek.cpp
r90 r109 63 63 m_creature->getThreatManager().modifyThreatPercent(m_creature->getVictim(),-50); 64 64 if (target) 65 DoStartAttackAndMovement(target);65 AttackStart(target); 66 66 67 67 Avartar_Timer = 25000 + rand()%10000; -
trunk/src/bindings/scripts/scripts/zone/zulgurub/boss_jeklik.cpp
r90 r109 110 110 m_creature->Relocate(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0); 111 111 m_creature->SendMonsterMove(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, true,1); 112 DoStartAttackAndMovement(target);112 AttackStart(target); 113 113 } 114 114 -
trunk/src/bindings/scripts/scripts/zone/zulgurub/boss_mandokir.cpp
r90 r109 143 143 DoCast(pUnit,SPELL_CHARGE); 144 144 m_creature->SendMonsterMove(pUnit->GetPositionX(), pUnit->GetPositionY(), pUnit->GetPositionZ(), 0, true,1); 145 DoStartAttackAndMovement(pUnit);145 AttackStart(pUnit); 146 146 } 147 147 } -
trunk/src/bindings/scripts/scripts/zone/zulgurub/boss_marli.cpp
r90 r109 166 166 } 167 167 if (target) 168 { 168 169 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 } 172 174 173 175 Charge_Timer = 8000; -
trunk/src/bindings/scripts/scripts/zone/zulgurub/boss_renataki.cpp
r90 r109 122 122 123 123 if (target) 124 DoStartAttackAndMovement(target);124 AttackStart(target); 125 125 126 126 Aggro_Timer = 7000 + rand()%13000; -
trunk/src/bindings/scripts/scripts/zone/zulgurub/boss_thekal.cpp
r90 r109 206 206 DoCast(target,SPELL_CHARGE); 207 207 m_creature->SendMonsterMove(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, true,1); 208 DoStartAttackAndMovement(target);209 208 DoResetThreat(); 209 AttackStart(target); 210 210 211 211 Charge_Timer = 15000 + rand()%7000; -
trunk/src/bindings/scripts/sql/scripts_structure.sql
r47 r109 1 DROP TABLE IF EXISTS `custom_texts`; 2 CREATE 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 1 20 DROP TABLE IF EXISTS `eventai_scripts`; 2 21 CREATE 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'; 5 47 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'; 48 DROP TABLE IF EXISTS `eventai_summons`; 49 CREATE 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'; 34 59 35 60 DROP TABLE IF EXISTS `eventai_texts`; 36 61 CREATE 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'; 73 78 74 79 DROP TABLE IF EXISTS `script_texts`; … … 91 96 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Script Texts'; 92 97 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 112 98 DROP TABLE IF EXISTS `script_db_version`; 113 99 CREATE 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' 115 101 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;