Changeset 109 for trunk/src/bindings/scripts/ScriptMgr.cpp
- Timestamp:
- 11/19/08 13:36:49 (17 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
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);