Show
Ignore:
Timestamp:
11/22/08 00:36:22 (17 years ago)
Author:
yumileroy
Message:

Merged commit 269 (5f0e38da128a).

Original author: gvcoman
Date: 2008-11-21 14:34:05-05:00

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/game/ObjectMgr.h

    r272 r279  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1919 */ 
    2020 
     
    8585    uint32 datalong; 
    8686    uint32 datalong2; 
    87     std::string datatext; 
     87    int32  dataint; 
    8888    float x; 
    8989    float y; 
     
    128128 
    129129typedef 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 
    130137 
    131138struct TrinityStringLocale 
     
    208215    CONDITION_QUESTTAKEN            = 9,                    // quest_id     0,      for condition true while quest active. 
    209216    CONDITION_AD_COMMISSION_AURA    = 10,                   // 0            0,      for condition true while one from AD ñommission aura active 
    210         CONDITION_NO_AURA               = 11,                   // spell_id     effindex 
    211         CONDITION_ACTIVE_EVENT          = 12,                   // event_id 
     217    CONDITION_NO_AURA               = 11,                   // spell_id     effindex 
     218    CONDITION_ACTIVE_EVENT          = 12,                   // event_id 
    212219}; 
    213220 
     
    251258// NPC gossip text id 
    252259typedef UNORDERED_MAP<uint32, uint32> CacheNpcTextIdMap; 
    253  
     260typedef std::list<GossipOption> CacheNpcOptionList; 
    254261 
    255262typedef UNORDERED_MAP<uint32, VendorItemData> CacheVendorItemMap; 
     
    300307        typedef UNORDERED_MAP<uint32, Quest*> QuestMap; 
    301308 
     309 
    302310        typedef UNORDERED_MAP<uint32, AreaTrigger> AreaTriggerMap; 
    303311 
    304         typedef UNORDERED_MAP<uint32, std::string> AreaTriggerScriptMap; 
     312        typedef UNORDERED_MAP<uint32, uint32> AreaTriggerScriptMap; 
    305313 
    306314        typedef UNORDERED_MAP<uint32, ReputationOnKillEntry> RepOnKillMap; 
     
    309317 
    310318        typedef UNORDERED_MAP<uint32, PetCreateSpellEntry> PetCreateSpellMap; 
     319 
     320        typedef std::vector<std::string> ScriptNameMap; 
    311321 
    312322        Player* GetPlayer(const char* name) const { return ObjectAccessor::Instance().FindPlayerByName(name);} 
     
    477487        AreaTrigger const* GetGoBackTrigger(uint32 Map) const; 
    478488 
    479         const char* GetAreaTriggerScriptName(uint32 id); 
     489        uint32 GetAreaTriggerScriptId(uint32 trigger_id); 
    480490 
    481491        ReputationOnKillEntry const* GetReputationOnKilEntry(uint32 id) const 
     
    523533 
    524534        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(); 
    526537        void LoadPetCreateSpells(); 
    527538        void LoadCreatureLocales(); 
     
    593604        uint32 GenerateItemTextID(); 
    594605        uint32 GeneratePetNumber(); 
     606        uint32 GenerateArenaTeamId(); 
     607        uint32 GenerateGuildId(); 
    595608         
    596609        void LoadPlayerInfoInCache(); 
     
    669682            return &itr->second; 
    670683        } 
    671          
    672684        NpcOptionLocale const* GetNpcOptionLocale(uint32 entry) const 
    673685        { 
     
    694706        const char *GetTrinityString(int32 entry, int locale_idx) const; 
    695707        const char *GetTrinityStringForDBCLocale(int32 entry) const { return GetTrinityString(entry,DBCLocaleIndex); } 
    696                 int32 GetDBCLocaleIndex() const { return DBCLocaleIndex; } 
     708        int32 GetDBCLocaleIndex() const { return DBCLocaleIndex; } 
    697709        void SetDBCLocaleIndex(uint32 lang) { DBCLocaleIndex = GetIndexForLocale(LocaleConstant(lang)); } 
    698710 
     
    733745        LocaleConstant GetLocaleForIndex(int i); 
    734746        // 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; } 
    736748 
    737749        uint16 GetConditionId(ConditionType condition, uint32 value1, uint32 value2); 
     
    754766        bool AddGameTele(GameTele& data); 
    755767        bool DeleteGameTele(std::string name); 
    756          
     768 
    757769        CacheNpcOptionList const& GetNpcOptions() const { return m_mCacheNpcOptionList; } 
    758770 
     
    762774            if(iter == m_mCacheNpcTextIdMap.end()) 
    763775                return 0; 
    764              
     776 
    765777            return iter->second; 
    766778        } 
     
    783795            return &iter->second; 
    784796        } 
    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); 
    789805    protected: 
     806 
     807        // first free id for selected id type 
    790808        uint32 m_auctionid; 
    791809        uint32 m_mailid; 
    792810        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 
    794816        uint32 m_hiCharGuid; 
    795817        uint32 m_hiCreatureGuid; 
     
    800822        uint32 m_hiCorpseGuid; 
    801823 
    802         uint32 m_hiPetNumber; 
    803  
    804         QuestMap mQuestTemplates; 
     824        QuestMap            mQuestTemplates; 
    805825 
    806826        typedef UNORDERED_MAP<uint32, GossipText*> GossipTextMap; 
     
    849869        GameTeleMap         m_GameTeleMap; 
    850870 
     871        ScriptNameMap       m_scriptNames; 
     872 
    851873        typedef             std::vector<LocaleConstant> LocalForIndex; 
    852874        LocalForIndex        m_LocalForIndex; 
     
    856878    private: 
    857879        void LoadScripts(ScriptMapMap& scripts, char const* tablename); 
     880        void CheckScripts(ScriptMapMap const& scripts,std::set<int32>& ids); 
    858881        void ConvertCreatureAddonAuras(CreatureDataAddon* addon, char const* table, char const* guidEntryStr); 
    859882        void LoadQuestRelationsHelper(QuestRelations& map,char const* table); 
     
    908931 
    909932// 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); 
     933TRINITY_DLL_SPEC bool LoadTrinityStrings(DatabaseType& db, char const* table,int32 start_value = -1, int32 end_value = std::numeric_limits<int32>::min()); 
     934TRINITY_DLL_SPEC uint32 GetAreaTriggerScriptId(uint32 trigger_id); 
     935TRINITY_DLL_SPEC uint32 GetScriptId(const char *name); 
     936TRINITY_DLL_SPEC ObjectMgr::ScriptNameMap& GetScriptNames(); 
    912937 
    913938#endif