aboutsummaryrefslogtreecommitdiff
path: root/src/game/ObjectMgr.cpp
diff options
context:
space:
mode:
authormegamage <none@none>2008-12-24 11:18:01 -0600
committermegamage <none@none>2008-12-24 11:18:01 -0600
commit184b82abccfff95b18bed81ded1b5a7e98d2dbd3 (patch)
tree4329c771076612bc55e52febfb5f323a2f21007e /src/game/ObjectMgr.cpp
parent3cb4e7c716b11f357b3265257c51e7b6cc5c36f9 (diff)
Backed out changeset: ad4f100c0a9d
--HG-- branch : trunk
Diffstat (limited to 'src/game/ObjectMgr.cpp')
-rw-r--r--src/game/ObjectMgr.cpp150
1 files changed, 34 insertions, 116 deletions
diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp
index add9fa793af..594cfaf0877 100644
--- a/src/game/ObjectMgr.cpp
+++ b/src/game/ObjectMgr.cpp
@@ -116,7 +116,6 @@ ObjectMgr::ObjectMgr()
m_hiCharGuid = 1;
m_hiCreatureGuid = 1;
m_hiPetGuid = 1;
- m_hiVehicleGuid = 1;
m_hiItemGuid = 1;
m_hiGoGuid = 1;
m_hiDoGuid = 1;
@@ -642,22 +641,6 @@ void ObjectMgr::LoadCreatureLocales()
sLog.outString( ">> Loaded %u creature locale strings", mCreatureLocaleMap.size() );
}
-void ObjectMgr::LoadCompletedAchievements()
-{
- QueryResult *result = CharacterDatabase.Query("SELECT achievement FROM character_achievement GROUP BY achievement");
-
- if(!result)
- return;
-
- do
- {
- Field *fields = result->Fetch();
- allCompletedAchievements.insert(fields[0].GetUInt32());
- } while(result->NextRow());
-
- delete result;
-}
-
void ObjectMgr::LoadNpcOptionLocales()
{
mNpcOptionLocaleMap.clear(); // need for reload case
@@ -1020,47 +1003,8 @@ void ObjectMgr::LoadEquipmentTemplates()
{
sEquipmentStorage.Load();
- for(uint32 i=0; i< sEquipmentStorage.MaxEntry; ++i)
- {
- EquipmentInfo const* eqInfo = sEquipmentStorage.LookupEntry<EquipmentInfo>(i);
-
- if(!eqInfo)
- continue;
-
- for(uint8 j=0; j<3; j++)
- {
- if(!eqInfo->equipentry[j])
- continue;
-
- ItemEntry const *dbcitem = sItemStore.LookupEntry(eqInfo->equipentry[j]);
-
- if(!dbcitem)
- {
- sLog.outErrorDb("Unknown item (entry=%u) in creature_equip_template.equipentry%u for entry = %u, forced to 0.", eqInfo->equipentry[j], j+1, i);
- const_cast<EquipmentInfo*>(eqInfo)->equipentry[j] = 0;
- continue;
- }
-
- if(dbcitem->InventoryType != INVTYPE_WEAPON &&
- dbcitem->InventoryType != INVTYPE_SHIELD &&
- dbcitem->InventoryType != INVTYPE_RANGED &&
- dbcitem->InventoryType != INVTYPE_2HWEAPON &&
- dbcitem->InventoryType != INVTYPE_WEAPONMAINHAND &&
- dbcitem->InventoryType != INVTYPE_WEAPONOFFHAND &&
- dbcitem->InventoryType != INVTYPE_HOLDABLE &&
- dbcitem->InventoryType != INVTYPE_THROWN &&
- dbcitem->InventoryType != INVTYPE_RANGEDRIGHT)
- {
- sLog.outErrorDb("Item (entry=%u) in creature_equip_template.equipentry%u for entry = %u is not equipable in a hand, forced to 0.", eqInfo->equipentry[j], j+1, i);
- const_cast<EquipmentInfo*>(eqInfo)->equipentry[j] = 0;
- }
- }
- }
sLog.outString( ">> Loaded %u equipment template", sEquipmentStorage.RecordCount );
sLog.outString();
-
- // This DBC is currently only used for item templates and creature equipments checks.
- sItemStore.Clear();
}
CreatureModelInfo const* ObjectMgr::GetCreatureModelInfo(uint32 modelid)
@@ -1734,7 +1678,7 @@ void ObjectMgr::LoadItemPrototypes()
if(proto->Class >= MAX_ITEM_CLASS)
{
sLog.outErrorDb("Item (Entry: %u) has wrong Class value (%u)",i,proto->Class);
- const_cast<ItemPrototype*>(proto)->Class = ITEM_CLASS_MISC;
+ const_cast<ItemPrototype*>(proto)->Class = ITEM_CLASS_JUNK;
}
if(proto->SubClass >= MaxItemSubclassValues[proto->Class])
@@ -1831,7 +1775,7 @@ void ObjectMgr::LoadItemPrototypes()
}
// special format
- if((proto->Spells[0].SpellId == SPELL_ID_GENERIC_LEARN) || (proto->Spells[0].SpellId == SPELL_ID_GENERIC_LEARN_PET))
+ if(proto->Spells[0].SpellId == SPELL_ID_GENERIC_LEARN)
{
// spell_1
if(proto->Spells[0].SpellTrigger != ITEM_SPELLTRIGGER_ON_USE)
@@ -1868,7 +1812,7 @@ void ObjectMgr::LoadItemPrototypes()
const_cast<ItemPrototype*>(proto)->Spells[1].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE;
}
// allowed only in special format
- else if((proto->Spells[1].SpellId==SPELL_ID_GENERIC_LEARN) || (proto->Spells[1].SpellId==SPELL_ID_GENERIC_LEARN_PET))
+ else if(proto->Spells[1].SpellId==SPELL_ID_GENERIC_LEARN)
{
sLog.outErrorDb("Item (Entry: %u) has broken spell in spellid_%d (%u)",i,1+1,proto->Spells[1].SpellId);
const_cast<ItemPrototype*>(proto)->Spells[0].SpellId = 0;
@@ -1914,7 +1858,7 @@ void ObjectMgr::LoadItemPrototypes()
const_cast<ItemPrototype*>(proto)->Spells[j].SpellId = 0;
}
// allowed only in special format
- else if((proto->Spells[j].SpellId==SPELL_ID_GENERIC_LEARN) || (proto->Spells[j].SpellId==SPELL_ID_GENERIC_LEARN_PET))
+ else if(proto->Spells[j].SpellId==SPELL_ID_GENERIC_LEARN)
{
sLog.outErrorDb("Item (Entry: %u) has broken spell in spellid_%d (%u)",i,j+1,proto->Spells[j].SpellId);
const_cast<ItemPrototype*>(proto)->Spells[j].SpellId = 0;
@@ -1983,6 +1927,9 @@ void ObjectMgr::LoadItemPrototypes()
const_cast<ItemPrototype*>(proto)->FoodType = 0;
}
}
+
+ // this DBC used currently only for check item templates in DB.
+ sItemStore.Clear();
}
void ObjectMgr::LoadAuctionItems()
@@ -2972,31 +2919,31 @@ void ObjectMgr::LoadQuests()
QueryResult *result = WorldDatabase.Query("SELECT entry, Method, ZoneOrSort, SkillOrClass, MinLevel, QuestLevel, Type, RequiredRaces, RequiredSkillValue,"
// 9 10 11 12 13 14 15 16
"RepObjectiveFaction, RepObjectiveValue, RequiredMinRepFaction, RequiredMinRepValue, RequiredMaxRepFaction, RequiredMaxRepValue, SuggestedPlayers, LimitTime,"
- // 17 18 19 20 21 22 23 24 25 26 27 28
- "QuestFlags, SpecialFlags, CharTitleId, PlayersSlain, BonusTalents, PrevQuestId, NextQuestId, ExclusiveGroup, NextQuestInChain, SrcItemId, SrcItemCount, SrcSpell,"
- // 29 30 31 32 33 34 35 36 37 38
+ // 17 18 19 20 21 22 23 24 25 26
+ "QuestFlags, SpecialFlags, CharTitleId, PrevQuestId, NextQuestId, ExclusiveGroup, NextQuestInChain, SrcItemId, SrcItemCount, SrcSpell,"
+ // 27 28 29 30 31 32 33 34 35 36
"Title, Details, Objectives, OfferRewardText, RequestItemsText, EndText, ObjectiveText1, ObjectiveText2, ObjectiveText3, ObjectiveText4,"
- // 39 40 41 42 43 44 45 46
+ // 37 38 39 40 41 42 43 44
"ReqItemId1, ReqItemId2, ReqItemId3, ReqItemId4, ReqItemCount1, ReqItemCount2, ReqItemCount3, ReqItemCount4,"
- // 47 48 49 50 51 52 53 54 55 56 57 58
+ // 45 46 47 48 49 50 51 52 53 54 54 55
"ReqSourceId1, ReqSourceId2, ReqSourceId3, ReqSourceId4, ReqSourceCount1, ReqSourceCount2, ReqSourceCount3, ReqSourceCount4, ReqSourceRef1, ReqSourceRef2, ReqSourceRef3, ReqSourceRef4,"
- // 59 60 61 62 63 64 65 66
+ // 57 58 59 60 61 62 63 64
"ReqCreatureOrGOId1, ReqCreatureOrGOId2, ReqCreatureOrGOId3, ReqCreatureOrGOId4, ReqCreatureOrGOCount1, ReqCreatureOrGOCount2, ReqCreatureOrGOCount3, ReqCreatureOrGOCount4,"
- // 67 68 69 70
+ // 65 66 67 68
"ReqSpellCast1, ReqSpellCast2, ReqSpellCast3, ReqSpellCast4,"
- // 71 72 73 74 75 76
+ // 69 70 71 72 73 74
"RewChoiceItemId1, RewChoiceItemId2, RewChoiceItemId3, RewChoiceItemId4, RewChoiceItemId5, RewChoiceItemId6,"
- // 77 78 79 80 81 82
+ // 75 76 77 78 79 80
"RewChoiceItemCount1, RewChoiceItemCount2, RewChoiceItemCount3, RewChoiceItemCount4, RewChoiceItemCount5, RewChoiceItemCount6,"
- // 83 84 85 86 87 88 89 90
+ // 81 82 83 84 85 86 87 88
"RewItemId1, RewItemId2, RewItemId3, RewItemId4, RewItemCount1, RewItemCount2, RewItemCount3, RewItemCount4,"
- // 91 92 93 94 95 96 97 98 99 100
+ // 89 90 91 92 93 94 95 96 97 98
"RewRepFaction1, RewRepFaction2, RewRepFaction3, RewRepFaction4, RewRepFaction5, RewRepValue1, RewRepValue2, RewRepValue3, RewRepValue4, RewRepValue5,"
- // 101 102 103 104 105 106 107 108 109 110 111
+ // 99 100 101 102 103 104 105 106 107 108 109
"RewHonorableKills, RewOrReqMoney, RewMoneyMaxLevel, RewSpell, RewSpellCast, RewMailTemplateId, RewMailDelaySecs, PointMapId, PointX, PointY, PointOpt,"
- // 112 113 114 115 116 117 118 119 120 121
+ // 110 111 112 113 114 115 116 117 118 119
"DetailsEmote1, DetailsEmote2, DetailsEmote3, DetailsEmote4,IncompleteEmote, CompleteEmote, OfferRewardEmote1, OfferRewardEmote2, OfferRewardEmote3, OfferRewardEmote4,"
- // 122 123
+ // 120 121
"StartScript, CompleteScript"
" FROM quest_template");
if(result == NULL)
@@ -4829,19 +4776,17 @@ uint16 ObjectMgr::GetTaxiMount( uint32 id, uint32 team )
TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(id);
if(node)
{
- if (team == ALLIANCE)
- {
- mount_entry = node->MountCreatureID[1];
- CreatureInfo const *ci = GetCreatureTemplate(mount_entry);
- if(ci)
- mount_id = ci->Modelid1;
- }
- if (team == HORDE)
+ if (team == ALLIANCE) mount_entry = node->alliance_mount_type;
+ else mount_entry = node->horde_mount_type;
+
+ CreatureInfo const *cinfo = GetCreatureTemplate(mount_entry);
+ if (cinfo)
{
- mount_entry = node->MountCreatureID[0];
- CreatureInfo const *ci = GetCreatureTemplate(mount_entry);
- if(ci)
- mount_id = ci->Modelid3;
+ if(! (mount_id = cinfo->GetRandomValidModelId()))
+ {
+ sLog.outErrorDb("No displayid found for the taxi mount with the entry %u! Can't load it!", mount_entry);
+ return false;
+ }
}
}
@@ -5320,8 +5265,6 @@ void ObjectMgr::SetHighestGuids()
// pet guids are not saved to DB, set to 0 (pet guid != pet id)
m_hiPetGuid = 0;
- // same for vehicles
- m_hiVehicleGuid = 0;
result = CharacterDatabase.Query( "SELECT MAX(guid) FROM item_instance" );
if( result )
@@ -5475,14 +5418,6 @@ uint32 ObjectMgr::GenerateLowGuid(HighGuid guidhigh)
World::StopNow(ERROR_EXIT_CODE);
}
return m_hiPetGuid++;
- case HIGHGUID_VEHICLE:
- ++m_hiVehicleGuid;
- if(m_hiVehicleGuid>=0x00FFFFFF)
- {
- sLog.outError("Vehicle guid overflow!! Can't continue, shutting down server. ");
- World::StopNow(ERROR_EXIT_CODE);
- }
- return m_hiVehicleGuid++;
case HIGHGUID_PLAYER:
if(m_hiCharGuid>=0xFFFFFFFE)
{
@@ -6445,23 +6380,6 @@ int ObjectMgr::GetOrNewIndexForLocale( LocaleConstant loc )
return m_LocalForIndex.size()-1;
}
-AchievementCriteriaEntryList const& ObjectMgr::GetAchievementCriteriaByType(AchievementCriteriaTypes type)
-{
- return m_AchievementCriteriasByType[type];
-}
-
-void ObjectMgr::LoadAchievementCriteriaList()
-{
- for (uint32 entryId = 0; entryId<sAchievementCriteriaStore.GetNumRows(); entryId++)
- {
- AchievementCriteriaEntry const* criteria = sAchievementCriteriaStore.LookupEntry(entryId);
- if(!criteria)
- continue;
-
- m_AchievementCriteriasByType[criteria->requiredType].push_back(criteria);
- }
-}
-
void ObjectMgr::LoadBattleMastersEntry()
{
mBattleMastersMap.clear(); // need for reload case
@@ -6838,7 +6756,7 @@ bool PlayerCondition::Meets(Player const * player) const
{
Unit::AuraMap const& auras = player->GetAuras();
for(Unit::AuraMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
- if((itr->second->GetSpellProto()->Attributes & 0x1000010) && itr->second->GetSpellProto()->SpellVisual[0]==3580)
+ if((itr->second->GetSpellProto()->Attributes & 0x1000010) && itr->second->GetSpellProto()->SpellVisual==3580)
return true;
return false;
}
@@ -7015,7 +6933,7 @@ SkillRangeType GetSkillRangeType(SkillLineEntry const *pSkill, bool racial)
return SKILL_RANGE_MONO;
case SKILL_CATEGORY_ARMOR:
case SKILL_CATEGORY_CLASS:
- if(pSkill->id != SKILL_LOCKPICKING)
+ if(pSkill->id != SKILL_POISONS && pSkill->id != SKILL_LOCKPICKING)
return SKILL_RANGE_MONO;
else
return SKILL_RANGE_LEVEL;
@@ -7030,7 +6948,7 @@ SkillRangeType GetSkillRangeType(SkillLineEntry const *pSkill, bool racial)
return SKILL_RANGE_MONO;
default:
case SKILL_CATEGORY_ATTRIBUTES: //not found in dbc
- case SKILL_CATEGORY_GENERIC: //only GENERIC(DND)
+ case SKILL_CATEGORY_NOT_DISPLAYED: //only GENEREC(DND)
return SKILL_RANGE_NONE;
}
}