Merge commit 'origin/master' into 310

This commit is contained in:
VladimirMangos 2009-03-27 03:22:41 +03:00
commit bb9e2ab658
46 changed files with 410 additions and 386 deletions

View file

@ -20,7 +20,7 @@
#include "Common.h"
#include "Player.h"
#include "WorldPacket.h"
#include "Database/DBCEnums.h"
#include "DBCEnums.h"
#include "GameEventMgr.h"
#include "ObjectMgr.h"
#include "Guild.h"
@ -725,14 +725,24 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
if(!worldOverlayEntry)
break;
int32 exploreFlag = GetAreaFlagByAreaID(worldOverlayEntry->areatableID);
if(exploreFlag < 0)
break;
bool matchFound = false;
for (int i = 0; i < 3; ++i)
{
int32 exploreFlag = GetAreaFlagByAreaID(worldOverlayEntry->areatableID[i]);
if(exploreFlag < 0)
break;
uint32 playerIndexOffset = uint32(exploreFlag) / 32;
uint32 mask = 1<< (uint32(exploreFlag) % 32);
uint32 playerIndexOffset = uint32(exploreFlag) / 32;
uint32 mask = 1<< (uint32(exploreFlag) % 32);
if(GetPlayer()->GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + playerIndexOffset) & mask)
if(GetPlayer()->GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + playerIndexOffset) & mask)
{
matchFound = true;
break;
}
}
if(matchFound)
SetCriteriaProgress(achievementCriteria, 1);
break;
}
@ -752,18 +762,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
}
case ACHIEVEMENT_CRITERIA_TYPE_GAIN_EXALTED_REPUTATION:
{
// skip faction check only at loading
if (miscvalue1 && GetPlayer()->GetReputationRank(miscvalue1) < REP_EXALTED)
continue;
uint32 counter = 0;
FactionStateList const& factionStateList = GetPlayer()->GetReputationMgr().GetStateList();
for (FactionStateList::const_iterator iter = factionStateList.begin(); iter!= factionStateList.end(); ++iter)
if(FactionEntry const *factionEntry = sFactionStore.LookupEntry(iter->second.ID))
if(ReputationMgr::ReputationToRank(iter->second.Standing + GetPlayer()->GetReputationMgr().GetBaseReputation(factionEntry)) >= REP_EXALTED)
++counter;
SetCriteriaProgress(achievementCriteria, counter);
SetCriteriaProgress(achievementCriteria, GetPlayer()->GetReputationMgr().GetExaltedFactionCount());
break;
}
case ACHIEVEMENT_CRITERIA_TYPE_VISIT_BARBER_SHOP:
@ -856,6 +855,15 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
SetCriteriaProgress(achievementCriteria, spellCount);
break;
}
case ACHIEVEMENT_CRITERIA_TYPE_GAIN_REVERED_REPUTATION:
SetCriteriaProgress(achievementCriteria, GetPlayer()->GetReputationMgr().GetReveredFactionCount());
break;
case ACHIEVEMENT_CRITERIA_TYPE_GAIN_HONORED_REPUTATION:
SetCriteriaProgress(achievementCriteria, GetPlayer()->GetReputationMgr().GetHonoredFactionCount());
break;
case ACHIEVEMENT_CRITERIA_TYPE_KNOWN_FACTIONS:
SetCriteriaProgress(achievementCriteria, GetPlayer()->GetReputationMgr().GetVisibleFactionCount());
break;
case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2:
{
if (!miscvalue1 || miscvalue1 != achievementCriteria->cast_spell.spellID)
@ -920,9 +928,6 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
case ACHIEVEMENT_CRITERIA_TYPE_CREATE_AUCTION:
case ACHIEVEMENT_CRITERIA_TYPE_WON_AUCTIONS:
case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_GOLD_VALUE_OWNED:
case ACHIEVEMENT_CRITERIA_TYPE_GAIN_REVERED_REPUTATION:
case ACHIEVEMENT_CRITERIA_TYPE_GAIN_HONORED_REPUTATION:
case ACHIEVEMENT_CRITERIA_TYPE_KNOWN_FACTIONS:
case ACHIEVEMENT_CRITERIA_TYPE_LOOT_EPIC_ITEM:
case ACHIEVEMENT_CRITERIA_TYPE_RECEIVE_EPIC_ITEM:
case ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED:
@ -1057,6 +1062,9 @@ bool AchievementMgr::IsCompletedCriteria(AchievementCriteriaEntry const* achieve
case ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_MAIL:
case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_BID:
case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_SOLD:
case ACHIEVEMENT_CRITERIA_TYPE_GAIN_REVERED_REPUTATION:
case ACHIEVEMENT_CRITERIA_TYPE_GAIN_HONORED_REPUTATION:
case ACHIEVEMENT_CRITERIA_TYPE_KNOWN_FACTIONS:
case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEALTH:
case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_SPELLPOWER:
case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_ARMOR:

View file

@ -20,9 +20,9 @@
#include "Common.h"
#include "Policies/Singleton.h"
#include "Database/DBCEnums.h"
#include "Database/DBCStores.h"
#include "Database/DatabaseEnv.h"
#include "DBCEnums.h"
#include "DBCStores.h"
#include <map>
#include <string>

View file

@ -18,8 +18,8 @@
#include "Common.h"
#include "Database/DatabaseEnv.h"
#include "Database/DBCStores.h"
#include "Database/SQLStorage.h"
#include "DBCStores.h"
#include "ProgressBar.h"
#include "AccountMgr.h"

322
src/game/DBCEnums.h Normal file
View file

@ -0,0 +1,322 @@
/*
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef DBCENUMS_H
#define DBCENUMS_H
// client supported max level for player/pets/etc. Avoid overflow or client stability affected.
// also see GT_MAX_LEVEL define
#define MAX_LEVEL 100
// Server side limitation. Base at used code requirements.
// also see MAX_LEVEL and GT_MAX_LEVEL define
#define STRONG_MAX_LEVEL 255
enum AreaTeams
{
AREATEAM_NONE = 0,
AREATEAM_ALLY = 2,
AREATEAM_HORDE = 4
};
enum AchievementFactionFlags
{
ACHIEVEMENT_FACTION_FLAG_HORDE = 0x00000000,
ACHIEVEMENT_FACTION_FLAG_ALLIANCE = 0x00000001,
};
enum AchievementFlags
{
ACHIEVEMENT_FLAG_COUNTER = 0x00000001,
ACHIEVEMENT_FLAG_REACH_LEVEL = 0x00000004,
ACHIEVEMENT_FLAG_RERERED_MAX = 0x00000010, // displays the maximum criteria of a refered achievement
ACHIEVEMENT_FLAG_AVERAGE = 0x00000040,
ACHIEVEMENT_FLAG_REALM_FIRST_REACH= 0x00000100,
ACHIEVEMENT_FLAG_REALM_FIRST_KILL = 0x00000200,
};
enum AchievementCriteriaCondition
{
ACHIEVEMENT_CRITERIA_CONDITION_NONE = 0,
ACHIEVEMENT_CRITERIA_CONDITION_NO_DEATH = 1,
ACHIEVEMENT_CRITERIA_CONDITION_UNK1 = 2, // only used in "Complete a daily quest every day for five consecutive days"
ACHIEVEMENT_CRITERIA_CONDITION_MAP = 3, // requires you to be on specific map
ACHIEVEMENT_CRITERIA_CONDITION_NO_LOOSE = 4, // only used in "Win 10 arenas without losing"
ACHIEVEMENT_CRITERIA_CONDITION_UNK2 = 9, // unk
ACHIEVEMENT_CRITERIA_CONDITION_UNK3 = 13, // unk
};
enum AchievementCriteriaCompletionFlags
{
// some Achievements (like 698) have several criteria but only one has to be fulfilled. These are identified by this flag.
ACHIEVEMENT_CRITERIA_COMPLETE_FLAG_ALL = 2,
};
enum AchievementCriteriaGroupFlags
{
// you mustn't be in a group while fulfilling this achievement
ACHIEVEMENT_CRITERIA_GROUP_NOT_IN_GROUP = 2,
};
enum AchievementCriteriaTypes
{
ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE = 0,
ACHIEVEMENT_CRITERIA_TYPE_WIN_BG = 1,
ACHIEVEMENT_CRITERIA_TYPE_REACH_LEVEL = 5,
ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL = 7,
ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_ACHIEVEMENT = 8,
ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST_COUNT = 9,
// you have to complete a daily quest x times in a row
ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_DAILY_QUEST_DAILY = 10,
ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUESTS_IN_ZONE = 11,
ACHIEVEMENT_CRITERIA_TYPE_DAMAGE_DONE = 13,
ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_DAILY_QUEST = 14,
ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_BATTLEGROUND= 15,
ACHIEVEMENT_CRITERIA_TYPE_DEATH_AT_MAP= 16,
ACHIEVEMENT_CRITERIA_TYPE_DEATH= 17,
ACHIEVEMENT_CRITERIA_TYPE_DEATH_IN_DUNGEON = 18,
ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_RAID = 19,
ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_CREATURE = 20,
ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_PLAYER = 23,
ACHIEVEMENT_CRITERIA_TYPE_FALL_WITHOUT_DYING = 24,
ACHIEVEMENT_CRITERIA_TYPE_DEATHS_FROM = 26,
ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST = 27,
ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET = 28,
ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL= 29,
ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE = 30,
ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL_AT_AREA = 31,
ACHIEVEMENT_CRITERIA_TYPE_WIN_ARENA = 32,
ACHIEVEMENT_CRITERIA_TYPE_PLAY_ARENA = 33,
ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL = 34,
// TODO: this criteria has additional conditions which can not be found in the dbcs
ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL = 35,
ACHIEVEMENT_CRITERIA_TYPE_OWN_ITEM = 36,
// TODO: the archievements 1162 and 1163 requires a special rating which can't be found in the dbc
ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA = 37,
ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_TEAM_RATING = 38,
ACHIEVEMENT_CRITERIA_TYPE_REACH_TEAM_RATING = 39,
ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LEVEL = 40,
ACHIEVEMENT_CRITERIA_TYPE_USE_ITEM = 41,
ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM= 42,
ACHIEVEMENT_CRITERIA_TYPE_EXPLORE_AREA = 43,
ACHIEVEMENT_CRITERIA_TYPE_OWN_RANK= 44,
ACHIEVEMENT_CRITERIA_TYPE_BUY_BANK_SLOT= 45,
ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION= 46,
ACHIEVEMENT_CRITERIA_TYPE_GAIN_EXALTED_REPUTATION= 47,
// noted: rewarded as soon as the player payed, not at taking place at the seat
ACHIEVEMENT_CRITERIA_TYPE_VISIT_BARBER_SHOP= 48,
ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM = 49,
// TODO: itemlevel is mentioned in text but not present in dbc
ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED_ON_LOOT = 50,
ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED_ON_LOOT= 51,
ACHIEVEMENT_CRITERIA_TYPE_HK_CLASS = 52,
ACHIEVEMENT_CRITERIA_TYPE_HK_RACE = 53,
ACHIEVEMENT_CRITERIA_TYPE_DO_EMOTE = 54,
ACHIEVEMENT_CRITERIA_TYPE_HEALING_DONE = 55,
// TODO: in some cases map not present, and in some cases need do without die
ACHIEVEMENT_CRITERIA_TYPE_GET_KILLING_BLOWS = 56,
ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM = 57,
ACHIEVEMENT_CRITERIA_TYPE_MONEY_FROM_VENDORS = 59,
ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_TALENTS = 60,
ACHIEVEMENT_CRITERIA_TYPE_NUMBER_OF_TALENT_RESETS = 61,
ACHIEVEMENT_CRITERIA_TYPE_MONEY_FROM_QUEST_REWARD = 62,
ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_TRAVELLING = 63,
ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_AT_BARBER = 65,
ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_MAIL = 66,
ACHIEVEMENT_CRITERIA_TYPE_LOOT_MONEY = 67,
ACHIEVEMENT_CRITERIA_TYPE_USE_GAMEOBJECT = 68,
ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2= 69,
ACHIEVEMENT_CRITERIA_TYPE_SPECIAL_PVP_KILL= 70,
ACHIEVEMENT_CRITERIA_TYPE_FISH_IN_GAMEOBJECT = 72,
// TODO: title id is not mentioned in dbc
ACHIEVEMENT_CRITERIA_TYPE_EARNED_PVP_TITLE = 74,
ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILLLINE_SPELLS= 75,
ACHIEVEMENT_CRITERIA_TYPE_WIN_DUEL = 76,
ACHIEVEMENT_CRITERIA_TYPE_LOSE_DUEL = 77,
// TODO: creature type (demon, undead etc.) is not stored in dbc
ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE_TYPE = 78,
ACHIEVEMENT_CRITERIA_TYPE_GOLD_EARNED_BY_AUCTIONS= 80,
ACHIEVEMENT_CRITERIA_TYPE_CREATE_AUCTION= 82,
ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_BID= 83,
ACHIEVEMENT_CRITERIA_TYPE_WON_AUCTIONS= 84,
ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_SOLD = 85,
ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_GOLD_VALUE_OWNED = 86,
ACHIEVEMENT_CRITERIA_TYPE_GAIN_REVERED_REPUTATION = 87,
ACHIEVEMENT_CRITERIA_TYPE_GAIN_HONORED_REPUTATION = 88,
ACHIEVEMENT_CRITERIA_TYPE_KNOWN_FACTIONS = 89,
ACHIEVEMENT_CRITERIA_TYPE_LOOT_EPIC_ITEM = 90,
ACHIEVEMENT_CRITERIA_TYPE_RECEIVE_EPIC_ITEM = 91,
ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED = 93,
ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED = 94,
ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEALTH = 95,
ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_POWER = 96,
ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_STAT = 97,
ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_SPELLPOWER = 98,
ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_ARMOR = 99,
ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_RATING = 100,
ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HIT_DEALT = 101,
ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HIT_RECEIVED = 102,
ACHIEVEMENT_CRITERIA_TYPE_TOTAL_DAMAGE_RECEIVED = 103,
ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEAL_CASTED = 104,
ACHIEVEMENT_CRITERIA_TYPE_TOTAL_HEALING_RECEIVED = 105,
ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEALING_RECEIVED = 106,
ACHIEVEMENT_CRITERIA_TYPE_QUEST_ABANDONED = 107,
ACHIEVEMENT_CRITERIA_TYPE_FLIGHT_PATHS_TAKEN = 108,
ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE = 109,
// TODO: target entry is missing
ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2 = 110,
ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LINE= 112,
ACHIEVEMENT_CRITERIA_TYPE_EARN_HONORABLE_KILL = 113,
ACHIEVEMENT_CRITERIA_TYPE_ACCEPTED_SUMMONINGS = 114,
// 0..114 => 115 criteria types total
ACHIEVEMENT_CRITERIA_TYPE_TOTAL = 115,
};
enum AreaFlags
{
AREA_FLAG_SNOW = 0x00000001, // snow (only Dun Morogh, Naxxramas, Razorfen Downs and Winterspring)
AREA_FLAG_UNK1 = 0x00000002, // may be necropolis?
AREA_FLAG_UNK2 = 0x00000004, // Only used for areas on map 571 (development before)
AREA_FLAG_SLAVE_CAPITAL = 0x00000008, // city and city subsones
AREA_FLAG_UNK3 = 0x00000010, // can't find common meaning
AREA_FLAG_SLAVE_CAPITAL2 = 0x00000020, // slave capital city flag?
AREA_FLAG_UNK4 = 0x00000040, // many zones have this flag
AREA_FLAG_ARENA = 0x00000080, // arena, both instanced and world arenas
AREA_FLAG_CAPITAL = 0x00000100, // main capital city flag
AREA_FLAG_CITY = 0x00000200, // only for one zone named "City" (where it located?)
AREA_FLAG_OUTLAND = 0x00000400, // expansion zones? (only Eye of the Storm not have this flag, but have 0x00004000 flag)
AREA_FLAG_SANCTUARY = 0x00000800, // sanctuary area (PvP disabled)
AREA_FLAG_NEED_FLY = 0x00001000, // only Netherwing Ledge, Socrethar's Seat, Tempest Keep, The Arcatraz, The Botanica, The Mechanar, Sorrow Wing Point, Dragonspine Ridge, Netherwing Mines, Dragonmaw Base Camp, Dragonmaw Skyway
AREA_FLAG_UNUSED1 = 0x00002000, // not used now (no area/zones with this flag set in 3.0.3)
AREA_FLAG_OUTLAND2 = 0x00004000, // expansion zones? (only Circle of Blood Arena not have this flag, but have 0x00000400 flag)
AREA_FLAG_PVP = 0x00008000, // pvp objective area? (Death's Door also has this flag although it's no pvp object area)
AREA_FLAG_ARENA_INSTANCE = 0x00010000, // used by instanced arenas only
AREA_FLAG_UNUSED2 = 0x00020000, // not used now (no area/zones with this flag set in 3.0.3)
AREA_FLAG_UNK5 = 0x00040000, // only used for Amani Pass, Hatchet Hills
AREA_FLAG_UNK6 = 0x00080000, // Valgarde and Acherus: The Ebon Hold
AREA_FLAG_LOWLEVEL = 0x00100000, // used for some starting areas with area_level <=15
AREA_FLAG_TOWN = 0x00200000, // small towns with Inn
AREA_FLAG_UNK7 = 0x00400000, // Warsong Hold, Acherus: The Ebon Hold, New Agamand Inn, Vengeance Landing Inn
AREA_FLAG_UNK8 = 0x00800000, // Westguard Inn, Acherus: The Ebon Hold, Valgarde
AREA_FLAG_OUTDOOR_PVP = 0x01000000, // Wintergrasp and it's subzones
AREA_FLAG_UNK9 = 0x02000000, // unknown
AREA_FLAG_UNK10 = 0x04000000, // unknown
AREA_FLAG_OUTDOOR_PVP2 = 0x08000000 // Wintergrasp and it's subzones
};
enum FactionTemplateFlags
{
FACTION_TEMPLATE_FLAG_CONTESTED_GUARD = 0x00001000, // faction will attack players that were involved in PvP combats
};
enum FactionMasks
{
FACTION_MASK_PLAYER = 1, // any player
FACTION_MASK_ALLIANCE = 2, // player or creature from alliance team
FACTION_MASK_HORDE = 4, // player or creature from horde team
FACTION_MASK_MONSTER = 8 // aggressive creature from monster team
// if none flags set then non-aggressive creature
};
enum MapTypes
{
MAP_COMMON = 0,
MAP_INSTANCE = 1,
MAP_RAID = 2,
MAP_BATTLEGROUND = 3,
MAP_ARENA = 4
};
enum AbilytyLearnType
{
ABILITY_LEARNED_ON_GET_PROFESSION_SKILL = 1,
ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL = 2
};
enum ItemEnchantmentType
{
ITEM_ENCHANTMENT_TYPE_NONE = 0,
ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL = 1,
ITEM_ENCHANTMENT_TYPE_DAMAGE = 2,
ITEM_ENCHANTMENT_TYPE_EQUIP_SPELL = 3,
ITEM_ENCHANTMENT_TYPE_RESISTANCE = 4,
ITEM_ENCHANTMENT_TYPE_STAT = 5,
ITEM_ENCHANTMENT_TYPE_TOTEM = 6,
ITEM_ENCHANTMENT_TYPE_USE_SPELL = 7,
ITEM_ENCHANTMENT_TYPE_PRISMATIC_SOCKET = 8
};
enum TotemCategoryType
{
TOTEM_CATEGORY_TYPE_KNIFE = 1,
TOTEM_CATEGORY_TYPE_TOTEM = 2,
TOTEM_CATEGORY_TYPE_ROD = 3,
TOTEM_CATEGORY_TYPE_PICK = 21,
TOTEM_CATEGORY_TYPE_STONE = 22,
TOTEM_CATEGORY_TYPE_HAMMER = 23,
TOTEM_CATEGORY_TYPE_SPANNER = 24
};
// SummonProperties.dbc, col 1
/*enum SummonGroup
{
SUMMON_GROUP_UNKNOWN1 = 0, // 1160 spells in 3.0.3
SUMMON_GROUP_UNKNOWN2 = 1, // 861 spells in 3.0.3
SUMMON_GROUP_PETS = 2, // 52 spells in 3.0.3, pets mostly
SUMMON_GROUP_CONTROLLABLE = 3, // 13 spells in 3.0.3, mostly controllable
SUMMON_GROUP_UNKNOWN3 = 4 // 86 spells in 3.0.3, taxi/mounts
};
// SummonProperties.dbc, col 3
enum SummonType
{
SUMMON_TYPE_UNKNOWN = 0, // different summons, 1330 spells in 3.0.3
SUMMON_TYPE_SUMMON = 1, // generic summons, 49 spells in 3.0.3
SUMMON_TYPE_GUARDIAN = 2, // summon guardian, 393 spells in 3.0.3
SUMMON_TYPE_ARMY = 3, // summon army, 5 spells in 3.0.3
SUMMON_TYPE_TOTEM = 4, // summon totem, 169 spells in 3.0.3
SUMMON_TYPE_CRITTER = 5, // critter/minipet, 195 spells in 3.0.3
SUMMON_TYPE_DK = 6, // summon DRW/Ghoul, 2 spells in 3.0.3
SUMMON_TYPE_BOMB = 7, // summon bot/bomb, 4 spells in 3.0.3
SUMMON_TYPE_PHASING = 8, // something todo with DK prequest line, 2 spells in 3.0.3
SUMMON_TYPE_SIEGE_VEH = 9, // summon different vehicles, 14 spells in 3.0.3
SUMMON_TYPE_DRAKE_VEH = 10, // summon drake (vehicle), 3 spells
SUMMON_TYPE_LIGHTWELL = 11 // summon lightwell, 6 spells in 3.0.3
};
// SummonProperties.dbc, col 5
enum SummonFlags
{
SUMMON_FLAG_NONE = 0x0000, // 1342 spells in 3.0.3
SUMMON_FLAG_UNK1 = 0x0001, // 75 spells in 3.0.3, something unfriendly
SUMMON_FLAG_UNK2 = 0x0002, // 616 spells in 3.0.3, something friendly
SUMMON_FLAG_UNK3 = 0x0004, // 22 spells in 3.0.3, no idea...
SUMMON_FLAG_UNK4 = 0x0008, // 49 spells in 3.0.3, some mounts
SUMMON_FLAG_UNK5 = 0x0010, // 25 spells in 3.0.3, quest related?
SUMMON_FLAG_UNK6 = 0x0020, // 0 spells in 3.0.3, unused
SUMMON_FLAG_UNK7 = 0x0040, // 12 spells in 3.0.3, no idea
SUMMON_FLAG_UNK8 = 0x0080, // 4 spells in 3.0.3, no idea
SUMMON_FLAG_UNK9 = 0x0100, // 51 spells in 3.0.3, no idea, many quest related
SUMMON_FLAG_UNK10 = 0x0200, // 51 spells in 3.0.3, something defensive
SUMMON_FLAG_UNK11 = 0x0400, // 3 spells, requires something near?
SUMMON_FLAG_UNK12 = 0x0800, // 30 spells in 3.0.3, no idea
SUMMON_FLAG_UNK13 = 0x1000, // 8 spells in 3.0.3, siege vehicle
SUMMON_FLAG_UNK14 = 0x2000, // 2 spells in 3.0.3, escort?
};
*/
#endif

651
src/game/DBCStores.cpp Normal file
View file

@ -0,0 +1,651 @@
/*
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "DBCStores.h"
#include "Policies/SingletonImp.h"
#include "Log.h"
#include "ProgressBar.h"
#include "DBCfmt.h"
#include <map>
typedef std::map<uint16,uint32> AreaFlagByAreaID;
typedef std::map<uint32,uint32> AreaFlagByMapID;
DBCStorage <AreaTableEntry> sAreaStore(AreaTableEntryfmt);
DBCStorage <AreaGroupEntry> sAreaGroupStore(AreaGroupEntryfmt);
static AreaFlagByAreaID sAreaFlagByAreaID;
static AreaFlagByMapID sAreaFlagByMapID; // for instances without generated *.map files
DBCStorage <AchievementEntry> sAchievementStore(Achievementfmt);
DBCStorage <AchievementCriteriaEntry> sAchievementCriteriaStore(AchievementCriteriafmt);
DBCStorage <AreaTriggerEntry> sAreaTriggerStore(AreaTriggerEntryfmt);
DBCStorage <AuctionHouseEntry> sAuctionHouseStore(AuctionHouseEntryfmt);
DBCStorage <BankBagSlotPricesEntry> sBankBagSlotPricesStore(BankBagSlotPricesEntryfmt);
DBCStorage <BattlemasterListEntry> sBattlemasterListStore(BattlemasterListEntryfmt);
DBCStorage <BarberShopStyleEntry> sBarberShopStyleStore(BarberShopStyleEntryfmt);
DBCStorage <CharStartOutfitEntry> sCharStartOutfitStore(CharStartOutfitEntryfmt);
DBCStorage <CharTitlesEntry> sCharTitlesStore(CharTitlesEntryfmt);
DBCStorage <ChatChannelsEntry> sChatChannelsStore(ChatChannelsEntryfmt);
DBCStorage <ChrClassesEntry> sChrClassesStore(ChrClassesEntryfmt);
DBCStorage <ChrRacesEntry> sChrRacesStore(ChrRacesEntryfmt);
DBCStorage <CreatureDisplayInfoEntry> sCreatureDisplayInfoStore(CreatureDisplayInfofmt);
DBCStorage <CreatureFamilyEntry> sCreatureFamilyStore(CreatureFamilyfmt);
DBCStorage <CreatureSpellDataEntry> sCreatureSpellDataStore(CreatureSpellDatafmt);
DBCStorage <CreatureTypeEntry> sCreatureTypeStore(CreatureTypefmt);
DBCStorage <CurrencyTypesEntry> sCurrencyTypesStore(CurrencyTypesfmt);
DBCStorage <DurabilityQualityEntry> sDurabilityQualityStore(DurabilityQualityfmt);
DBCStorage <DurabilityCostsEntry> sDurabilityCostsStore(DurabilityCostsfmt);
DBCStorage <EmotesTextEntry> sEmotesTextStore(EmoteEntryfmt);
typedef std::map<uint32,SimpleFactionsList> FactionTeamMap;
static FactionTeamMap sFactionTeamMap;
DBCStorage <FactionEntry> sFactionStore(FactionEntryfmt);
DBCStorage <FactionTemplateEntry> sFactionTemplateStore(FactionTemplateEntryfmt);
DBCStorage <GemPropertiesEntry> sGemPropertiesStore(GemPropertiesEntryfmt);
DBCStorage <GlyphPropertiesEntry> sGlyphPropertiesStore(GlyphPropertiesfmt);
DBCStorage <GlyphSlotEntry> sGlyphSlotStore(GlyphSlotfmt);
DBCStorage <GtBarberShopCostBaseEntry> sGtBarberShopCostBaseStore(GtBarberShopCostBasefmt);
DBCStorage <GtCombatRatingsEntry> sGtCombatRatingsStore(GtCombatRatingsfmt);
DBCStorage <GtChanceToMeleeCritBaseEntry> sGtChanceToMeleeCritBaseStore(GtChanceToMeleeCritBasefmt);
DBCStorage <GtChanceToMeleeCritEntry> sGtChanceToMeleeCritStore(GtChanceToMeleeCritfmt);
DBCStorage <GtChanceToSpellCritBaseEntry> sGtChanceToSpellCritBaseStore(GtChanceToSpellCritBasefmt);
DBCStorage <GtChanceToSpellCritEntry> sGtChanceToSpellCritStore(GtChanceToSpellCritfmt);
DBCStorage <GtOCTRegenHPEntry> sGtOCTRegenHPStore(GtOCTRegenHPfmt);
//DBCStorage <GtOCTRegenMPEntry> sGtOCTRegenMPStore(GtOCTRegenMPfmt); -- not used currently
DBCStorage <GtRegenHPPerSptEntry> sGtRegenHPPerSptStore(GtRegenHPPerSptfmt);
DBCStorage <GtRegenMPPerSptEntry> sGtRegenMPPerSptStore(GtRegenMPPerSptfmt);
DBCStorage <HolidaysEntry> sHolidaysStore(Holidaysfmt);
DBCStorage <ItemEntry> sItemStore(Itemfmt);
DBCStorage <ItemBagFamilyEntry> sItemBagFamilyStore(ItemBagFamilyfmt);
//DBCStorage <ItemCondExtCostsEntry> sItemCondExtCostsStore(ItemCondExtCostsEntryfmt);
//DBCStorage <ItemDisplayInfoEntry> sItemDisplayInfoStore(ItemDisplayTemplateEntryfmt); -- not used currently
DBCStorage <ItemExtendedCostEntry> sItemExtendedCostStore(ItemExtendedCostEntryfmt);
DBCStorage <ItemLimitCategoryEntry> sItemLimitCategoryStore(ItemLimitCategoryEntryfmt);
DBCStorage <ItemRandomPropertiesEntry> sItemRandomPropertiesStore(ItemRandomPropertiesfmt);
DBCStorage <ItemRandomSuffixEntry> sItemRandomSuffixStore(ItemRandomSuffixfmt);
DBCStorage <ItemSetEntry> sItemSetStore(ItemSetEntryfmt);
DBCStorage <LockEntry> sLockStore(LockEntryfmt);
DBCStorage <MailTemplateEntry> sMailTemplateStore(MailTemplateEntryfmt);
DBCStorage <MapEntry> sMapStore(MapEntryfmt);
DBCStorage <QuestSortEntry> sQuestSortStore(QuestSortEntryfmt);
DBCStorage <RandomPropertiesPointsEntry> sRandomPropertiesPointsStore(RandomPropertiesPointsfmt);
DBCStorage <ScalingStatDistributionEntry> sScalingStatDistributionStore(ScalingStatDistributionfmt);
DBCStorage <ScalingStatValuesEntry> sScalingStatValuesStore(ScalingStatValuesfmt);
DBCStorage <SkillLineEntry> sSkillLineStore(SkillLinefmt);
DBCStorage <SkillLineAbilityEntry> sSkillLineAbilityStore(SkillLineAbilityfmt);
DBCStorage <SoundEntriesEntry> sSoundEntriesStore(SoundEntriesfmt);
DBCStorage <SpellItemEnchantmentEntry> sSpellItemEnchantmentStore(SpellItemEnchantmentfmt);
DBCStorage <SpellItemEnchantmentConditionEntry> sSpellItemEnchantmentConditionStore(SpellItemEnchantmentConditionfmt);
DBCStorage <SpellEntry> sSpellStore(SpellEntryfmt);
SpellCategoryStore sSpellCategoryStore;
PetFamilySpellsStore sPetFamilySpellsStore;
DBCStorage <SpellCastTimesEntry> sSpellCastTimesStore(SpellCastTimefmt);
DBCStorage <SpellDurationEntry> sSpellDurationStore(SpellDurationfmt);
DBCStorage <SpellFocusObjectEntry> sSpellFocusObjectStore(SpellFocusObjectfmt);
DBCStorage <SpellRadiusEntry> sSpellRadiusStore(SpellRadiusfmt);
DBCStorage <SpellRangeEntry> sSpellRangeStore(SpellRangefmt);
DBCStorage <SpellRuneCostEntry> sSpellRuneCostStore(SpellRuneCostfmt);
DBCStorage <SpellShapeshiftEntry> sSpellShapeshiftStore(SpellShapeshiftfmt);
DBCStorage <StableSlotPricesEntry> sStableSlotPricesStore(StableSlotPricesfmt);
//DBCStorage <SummonPropertiesEntry> sSummonPropertiesStore(SummonPropertiesfmt);
DBCStorage <TalentEntry> sTalentStore(TalentEntryfmt);
TalentSpellPosMap sTalentSpellPosMap;
DBCStorage <TalentTabEntry> sTalentTabStore(TalentTabEntryfmt);
// store absolute bit position for first rank for talent inspect
static uint32 sTalentTabPages[12/*MAX_CLASSES*/][3];
DBCStorage <TaxiNodesEntry> sTaxiNodesStore(TaxiNodesEntryfmt);
TaxiMask sTaxiNodesMask;
// DBC used only for initialization sTaxiPathSetBySource at startup.
TaxiPathSetBySource sTaxiPathSetBySource;
DBCStorage <TaxiPathEntry> sTaxiPathStore(TaxiPathEntryfmt);
// DBC used only for initialization sTaxiPathSetBySource at startup.
TaxiPathNodesByPath sTaxiPathNodesByPath;
static DBCStorage <TaxiPathNodeEntry> sTaxiPathNodeStore(TaxiPathNodeEntryfmt);
DBCStorage <TotemCategoryEntry> sTotemCategoryStore(TotemCategoryEntryfmt);
DBCStorage <VehicleEntry> sVehicleStore(VehicleEntryfmt);
DBCStorage <VehicleSeatEntry> sVehicleSeatStore(VehicleSeatEntryfmt);
DBCStorage <WorldMapAreaEntry> sWorldMapAreaStore(WorldMapAreaEntryfmt);
DBCStorage <WorldSafeLocsEntry> sWorldSafeLocsStore(WorldSafeLocsEntryfmt);
DBCStorage <WorldMapOverlayEntry> sWorldMapOverlayStore(WorldMapOverlayEntryfmt);
typedef std::list<std::string> StoreProblemList;
static bool LoadDBC_assert_print(uint32 fsize,uint32 rsize, const std::string& filename)
{
sLog.outError("ERROR: Size of '%s' setted by format string (%u) not equal size of C++ structure (%u).",filename.c_str(),fsize,rsize);
// assert must fail after function call
return false;
}
template<class T>
inline void LoadDBC(uint32& availableDbcLocales,barGoLink& bar, StoreProblemList& errlist, DBCStorage<T>& storage, const std::string& dbc_path, const std::string& filename)
{
// compatibility format and C++ structure sizes
assert(DBCFileLoader::GetFormatRecordSize(storage.GetFormat()) == sizeof(T) || LoadDBC_assert_print(DBCFileLoader::GetFormatRecordSize(storage.GetFormat()),sizeof(T),filename));
std::string dbc_filename = dbc_path + filename;
if(storage.Load(dbc_filename.c_str()))
{
bar.step();
for(uint8 i = 0; i < MAX_LOCALE; ++i)
{
if(!(availableDbcLocales & (1 << i)))
continue;
std::string dbc_filename_loc = dbc_path + localeNames[i] + "/" + filename;
if(!storage.LoadStringsFrom(dbc_filename_loc.c_str()))
availableDbcLocales &= ~(1<<i); // mark as not available for speedup next checks
}
}
else
{
// sort problematic dbc to (1) non compatible and (2) non-existed
FILE * f=fopen(dbc_filename.c_str(),"rb");
if(f)
{
char buf[100];
snprintf(buf,100," (exist, but have %d fields instead %d) Wrong client version DBC file?",storage.GetFieldCount(),strlen(storage.GetFormat()));
errlist.push_back(dbc_filename + buf);
fclose(f);
}
else
errlist.push_back(dbc_filename);
}
}
void LoadDBCStores(const std::string& dataPath)
{
std::string dbcPath = dataPath+"dbc/";
const uint32 DBCFilesCount = 75;
barGoLink bar( DBCFilesCount );
StoreProblemList bad_dbc_files;
uint32 availableDbcLocales = 0xFFFFFFFF;
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sAreaStore, dbcPath,"AreaTable.dbc");
// must be after sAreaStore loading
for(uint32 i = 0; i < sAreaStore.GetNumRows(); ++i) // areaflag numbered from 0
{
if(AreaTableEntry const* area = sAreaStore.LookupEntry(i))
{
// fill AreaId->DBC records
sAreaFlagByAreaID.insert(AreaFlagByAreaID::value_type(uint16(area->ID),area->exploreFlag));
// fill MapId->DBC records ( skip sub zones and continents )
if(area->zone==0 && area->mapid != 0 && area->mapid != 1 && area->mapid != 530 && area->mapid != 571 )
sAreaFlagByMapID.insert(AreaFlagByMapID::value_type(area->mapid,area->exploreFlag));
}
}
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sAchievementStore, dbcPath,"Achievement.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sAchievementCriteriaStore, dbcPath,"Achievement_Criteria.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sAreaTriggerStore, dbcPath,"AreaTrigger.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sAreaGroupStore, dbcPath,"AreaGroup.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sAuctionHouseStore, dbcPath,"AuctionHouse.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sBankBagSlotPricesStore, dbcPath,"BankBagSlotPrices.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sBattlemasterListStore, dbcPath,"BattlemasterList.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sBarberShopStyleStore, dbcPath,"BarberShopStyle.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sCharStartOutfitStore, dbcPath,"CharStartOutfit.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sCharTitlesStore, dbcPath,"CharTitles.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sChatChannelsStore, dbcPath,"ChatChannels.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sChrClassesStore, dbcPath,"ChrClasses.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sChrRacesStore, dbcPath,"ChrRaces.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sCreatureDisplayInfoStore, dbcPath,"CreatureDisplayInfo.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sCreatureFamilyStore, dbcPath,"CreatureFamily.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sCreatureSpellDataStore, dbcPath,"CreatureSpellData.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sCreatureTypeStore, dbcPath,"CreatureType.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sCurrencyTypesStore, dbcPath,"CurrencyTypes.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sDurabilityCostsStore, dbcPath,"DurabilityCosts.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sDurabilityQualityStore, dbcPath,"DurabilityQuality.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sEmotesTextStore, dbcPath,"EmotesText.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sFactionStore, dbcPath,"Faction.dbc");
for (uint32 i=0;i<sFactionStore.GetNumRows(); ++i)
{
FactionEntry const * faction = sFactionStore.LookupEntry(i);
if (faction && faction->team)
{
SimpleFactionsList &flist = sFactionTeamMap[faction->team];
flist.push_back(i);
}
}
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sFactionTemplateStore, dbcPath,"FactionTemplate.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sGemPropertiesStore, dbcPath,"GemProperties.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sGlyphPropertiesStore, dbcPath,"GlyphProperties.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sGlyphSlotStore, dbcPath,"GlyphSlot.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sGtBarberShopCostBaseStore,dbcPath,"gtBarberShopCostBase.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sGtCombatRatingsStore, dbcPath,"gtCombatRatings.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sGtChanceToMeleeCritBaseStore, dbcPath,"gtChanceToMeleeCritBase.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sGtChanceToMeleeCritStore, dbcPath,"gtChanceToMeleeCrit.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sGtChanceToSpellCritBaseStore, dbcPath,"gtChanceToSpellCritBase.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sGtChanceToSpellCritStore, dbcPath,"gtChanceToSpellCrit.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sGtOCTRegenHPStore, dbcPath,"gtOCTRegenHP.dbc");
//LoadDBC(availableDbcLocales,bar,bad_dbc_files,sGtOCTRegenMPStore, dbcPath,"gtOCTRegenMP.dbc"); -- not used currently
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sGtRegenHPPerSptStore, dbcPath,"gtRegenHPPerSpt.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sGtRegenMPPerSptStore, dbcPath,"gtRegenMPPerSpt.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sHolidaysStore, dbcPath,"Holidays.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sItemStore, dbcPath,"Item.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sItemBagFamilyStore, dbcPath,"ItemBagFamily.dbc");
//LoadDBC(availableDbcLocales,bar,bad_dbc_files,sItemDisplayInfoStore, dbcPath,"ItemDisplayInfo.dbc"); -- not used currently
//LoadDBC(availableDbcLocales,bar,bad_dbc_files,sItemCondExtCostsStore, dbcPath,"ItemCondExtCosts.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sItemExtendedCostStore, dbcPath,"ItemExtendedCost.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sItemLimitCategoryStore, dbcPath,"ItemLimitCategory.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sItemRandomPropertiesStore,dbcPath,"ItemRandomProperties.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sItemRandomSuffixStore, dbcPath,"ItemRandomSuffix.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sItemSetStore, dbcPath,"ItemSet.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sLockStore, dbcPath,"Lock.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sMailTemplateStore, dbcPath,"MailTemplate.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sMapStore, dbcPath,"Map.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sQuestSortStore, dbcPath,"QuestSort.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sRandomPropertiesPointsStore, dbcPath,"RandPropPoints.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sScalingStatDistributionStore, dbcPath,"ScalingStatDistribution.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sScalingStatValuesStore, dbcPath,"ScalingStatValues.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSkillLineStore, dbcPath,"SkillLine.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSkillLineAbilityStore, dbcPath,"SkillLineAbility.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSoundEntriesStore, dbcPath,"SoundEntries.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellStore, dbcPath,"Spell.dbc");
for(uint32 i = 1; i < sSpellStore.GetNumRows(); ++i)
{
SpellEntry const * spell = sSpellStore.LookupEntry(i);
if(spell && spell->Category)
sSpellCategoryStore[spell->Category].insert(i);
// DBC not support uint64 fields but SpellEntry have SpellFamilyFlags mapped at 2 uint32 fields
// uint32 field already converted to bigendian if need, but must be swapped for correct uint64 bigendian view
#if MANGOS_ENDIAN == MANGOS_BIGENDIAN
std::swap(*((uint32*)(&spell->SpellFamilyFlags)),*(((uint32*)(&spell->SpellFamilyFlags))+1));
#endif
}
for (uint32 j = 0; j < sSkillLineAbilityStore.GetNumRows(); ++j)
{
SkillLineAbilityEntry const *skillLine = sSkillLineAbilityStore.LookupEntry(j);
if(!skillLine)
continue;
SpellEntry const* spellInfo = sSpellStore.LookupEntry(skillLine->spellId);
if(spellInfo && (spellInfo->Attributes & 0x1D0) == 0x1D0)
{
for (unsigned int i = 1; i < sCreatureFamilyStore.GetNumRows(); ++i)
{
CreatureFamilyEntry const* cFamily = sCreatureFamilyStore.LookupEntry(i);
if(!cFamily)
continue;
if(skillLine->skillId != cFamily->skillLine[0] && skillLine->skillId != cFamily->skillLine[1])
continue;
sPetFamilySpellsStore[i].insert(spellInfo->Id);
}
}
}
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellCastTimesStore, dbcPath,"SpellCastTimes.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellDurationStore, dbcPath,"SpellDuration.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellFocusObjectStore, dbcPath,"SpellFocusObject.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellItemEnchantmentStore,dbcPath,"SpellItemEnchantment.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellItemEnchantmentConditionStore,dbcPath,"SpellItemEnchantmentCondition.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellRadiusStore, dbcPath,"SpellRadius.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellRangeStore, dbcPath,"SpellRange.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellRuneCostStore, dbcPath,"SpellRuneCost.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellShapeshiftStore, dbcPath,"SpellShapeshiftForm.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sStableSlotPricesStore, dbcPath,"StableSlotPrices.dbc");
//LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSummonPropertiesStore, dbcPath,"SummonProperties.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sTalentStore, dbcPath,"Talent.dbc");
// create talent spells set
for (unsigned int i = 0; i < sTalentStore.GetNumRows(); ++i)
{
TalentEntry const *talentInfo = sTalentStore.LookupEntry(i);
if (!talentInfo) continue;
for (int j = 0; j < MAX_TALENT_RANK; j++)
if(talentInfo->RankID[j])
sTalentSpellPosMap[talentInfo->RankID[j]] = TalentSpellPos(i,j);
}
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sTalentTabStore, dbcPath,"TalentTab.dbc");
// prepare fast data access to bit pos of talent ranks for use at inspecting
{
// now have all max ranks (and then bit amount used for store talent ranks in inspect)
for(uint32 talentTabId = 1; talentTabId < sTalentTabStore.GetNumRows(); ++talentTabId)
{
TalentTabEntry const *talentTabInfo = sTalentTabStore.LookupEntry( talentTabId );
if(!talentTabInfo)
continue;
// store class talent tab pages
uint32 cls = 1;
for(uint32 m=1;!(m & talentTabInfo->ClassMask) && cls < 12 /*MAX_CLASSES*/;m <<=1, ++cls) {}
sTalentTabPages[cls][talentTabInfo->tabpage]=talentTabId;
}
}
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sTaxiNodesStore, dbcPath,"TaxiNodes.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sTaxiPathStore, dbcPath,"TaxiPath.dbc");
for(uint32 i = 1; i < sTaxiPathStore.GetNumRows(); ++i)
if(TaxiPathEntry const* entry = sTaxiPathStore.LookupEntry(i))
sTaxiPathSetBySource[entry->from][entry->to] = TaxiPathBySourceAndDestination(entry->ID,entry->price);
uint32 pathCount = sTaxiPathStore.GetNumRows();
//## TaxiPathNode.dbc ## Loaded only for initialization different structures
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sTaxiPathNodeStore, dbcPath,"TaxiPathNode.dbc");
// Calculate path nodes count
std::vector<uint32> pathLength;
pathLength.resize(pathCount); // 0 and some other indexes not used
for(uint32 i = 1; i < sTaxiPathNodeStore.GetNumRows(); ++i)
if(TaxiPathNodeEntry const* entry = sTaxiPathNodeStore.LookupEntry(i))
{
if (pathLength[entry->path] < entry->index + 1)
pathLength[entry->path] = entry->index + 1;
}
// Set path length
sTaxiPathNodesByPath.resize(pathCount); // 0 and some other indexes not used
for(uint32 i = 1; i < sTaxiPathNodesByPath.size(); ++i)
sTaxiPathNodesByPath[i].resize(pathLength[i]);
// fill data
for(uint32 i = 1; i < sTaxiPathNodeStore.GetNumRows(); ++i)
if(TaxiPathNodeEntry const* entry = sTaxiPathNodeStore.LookupEntry(i))
sTaxiPathNodesByPath[entry->path][entry->index] = TaxiPathNode(entry->mapid,entry->x,entry->y,entry->z,entry->actionFlag,entry->delay);
sTaxiPathNodeStore.Clear();
// Initialize global taxinodes mask
// include existed nodes that have at least single not spell base (scripted) path
{
std::set<uint32> spellPaths;
for(uint32 i = 1; i < sSpellStore.GetNumRows (); ++i)
if(SpellEntry const* sInfo = sSpellStore.LookupEntry (i))
for(int j=0; j < 3; ++j)
if(sInfo->Effect[j]==123 /*SPELL_EFFECT_SEND_TAXI*/)
spellPaths.insert(sInfo->EffectMiscValue[j]);
memset(sTaxiNodesMask,0,sizeof(sTaxiNodesMask));
for(uint32 i = 1; i < sTaxiNodesStore.GetNumRows(); ++i)
{
if(!sTaxiNodesStore.LookupEntry(i))
continue;
TaxiPathSetBySource::const_iterator src_i = sTaxiPathSetBySource.find(i);
if(src_i!=sTaxiPathSetBySource.end() && !src_i->second.empty())
{
bool ok = false;
for(TaxiPathSetForSource::const_iterator dest_i = src_i->second.begin();dest_i != src_i->second.end(); ++dest_i)
{
// not spell path
if(spellPaths.find(dest_i->second.ID)==spellPaths.end())
{
ok = true;
break;
}
}
if(!ok)
continue;
}
// valid taxi netowrk node
uint8 field = (uint8)((i - 1) / 32);
uint32 submask = 1<<((i-1)%32);
sTaxiNodesMask[field] |= submask;
}
}
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sTotemCategoryStore, dbcPath,"TotemCategory.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sVehicleStore, dbcPath,"Vehicle.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sVehicleSeatStore, dbcPath,"VehicleSeat.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sWorldMapAreaStore, dbcPath,"WorldMapArea.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sWorldSafeLocsStore, dbcPath,"WorldSafeLocs.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sWorldMapOverlayStore, dbcPath,"WorldMapOverlay.dbc");
// error checks
if(bad_dbc_files.size() >= DBCFilesCount )
{
sLog.outError("\nIncorrect DataDir value in mangosd.conf or ALL required *.dbc files (%d) not found by path: %sdbc",DBCFilesCount,dataPath.c_str());
exit(1);
}
else if(!bad_dbc_files.empty() )
{
std::string str;
for(std::list<std::string>::iterator i = bad_dbc_files.begin(); i != bad_dbc_files.end(); ++i)
str += *i + "\n";
sLog.outError("\nSome required *.dbc files (%u from %d) not found or not compatible:\n%s",(uint32)bad_dbc_files.size(),DBCFilesCount,str.c_str());
exit(1);
}
// Check loaded DBC files proper version
if( !sSpellStore.LookupEntry(100034) || // last added spell in 3.1.0
!sMapStore.LookupEntry(624) || // last map added in 3.1.0
!sGemPropertiesStore.LookupEntry(1557) || // last gem property added in 3.1.0
!sItemExtendedCostStore.LookupEntry(2595) || // last item extended cost added in 3.1.0
!sCharTitlesStore.LookupEntry(154) || // last char title added in 3.1.0
!sAreaStore.LookupEntry(2833) || // last area (areaflag) added in 3.1.0
!sItemStore.LookupEntry(45704) ) // last client known item added in 3.1.0
{
sLog.outError("\nYou have _outdated_ DBC files. Please extract correct versions from current using client.");
exit(1);
}
sLog.outString();
sLog.outString( ">> Initialized %d data stores", DBCFilesCount );
}
SimpleFactionsList const* GetFactionTeamList(uint32 faction)
{
FactionTeamMap::const_iterator itr = sFactionTeamMap.find(faction);
if(itr==sFactionTeamMap.end())
return NULL;
return &itr->second;
}
char* GetPetName(uint32 petfamily, uint32 dbclang)
{
if(!petfamily)
return NULL;
CreatureFamilyEntry const *pet_family = sCreatureFamilyStore.LookupEntry(petfamily);
if(!pet_family)
return NULL;
return pet_family->Name[dbclang]?pet_family->Name[dbclang]:NULL;
}
TalentSpellPos const* GetTalentSpellPos(uint32 spellId)
{
TalentSpellPosMap::const_iterator itr = sTalentSpellPosMap.find(spellId);
if(itr==sTalentSpellPosMap.end())
return NULL;
return &itr->second;
}
uint32 GetTalentSpellCost(uint32 spellId)
{
if(TalentSpellPos const* pos = GetTalentSpellPos(spellId))
return pos->rank+1;
return 0;
}
int32 GetAreaFlagByAreaID(uint32 area_id)
{
AreaFlagByAreaID::iterator i = sAreaFlagByAreaID.find(area_id);
if(i == sAreaFlagByAreaID.end())
return -1;
return i->second;
}
AreaTableEntry const* GetAreaEntryByAreaID(uint32 area_id)
{
int32 areaflag = GetAreaFlagByAreaID(area_id);
if(areaflag < 0)
return NULL;
return sAreaStore.LookupEntry(areaflag );
}
AreaTableEntry const* GetAreaEntryByAreaFlagAndMap(uint32 area_flag,uint32 map_id)
{
if(area_flag)
return sAreaStore.LookupEntry(area_flag);
if(MapEntry const* mapEntry = sMapStore.LookupEntry(map_id))
return GetAreaEntryByAreaID(mapEntry->linked_zone);
return NULL;
}
uint32 GetAreaFlagByMapId(uint32 mapid)
{
AreaFlagByMapID::iterator i = sAreaFlagByMapID.find(mapid);
if(i == sAreaFlagByMapID.end())
return 0;
else
return i->second;
}
uint32 GetVirtualMapForMapAndZone(uint32 mapid, uint32 zoneId)
{
if(mapid != 530 && mapid != 571) // speed for most cases
return mapid;
if(WorldMapAreaEntry const* wma = sWorldMapAreaStore.LookupEntry(zoneId))
return wma->virtual_map_id >= 0 ? wma->virtual_map_id : wma->map_id;
return mapid;
}
ContentLevels GetContentLevelsForMapAndZone(uint32 mapid, uint32 zoneId)
{
mapid = GetVirtualMapForMapAndZone(mapid,zoneId);
if(mapid < 2)
return CONTENT_1_60;
MapEntry const* mapEntry = sMapStore.LookupEntry(mapid);
if(!mapEntry)
return CONTENT_1_60;
switch(mapEntry->Expansion())
{
default: return CONTENT_1_60;
case 1: return CONTENT_61_70;
case 2: return CONTENT_71_80;
}
}
ChatChannelsEntry const* GetChannelEntryFor(uint32 channel_id)
{
// not sorted, numbering index from 0
for(uint32 i = 0; i < sChatChannelsStore.GetNumRows(); ++i)
{
ChatChannelsEntry const* ch = sChatChannelsStore.LookupEntry(i);
if(ch && ch->ChannelID == channel_id)
return ch;
}
return NULL;
}
bool IsTotemCategoryCompatiableWith(uint32 itemTotemCategoryId, uint32 requiredTotemCategoryId)
{
if(requiredTotemCategoryId==0)
return true;
if(itemTotemCategoryId==0)
return false;
TotemCategoryEntry const* itemEntry = sTotemCategoryStore.LookupEntry(itemTotemCategoryId);
if(!itemEntry)
return false;
TotemCategoryEntry const* reqEntry = sTotemCategoryStore.LookupEntry(requiredTotemCategoryId);
if(!reqEntry)
return false;
if(itemEntry->categoryType!=reqEntry->categoryType)
return false;
return (itemEntry->categoryMask & reqEntry->categoryMask)==reqEntry->categoryMask;
}
void Zone2MapCoordinates(float& x,float& y,uint32 zone)
{
WorldMapAreaEntry const* maEntry = sWorldMapAreaStore.LookupEntry(zone);
// if not listed then map coordinates (instance)
if(!maEntry)
return;
std::swap(x,y); // at client map coords swapped
x = x*((maEntry->x2-maEntry->x1)/100)+maEntry->x1;
y = y*((maEntry->y2-maEntry->y1)/100)+maEntry->y1; // client y coord from top to down
}
void Map2ZoneCoordinates(float& x,float& y,uint32 zone)
{
WorldMapAreaEntry const* maEntry = sWorldMapAreaStore.LookupEntry(zone);
// if not listed then map coordinates (instance)
if(!maEntry)
return;
x = (x-maEntry->x1)/((maEntry->x2-maEntry->x1)/100);
y = (y-maEntry->y1)/((maEntry->y2-maEntry->y1)/100); // client y coord from top to down
std::swap(x,y); // client have map coords swapped
}
uint32 const* GetTalentTabPages(uint32 cls)
{
return sTalentTabPages[cls];
}
// script support functions
MANGOS_DLL_SPEC DBCStorage <SoundEntriesEntry> const* GetSoundEntriesStore() { return &sSoundEntriesStore; }
MANGOS_DLL_SPEC DBCStorage <SpellEntry> const* GetSpellStore() { return &sSpellStore; }
MANGOS_DLL_SPEC DBCStorage <SpellRangeEntry> const* GetSpellRangeStore() { return &sSpellRangeStore; }
MANGOS_DLL_SPEC DBCStorage <FactionEntry> const* GetFactionStore() { return &sFactionStore; }
MANGOS_DLL_SPEC DBCStorage <ItemEntry> const* GetItemDisplayStore() { return &sItemStore; }
MANGOS_DLL_SPEC DBCStorage <CreatureDisplayInfoEntry> const* GetCreatureDisplayStore() { return &sCreatureDisplayInfoStore; }

