[260] | 1 | /* |
---|
| 2 | * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> |
---|
| 3 | * |
---|
| 4 | * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> |
---|
| 5 | * |
---|
| 6 | * This program is free software; you can redistribute it and/or modify |
---|
| 7 | * it under the terms of the GNU General Public License as published by |
---|
| 8 | * the Free Software Foundation; either version 2 of the License, or |
---|
| 9 | * (at your option) any later version. |
---|
| 10 | * |
---|
| 11 | * This program is distributed in the hope that it will be useful, |
---|
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 14 | * GNU General Public License for more details. |
---|
| 15 | * |
---|
| 16 | * You should have received a copy of the GNU General Public License |
---|
| 17 | * along with this program; if not, write to the Free Software |
---|
| 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
| 19 | */ |
---|
| 20 | |
---|
| 21 | #ifndef _OBJECTMGR_H |
---|
| 22 | #define _OBJECTMGR_H |
---|
| 23 | |
---|
| 24 | #include "Log.h" |
---|
| 25 | #include "Object.h" |
---|
| 26 | #include "Bag.h" |
---|
| 27 | #include "Creature.h" |
---|
| 28 | #include "Player.h" |
---|
| 29 | #include "DynamicObject.h" |
---|
| 30 | #include "GameObject.h" |
---|
| 31 | #include "Corpse.h" |
---|
| 32 | #include "QuestDef.h" |
---|
| 33 | #include "Path.h" |
---|
| 34 | #include "ItemPrototype.h" |
---|
| 35 | #include "NPCHandler.h" |
---|
| 36 | #include "Database/DatabaseEnv.h" |
---|
| 37 | #include "AuctionHouseObject.h" |
---|
| 38 | #include "Mail.h" |
---|
| 39 | #include "Map.h" |
---|
| 40 | #include "ObjectAccessor.h" |
---|
| 41 | #include "ObjectDefines.h" |
---|
| 42 | #include "Policies/Singleton.h" |
---|
| 43 | #include "Database/SQLStorage.h" |
---|
| 44 | |
---|
| 45 | #include <string> |
---|
| 46 | #include <map> |
---|
| 47 | #include <limits> |
---|
| 48 | |
---|
| 49 | extern SQLStorage sCreatureStorage; |
---|
| 50 | extern SQLStorage sCreatureDataAddonStorage; |
---|
| 51 | extern SQLStorage sCreatureInfoAddonStorage; |
---|
| 52 | extern SQLStorage sCreatureModelStorage; |
---|
| 53 | extern SQLStorage sEquipmentStorage; |
---|
| 54 | extern SQLStorage sGOStorage; |
---|
| 55 | extern SQLStorage sPageTextStore; |
---|
| 56 | extern SQLStorage sItemStorage; |
---|
| 57 | extern SQLStorage sInstanceTemplate; |
---|
| 58 | |
---|
| 59 | class Group; |
---|
| 60 | class Guild; |
---|
| 61 | class ArenaTeam; |
---|
| 62 | class Path; |
---|
| 63 | class TransportPath; |
---|
| 64 | class Item; |
---|
| 65 | |
---|
| 66 | struct GameTele |
---|
| 67 | { |
---|
| 68 | float position_x; |
---|
| 69 | float position_y; |
---|
| 70 | float position_z; |
---|
| 71 | float orientation; |
---|
| 72 | uint32 mapId; |
---|
| 73 | std::string name; |
---|
| 74 | std::wstring wnameLow; |
---|
| 75 | }; |
---|
| 76 | |
---|
| 77 | typedef UNORDERED_MAP<uint32, GameTele > GameTeleMap; |
---|
| 78 | typedef std::list<GossipOption> CacheNpcOptionList; |
---|
| 79 | |
---|
| 80 | struct ScriptInfo |
---|
| 81 | { |
---|
| 82 | uint32 id; |
---|
| 83 | uint32 delay; |
---|
| 84 | uint32 command; |
---|
| 85 | uint32 datalong; |
---|
| 86 | uint32 datalong2; |
---|
| 87 | int32 dataint; |
---|
| 88 | float x; |
---|
| 89 | float y; |
---|
| 90 | float z; |
---|
| 91 | float o; |
---|
| 92 | }; |
---|
| 93 | |
---|
| 94 | typedef std::multimap<uint32, ScriptInfo> ScriptMap; |
---|
| 95 | typedef std::map<uint32, ScriptMap > ScriptMapMap; |
---|
| 96 | extern ScriptMapMap sQuestEndScripts; |
---|
| 97 | extern ScriptMapMap sQuestStartScripts; |
---|
| 98 | extern ScriptMapMap sSpellScripts; |
---|
| 99 | extern ScriptMapMap sGameObjectScripts; |
---|
| 100 | extern ScriptMapMap sEventScripts; |
---|
| 101 | |
---|
| 102 | struct AreaTrigger |
---|
| 103 | { |
---|
| 104 | uint8 requiredLevel; |
---|
| 105 | uint32 requiredItem; |
---|
| 106 | uint32 requiredItem2; |
---|
| 107 | uint32 heroicKey; |
---|
| 108 | uint32 heroicKey2; |
---|
| 109 | uint32 requiredQuest; |
---|
| 110 | std::string requiredFailedText; |
---|
| 111 | uint32 target_mapId; |
---|
| 112 | float target_X; |
---|
| 113 | float target_Y; |
---|
| 114 | float target_Z; |
---|
| 115 | float target_Orientation; |
---|
| 116 | }; |
---|
| 117 | |
---|
| 118 | typedef std::set<uint32> CellGuidSet; |
---|
| 119 | typedef std::map<uint32/*player guid*/,uint32/*instance*/> CellCorpseSet; |
---|
| 120 | struct CellObjectGuids |
---|
| 121 | { |
---|
| 122 | CellGuidSet creatures; |
---|
| 123 | CellGuidSet gameobjects; |
---|
| 124 | CellCorpseSet corpses; |
---|
| 125 | }; |
---|
| 126 | typedef UNORDERED_MAP<uint32/*cell_id*/,CellObjectGuids> CellObjectGuidsMap; |
---|
| 127 | typedef UNORDERED_MAP<uint32/*(mapid,spawnMode) pair*/,CellObjectGuidsMap> MapObjectGuids; |
---|
| 128 | |
---|
| 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 |
---|
| 137 | |
---|
| 138 | struct TrinityStringLocale |
---|
| 139 | { |
---|
| 140 | std::vector<std::string> Content; // 0 -> default, i -> i-1 locale index |
---|
| 141 | }; |
---|
| 142 | |
---|
| 143 | typedef UNORDERED_MAP<uint32,CreatureData> CreatureDataMap; |
---|
| 144 | typedef UNORDERED_MAP<uint32,GameObjectData> GameObjectDataMap; |
---|
| 145 | typedef UNORDERED_MAP<uint32,CreatureLocale> CreatureLocaleMap; |
---|
| 146 | typedef UNORDERED_MAP<uint32,GameObjectLocale> GameObjectLocaleMap; |
---|
| 147 | typedef UNORDERED_MAP<uint32,ItemLocale> ItemLocaleMap; |
---|
| 148 | typedef UNORDERED_MAP<uint32,QuestLocale> QuestLocaleMap; |
---|
| 149 | typedef UNORDERED_MAP<uint32,NpcTextLocale> NpcTextLocaleMap; |
---|
| 150 | typedef UNORDERED_MAP<uint32,PageTextLocale> PageTextLocaleMap; |
---|
| 151 | typedef UNORDERED_MAP<uint32,TrinityStringLocale> TrinityStringLocaleMap; |
---|
| 152 | typedef UNORDERED_MAP<uint32,NpcOptionLocale> NpcOptionLocaleMap; |
---|
| 153 | |
---|
| 154 | typedef std::multimap<uint32,uint32> QuestRelations; |
---|
| 155 | |
---|
| 156 | struct PetLevelInfo |
---|
| 157 | { |
---|
| 158 | PetLevelInfo() : health(0), mana(0) { for(int i=0; i < MAX_STATS; ++i ) stats[i] = 0; } |
---|
| 159 | |
---|
| 160 | uint16 stats[MAX_STATS]; |
---|
| 161 | uint16 health; |
---|
| 162 | uint16 mana; |
---|
| 163 | uint16 armor; |
---|
| 164 | }; |
---|
| 165 | |
---|
| 166 | struct ReputationOnKillEntry |
---|
| 167 | { |
---|
| 168 | uint32 repfaction1; |
---|
| 169 | uint32 repfaction2; |
---|
| 170 | bool is_teamaward1; |
---|
| 171 | uint32 reputation_max_cap1; |
---|
| 172 | int32 repvalue1; |
---|
| 173 | bool is_teamaward2; |
---|
| 174 | uint32 reputation_max_cap2; |
---|
| 175 | int32 repvalue2; |
---|
| 176 | bool team_dependent; |
---|
| 177 | }; |
---|
| 178 | |
---|
| 179 | struct PetCreateSpellEntry |
---|
| 180 | { |
---|
| 181 | uint32 spellid[4]; |
---|
| 182 | }; |
---|
| 183 | |
---|
| 184 | #define WEATHER_SEASONS 4 |
---|
| 185 | struct WeatherSeasonChances |
---|
| 186 | { |
---|
| 187 | uint32 rainChance; |
---|
| 188 | uint32 snowChance; |
---|
| 189 | uint32 stormChance; |
---|
| 190 | }; |
---|
| 191 | |
---|
| 192 | struct WeatherZoneChances |
---|
| 193 | { |
---|
| 194 | WeatherSeasonChances data[WEATHER_SEASONS]; |
---|
| 195 | }; |
---|
| 196 | |
---|
| 197 | struct GraveYardData |
---|
| 198 | { |
---|
| 199 | uint32 safeLocId; |
---|
| 200 | uint32 team; |
---|
| 201 | }; |
---|
| 202 | typedef std::multimap<uint32,GraveYardData> GraveYardMap; |
---|
| 203 | |
---|
| 204 | enum ConditionType |
---|
| 205 | { // value1 value2 for the Condition enumed |
---|
| 206 | CONDITION_NONE = 0, // 0 0 |
---|
| 207 | CONDITION_AURA = 1, // spell_id effindex |
---|
| 208 | CONDITION_ITEM = 2, // item_id count |
---|
| 209 | CONDITION_ITEM_EQUIPPED = 3, // item_id 0 |
---|
| 210 | CONDITION_ZONEID = 4, // zone_id 0 |
---|
| 211 | CONDITION_REPUTATION_RANK = 5, // faction_id min_rank |
---|
| 212 | CONDITION_TEAM = 6, // player_team 0, (469 - Alliance 67 - Horde) |
---|
| 213 | CONDITION_SKILL = 7, // skill_id skill_value |
---|
| 214 | CONDITION_QUESTREWARDED = 8, // quest_id 0 |
---|
| 215 | CONDITION_QUESTTAKEN = 9, // quest_id 0, for condition true while quest active. |
---|
| 216 | 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 |
---|
| 219 | }; |
---|
| 220 | |
---|
| 221 | #define MAX_CONDITION 13 // maximum value in ConditionType enum |
---|
| 222 | |
---|
| 223 | //Player's info |
---|
| 224 | typedef struct _tagCachePlayerInfo |
---|
| 225 | { |
---|
| 226 | std::string sPlayerName; |
---|
| 227 | uint32 unfield; |
---|
| 228 | uint32 unLevel; |
---|
| 229 | uint8 unClass; |
---|
| 230 | //Arena |
---|
| 231 | uint32 unArenaInfoId0; |
---|
| 232 | uint32 unArenaInfoId1; |
---|
| 233 | uint32 unArenaInfoId2; |
---|
| 234 | uint32 unArenaInfoSlot0; |
---|
| 235 | uint32 unArenaInfoSlot1; |
---|
| 236 | uint32 unArenaInfoSlot2; |
---|
| 237 | }CachePlayerInfo, *PCachePlayerInfo; |
---|
| 238 | typedef UNORDERED_MAP<uint32, PCachePlayerInfo> CachePlayerInfoMap; |
---|
| 239 | |
---|
| 240 | struct PlayerCondition |
---|
| 241 | { |
---|
| 242 | ConditionType condition; // additional condition type |
---|
| 243 | uint32 value1; // data for the condition - see ConditionType definition |
---|
| 244 | uint32 value2; |
---|
| 245 | |
---|
| 246 | PlayerCondition(uint8 _condition = 0, uint32 _value1 = 0, uint32 _value2 = 0) |
---|
| 247 | : condition(ConditionType(_condition)), value1(_value1), value2(_value2) {} |
---|
| 248 | |
---|
| 249 | static bool IsValid(ConditionType condition, uint32 value1, uint32 value2); |
---|
| 250 | // Checks correctness of values |
---|
| 251 | bool Meets(Player const * APlayer) const; // Checks if the player meets the condition |
---|
| 252 | bool operator == (PlayerCondition const& lc) const |
---|
| 253 | { |
---|
| 254 | return (lc.condition == condition && lc.value1 == value1 && lc.value2 == value2); |
---|
| 255 | } |
---|
| 256 | }; |
---|
| 257 | |
---|
| 258 | // NPC gossip text id |
---|
| 259 | typedef UNORDERED_MAP<uint32, uint32> CacheNpcTextIdMap; |
---|
| 260 | typedef std::list<GossipOption> CacheNpcOptionList; |
---|
| 261 | |
---|
| 262 | typedef UNORDERED_MAP<uint32, VendorItemData> CacheVendorItemMap; |
---|
| 263 | typedef UNORDERED_MAP<uint32, TrainerSpellData> CacheTrainerSpellMap; |
---|
| 264 | |
---|
| 265 | enum SkillRangeType |
---|
| 266 | { |
---|
| 267 | SKILL_RANGE_LANGUAGE, // 300..300 |
---|
| 268 | SKILL_RANGE_LEVEL, // 1..max skill for level |
---|
| 269 | SKILL_RANGE_MONO, // 1..1, grey monolite bar |
---|
| 270 | SKILL_RANGE_RANK, // 1..skill for known rank |
---|
| 271 | SKILL_RANGE_NONE, // 0..0 always |
---|
| 272 | }; |
---|
| 273 | |
---|
| 274 | SkillRangeType GetSkillRangeType(SkillLineEntry const *pSkill, bool racial); |
---|
| 275 | |
---|
| 276 | #define MAX_PLAYER_NAME 12 // max allowed by client name length |
---|
| 277 | #define MAX_INTERNAL_PLAYER_NAME 15 // max server internal player name length ( > MAX_PLAYER_NAME for support declined names ) |
---|
| 278 | |
---|
| 279 | bool normalizePlayerName(std::string& name); |
---|
| 280 | |
---|
| 281 | struct TRINITY_DLL_SPEC LanguageDesc |
---|
| 282 | { |
---|
| 283 | Language lang_id; |
---|
| 284 | uint32 spell_id; |
---|
| 285 | uint32 skill_id; |
---|
| 286 | }; |
---|
| 287 | |
---|
| 288 | extern LanguageDesc lang_description[LANGUAGES_COUNT]; |
---|
| 289 | TRINITY_DLL_SPEC LanguageDesc const* GetLanguageDescByID(uint32 lang); |
---|
| 290 | |
---|
| 291 | class PlayerDumpReader; |
---|
| 292 | |
---|
| 293 | class ObjectMgr |
---|
| 294 | { |
---|
| 295 | friend class PlayerDumpReader; |
---|
| 296 | |
---|
| 297 | public: |
---|
| 298 | ObjectMgr(); |
---|
| 299 | ~ObjectMgr(); |
---|
| 300 | |
---|
| 301 | typedef UNORDERED_MAP<uint32, Item*> ItemMap; |
---|
| 302 | |
---|
| 303 | typedef std::set< Group * > GroupSet; |
---|
| 304 | typedef std::set< Guild * > GuildSet; |
---|
| 305 | typedef std::set< ArenaTeam * > ArenaTeamSet; |
---|
| 306 | |
---|
| 307 | typedef UNORDERED_MAP<uint32, Quest*> QuestMap; |
---|
| 308 | |
---|
| 309 | |
---|
| 310 | typedef UNORDERED_MAP<uint32, AreaTrigger> AreaTriggerMap; |
---|
| 311 | |
---|
| 312 | typedef UNORDERED_MAP<uint32, uint32> AreaTriggerScriptMap; |
---|
| 313 | |
---|
| 314 | typedef UNORDERED_MAP<uint32, ReputationOnKillEntry> RepOnKillMap; |
---|
| 315 | |
---|
| 316 | typedef UNORDERED_MAP<uint32, WeatherZoneChances> WeatherZoneMap; |
---|
| 317 | |
---|
| 318 | typedef UNORDERED_MAP<uint32, PetCreateSpellEntry> PetCreateSpellMap; |
---|
| 319 | |
---|
| 320 | typedef std::vector<std::string> ScriptNameMap; |
---|
| 321 | |
---|
| 322 | Player* GetPlayer(const char* name) const { return ObjectAccessor::Instance().FindPlayerByName(name);} |
---|
| 323 | Player* GetPlayer(uint64 guid) const { return ObjectAccessor::FindPlayer(guid); } |
---|
| 324 | |
---|
| 325 | static GameObjectInfo const *GetGameObjectInfo(uint32 id) { return sGOStorage.LookupEntry<GameObjectInfo>(id); } |
---|
| 326 | |
---|
| 327 | void LoadGameobjectInfo(); |
---|
| 328 | void AddGameobjectInfo(GameObjectInfo *goinfo); |
---|
| 329 | |
---|
| 330 | Group * GetGroupByLeader(const uint64 &guid) const; |
---|
| 331 | void AddGroup(Group* group) { mGroupSet.insert( group ); } |
---|
| 332 | void RemoveGroup(Group* group) { mGroupSet.erase( group ); } |
---|
| 333 | |
---|
| 334 | Guild* GetGuildByLeader(uint64 const&guid) const; |
---|
| 335 | Guild* GetGuildById(const uint32 GuildId) const; |
---|
| 336 | Guild* GetGuildByName(std::string guildname) const; |
---|
| 337 | std::string GetGuildNameById(const uint32 GuildId) const; |
---|
| 338 | void AddGuild(Guild* guild) { mGuildSet.insert( guild ); } |
---|
| 339 | void RemoveGuild(Guild* guild) { mGuildSet.erase( guild ); } |
---|
| 340 | |
---|
| 341 | ArenaTeam* GetArenaTeamById(const uint32 ArenaTeamId) const; |
---|
| 342 | ArenaTeam* GetArenaTeamByName(std::string ArenaTeamName) const; |
---|
| 343 | ArenaTeam* GetArenaTeamByCapitan(uint64 const& guid) const; |
---|
| 344 | void AddArenaTeam(ArenaTeam* arenateam) { mArenaTeamSet.insert( arenateam ); } |
---|
| 345 | void RemoveArenaTeam(ArenaTeam* arenateam) { mArenaTeamSet.erase( arenateam ); } |
---|
| 346 | ArenaTeamSet::iterator GetArenaTeamSetBegin() { return mArenaTeamSet.begin(); } |
---|
| 347 | ArenaTeamSet::iterator GetArenaTeamSetEnd() { return mArenaTeamSet.end(); } |
---|
| 348 | |
---|
| 349 | static CreatureInfo const *GetCreatureTemplate( uint32 id ); |
---|
| 350 | CreatureModelInfo const *GetCreatureModelInfo( uint32 modelid ); |
---|
| 351 | CreatureModelInfo const* GetCreatureModelRandomGender(uint32 display_id); |
---|
| 352 | uint32 ChooseDisplayId(uint32 team, const CreatureInfo *cinfo, const CreatureData *data = NULL); |
---|
| 353 | EquipmentInfo const *GetEquipmentInfo( uint32 entry ); |
---|
| 354 | static CreatureDataAddon const *GetCreatureAddon( uint32 lowguid ) |
---|
| 355 | { |
---|
| 356 | return sCreatureDataAddonStorage.LookupEntry<CreatureDataAddon>(lowguid); |
---|
| 357 | } |
---|
| 358 | |
---|
| 359 | static CreatureDataAddon const *GetCreatureTemplateAddon( uint32 entry ) |
---|
| 360 | { |
---|
| 361 | return sCreatureInfoAddonStorage.LookupEntry<CreatureDataAddon>(entry); |
---|
| 362 | } |
---|
| 363 | |
---|
| 364 | static ItemPrototype const* GetItemPrototype(uint32 id) { return sItemStorage.LookupEntry<ItemPrototype>(id); } |
---|
| 365 | |
---|
| 366 | static InstanceTemplate const* GetInstanceTemplate(uint32 map) |
---|
| 367 | { |
---|
| 368 | return sInstanceTemplate.LookupEntry<InstanceTemplate>(map); |
---|
| 369 | } |
---|
| 370 | |
---|
| 371 | Item* GetAItem(uint32 id) |
---|
| 372 | { |
---|
| 373 | ItemMap::const_iterator itr = mAitems.find(id); |
---|
| 374 | if (itr != mAitems.end()) |
---|
| 375 | { |
---|
| 376 | return itr->second; |
---|
| 377 | } |
---|
| 378 | return NULL; |
---|
| 379 | } |
---|
| 380 | void AddAItem(Item* it) |
---|
| 381 | { |
---|
| 382 | ASSERT( it ); |
---|
| 383 | ASSERT( mAitems.find(it->GetGUIDLow()) == mAitems.end()); |
---|
| 384 | mAitems[it->GetGUIDLow()] = it; |
---|
| 385 | } |
---|
| 386 | bool RemoveAItem(uint32 id) |
---|
| 387 | { |
---|
| 388 | ItemMap::iterator i = mAitems.find(id); |
---|
| 389 | if (i == mAitems.end()) |
---|
| 390 | { |
---|
| 391 | return false; |
---|
| 392 | } |
---|
| 393 | mAitems.erase(i); |
---|
| 394 | return true; |
---|
| 395 | } |
---|
| 396 | AuctionHouseObject * GetAuctionsMap( uint32 location ); |
---|
| 397 | |
---|
| 398 | //auction messages |
---|
| 399 | void SendAuctionWonMail( AuctionEntry * auction ); |
---|
| 400 | void SendAuctionSalePendingMail( AuctionEntry * auction ); |
---|
| 401 | void SendAuctionSuccessfulMail( AuctionEntry * auction ); |
---|
| 402 | void SendAuctionExpiredMail( AuctionEntry * auction ); |
---|
| 403 | static uint32 GetAuctionCut( uint32 location, uint32 highBid ); |
---|
| 404 | static uint32 GetAuctionDeposit(uint32 location, uint32 time, Item *pItem); |
---|
| 405 | static uint32 GetAuctionOutBid(uint32 currentBid); |
---|
| 406 | |
---|
| 407 | PetLevelInfo const* GetPetLevelInfo(uint32 creature_id, uint32 level) const; |
---|
| 408 | |
---|
| 409 | PlayerClassInfo const* GetPlayerClassInfo(uint32 class_) const |
---|
| 410 | { |
---|
| 411 | if(class_ >= MAX_CLASSES) return NULL; |
---|
| 412 | return &playerClassInfo[class_]; |
---|
| 413 | } |
---|
| 414 | void GetPlayerClassLevelInfo(uint32 class_,uint32 level, PlayerClassLevelInfo* info) const; |
---|
| 415 | |
---|
| 416 | PlayerInfo const* GetPlayerInfo(uint32 race, uint32 class_) const |
---|
| 417 | { |
---|
| 418 | if(race >= MAX_RACES) return NULL; |
---|
| 419 | if(class_ >= MAX_CLASSES) return NULL; |
---|
| 420 | PlayerInfo const* info = &playerInfo[race][class_]; |
---|
| 421 | if(info->displayId_m==0 || info->displayId_f==0) return NULL; |
---|
| 422 | return info; |
---|
| 423 | } |
---|
| 424 | void GetPlayerLevelInfo(uint32 race, uint32 class_,uint32 level, PlayerLevelInfo* info) const; |
---|
| 425 | |
---|
| 426 | uint64 GetPlayerGUIDByName(std::string name) const; |
---|
| 427 | bool GetPlayerNameByGUID(const uint64 &guid, std::string &name) const; |
---|
| 428 | uint32 GetPlayerTeamByGUID(const uint64 &guid) const; |
---|
| 429 | uint32 GetPlayerAccountIdByGUID(const uint64 &guid) const; |
---|
| 430 | uint32 GetPlayerAccountIdByPlayerName(std::string name) const; |
---|
| 431 | |
---|
| 432 | uint32 GetNearestTaxiNode( float x, float y, float z, uint32 mapid ); |
---|
| 433 | void GetTaxiPath( uint32 source, uint32 destination, uint32 &path, uint32 &cost); |
---|
| 434 | uint16 GetTaxiMount( uint32 id, uint32 team ); |
---|
| 435 | void GetTaxiPathNodes( uint32 path, Path &pathnodes, std::vector<uint32>& mapIds ); |
---|
| 436 | void GetTransportPathNodes( uint32 path, TransportPath &pathnodes ); |
---|
| 437 | |
---|
| 438 | Quest const* GetQuestTemplate(uint32 quest_id) const |
---|
| 439 | { |
---|
| 440 | QuestMap::const_iterator itr = mQuestTemplates.find(quest_id); |
---|
| 441 | return itr != mQuestTemplates.end() ? itr->second : NULL; |
---|
| 442 | } |
---|
| 443 | QuestMap const& GetQuestTemplates() const { return mQuestTemplates; } |
---|
| 444 | |
---|
| 445 | uint32 GetQuestForAreaTrigger(uint32 Trigger_ID) const |
---|
| 446 | { |
---|
| 447 | QuestAreaTriggerMap::const_iterator itr = mQuestAreaTriggerMap.find(Trigger_ID); |
---|
| 448 | if(itr != mQuestAreaTriggerMap.end()) |
---|
| 449 | return itr->second; |
---|
| 450 | return 0; |
---|
| 451 | } |
---|
| 452 | bool IsTavernAreaTrigger(uint32 Trigger_ID) const { return mTavernAreaTriggerSet.count(Trigger_ID) != 0; } |
---|
| 453 | bool IsGameObjectForQuests(uint32 entry) const { return mGameObjectForQuestSet.count(entry) != 0; } |
---|
| 454 | bool IsGuildVaultGameObject(Player *player, uint64 guid) const |
---|
| 455 | { |
---|
| 456 | if(GameObject *go = ObjectAccessor::GetGameObject(*player, guid)) |
---|
| 457 | if(go->GetGoType() == GAMEOBJECT_TYPE_GUILD_BANK) |
---|
| 458 | return true; |
---|
| 459 | return false; |
---|
| 460 | } |
---|
| 461 | |
---|
| 462 | uint32 GetBattleMasterBG(uint32 entry) const |
---|
| 463 | { |
---|
| 464 | BattleMastersMap::const_iterator itr = mBattleMastersMap.find(entry); |
---|
| 465 | if(itr != mBattleMastersMap.end()) |
---|
| 466 | return itr->second; |
---|
| 467 | return 2; //BATTLEGROUND_WS - i will not add include only for constant usage! |
---|
| 468 | } |
---|
| 469 | |
---|
| 470 | void AddGossipText(GossipText *pGText); |
---|
| 471 | GossipText *GetGossipText(uint32 Text_ID); |
---|
| 472 | |
---|
| 473 | WorldSafeLocsEntry const *GetClosestGraveYard(float x, float y, float z, uint32 MapId, uint32 team); |
---|
| 474 | bool AddGraveYardLink(uint32 id, uint32 zone, uint32 team, bool inDB = true); |
---|
| 475 | void RemoveGraveYardLink(uint32 id, uint32 zone, uint32 team, bool inDB = false); |
---|
| 476 | void LoadGraveyardZones(); |
---|
| 477 | GraveYardData const* FindGraveYardData(uint32 id, uint32 zone); |
---|
| 478 | |
---|
| 479 | AreaTrigger const* GetAreaTrigger(uint32 trigger) const |
---|
| 480 | { |
---|
| 481 | AreaTriggerMap::const_iterator itr = mAreaTriggers.find( trigger ); |
---|
| 482 | if( itr != mAreaTriggers.end( ) ) |
---|
| 483 | return &itr->second; |
---|
| 484 | return NULL; |
---|
| 485 | } |
---|
| 486 | |
---|
| 487 | AreaTrigger const* GetGoBackTrigger(uint32 Map) const; |
---|
| 488 | |
---|
| 489 | uint32 GetAreaTriggerScriptId(uint32 trigger_id); |
---|
| 490 | |
---|
| 491 | ReputationOnKillEntry const* GetReputationOnKilEntry(uint32 id) const |
---|
| 492 | { |
---|
| 493 | RepOnKillMap::const_iterator itr = mRepOnKill.find(id); |
---|
| 494 | if(itr != mRepOnKill.end()) |
---|
| 495 | return &itr->second; |
---|
| 496 | return NULL; |
---|
| 497 | } |
---|
| 498 | |
---|
| 499 | PetCreateSpellEntry const* GetPetCreateSpellEntry(uint32 id) const |
---|
| 500 | { |
---|
| 501 | PetCreateSpellMap::const_iterator itr = mPetCreateSpell.find(id); |
---|
| 502 | if(itr != mPetCreateSpell.end()) |
---|
| 503 | return &itr->second; |
---|
| 504 | return NULL; |
---|
| 505 | } |
---|
| 506 | |
---|
| 507 | void LoadGuilds(); |
---|
| 508 | void LoadArenaTeams(); |
---|
| 509 | void LoadGroups(); |
---|
| 510 | void LoadQuests(); |
---|
| 511 | void LoadQuestRelations() |
---|
| 512 | { |
---|
| 513 | LoadGameobjectQuestRelations(); |
---|
| 514 | LoadGameobjectInvolvedRelations(); |
---|
| 515 | LoadCreatureQuestRelations(); |
---|
| 516 | LoadCreatureInvolvedRelations(); |
---|
| 517 | } |
---|
| 518 | void LoadGameobjectQuestRelations(); |
---|
| 519 | void LoadGameobjectInvolvedRelations(); |
---|
| 520 | void LoadCreatureQuestRelations(); |
---|
| 521 | void LoadCreatureInvolvedRelations(); |
---|
| 522 | |
---|
| 523 | QuestRelations mGOQuestRelations; |
---|
| 524 | QuestRelations mGOQuestInvolvedRelations; |
---|
| 525 | QuestRelations mCreatureQuestRelations; |
---|
| 526 | QuestRelations mCreatureQuestInvolvedRelations; |
---|
| 527 | |
---|
| 528 | void LoadGameObjectScripts(); |
---|
| 529 | void LoadQuestEndScripts(); |
---|
| 530 | void LoadQuestStartScripts(); |
---|
| 531 | void LoadEventScripts(); |
---|
| 532 | void LoadSpellScripts(); |
---|
| 533 | |
---|
| 534 | 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(); |
---|
| 537 | void LoadPetCreateSpells(); |
---|
| 538 | void LoadCreatureLocales(); |
---|
| 539 | void LoadCreatureTemplates(); |
---|
| 540 | void LoadCreatures(); |
---|
| 541 | void LoadCreatureRespawnTimes(); |
---|
| 542 | void LoadCreatureAddons(); |
---|
| 543 | void LoadCreatureModelInfo(); |
---|
| 544 | void LoadEquipmentTemplates(); |
---|
| 545 | void LoadGameObjectLocales(); |
---|
| 546 | void LoadGameobjects(); |
---|
| 547 | void LoadGameobjectRespawnTimes(); |
---|
| 548 | void LoadItemPrototypes(); |
---|
| 549 | void LoadItemLocales(); |
---|
| 550 | void LoadQuestLocales(); |
---|
| 551 | void LoadNpcTextLocales(); |
---|
| 552 | void LoadPageTextLocales(); |
---|
| 553 | void LoadNpcOptionLocales(); |
---|
| 554 | void LoadInstanceTemplate(); |
---|
| 555 | |
---|
| 556 | void LoadGossipText(); |
---|
| 557 | |
---|
| 558 | void LoadAreaTriggerTeleports(); |
---|
| 559 | void LoadQuestAreaTriggers(); |
---|
| 560 | void LoadAreaTriggerScripts(); |
---|
| 561 | void LoadTavernAreaTriggers(); |
---|
| 562 | void LoadBattleMastersEntry(); |
---|
| 563 | void LoadGameObjectForQuests(); |
---|
| 564 | |
---|
| 565 | void LoadItemTexts(); |
---|
| 566 | void LoadPageTexts(); |
---|
| 567 | |
---|
| 568 | //load first auction items, because of check if item exists, when loading |
---|
| 569 | void LoadAuctionItems(); |
---|
| 570 | void LoadAuctions(); |
---|
| 571 | void LoadPlayerInfo(); |
---|
| 572 | void LoadPetLevelInfo(); |
---|
| 573 | void LoadExplorationBaseXP(); |
---|
| 574 | void LoadPetNames(); |
---|
| 575 | void LoadPetNumber(); |
---|
| 576 | void LoadCorpses(); |
---|
| 577 | void LoadFishingBaseSkillLevel(); |
---|
| 578 | |
---|
| 579 | void LoadReputationOnKill(); |
---|
| 580 | |
---|
| 581 | void LoadWeatherZoneChances(); |
---|
| 582 | void LoadGameTele(); |
---|
| 583 | |
---|
| 584 | void LoadNpcOptions(); |
---|
| 585 | void LoadNpcTextId(); |
---|
| 586 | void LoadVendors(); |
---|
| 587 | void LoadTrainerSpell(); |
---|
| 588 | |
---|
| 589 | std::string GeneratePetName(uint32 entry); |
---|
| 590 | uint32 GetBaseXP(uint32 level); |
---|
| 591 | |
---|
| 592 | int32 GetFishingBaseSkillLevel(uint32 entry) const |
---|
| 593 | { |
---|
| 594 | FishingBaseSkillMap::const_iterator itr = mFishingBaseForArea.find(entry); |
---|
| 595 | return itr != mFishingBaseForArea.end() ? itr->second : 0; |
---|
| 596 | } |
---|
| 597 | |
---|
| 598 | void ReturnOrDeleteOldMails(bool serverUp); |
---|
| 599 | |
---|
| 600 | void SetHighestGuids(); |
---|
| 601 | uint32 GenerateLowGuid(HighGuid guidhigh); |
---|
| 602 | uint32 GenerateAuctionID(); |
---|
| 603 | uint32 GenerateMailID(); |
---|
| 604 | uint32 GenerateItemTextID(); |
---|
| 605 | uint32 GeneratePetNumber(); |
---|
| 606 | uint32 GenerateArenaTeamId(); |
---|
| 607 | uint32 GenerateGuildId(); |
---|
| 608 | |
---|
| 609 | void LoadPlayerInfoInCache(); |
---|
| 610 | PCachePlayerInfo GetPlayerInfoFromCache(uint32 unPlayerGuid) const; |
---|
| 611 | CachePlayerInfoMap m_mPlayerInfoMap; |
---|
| 612 | |
---|
| 613 | uint32 CreateItemText(std::string text); |
---|
| 614 | std::string GetItemText( uint32 id ) |
---|
| 615 | { |
---|
| 616 | ItemTextMap::const_iterator itr = mItemTexts.find( id ); |
---|
| 617 | if ( itr != mItemTexts.end() ) |
---|
| 618 | return itr->second; |
---|
| 619 | else |
---|
| 620 | return "There is no info for this item"; |
---|
| 621 | } |
---|
| 622 | |
---|
| 623 | typedef std::multimap<int32, uint32> ExclusiveQuestGroups; |
---|
| 624 | ExclusiveQuestGroups mExclusiveQuestGroups; |
---|
| 625 | |
---|
| 626 | WeatherZoneChances const* GetWeatherChances(uint32 zone_id) const |
---|
| 627 | { |
---|
| 628 | WeatherZoneMap::const_iterator itr = mWeatherZoneMap.find(zone_id); |
---|
| 629 | if(itr != mWeatherZoneMap.end()) |
---|
| 630 | return &itr->second; |
---|
| 631 | else |
---|
| 632 | return NULL; |
---|
| 633 | } |
---|
| 634 | |
---|
| 635 | CellObjectGuids const& GetCellObjectGuids(uint16 mapid, uint8 spawnMode, uint32 cell_id) |
---|
| 636 | { |
---|
| 637 | return mMapObjectGuids[MAKE_PAIR32(mapid,spawnMode)][cell_id]; |
---|
| 638 | } |
---|
| 639 | |
---|
| 640 | CreatureData const* GetCreatureData(uint32 guid) const |
---|
| 641 | { |
---|
| 642 | CreatureDataMap::const_iterator itr = mCreatureDataMap.find(guid); |
---|
| 643 | if(itr==mCreatureDataMap.end()) return NULL; |
---|
| 644 | return &itr->second; |
---|
| 645 | } |
---|
| 646 | CreatureData& NewOrExistCreatureData(uint32 guid) { return mCreatureDataMap[guid]; } |
---|
| 647 | void DeleteCreatureData(uint32 guid); |
---|
| 648 | CreatureLocale const* GetCreatureLocale(uint32 entry) const |
---|
| 649 | { |
---|
| 650 | CreatureLocaleMap::const_iterator itr = mCreatureLocaleMap.find(entry); |
---|
| 651 | if(itr==mCreatureLocaleMap.end()) return NULL; |
---|
| 652 | return &itr->second; |
---|
| 653 | } |
---|
| 654 | GameObjectLocale const* GetGameObjectLocale(uint32 entry) const |
---|
| 655 | { |
---|
| 656 | GameObjectLocaleMap::const_iterator itr = mGameObjectLocaleMap.find(entry); |
---|
| 657 | if(itr==mGameObjectLocaleMap.end()) return NULL; |
---|
| 658 | return &itr->second; |
---|
| 659 | } |
---|
| 660 | ItemLocale const* GetItemLocale(uint32 entry) const |
---|
| 661 | { |
---|
| 662 | ItemLocaleMap::const_iterator itr = mItemLocaleMap.find(entry); |
---|
| 663 | if(itr==mItemLocaleMap.end()) return NULL; |
---|
| 664 | return &itr->second; |
---|
| 665 | } |
---|
| 666 | QuestLocale const* GetQuestLocale(uint32 entry) const |
---|
| 667 | { |
---|
| 668 | QuestLocaleMap::const_iterator itr = mQuestLocaleMap.find(entry); |
---|
| 669 | if(itr==mQuestLocaleMap.end()) return NULL; |
---|
| 670 | return &itr->second; |
---|
| 671 | } |
---|
| 672 | NpcTextLocale const* GetNpcTextLocale(uint32 entry) const |
---|
| 673 | { |
---|
| 674 | NpcTextLocaleMap::const_iterator itr = mNpcTextLocaleMap.find(entry); |
---|
| 675 | if(itr==mNpcTextLocaleMap.end()) return NULL; |
---|
| 676 | return &itr->second; |
---|
| 677 | } |
---|
| 678 | PageTextLocale const* GetPageTextLocale(uint32 entry) const |
---|
| 679 | { |
---|
| 680 | PageTextLocaleMap::const_iterator itr = mPageTextLocaleMap.find(entry); |
---|
| 681 | if(itr==mPageTextLocaleMap.end()) return NULL; |
---|
| 682 | return &itr->second; |
---|
| 683 | } |
---|
| 684 | NpcOptionLocale const* GetNpcOptionLocale(uint32 entry) const |
---|
| 685 | { |
---|
| 686 | NpcOptionLocaleMap::const_iterator itr = mNpcOptionLocaleMap.find(entry); |
---|
| 687 | if(itr==mNpcOptionLocaleMap.end()) return NULL; |
---|
| 688 | return &itr->second; |
---|
| 689 | } |
---|
| 690 | |
---|
| 691 | GameObjectData const* GetGOData(uint32 guid) const |
---|
| 692 | { |
---|
| 693 | GameObjectDataMap::const_iterator itr = mGameObjectDataMap.find(guid); |
---|
| 694 | if(itr==mGameObjectDataMap.end()) return NULL; |
---|
| 695 | return &itr->second; |
---|
| 696 | } |
---|
| 697 | GameObjectData& NewGOData(uint32 guid) { return mGameObjectDataMap[guid]; } |
---|
| 698 | void DeleteGOData(uint32 guid); |
---|
| 699 | |
---|
| 700 | TrinityStringLocale const* GetTrinityStringLocale(int32 entry) const |
---|
| 701 | { |
---|
| 702 | TrinityStringLocaleMap::const_iterator itr = mTrinityStringLocaleMap.find(entry); |
---|
| 703 | if(itr==mTrinityStringLocaleMap.end()) return NULL; |
---|
| 704 | return &itr->second; |
---|
| 705 | } |
---|
| 706 | const char *GetTrinityString(int32 entry, int locale_idx) const; |
---|
| 707 | const char *GetTrinityStringForDBCLocale(int32 entry) const { return GetTrinityString(entry,DBCLocaleIndex); } |
---|
| 708 | int32 GetDBCLocaleIndex() const { return DBCLocaleIndex; } |
---|
| 709 | void SetDBCLocaleIndex(uint32 lang) { DBCLocaleIndex = GetIndexForLocale(LocaleConstant(lang)); } |
---|
| 710 | |
---|
| 711 | void AddCorpseCellData(uint32 mapid, uint32 cellid, uint32 player_guid, uint32 instance); |
---|
| 712 | void DeleteCorpseCellData(uint32 mapid, uint32 cellid, uint32 player_guid); |
---|
| 713 | |
---|
| 714 | time_t GetCreatureRespawnTime(uint32 loguid, uint32 instance) { return mCreatureRespawnTimes[MAKE_PAIR64(loguid,instance)]; } |
---|
| 715 | void SaveCreatureRespawnTime(uint32 loguid, uint32 instance, time_t t); |
---|
| 716 | time_t GetGORespawnTime(uint32 loguid, uint32 instance) { return mGORespawnTimes[MAKE_PAIR64(loguid,instance)]; } |
---|
| 717 | void SaveGORespawnTime(uint32 loguid, uint32 instance, time_t t); |
---|
| 718 | void DeleteRespawnTimeForInstance(uint32 instance); |
---|
| 719 | |
---|
| 720 | // grid objects |
---|
| 721 | void AddCreatureToGrid(uint32 guid, CreatureData const* data); |
---|
| 722 | void RemoveCreatureFromGrid(uint32 guid, CreatureData const* data); |
---|
| 723 | void AddGameobjectToGrid(uint32 guid, GameObjectData const* data); |
---|
| 724 | void RemoveGameobjectFromGrid(uint32 guid, GameObjectData const* data); |
---|
| 725 | |
---|
| 726 | // reserved names |
---|
| 727 | void LoadReservedPlayersNames(); |
---|
| 728 | bool IsReservedName(std::string name) const |
---|
| 729 | { |
---|
| 730 | return m_ReservedNames.find(name) != m_ReservedNames.end(); |
---|
| 731 | } |
---|
| 732 | |
---|
| 733 | // name with valid structure and symbols |
---|
| 734 | static bool IsValidName( std::string name, bool create = false ); |
---|
| 735 | static bool IsValidCharterName( std::string name ); |
---|
| 736 | static bool IsValidPetName( std::string name ); |
---|
| 737 | |
---|
| 738 | static bool CheckDeclinedNames(std::wstring mainpart, DeclinedName const& names); |
---|
| 739 | |
---|
| 740 | void LoadSpellDisabledEntrys(); |
---|
| 741 | bool IsPlayerSpellDisabled(uint32 spellid) { return (m_DisabledPlayerSpells.count(spellid) != 0); } |
---|
| 742 | bool IsCreatureSpellDisabled(uint32 spellid) { return (m_DisabledCreatureSpells.count(spellid) != 0); } |
---|
| 743 | |
---|
| 744 | int GetIndexForLocale(LocaleConstant loc); |
---|
| 745 | LocaleConstant GetLocaleForIndex(int i); |
---|
| 746 | // guild bank tabs |
---|
| 747 | uint32 GetGuildBankTabPrice(uint8 Index) const { return Index < GUILD_BANK_MAX_TABS ? mGuildBankTabPrice[Index] : 0; } |
---|
| 748 | |
---|
| 749 | uint16 GetConditionId(ConditionType condition, uint32 value1, uint32 value2); |
---|
| 750 | bool IsPlayerMeetToCondition(Player const* player, uint16 condition_id) const |
---|
| 751 | { |
---|
| 752 | if(condition_id >= mConditions.size()) |
---|
| 753 | return false; |
---|
| 754 | |
---|
| 755 | return mConditions[condition_id].Meets(player); |
---|
| 756 | } |
---|
| 757 | |
---|
| 758 | GameTele const* GetGameTele(uint32 id) const |
---|
| 759 | { |
---|
| 760 | GameTeleMap::const_iterator itr = m_GameTeleMap.find(id); |
---|
| 761 | if(itr==m_GameTeleMap.end()) return NULL; |
---|
| 762 | return &itr->second; |
---|
| 763 | } |
---|
| 764 | GameTele const* GetGameTele(std::string name) const; |
---|
| 765 | GameTeleMap const& GetGameTeleMap() const { return m_GameTeleMap; } |
---|
| 766 | bool AddGameTele(GameTele& data); |
---|
| 767 | bool DeleteGameTele(std::string name); |
---|
| 768 | |
---|
| 769 | CacheNpcOptionList const& GetNpcOptions() const { return m_mCacheNpcOptionList; } |
---|
| 770 | |
---|
| 771 | uint32 GetNpcGossip(uint32 entry) const |
---|
| 772 | { |
---|
| 773 | CacheNpcTextIdMap::const_iterator iter = m_mCacheNpcTextIdMap.find(entry); |
---|
| 774 | if(iter == m_mCacheNpcTextIdMap.end()) |
---|
| 775 | return 0; |
---|
| 776 | |
---|
| 777 | return iter->second; |
---|
| 778 | } |
---|
| 779 | |
---|
| 780 | TrainerSpellData const* GetNpcTrainerSpells(uint32 entry) const |
---|
| 781 | { |
---|
| 782 | CacheTrainerSpellMap::const_iterator iter = m_mCacheTrainerSpellMap.find(entry); |
---|
| 783 | if(iter == m_mCacheTrainerSpellMap.end()) |
---|
| 784 | return NULL; |
---|
| 785 | |
---|
| 786 | return &iter->second; |
---|
| 787 | } |
---|
| 788 | |
---|
| 789 | VendorItemData const* GetNpcVendorItemList(uint32 entry) const |
---|
| 790 | { |
---|
| 791 | CacheVendorItemMap::const_iterator iter = m_mCacheVendorItemMap.find(entry); |
---|
| 792 | if(iter == m_mCacheVendorItemMap.end()) |
---|
| 793 | return NULL; |
---|
| 794 | |
---|
| 795 | return &iter->second; |
---|
| 796 | } |
---|
| 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); |
---|
| 805 | protected: |
---|
| 806 | |
---|
| 807 | // first free id for selected id type |
---|
| 808 | uint32 m_auctionid; |
---|
| 809 | uint32 m_mailid; |
---|
| 810 | 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 |
---|
| 816 | uint32 m_hiCharGuid; |
---|
| 817 | uint32 m_hiCreatureGuid; |
---|
| 818 | uint32 m_hiPetGuid; |
---|
| 819 | uint32 m_hiItemGuid; |
---|
| 820 | uint32 m_hiGoGuid; |
---|
| 821 | uint32 m_hiDoGuid; |
---|
| 822 | uint32 m_hiCorpseGuid; |
---|
| 823 | |
---|
| 824 | QuestMap mQuestTemplates; |
---|
| 825 | |
---|
| 826 | typedef UNORDERED_MAP<uint32, GossipText*> GossipTextMap; |
---|
| 827 | typedef UNORDERED_MAP<uint32, uint32> QuestAreaTriggerMap; |
---|
| 828 | typedef UNORDERED_MAP<uint32, uint32> BattleMastersMap; |
---|
| 829 | typedef UNORDERED_MAP<uint32, std::string> ItemTextMap; |
---|
| 830 | typedef std::set<uint32> TavernAreaTriggerSet; |
---|
| 831 | typedef std::set<uint32> GameObjectForQuestSet; |
---|
| 832 | |
---|
| 833 | GroupSet mGroupSet; |
---|
| 834 | GuildSet mGuildSet; |
---|
| 835 | ArenaTeamSet mArenaTeamSet; |
---|
| 836 | |
---|
| 837 | ItemMap mItems; |
---|
| 838 | ItemMap mAitems; |
---|
| 839 | |
---|
| 840 | ItemTextMap mItemTexts; |
---|
| 841 | |
---|
| 842 | AuctionHouseObject mHordeAuctions; |
---|
| 843 | AuctionHouseObject mAllianceAuctions; |
---|
| 844 | AuctionHouseObject mNeutralAuctions; |
---|
| 845 | |
---|
| 846 | QuestAreaTriggerMap mQuestAreaTriggerMap; |
---|
| 847 | BattleMastersMap mBattleMastersMap; |
---|
| 848 | TavernAreaTriggerSet mTavernAreaTriggerSet; |
---|
| 849 | GameObjectForQuestSet mGameObjectForQuestSet; |
---|
| 850 | GossipTextMap mGossipText; |
---|
| 851 | AreaTriggerMap mAreaTriggers; |
---|
| 852 | AreaTriggerScriptMap mAreaTriggerScripts; |
---|
| 853 | |
---|
| 854 | RepOnKillMap mRepOnKill; |
---|
| 855 | |
---|
| 856 | WeatherZoneMap mWeatherZoneMap; |
---|
| 857 | |
---|
| 858 | PetCreateSpellMap mPetCreateSpell; |
---|
| 859 | |
---|
| 860 | //character reserved names |
---|
| 861 | typedef std::set<std::string> ReservedNamesMap; |
---|
| 862 | ReservedNamesMap m_ReservedNames; |
---|
| 863 | |
---|
| 864 | std::set<uint32> m_DisabledPlayerSpells; |
---|
| 865 | std::set<uint32> m_DisabledCreatureSpells; |
---|
| 866 | |
---|
| 867 | GraveYardMap mGraveYardMap; |
---|
| 868 | |
---|
| 869 | GameTeleMap m_GameTeleMap; |
---|
| 870 | |
---|
| 871 | ScriptNameMap m_scriptNames; |
---|
| 872 | |
---|
| 873 | typedef std::vector<LocaleConstant> LocalForIndex; |
---|
| 874 | LocalForIndex m_LocalForIndex; |
---|
| 875 | int GetOrNewIndexForLocale(LocaleConstant loc); |
---|
| 876 | |
---|
| 877 | int DBCLocaleIndex; |
---|
| 878 | private: |
---|
| 879 | void LoadScripts(ScriptMapMap& scripts, char const* tablename); |
---|
| 880 | void CheckScripts(ScriptMapMap const& scripts,std::set<int32>& ids); |
---|
| 881 | void ConvertCreatureAddonAuras(CreatureDataAddon* addon, char const* table, char const* guidEntryStr); |
---|
| 882 | void LoadQuestRelationsHelper(QuestRelations& map,char const* table); |
---|
| 883 | |
---|
| 884 | typedef std::map<uint32,PetLevelInfo*> PetLevelInfoMap; |
---|
| 885 | // PetLevelInfoMap[creature_id][level] |
---|
| 886 | PetLevelInfoMap petInfo; // [creature_id][level] |
---|
| 887 | |
---|
| 888 | PlayerClassInfo playerClassInfo[MAX_CLASSES]; |
---|
| 889 | |
---|
| 890 | void BuildPlayerLevelInfo(uint8 race, uint8 class_, uint8 level, PlayerLevelInfo* plinfo) const; |
---|
| 891 | PlayerInfo playerInfo[MAX_RACES][MAX_CLASSES]; |
---|
| 892 | |
---|
| 893 | typedef std::map<uint32,uint32> BaseXPMap; // [area level][base xp] |
---|
| 894 | BaseXPMap mBaseXPTable; |
---|
| 895 | |
---|
| 896 | typedef std::map<uint32,int32> FishingBaseSkillMap; // [areaId][base skill level] |
---|
| 897 | FishingBaseSkillMap mFishingBaseForArea; |
---|
| 898 | |
---|
| 899 | typedef std::map<uint32,std::vector<std::string> > HalfNameMap; |
---|
| 900 | HalfNameMap PetHalfName0; |
---|
| 901 | HalfNameMap PetHalfName1; |
---|
| 902 | |
---|
| 903 | MapObjectGuids mMapObjectGuids; |
---|
| 904 | CreatureDataMap mCreatureDataMap; |
---|
| 905 | CreatureLocaleMap mCreatureLocaleMap; |
---|
| 906 | GameObjectDataMap mGameObjectDataMap; |
---|
| 907 | GameObjectLocaleMap mGameObjectLocaleMap; |
---|
| 908 | ItemLocaleMap mItemLocaleMap; |
---|
| 909 | QuestLocaleMap mQuestLocaleMap; |
---|
| 910 | NpcTextLocaleMap mNpcTextLocaleMap; |
---|
| 911 | PageTextLocaleMap mPageTextLocaleMap; |
---|
| 912 | TrinityStringLocaleMap mTrinityStringLocaleMap; |
---|
| 913 | NpcOptionLocaleMap mNpcOptionLocaleMap; |
---|
| 914 | RespawnTimes mCreatureRespawnTimes; |
---|
| 915 | RespawnTimes mGORespawnTimes; |
---|
| 916 | |
---|
| 917 | typedef std::vector<uint32> GuildBankTabPriceMap; |
---|
| 918 | GuildBankTabPriceMap mGuildBankTabPrice; |
---|
| 919 | |
---|
| 920 | // Storage for Conditions. First element (index 0) is reserved for zero-condition (nothing required) |
---|
| 921 | typedef std::vector<PlayerCondition> ConditionStore; |
---|
| 922 | ConditionStore mConditions; |
---|
| 923 | |
---|
| 924 | CacheNpcOptionList m_mCacheNpcOptionList; |
---|
| 925 | CacheNpcTextIdMap m_mCacheNpcTextIdMap; |
---|
| 926 | CacheVendorItemMap m_mCacheVendorItemMap; |
---|
| 927 | CacheTrainerSpellMap m_mCacheTrainerSpellMap; |
---|
| 928 | }; |
---|
| 929 | |
---|
| 930 | #define objmgr Trinity::Singleton<ObjectMgr>::Instance() |
---|
| 931 | |
---|
| 932 | // 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(); |
---|
| 937 | |
---|
| 938 | #endif |
---|