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

Delete possessed AI only on creature delete.

Original author: gvcoman
Date: 2008-11-16 14:38:02-05:00

Files:
1 modified

Legend:

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

    r263 r272  
    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     int32  dataint; 
     87    std::string datatext; 
    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 
    137130 
    138131struct TrinityStringLocale 
     
    215208    CONDITION_QUESTTAKEN            = 9,                    // quest_id     0,      for condition true while quest active. 
    216209    CONDITION_AD_COMMISSION_AURA    = 10,                   // 0            0,      for condition true while one from AD ñommission aura active 
    217     CONDITION_NO_AURA               = 11,                   // spell_id     effindex 
    218     CONDITION_ACTIVE_EVENT          = 12,                   // event_id 
     210        CONDITION_NO_AURA               = 11,                   // spell_id     effindex 
     211        CONDITION_ACTIVE_EVENT          = 12,                   // event_id 
    219212}; 
    220213 
     
    258251// NPC gossip text id 
    259252typedef UNORDERED_MAP<uint32, uint32> CacheNpcTextIdMap; 
    260 typedef std::list<GossipOption> CacheNpcOptionList; 
     253 
    261254 
    262255typedef UNORDERED_MAP<uint32, VendorItemData> CacheVendorItemMap; 
     
    307300        typedef UNORDERED_MAP<uint32, Quest*> QuestMap; 
    308301 
    309  
    310302        typedef UNORDERED_MAP<uint32, AreaTrigger> AreaTriggerMap; 
    311303 
    312         typedef UNORDERED_MAP<uint32, uint32> AreaTriggerScriptMap; 
     304        typedef UNORDERED_MAP<uint32, std::string> AreaTriggerScriptMap; 
    313305 
    314306        typedef UNORDERED_MAP<uint32, ReputationOnKillEntry> RepOnKillMap; 
     
    317309 
    318310        typedef UNORDERED_MAP<uint32, PetCreateSpellEntry> PetCreateSpellMap; 
    319  
    320         typedef std::vector<std::string> ScriptNameMap; 
    321311 
    322312        Player* GetPlayer(const char* name) const { return ObjectAccessor::Instance().FindPlayerByName(name);} 
     
    487477        AreaTrigger const* GetGoBackTrigger(uint32 Map) const; 
    488478 
    489         uint32 GetAreaTriggerScriptId(uint32 trigger_id); 
     479        const char* GetAreaTriggerScriptName(uint32 id); 
    490480 
    491481        ReputationOnKillEntry const* GetReputationOnKilEntry(uint32 id) const 
     
    533523 
    534524        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()); } 
    537526        void LoadPetCreateSpells(); 
    538527        void LoadCreatureLocales(); 
     
    604593        uint32 GenerateItemTextID(); 
    605594        uint32 GeneratePetNumber(); 
    606         uint32 GenerateArenaTeamId(); 
    607         uint32 GenerateGuildId(); 
    608595         
    609596        void LoadPlayerInfoInCache(); 
     
    682669            return &itr->second; 
    683670        } 
     671         
    684672        NpcOptionLocale const* GetNpcOptionLocale(uint32 entry) const 
    685673        { 
     
    706694        const char *GetTrinityString(int32 entry, int locale_idx) const; 
    707695        const char *GetTrinityStringForDBCLocale(int32 entry) const { return GetTrinityString(entry,DBCLocaleIndex); } 
    708         int32 GetDBCLocaleIndex() const { return DBCLocaleIndex; } 
     696                int32 GetDBCLocaleIndex() const { return DBCLocaleIndex; } 
    709697        void SetDBCLocaleIndex(uint32 lang) { DBCLocaleIndex = GetIndexForLocale(LocaleConstant(lang)); } 
    710698 
     
    745733        LocaleConstant GetLocaleForIndex(int i); 
    746734        // 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; } 
    748736 
    749737        uint16 GetConditionId(ConditionType condition, uint32 value1, uint32 value2); 
     
    766754        bool AddGameTele(GameTele& data); 
    767755        bool DeleteGameTele(std::string name); 
    768  
     756         
    769757        CacheNpcOptionList const& GetNpcOptions() const { return m_mCacheNpcOptionList; } 
    770758 
     
    774762            if(iter == m_mCacheNpcTextIdMap.end()) 
    775763                return 0; 
    776  
     764             
    777765            return iter->second; 
    778766        } 
     
    795783            return &iter->second; 
    796784        } 
    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 
    805789    protected: 
    806  
    807         // first free id for selected id type 
    808790        uint32 m_auctionid; 
    809791        uint32 m_mailid; 
    810792        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 
    816794        uint32 m_hiCharGuid; 
    817795        uint32 m_hiCreatureGuid; 
     
    822800        uint32 m_hiCorpseGuid; 
    823801 
    824         QuestMap            mQuestTemplates; 
     802        uint32 m_hiPetNumber; 
     803 
     804        QuestMap mQuestTemplates; 
    825805 
    826806        typedef UNORDERED_MAP<uint32, GossipText*> GossipTextMap; 
     
    869849        GameTeleMap         m_GameTeleMap; 
    870850 
    871         ScriptNameMap       m_scriptNames; 
    872  
    873851        typedef             std::vector<LocaleConstant> LocalForIndex; 
    874852        LocalForIndex        m_LocalForIndex; 
     
    878856    private: 
    879857        void LoadScripts(ScriptMapMap& scripts, char const* tablename); 
    880         void CheckScripts(ScriptMapMap const& scripts,std::set<int32>& ids); 
    881858        void ConvertCreatureAddonAuras(CreatureDataAddon* addon, char const* table, char const* guidEntryStr); 
    882859        void LoadQuestRelationsHelper(QuestRelations& map,char const* table); 
     
    931908 
    932909// 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(); 
     910bool TRINITY_DLL_SPEC LoadTrinityStrings(DatabaseType& db, char const* table,int32 start_value = -1, int32 end_value = std::numeric_limits<int32>::min()); 
     911TRINITY_DLL_SPEC const char* GetAreaTriggerScriptNameById(uint32 id); 
    937912 
    938913#endif