153
src/game/DBCStores.h Normal file
View file

@ -0,0 +1,153 @@
/*
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef MANGOS_DBCSTORES_H
#define MANGOS_DBCSTORES_H
#include "Common.h"
#include "Database/DBCStore.h"
#include "DBCStructure.h"
#include <list>
typedef std::list<uint32> SimpleFactionsList;
SimpleFactionsList const* GetFactionTeamList(uint32 faction);
char* GetPetName(uint32 petfamily, uint32 dbclang);
uint32 GetTalentSpellCost(uint32 spellId);
TalentSpellPos const* GetTalentSpellPos(uint32 spellId);
int32 GetAreaFlagByAreaID(uint32 area_id); // -1 if not found
AreaTableEntry const* GetAreaEntryByAreaID(uint32 area_id);
AreaTableEntry const* GetAreaEntryByAreaFlagAndMap(uint32 area_flag,uint32 map_id);
uint32 GetAreaFlagByMapId(uint32 mapid);
uint32 GetVirtualMapForMapAndZone(uint32 mapid, uint32 zoneId);
enum ContentLevels
{
CONTENT_1_60 = 0,
CONTENT_61_70,
CONTENT_71_80
};
ContentLevels GetContentLevelsForMapAndZone(uint32 mapid, uint32 zoneId);
ChatChannelsEntry const* GetChannelEntryFor(uint32 channel_id);
bool IsTotemCategoryCompatiableWith(uint32 itemTotemCategoryId, uint32 requiredTotemCategoryId);
void Zone2MapCoordinates(float& x,float& y,uint32 zone);
void Map2ZoneCoordinates(float& x,float& y,uint32 zone);
uint32 const* /*[3]*/ GetTalentTabPages(uint32 cls);
extern DBCStorage <AchievementEntry> sAchievementStore;
extern DBCStorage <AchievementCriteriaEntry> sAchievementCriteriaStore;
extern DBCStorage <AreaTableEntry> sAreaStore;// recommend access using functions
extern DBCStorage <AreaGroupEntry> sAreaGroupStore;
extern DBCStorage <AreaTriggerEntry> sAreaTriggerStore;
extern DBCStorage <AuctionHouseEntry> sAuctionHouseStore;
extern DBCStorage <BankBagSlotPricesEntry> sBankBagSlotPricesStore;
extern DBCStorage <BarberShopStyleEntry> sBarberShopStyleStore;
extern DBCStorage <BattlemasterListEntry> sBattlemasterListStore;
//extern DBCStorage <ChatChannelsEntry> sChatChannelsStore; -- accessed using function, no usable index
extern DBCStorage <CharStartOutfitEntry> sCharStartOutfitStore;
extern DBCStorage <CharTitlesEntry> sCharTitlesStore;
extern DBCStorage <ChrClassesEntry> sChrClassesStore;
extern DBCStorage <ChrRacesEntry> sChrRacesStore;
extern DBCStorage <CreatureDisplayInfoEntry> sCreatureDisplayInfoStore;
extern DBCStorage <CreatureFamilyEntry> sCreatureFamilyStore;
extern DBCStorage <CreatureSpellDataEntry> sCreatureSpellDataStore;
extern DBCStorage <CreatureTypeEntry> sCreatureTypeStore;
extern DBCStorage <CurrencyTypesEntry> sCurrencyTypesStore;
extern DBCStorage <DurabilityCostsEntry> sDurabilityCostsStore;
extern DBCStorage <DurabilityQualityEntry> sDurabilityQualityStore;
extern DBCStorage <EmotesTextEntry> sEmotesTextStore;
extern DBCStorage <FactionEntry> sFactionStore;
extern DBCStorage <FactionTemplateEntry> sFactionTemplateStore;
extern DBCStorage <GemPropertiesEntry> sGemPropertiesStore;
extern DBCStorage <GlyphPropertiesEntry> sGlyphPropertiesStore;
extern DBCStorage <GlyphSlotEntry> sGlyphSlotStore;
extern DBCStorage <GtBarberShopCostBaseEntry> sGtBarberShopCostBaseStore;
extern DBCStorage <GtCombatRatingsEntry> sGtCombatRatingsStore;
extern DBCStorage <GtChanceToMeleeCritBaseEntry> sGtChanceToMeleeCritBaseStore;
extern DBCStorage <GtChanceToMeleeCritEntry> sGtChanceToMeleeCritStore;
extern DBCStorage <GtChanceToSpellCritBaseEntry> sGtChanceToSpellCritBaseStore;
extern DBCStorage <GtChanceToSpellCritEntry> sGtChanceToSpellCritStore;
extern DBCStorage <GtOCTRegenHPEntry> sGtOCTRegenHPStore;
//extern DBCStorage <GtOCTRegenMPEntry> sGtOCTRegenMPStore; -- not used currently
extern DBCStorage <GtRegenHPPerSptEntry> sGtRegenHPPerSptStore;
extern DBCStorage <GtRegenMPPerSptEntry> sGtRegenMPPerSptStore;
extern DBCStorage <HolidaysEntry> sHolidaysStore;
extern DBCStorage <ItemEntry> sItemStore;
extern DBCStorage <ItemBagFamilyEntry> sItemBagFamilyStore;
//extern DBCStorage <ItemDisplayInfoEntry> sItemDisplayInfoStore; -- not used currently
extern DBCStorage <ItemExtendedCostEntry> sItemExtendedCostStore;
extern DBCStorage <ItemLimitCategoryEntry> sItemLimitCategoryStore;
extern DBCStorage <ItemRandomPropertiesEntry> sItemRandomPropertiesStore;
extern DBCStorage <ItemRandomSuffixEntry> sItemRandomSuffixStore;
extern DBCStorage <ItemSetEntry> sItemSetStore;
extern DBCStorage <LockEntry> sLockStore;
extern DBCStorage <MailTemplateEntry> sMailTemplateStore;
extern DBCStorage <MapEntry> sMapStore;
extern DBCStorage <QuestSortEntry> sQuestSortStore;
extern DBCStorage <RandomPropertiesPointsEntry> sRandomPropertiesPointsStore;
extern DBCStorage <ScalingStatDistributionEntry> sScalingStatDistributionStore;
extern DBCStorage <ScalingStatValuesEntry> sScalingStatValuesStore;
extern DBCStorage <SkillLineEntry> sSkillLineStore;
extern DBCStorage <SkillLineAbilityEntry> sSkillLineAbilityStore;
extern DBCStorage <SoundEntriesEntry> sSoundEntriesStore;
extern DBCStorage <SpellCastTimesEntry> sSpellCastTimesStore;
extern DBCStorage <SpellDurationEntry> sSpellDurationStore;
extern DBCStorage <SpellFocusObjectEntry> sSpellFocusObjectStore;
extern DBCStorage <SpellItemEnchantmentEntry> sSpellItemEnchantmentStore;
extern DBCStorage <SpellItemEnchantmentConditionEntry> sSpellItemEnchantmentConditionStore;
extern SpellCategoryStore sSpellCategoryStore;
extern PetFamilySpellsStore sPetFamilySpellsStore;
extern DBCStorage <SpellRadiusEntry> sSpellRadiusStore;
extern DBCStorage <SpellRangeEntry> sSpellRangeStore;
extern DBCStorage <SpellRuneCostEntry> sSpellRuneCostStore;
extern DBCStorage <SpellShapeshiftEntry> sSpellShapeshiftStore;
extern DBCStorage <SpellEntry> sSpellStore;
extern DBCStorage <StableSlotPricesEntry> sStableSlotPricesStore;
//extern DBCStorage <SummonPropertiesEntry> sSummonPropertiesStore;
extern DBCStorage <TalentEntry> sTalentStore;
extern DBCStorage <TalentTabEntry> sTalentTabStore;
extern DBCStorage <TaxiNodesEntry> sTaxiNodesStore;
extern DBCStorage <TaxiPathEntry> sTaxiPathStore;
extern TaxiMask sTaxiNodesMask;
extern TaxiPathSetBySource sTaxiPathSetBySource;
extern TaxiPathNodesByPath sTaxiPathNodesByPath;
extern DBCStorage <TotemCategoryEntry> sTotemCategoryStore;
extern DBCStorage <VehicleEntry> sVehicleStore;
extern DBCStorage <VehicleSeatEntry> sVehicleSeatStore;
//extern DBCStorage <WorldMapAreaEntry> sWorldMapAreaStore; -- use Zone2MapCoordinates and Map2ZoneCoordinates
extern DBCStorage <WorldSafeLocsEntry> sWorldSafeLocsStore;
extern DBCStorage <WorldMapOverlayEntry> sWorldMapOverlayStore;
void LoadDBCStores(const std::string& dataPath);
// script support functions
MANGOS_DLL_SPEC DBCStorage <SoundEntriesEntry> const* GetSoundEntriesStore();
MANGOS_DLL_SPEC DBCStorage <SpellEntry> const* GetSpellStore();
MANGOS_DLL_SPEC DBCStorage <SpellRangeEntry> const* GetSpellRangeStore();
MANGOS_DLL_SPEC DBCStorage <FactionEntry> const* GetFactionStore();
MANGOS_DLL_SPEC DBCStorage <ItemEntry> const* GetItemDisplayStore();
MANGOS_DLL_SPEC DBCStorage <CreatureDisplayInfoEntry> const* GetCreatureDisplayStore();
#endif

