Changeset 272 for trunk/src/game/ObjectMgr.h
- Timestamp:
- 11/22/08 00:35:41 (17 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/game/ObjectMgr.h
r263 r272 11 11 * This program is distributed in the hope that it will be useful, 12 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 14 * GNU General Public License for more details. 15 15 * 16 16 * You should have received a copy of the GNU General Public License 17 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307USA18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 */ 20 20 … … 85 85 uint32 datalong; 86 86 uint32 datalong2; 87 int32 dataint;87 std::string datatext; 88 88 float x; 89 89 float y; … … 128 128 129 129 typedef UNORDERED_MAP<uint64/*(instance,guid) pair*/,time_t> RespawnTimes; 130 131 132 // mangos string ranges133 #define MIN_TRINITY_STRING_ID 1134 #define MAX_TRINITY_STRING_ID 2000000000135 #define MIN_DB_SCRIPT_STRING_ID MAX_TRINITY_STRING_ID136 #define MAX_DB_SCRIPT_STRING_ID 2000010000137 130 138 131 struct TrinityStringLocale … … 215 208 CONDITION_QUESTTAKEN = 9, // quest_id 0, for condition true while quest active. 216 209 CONDITION_AD_COMMISSION_AURA = 10, // 0 0, for condition true while one from AD ñommission aura active 217 218 210 CONDITION_NO_AURA = 11, // spell_id effindex 211 CONDITION_ACTIVE_EVENT = 12, // event_id 219 212 }; 220 213 … … 258 251 // NPC gossip text id 259 252 typedef UNORDERED_MAP<uint32, uint32> CacheNpcTextIdMap; 260 typedef std::list<GossipOption> CacheNpcOptionList; 253 261 254 262 255 typedef UNORDERED_MAP<uint32, VendorItemData> CacheVendorItemMap; … … 307 300 typedef UNORDERED_MAP<uint32, Quest*> QuestMap; 308 301 309 310 302 typedef UNORDERED_MAP<uint32, AreaTrigger> AreaTriggerMap; 311 303 312 typedef UNORDERED_MAP<uint32, uint32> AreaTriggerScriptMap;304 typedef UNORDERED_MAP<uint32, std::string> AreaTriggerScriptMap; 313 305 314 306 typedef UNORDERED_MAP<uint32, ReputationOnKillEntry> RepOnKillMap; … … 317 309 318 310 typedef UNORDERED_MAP<uint32, PetCreateSpellEntry> PetCreateSpellMap; 319 320 typedef std::vector<std::string> ScriptNameMap;321 311 322 312 Player* GetPlayer(const char* name) const { return ObjectAccessor::Instance().FindPlayerByName(name);} … … 487 477 AreaTrigger const* GetGoBackTrigger(uint32 Map) const; 488 478 489 uint32 GetAreaTriggerScriptId(uint32 trigger_id);479 const char* GetAreaTriggerScriptName(uint32 id); 490 480 491 481 ReputationOnKillEntry const* GetReputationOnKilEntry(uint32 id) const … … 533 523 534 524 bool LoadTrinityStrings(DatabaseType& db, char const* table, int32 min_value, int32 max_value); 535 bool LoadTrinityStrings() { return LoadTrinityStrings(WorldDatabase,"trinity_string",MIN_TRINITY_STRING_ID,MAX_TRINITY_STRING_ID); } 536 void LoadDbScriptStrings(); 525 bool LoadTrinityStrings() { return LoadTrinityStrings(WorldDatabase,"trinity_string",1,std::numeric_limits<int32>::max()); } 537 526 void LoadPetCreateSpells(); 538 527 void LoadCreatureLocales(); … … 604 593 uint32 GenerateItemTextID(); 605 594 uint32 GeneratePetNumber(); 606 uint32 GenerateArenaTeamId();607 uint32 GenerateGuildId();608 595 609 596 void LoadPlayerInfoInCache(); … … 682 669 return &itr->second; 683 670 } 671 684 672 NpcOptionLocale const* GetNpcOptionLocale(uint32 entry) const 685 673 { … … 706 694 const char *GetTrinityString(int32 entry, int locale_idx) const; 707 695 const char *GetTrinityStringForDBCLocale(int32 entry) const { return GetTrinityString(entry,DBCLocaleIndex); } 708 int32 GetDBCLocaleIndex() const { return DBCLocaleIndex; }696 int32 GetDBCLocaleIndex() const { return DBCLocaleIndex; } 709 697 void SetDBCLocaleIndex(uint32 lang) { DBCLocaleIndex = GetIndexForLocale(LocaleConstant(lang)); } 710 698 … … 745 733 LocaleConstant GetLocaleForIndex(int i); 746 734 // guild bank tabs 747 uint32 GetGuildBankTabPrice(uint8 Index) const{ return Index < GUILD_BANK_MAX_TABS ? mGuildBankTabPrice[Index] : 0; }735 const uint32 GetGuildBankTabPrice(uint8 Index) { return Index < GUILD_BANK_MAX_TABS ? mGuildBankTabPrice[Index] : 0; } 748 736 749 737 uint16 GetConditionId(ConditionType condition, uint32 value1, uint32 value2); … … 766 754 bool AddGameTele(GameTele& data); 767 755 bool DeleteGameTele(std::string name); 768 756 769 757 CacheNpcOptionList const& GetNpcOptions() const { return m_mCacheNpcOptionList; } 770 758 … … 774 762 if(iter == m_mCacheNpcTextIdMap.end()) 775 763 return 0; 776 764 777 765 return iter->second; 778 766 } … … 795 783 return &iter->second; 796 784 } 797 void AddVendorItem(uint32 entry,uint32 item, uint32 maxcount, uint32 incrtime, uint32 ExtendedCost, bool savetodb = true); // for event 798 bool RemoveVendorItem(uint32 entry,uint32 item, bool savetodb = true); // for event 799 bool IsVendorItemValid( uint32 vendor_entry, uint32 item, uint32 maxcount, uint32 ptime, uint32 ExtendedCost, Player* pl = NULL, std::set<uint32>* skip_vendors = NULL, uint32 ORnpcflag = 0 ) const; 800 801 void LoadScriptNames(); 802 ScriptNameMap &GetScriptNames() { return m_scriptNames; } 803 const char * GetScriptName(uint32 id) { return id < m_scriptNames.size() ? m_scriptNames[id].c_str() : ""; } 804 uint32 GetScriptId(const char *name); 785 void AddVendorItem(uint32 entry,uint32 item, uint32 maxcount, uint32 incrtime, uint32 ExtendedCost, bool savetodb = true); 786 bool RemoveVendorItem(uint32 entry,uint32 item, bool savetodb = true); 787 bool IsVendorItemValid( uint32 vendor_entry, uint32 item, uint32 maxcount, uint32 ptime, uint32 ExtendedCost, Player* pl = NULL, std::set<uint32>* skip_vendors = NULL, uint32 ORnpcflag = 0) const; 788 805 789 protected: 806 807 // first free id for selected id type808 790 uint32 m_auctionid; 809 791 uint32 m_mailid; 810 792 uint32 m_ItemTextId; 811 uint32 m_arenaTeamId; 812 uint32 m_guildId; 813 uint32 m_hiPetNumber; 814 815 // first free low guid for seelcted guid type 793 816 794 uint32 m_hiCharGuid; 817 795 uint32 m_hiCreatureGuid; … … 822 800 uint32 m_hiCorpseGuid; 823 801 824 QuestMap mQuestTemplates; 802 uint32 m_hiPetNumber; 803 804 QuestMap mQuestTemplates; 825 805 826 806 typedef UNORDERED_MAP<uint32, GossipText*> GossipTextMap; … … 869 849 GameTeleMap m_GameTeleMap; 870 850 871 ScriptNameMap m_scriptNames;872 873 851 typedef std::vector<LocaleConstant> LocalForIndex; 874 852 LocalForIndex m_LocalForIndex; … … 878 856 private: 879 857 void LoadScripts(ScriptMapMap& scripts, char const* tablename); 880 void CheckScripts(ScriptMapMap const& scripts,std::set<int32>& ids);881 858 void ConvertCreatureAddonAuras(CreatureDataAddon* addon, char const* table, char const* guidEntryStr); 882 859 void LoadQuestRelationsHelper(QuestRelations& map,char const* table); … … 931 908 932 909 // scripting access functions 933 TRINITY_DLL_SPEC bool LoadTrinityStrings(DatabaseType& db, char const* table,int32 start_value = -1, int32 end_value = std::numeric_limits<int32>::min()); 934 TRINITY_DLL_SPEC uint32 GetAreaTriggerScriptId(uint32 trigger_id); 935 TRINITY_DLL_SPEC uint32 GetScriptId(const char *name); 936 TRINITY_DLL_SPEC ObjectMgr::ScriptNameMap& GetScriptNames(); 910 bool TRINITY_DLL_SPEC LoadTrinityStrings(DatabaseType& db, char const* table,int32 start_value = -1, int32 end_value = std::numeric_limits<int32>::min()); 911 TRINITY_DLL_SPEC const char* GetAreaTriggerScriptNameById(uint32 id); 937 912 938 913 #endif