Changeset 279 for trunk/src/game/ObjectMgr.h
- Timestamp:
- 11/22/08 00:36:22 (17 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/game/ObjectMgr.h
r272 r279 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. See the13 * 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 std::string datatext;87 int32 dataint; 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 ranges 133 #define MIN_TRINITY_STRING_ID 1 134 #define MAX_TRINITY_STRING_ID 2000000000 135 #define MIN_DB_SCRIPT_STRING_ID MAX_TRINITY_STRING_ID 136 #define MAX_DB_SCRIPT_STRING_ID 2000010000 130 137 131 138 struct TrinityStringLocale … … 208 215 CONDITION_QUESTTAKEN = 9, // quest_id 0, for condition true while quest active. 209 216 CONDITION_AD_COMMISSION_AURA = 10, // 0 0, for condition true while one from AD ñommission aura active 210 211 217 CONDITION_NO_AURA = 11, // spell_id effindex 218 CONDITION_ACTIVE_EVENT = 12, // event_id 212 219 }; 213 220 … … 251 258 // NPC gossip text id 252 259 typedef UNORDERED_MAP<uint32, uint32> CacheNpcTextIdMap; 253 260 typedef std::list<GossipOption> CacheNpcOptionList; 254 261 255 262 typedef UNORDERED_MAP<uint32, VendorItemData> CacheVendorItemMap; … … 300 307 typedef UNORDERED_MAP<uint32, Quest*> QuestMap; 301 308 309 302 310 typedef UNORDERED_MAP<uint32, AreaTrigger> AreaTriggerMap; 303 311 304 typedef UNORDERED_MAP<uint32, std::string> AreaTriggerScriptMap;312 typedef UNORDERED_MAP<uint32, uint32> AreaTriggerScriptMap; 305 313 306 314 typedef UNORDERED_MAP<uint32, ReputationOnKillEntry> RepOnKillMap; … … 309 317 310 318 typedef UNORDERED_MAP<uint32, PetCreateSpellEntry> PetCreateSpellMap; 319 320 typedef std::vector<std::string> ScriptNameMap; 311 321 312 322 Player* GetPlayer(const char* name) const { return ObjectAccessor::Instance().FindPlayerByName(name);} … … 477 487 AreaTrigger const* GetGoBackTrigger(uint32 Map) const; 478 488 479 const char* GetAreaTriggerScriptName(uint32id);489 uint32 GetAreaTriggerScriptId(uint32 trigger_id); 480 490 481 491 ReputationOnKillEntry const* GetReputationOnKilEntry(uint32 id) const … … 523 533 524 534 bool LoadTrinityStrings(DatabaseType& db, char const* table, int32 min_value, int32 max_value); 525 bool LoadTrinityStrings() { return LoadTrinityStrings(WorldDatabase,"trinity_string",1,std::numeric_limits<int32>::max()); } 535 bool LoadTrinityStrings() { return LoadTrinityStrings(WorldDatabase,"trinity_string",MIN_TRINITY_STRING_ID,MAX_TRINITY_STRING_ID); } 536 void LoadDbScriptStrings(); 526 537 void LoadPetCreateSpells(); 527 538 void LoadCreatureLocales(); … … 593 604 uint32 GenerateItemTextID(); 594 605 uint32 GeneratePetNumber(); 606 uint32 GenerateArenaTeamId(); 607 uint32 GenerateGuildId(); 595 608 596 609 void LoadPlayerInfoInCache(); … … 669 682 return &itr->second; 670 683 } 671 672 684 NpcOptionLocale const* GetNpcOptionLocale(uint32 entry) const 673 685 { … … 694 706 const char *GetTrinityString(int32 entry, int locale_idx) const; 695 707 const char *GetTrinityStringForDBCLocale(int32 entry) const { return GetTrinityString(entry,DBCLocaleIndex); } 696 708 int32 GetDBCLocaleIndex() const { return DBCLocaleIndex; } 697 709 void SetDBCLocaleIndex(uint32 lang) { DBCLocaleIndex = GetIndexForLocale(LocaleConstant(lang)); } 698 710 … … 733 745 LocaleConstant GetLocaleForIndex(int i); 734 746 // guild bank tabs 735 const uint32 GetGuildBankTabPrice(uint8 Index){ return Index < GUILD_BANK_MAX_TABS ? mGuildBankTabPrice[Index] : 0; }747 uint32 GetGuildBankTabPrice(uint8 Index) const { return Index < GUILD_BANK_MAX_TABS ? mGuildBankTabPrice[Index] : 0; } 736 748 737 749 uint16 GetConditionId(ConditionType condition, uint32 value1, uint32 value2); … … 754 766 bool AddGameTele(GameTele& data); 755 767 bool DeleteGameTele(std::string name); 756 768 757 769 CacheNpcOptionList const& GetNpcOptions() const { return m_mCacheNpcOptionList; } 758 770 … … 762 774 if(iter == m_mCacheNpcTextIdMap.end()) 763 775 return 0; 764 776 765 777 return iter->second; 766 778 } … … 783 795 return &iter->second; 784 796 } 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 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); 789 805 protected: 806 807 // first free id for selected id type 790 808 uint32 m_auctionid; 791 809 uint32 m_mailid; 792 810 uint32 m_ItemTextId; 793 811 uint32 m_arenaTeamId; 812 uint32 m_guildId; 813 uint32 m_hiPetNumber; 814 815 // first free low guid for seelcted guid type 794 816 uint32 m_hiCharGuid; 795 817 uint32 m_hiCreatureGuid; … … 800 822 uint32 m_hiCorpseGuid; 801 823 802 uint32 m_hiPetNumber; 803 804 QuestMap mQuestTemplates; 824 QuestMap mQuestTemplates; 805 825 806 826 typedef UNORDERED_MAP<uint32, GossipText*> GossipTextMap; … … 849 869 GameTeleMap m_GameTeleMap; 850 870 871 ScriptNameMap m_scriptNames; 872 851 873 typedef std::vector<LocaleConstant> LocalForIndex; 852 874 LocalForIndex m_LocalForIndex; … … 856 878 private: 857 879 void LoadScripts(ScriptMapMap& scripts, char const* tablename); 880 void CheckScripts(ScriptMapMap const& scripts,std::set<int32>& ids); 858 881 void ConvertCreatureAddonAuras(CreatureDataAddon* addon, char const* table, char const* guidEntryStr); 859 882 void LoadQuestRelationsHelper(QuestRelations& map,char const* table); … … 908 931 909 932 // scripting access functions 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); 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(); 912 937 913 938 #endif