1671
src/game/DBCStructure.h Normal file

File diff suppressed because it is too large Load diff

104
src/game/DBCfmt.h Normal file
View file

@ -0,0 +1,104 @@
/*
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef MANGOS_DBCSFRM_H
#define MANGOS_DBCSFRM_H
const char Achievementfmt[]="niixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxiixixxxxxxxxxxxxxxxxxxxi";
const char AchievementCriteriafmt[]="niiiiiiiixxxxxxxxxxxxxxxxxiixix";
const char AreaTableEntryfmt[]="iiinixxxxxissssssssssssssssxixxxxxxx";
const char AreaGroupEntryfmt[]="niiiiiii";
const char AreaTriggerEntryfmt[]="niffffffff";
const char AuctionHouseEntryfmt[]="niiixxxxxxxxxxxxxxxxx";
const char BankBagSlotPricesEntryfmt[]="ni";
const char BarberShopStyleEntryfmt[]="nixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxiii";
const char BattlemasterListEntryfmt[]="niiiiiiiiiiiixxxssssssssssssssssxxx";
const char CharStartOutfitEntryfmt[]="diiiiiiiiiiiiiiiiiiiiiiiiixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
const char CharTitlesEntryfmt[]="nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxi";
const char ChatChannelsEntryfmt[]="iixssssssssssssssssxxxxxxxxxxxxxxxxxx";
// ChatChannelsEntryfmt, index not used (more compact store)
const char ChrClassesEntryfmt[]="nxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxixii";
const char ChrRacesEntryfmt[]="nxixiixxixxxxissssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxi";
const char CreatureDisplayInfofmt[]="nxxxfxxxxxxxxxxx";
const char CreatureFamilyfmt[]="nfifiiiiixssssssssssssssssxx";
const char CreatureSpellDatafmt[]="nxxxxxxxx";
const char CreatureTypefmt[]="nxxxxxxxxxxxxxxxxxx";
const char CurrencyTypesfmt[]="xnxi";
const char DurabilityCostsfmt[]="niiiiiiiiiiiiiiiiiiiiiiiiiiiii";
const char DurabilityQualityfmt[]="nf";
const char EmoteEntryfmt[]="nxixxxxxxxxxxxxxxxx";
const char FactionEntryfmt[]="niiiiiiiiiiiiiiiiiissssssssssssssssxxxxxxxxxxxxxxxxxx";
const char FactionTemplateEntryfmt[]="niiiiiiiiiiiii";
const char GemPropertiesEntryfmt[]="nixxi";
const char GlyphPropertiesfmt[]="niii";
const char GlyphSlotfmt[]="nii";
const char GtBarberShopCostBasefmt[]="f";
const char GtCombatRatingsfmt[]="f";
const char GtChanceToMeleeCritBasefmt[]="f";
const char GtChanceToMeleeCritfmt[]="f";
const char GtChanceToSpellCritBasefmt[]="f";
const char GtChanceToSpellCritfmt[]="f";
const char GtOCTRegenHPfmt[]="f";
//const char GtOCTRegenMPfmt[]="f";
const char GtRegenHPPerSptfmt[]="f";
const char GtRegenMPPerSptfmt[]="f";
const char Holidaysfmt[]="nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
const char Itemfmt[]="nixiiiii";
const char ItemBagFamilyfmt[]="nxxxxxxxxxxxxxxxxx";
//const char ItemDisplayTemplateEntryfmt[]="nxxxxxxxxxxixxxxxxxxxxx";
//const char ItemCondExtCostsEntryfmt[]="xiii";
const char ItemExtendedCostEntryfmt[]="niiiiiiiiiiiiix";
const char ItemLimitCategoryEntryfmt[]="nxxxxxxxxxxxxxxxxxix";
const char ItemRandomPropertiesfmt[]="nxiiiiixxxxxxxxxxxxxxxxx";
const char ItemRandomSuffixfmt[]="nxxxxxxxxxxxxxxxxxxiiiiiiiiii";
const char ItemSetEntryfmt[]="dssssssssssssssssxxxxxxxxxxxxxxxxxxiiiiiiiiiiiiiiiiii";
const char LockEntryfmt[]="niiiiiiiiiiiiiiiiiiiiiiiixxxxxxxx";
const char MailTemplateEntryfmt[]="nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
const char MapEntryfmt[]="nxixssssssssssssssssxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxiffiixxix";
const char QuestSortEntryfmt[]="nxxxxxxxxxxxxxxxxx";
const char RandomPropertiesPointsfmt[]="niiiiiiiiiiiiiii";
const char ScalingStatDistributionfmt[]="niiiiiiiiiiiiiiiiiiiii";
const char ScalingStatValuesfmt[]="iniiiiiiiiiiiiiiiii";
const char SkillLinefmt[]="nixssssssssssssssssxxxxxxxxxxxxxxxxxxixxxxxxxxxxxxxxxxxx";
const char SkillLineAbilityfmt[]="niiiixxiiiiixx";
const char SoundEntriesfmt[]="nxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
const char SpellCastTimefmt[]="nixx";
const char SpellDurationfmt[]="niii";
const char SpellEntryfmt[]="niiiiiiiiixiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiifxiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiffffffiiiiiiiiiiiiiiiiiiiiifffiiiiiiiiiiiiiiifffiiiiiiiiiiiiixssssssssssssssssxssssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxiiiiiiiiiiixfffxxxiiiiixx";
const char SpellFocusObjectfmt[]="nxxxxxxxxxxxxxxxxx";
const char SpellItemEnchantmentfmt[]="nxiiiiiixxxiiissssssssssssssssxiiiixxx";
const char SpellItemEnchantmentConditionfmt[]="nbbbbbxxxxxbbbbbbbbbbiiiiiXXXXX";
const char SpellRadiusfmt[]="nfxf";
const char SpellRangefmt[]="nfxfxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
const char SpellRuneCostfmt[]="niiii";
const char SpellShapeshiftfmt[]="nxxxxxxxxxxxxxxxxxxiixixxxxxxxxxxxx";
const char StableSlotPricesfmt[] = "ni";
//const char SummonPropertiesfmt[] = "niiiii";
const char TalentEntryfmt[]="niiiiiiiixxxxixxixxxxxx";
const char TalentTabEntryfmt[]="nxxxxxxxxxxxxxxxxxxxiiix";
const char TaxiNodesEntryfmt[]="nifffxxxxxxxxxxxxxxxxxii";
const char TaxiPathEntryfmt[]="niii";
const char TaxiPathNodeEntryfmt[]="diiifffiixx";
const char TotemCategoryEntryfmt[]="nxxxxxxxxxxxxxxxxxii";
const char VehicleEntryfmt[]="niffffiiiiiiiifffffffffffffffssssfifixxx";
const char VehicleSeatEntryfmt[]="niiffffffffffiiiiiifffffffiiifffiiiiiiiffiiiiixxxxxxxxxxxx";
const char WorldMapAreaEntryfmt[]="xinxffffix";
const char WorldSafeLocsEntryfmt[]="nifffxxxxxxxxxxxxxxxxx";
const char WorldMapOverlayEntryfmt[]="nxiiiixxxxxxxxxxx";
#endif

View file

@ -19,7 +19,7 @@
#include "HostilRefManager.h"
#include "ThreatManager.h"
#include "Unit.h"
#include "Database/DBCStructure.h"
#include "DBCStructure.h"
#include "SpellMgr.h"
HostilRefManager::~HostilRefManager()

View file

@ -2066,7 +2066,7 @@ bool ChatHandler::HandleModifyMorphCommand(const char* args)
//kick player
bool ChatHandler::HandleKickPlayerCommand(const char *args)
{
if (!args)
if (!*args)
{
Player* player = getSelectedPlayer();

View file

@ -3556,7 +3556,7 @@ bool ChatHandler::HandleNpcAllowMovementCommand(const char* /*args*/)
bool ChatHandler::HandleNpcChangeEntryCommand(const char *args)
{
if(!args)
if (!*args)
return false;
uint32 newEntryNum = atoi(args);
@ -5047,7 +5047,7 @@ bool ChatHandler::HandleBanIPCommand(const char* args)
bool ChatHandler::HandleBanHelper(BanMode mode, const char* args)
{
if(!args)
if (!*args)
return false;
char* cnameOrIP = strtok ((char*)args, " ");
@ -5135,7 +5135,7 @@ bool ChatHandler::HandleUnBanIPCommand(const char* args)
bool ChatHandler::HandleUnBanHelper(BanMode mode, const char* args)
{
if(!args)
if (!*args)
return false;
char* cnameOrIP = strtok ((char*)args, " ");
@ -5178,7 +5178,7 @@ bool ChatHandler::HandleUnBanHelper(BanMode mode, const char* args)
bool ChatHandler::HandleBanInfoAccountCommand(const char* args)
{
if(!args)
if (!*args)
return false;
char* cname = strtok((char*)args, "");
@ -5205,7 +5205,7 @@ bool ChatHandler::HandleBanInfoAccountCommand(const char* args)
bool ChatHandler::HandleBanInfoCharacterCommand(const char* args)
{
if(!args)
if (!*args)
return false;
std::string name = extractPlayerNameFromLink((char*)args);
@ -5264,7 +5264,7 @@ bool ChatHandler::HandleBanInfoHelper(uint32 accountid, char const* accountname)
bool ChatHandler::HandleBanInfoIPCommand(const char* args)
{
if(!args)
if (!*args)
return false;
char* cIP = strtok ((char*)args, "");
@ -5533,7 +5533,7 @@ bool ChatHandler::HandleRespawnCommand(const char* /*args*/)
bool ChatHandler::HandleGMFlyModeCommand(const char* args)
{
if(!args)
if (!*args)
return false;
Player *target = getSelectedPlayer();
@ -5559,7 +5559,7 @@ bool ChatHandler::HandleGMFlyModeCommand(const char* args)
bool ChatHandler::HandlePDumpLoadCommand(const char *args)
{
if(!args)
if (!*args)
return false;
char * file = strtok((char*)args, " ");
@ -5670,7 +5670,7 @@ bool ChatHandler::HandlePDumpLoadCommand(const char *args)
bool ChatHandler::HandlePDumpWriteCommand(const char *args)
{
if(!args)
if (!*args)
return false;
char* file = strtok((char*)args, " ");

View file

@ -27,7 +27,7 @@
#include "UpdateMask.h"
#include "Unit.h"
#include "Language.h"
#include "Database/DBCStores.h"
#include "DBCStores.h"
void MailItem::deleteItem( bool inDB )
{

View file

@ -97,6 +97,11 @@ libmangosgame_a_SOURCES = \
CreatureAISelector.h \
Creature.cpp \
Creature.h \
DBCEnums.h \
DBCfmt.h \
DBCStores.cpp \
DBCStores.h \
DBCStructure.h \
debugcmds.cpp \
DestinationHolder.cpp \
DestinationHolder.h \

View file

@ -24,7 +24,7 @@
#include "zthread/Lockable.h"
#include "zthread/Mutex.h"
#include "zthread/FairReadWriteLock.h"
#include "Database/DBCStructure.h"
#include "DBCStructure.h"
#include "GridDefines.h"
#include "Cell.h"
#include "Object.h"

View file

@ -20,7 +20,7 @@
#include "Errors.h"
#include "Pet.h"
#include "Player.h"
#include "Database/DBCStores.h"
#include "DBCStores.h"
#include "Spell.h"
#include "ObjectAccessor.h"
#include "SpellMgr.h"

View file

@ -343,8 +343,6 @@ Player::Player (WorldSession *session): Unit(), m_achievementMgr(this), m_reputa
m_DailyQuestChanged = false;
m_lastDailyQuestTime = 0;
m_regenTimer = 0;
m_weaponChangeTimer = 0;
for (int i=0; i<MAX_TIMERS; i++)
m_MirrorTimer[i] = DISABLED_MIRROR_TIMER;
@ -1098,8 +1096,6 @@ void Player::Update( uint32 p_time )
UpdateAfkReport(now);
CheckExploreSystem();
// Update items that have just a limited lifetime
if (now>m_Last_tick)
UpdateItemDuration(uint32(now- m_Last_tick));
@ -17454,13 +17450,14 @@ void Player::LeaveBattleground(bool teleportToEntryPoint)
{
if(BattleGround *bg = GetBattleGround())
{
bool need_debuf = bg->isBattleGround() && (bg->GetStatus() == STATUS_IN_PROGRESS) && sWorld.getConfig(CONFIG_BATTLEGROUND_CAST_DESERTER);
bg->RemovePlayerAtLeave(GetGUID(), teleportToEntryPoint, true);
// call after remove to be sure that player resurrected for correct cast
if(need_debuf)
CastSpell(this, 26013, true); // Deserter
if( bg->isBattleGround() && sWorld.getConfig(CONFIG_BATTLEGROUND_CAST_DESERTER) )
{
if( bg->GetStatus() == STATUS_IN_PROGRESS || bg->GetStatus() == STATUS_WAIT_JOIN )
CastSpell(this, 26013, true); // Deserter
}
}
}

View file

@ -17,7 +17,7 @@
*/
#include "ReputationMgr.h"
#include "Database/DBCStores.h"
#include "DBCStores.h"
#include "Player.h"
#include "WorldPacket.h"
@ -198,6 +198,10 @@ void ReputationMgr::SendVisible(FactionState const* faction) const
void ReputationMgr::Initilize()
{
m_factions.clear();
m_visibleFactionCount = 0;
m_honoredFactionCount = 0;
m_reveredFactionCount = 0;
m_exaltedFactionCount = 0;
for(unsigned int i = 1; i < sFactionStore.GetNumRows(); i++)
{
@ -212,12 +216,17 @@ void ReputationMgr::Initilize()
newFaction.Flags = GetDefaultStateFlags(factionEntry);
newFaction.Changed = true;
if( newFaction.Flags & FACTION_FLAG_VISIBLE )
++m_visibleFactionCount;
UpdateRankCounters(REP_HOSTILE,GetBaseRank(factionEntry));
m_factions[newFaction.ReputationListID] = newFaction;
}
}
}
bool ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standing)
bool ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standing, bool incremental)
{
SimpleFactionsList const* flist = GetFactionTeamList(factionEntry->ID);
if (flist)
@ -227,89 +236,50 @@ bool ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standi
{
FactionEntry const *factionEntryCalc = sFactionStore.LookupEntry(*itr);
if(factionEntryCalc)
res = SetOneFactionReputation(factionEntryCalc, standing);
res = SetOneFactionReputation(factionEntryCalc, standing, incremental);
}
return res;
}
else
return SetOneFactionReputation(factionEntry, standing);
return SetOneFactionReputation(factionEntry, standing, incremental);
}
bool ReputationMgr::SetOneFactionReputation(FactionEntry const* factionEntry, int32 standing)
bool ReputationMgr::SetOneFactionReputation(FactionEntry const* factionEntry, int32 standing, bool incremental)
{
FactionStateList::iterator itr = m_factions.find(factionEntry->reputationListID);
if (itr != m_factions.end())
{
int32 BaseRep = GetBaseReputation(factionEntry);
if(incremental)
standing += itr->second.Standing + BaseRep;
if (standing > Reputation_Cap)
standing = Reputation_Cap;
else
if (standing < Reputation_Bottom)
standing = Reputation_Bottom;
else if (standing < Reputation_Bottom)
standing = Reputation_Bottom;
ReputationRank old_rank = ReputationToRank(itr->second.Standing + BaseRep);
ReputationRank new_rank = ReputationToRank(standing);
int32 BaseRep = GetBaseReputation(factionEntry);
itr->second.Standing = standing - BaseRep;
itr->second.Changed = true;
SetVisible(&itr->second);
if(ReputationToRank(standing) <= REP_HOSTILE)
if(new_rank <= REP_HOSTILE)
SetAtWar(&itr->second,true);
SendState(&itr->second);
m_player->ReputationChanged(factionEntry);
m_player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION,factionEntry->ID);
m_player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_EXALTED_REPUTATION,factionEntry->ID);
return true;
}
return false;
}
bool ReputationMgr::ModifyReputation(FactionEntry const* factionEntry, int32 standing)
{
SimpleFactionsList const* flist = GetFactionTeamList(factionEntry->ID);
if (flist)
{
bool res = false;
for (SimpleFactionsList::const_iterator itr = flist->begin();itr != flist->end();++itr)
{
FactionEntry const *factionEntryCalc = sFactionStore.LookupEntry(*itr);
if(factionEntryCalc)
res = ModifyOneFactionReputation(factionEntryCalc, standing);
}
return res;
}
else
return ModifyOneFactionReputation(factionEntry, standing);
}
bool ReputationMgr::ModifyOneFactionReputation(FactionEntry const* factionEntry, int32 standing)
{
FactionStateList::iterator itr = m_factions.find(factionEntry->reputationListID);
if (itr != m_factions.end())
{
int32 BaseRep = GetBaseReputation(factionEntry);
int32 new_rep = BaseRep + itr->second.Standing + standing;
if (new_rep > Reputation_Cap)
new_rep = Reputation_Cap;
else
if (new_rep < Reputation_Bottom)
new_rep = Reputation_Bottom;
if(ReputationToRank(new_rep) <= REP_HOSTILE)
SetAtWar(&itr->second,true);
itr->second.Standing = new_rep - BaseRep;
itr->second.Changed = true;
SetVisible(&itr->second);
SendState(&itr->second);
UpdateRankCounters(old_rank, new_rank);
m_player->ReputationChanged(factionEntry);
m_player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION,factionEntry->ID);
m_player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KNOWN_FACTIONS, factionEntry->ID);
m_player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION, factionEntry->ID);
m_player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_EXALTED_REPUTATION,factionEntry->ID);
m_player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_REVERED_REPUTATION,factionEntry->ID);
m_player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_HONORED_REPUTATION,factionEntry->ID);
return true;
}
@ -350,6 +320,8 @@ void ReputationMgr::SetVisible(FactionState* faction)
faction->Flags |= FACTION_FLAG_VISIBLE;
faction->Changed = true;
++m_visibleFactionCount;
SendVisible(faction);
}
@ -432,6 +404,12 @@ void ReputationMgr::LoadFromDB(QueryResult *result)
// update standing to current
faction->Standing = int32(fields[1].GetUInt32());
// update counters
int32 BaseRep = GetBaseReputation(factionEntry);
ReputationRank old_rank = ReputationToRank(BaseRep);
ReputationRank new_rank = ReputationToRank(BaseRep + faction->Standing);
UpdateRankCounters(old_rank,new_rank);
uint32 dbFactionFlags = fields[2].GetUInt32();
if( dbFactionFlags & FACTION_FLAG_VISIBLE )
@ -478,3 +456,20 @@ void ReputationMgr::SaveToDB()
}
CharacterDatabase.CommitTransaction();
}
void ReputationMgr::UpdateRankCounters( ReputationRank old_rank, ReputationRank new_rank )
{
if(old_rank >= REP_EXALTED)
--m_exaltedFactionCount;
if(old_rank >= REP_REVERED)
--m_reveredFactionCount;
if(old_rank >= REP_HONORED)
--m_honoredFactionCount;
if(new_rank >= REP_EXALTED)
++m_exaltedFactionCount;
if(new_rank >= REP_REVERED)
++m_reveredFactionCount;
if(new_rank >= REP_HONORED)
++m_honoredFactionCount;
}

View file

@ -21,7 +21,7 @@
#include "Common.h"
#include "SharedDefines.h"
#include "Database/DBCStructure.h"
#include "DBCStructure.h"
#include <map>
enum FactionFlags
@ -56,7 +56,8 @@ class QueryResult;
class ReputationMgr
{
public: // constructors and global modifiers
explicit ReputationMgr(Player* owner) : m_player(owner) {}
explicit ReputationMgr(Player* owner) : m_player(owner),
m_visibleFactionCount(0), m_honoredFactionCount(0), m_reveredFactionCount(0), m_exaltedFactionCount(0) {}
~ReputationMgr() {}
void SaveToDB();
@ -68,6 +69,11 @@ class ReputationMgr
static ReputationRank ReputationToRank(int32 standing);
public: // accessors
uint8 GetVisibleFactionCount() const { return m_visibleFactionCount; }
uint8 GetHonoredFactionCount() const { return m_honoredFactionCount; }
uint8 GetReveredFactionCount() const { return m_reveredFactionCount; }
uint8 GetExaltedFactionCount() const { return m_exaltedFactionCount; }
FactionStateList const& GetStateList() const { return m_factions; }
FactionState const* GetState(FactionEntry const* factionEntry) const
@ -95,8 +101,14 @@ class ReputationMgr
}
public: // modifiers
bool SetReputation(FactionEntry const* factionEntry, int32 standing);
bool ModifyReputation(FactionEntry const* factionEntry, int32 standing);
bool SetReputation(FactionEntry const* factionEntry, int32 standing)
{
return SetReputation(factionEntry, standing, false);
}
bool ModifyReputation(FactionEntry const* factionEntry, int32 standing)
{
return SetReputation(factionEntry, standing, true);
}
void SetVisible(FactionTemplateEntry const* factionTemplateEntry);
void SetVisible(FactionEntry const* factionEntry);
@ -114,16 +126,21 @@ class ReputationMgr
private: // internal helper functions
void Initilize();
uint32 GetDefaultStateFlags(const FactionEntry *factionEntry) const;
bool SetOneFactionReputation(FactionEntry const* factionEntry, int32 standing);
bool ModifyOneFactionReputation(FactionEntry const* factionEntry, int32 standing);
bool SetReputation(FactionEntry const* factionEntry, int32 standing, bool incremental);
bool SetOneFactionReputation(FactionEntry const* factionEntry, int32 standing, bool incremental);
void SetVisible(FactionState* faction);
void SetAtWar(FactionState* faction, bool atWar);
void SetInactive(FactionState* faction, bool inactive);
void SendVisible(FactionState const* faction) const;
void UpdateRankCounters( ReputationRank old_rank, ReputationRank new_rank );
private:
Player* m_player;
FactionStateList m_factions;
ForcedReactions m_forcedReactions;
uint8 m_visibleFactionCount :8;
uint8 m_honoredFactionCount :8;
uint8 m_reveredFactionCount :8;
uint8 m_exaltedFactionCount :8;
};
#endif

View file

@ -17,7 +17,7 @@
*/
#include "Common.h"
#include "Database/DBCStores.h"
#include "DBCStores.h"
#include "WorldPacket.h"
#include "WorldSession.h"
#include "ObjectMgr.h"

View file

@ -20,7 +20,7 @@
#include "ObjectMgr.h"
#include "SpellAuraDefines.h"
#include "ProgressBar.h"
#include "Database/DBCStores.h"
#include "DBCStores.h"
#include "World.h"
#include "Chat.h"
#include "Spell.h"

View file

@ -23,7 +23,7 @@
// For more high level function for sSpellStore data
#include "SharedDefines.h"
#include "Database/DBCStructure.h"
#include "DBCStructure.h"
#include "Database/SQLStorage.h"
#include "Utilities/UnorderedMap.h"

View file

@ -19,7 +19,7 @@
#include "TotemAI.h"
#include "Totem.h"
#include "Creature.h"
#include "Database/DBCStores.h"
#include "DBCStores.h"
#include "ObjectAccessor.h"
#include "SpellMgr.h"

View file

@ -24,7 +24,7 @@
#include "Path.h"
#include "WorldPacket.h"
#include "Database/DBCStores.h"
#include "DBCStores.h"
#include "ProgressBar.h"
void MapManager::LoadTransports()

View file

@ -31,7 +31,7 @@
#include "FollowerRefManager.h"
#include "Utilities/EventProcessor.h"
#include "MotionMaster.h"
#include "Database/DBCStructure.h"
#include "DBCStructure.h"
#include <list>
enum SpellInterruptFlags

View file

@ -40,7 +40,7 @@
#include "ObjectMgr.h"
#include "SpellMgr.h"
#include "Chat.h"
#include "Database/DBCStores.h"
#include "DBCStores.h"
#include "LootMgr.h"
#include "ItemEnchantmentMgr.h"
#include "MapManager.h"
@ -1367,8 +1367,8 @@ void World::SetInitialWorldSettings()
sprintf( isoDate, "%04d-%02d-%02d %02d:%02d:%02d",
local.tm_year+1900, local.tm_mon+1, local.tm_mday, local.tm_hour, local.tm_min, local.tm_sec);
WorldDatabase.PExecute("INSERT INTO uptime (startstring, starttime, uptime) VALUES('%s', " I64FMTD ", 0)",
isoDate, uint64(m_startTime));
loginDatabase.PExecute("INSERT INTO uptime (realmid, starttime, startstring, uptime) VALUES('%u', " I64FMTD ", '%s', 0)",
realmID, uint64(m_startTime), isoDate);
m_timers[WUPDATE_OBJECTS].SetInterval(0);
m_timers[WUPDATE_SESSIONS].SetInterval(0);
@ -1534,10 +1534,10 @@ void World::Update(uint32 diff)
if (m_timers[WUPDATE_UPTIME].Passed())
{
uint32 tmpDiff = (m_gameTime - m_startTime);
uint32 maxClientsNum = sWorld.GetMaxActiveSessionCount();
uint32 maxClientsNum = GetMaxActiveSessionCount();
m_timers[WUPDATE_UPTIME].Reset();
WorldDatabase.PExecute("UPDATE uptime SET uptime = %d, maxplayers = %d WHERE starttime = " I64FMTD, tmpDiff, maxClientsNum, uint64(m_startTime));
loginDatabase.PExecute("UPDATE uptime SET uptime = %u, maxplayers = %u WHERE realmid = %u AND starttime = " I64FMTD, tmpDiff, maxClientsNum, realmID, uint64(m_startTime));
}
/// <li> Handle all other objects